libv8 3.3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (700) hide show
  1. data/.gitignore +8 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +44 -0
  5. data/Rakefile +73 -0
  6. data/ext/libv8/extconf.rb +9 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +38 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  11. data/lib/libv8/scons/CHANGES.txt +5334 -0
  12. data/lib/libv8/scons/LICENSE.txt +20 -0
  13. data/lib/libv8/scons/MANIFEST +199 -0
  14. data/lib/libv8/scons/PKG-INFO +13 -0
  15. data/lib/libv8/scons/README.txt +243 -0
  16. data/lib/libv8/scons/RELEASE.txt +98 -0
  17. data/lib/libv8/scons/engine/SCons/Action.py +1241 -0
  18. data/lib/libv8/scons/engine/SCons/Builder.py +877 -0
  19. data/lib/libv8/scons/engine/SCons/CacheDir.py +216 -0
  20. data/lib/libv8/scons/engine/SCons/Conftest.py +793 -0
  21. data/lib/libv8/scons/engine/SCons/Debug.py +220 -0
  22. data/lib/libv8/scons/engine/SCons/Defaults.py +480 -0
  23. data/lib/libv8/scons/engine/SCons/Environment.py +2318 -0
  24. data/lib/libv8/scons/engine/SCons/Errors.py +205 -0
  25. data/lib/libv8/scons/engine/SCons/Executor.py +633 -0
  26. data/lib/libv8/scons/engine/SCons/Job.py +435 -0
  27. data/lib/libv8/scons/engine/SCons/Memoize.py +244 -0
  28. data/lib/libv8/scons/engine/SCons/Node/Alias.py +152 -0
  29. data/lib/libv8/scons/engine/SCons/Node/FS.py +3142 -0
  30. data/lib/libv8/scons/engine/SCons/Node/Python.py +128 -0
  31. data/lib/libv8/scons/engine/SCons/Node/__init__.py +1328 -0
  32. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +50 -0
  33. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +50 -0
  34. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +50 -0
  35. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +50 -0
  36. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +76 -0
  37. data/lib/libv8/scons/engine/SCons/Options/__init__.py +67 -0
  38. data/lib/libv8/scons/engine/SCons/PathList.py +231 -0
  39. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +241 -0
  40. data/lib/libv8/scons/engine/SCons/Platform/aix.py +69 -0
  41. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +55 -0
  42. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +46 -0
  43. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +46 -0
  44. data/lib/libv8/scons/engine/SCons/Platform/irix.py +44 -0
  45. data/lib/libv8/scons/engine/SCons/Platform/os2.py +58 -0
  46. data/lib/libv8/scons/engine/SCons/Platform/posix.py +263 -0
  47. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +50 -0
  48. data/lib/libv8/scons/engine/SCons/Platform/win32.py +385 -0
  49. data/lib/libv8/scons/engine/SCons/SConf.py +1030 -0
  50. data/lib/libv8/scons/engine/SCons/SConsign.py +383 -0
  51. data/lib/libv8/scons/engine/SCons/Scanner/C.py +132 -0
  52. data/lib/libv8/scons/engine/SCons/Scanner/D.py +73 -0
  53. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +109 -0
  54. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +316 -0
  55. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +48 -0
  56. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +384 -0
  57. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +101 -0
  58. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +55 -0
  59. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +413 -0
  60. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +384 -0
  61. data/lib/libv8/scons/engine/SCons/Script/Main.py +1334 -0
  62. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +939 -0
  63. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +640 -0
  64. data/lib/libv8/scons/engine/SCons/Script/__init__.py +412 -0
  65. data/lib/libv8/scons/engine/SCons/Sig.py +63 -0
  66. data/lib/libv8/scons/engine/SCons/Subst.py +904 -0
  67. data/lib/libv8/scons/engine/SCons/Taskmaster.py +1017 -0
  68. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +61 -0
  69. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +67 -0
  70. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +73 -0
  71. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +246 -0
  72. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +323 -0
  73. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  74. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  75. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +240 -0
  76. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +82 -0
  77. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +391 -0
  78. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +456 -0
  79. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +499 -0
  80. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +103 -0
  81. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +137 -0
  82. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +64 -0
  83. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +64 -0
  84. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +71 -0
  85. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +681 -0
  86. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +82 -0
  87. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +74 -0
  88. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +80 -0
  89. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +76 -0
  90. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +71 -0
  91. data/lib/libv8/scons/engine/SCons/Tool/ar.py +63 -0
  92. data/lib/libv8/scons/engine/SCons/Tool/as.py +78 -0
  93. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +81 -0
  94. data/lib/libv8/scons/engine/SCons/Tool/c++.py +99 -0
  95. data/lib/libv8/scons/engine/SCons/Tool/cc.py +102 -0
  96. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +58 -0
  97. data/lib/libv8/scons/engine/SCons/Tool/default.py +50 -0
  98. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +223 -0
  99. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +64 -0
  100. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +124 -0
  101. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +94 -0
  102. data/lib/libv8/scons/engine/SCons/Tool/f77.py +62 -0
  103. data/lib/libv8/scons/engine/SCons/Tool/f90.py +62 -0
  104. data/lib/libv8/scons/engine/SCons/Tool/f95.py +63 -0
  105. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +98 -0
  106. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +62 -0
  107. data/lib/libv8/scons/engine/SCons/Tool/g++.py +90 -0
  108. data/lib/libv8/scons/engine/SCons/Tool/g77.py +73 -0
  109. data/lib/libv8/scons/engine/SCons/Tool/gas.py +53 -0
  110. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +80 -0
  111. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +64 -0
  112. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +63 -0
  113. data/lib/libv8/scons/engine/SCons/Tool/gs.py +81 -0
  114. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +84 -0
  115. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +53 -0
  116. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +77 -0
  117. data/lib/libv8/scons/engine/SCons/Tool/icc.py +59 -0
  118. data/lib/libv8/scons/engine/SCons/Tool/icl.py +52 -0
  119. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +72 -0
  120. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +88 -0
  121. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +59 -0
  122. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +60 -0
  123. data/lib/libv8/scons/engine/SCons/Tool/install.py +229 -0
  124. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +482 -0
  125. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +67 -0
  126. data/lib/libv8/scons/engine/SCons/Tool/jar.py +110 -0
  127. data/lib/libv8/scons/engine/SCons/Tool/javac.py +230 -0
  128. data/lib/libv8/scons/engine/SCons/Tool/javah.py +137 -0
  129. data/lib/libv8/scons/engine/SCons/Tool/latex.py +79 -0
  130. data/lib/libv8/scons/engine/SCons/Tool/lex.py +97 -0
  131. data/lib/libv8/scons/engine/SCons/Tool/link.py +121 -0
  132. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +112 -0
  133. data/lib/libv8/scons/engine/SCons/Tool/m4.py +63 -0
  134. data/lib/libv8/scons/engine/SCons/Tool/masm.py +77 -0
  135. data/lib/libv8/scons/engine/SCons/Tool/midl.py +88 -0
  136. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +158 -0
  137. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +64 -0
  138. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +266 -0
  139. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +50 -0
  140. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +268 -0
  141. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +1388 -0
  142. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +207 -0
  143. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +107 -0
  144. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +72 -0
  145. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +312 -0
  146. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  147. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +527 -0
  148. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +365 -0
  149. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  150. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  151. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  152. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  153. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  154. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  155. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +78 -0
  156. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +83 -0
  157. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +108 -0
  158. data/lib/libv8/scons/engine/SCons/Tool/qt.py +336 -0
  159. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +120 -0
  160. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +70 -0
  161. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +132 -0
  162. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +68 -0
  163. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +58 -0
  164. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +53 -0
  165. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +63 -0
  166. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +67 -0
  167. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +142 -0
  168. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +58 -0
  169. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +63 -0
  170. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +64 -0
  171. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +64 -0
  172. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +77 -0
  173. data/lib/libv8/scons/engine/SCons/Tool/swig.py +182 -0
  174. data/lib/libv8/scons/engine/SCons/Tool/tar.py +73 -0
  175. data/lib/libv8/scons/engine/SCons/Tool/tex.py +813 -0
  176. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +175 -0
  177. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +53 -0
  178. data/lib/libv8/scons/engine/SCons/Tool/wix.py +99 -0
  179. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +130 -0
  180. data/lib/libv8/scons/engine/SCons/Tool/zip.py +99 -0
  181. data/lib/libv8/scons/engine/SCons/Util.py +1492 -0
  182. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +89 -0
  183. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +103 -0
  184. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +135 -0
  185. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +106 -0
  186. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +147 -0
  187. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +312 -0
  188. data/lib/libv8/scons/engine/SCons/Warnings.py +246 -0
  189. data/lib/libv8/scons/engine/SCons/__init__.py +49 -0
  190. data/lib/libv8/scons/engine/SCons/compat/__init__.py +237 -0
  191. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +150 -0
  192. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +45 -0
  193. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +45 -0
  194. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +76 -0
  195. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +45 -0
  196. data/lib/libv8/scons/engine/SCons/compat/_scons_sets.py +563 -0
  197. data/lib/libv8/scons/engine/SCons/compat/_scons_subprocess.py +1281 -0
  198. data/lib/libv8/scons/engine/SCons/cpp.py +589 -0
  199. data/lib/libv8/scons/engine/SCons/dblite.py +251 -0
  200. data/lib/libv8/scons/engine/SCons/exitfuncs.py +77 -0
  201. data/lib/libv8/scons/os_spawnv_fix.diff +83 -0
  202. data/lib/libv8/scons/scons-time.1 +1017 -0
  203. data/lib/libv8/scons/scons.1 +15219 -0
  204. data/lib/libv8/scons/sconsign.1 +208 -0
  205. data/lib/libv8/scons/script/scons +196 -0
  206. data/lib/libv8/scons/script/scons-time +1544 -0
  207. data/lib/libv8/scons/script/scons.bat +31 -0
  208. data/lib/libv8/scons/script/sconsign +513 -0
  209. data/lib/libv8/scons/setup.cfg +6 -0
  210. data/lib/libv8/scons/setup.py +425 -0
  211. data/lib/libv8/v8/.gitignore +35 -0
  212. data/lib/libv8/v8/AUTHORS +44 -0
  213. data/lib/libv8/v8/ChangeLog +2839 -0
  214. data/lib/libv8/v8/LICENSE +52 -0
  215. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  216. data/lib/libv8/v8/LICENSE.v8 +26 -0
  217. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  218. data/lib/libv8/v8/SConstruct +1478 -0
  219. data/lib/libv8/v8/build/README.txt +49 -0
  220. data/lib/libv8/v8/build/all.gyp +18 -0
  221. data/lib/libv8/v8/build/armu.gypi +32 -0
  222. data/lib/libv8/v8/build/common.gypi +144 -0
  223. data/lib/libv8/v8/build/gyp_v8 +145 -0
  224. data/lib/libv8/v8/include/v8-debug.h +395 -0
  225. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  226. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  227. data/lib/libv8/v8/include/v8-testing.h +104 -0
  228. data/lib/libv8/v8/include/v8.h +4124 -0
  229. data/lib/libv8/v8/include/v8stdint.h +53 -0
  230. data/lib/libv8/v8/preparser/SConscript +38 -0
  231. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  232. data/lib/libv8/v8/src/SConscript +368 -0
  233. data/lib/libv8/v8/src/accessors.cc +767 -0
  234. data/lib/libv8/v8/src/accessors.h +123 -0
  235. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  236. data/lib/libv8/v8/src/allocation.cc +122 -0
  237. data/lib/libv8/v8/src/allocation.h +143 -0
  238. data/lib/libv8/v8/src/api.cc +5845 -0
  239. data/lib/libv8/v8/src/api.h +574 -0
  240. data/lib/libv8/v8/src/apinatives.js +110 -0
  241. data/lib/libv8/v8/src/apiutils.h +73 -0
  242. data/lib/libv8/v8/src/arguments.h +118 -0
  243. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  244. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  245. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  246. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  247. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  248. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  249. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  250. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  251. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  252. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  253. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  254. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  255. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  256. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  257. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  258. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  259. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  260. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  261. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  262. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  263. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  264. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  265. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  266. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  267. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  268. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  269. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  270. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  271. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  272. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  273. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  274. data/lib/libv8/v8/src/array.js +1366 -0
  275. data/lib/libv8/v8/src/assembler.cc +1207 -0
  276. data/lib/libv8/v8/src/assembler.h +858 -0
  277. data/lib/libv8/v8/src/ast-inl.h +112 -0
  278. data/lib/libv8/v8/src/ast.cc +1146 -0
  279. data/lib/libv8/v8/src/ast.h +2188 -0
  280. data/lib/libv8/v8/src/atomicops.h +167 -0
  281. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  282. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  283. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  284. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  285. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  286. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  287. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  288. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  289. data/lib/libv8/v8/src/bignum.cc +768 -0
  290. data/lib/libv8/v8/src/bignum.h +140 -0
  291. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  292. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  293. data/lib/libv8/v8/src/builtins.cc +1707 -0
  294. data/lib/libv8/v8/src/builtins.h +371 -0
  295. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  296. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  297. data/lib/libv8/v8/src/cached-powers.h +65 -0
  298. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  299. data/lib/libv8/v8/src/char-predicates.h +67 -0
  300. data/lib/libv8/v8/src/checks.cc +110 -0
  301. data/lib/libv8/v8/src/checks.h +296 -0
  302. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  303. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  304. data/lib/libv8/v8/src/circular-queue.h +103 -0
  305. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  306. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  307. data/lib/libv8/v8/src/code.h +70 -0
  308. data/lib/libv8/v8/src/codegen.cc +231 -0
  309. data/lib/libv8/v8/src/codegen.h +84 -0
  310. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  311. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  312. data/lib/libv8/v8/src/compiler.cc +786 -0
  313. data/lib/libv8/v8/src/compiler.h +312 -0
  314. data/lib/libv8/v8/src/contexts.cc +347 -0
  315. data/lib/libv8/v8/src/contexts.h +391 -0
  316. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  317. data/lib/libv8/v8/src/conversions.cc +1131 -0
  318. data/lib/libv8/v8/src/conversions.h +135 -0
  319. data/lib/libv8/v8/src/counters.cc +93 -0
  320. data/lib/libv8/v8/src/counters.h +254 -0
  321. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  322. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  323. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  324. data/lib/libv8/v8/src/cpu.h +69 -0
  325. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  326. data/lib/libv8/v8/src/d8-debug.h +158 -0
  327. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  328. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  329. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  330. data/lib/libv8/v8/src/d8.cc +803 -0
  331. data/lib/libv8/v8/src/d8.gyp +91 -0
  332. data/lib/libv8/v8/src/d8.h +235 -0
  333. data/lib/libv8/v8/src/d8.js +2798 -0
  334. data/lib/libv8/v8/src/data-flow.cc +66 -0
  335. data/lib/libv8/v8/src/data-flow.h +205 -0
  336. data/lib/libv8/v8/src/date.js +1103 -0
  337. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  338. data/lib/libv8/v8/src/dateparser.cc +178 -0
  339. data/lib/libv8/v8/src/dateparser.h +266 -0
  340. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  341. data/lib/libv8/v8/src/debug-agent.h +129 -0
  342. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  343. data/lib/libv8/v8/src/debug.cc +3165 -0
  344. data/lib/libv8/v8/src/debug.h +1057 -0
  345. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  346. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  347. data/lib/libv8/v8/src/disasm.h +80 -0
  348. data/lib/libv8/v8/src/disassembler.cc +343 -0
  349. data/lib/libv8/v8/src/disassembler.h +58 -0
  350. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  351. data/lib/libv8/v8/src/diy-fp.h +117 -0
  352. data/lib/libv8/v8/src/double.h +238 -0
  353. data/lib/libv8/v8/src/dtoa.cc +103 -0
  354. data/lib/libv8/v8/src/dtoa.h +85 -0
  355. data/lib/libv8/v8/src/execution.cc +849 -0
  356. data/lib/libv8/v8/src/execution.h +297 -0
  357. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  358. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  359. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  360. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  361. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  362. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  363. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  364. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  365. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  366. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  367. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  368. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  369. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  370. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  371. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  372. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  373. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  374. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  375. data/lib/libv8/v8/src/factory.cc +1222 -0
  376. data/lib/libv8/v8/src/factory.h +442 -0
  377. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  378. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  379. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  380. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  381. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  382. data/lib/libv8/v8/src/flags.cc +551 -0
  383. data/lib/libv8/v8/src/flags.h +79 -0
  384. data/lib/libv8/v8/src/frames-inl.h +247 -0
  385. data/lib/libv8/v8/src/frames.cc +1243 -0
  386. data/lib/libv8/v8/src/frames.h +870 -0
  387. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  388. data/lib/libv8/v8/src/full-codegen.h +771 -0
  389. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  390. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  391. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  392. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  393. data/lib/libv8/v8/src/global-handles.cc +665 -0
  394. data/lib/libv8/v8/src/global-handles.h +284 -0
  395. data/lib/libv8/v8/src/globals.h +325 -0
  396. data/lib/libv8/v8/src/handles-inl.h +177 -0
  397. data/lib/libv8/v8/src/handles.cc +987 -0
  398. data/lib/libv8/v8/src/handles.h +382 -0
  399. data/lib/libv8/v8/src/hashmap.cc +230 -0
  400. data/lib/libv8/v8/src/hashmap.h +123 -0
  401. data/lib/libv8/v8/src/heap-inl.h +704 -0
  402. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  403. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  404. data/lib/libv8/v8/src/heap.cc +5930 -0
  405. data/lib/libv8/v8/src/heap.h +2268 -0
  406. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  407. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  408. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  409. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  410. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  411. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  412. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  413. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  414. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  415. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  416. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  417. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  418. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  419. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  420. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  421. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  422. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  423. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  424. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  425. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  426. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  427. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  428. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  429. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  430. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  431. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  432. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  433. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  434. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  435. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  436. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  437. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  438. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  439. data/lib/libv8/v8/src/ic-inl.h +130 -0
  440. data/lib/libv8/v8/src/ic.cc +2577 -0
  441. data/lib/libv8/v8/src/ic.h +736 -0
  442. data/lib/libv8/v8/src/inspector.cc +63 -0
  443. data/lib/libv8/v8/src/inspector.h +62 -0
  444. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  445. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  446. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  447. data/lib/libv8/v8/src/isolate.cc +1869 -0
  448. data/lib/libv8/v8/src/isolate.h +1382 -0
  449. data/lib/libv8/v8/src/json-parser.cc +504 -0
  450. data/lib/libv8/v8/src/json-parser.h +161 -0
  451. data/lib/libv8/v8/src/json.js +342 -0
  452. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  453. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  454. data/lib/libv8/v8/src/list-inl.h +212 -0
  455. data/lib/libv8/v8/src/list.h +174 -0
  456. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  457. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  458. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  459. data/lib/libv8/v8/src/lithium.cc +190 -0
  460. data/lib/libv8/v8/src/lithium.h +597 -0
  461. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  462. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  463. data/lib/libv8/v8/src/liveedit.h +180 -0
  464. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  465. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  466. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  467. data/lib/libv8/v8/src/log-inl.h +59 -0
  468. data/lib/libv8/v8/src/log-utils.cc +428 -0
  469. data/lib/libv8/v8/src/log-utils.h +231 -0
  470. data/lib/libv8/v8/src/log.cc +1993 -0
  471. data/lib/libv8/v8/src/log.h +476 -0
  472. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  473. data/lib/libv8/v8/src/macros.py +178 -0
  474. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  475. data/lib/libv8/v8/src/mark-compact.h +506 -0
  476. data/lib/libv8/v8/src/math.js +264 -0
  477. data/lib/libv8/v8/src/messages.cc +179 -0
  478. data/lib/libv8/v8/src/messages.h +113 -0
  479. data/lib/libv8/v8/src/messages.js +1096 -0
  480. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  481. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  482. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  483. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  484. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  485. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  486. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  487. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  488. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  489. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  490. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  491. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  492. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  493. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  494. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  495. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  496. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  497. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  498. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  499. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  500. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  501. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  502. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  503. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  504. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  505. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  506. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  507. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  508. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  509. data/lib/libv8/v8/src/natives.h +64 -0
  510. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  511. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  512. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  513. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  514. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  515. data/lib/libv8/v8/src/objects.cc +10585 -0
  516. data/lib/libv8/v8/src/objects.h +6838 -0
  517. data/lib/libv8/v8/src/parser.cc +4997 -0
  518. data/lib/libv8/v8/src/parser.h +765 -0
  519. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  520. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  521. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  522. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  523. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  524. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  525. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  526. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  527. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  528. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  529. data/lib/libv8/v8/src/platform-tls.h +50 -0
  530. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  531. data/lib/libv8/v8/src/platform.h +667 -0
  532. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  533. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  534. data/lib/libv8/v8/src/preparse-data.h +225 -0
  535. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  536. data/lib/libv8/v8/src/preparser.cc +1450 -0
  537. data/lib/libv8/v8/src/preparser.h +493 -0
  538. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  539. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  540. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  541. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  542. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  543. data/lib/libv8/v8/src/property.cc +105 -0
  544. data/lib/libv8/v8/src/property.h +365 -0
  545. data/lib/libv8/v8/src/proxy.js +83 -0
  546. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  547. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  548. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  549. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  550. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  551. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  552. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  553. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  554. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  555. data/lib/libv8/v8/src/regexp.js +483 -0
  556. data/lib/libv8/v8/src/rewriter.cc +360 -0
  557. data/lib/libv8/v8/src/rewriter.h +50 -0
  558. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  559. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  560. data/lib/libv8/v8/src/runtime.cc +12227 -0
  561. data/lib/libv8/v8/src/runtime.h +652 -0
  562. data/lib/libv8/v8/src/runtime.js +649 -0
  563. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  564. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  565. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  566. data/lib/libv8/v8/src/scanner-base.h +670 -0
  567. data/lib/libv8/v8/src/scanner.cc +345 -0
  568. data/lib/libv8/v8/src/scanner.h +146 -0
  569. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  570. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  571. data/lib/libv8/v8/src/scopes.cc +1150 -0
  572. data/lib/libv8/v8/src/scopes.h +507 -0
  573. data/lib/libv8/v8/src/serialize.cc +1574 -0
  574. data/lib/libv8/v8/src/serialize.h +589 -0
  575. data/lib/libv8/v8/src/shell.h +55 -0
  576. data/lib/libv8/v8/src/simulator.h +43 -0
  577. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  578. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  579. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  580. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  581. data/lib/libv8/v8/src/snapshot.h +91 -0
  582. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  583. data/lib/libv8/v8/src/spaces.cc +3145 -0
  584. data/lib/libv8/v8/src/spaces.h +2369 -0
  585. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  586. data/lib/libv8/v8/src/splay-tree.h +205 -0
  587. data/lib/libv8/v8/src/string-search.cc +41 -0
  588. data/lib/libv8/v8/src/string-search.h +568 -0
  589. data/lib/libv8/v8/src/string-stream.cc +592 -0
  590. data/lib/libv8/v8/src/string-stream.h +191 -0
  591. data/lib/libv8/v8/src/string.js +994 -0
  592. data/lib/libv8/v8/src/strtod.cc +440 -0
  593. data/lib/libv8/v8/src/strtod.h +40 -0
  594. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  595. data/lib/libv8/v8/src/stub-cache.h +924 -0
  596. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  597. data/lib/libv8/v8/src/token.cc +63 -0
  598. data/lib/libv8/v8/src/token.h +288 -0
  599. data/lib/libv8/v8/src/type-info.cc +507 -0
  600. data/lib/libv8/v8/src/type-info.h +272 -0
  601. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  602. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  603. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  604. data/lib/libv8/v8/src/unicode.cc +1624 -0
  605. data/lib/libv8/v8/src/unicode.h +280 -0
  606. data/lib/libv8/v8/src/uri.js +408 -0
  607. data/lib/libv8/v8/src/utils-inl.h +48 -0
  608. data/lib/libv8/v8/src/utils.cc +371 -0
  609. data/lib/libv8/v8/src/utils.h +800 -0
  610. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  611. data/lib/libv8/v8/src/v8-counters.h +314 -0
  612. data/lib/libv8/v8/src/v8.cc +213 -0
  613. data/lib/libv8/v8/src/v8.h +131 -0
  614. data/lib/libv8/v8/src/v8checks.h +64 -0
  615. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  616. data/lib/libv8/v8/src/v8globals.h +512 -0
  617. data/lib/libv8/v8/src/v8memory.h +82 -0
  618. data/lib/libv8/v8/src/v8natives.js +1310 -0
  619. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  620. data/lib/libv8/v8/src/v8threads.cc +464 -0
  621. data/lib/libv8/v8/src/v8threads.h +165 -0
  622. data/lib/libv8/v8/src/v8utils.h +319 -0
  623. data/lib/libv8/v8/src/variables.cc +114 -0
  624. data/lib/libv8/v8/src/variables.h +167 -0
  625. data/lib/libv8/v8/src/version.cc +116 -0
  626. data/lib/libv8/v8/src/version.h +68 -0
  627. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  628. data/lib/libv8/v8/src/vm-state.h +71 -0
  629. data/lib/libv8/v8/src/win32-headers.h +96 -0
  630. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  631. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  632. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  633. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  634. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  635. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  636. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  637. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  638. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  639. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  640. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  641. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  642. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  643. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  644. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  645. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  646. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  647. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  648. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  649. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  650. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  651. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  652. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  653. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  654. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  655. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  656. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  657. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  658. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  659. data/lib/libv8/v8/src/zone-inl.h +140 -0
  660. data/lib/libv8/v8/src/zone.cc +196 -0
  661. data/lib/libv8/v8/src/zone.h +240 -0
  662. data/lib/libv8/v8/tools/codemap.js +265 -0
  663. data/lib/libv8/v8/tools/consarray.js +93 -0
  664. data/lib/libv8/v8/tools/csvparser.js +78 -0
  665. data/lib/libv8/v8/tools/disasm.py +92 -0
  666. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  667. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  668. data/lib/libv8/v8/tools/gcmole/README +62 -0
  669. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  670. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  671. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  672. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  673. data/lib/libv8/v8/tools/grokdump.py +841 -0
  674. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  675. data/lib/libv8/v8/tools/js2c.py +364 -0
  676. data/lib/libv8/v8/tools/jsmin.py +280 -0
  677. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  678. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  679. data/lib/libv8/v8/tools/logreader.js +185 -0
  680. data/lib/libv8/v8/tools/mac-nm +18 -0
  681. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  682. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  683. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  684. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  685. data/lib/libv8/v8/tools/presubmit.py +305 -0
  686. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  687. data/lib/libv8/v8/tools/profile.js +751 -0
  688. data/lib/libv8/v8/tools/profile_view.js +219 -0
  689. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  690. data/lib/libv8/v8/tools/splaytree.js +316 -0
  691. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  692. data/lib/libv8/v8/tools/test.py +1510 -0
  693. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  694. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  695. data/lib/libv8/v8/tools/utils.py +96 -0
  696. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  697. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  698. data/lib/libv8/version.rb +4 -0
  699. data/libv8.gemspec +31 -0
  700. metadata +800 -0
