libv8-freebsd 3.3.10.4

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