@@ -0,0 +1,74 @@
1
+ // Copyright 2011 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #ifndef V8_X64_LITHIUM_GAP_RESOLVER_X64_H_
29
+ #define V8_X64_LITHIUM_GAP_RESOLVER_X64_H_
30
+
31
+ #include "v8.h"
32
+
33
+ #include "lithium.h"
34
+
35
+ namespace v8 {
36
+ namespace internal {
37
+
38
+ class LCodeGen;
39
+ class LGapResolver;
40
+
41
+ class LGapResolver BASE_EMBEDDED {
42
+ public:
43
+ explicit LGapResolver(LCodeGen* owner);
44
+
45
+ // Resolve a set of parallel moves, emitting assembler instructions.
46
+ void Resolve(LParallelMove* parallel_move);
47
+
48
+ private:
49
+ // Build the initial list of moves.
50
+ void BuildInitialMoveList(LParallelMove* parallel_move);
51
+
52
+ // Perform the move at the moves_ index in question (possibly requiring
53
+ // other moves to satisfy dependencies).
54
+ void PerformMove(int index);
55
+
56
+ // Emit a move and remove it from the move graph.
57
+ void EmitMove(int index);
58
+
59
+ // Execute a move by emitting a swap of two operands. The move from
60
+ // source to destination is removed from the move graph.
61
+ void EmitSwap(int index);
62
+
63
+ // Verify the move list before performing moves.
64
+ void Verify();
65
+
66
+ LCodeGen* cgen_;
67
+
68
+ // List of moves not yet resolved.
69
+ ZoneList<LMoveOperands> moves_;
70
+ };
71
+
72
+ } } // namespace v8::internal
73
+
74
+ #endif // V8_X64_LITHIUM_GAP_RESOLVER_X64_H_
@@ -0,0 +1,2202 @@
1
+ // Copyright 2011 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #include "v8.h"
29
+
30
+ #if defined(V8_TARGET_ARCH_X64)
31
+
32
+ #include "lithium-allocator-inl.h"
33
+ #include "x64/lithium-x64.h"
34
+ #include "x64/lithium-codegen-x64.h"
35
+
36
+ namespace v8 {
37
+ namespace internal {
38
+
39
+ #define DEFINE_COMPILE(type) \
40
+ void L##type::CompileToNative(LCodeGen* generator) { \
41
+ generator->Do##type(this); \
42
+ }
43
+ LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE)
44
+ #undef DEFINE_COMPILE
45
+
46
+ LOsrEntry::LOsrEntry() {
47
+ for (int i = 0; i < Register::kNumAllocatableRegisters; ++i) {
48
+ register_spills_[i] = NULL;
49
+ }
50
+ for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; ++i) {
51
+ double_register_spills_[i] = NULL;
52
+ }
53
+ }
54
+
55
+
56
+ void LOsrEntry::MarkSpilledRegister(int allocation_index,
57
+ LOperand* spill_operand) {
58
+ ASSERT(spill_operand->IsStackSlot());
59
+ ASSERT(register_spills_[allocation_index] == NULL);
60
+ register_spills_[allocation_index] = spill_operand;
61
+ }
62
+
63
+
64
+ void LOsrEntry::MarkSpilledDoubleRegister(int allocation_index,
65
+ LOperand* spill_operand) {
66
+ ASSERT(spill_operand->IsDoubleStackSlot());
67
+ ASSERT(double_register_spills_[allocation_index] == NULL);
68
+ double_register_spills_[allocation_index] = spill_operand;
69
+ }
70
+
71
+
72
+ #ifdef DEBUG
73
+ void LInstruction::VerifyCall() {
74
+ // Call instructions can use only fixed registers as temporaries and
75
+ // outputs because all registers are blocked by the calling convention.
76
+ // Inputs operands must use a fixed register or use-at-start policy or
77
+ // a non-register policy.
78
+ ASSERT(Output() == NULL ||
79
+ LUnallocated::cast(Output())->HasFixedPolicy() ||
80
+ !LUnallocated::cast(Output())->HasRegisterPolicy());
81
+ for (UseIterator it(this); it.HasNext(); it.Advance()) {
82
+ LUnallocated* operand = LUnallocated::cast(it.Next());
83
+ ASSERT(operand->HasFixedPolicy() ||
84
+ operand->IsUsedAtStart());
85
+ }
86
+ for (TempIterator it(this); it.HasNext(); it.Advance()) {
87
+ LUnallocated* operand = LUnallocated::cast(it.Next());
88
+ ASSERT(operand->HasFixedPolicy() ||!operand->HasRegisterPolicy());
89
+ }
90
+ }
91
+ #endif
92
+
93
+
94
+ void LInstruction::PrintTo(StringStream* stream) {
95
+ stream->Add("%s ", this->Mnemonic());
96
+
97
+ PrintOutputOperandTo(stream);
98
+
99
+ PrintDataTo(stream);
100
+
101
+ if (HasEnvironment()) {
102
+ stream->Add(" ");
103
+ environment()->PrintTo(stream);
104
+ }
105
+
106
+ if (HasPointerMap()) {
107
+ stream->Add(" ");
108
+ pointer_map()->PrintTo(stream);
109
+ }
110
+ }
111
+
112
+
113
+ template<int R, int I, int T>
114
+ void LTemplateInstruction<R, I, T>::PrintDataTo(StringStream* stream) {
115
+ stream->Add("= ");
116
+ inputs_.PrintOperandsTo(stream);
117
+ }
118
+
119
+
120
+ template<int R, int I, int T>
121
+ void LTemplateInstruction<R, I, T>::PrintOutputOperandTo(StringStream* stream) {
122
+ results_.PrintOperandsTo(stream);
123
+ }
124
+
125
+
126
+ template<typename T, int N>
127
+ void OperandContainer<T, N>::PrintOperandsTo(StringStream* stream) {
128
+ for (int i = 0; i < N; i++) {
129
+ if (i > 0) stream->Add(" ");
130
+ elems_[i]->PrintTo(stream);
131
+ }
132
+ }
133
+
134
+
135
+ void LLabel::PrintDataTo(StringStream* stream) {
136
+ LGap::PrintDataTo(stream);
137
+ LLabel* rep = replacement();
138
+ if (rep != NULL) {
139
+ stream->Add(" Dead block replaced with B%d", rep->block_id());
140
+ }
141
+ }
142
+
143
+
144
+ bool LGap::IsRedundant() const {
145
+ for (int i = 0; i < 4; i++) {
146
+ if (parallel_moves_[i] != NULL && !parallel_moves_[i]->IsRedundant()) {
147
+ return false;
148
+ }
149
+ }
150
+
151
+ return true;
152
+ }
153
+
154
+
155
+ void LGap::PrintDataTo(StringStream* stream) {
156
+ for (int i = 0; i < 4; i++) {
157
+ stream->Add("(");
158
+ if (parallel_moves_[i] != NULL) {
159
+ parallel_moves_[i]->PrintDataTo(stream);
160
+ }
161
+ stream->Add(") ");
162
+ }
163
+ }
164
+
165
+
166
+ const char* LArithmeticD::Mnemonic() const {
167
+ switch (op()) {
168
+ case Token::ADD: return "add-d";
169
+ case Token::SUB: return "sub-d";
170
+ case Token::MUL: return "mul-d";
171
+ case Token::DIV: return "div-d";
172
+ case Token::MOD: return "mod-d";
173
+ default:
174
+ UNREACHABLE();
175
+ return NULL;
176
+ }
177
+ }
178
+
179
+
180
+ const char* LArithmeticT::Mnemonic() const {
181
+ switch (op()) {
182
+ case Token::ADD: return "add-t";
183
+ case Token::SUB: return "sub-t";
184
+ case Token::MUL: return "mul-t";
185
+ case Token::MOD: return "mod-t";
186
+ case Token::DIV: return "div-t";
187
+ case Token::BIT_AND: return "bit-and-t";
188
+ case Token::BIT_OR: return "bit-or-t";
189
+ case Token::BIT_XOR: return "bit-xor-t";
190
+ case Token::SHL: return "sal-t";
191
+ case Token::SAR: return "sar-t";
192
+ case Token::SHR: return "shr-t";
193
+ default:
194
+ UNREACHABLE();
195
+ return NULL;
196
+ }
197
+ }
198
+
199
+
200
+ void LGoto::PrintDataTo(StringStream* stream) {
201
+ stream->Add("B%d", block_id());
202
+ }
203
+
204
+
205
+ void LBranch::PrintDataTo(StringStream* stream) {
206
+ stream->Add("B%d | B%d on ", true_block_id(), false_block_id());
207
+ InputAt(0)->PrintTo(stream);
208
+ }
209
+
210
+
211
+ void LCmpIDAndBranch::PrintDataTo(StringStream* stream) {
212
+ stream->Add("if ");
213
+ InputAt(0)->PrintTo(stream);
214
+ stream->Add(" %s ", Token::String(op()));
215
+ InputAt(1)->PrintTo(stream);
216
+ stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
217
+ }
218
+
219
+
220
+ void LIsNullAndBranch::PrintDataTo(StringStream* stream) {
221
+ stream->Add("if ");
222
+ InputAt(0)->PrintTo(stream);
223
+ stream->Add(is_strict() ? " === null" : " == null");
224
+ stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
225
+ }
226
+
227
+
228
+ void LIsObjectAndBranch::PrintDataTo(StringStream* stream) {
229
+ stream->Add("if is_object(");
230
+ InputAt(0)->PrintTo(stream);
231
+ stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
232
+ }
233
+
234
+
235
+ void LIsSmiAndBranch::PrintDataTo(StringStream* stream) {
236
+ stream->Add("if is_smi(");
237
+ InputAt(0)->PrintTo(stream);
238
+ stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
239
+ }
240
+
241
+
242
+ void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) {
243
+ stream->Add("if is_undetectable(");
244
+ InputAt(0)->PrintTo(stream);
245
+ stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
246
+ }
247
+
248
+
249
+ void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) {
250
+ stream->Add("if has_instance_type(");
251
+ InputAt(0)->PrintTo(stream);
252
+ stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
253
+ }
254
+
255
+
256
+ void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) {
257
+ stream->Add("if has_cached_array_index(");
258
+ InputAt(0)->PrintTo(stream);
259
+ stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
260
+ }
261
+
262
+
263
+ void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) {
264
+ stream->Add("if class_of_test(");
265
+ InputAt(0)->PrintTo(stream);
266
+ stream->Add(", \"%o\") then B%d else B%d",
267
+ *hydrogen()->class_name(),
268
+ true_block_id(),
269
+ false_block_id());
270
+ }
271
+
272
+
273
+ void LTypeofIs::PrintDataTo(StringStream* stream) {
274
+ InputAt(0)->PrintTo(stream);
275
+ stream->Add(" == \"%s\"", *hydrogen()->type_literal()->ToCString());
276
+ }
277
+
278
+
279
+ void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) {
280
+ stream->Add("if typeof ");
281
+ InputAt(0)->PrintTo(stream);
282
+ stream->Add(" == \"%s\" then B%d else B%d",
283
+ *hydrogen()->type_literal()->ToCString(),
284
+ true_block_id(), false_block_id());
285
+ }
286
+
287
+
288
+ void LCallConstantFunction::PrintDataTo(StringStream* stream) {
289
+ stream->Add("#%d / ", arity());
290
+ }
291
+
292
+
293
+ void LUnaryMathOperation::PrintDataTo(StringStream* stream) {
294
+ stream->Add("/%s ", hydrogen()->OpName());
295
+ InputAt(0)->PrintTo(stream);
296
+ }
297
+
298
+
299
+ void LLoadContextSlot::PrintDataTo(StringStream* stream) {
300
+ InputAt(0)->PrintTo(stream);
301
+ stream->Add("[%d]", slot_index());
302
+ }
303
+
304
+
305
+ void LStoreContextSlot::PrintDataTo(StringStream* stream) {
306
+ InputAt(0)->PrintTo(stream);
307
+ stream->Add("[%d] <- ", slot_index());
308
+ InputAt(1)->PrintTo(stream);
309
+ }
310
+
311
+
312
+ void LInvokeFunction::PrintDataTo(StringStream* stream) {
313
+ stream->Add("= ");
314
+ InputAt(0)->PrintTo(stream);
315
+ stream->Add(" #%d / ", arity());
316
+ }
317
+
318
+
319
+ void LCallKeyed::PrintDataTo(StringStream* stream) {
320
+ stream->Add("[rcx] #%d / ", arity());
321
+ }
322
+
323
+
324
+ void LCallNamed::PrintDataTo(StringStream* stream) {
325
+ SmartPointer<char> name_string = name()->ToCString();
326
+ stream->Add("%s #%d / ", *name_string, arity());
327
+ }
328
+
329
+
330
+ void LCallGlobal::PrintDataTo(StringStream* stream) {
331
+ SmartPointer<char> name_string = name()->ToCString();
332
+ stream->Add("%s #%d / ", *name_string, arity());
333
+ }
334
+
335
+
336
+ void LCallKnownGlobal::PrintDataTo(StringStream* stream) {
337
+ stream->Add("#%d / ", arity());
338
+ }
339
+
340
+
341
+ void LCallNew::PrintDataTo(StringStream* stream) {
342
+ stream->Add("= ");
343
+ InputAt(0)->PrintTo(stream);
344
+ stream->Add(" #%d / ", arity());
345
+ }
346
+
347
+
348
+ void LClassOfTest::PrintDataTo(StringStream* stream) {
349
+ stream->Add("= class_of_test(");
350
+ InputAt(0)->PrintTo(stream);
351
+ stream->Add(", \"%o\")", *hydrogen()->class_name());
352
+ }
353
+
354
+
355
+ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
356
+ arguments()->PrintTo(stream);
357
+
358
+ stream->Add(" length ");
359
+ length()->PrintTo(stream);
360
+
361
+ stream->Add(" index ");
362
+ index()->PrintTo(stream);
363
+ }
364
+
365
+
366
+ int LChunk::GetNextSpillIndex(bool is_double) {
367
+ return spill_slot_count_++;
368
+ }
369
+
370
+
371
+ LOperand* LChunk::GetNextSpillSlot(bool is_double) {
372
+ // All stack slots are Double stack slots on x64.
373
+ // Alternatively, at some point, start using half-size
374
+ // stack slots for int32 values.
375
+ int index = GetNextSpillIndex(is_double);
376
+ if (is_double) {
377
+ return LDoubleStackSlot::Create(index);
378
+ } else {
379
+ return LStackSlot::Create(index);
380
+ }
381
+ }
382
+
383
+
384
+ void LChunk::MarkEmptyBlocks() {
385
+ HPhase phase("Mark empty blocks", this);
386
+ for (int i = 0; i < graph()->blocks()->length(); ++i) {
387
+ HBasicBlock* block = graph()->blocks()->at(i);
388
+ int first = block->first_instruction_index();
389
+ int last = block->last_instruction_index();
390
+ LInstruction* first_instr = instructions()->at(first);
391
+ LInstruction* last_instr = instructions()->at(last);
392
+
393
+ LLabel* label = LLabel::cast(first_instr);
394
+ if (last_instr->IsGoto()) {
395
+ LGoto* goto_instr = LGoto::cast(last_instr);
396
+ if (!goto_instr->include_stack_check() &&
397
+ label->IsRedundant() &&
398
+ !label->is_loop_header()) {
399
+ bool can_eliminate = true;
400
+ for (int i = first + 1; i < last && can_eliminate; ++i) {
401
+ LInstruction* cur = instructions()->at(i);
402
+ if (cur->IsGap()) {
403
+ LGap* gap = LGap::cast(cur);
404
+ if (!gap->IsRedundant()) {
405
+ can_eliminate = false;
406
+ }
407
+ } else {
408
+ can_eliminate = false;
409
+ }
410
+ }
411
+
412
+ if (can_eliminate) {
413
+ label->set_replacement(GetLabel(goto_instr->block_id()));
414
+ }
415
+ }
416
+ }
417
+ }
418
+ }
419
+
420
+
421
+ void LStoreNamedField::PrintDataTo(StringStream* stream) {
422
+ object()->PrintTo(stream);
423
+ stream->Add(".");
424
+ stream->Add(*String::cast(*name())->ToCString());
425
+ stream->Add(" <- ");
426
+ value()->PrintTo(stream);
427
+ }
428
+
429
+
430
+ void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
431
+ object()->PrintTo(stream);
432
+ stream->Add(".");
433
+ stream->Add(*String::cast(*name())->ToCString());
434
+ stream->Add(" <- ");
435
+ value()->PrintTo(stream);
436
+ }
437
+
438
+
439
+ void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
440
+ object()->PrintTo(stream);
441
+ stream->Add("[");
442
+ key()->PrintTo(stream);
443
+ stream->Add("] <- ");
444
+ value()->PrintTo(stream);
445
+ }
446
+
447
+
448
+ void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
449
+ object()->PrintTo(stream);
450
+ stream->Add("[");
451
+ key()->PrintTo(stream);
452
+ stream->Add("] <- ");
453
+ value()->PrintTo(stream);
454
+ }
455
+
456
+
457
+ void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) {
458
+ LInstructionGap* gap = new LInstructionGap(block);
459
+ int index = -1;
460
+ if (instr->IsControl()) {
461
+ instructions_.Add(gap);
462
+ index = instructions_.length();
463
+ instructions_.Add(instr);
464
+ } else {
465
+ index = instructions_.length();
466
+ instructions_.Add(instr);
467
+ instructions_.Add(gap);
468
+ }
469
+ if (instr->HasPointerMap()) {
470
+ pointer_maps_.Add(instr->pointer_map());
471
+ instr->pointer_map()->set_lithium_position(index);
472
+ }
473
+ }
474
+
475
+
476
+ LConstantOperand* LChunk::DefineConstantOperand(HConstant* constant) {
477
+ return LConstantOperand::Create(constant->id());
478
+ }
479
+
480
+
481
+ int LChunk::GetParameterStackSlot(int index) const {
482
+ // The receiver is at index 0, the first parameter at index 1, so we
483
+ // shift all parameter indexes down by the number of parameters, and
484
+ // make sure they end up negative so they are distinguishable from
485
+ // spill slots.
486
+ int result = index - info()->scope()->num_parameters() - 1;
487
+ ASSERT(result < 0);
488
+ return result;
489
+ }
490
+
491
+ // A parameter relative to ebp in the arguments stub.
492
+ int LChunk::ParameterAt(int index) {
493
+ ASSERT(-1 <= index); // -1 is the receiver.
494
+ return (1 + info()->scope()->num_parameters() - index) *
495
+ kPointerSize;
496
+ }
497
+
498
+
499
+ LGap* LChunk::GetGapAt(int index) const {
500
+ return LGap::cast(instructions_[index]);
501
+ }
502
+
503
+
504
+ bool LChunk::IsGapAt(int index) const {
505
+ return instructions_[index]->IsGap();
506
+ }
507
+
508
+
509
+ int LChunk::NearestGapPos(int index) const {
510
+ while (!IsGapAt(index)) index--;
511
+ return index;
512
+ }
513
+
514
+
515
+ void LChunk::AddGapMove(int index, LOperand* from, LOperand* to) {
516
+ GetGapAt(index)->GetOrCreateParallelMove(LGap::START)->AddMove(from, to);
517
+ }
518
+
519
+
520
+ Handle<Object> LChunk::LookupLiteral(LConstantOperand* operand) const {
521
+ return HConstant::cast(graph_->LookupValue(operand->index()))->handle();
522
+ }
523
+
524
+
525
+ Representation LChunk::LookupLiteralRepresentation(
526
+ LConstantOperand* operand) const {
527
+ return graph_->LookupValue(operand->index())->representation();
528
+ }
529
+
530
+
531
+ LChunk* LChunkBuilder::Build() {
532
+ ASSERT(is_unused());
533
+ chunk_ = new LChunk(info(), graph());
534
+ HPhase phase("Building chunk", chunk_);
535
+ status_ = BUILDING;
536
+ const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
537
+ for (int i = 0; i < blocks->length(); i++) {
538
+ HBasicBlock* next = NULL;
539
+ if (i < blocks->length() - 1) next = blocks->at(i + 1);
540
+ DoBasicBlock(blocks->at(i), next);
541
+ if (is_aborted()) return NULL;
542
+ }
543
+ status_ = DONE;
544
+ return chunk_;
545
+ }
546
+
547
+
548
+ void LChunkBuilder::Abort(const char* format, ...) {
549
+ if (FLAG_trace_bailout) {
550
+ SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString());
551
+ PrintF("Aborting LChunk building in @\"%s\": ", *name);
552
+ va_list arguments;
553
+ va_start(arguments, format);
554
+ OS::VPrint(format, arguments);
555
+ va_end(arguments);
556
+ PrintF("\n");
557
+ }
558
+ status_ = ABORTED;
559
+ }
560
+
561
+
562
+ LRegister* LChunkBuilder::ToOperand(Register reg) {
563
+ return LRegister::Create(Register::ToAllocationIndex(reg));
564
+ }
565
+
566
+
567
+ LUnallocated* LChunkBuilder::ToUnallocated(Register reg) {
568
+ return new LUnallocated(LUnallocated::FIXED_REGISTER,
569
+ Register::ToAllocationIndex(reg));
570
+ }
571
+
572
+
573
+ LUnallocated* LChunkBuilder::ToUnallocated(XMMRegister reg) {
574
+ return new LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER,
575
+ XMMRegister::ToAllocationIndex(reg));
576
+ }
577
+
578
+
579
+ LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) {
580
+ return Use(value, ToUnallocated(fixed_register));
581
+ }
582
+
583
+
584
+ LOperand* LChunkBuilder::UseFixedDouble(HValue* value, XMMRegister reg) {
585
+ return Use(value, ToUnallocated(reg));
586
+ }
587
+
588
+
589
+ LOperand* LChunkBuilder::UseRegister(HValue* value) {
590
+ return Use(value, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
591
+ }
592
+
593
+
594
+ LOperand* LChunkBuilder::UseRegisterAtStart(HValue* value) {
595
+ return Use(value,
596
+ new LUnallocated(LUnallocated::MUST_HAVE_REGISTER,
597
+ LUnallocated::USED_AT_START));
598
+ }
599
+
600
+
601
+ LOperand* LChunkBuilder::UseTempRegister(HValue* value) {
602
+ return Use(value, new LUnallocated(LUnallocated::WRITABLE_REGISTER));
603
+ }
604
+
605
+
606
+ LOperand* LChunkBuilder::Use(HValue* value) {
607
+ return Use(value, new LUnallocated(LUnallocated::NONE));
608
+ }
609
+
610
+
611
+ LOperand* LChunkBuilder::UseAtStart(HValue* value) {
612
+ return Use(value, new LUnallocated(LUnallocated::NONE,
613
+ LUnallocated::USED_AT_START));
614
+ }
615
+
616
+
617
+ LOperand* LChunkBuilder::UseOrConstant(HValue* value) {
618
+ return value->IsConstant()
619
+ ? chunk_->DefineConstantOperand(HConstant::cast(value))
620
+ : Use(value);
621
+ }
622
+
623
+
624
+ LOperand* LChunkBuilder::UseOrConstantAtStart(HValue* value) {
625
+ return value->IsConstant()
626
+ ? chunk_->DefineConstantOperand(HConstant::cast(value))
627
+ : UseAtStart(value);
628
+ }
629
+
630
+
631
+ LOperand* LChunkBuilder::UseRegisterOrConstant(HValue* value) {
632
+ return value->IsConstant()
633
+ ? chunk_->DefineConstantOperand(HConstant::cast(value))
634
+ : UseRegister(value);
635
+ }
636
+
637
+
638
+ LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) {
639
+ return value->IsConstant()
640
+ ? chunk_->DefineConstantOperand(HConstant::cast(value))
641
+ : UseRegisterAtStart(value);
642
+ }
643
+
644
+
645
+ LOperand* LChunkBuilder::UseAny(HValue* value) {
646
+ return value->IsConstant()
647
+ ? chunk_->DefineConstantOperand(HConstant::cast(value))
648
+ : Use(value, new LUnallocated(LUnallocated::ANY));
649
+ }
650
+
651
+
652
+ LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
653
+ if (value->EmitAtUses()) {
654
+ HInstruction* instr = HInstruction::cast(value);
655
+ VisitInstruction(instr);
656
+ }
657
+ allocator_->RecordUse(value, operand);
658
+ return operand;
659
+ }
660
+
661
+
662
+ template<int I, int T>
663
+ LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr,
664
+ LUnallocated* result) {
665
+ allocator_->RecordDefinition(current_instruction_, result);
666
+ instr->set_result(result);
667
+ return instr;
668
+ }
669
+
670
+
671
+ template<int I, int T>
672
+ LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr) {
673
+ return Define(instr, new LUnallocated(LUnallocated::NONE));
674
+ }
675
+
676
+
677
+ template<int I, int T>
678
+ LInstruction* LChunkBuilder::DefineAsRegister(
679
+ LTemplateInstruction<1, I, T>* instr) {
680
+ return Define(instr, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
681
+ }
682
+
683
+
684
+ template<int I, int T>
685
+ LInstruction* LChunkBuilder::DefineAsSpilled(
686
+ LTemplateInstruction<1, I, T>* instr,
687
+ int index) {
688
+ return Define(instr, new LUnallocated(LUnallocated::FIXED_SLOT, index));
689
+ }
690
+
691
+
692
+ template<int I, int T>
693
+ LInstruction* LChunkBuilder::DefineSameAsFirst(
694
+ LTemplateInstruction<1, I, T>* instr) {
695
+ return Define(instr, new LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT));
696
+ }
697
+
698
+
699
+ template<int I, int T>
700
+ LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1, I, T>* instr,
701
+ Register reg) {
702
+ return Define(instr, ToUnallocated(reg));
703
+ }
704
+
705
+
706
+ template<int I, int T>
707
+ LInstruction* LChunkBuilder::DefineFixedDouble(
708
+ LTemplateInstruction<1, I, T>* instr,
709
+ XMMRegister reg) {
710
+ return Define(instr, ToUnallocated(reg));
711
+ }
712
+
713
+
714
+ LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
715
+ HEnvironment* hydrogen_env = current_block_->last_environment();
716
+ instr->set_environment(CreateEnvironment(hydrogen_env));
717
+ return instr;
718
+ }
719
+
720
+
721
+ LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment(
722
+ LInstruction* instr, int ast_id) {
723
+ ASSERT(instruction_pending_deoptimization_environment_ == NULL);
724
+ ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber);
725
+ instruction_pending_deoptimization_environment_ = instr;
726
+ pending_deoptimization_ast_id_ = ast_id;
727
+ return instr;
728
+ }
729
+
730
+
731
+ void LChunkBuilder::ClearInstructionPendingDeoptimizationEnvironment() {
732
+ instruction_pending_deoptimization_environment_ = NULL;
733
+ pending_deoptimization_ast_id_ = AstNode::kNoNumber;
734
+ }
735
+
736
+
737
+ LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
738
+ HInstruction* hinstr,
739
+ CanDeoptimize can_deoptimize) {
740
+ #ifdef DEBUG
741
+ instr->VerifyCall();
742
+ #endif
743
+ instr->MarkAsCall();
744
+ instr = AssignPointerMap(instr);
745
+
746
+ if (hinstr->HasSideEffects()) {
747
+ ASSERT(hinstr->next()->IsSimulate());
748
+ HSimulate* sim = HSimulate::cast(hinstr->next());
749
+ instr = SetInstructionPendingDeoptimizationEnvironment(
750
+ instr, sim->ast_id());
751
+ }
752
+
753
+ // If instruction does not have side-effects lazy deoptimization
754
+ // after the call will try to deoptimize to the point before the call.
755
+ // Thus we still need to attach environment to this call even if
756
+ // call sequence can not deoptimize eagerly.
757
+ bool needs_environment =
758
+ (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || !hinstr->HasSideEffects();
759
+ if (needs_environment && !instr->HasEnvironment()) {
760
+ instr = AssignEnvironment(instr);
761
+ }
762
+
763
+ return instr;
764
+ }
765
+
766
+
767
+ LInstruction* LChunkBuilder::MarkAsSaveDoubles(LInstruction* instr) {
768
+ instr->MarkAsSaveDoubles();
769
+ return instr;
770
+ }
771
+
772
+
773
+ LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
774
+ ASSERT(!instr->HasPointerMap());
775
+ instr->set_pointer_map(new LPointerMap(position_));
776
+ return instr;
777
+ }
778
+
779
+
780
+ LUnallocated* LChunkBuilder::TempRegister() {
781
+ LUnallocated* operand = new LUnallocated(LUnallocated::MUST_HAVE_REGISTER);
782
+ allocator_->RecordTemporary(operand);
783
+ return operand;
784
+ }
785
+
786
+
787
+ LOperand* LChunkBuilder::FixedTemp(Register reg) {
788
+ LUnallocated* operand = ToUnallocated(reg);
789
+ allocator_->RecordTemporary(operand);
790
+ return operand;
791
+ }
792
+
793
+
794
+ LOperand* LChunkBuilder::FixedTemp(XMMRegister reg) {
795
+ LUnallocated* operand = ToUnallocated(reg);
796
+ allocator_->RecordTemporary(operand);
797
+ return operand;
798
+ }
799
+
800
+
801
+ LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
802
+ return new LLabel(instr->block());
803
+ }
804
+
805
+
806
+ LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
807
+ return AssignEnvironment(new LDeoptimize);
808
+ }
809
+
810
+
811
+ LInstruction* LChunkBuilder::DoBit(Token::Value op,
812
+ HBitwiseBinaryOperation* instr) {
813
+ if (instr->representation().IsInteger32()) {
814
+ ASSERT(instr->left()->representation().IsInteger32());
815
+ ASSERT(instr->right()->representation().IsInteger32());
816
+
817
+ LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
818
+ LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
819
+ return DefineSameAsFirst(new LBitI(op, left, right));
820
+ } else {
821
+ ASSERT(instr->representation().IsTagged());
822
+ ASSERT(instr->left()->representation().IsTagged());
823
+ ASSERT(instr->right()->representation().IsTagged());
824
+
825
+ LOperand* left = UseFixed(instr->left(), rdx);
826
+ LOperand* right = UseFixed(instr->right(), rax);
827
+ LArithmeticT* result = new LArithmeticT(op, left, right);
828
+ return MarkAsCall(DefineFixed(result, rax), instr);
829
+ }
830
+ }
831
+
832
+
833
+ LInstruction* LChunkBuilder::DoShift(Token::Value op,
834
+ HBitwiseBinaryOperation* instr) {
835
+ if (instr->representation().IsTagged()) {
836
+ ASSERT(instr->left()->representation().IsTagged());
837
+ ASSERT(instr->right()->representation().IsTagged());
838
+
839
+ LOperand* left = UseFixed(instr->left(), rdx);
840
+ LOperand* right = UseFixed(instr->right(), rax);
841
+ LArithmeticT* result = new LArithmeticT(op, left, right);
842
+ return MarkAsCall(DefineFixed(result, rax), instr);
843
+ }
844
+
845
+ ASSERT(instr->representation().IsInteger32());
846
+ ASSERT(instr->OperandAt(0)->representation().IsInteger32());
847
+ ASSERT(instr->OperandAt(1)->representation().IsInteger32());
848
+ LOperand* left = UseRegisterAtStart(instr->OperandAt(0));
849
+
850
+ HValue* right_value = instr->OperandAt(1);
851
+ LOperand* right = NULL;
852
+ int constant_value = 0;
853
+ if (right_value->IsConstant()) {
854
+ HConstant* constant = HConstant::cast(right_value);
855
+ right = chunk_->DefineConstantOperand(constant);
856
+ constant_value = constant->Integer32Value() & 0x1f;
857
+ } else {
858
+ right = UseFixed(right_value, rcx);
859
+ }
860
+
861
+ // Shift operations can only deoptimize if we do a logical shift by 0 and
862
+ // the result cannot be truncated to int32.
863
+ bool may_deopt = (op == Token::SHR && constant_value == 0);
864
+ bool does_deopt = false;
865
+ if (may_deopt) {
866
+ for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
867
+ if (!it.value()->CheckFlag(HValue::kTruncatingToInt32)) {
868
+ does_deopt = true;
869
+ break;
870
+ }
871
+ }
872
+ }
873
+
874
+ LInstruction* result =
875
+ DefineSameAsFirst(new LShiftI(op, left, right, does_deopt));
876
+ return does_deopt ? AssignEnvironment(result) : result;
877
+ }
878
+
879
+
880
+ LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
881
+ HArithmeticBinaryOperation* instr) {
882
+ ASSERT(instr->representation().IsDouble());
883
+ ASSERT(instr->left()->representation().IsDouble());
884
+ ASSERT(instr->right()->representation().IsDouble());
885
+ ASSERT(op != Token::MOD);
886
+ LOperand* left = UseRegisterAtStart(instr->left());
887
+ LOperand* right = UseRegisterAtStart(instr->right());
888
+ LArithmeticD* result = new LArithmeticD(op, left, right);
889
+ return DefineSameAsFirst(result);
890
+ }
891
+
892
+
893
+ LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op,
894
+ HArithmeticBinaryOperation* instr) {
895
+ ASSERT(op == Token::ADD ||
896
+ op == Token::DIV ||
897
+ op == Token::MOD ||
898
+ op == Token::MUL ||
899
+ op == Token::SUB);
900
+ HValue* left = instr->left();
901
+ HValue* right = instr->right();
902
+ ASSERT(left->representation().IsTagged());
903
+ ASSERT(right->representation().IsTagged());
904
+ LOperand* left_operand = UseFixed(left, rdx);
905
+ LOperand* right_operand = UseFixed(right, rax);
906
+ LArithmeticT* result = new LArithmeticT(op, left_operand, right_operand);
907
+ return MarkAsCall(DefineFixed(result, rax), instr);
908
+ }
909
+
910
+
911
+ void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) {
912
+ ASSERT(is_building());
913
+ current_block_ = block;
914
+ next_block_ = next_block;
915
+ if (block->IsStartBlock()) {
916
+ block->UpdateEnvironment(graph_->start_environment());
917
+ argument_count_ = 0;
918
+ } else if (block->predecessors()->length() == 1) {
919
+ // We have a single predecessor => copy environment and outgoing
920
+ // argument count from the predecessor.
921
+ ASSERT(block->phis()->length() == 0);
922
+ HBasicBlock* pred = block->predecessors()->at(0);
923
+ HEnvironment* last_environment = pred->last_environment();
924
+ ASSERT(last_environment != NULL);
925
+ // Only copy the environment, if it is later used again.
926
+ if (pred->end()->SecondSuccessor() == NULL) {
927
+ ASSERT(pred->end()->FirstSuccessor() == block);
928
+ } else {
929
+ if (pred->end()->FirstSuccessor()->block_id() > block->block_id() ||
930
+ pred->end()->SecondSuccessor()->block_id() > block->block_id()) {
931
+ last_environment = last_environment->Copy();
932
+ }
933
+ }
934
+ block->UpdateEnvironment(last_environment);
935
+ ASSERT(pred->argument_count() >= 0);
936
+ argument_count_ = pred->argument_count();
937
+ } else {
938
+ // We are at a state join => process phis.
939
+ HBasicBlock* pred = block->predecessors()->at(0);
940
+ // No need to copy the environment, it cannot be used later.
941
+ HEnvironment* last_environment = pred->last_environment();
942
+ for (int i = 0; i < block->phis()->length(); ++i) {
943
+ HPhi* phi = block->phis()->at(i);
944
+ last_environment->SetValueAt(phi->merged_index(), phi);
945
+ }
946
+ for (int i = 0; i < block->deleted_phis()->length(); ++i) {
947
+ last_environment->SetValueAt(block->deleted_phis()->at(i),
948
+ graph_->GetConstantUndefined());
949
+ }
950
+ block->UpdateEnvironment(last_environment);
951
+ // Pick up the outgoing argument count of one of the predecessors.
952
+ argument_count_ = pred->argument_count();
953
+ }
954
+ HInstruction* current = block->first();
955
+ int start = chunk_->instructions()->length();
956
+ while (current != NULL && !is_aborted()) {
957
+ // Code for constants in registers is generated lazily.
958
+ if (!current->EmitAtUses()) {
959
+ VisitInstruction(current);
960
+ }
961
+ current = current->next();
962
+ }
963
+ int end = chunk_->instructions()->length() - 1;
964
+ if (end >= start) {
965
+ block->set_first_instruction_index(start);
966
+ block->set_last_instruction_index(end);
967
+ }
968
+ block->set_argument_count(argument_count_);
969
+ next_block_ = NULL;
970
+ current_block_ = NULL;
971
+ }
972
+
973
+
974
+ void LChunkBuilder::VisitInstruction(HInstruction* current) {
975
+ HInstruction* old_current = current_instruction_;
976
+ current_instruction_ = current;
977
+ if (current->has_position()) position_ = current->position();
978
+ LInstruction* instr = current->CompileToLithium(this);
979
+
980
+ if (instr != NULL) {
981
+ if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
982
+ instr = AssignPointerMap(instr);
983
+ }
984
+ if (FLAG_stress_environments && !instr->HasEnvironment()) {
985
+ instr = AssignEnvironment(instr);
986
+ }
987
+ if (current->IsTest() && !instr->IsGoto()) {
988
+ ASSERT(instr->IsControl());
989
+ HTest* test = HTest::cast(current);
990
+ instr->set_hydrogen_value(test->value());
991
+ HBasicBlock* first = test->FirstSuccessor();
992
+ HBasicBlock* second = test->SecondSuccessor();
993
+ ASSERT(first != NULL && second != NULL);
994
+ instr->SetBranchTargets(first->block_id(), second->block_id());
995
+ } else {
996
+ instr->set_hydrogen_value(current);
997
+ }
998
+
999
+ chunk_->AddInstruction(instr, current_block_);
1000
+ }
1001
+ current_instruction_ = old_current;
1002
+ }
1003
+
1004
+
1005
+ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
1006
+ if (hydrogen_env == NULL) return NULL;
1007
+
1008
+ LEnvironment* outer = CreateEnvironment(hydrogen_env->outer());
1009
+ int ast_id = hydrogen_env->ast_id();
1010
+ ASSERT(ast_id != AstNode::kNoNumber);
1011
+ int value_count = hydrogen_env->length();
1012
+ LEnvironment* result = new LEnvironment(hydrogen_env->closure(),
1013
+ ast_id,
1014
+ hydrogen_env->parameter_count(),
1015
+ argument_count_,
1016
+ value_count,
1017
+ outer);
1018
+ int argument_index = 0;
1019
+ for (int i = 0; i < value_count; ++i) {
1020
+ if (hydrogen_env->is_special_index(i)) continue;
1021
+
1022
+ HValue* value = hydrogen_env->values()->at(i);
1023
+ LOperand* op = NULL;
1024
+ if (value->IsArgumentsObject()) {
1025
+ op = NULL;
1026
+ } else if (value->IsPushArgument()) {
1027
+ op = new LArgument(argument_index++);
1028
+ } else {
1029
+ op = UseAny(value);
1030
+ }
1031
+ result->AddValue(op, value->representation());
1032
+ }
1033
+
1034
+ return result;
1035
+ }
1036
+
1037
+
1038
+ LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1039
+ LGoto* result = new LGoto(instr->FirstSuccessor()->block_id(),
1040
+ instr->include_stack_check());
1041
+ return (instr->include_stack_check())
1042
+ ? AssignPointerMap(result)
1043
+ : result;
1044
+ }
1045
+
1046
+
1047
+ LInstruction* LChunkBuilder::DoTest(HTest* instr) {
1048
+ HValue* v = instr->value();
1049
+ if (!v->EmitAtUses()) {
1050
+ return new LBranch(UseRegisterAtStart(v));
1051
+ } else if (v->IsClassOfTest()) {
1052
+ HClassOfTest* compare = HClassOfTest::cast(v);
1053
+ ASSERT(compare->value()->representation().IsTagged());
1054
+ return new LClassOfTestAndBranch(UseTempRegister(compare->value()),
1055
+ TempRegister());
1056
+ } else if (v->IsCompare()) {
1057
+ HCompare* compare = HCompare::cast(v);
1058
+ Token::Value op = compare->token();
1059
+ HValue* left = compare->left();
1060
+ HValue* right = compare->right();
1061
+ Representation r = compare->GetInputRepresentation();
1062
+ if (r.IsInteger32()) {
1063
+ ASSERT(left->representation().IsInteger32());
1064
+ ASSERT(right->representation().IsInteger32());
1065
+ return new LCmpIDAndBranch(UseRegisterAtStart(left),
1066
+ UseOrConstantAtStart(right));
1067
+ } else if (r.IsDouble()) {
1068
+ ASSERT(left->representation().IsDouble());
1069
+ ASSERT(right->representation().IsDouble());
1070
+ return new LCmpIDAndBranch(UseRegisterAtStart(left),
1071
+ UseRegisterAtStart(right));
1072
+ } else {
1073
+ ASSERT(left->representation().IsTagged());
1074
+ ASSERT(right->representation().IsTagged());
1075
+ bool reversed = op == Token::GT || op == Token::LTE;
1076
+ LOperand* left_operand = UseFixed(left, reversed ? rax : rdx);
1077
+ LOperand* right_operand = UseFixed(right, reversed ? rdx : rax);
1078
+ LCmpTAndBranch* result = new LCmpTAndBranch(left_operand, right_operand);
1079
+ return MarkAsCall(result, instr);
1080
+ }
1081
+ } else if (v->IsIsSmi()) {
1082
+ HIsSmi* compare = HIsSmi::cast(v);
1083
+ ASSERT(compare->value()->representation().IsTagged());
1084
+ return new LIsSmiAndBranch(Use(compare->value()));
1085
+ } else if (v->IsIsUndetectable()) {
1086
+ HIsUndetectable* compare = HIsUndetectable::cast(v);
1087
+ ASSERT(compare->value()->representation().IsTagged());
1088
+ return new LIsUndetectableAndBranch(UseRegisterAtStart(compare->value()),
1089
+ TempRegister());
1090
+ } else if (v->IsHasInstanceType()) {
1091
+ HHasInstanceType* compare = HHasInstanceType::cast(v);
1092
+ ASSERT(compare->value()->representation().IsTagged());
1093
+ return new LHasInstanceTypeAndBranch(UseRegisterAtStart(compare->value()));
1094
+ } else if (v->IsHasCachedArrayIndex()) {
1095
+ HHasCachedArrayIndex* compare = HHasCachedArrayIndex::cast(v);
1096
+ ASSERT(compare->value()->representation().IsTagged());
1097
+ return new LHasCachedArrayIndexAndBranch(
1098
+ UseRegisterAtStart(compare->value()));
1099
+ } else if (v->IsIsNull()) {
1100
+ HIsNull* compare = HIsNull::cast(v);
1101
+ ASSERT(compare->value()->representation().IsTagged());
1102
+ // We only need a temp register for non-strict compare.
1103
+ LOperand* temp = compare->is_strict() ? NULL : TempRegister();
1104
+ return new LIsNullAndBranch(UseRegisterAtStart(compare->value()), temp);
1105
+ } else if (v->IsIsObject()) {
1106
+ HIsObject* compare = HIsObject::cast(v);
1107
+ ASSERT(compare->value()->representation().IsTagged());
1108
+ return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()));
1109
+ } else if (v->IsCompareJSObjectEq()) {
1110
+ HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v);
1111
+ return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()),
1112
+ UseRegisterAtStart(compare->right()));
1113
+ } else if (v->IsCompareSymbolEq()) {
1114
+ HCompareSymbolEq* compare = HCompareSymbolEq::cast(v);
1115
+ return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()),
1116
+ UseRegisterAtStart(compare->right()));
1117
+ } else if (v->IsInstanceOf()) {
1118
+ HInstanceOf* instance_of = HInstanceOf::cast(v);
1119
+ LInstanceOfAndBranch* result =
1120
+ new LInstanceOfAndBranch(UseFixed(instance_of->left(), rax),
1121
+ UseFixed(instance_of->right(), rdx));
1122
+ return MarkAsCall(result, instr);
1123
+ } else if (v->IsTypeofIs()) {
1124
+ HTypeofIs* typeof_is = HTypeofIs::cast(v);
1125
+ return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()));
1126
+ } else if (v->IsIsConstructCall()) {
1127
+ return new LIsConstructCallAndBranch(TempRegister());
1128
+ } else if (v->IsConstant()) {
1129
+ HBasicBlock* successor = HConstant::cast(v)->ToBoolean()
1130
+ ? instr->FirstSuccessor()
1131
+ : instr->SecondSuccessor();
1132
+ return new LGoto(successor->block_id());
1133
+ } else {
1134
+ Abort("Undefined compare before branch");
1135
+ return NULL;
1136
+ }
1137
+ }
1138
+
1139
+
1140
+ LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) {
1141
+ ASSERT(instr->value()->representation().IsTagged());
1142
+ LOperand* value = UseRegisterAtStart(instr->value());
1143
+ return new LCmpMapAndBranch(value);
1144
+ }
1145
+
1146
+
1147
+ LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) {
1148
+ return DefineAsRegister(new LArgumentsLength(Use(length->value())));
1149
+ }
1150
+
1151
+
1152
+ LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
1153
+ return DefineAsRegister(new LArgumentsElements);
1154
+ }
1155
+
1156
+
1157
+ LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1158
+ LOperand* left = UseFixed(instr->left(), rax);
1159
+ LOperand* right = UseFixed(instr->right(), rdx);
1160
+ LInstanceOf* result = new LInstanceOf(left, right);
1161
+ return MarkAsCall(DefineFixed(result, rax), instr);
1162
+ }
1163
+
1164
+
1165
+ LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal(
1166
+ HInstanceOfKnownGlobal* instr) {
1167
+ LInstanceOfKnownGlobal* result =
1168
+ new LInstanceOfKnownGlobal(UseFixed(instr->value(), rax),
1169
+ FixedTemp(rdi));
1170
+ return MarkAsCall(DefineFixed(result, rax), instr);
1171
+ }
1172
+
1173
+
1174
+ LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1175
+ LOperand* function = UseFixed(instr->function(), rdi);
1176
+ LOperand* receiver = UseFixed(instr->receiver(), rax);
1177
+ LOperand* length = UseFixed(instr->length(), rbx);
1178
+ LOperand* elements = UseFixed(instr->elements(), rcx);
1179
+ LApplyArguments* result = new LApplyArguments(function,
1180
+ receiver,
1181
+ length,
1182
+ elements);
1183
+ return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY);
1184
+ }
1185
+
1186
+
1187
+ LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1188
+ ++argument_count_;
1189
+ LOperand* argument = UseOrConstant(instr->argument());
1190
+ return new LPushArgument(argument);
1191
+ }
1192
+
1193
+
1194
+ LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1195
+ return instr->HasNoUses() ? NULL : DefineAsRegister(new LContext);
1196
+ }
1197
+
1198
+
1199
+ LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1200
+ LOperand* context = UseRegisterAtStart(instr->value());
1201
+ return DefineAsRegister(new LOuterContext(context));
1202
+ }
1203
+
1204
+
1205
+ LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1206
+ return DefineAsRegister(new LGlobalObject);
1207
+ }
1208
+
1209
+
1210
+ LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1211
+ LOperand* global_object = UseRegisterAtStart(instr->value());
1212
+ return DefineAsRegister(new LGlobalReceiver(global_object));
1213
+ }
1214
+
1215
+
1216
+ LInstruction* LChunkBuilder::DoCallConstantFunction(
1217
+ HCallConstantFunction* instr) {
1218
+ argument_count_ -= instr->argument_count();
1219
+ return MarkAsCall(DefineFixed(new LCallConstantFunction, rax), instr);
1220
+ }
1221
+
1222
+
1223
+ LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1224
+ LOperand* function = UseFixed(instr->function(), rdi);
1225
+ argument_count_ -= instr->argument_count();
1226
+ LInvokeFunction* result = new LInvokeFunction(function);
1227
+ return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1228
+ }
1229
+
1230
+
1231
+ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1232
+ BuiltinFunctionId op = instr->op();
1233
+ if (op == kMathLog || op == kMathSin || op == kMathCos) {
1234
+ LOperand* input = UseFixedDouble(instr->value(), xmm1);
1235
+ LUnaryMathOperation* result = new LUnaryMathOperation(input);
1236
+ return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1237
+ } else {
1238
+ LOperand* input = UseRegisterAtStart(instr->value());
1239
+ LUnaryMathOperation* result = new LUnaryMathOperation(input);
1240
+ switch (op) {
1241
+ case kMathAbs:
1242
+ return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1243
+ case kMathFloor:
1244
+ return AssignEnvironment(DefineAsRegister(result));
1245
+ case kMathRound:
1246
+ return AssignEnvironment(DefineAsRegister(result));
1247
+ case kMathSqrt:
1248
+ return DefineSameAsFirst(result);
1249
+ case kMathPowHalf:
1250
+ return DefineSameAsFirst(result);
1251
+ default:
1252
+ UNREACHABLE();
1253
+ return NULL;
1254
+ }
1255
+ }
1256
+ }
1257
+
1258
+
1259
+ LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1260
+ ASSERT(instr->key()->representation().IsTagged());
1261
+ LOperand* key = UseFixed(instr->key(), rcx);
1262
+ argument_count_ -= instr->argument_count();
1263
+ LCallKeyed* result = new LCallKeyed(key);
1264
+ return MarkAsCall(DefineFixed(result, rax), instr);
1265
+ }
1266
+
1267
+
1268
+ LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1269
+ argument_count_ -= instr->argument_count();
1270
+ return MarkAsCall(DefineFixed(new LCallNamed, rax), instr);
1271
+ }
1272
+
1273
+
1274
+ LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1275
+ argument_count_ -= instr->argument_count();
1276
+ return MarkAsCall(DefineFixed(new LCallGlobal, rax), instr);
1277
+ }
1278
+
1279
+
1280
+ LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1281
+ argument_count_ -= instr->argument_count();
1282
+ return MarkAsCall(DefineFixed(new LCallKnownGlobal, rax), instr);
1283
+ }
1284
+
1285
+
1286
+ LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1287
+ LOperand* constructor = UseFixed(instr->constructor(), rdi);
1288
+ argument_count_ -= instr->argument_count();
1289
+ LCallNew* result = new LCallNew(constructor);
1290
+ return MarkAsCall(DefineFixed(result, rax), instr);
1291
+ }
1292
+
1293
+
1294
+ LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1295
+ argument_count_ -= instr->argument_count();
1296
+ LCallFunction* result = new LCallFunction();
1297
+ return MarkAsCall(DefineFixed(result, rax), instr);
1298
+ }
1299
+
1300
+
1301
+ LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1302
+ argument_count_ -= instr->argument_count();
1303
+ return MarkAsCall(DefineFixed(new LCallRuntime, rax), instr);
1304
+ }
1305
+
1306
+
1307
+ LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1308
+ return DoShift(Token::SHR, instr);
1309
+ }
1310
+
1311
+
1312
+ LInstruction* LChunkBuilder::DoSar(HSar* instr) {
1313
+ return DoShift(Token::SAR, instr);
1314
+ }
1315
+
1316
+
1317
+ LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1318
+ return DoShift(Token::SHL, instr);
1319
+ }
1320
+
1321
+
1322
+ LInstruction* LChunkBuilder::DoBitAnd(HBitAnd* instr) {
1323
+ return DoBit(Token::BIT_AND, instr);
1324
+ }
1325
+
1326
+
1327
+ LInstruction* LChunkBuilder::DoBitNot(HBitNot* instr) {
1328
+ ASSERT(instr->value()->representation().IsInteger32());
1329
+ ASSERT(instr->representation().IsInteger32());
1330
+ LOperand* input = UseRegisterAtStart(instr->value());
1331
+ LBitNotI* result = new LBitNotI(input);
1332
+ return DefineSameAsFirst(result);
1333
+ }
1334
+
1335
+
1336
+ LInstruction* LChunkBuilder::DoBitOr(HBitOr* instr) {
1337
+ return DoBit(Token::BIT_OR, instr);
1338
+ }
1339
+
1340
+
1341
+ LInstruction* LChunkBuilder::DoBitXor(HBitXor* instr) {
1342
+ return DoBit(Token::BIT_XOR, instr);
1343
+ }
1344
+
1345
+
1346
+ LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1347
+ if (instr->representation().IsDouble()) {
1348
+ return DoArithmeticD(Token::DIV, instr);
1349
+ } else if (instr->representation().IsInteger32()) {
1350
+ // The temporary operand is necessary to ensure that right is not allocated
1351
+ // into rdx.
1352
+ LOperand* temp = FixedTemp(rdx);
1353
+ LOperand* dividend = UseFixed(instr->left(), rax);
1354
+ LOperand* divisor = UseRegister(instr->right());
1355
+ LDivI* result = new LDivI(dividend, divisor, temp);
1356
+ return AssignEnvironment(DefineFixed(result, rax));
1357
+ } else {
1358
+ ASSERT(instr->representation().IsTagged());
1359
+ return DoArithmeticT(Token::DIV, instr);
1360
+ }
1361
+ }
1362
+
1363
+
1364
+ LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1365
+ if (instr->representation().IsInteger32()) {
1366
+ ASSERT(instr->left()->representation().IsInteger32());
1367
+ ASSERT(instr->right()->representation().IsInteger32());
1368
+
1369
+ LInstruction* result;
1370
+ if (instr->HasPowerOf2Divisor()) {
1371
+ ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
1372
+ LOperand* value = UseRegisterAtStart(instr->left());
1373
+ LModI* mod = new LModI(value, UseOrConstant(instr->right()), NULL);
1374
+ result = DefineSameAsFirst(mod);
1375
+ } else {
1376
+ // The temporary operand is necessary to ensure that right is not
1377
+ // allocated into edx.
1378
+ LOperand* temp = FixedTemp(rdx);
1379
+ LOperand* value = UseFixed(instr->left(), rax);
1380
+ LOperand* divisor = UseRegister(instr->right());
1381
+ LModI* mod = new LModI(value, divisor, temp);
1382
+ result = DefineFixed(mod, rdx);
1383
+ }
1384
+
1385
+ return (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1386
+ instr->CheckFlag(HValue::kCanBeDivByZero))
1387
+ ? AssignEnvironment(result)
1388
+ : result;
1389
+ } else if (instr->representation().IsTagged()) {
1390
+ return DoArithmeticT(Token::MOD, instr);
1391
+ } else {
1392
+ ASSERT(instr->representation().IsDouble());
1393
+ // We call a C function for double modulo. It can't trigger a GC.
1394
+ // We need to use fixed result register for the call.
1395
+ // TODO(fschneider): Allow any register as input registers.
1396
+ LOperand* left = UseFixedDouble(instr->left(), xmm2);
1397
+ LOperand* right = UseFixedDouble(instr->right(), xmm1);
1398
+ LArithmeticD* result = new LArithmeticD(Token::MOD, left, right);
1399
+ return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1400
+ }
1401
+ }
1402
+
1403
+
1404
+ LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1405
+ if (instr->representation().IsInteger32()) {
1406
+ ASSERT(instr->left()->representation().IsInteger32());
1407
+ ASSERT(instr->right()->representation().IsInteger32());
1408
+ LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1409
+ LOperand* right = UseOrConstant(instr->MostConstantOperand());
1410
+ LMulI* mul = new LMulI(left, right);
1411
+ return AssignEnvironment(DefineSameAsFirst(mul));
1412
+ } else if (instr->representation().IsDouble()) {
1413
+ return DoArithmeticD(Token::MUL, instr);
1414
+ } else {
1415
+ ASSERT(instr->representation().IsTagged());
1416
+ return DoArithmeticT(Token::MUL, instr);
1417
+ }
1418
+ }
1419
+
1420
+
1421
+ LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1422
+ if (instr->representation().IsInteger32()) {
1423
+ ASSERT(instr->left()->representation().IsInteger32());
1424
+ ASSERT(instr->right()->representation().IsInteger32());
1425
+ LOperand* left = UseRegisterAtStart(instr->left());
1426
+ LOperand* right = UseOrConstantAtStart(instr->right());
1427
+ LSubI* sub = new LSubI(left, right);
1428
+ LInstruction* result = DefineSameAsFirst(sub);
1429
+ if (instr->CheckFlag(HValue::kCanOverflow)) {
1430
+ result = AssignEnvironment(result);
1431
+ }
1432
+ return result;
1433
+ } else if (instr->representation().IsDouble()) {
1434
+ return DoArithmeticD(Token::SUB, instr);
1435
+ } else {
1436
+ ASSERT(instr->representation().IsTagged());
1437
+ return DoArithmeticT(Token::SUB, instr);
1438
+ }
1439
+ }
1440
+
1441
+
1442
+ LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1443
+ if (instr->representation().IsInteger32()) {
1444
+ ASSERT(instr->left()->representation().IsInteger32());
1445
+ ASSERT(instr->right()->representation().IsInteger32());
1446
+ LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
1447
+ LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand());
1448
+ LAddI* add = new LAddI(left, right);
1449
+ LInstruction* result = DefineSameAsFirst(add);
1450
+ if (instr->CheckFlag(HValue::kCanOverflow)) {
1451
+ result = AssignEnvironment(result);
1452
+ }
1453
+ return result;
1454
+ } else if (instr->representation().IsDouble()) {
1455
+ return DoArithmeticD(Token::ADD, instr);
1456
+ } else {
1457
+ ASSERT(instr->representation().IsTagged());
1458
+ return DoArithmeticT(Token::ADD, instr);
1459
+ }
1460
+ return NULL;
1461
+ }
1462
+
1463
+
1464
+ LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1465
+ ASSERT(instr->representation().IsDouble());
1466
+ // We call a C function for double power. It can't trigger a GC.
1467
+ // We need to use fixed result register for the call.
1468
+ Representation exponent_type = instr->right()->representation();
1469
+ ASSERT(instr->left()->representation().IsDouble());
1470
+ LOperand* left = UseFixedDouble(instr->left(), xmm2);
1471
+ LOperand* right = exponent_type.IsDouble() ?
1472
+ UseFixedDouble(instr->right(), xmm1) :
1473
+ #ifdef _WIN64
1474
+ UseFixed(instr->right(), rdx);
1475
+ #else
1476
+ UseFixed(instr->right(), rdi);
1477
+ #endif
1478
+ LPower* result = new LPower(left, right);
1479
+ return MarkAsCall(DefineFixedDouble(result, xmm1), instr,
1480
+ CAN_DEOPTIMIZE_EAGERLY);
1481
+ }
1482
+
1483
+
1484
+ LInstruction* LChunkBuilder::DoCompare(HCompare* instr) {
1485
+ Token::Value op = instr->token();
1486
+ Representation r = instr->GetInputRepresentation();
1487
+ if (r.IsInteger32()) {
1488
+ ASSERT(instr->left()->representation().IsInteger32());
1489
+ ASSERT(instr->right()->representation().IsInteger32());
1490
+ LOperand* left = UseRegisterAtStart(instr->left());
1491
+ LOperand* right = UseOrConstantAtStart(instr->right());
1492
+ return DefineAsRegister(new LCmpID(left, right));
1493
+ } else if (r.IsDouble()) {
1494
+ ASSERT(instr->left()->representation().IsDouble());
1495
+ ASSERT(instr->right()->representation().IsDouble());
1496
+ LOperand* left = UseRegisterAtStart(instr->left());
1497
+ LOperand* right = UseRegisterAtStart(instr->right());
1498
+ return DefineAsRegister(new LCmpID(left, right));
1499
+ } else {
1500
+ ASSERT(instr->left()->representation().IsTagged());
1501
+ ASSERT(instr->right()->representation().IsTagged());
1502
+ bool reversed = (op == Token::GT || op == Token::LTE);
1503
+ LOperand* left = UseFixed(instr->left(), reversed ? rax : rdx);
1504
+ LOperand* right = UseFixed(instr->right(), reversed ? rdx : rax);
1505
+ LCmpT* result = new LCmpT(left, right);
1506
+ return MarkAsCall(DefineFixed(result, rax), instr);
1507
+ }
1508
+ }
1509
+
1510
+
1511
+ LInstruction* LChunkBuilder::DoCompareJSObjectEq(
1512
+ HCompareJSObjectEq* instr) {
1513
+ LOperand* left = UseRegisterAtStart(instr->left());
1514
+ LOperand* right = UseRegisterAtStart(instr->right());
1515
+ LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right);
1516
+ return DefineAsRegister(result);
1517
+ }
1518
+
1519
+
1520
+ LInstruction* LChunkBuilder::DoCompareSymbolEq(
1521
+ HCompareSymbolEq* instr) {
1522
+ LOperand* left = UseRegisterAtStart(instr->left());
1523
+ LOperand* right = UseRegisterAtStart(instr->right());
1524
+ LCmpSymbolEq* result = new LCmpSymbolEq(left, right);
1525
+ return DefineAsRegister(result);
1526
+ }
1527
+
1528
+
1529
+ LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) {
1530
+ ASSERT(instr->value()->representation().IsTagged());
1531
+ LOperand* value = UseRegisterAtStart(instr->value());
1532
+
1533
+ return DefineAsRegister(new LIsNull(value));
1534
+ }
1535
+
1536
+
1537
+ LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) {
1538
+ ASSERT(instr->value()->representation().IsTagged());
1539
+ LOperand* value = UseRegister(instr->value());
1540
+
1541
+ return DefineAsRegister(new LIsObject(value));
1542
+ }
1543
+
1544
+
1545
+ LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) {
1546
+ ASSERT(instr->value()->representation().IsTagged());
1547
+ LOperand* value = UseAtStart(instr->value());
1548
+
1549
+ return DefineAsRegister(new LIsSmi(value));
1550
+ }
1551
+
1552
+
1553
+ LInstruction* LChunkBuilder::DoIsUndetectable(HIsUndetectable* instr) {
1554
+ ASSERT(instr->value()->representation().IsTagged());
1555
+ LOperand* value = UseRegisterAtStart(instr->value());
1556
+
1557
+ return DefineAsRegister(new LIsUndetectable(value));
1558
+ }
1559
+
1560
+
1561
+ LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) {
1562
+ ASSERT(instr->value()->representation().IsTagged());
1563
+ LOperand* value = UseRegisterAtStart(instr->value());
1564
+
1565
+ return DefineAsRegister(new LHasInstanceType(value));
1566
+ }
1567
+
1568
+
1569
+ LInstruction* LChunkBuilder::DoGetCachedArrayIndex(
1570
+ HGetCachedArrayIndex* instr) {
1571
+ ASSERT(instr->value()->representation().IsTagged());
1572
+ LOperand* value = UseRegisterAtStart(instr->value());
1573
+
1574
+ return DefineAsRegister(new LGetCachedArrayIndex(value));
1575
+ }
1576
+
1577
+
1578
+ LInstruction* LChunkBuilder::DoHasCachedArrayIndex(
1579
+ HHasCachedArrayIndex* instr) {
1580
+ ASSERT(instr->value()->representation().IsTagged());
1581
+ LOperand* value = UseRegister(instr->value());
1582
+ return DefineAsRegister(new LHasCachedArrayIndex(value));
1583
+ }
1584
+
1585
+
1586
+ LInstruction* LChunkBuilder::DoClassOfTest(HClassOfTest* instr) {
1587
+ Abort("Unimplemented: %s", "DoClassOfTest");
1588
+ return NULL;
1589
+ }
1590
+
1591
+
1592
+ LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) {
1593
+ LOperand* array = UseRegisterAtStart(instr->value());
1594
+ return DefineAsRegister(new LJSArrayLength(array));
1595
+ }
1596
+
1597
+
1598
+ LInstruction* LChunkBuilder::DoFixedArrayLength(HFixedArrayLength* instr) {
1599
+ LOperand* array = UseRegisterAtStart(instr->value());
1600
+ return DefineAsRegister(new LFixedArrayLength(array));
1601
+ }
1602
+
1603
+
1604
+ LInstruction* LChunkBuilder::DoExternalArrayLength(
1605
+ HExternalArrayLength* instr) {
1606
+ LOperand* array = UseRegisterAtStart(instr->value());
1607
+ return DefineAsRegister(new LExternalArrayLength(array));
1608
+ }
1609
+
1610
+
1611
+ LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
1612
+ LOperand* object = UseRegister(instr->value());
1613
+ LValueOf* result = new LValueOf(object);
1614
+ return AssignEnvironment(DefineSameAsFirst(result));
1615
+ }
1616
+
1617
+
1618
+ LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1619
+ return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()),
1620
+ Use(instr->length())));
1621
+ }
1622
+
1623
+
1624
+ LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1625
+ // The control instruction marking the end of a block that completed
1626
+ // abruptly (e.g., threw an exception). There is nothing specific to do.
1627
+ return NULL;
1628
+ }
1629
+
1630
+
1631
+ LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1632
+ LOperand* value = UseFixed(instr->value(), rax);
1633
+ return MarkAsCall(new LThrow(value), instr);
1634
+ }
1635
+
1636
+
1637
+ LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) {
1638
+ // All HForceRepresentation instructions should be eliminated in the
1639
+ // representation change phase of Hydrogen.
1640
+ UNREACHABLE();
1641
+ return NULL;
1642
+ }
1643
+
1644
+
1645
+ LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1646
+ Representation from = instr->from();
1647
+ Representation to = instr->to();
1648
+ if (from.IsTagged()) {
1649
+ if (to.IsDouble()) {
1650
+ LOperand* value = UseRegister(instr->value());
1651
+ LNumberUntagD* res = new LNumberUntagD(value);
1652
+ return AssignEnvironment(DefineAsRegister(res));
1653
+ } else {
1654
+ ASSERT(to.IsInteger32());
1655
+ LOperand* value = UseRegister(instr->value());
1656
+ bool needs_check = !instr->value()->type().IsSmi();
1657
+ if (needs_check) {
1658
+ LOperand* xmm_temp = instr->CanTruncateToInt32() ? NULL
1659
+ : FixedTemp(xmm1);
1660
+ LTaggedToI* res = new LTaggedToI(value, xmm_temp);
1661
+ return AssignEnvironment(DefineSameAsFirst(res));
1662
+ } else {
1663
+ return DefineSameAsFirst(new LSmiUntag(value, needs_check));
1664
+ }
1665
+ }
1666
+ } else if (from.IsDouble()) {
1667
+ if (to.IsTagged()) {
1668
+ LOperand* value = UseRegister(instr->value());
1669
+ LOperand* temp = TempRegister();
1670
+
1671
+ // Make sure that temp and result_temp are different registers.
1672
+ LUnallocated* result_temp = TempRegister();
1673
+ LNumberTagD* result = new LNumberTagD(value, temp);
1674
+ return AssignPointerMap(Define(result, result_temp));
1675
+ } else {
1676
+ ASSERT(to.IsInteger32());
1677
+ LOperand* value = UseRegister(instr->value());
1678
+ return AssignEnvironment(DefineAsRegister(new LDoubleToI(value)));
1679
+ }
1680
+ } else if (from.IsInteger32()) {
1681
+ if (to.IsTagged()) {
1682
+ HValue* val = instr->value();
1683
+ LOperand* value = UseRegister(val);
1684
+ if (val->HasRange() && val->range()->IsInSmiRange()) {
1685
+ return DefineSameAsFirst(new LSmiTag(value));
1686
+ } else {
1687
+ LNumberTagI* result = new LNumberTagI(value);
1688
+ return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1689
+ }
1690
+ } else {
1691
+ ASSERT(to.IsDouble());
1692
+ return DefineAsRegister(new LInteger32ToDouble(Use(instr->value())));
1693
+ }
1694
+ }
1695
+ UNREACHABLE();
1696
+ return NULL;
1697
+ }
1698
+
1699
+
1700
+ LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
1701
+ LOperand* value = UseRegisterAtStart(instr->value());
1702
+ return AssignEnvironment(new LCheckNonSmi(value));
1703
+ }
1704
+
1705
+
1706
+ LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1707
+ LOperand* value = UseRegisterAtStart(instr->value());
1708
+ LCheckInstanceType* result = new LCheckInstanceType(value);
1709
+ return AssignEnvironment(result);
1710
+ }
1711
+
1712
+
1713
+ LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
1714
+ LOperand* temp = TempRegister();
1715
+ LCheckPrototypeMaps* result = new LCheckPrototypeMaps(temp);
1716
+ return AssignEnvironment(result);
1717
+ }
1718
+
1719
+
1720
+ LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1721
+ LOperand* value = UseRegisterAtStart(instr->value());
1722
+ return AssignEnvironment(new LCheckSmi(value));
1723
+ }
1724
+
1725
+
1726
+ LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
1727
+ LOperand* value = UseRegisterAtStart(instr->value());
1728
+ return AssignEnvironment(new LCheckFunction(value));
1729
+ }
1730
+
1731
+
1732
+ LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) {
1733
+ LOperand* value = UseRegisterAtStart(instr->value());
1734
+ LCheckMap* result = new LCheckMap(value);
1735
+ return AssignEnvironment(result);
1736
+ }
1737
+
1738
+
1739
+ LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
1740
+ HValue* value = instr->value();
1741
+ Representation input_rep = value->representation();
1742
+ LOperand* reg = UseRegister(value);
1743
+ if (input_rep.IsDouble()) {
1744
+ return DefineAsRegister(new LClampDToUint8(reg,
1745
+ TempRegister()));
1746
+ } else if (input_rep.IsInteger32()) {
1747
+ return DefineSameAsFirst(new LClampIToUint8(reg));
1748
+ } else {
1749
+ ASSERT(input_rep.IsTagged());
1750
+ // Register allocator doesn't (yet) support allocation of double
1751
+ // temps. Reserve xmm1 explicitly.
1752
+ LClampTToUint8* result = new LClampTToUint8(reg,
1753
+ TempRegister(),
1754
+ FixedTemp(xmm1));
1755
+ return AssignEnvironment(DefineSameAsFirst(result));
1756
+ }
1757
+ }
1758
+
1759
+
1760
+ LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1761
+ return new LReturn(UseFixed(instr->value(), rax));
1762
+ }
1763
+
1764
+
1765
+ LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1766
+ Representation r = instr->representation();
1767
+ if (r.IsInteger32()) {
1768
+ return DefineAsRegister(new LConstantI);
1769
+ } else if (r.IsDouble()) {
1770
+ LOperand* temp = TempRegister();
1771
+ return DefineAsRegister(new LConstantD(temp));
1772
+ } else if (r.IsTagged()) {
1773
+ return DefineAsRegister(new LConstantT);
1774
+ } else {
1775
+ UNREACHABLE();
1776
+ return NULL;
1777
+ }
1778
+ }
1779
+
1780
+
1781
+ LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
1782
+ LLoadGlobalCell* result = new LLoadGlobalCell;
1783
+ return instr->check_hole_value()
1784
+ ? AssignEnvironment(DefineAsRegister(result))
1785
+ : DefineAsRegister(result);
1786
+ }
1787
+
1788
+
1789
+ LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
1790
+ LOperand* global_object = UseFixed(instr->global_object(), rax);
1791
+ LLoadGlobalGeneric* result = new LLoadGlobalGeneric(global_object);
1792
+ return MarkAsCall(DefineFixed(result, rax), instr);
1793
+ }
1794
+
1795
+
1796
+ LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
1797
+ LStoreGlobalCell* result =
1798
+ new LStoreGlobalCell(UseRegister(instr->value()), TempRegister());
1799
+ return instr->check_hole_value() ? AssignEnvironment(result) : result;
1800
+ }
1801
+
1802
+
1803
+ LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
1804
+ LOperand* global_object = UseFixed(instr->global_object(), rdx);
1805
+ LOperand* value = UseFixed(instr->value(), rax);
1806
+ LStoreGlobalGeneric* result = new LStoreGlobalGeneric(global_object, value);
1807
+ return MarkAsCall(result, instr);
1808
+ }
1809
+
1810
+
1811
+ LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
1812
+ LOperand* context = UseRegisterAtStart(instr->value());
1813
+ return DefineAsRegister(new LLoadContextSlot(context));
1814
+ }
1815
+
1816
+
1817
+ LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
1818
+ LOperand* context;
1819
+ LOperand* value;
1820
+ LOperand* temp;
1821
+ if (instr->NeedsWriteBarrier()) {
1822
+ context = UseTempRegister(instr->context());
1823
+ value = UseTempRegister(instr->value());
1824
+ temp = TempRegister();
1825
+ } else {
1826
+ context = UseRegister(instr->context());
1827
+ value = UseRegister(instr->value());
1828
+ temp = NULL;
1829
+ }
1830
+ return new LStoreContextSlot(context, value, temp);
1831
+ }
1832
+
1833
+
1834
+ LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
1835
+ ASSERT(instr->representation().IsTagged());
1836
+ LOperand* obj = UseRegisterAtStart(instr->object());
1837
+ return DefineAsRegister(new LLoadNamedField(obj));
1838
+ }
1839
+
1840
+
1841
+ LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic(
1842
+ HLoadNamedFieldPolymorphic* instr) {
1843
+ ASSERT(instr->representation().IsTagged());
1844
+ if (instr->need_generic()) {
1845
+ LOperand* obj = UseFixed(instr->object(), rax);
1846
+ LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj);
1847
+ return MarkAsCall(DefineFixed(result, rax), instr);
1848
+ } else {
1849
+ LOperand* obj = UseRegisterAtStart(instr->object());
1850
+ LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj);
1851
+ return AssignEnvironment(DefineAsRegister(result));
1852
+ }
1853
+ }
1854
+
1855
+
1856
+ LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
1857
+ LOperand* object = UseFixed(instr->object(), rax);
1858
+ LLoadNamedGeneric* result = new LLoadNamedGeneric(object);
1859
+ return MarkAsCall(DefineFixed(result, rax), instr);
1860
+ }
1861
+
1862
+
1863
+ LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
1864
+ HLoadFunctionPrototype* instr) {
1865
+ return AssignEnvironment(DefineAsRegister(
1866
+ new LLoadFunctionPrototype(UseRegister(instr->function()))));
1867
+ }
1868
+
1869
+
1870
+ LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) {
1871
+ LOperand* input = UseRegisterAtStart(instr->value());
1872
+ return DefineAsRegister(new LLoadElements(input));
1873
+ }
1874
+
1875
+
1876
+ LInstruction* LChunkBuilder::DoLoadExternalArrayPointer(
1877
+ HLoadExternalArrayPointer* instr) {
1878
+ LOperand* input = UseRegisterAtStart(instr->value());
1879
+ return DefineAsRegister(new LLoadExternalArrayPointer(input));
1880
+ }
1881
+
1882
+
1883
+ LInstruction* LChunkBuilder::DoLoadKeyedFastElement(
1884
+ HLoadKeyedFastElement* instr) {
1885
+ ASSERT(instr->representation().IsTagged());
1886
+ ASSERT(instr->key()->representation().IsInteger32());
1887
+ LOperand* obj = UseRegisterAtStart(instr->object());
1888
+ LOperand* key = UseRegisterAtStart(instr->key());
1889
+ LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key);
1890
+ return AssignEnvironment(DefineSameAsFirst(result));
1891
+ }
1892
+
1893
+
1894
+ LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement(
1895
+ HLoadKeyedSpecializedArrayElement* instr) {
1896
+ ExternalArrayType array_type = instr->array_type();
1897
+ Representation representation(instr->representation());
1898
+ ASSERT(
1899
+ (representation.IsInteger32() && (array_type != kExternalFloatArray &&
1900
+ array_type != kExternalDoubleArray)) ||
1901
+ (representation.IsDouble() && (array_type == kExternalFloatArray ||
1902
+ array_type == kExternalDoubleArray)));
1903
+ ASSERT(instr->key()->representation().IsInteger32());
1904
+ LOperand* external_pointer = UseRegister(instr->external_pointer());
1905
+ LOperand* key = UseRegisterOrConstant(instr->key());
1906
+ LLoadKeyedSpecializedArrayElement* result =
1907
+ new LLoadKeyedSpecializedArrayElement(external_pointer, key);
1908
+ LInstruction* load_instr = DefineAsRegister(result);
1909
+ // An unsigned int array load might overflow and cause a deopt, make sure it
1910
+ // has an environment.
1911
+ return (array_type == kExternalUnsignedIntArray) ?
1912
+ AssignEnvironment(load_instr) : load_instr;
1913
+ }
1914
+
1915
+
1916
+ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1917
+ LOperand* object = UseFixed(instr->object(), rdx);
1918
+ LOperand* key = UseFixed(instr->key(), rax);
1919
+
1920
+ LLoadKeyedGeneric* result = new LLoadKeyedGeneric(object, key);
1921
+ return MarkAsCall(DefineFixed(result, rax), instr);
1922
+ }
1923
+
1924
+
1925
+ LInstruction* LChunkBuilder::DoStoreKeyedFastElement(
1926
+ HStoreKeyedFastElement* instr) {
1927
+ bool needs_write_barrier = instr->NeedsWriteBarrier();
1928
+ ASSERT(instr->value()->representation().IsTagged());
1929
+ ASSERT(instr->object()->representation().IsTagged());
1930
+ ASSERT(instr->key()->representation().IsInteger32());
1931
+
1932
+ LOperand* obj = UseTempRegister(instr->object());
1933
+ LOperand* val = needs_write_barrier
1934
+ ? UseTempRegister(instr->value())
1935
+ : UseRegisterAtStart(instr->value());
1936
+ LOperand* key = needs_write_barrier
1937
+ ? UseTempRegister(instr->key())
1938
+ : UseRegisterOrConstantAtStart(instr->key());
1939
+
1940
+ return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val));
1941
+ }
1942
+
1943
+
1944
+ LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement(
1945
+ HStoreKeyedSpecializedArrayElement* instr) {
1946
+ Representation representation(instr->value()->representation());
1947
+ ExternalArrayType array_type = instr->array_type();
1948
+ ASSERT(
1949
+ (representation.IsInteger32() && (array_type != kExternalFloatArray &&
1950
+ array_type != kExternalDoubleArray)) ||
1951
+ (representation.IsDouble() && (array_type == kExternalFloatArray ||
1952
+ array_type == kExternalDoubleArray)));
1953
+ ASSERT(instr->external_pointer()->representation().IsExternal());
1954
+ ASSERT(instr->key()->representation().IsInteger32());
1955
+
1956
+ LOperand* external_pointer = UseRegister(instr->external_pointer());
1957
+ bool val_is_temp_register = array_type == kExternalPixelArray ||
1958
+ array_type == kExternalFloatArray;
1959
+ LOperand* val = val_is_temp_register
1960
+ ? UseTempRegister(instr->value())
1961
+ : UseRegister(instr->value());
1962
+ LOperand* key = UseRegisterOrConstant(instr->key());
1963
+
1964
+ return new LStoreKeyedSpecializedArrayElement(external_pointer,
1965
+ key,
1966
+ val);
1967
+ }
1968
+
1969
+
1970
+ LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
1971
+ LOperand* object = UseFixed(instr->object(), rdx);
1972
+ LOperand* key = UseFixed(instr->key(), rcx);
1973
+ LOperand* value = UseFixed(instr->value(), rax);
1974
+
1975
+ ASSERT(instr->object()->representation().IsTagged());
1976
+ ASSERT(instr->key()->representation().IsTagged());
1977
+ ASSERT(instr->value()->representation().IsTagged());
1978
+
1979
+ LStoreKeyedGeneric* result = new LStoreKeyedGeneric(object, key, value);
1980
+ return MarkAsCall(result, instr);
1981
+ }
1982
+
1983
+
1984
+ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
1985
+ bool needs_write_barrier = instr->NeedsWriteBarrier();
1986
+
1987
+ LOperand* obj = needs_write_barrier
1988
+ ? UseTempRegister(instr->object())
1989
+ : UseRegisterAtStart(instr->object());
1990
+
1991
+ LOperand* val = needs_write_barrier
1992
+ ? UseTempRegister(instr->value())
1993
+ : UseRegister(instr->value());
1994
+
1995
+ // We only need a scratch register if we have a write barrier or we
1996
+ // have a store into the properties array (not in-object-property).
1997
+ LOperand* temp = (!instr->is_in_object() || needs_write_barrier)
1998
+ ? TempRegister() : NULL;
1999
+
2000
+ return new LStoreNamedField(obj, val, temp);
2001
+ }
2002
+
2003
+
2004
+ LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2005
+ LOperand* object = UseFixed(instr->object(), rdx);
2006
+ LOperand* value = UseFixed(instr->value(), rax);
2007
+
2008
+ LStoreNamedGeneric* result = new LStoreNamedGeneric(object, value);
2009
+ return MarkAsCall(result, instr);
2010
+ }
2011
+
2012
+
2013
+ LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2014
+ LOperand* left = UseOrConstantAtStart(instr->left());
2015
+ LOperand* right = UseOrConstantAtStart(instr->right());
2016
+ return MarkAsCall(DefineFixed(new LStringAdd(left, right), rax), instr);
2017
+ }
2018
+
2019
+
2020
+ LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2021
+ LOperand* string = UseRegister(instr->string());
2022
+ LOperand* index = UseRegisterOrConstant(instr->index());
2023
+ LStringCharCodeAt* result = new LStringCharCodeAt(string, index);
2024
+ return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
2025
+ }
2026
+
2027
+
2028
+ LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2029
+ LOperand* char_code = UseRegister(instr->value());
2030
+ LStringCharFromCode* result = new LStringCharFromCode(char_code);
2031
+ return AssignPointerMap(DefineAsRegister(result));
2032
+ }
2033
+
2034
+
2035
+ LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) {
2036
+ LOperand* string = UseRegisterAtStart(instr->value());
2037
+ return DefineAsRegister(new LStringLength(string));
2038
+ }
2039
+
2040
+
2041
+ LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) {
2042
+ return MarkAsCall(DefineFixed(new LArrayLiteral, rax), instr);
2043
+ }
2044
+
2045
+
2046
+ LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) {
2047
+ return MarkAsCall(DefineFixed(new LObjectLiteral, rax), instr);
2048
+ }
2049
+
2050
+
2051
+ LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2052
+ return MarkAsCall(DefineFixed(new LRegExpLiteral, rax), instr);
2053
+ }
2054
+
2055
+
2056
+ LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2057
+ return MarkAsCall(DefineFixed(new LFunctionLiteral, rax), instr);
2058
+ }
2059
+
2060
+
2061
+ LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) {
2062
+ LDeleteProperty* result =
2063
+ new LDeleteProperty(UseAtStart(instr->object()),
2064
+ UseOrConstantAtStart(instr->key()));
2065
+ return MarkAsCall(DefineFixed(result, rax), instr);
2066
+ }
2067
+
2068
+
2069
+ LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2070
+ allocator_->MarkAsOsrEntry();
2071
+ current_block_->last_environment()->set_ast_id(instr->ast_id());
2072
+ return AssignEnvironment(new LOsrEntry);
2073
+ }
2074
+
2075
+
2076
+ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
2077
+ int spill_index = chunk()->GetParameterStackSlot(instr->index());
2078
+ return DefineAsSpilled(new LParameter, spill_index);
2079
+ }
2080
+
2081
+
2082
+ LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
2083
+ int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
2084
+ return DefineAsSpilled(new LUnknownOSRValue, spill_index);
2085
+ }
2086
+
2087
+
2088
+ LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2089
+ argument_count_ -= instr->argument_count();
2090
+ return MarkAsCall(DefineFixed(new LCallStub, rax), instr);
2091
+ }
2092
+
2093
+
2094
+ LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2095
+ // There are no real uses of the arguments object.
2096
+ // arguments.length and element access are supported directly on
2097
+ // stack arguments, and any real arguments object use causes a bailout.
2098
+ // So this value is never used.
2099
+ return NULL;
2100
+ }
2101
+
2102
+
2103
+ LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2104
+ LOperand* arguments = UseRegister(instr->arguments());
2105
+ LOperand* length = UseTempRegister(instr->length());
2106
+ LOperand* index = Use(instr->index());
2107
+ LAccessArgumentsAt* result = new LAccessArgumentsAt(arguments, length, index);
2108
+ return AssignEnvironment(DefineAsRegister(result));
2109
+ }
2110
+
2111
+
2112
+ LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2113
+ LOperand* object = UseFixed(instr->value(), rax);
2114
+ LToFastProperties* result = new LToFastProperties(object);
2115
+ return MarkAsCall(DefineFixed(result, rax), instr);
2116
+ }
2117
+
2118
+
2119
+ LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2120
+ LTypeof* result = new LTypeof(UseAtStart(instr->value()));
2121
+ return MarkAsCall(DefineFixed(result, rax), instr);
2122
+ }
2123
+
2124
+
2125
+ LInstruction* LChunkBuilder::DoTypeofIs(HTypeofIs* instr) {
2126
+ return DefineSameAsFirst(new LTypeofIs(UseRegister(instr->value())));
2127
+ }
2128
+
2129
+
2130
+ LInstruction* LChunkBuilder::DoIsConstructCall(HIsConstructCall* instr) {
2131
+ return DefineAsRegister(new LIsConstructCall);
2132
+ }
2133
+
2134
+
2135
+ LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2136
+ HEnvironment* env = current_block_->last_environment();
2137
+ ASSERT(env != NULL);
2138
+
2139
+ env->set_ast_id(instr->ast_id());
2140
+
2141
+ env->Drop(instr->pop_count());
2142
+ for (int i = 0; i < instr->values()->length(); ++i) {
2143
+ HValue* value = instr->values()->at(i);
2144
+ if (instr->HasAssignedIndexAt(i)) {
2145
+ env->Bind(instr->GetAssignedIndexAt(i), value);
2146
+ } else {
2147
+ env->Push(value);
2148
+ }
2149
+ }
2150
+
2151
+ // If there is an instruction pending deoptimization environment create a
2152
+ // lazy bailout instruction to capture the environment.
2153
+ if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2154
+ LLazyBailout* lazy_bailout = new LLazyBailout;
2155
+ LInstruction* result = AssignEnvironment(lazy_bailout);
2156
+ instruction_pending_deoptimization_environment_->
2157
+ set_deoptimization_environment(result->environment());
2158
+ ClearInstructionPendingDeoptimizationEnvironment();
2159
+ return result;
2160
+ }
2161
+
2162
+ return NULL;
2163
+ }
2164
+
2165
+
2166
+ LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2167
+ return MarkAsCall(new LStackCheck, instr);
2168
+ }
2169
+
2170
+
2171
+ LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2172
+ HEnvironment* outer = current_block_->last_environment();
2173
+ HConstant* undefined = graph()->GetConstantUndefined();
2174
+ HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2175
+ instr->function(),
2176
+ HEnvironment::LITHIUM,
2177
+ undefined,
2178
+ instr->call_kind());
2179
+ current_block_->UpdateEnvironment(inner);
2180
+ chunk_->AddInlinedClosure(instr->closure());
2181
+ return NULL;
2182
+ }
2183
+
2184
+
2185
+ LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2186
+ HEnvironment* outer = current_block_->last_environment()->outer();
2187
+ current_block_->UpdateEnvironment(outer);
2188
+ return NULL;
2189
+ }
2190
+
2191
+
2192
+ LInstruction* LChunkBuilder::DoIn(HIn* instr) {
2193
+ LOperand* key = UseOrConstantAtStart(instr->key());
2194
+ LOperand* object = UseOrConstantAtStart(instr->object());
2195
+ LIn* result = new LIn(key, object);
2196
+ return MarkAsCall(DefineFixed(result, rax), instr);
2197
+ }
2198
+
2199
+
2200
+ } } // namespace v8::internal
2201
+
2202
+ #endif // V8_TARGET_ARCH_X64