libv8 3.3.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (700) hide show
  1. data/.gitignore +8 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +44 -0
  5. data/Rakefile +73 -0
  6. data/ext/libv8/extconf.rb +9 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +38 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  11. data/lib/libv8/scons/CHANGES.txt +5334 -0
  12. data/lib/libv8/scons/LICENSE.txt +20 -0
  13. data/lib/libv8/scons/MANIFEST +199 -0
  14. data/lib/libv8/scons/PKG-INFO +13 -0
  15. data/lib/libv8/scons/README.txt +243 -0
  16. data/lib/libv8/scons/RELEASE.txt +98 -0
  17. data/lib/libv8/scons/engine/SCons/Action.py +1241 -0
  18. data/lib/libv8/scons/engine/SCons/Builder.py +877 -0
  19. data/lib/libv8/scons/engine/SCons/CacheDir.py +216 -0
  20. data/lib/libv8/scons/engine/SCons/Conftest.py +793 -0
  21. data/lib/libv8/scons/engine/SCons/Debug.py +220 -0
  22. data/lib/libv8/scons/engine/SCons/Defaults.py +480 -0
  23. data/lib/libv8/scons/engine/SCons/Environment.py +2318 -0
  24. data/lib/libv8/scons/engine/SCons/Errors.py +205 -0
  25. data/lib/libv8/scons/engine/SCons/Executor.py +633 -0
  26. data/lib/libv8/scons/engine/SCons/Job.py +435 -0
  27. data/lib/libv8/scons/engine/SCons/Memoize.py +244 -0
  28. data/lib/libv8/scons/engine/SCons/Node/Alias.py +152 -0
  29. data/lib/libv8/scons/engine/SCons/Node/FS.py +3142 -0
  30. data/lib/libv8/scons/engine/SCons/Node/Python.py +128 -0
  31. data/lib/libv8/scons/engine/SCons/Node/__init__.py +1328 -0
  32. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +50 -0
  33. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +50 -0
  34. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +50 -0
  35. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +50 -0
  36. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +76 -0
  37. data/lib/libv8/scons/engine/SCons/Options/__init__.py +67 -0
  38. data/lib/libv8/scons/engine/SCons/PathList.py +231 -0
  39. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +241 -0
  40. data/lib/libv8/scons/engine/SCons/Platform/aix.py +69 -0
  41. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +55 -0
  42. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +46 -0
  43. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +46 -0
  44. data/lib/libv8/scons/engine/SCons/Platform/irix.py +44 -0
  45. data/lib/libv8/scons/engine/SCons/Platform/os2.py +58 -0
  46. data/lib/libv8/scons/engine/SCons/Platform/posix.py +263 -0
  47. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +50 -0
  48. data/lib/libv8/scons/engine/SCons/Platform/win32.py +385 -0
  49. data/lib/libv8/scons/engine/SCons/SConf.py +1030 -0
  50. data/lib/libv8/scons/engine/SCons/SConsign.py +383 -0
  51. data/lib/libv8/scons/engine/SCons/Scanner/C.py +132 -0
  52. data/lib/libv8/scons/engine/SCons/Scanner/D.py +73 -0
  53. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +109 -0
  54. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +316 -0
  55. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +48 -0
  56. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +384 -0
  57. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +101 -0
  58. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +55 -0
  59. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +413 -0
  60. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +384 -0
  61. data/lib/libv8/scons/engine/SCons/Script/Main.py +1334 -0
  62. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +939 -0
  63. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +640 -0
  64. data/lib/libv8/scons/engine/SCons/Script/__init__.py +412 -0
  65. data/lib/libv8/scons/engine/SCons/Sig.py +63 -0
  66. data/lib/libv8/scons/engine/SCons/Subst.py +904 -0
  67. data/lib/libv8/scons/engine/SCons/Taskmaster.py +1017 -0
  68. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +61 -0
  69. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +67 -0
  70. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +73 -0
  71. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +246 -0
  72. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +323 -0
  73. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  74. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  75. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +240 -0
  76. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +82 -0
  77. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +391 -0
  78. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +456 -0
  79. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +499 -0
  80. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +103 -0
  81. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +137 -0
  82. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +64 -0
  83. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +64 -0
  84. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +71 -0
  85. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +681 -0
  86. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +82 -0
  87. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +74 -0
  88. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +80 -0
  89. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +76 -0
  90. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +71 -0
  91. data/lib/libv8/scons/engine/SCons/Tool/ar.py +63 -0
  92. data/lib/libv8/scons/engine/SCons/Tool/as.py +78 -0
  93. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +81 -0
  94. data/lib/libv8/scons/engine/SCons/Tool/c++.py +99 -0
  95. data/lib/libv8/scons/engine/SCons/Tool/cc.py +102 -0
  96. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +58 -0
  97. data/lib/libv8/scons/engine/SCons/Tool/default.py +50 -0
  98. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +223 -0
  99. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +64 -0
  100. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +124 -0
  101. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +94 -0
  102. data/lib/libv8/scons/engine/SCons/Tool/f77.py +62 -0
  103. data/lib/libv8/scons/engine/SCons/Tool/f90.py +62 -0
  104. data/lib/libv8/scons/engine/SCons/Tool/f95.py +63 -0
  105. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +98 -0
  106. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +62 -0
  107. data/lib/libv8/scons/engine/SCons/Tool/g++.py +90 -0
  108. data/lib/libv8/scons/engine/SCons/Tool/g77.py +73 -0
  109. data/lib/libv8/scons/engine/SCons/Tool/gas.py +53 -0
  110. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +80 -0
  111. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +64 -0
  112. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +63 -0
  113. data/lib/libv8/scons/engine/SCons/Tool/gs.py +81 -0
  114. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +84 -0
  115. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +53 -0
  116. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +77 -0
  117. data/lib/libv8/scons/engine/SCons/Tool/icc.py +59 -0
  118. data/lib/libv8/scons/engine/SCons/Tool/icl.py +52 -0
  119. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +72 -0
  120. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +88 -0
  121. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +59 -0
  122. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +60 -0
  123. data/lib/libv8/scons/engine/SCons/Tool/install.py +229 -0
  124. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +482 -0
  125. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +67 -0
  126. data/lib/libv8/scons/engine/SCons/Tool/jar.py +110 -0
  127. data/lib/libv8/scons/engine/SCons/Tool/javac.py +230 -0
  128. data/lib/libv8/scons/engine/SCons/Tool/javah.py +137 -0
  129. data/lib/libv8/scons/engine/SCons/Tool/latex.py +79 -0
  130. data/lib/libv8/scons/engine/SCons/Tool/lex.py +97 -0
  131. data/lib/libv8/scons/engine/SCons/Tool/link.py +121 -0
  132. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +112 -0
  133. data/lib/libv8/scons/engine/SCons/Tool/m4.py +63 -0
  134. data/lib/libv8/scons/engine/SCons/Tool/masm.py +77 -0
  135. data/lib/libv8/scons/engine/SCons/Tool/midl.py +88 -0
  136. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +158 -0
  137. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +64 -0
  138. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +266 -0
  139. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +50 -0
  140. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +268 -0
  141. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +1388 -0
  142. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +207 -0
  143. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +107 -0
  144. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +72 -0
  145. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +312 -0
  146. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  147. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +527 -0
  148. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +365 -0
  149. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  150. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  151. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  152. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  153. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  154. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  155. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +78 -0
  156. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +83 -0
  157. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +108 -0
  158. data/lib/libv8/scons/engine/SCons/Tool/qt.py +336 -0
  159. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +120 -0
  160. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +70 -0
  161. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +132 -0
  162. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +68 -0
  163. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +58 -0
  164. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +53 -0
  165. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +63 -0
  166. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +67 -0
  167. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +142 -0
  168. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +58 -0
  169. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +63 -0
  170. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +64 -0
  171. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +64 -0
  172. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +77 -0
  173. data/lib/libv8/scons/engine/SCons/Tool/swig.py +182 -0
  174. data/lib/libv8/scons/engine/SCons/Tool/tar.py +73 -0
  175. data/lib/libv8/scons/engine/SCons/Tool/tex.py +813 -0
  176. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +175 -0
  177. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +53 -0
  178. data/lib/libv8/scons/engine/SCons/Tool/wix.py +99 -0
  179. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +130 -0
  180. data/lib/libv8/scons/engine/SCons/Tool/zip.py +99 -0
  181. data/lib/libv8/scons/engine/SCons/Util.py +1492 -0
  182. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +89 -0
  183. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +103 -0
  184. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +135 -0
  185. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +106 -0
  186. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +147 -0
  187. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +312 -0
  188. data/lib/libv8/scons/engine/SCons/Warnings.py +246 -0
  189. data/lib/libv8/scons/engine/SCons/__init__.py +49 -0
  190. data/lib/libv8/scons/engine/SCons/compat/__init__.py +237 -0
  191. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +150 -0
  192. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +45 -0
  193. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +45 -0
  194. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +76 -0
  195. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +45 -0
  196. data/lib/libv8/scons/engine/SCons/compat/_scons_sets.py +563 -0
  197. data/lib/libv8/scons/engine/SCons/compat/_scons_subprocess.py +1281 -0
  198. data/lib/libv8/scons/engine/SCons/cpp.py +589 -0
  199. data/lib/libv8/scons/engine/SCons/dblite.py +251 -0
  200. data/lib/libv8/scons/engine/SCons/exitfuncs.py +77 -0
  201. data/lib/libv8/scons/os_spawnv_fix.diff +83 -0
  202. data/lib/libv8/scons/scons-time.1 +1017 -0
  203. data/lib/libv8/scons/scons.1 +15219 -0
  204. data/lib/libv8/scons/sconsign.1 +208 -0
  205. data/lib/libv8/scons/script/scons +196 -0
  206. data/lib/libv8/scons/script/scons-time +1544 -0
  207. data/lib/libv8/scons/script/scons.bat +31 -0
  208. data/lib/libv8/scons/script/sconsign +513 -0
  209. data/lib/libv8/scons/setup.cfg +6 -0
  210. data/lib/libv8/scons/setup.py +425 -0
  211. data/lib/libv8/v8/.gitignore +35 -0
  212. data/lib/libv8/v8/AUTHORS +44 -0
  213. data/lib/libv8/v8/ChangeLog +2839 -0
  214. data/lib/libv8/v8/LICENSE +52 -0
  215. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  216. data/lib/libv8/v8/LICENSE.v8 +26 -0
  217. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  218. data/lib/libv8/v8/SConstruct +1478 -0
  219. data/lib/libv8/v8/build/README.txt +49 -0
  220. data/lib/libv8/v8/build/all.gyp +18 -0
  221. data/lib/libv8/v8/build/armu.gypi +32 -0
  222. data/lib/libv8/v8/build/common.gypi +144 -0
  223. data/lib/libv8/v8/build/gyp_v8 +145 -0
  224. data/lib/libv8/v8/include/v8-debug.h +395 -0
  225. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  226. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  227. data/lib/libv8/v8/include/v8-testing.h +104 -0
  228. data/lib/libv8/v8/include/v8.h +4124 -0
  229. data/lib/libv8/v8/include/v8stdint.h +53 -0
  230. data/lib/libv8/v8/preparser/SConscript +38 -0
  231. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  232. data/lib/libv8/v8/src/SConscript +368 -0
  233. data/lib/libv8/v8/src/accessors.cc +767 -0
  234. data/lib/libv8/v8/src/accessors.h +123 -0
  235. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  236. data/lib/libv8/v8/src/allocation.cc +122 -0
  237. data/lib/libv8/v8/src/allocation.h +143 -0
  238. data/lib/libv8/v8/src/api.cc +5845 -0
  239. data/lib/libv8/v8/src/api.h +574 -0
  240. data/lib/libv8/v8/src/apinatives.js +110 -0
  241. data/lib/libv8/v8/src/apiutils.h +73 -0
  242. data/lib/libv8/v8/src/arguments.h +118 -0
  243. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  244. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  245. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  246. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  247. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  248. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  249. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  250. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  251. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  252. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  253. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  254. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  255. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  256. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  257. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  258. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  259. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  260. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  261. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  262. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  263. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  264. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  265. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  266. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  267. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  268. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  269. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  270. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  271. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  272. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  273. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  274. data/lib/libv8/v8/src/array.js +1366 -0
  275. data/lib/libv8/v8/src/assembler.cc +1207 -0
  276. data/lib/libv8/v8/src/assembler.h +858 -0
  277. data/lib/libv8/v8/src/ast-inl.h +112 -0
  278. data/lib/libv8/v8/src/ast.cc +1146 -0
  279. data/lib/libv8/v8/src/ast.h +2188 -0
  280. data/lib/libv8/v8/src/atomicops.h +167 -0
  281. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  282. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  283. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  284. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  285. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  286. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  287. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  288. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  289. data/lib/libv8/v8/src/bignum.cc +768 -0
  290. data/lib/libv8/v8/src/bignum.h +140 -0
  291. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  292. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  293. data/lib/libv8/v8/src/builtins.cc +1707 -0
  294. data/lib/libv8/v8/src/builtins.h +371 -0
  295. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  296. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  297. data/lib/libv8/v8/src/cached-powers.h +65 -0
  298. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  299. data/lib/libv8/v8/src/char-predicates.h +67 -0
  300. data/lib/libv8/v8/src/checks.cc +110 -0
  301. data/lib/libv8/v8/src/checks.h +296 -0
  302. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  303. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  304. data/lib/libv8/v8/src/circular-queue.h +103 -0
  305. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  306. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  307. data/lib/libv8/v8/src/code.h +70 -0
  308. data/lib/libv8/v8/src/codegen.cc +231 -0
  309. data/lib/libv8/v8/src/codegen.h +84 -0
  310. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  311. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  312. data/lib/libv8/v8/src/compiler.cc +786 -0
  313. data/lib/libv8/v8/src/compiler.h +312 -0
  314. data/lib/libv8/v8/src/contexts.cc +347 -0
  315. data/lib/libv8/v8/src/contexts.h +391 -0
  316. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  317. data/lib/libv8/v8/src/conversions.cc +1131 -0
  318. data/lib/libv8/v8/src/conversions.h +135 -0
  319. data/lib/libv8/v8/src/counters.cc +93 -0
  320. data/lib/libv8/v8/src/counters.h +254 -0
  321. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  322. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  323. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  324. data/lib/libv8/v8/src/cpu.h +69 -0
  325. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  326. data/lib/libv8/v8/src/d8-debug.h +158 -0
  327. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  328. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  329. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  330. data/lib/libv8/v8/src/d8.cc +803 -0
  331. data/lib/libv8/v8/src/d8.gyp +91 -0
  332. data/lib/libv8/v8/src/d8.h +235 -0
  333. data/lib/libv8/v8/src/d8.js +2798 -0
  334. data/lib/libv8/v8/src/data-flow.cc +66 -0
  335. data/lib/libv8/v8/src/data-flow.h +205 -0
  336. data/lib/libv8/v8/src/date.js +1103 -0
  337. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  338. data/lib/libv8/v8/src/dateparser.cc +178 -0
  339. data/lib/libv8/v8/src/dateparser.h +266 -0
  340. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  341. data/lib/libv8/v8/src/debug-agent.h +129 -0
  342. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  343. data/lib/libv8/v8/src/debug.cc +3165 -0
  344. data/lib/libv8/v8/src/debug.h +1057 -0
  345. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  346. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  347. data/lib/libv8/v8/src/disasm.h +80 -0
  348. data/lib/libv8/v8/src/disassembler.cc +343 -0
  349. data/lib/libv8/v8/src/disassembler.h +58 -0
  350. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  351. data/lib/libv8/v8/src/diy-fp.h +117 -0
  352. data/lib/libv8/v8/src/double.h +238 -0
  353. data/lib/libv8/v8/src/dtoa.cc +103 -0
  354. data/lib/libv8/v8/src/dtoa.h +85 -0
  355. data/lib/libv8/v8/src/execution.cc +849 -0
  356. data/lib/libv8/v8/src/execution.h +297 -0
  357. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  358. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  359. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  360. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  361. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  362. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  363. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  364. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  365. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  366. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  367. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  368. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  369. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  370. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  371. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  372. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  373. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  374. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  375. data/lib/libv8/v8/src/factory.cc +1222 -0
  376. data/lib/libv8/v8/src/factory.h +442 -0
  377. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  378. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  379. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  380. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  381. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  382. data/lib/libv8/v8/src/flags.cc +551 -0
  383. data/lib/libv8/v8/src/flags.h +79 -0
  384. data/lib/libv8/v8/src/frames-inl.h +247 -0
  385. data/lib/libv8/v8/src/frames.cc +1243 -0
  386. data/lib/libv8/v8/src/frames.h +870 -0
  387. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  388. data/lib/libv8/v8/src/full-codegen.h +771 -0
  389. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  390. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  391. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  392. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  393. data/lib/libv8/v8/src/global-handles.cc +665 -0
  394. data/lib/libv8/v8/src/global-handles.h +284 -0
  395. data/lib/libv8/v8/src/globals.h +325 -0
  396. data/lib/libv8/v8/src/handles-inl.h +177 -0
  397. data/lib/libv8/v8/src/handles.cc +987 -0
  398. data/lib/libv8/v8/src/handles.h +382 -0
  399. data/lib/libv8/v8/src/hashmap.cc +230 -0
  400. data/lib/libv8/v8/src/hashmap.h +123 -0
  401. data/lib/libv8/v8/src/heap-inl.h +704 -0
  402. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  403. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  404. data/lib/libv8/v8/src/heap.cc +5930 -0
  405. data/lib/libv8/v8/src/heap.h +2268 -0
  406. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  407. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  408. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  409. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  410. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  411. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  412. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  413. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  414. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  415. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  416. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  417. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  418. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  419. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  420. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  421. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  422. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  423. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  424. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  425. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  426. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  427. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  428. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  429. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  430. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  431. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  432. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  433. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  434. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  435. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  436. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  437. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  438. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  439. data/lib/libv8/v8/src/ic-inl.h +130 -0
  440. data/lib/libv8/v8/src/ic.cc +2577 -0
  441. data/lib/libv8/v8/src/ic.h +736 -0
  442. data/lib/libv8/v8/src/inspector.cc +63 -0
  443. data/lib/libv8/v8/src/inspector.h +62 -0
  444. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  445. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  446. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  447. data/lib/libv8/v8/src/isolate.cc +1869 -0
  448. data/lib/libv8/v8/src/isolate.h +1382 -0
  449. data/lib/libv8/v8/src/json-parser.cc +504 -0
  450. data/lib/libv8/v8/src/json-parser.h +161 -0
  451. data/lib/libv8/v8/src/json.js +342 -0
  452. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  453. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  454. data/lib/libv8/v8/src/list-inl.h +212 -0
  455. data/lib/libv8/v8/src/list.h +174 -0
  456. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  457. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  458. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  459. data/lib/libv8/v8/src/lithium.cc +190 -0
  460. data/lib/libv8/v8/src/lithium.h +597 -0
  461. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  462. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  463. data/lib/libv8/v8/src/liveedit.h +180 -0
  464. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  465. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  466. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  467. data/lib/libv8/v8/src/log-inl.h +59 -0
  468. data/lib/libv8/v8/src/log-utils.cc +428 -0
  469. data/lib/libv8/v8/src/log-utils.h +231 -0
  470. data/lib/libv8/v8/src/log.cc +1993 -0
  471. data/lib/libv8/v8/src/log.h +476 -0
  472. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  473. data/lib/libv8/v8/src/macros.py +178 -0
  474. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  475. data/lib/libv8/v8/src/mark-compact.h +506 -0
  476. data/lib/libv8/v8/src/math.js +264 -0
  477. data/lib/libv8/v8/src/messages.cc +179 -0
  478. data/lib/libv8/v8/src/messages.h +113 -0
  479. data/lib/libv8/v8/src/messages.js +1096 -0
  480. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  481. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  482. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  483. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  484. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  485. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  486. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  487. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  488. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  489. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  490. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  491. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  492. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  493. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  494. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  495. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  496. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  497. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  498. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  499. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  500. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  501. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  502. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  503. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  504. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  505. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  506. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  507. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  508. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  509. data/lib/libv8/v8/src/natives.h +64 -0
  510. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  511. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  512. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  513. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  514. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  515. data/lib/libv8/v8/src/objects.cc +10585 -0
  516. data/lib/libv8/v8/src/objects.h +6838 -0
  517. data/lib/libv8/v8/src/parser.cc +4997 -0
  518. data/lib/libv8/v8/src/parser.h +765 -0
  519. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  520. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  521. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  522. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  523. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  524. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  525. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  526. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  527. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  528. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  529. data/lib/libv8/v8/src/platform-tls.h +50 -0
  530. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  531. data/lib/libv8/v8/src/platform.h +667 -0
  532. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  533. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  534. data/lib/libv8/v8/src/preparse-data.h +225 -0
  535. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  536. data/lib/libv8/v8/src/preparser.cc +1450 -0
  537. data/lib/libv8/v8/src/preparser.h +493 -0
  538. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  539. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  540. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  541. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  542. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  543. data/lib/libv8/v8/src/property.cc +105 -0
  544. data/lib/libv8/v8/src/property.h +365 -0
  545. data/lib/libv8/v8/src/proxy.js +83 -0
  546. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  547. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  548. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  549. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  550. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  551. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  552. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  553. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  554. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  555. data/lib/libv8/v8/src/regexp.js +483 -0
  556. data/lib/libv8/v8/src/rewriter.cc +360 -0
  557. data/lib/libv8/v8/src/rewriter.h +50 -0
  558. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  559. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  560. data/lib/libv8/v8/src/runtime.cc +12227 -0
  561. data/lib/libv8/v8/src/runtime.h +652 -0
  562. data/lib/libv8/v8/src/runtime.js +649 -0
  563. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  564. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  565. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  566. data/lib/libv8/v8/src/scanner-base.h +670 -0
  567. data/lib/libv8/v8/src/scanner.cc +345 -0
  568. data/lib/libv8/v8/src/scanner.h +146 -0
  569. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  570. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  571. data/lib/libv8/v8/src/scopes.cc +1150 -0
  572. data/lib/libv8/v8/src/scopes.h +507 -0
  573. data/lib/libv8/v8/src/serialize.cc +1574 -0
  574. data/lib/libv8/v8/src/serialize.h +589 -0
  575. data/lib/libv8/v8/src/shell.h +55 -0
  576. data/lib/libv8/v8/src/simulator.h +43 -0
  577. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  578. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  579. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  580. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  581. data/lib/libv8/v8/src/snapshot.h +91 -0
  582. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  583. data/lib/libv8/v8/src/spaces.cc +3145 -0
  584. data/lib/libv8/v8/src/spaces.h +2369 -0
  585. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  586. data/lib/libv8/v8/src/splay-tree.h +205 -0
  587. data/lib/libv8/v8/src/string-search.cc +41 -0
  588. data/lib/libv8/v8/src/string-search.h +568 -0
  589. data/lib/libv8/v8/src/string-stream.cc +592 -0
  590. data/lib/libv8/v8/src/string-stream.h +191 -0
  591. data/lib/libv8/v8/src/string.js +994 -0
  592. data/lib/libv8/v8/src/strtod.cc +440 -0
  593. data/lib/libv8/v8/src/strtod.h +40 -0
  594. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  595. data/lib/libv8/v8/src/stub-cache.h +924 -0
  596. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  597. data/lib/libv8/v8/src/token.cc +63 -0
  598. data/lib/libv8/v8/src/token.h +288 -0
  599. data/lib/libv8/v8/src/type-info.cc +507 -0
  600. data/lib/libv8/v8/src/type-info.h +272 -0
  601. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  602. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  603. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  604. data/lib/libv8/v8/src/unicode.cc +1624 -0
  605. data/lib/libv8/v8/src/unicode.h +280 -0
  606. data/lib/libv8/v8/src/uri.js +408 -0
  607. data/lib/libv8/v8/src/utils-inl.h +48 -0
  608. data/lib/libv8/v8/src/utils.cc +371 -0
  609. data/lib/libv8/v8/src/utils.h +800 -0
  610. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  611. data/lib/libv8/v8/src/v8-counters.h +314 -0
  612. data/lib/libv8/v8/src/v8.cc +213 -0
  613. data/lib/libv8/v8/src/v8.h +131 -0
  614. data/lib/libv8/v8/src/v8checks.h +64 -0
  615. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  616. data/lib/libv8/v8/src/v8globals.h +512 -0
  617. data/lib/libv8/v8/src/v8memory.h +82 -0
  618. data/lib/libv8/v8/src/v8natives.js +1310 -0
  619. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  620. data/lib/libv8/v8/src/v8threads.cc +464 -0
  621. data/lib/libv8/v8/src/v8threads.h +165 -0
  622. data/lib/libv8/v8/src/v8utils.h +319 -0
  623. data/lib/libv8/v8/src/variables.cc +114 -0
  624. data/lib/libv8/v8/src/variables.h +167 -0
  625. data/lib/libv8/v8/src/version.cc +116 -0
  626. data/lib/libv8/v8/src/version.h +68 -0
  627. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  628. data/lib/libv8/v8/src/vm-state.h +71 -0
  629. data/lib/libv8/v8/src/win32-headers.h +96 -0
  630. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  631. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  632. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  633. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  634. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  635. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  636. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  637. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  638. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  639. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  640. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  641. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  642. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  643. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  644. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  645. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  646. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  647. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  648. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  649. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  650. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  651. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  652. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  653. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  654. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  655. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  656. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  657. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  658. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  659. data/lib/libv8/v8/src/zone-inl.h +140 -0
  660. data/lib/libv8/v8/src/zone.cc +196 -0
  661. data/lib/libv8/v8/src/zone.h +240 -0
  662. data/lib/libv8/v8/tools/codemap.js +265 -0
  663. data/lib/libv8/v8/tools/consarray.js +93 -0
  664. data/lib/libv8/v8/tools/csvparser.js +78 -0
  665. data/lib/libv8/v8/tools/disasm.py +92 -0
  666. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  667. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  668. data/lib/libv8/v8/tools/gcmole/README +62 -0
  669. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  670. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  671. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  672. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  673. data/lib/libv8/v8/tools/grokdump.py +841 -0
  674. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  675. data/lib/libv8/v8/tools/js2c.py +364 -0
  676. data/lib/libv8/v8/tools/jsmin.py +280 -0
  677. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  678. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  679. data/lib/libv8/v8/tools/logreader.js +185 -0
  680. data/lib/libv8/v8/tools/mac-nm +18 -0
  681. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  682. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  683. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  684. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  685. data/lib/libv8/v8/tools/presubmit.py +305 -0
  686. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  687. data/lib/libv8/v8/tools/profile.js +751 -0
  688. data/lib/libv8/v8/tools/profile_view.js +219 -0
  689. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  690. data/lib/libv8/v8/tools/splaytree.js +316 -0
  691. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  692. data/lib/libv8/v8/tools/test.py +1510 -0
  693. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  694. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  695. data/lib/libv8/v8/tools/utils.py +96 -0
  696. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  697. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  698. data/lib/libv8/version.rb +4 -0
  699. data/libv8.gemspec +31 -0
  700. metadata +800 -0
@@ -0,0 +1,1769 @@
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
+ #include "factory.h"
31
+ #include "hydrogen.h"
32
+
33
+ #if V8_TARGET_ARCH_IA32
34
+ #include "ia32/lithium-ia32.h"
35
+ #elif V8_TARGET_ARCH_X64
36
+ #include "x64/lithium-x64.h"
37
+ #elif V8_TARGET_ARCH_ARM
38
+ #include "arm/lithium-arm.h"
39
+ #elif V8_TARGET_ARCH_MIPS
40
+ #include "mips/lithium-mips.h"
41
+ #else
42
+ #error Unsupported target architecture.
43
+ #endif
44
+
45
+ namespace v8 {
46
+ namespace internal {
47
+
48
+ #define DEFINE_COMPILE(type) \
49
+ LInstruction* H##type::CompileToLithium(LChunkBuilder* builder) { \
50
+ return builder->Do##type(this); \
51
+ }
52
+ HYDROGEN_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE)
53
+ #undef DEFINE_COMPILE
54
+
55
+
56
+ const char* Representation::Mnemonic() const {
57
+ switch (kind_) {
58
+ case kNone: return "v";
59
+ case kTagged: return "t";
60
+ case kDouble: return "d";
61
+ case kInteger32: return "i";
62
+ case kExternal: return "x";
63
+ default:
64
+ UNREACHABLE();
65
+ return NULL;
66
+ }
67
+ }
68
+
69
+
70
+ void HValue::AssumeRepresentation(Representation r) {
71
+ if (CheckFlag(kFlexibleRepresentation)) {
72
+ ChangeRepresentation(r);
73
+ // The representation of the value is dictated by type feedback and
74
+ // will not be changed later.
75
+ ClearFlag(kFlexibleRepresentation);
76
+ }
77
+ }
78
+
79
+
80
+ static int32_t ConvertAndSetOverflow(int64_t result, bool* overflow) {
81
+ if (result > kMaxInt) {
82
+ *overflow = true;
83
+ return kMaxInt;
84
+ }
85
+ if (result < kMinInt) {
86
+ *overflow = true;
87
+ return kMinInt;
88
+ }
89
+ return static_cast<int32_t>(result);
90
+ }
91
+
92
+
93
+ static int32_t AddWithoutOverflow(int32_t a, int32_t b, bool* overflow) {
94
+ int64_t result = static_cast<int64_t>(a) + static_cast<int64_t>(b);
95
+ return ConvertAndSetOverflow(result, overflow);
96
+ }
97
+
98
+
99
+ static int32_t SubWithoutOverflow(int32_t a, int32_t b, bool* overflow) {
100
+ int64_t result = static_cast<int64_t>(a) - static_cast<int64_t>(b);
101
+ return ConvertAndSetOverflow(result, overflow);
102
+ }
103
+
104
+
105
+ static int32_t MulWithoutOverflow(int32_t a, int32_t b, bool* overflow) {
106
+ int64_t result = static_cast<int64_t>(a) * static_cast<int64_t>(b);
107
+ return ConvertAndSetOverflow(result, overflow);
108
+ }
109
+
110
+
111
+ int32_t Range::Mask() const {
112
+ if (lower_ == upper_) return lower_;
113
+ if (lower_ >= 0) {
114
+ int32_t res = 1;
115
+ while (res < upper_) {
116
+ res = (res << 1) | 1;
117
+ }
118
+ return res;
119
+ }
120
+ return 0xffffffff;
121
+ }
122
+
123
+
124
+ void Range::AddConstant(int32_t value) {
125
+ if (value == 0) return;
126
+ bool may_overflow = false; // Overflow is ignored here.
127
+ lower_ = AddWithoutOverflow(lower_, value, &may_overflow);
128
+ upper_ = AddWithoutOverflow(upper_, value, &may_overflow);
129
+ Verify();
130
+ }
131
+
132
+
133
+ void Range::Intersect(Range* other) {
134
+ upper_ = Min(upper_, other->upper_);
135
+ lower_ = Max(lower_, other->lower_);
136
+ bool b = CanBeMinusZero() && other->CanBeMinusZero();
137
+ set_can_be_minus_zero(b);
138
+ }
139
+
140
+
141
+ void Range::Union(Range* other) {
142
+ upper_ = Max(upper_, other->upper_);
143
+ lower_ = Min(lower_, other->lower_);
144
+ bool b = CanBeMinusZero() || other->CanBeMinusZero();
145
+ set_can_be_minus_zero(b);
146
+ }
147
+
148
+
149
+ void Range::Sar(int32_t value) {
150
+ int32_t bits = value & 0x1F;
151
+ lower_ = lower_ >> bits;
152
+ upper_ = upper_ >> bits;
153
+ set_can_be_minus_zero(false);
154
+ }
155
+
156
+
157
+ void Range::Shl(int32_t value) {
158
+ int32_t bits = value & 0x1F;
159
+ int old_lower = lower_;
160
+ int old_upper = upper_;
161
+ lower_ = lower_ << bits;
162
+ upper_ = upper_ << bits;
163
+ if (old_lower != lower_ >> bits || old_upper != upper_ >> bits) {
164
+ upper_ = kMaxInt;
165
+ lower_ = kMinInt;
166
+ }
167
+ set_can_be_minus_zero(false);
168
+ }
169
+
170
+
171
+ bool Range::AddAndCheckOverflow(Range* other) {
172
+ bool may_overflow = false;
173
+ lower_ = AddWithoutOverflow(lower_, other->lower(), &may_overflow);
174
+ upper_ = AddWithoutOverflow(upper_, other->upper(), &may_overflow);
175
+ KeepOrder();
176
+ Verify();
177
+ return may_overflow;
178
+ }
179
+
180
+
181
+ bool Range::SubAndCheckOverflow(Range* other) {
182
+ bool may_overflow = false;
183
+ lower_ = SubWithoutOverflow(lower_, other->upper(), &may_overflow);
184
+ upper_ = SubWithoutOverflow(upper_, other->lower(), &may_overflow);
185
+ KeepOrder();
186
+ Verify();
187
+ return may_overflow;
188
+ }
189
+
190
+
191
+ void Range::KeepOrder() {
192
+ if (lower_ > upper_) {
193
+ int32_t tmp = lower_;
194
+ lower_ = upper_;
195
+ upper_ = tmp;
196
+ }
197
+ }
198
+
199
+
200
+ void Range::Verify() const {
201
+ ASSERT(lower_ <= upper_);
202
+ }
203
+
204
+
205
+ bool Range::MulAndCheckOverflow(Range* other) {
206
+ bool may_overflow = false;
207
+ int v1 = MulWithoutOverflow(lower_, other->lower(), &may_overflow);
208
+ int v2 = MulWithoutOverflow(lower_, other->upper(), &may_overflow);
209
+ int v3 = MulWithoutOverflow(upper_, other->lower(), &may_overflow);
210
+ int v4 = MulWithoutOverflow(upper_, other->upper(), &may_overflow);
211
+ lower_ = Min(Min(v1, v2), Min(v3, v4));
212
+ upper_ = Max(Max(v1, v2), Max(v3, v4));
213
+ Verify();
214
+ return may_overflow;
215
+ }
216
+
217
+
218
+ const char* HType::ToString() {
219
+ switch (type_) {
220
+ case kTagged: return "tagged";
221
+ case kTaggedPrimitive: return "primitive";
222
+ case kTaggedNumber: return "number";
223
+ case kSmi: return "smi";
224
+ case kHeapNumber: return "heap-number";
225
+ case kString: return "string";
226
+ case kBoolean: return "boolean";
227
+ case kNonPrimitive: return "non-primitive";
228
+ case kJSArray: return "array";
229
+ case kJSObject: return "object";
230
+ case kUninitialized: return "uninitialized";
231
+ }
232
+ UNREACHABLE();
233
+ return "Unreachable code";
234
+ }
235
+
236
+
237
+ const char* HType::ToShortString() {
238
+ switch (type_) {
239
+ case kTagged: return "t";
240
+ case kTaggedPrimitive: return "p";
241
+ case kTaggedNumber: return "n";
242
+ case kSmi: return "m";
243
+ case kHeapNumber: return "h";
244
+ case kString: return "s";
245
+ case kBoolean: return "b";
246
+ case kNonPrimitive: return "r";
247
+ case kJSArray: return "a";
248
+ case kJSObject: return "o";
249
+ case kUninitialized: return "z";
250
+ }
251
+ UNREACHABLE();
252
+ return "Unreachable code";
253
+ }
254
+
255
+
256
+ HType HType::TypeFromValue(Handle<Object> value) {
257
+ HType result = HType::Tagged();
258
+ if (value->IsSmi()) {
259
+ result = HType::Smi();
260
+ } else if (value->IsHeapNumber()) {
261
+ result = HType::HeapNumber();
262
+ } else if (value->IsString()) {
263
+ result = HType::String();
264
+ } else if (value->IsBoolean()) {
265
+ result = HType::Boolean();
266
+ } else if (value->IsJSObject()) {
267
+ result = HType::JSObject();
268
+ } else if (value->IsJSArray()) {
269
+ result = HType::JSArray();
270
+ }
271
+ return result;
272
+ }
273
+
274
+
275
+ bool HValue::IsDefinedAfter(HBasicBlock* other) const {
276
+ return block()->block_id() > other->block_id();
277
+ }
278
+
279
+
280
+ HUseIterator::HUseIterator(HUseListNode* head) : next_(head) {
281
+ Advance();
282
+ }
283
+
284
+
285
+ void HUseIterator::Advance() {
286
+ current_ = next_;
287
+ if (current_ != NULL) {
288
+ next_ = current_->tail();
289
+ value_ = current_->value();
290
+ index_ = current_->index();
291
+ }
292
+ }
293
+
294
+
295
+ int HValue::UseCount() const {
296
+ int count = 0;
297
+ for (HUseIterator it(uses()); !it.Done(); it.Advance()) ++count;
298
+ return count;
299
+ }
300
+
301
+
302
+ HUseListNode* HValue::RemoveUse(HValue* value, int index) {
303
+ HUseListNode* previous = NULL;
304
+ HUseListNode* current = use_list_;
305
+ while (current != NULL) {
306
+ if (current->value() == value && current->index() == index) {
307
+ if (previous == NULL) {
308
+ use_list_ = current->tail();
309
+ } else {
310
+ previous->set_tail(current->tail());
311
+ }
312
+ break;
313
+ }
314
+
315
+ previous = current;
316
+ current = current->tail();
317
+ }
318
+
319
+ #ifdef DEBUG
320
+ // Do not reuse use list nodes in debug mode, zap them.
321
+ if (current != NULL) {
322
+ HUseListNode* temp =
323
+ new HUseListNode(current->value(), current->index(), NULL);
324
+ current->Zap();
325
+ current = temp;
326
+ }
327
+ #endif
328
+ return current;
329
+ }
330
+
331
+
332
+ bool HValue::Equals(HValue* other) {
333
+ if (other->opcode() != opcode()) return false;
334
+ if (!other->representation().Equals(representation())) return false;
335
+ if (!other->type_.Equals(type_)) return false;
336
+ if (other->flags() != flags()) return false;
337
+ if (OperandCount() != other->OperandCount()) return false;
338
+ for (int i = 0; i < OperandCount(); ++i) {
339
+ if (OperandAt(i)->id() != other->OperandAt(i)->id()) return false;
340
+ }
341
+ bool result = DataEquals(other);
342
+ ASSERT(!result || Hashcode() == other->Hashcode());
343
+ return result;
344
+ }
345
+
346
+
347
+ intptr_t HValue::Hashcode() {
348
+ intptr_t result = opcode();
349
+ int count = OperandCount();
350
+ for (int i = 0; i < count; ++i) {
351
+ result = result * 19 + OperandAt(i)->id() + (result >> 7);
352
+ }
353
+ return result;
354
+ }
355
+
356
+
357
+ const char* HValue::Mnemonic() const {
358
+ switch (opcode()) {
359
+ #define MAKE_CASE(type) case k##type: return #type;
360
+ HYDROGEN_CONCRETE_INSTRUCTION_LIST(MAKE_CASE)
361
+ #undef MAKE_CASE
362
+ case kPhi: return "Phi";
363
+ default: return "";
364
+ }
365
+ }
366
+
367
+
368
+ void HValue::SetOperandAt(int index, HValue* value) {
369
+ RegisterUse(index, value);
370
+ InternalSetOperandAt(index, value);
371
+ }
372
+
373
+
374
+ void HValue::DeleteAndReplaceWith(HValue* other) {
375
+ // We replace all uses first, so Delete can assert that there are none.
376
+ if (other != NULL) ReplaceAllUsesWith(other);
377
+ ASSERT(HasNoUses());
378
+ ClearOperands();
379
+ DeleteFromGraph();
380
+ }
381
+
382
+
383
+ void HValue::ReplaceAllUsesWith(HValue* other) {
384
+ while (use_list_ != NULL) {
385
+ HUseListNode* list_node = use_list_;
386
+ HValue* value = list_node->value();
387
+ ASSERT(!value->block()->IsStartBlock());
388
+ value->InternalSetOperandAt(list_node->index(), other);
389
+ use_list_ = list_node->tail();
390
+ list_node->set_tail(other->use_list_);
391
+ other->use_list_ = list_node;
392
+ }
393
+ }
394
+
395
+
396
+ void HValue::ClearOperands() {
397
+ for (int i = 0; i < OperandCount(); ++i) {
398
+ SetOperandAt(i, NULL);
399
+ }
400
+ }
401
+
402
+
403
+ void HValue::SetBlock(HBasicBlock* block) {
404
+ ASSERT(block_ == NULL || block == NULL);
405
+ block_ = block;
406
+ if (id_ == kNoNumber && block != NULL) {
407
+ id_ = block->graph()->GetNextValueID(this);
408
+ }
409
+ }
410
+
411
+
412
+ void HValue::PrintTypeTo(StringStream* stream) {
413
+ if (!representation().IsTagged() || type().Equals(HType::Tagged())) return;
414
+ stream->Add(" type[%s]", type().ToString());
415
+ }
416
+
417
+
418
+ void HValue::PrintRangeTo(StringStream* stream) {
419
+ if (range() == NULL || range()->IsMostGeneric()) return;
420
+ stream->Add(" range[%d,%d,m0=%d]",
421
+ range()->lower(),
422
+ range()->upper(),
423
+ static_cast<int>(range()->CanBeMinusZero()));
424
+ }
425
+
426
+
427
+ void HValue::PrintChangesTo(StringStream* stream) {
428
+ int changes_flags = (flags() & HValue::ChangesFlagsMask());
429
+ if (changes_flags == 0) return;
430
+ stream->Add(" changes[");
431
+ if (changes_flags == AllSideEffects()) {
432
+ stream->Add("*");
433
+ } else {
434
+ bool add_comma = false;
435
+ #define PRINT_DO(type) \
436
+ if (changes_flags & (1 << kChanges##type)) { \
437
+ if (add_comma) stream->Add(","); \
438
+ add_comma = true; \
439
+ stream->Add(#type); \
440
+ }
441
+ GVN_FLAG_LIST(PRINT_DO);
442
+ #undef PRINT_DO
443
+ }
444
+ stream->Add("]");
445
+ }
446
+
447
+
448
+ void HValue::PrintNameTo(StringStream* stream) {
449
+ stream->Add("%s%d", representation_.Mnemonic(), id());
450
+ }
451
+
452
+
453
+ bool HValue::UpdateInferredType() {
454
+ HType type = CalculateInferredType();
455
+ bool result = (!type.Equals(type_));
456
+ type_ = type;
457
+ return result;
458
+ }
459
+
460
+
461
+ void HValue::RegisterUse(int index, HValue* new_value) {
462
+ HValue* old_value = OperandAt(index);
463
+ if (old_value == new_value) return;
464
+
465
+ HUseListNode* removed = NULL;
466
+ if (old_value != NULL) {
467
+ removed = old_value->RemoveUse(this, index);
468
+ }
469
+
470
+ if (new_value != NULL) {
471
+ if (removed == NULL) {
472
+ new_value->use_list_ =
473
+ new HUseListNode(this, index, new_value->use_list_);
474
+ } else {
475
+ removed->set_tail(new_value->use_list_);
476
+ new_value->use_list_ = removed;
477
+ }
478
+ }
479
+ }
480
+
481
+
482
+ void HValue::AddNewRange(Range* r) {
483
+ if (!HasRange()) ComputeInitialRange();
484
+ if (!HasRange()) range_ = new Range();
485
+ ASSERT(HasRange());
486
+ r->StackUpon(range_);
487
+ range_ = r;
488
+ }
489
+
490
+
491
+ void HValue::RemoveLastAddedRange() {
492
+ ASSERT(HasRange());
493
+ ASSERT(range_->next() != NULL);
494
+ range_ = range_->next();
495
+ }
496
+
497
+
498
+ void HValue::ComputeInitialRange() {
499
+ ASSERT(!HasRange());
500
+ range_ = InferRange();
501
+ ASSERT(HasRange());
502
+ }
503
+
504
+
505
+ void HInstruction::PrintTo(StringStream* stream) {
506
+ PrintMnemonicTo(stream);
507
+ PrintDataTo(stream);
508
+ PrintRangeTo(stream);
509
+ PrintChangesTo(stream);
510
+ PrintTypeTo(stream);
511
+ }
512
+
513
+
514
+ void HInstruction::PrintMnemonicTo(StringStream* stream) {
515
+ stream->Add("%s", Mnemonic());
516
+ if (HasSideEffects()) stream->Add("*");
517
+ stream->Add(" ");
518
+ }
519
+
520
+
521
+ void HInstruction::Unlink() {
522
+ ASSERT(IsLinked());
523
+ ASSERT(!IsControlInstruction()); // Must never move control instructions.
524
+ ASSERT(!IsBlockEntry()); // Doesn't make sense to delete these.
525
+ ASSERT(previous_ != NULL);
526
+ previous_->next_ = next_;
527
+ if (next_ == NULL) {
528
+ ASSERT(block()->last() == this);
529
+ block()->set_last(previous_);
530
+ } else {
531
+ next_->previous_ = previous_;
532
+ }
533
+ clear_block();
534
+ }
535
+
536
+
537
+ void HInstruction::InsertBefore(HInstruction* next) {
538
+ ASSERT(!IsLinked());
539
+ ASSERT(!next->IsBlockEntry());
540
+ ASSERT(!IsControlInstruction());
541
+ ASSERT(!next->block()->IsStartBlock());
542
+ ASSERT(next->previous_ != NULL);
543
+ HInstruction* prev = next->previous();
544
+ prev->next_ = this;
545
+ next->previous_ = this;
546
+ next_ = next;
547
+ previous_ = prev;
548
+ SetBlock(next->block());
549
+ }
550
+
551
+
552
+ void HInstruction::InsertAfter(HInstruction* previous) {
553
+ ASSERT(!IsLinked());
554
+ ASSERT(!previous->IsControlInstruction());
555
+ ASSERT(!IsControlInstruction() || previous->next_ == NULL);
556
+ HBasicBlock* block = previous->block();
557
+ // Never insert anything except constants into the start block after finishing
558
+ // it.
559
+ if (block->IsStartBlock() && block->IsFinished() && !IsConstant()) {
560
+ ASSERT(block->end()->SecondSuccessor() == NULL);
561
+ InsertAfter(block->end()->FirstSuccessor()->first());
562
+ return;
563
+ }
564
+
565
+ // If we're inserting after an instruction with side-effects that is
566
+ // followed by a simulate instruction, we need to insert after the
567
+ // simulate instruction instead.
568
+ HInstruction* next = previous->next_;
569
+ if (previous->HasSideEffects() && next != NULL) {
570
+ ASSERT(next->IsSimulate());
571
+ previous = next;
572
+ next = previous->next_;
573
+ }
574
+
575
+ previous_ = previous;
576
+ next_ = next;
577
+ SetBlock(block);
578
+ previous->next_ = this;
579
+ if (next != NULL) next->previous_ = this;
580
+ }
581
+
582
+
583
+ #ifdef DEBUG
584
+ void HInstruction::Verify() {
585
+ // Verify that input operands are defined before use.
586
+ HBasicBlock* cur_block = block();
587
+ for (int i = 0; i < OperandCount(); ++i) {
588
+ HValue* other_operand = OperandAt(i);
589
+ HBasicBlock* other_block = other_operand->block();
590
+ if (cur_block == other_block) {
591
+ if (!other_operand->IsPhi()) {
592
+ HInstruction* cur = cur_block->first();
593
+ while (cur != NULL) {
594
+ ASSERT(cur != this); // We should reach other_operand before!
595
+ if (cur == other_operand) break;
596
+ cur = cur->next();
597
+ }
598
+ // Must reach other operand in the same block!
599
+ ASSERT(cur == other_operand);
600
+ }
601
+ } else {
602
+ // If the following assert fires, you may have forgotten an
603
+ // AddInstruction.
604
+ ASSERT(other_block->Dominates(cur_block));
605
+ }
606
+ }
607
+
608
+ // Verify that instructions that may have side-effects are followed
609
+ // by a simulate instruction.
610
+ if (HasSideEffects() && !IsOsrEntry()) {
611
+ ASSERT(next()->IsSimulate());
612
+ }
613
+
614
+ // Verify that instructions that can be eliminated by GVN have overridden
615
+ // HValue::DataEquals. The default implementation is UNREACHABLE. We
616
+ // don't actually care whether DataEquals returns true or false here.
617
+ if (CheckFlag(kUseGVN)) DataEquals(this);
618
+ }
619
+ #endif
620
+
621
+
622
+ void HUnaryCall::PrintDataTo(StringStream* stream) {
623
+ value()->PrintNameTo(stream);
624
+ stream->Add(" ");
625
+ stream->Add("#%d", argument_count());
626
+ }
627
+
628
+
629
+ void HBinaryCall::PrintDataTo(StringStream* stream) {
630
+ first()->PrintNameTo(stream);
631
+ stream->Add(" ");
632
+ second()->PrintNameTo(stream);
633
+ stream->Add(" ");
634
+ stream->Add("#%d", argument_count());
635
+ }
636
+
637
+
638
+ void HCallConstantFunction::PrintDataTo(StringStream* stream) {
639
+ if (IsApplyFunction()) {
640
+ stream->Add("optimized apply ");
641
+ } else {
642
+ stream->Add("%o ", function()->shared()->DebugName());
643
+ }
644
+ stream->Add("#%d", argument_count());
645
+ }
646
+
647
+
648
+ void HCallNamed::PrintDataTo(StringStream* stream) {
649
+ stream->Add("%o ", *name());
650
+ HUnaryCall::PrintDataTo(stream);
651
+ }
652
+
653
+
654
+ void HCallGlobal::PrintDataTo(StringStream* stream) {
655
+ stream->Add("%o ", *name());
656
+ HUnaryCall::PrintDataTo(stream);
657
+ }
658
+
659
+
660
+ void HCallKnownGlobal::PrintDataTo(StringStream* stream) {
661
+ stream->Add("o ", target()->shared()->DebugName());
662
+ stream->Add("#%d", argument_count());
663
+ }
664
+
665
+
666
+ void HCallRuntime::PrintDataTo(StringStream* stream) {
667
+ stream->Add("%o ", *name());
668
+ stream->Add("#%d", argument_count());
669
+ }
670
+
671
+
672
+ void HClassOfTest::PrintDataTo(StringStream* stream) {
673
+ stream->Add("class_of_test(");
674
+ value()->PrintNameTo(stream);
675
+ stream->Add(", \"%o\")", *class_name());
676
+ }
677
+
678
+
679
+ void HAccessArgumentsAt::PrintDataTo(StringStream* stream) {
680
+ arguments()->PrintNameTo(stream);
681
+ stream->Add("[");
682
+ index()->PrintNameTo(stream);
683
+ stream->Add("], length ");
684
+ length()->PrintNameTo(stream);
685
+ }
686
+
687
+
688
+ void HControlInstruction::PrintDataTo(StringStream* stream) {
689
+ if (FirstSuccessor() != NULL) {
690
+ int first_id = FirstSuccessor()->block_id();
691
+ if (SecondSuccessor() == NULL) {
692
+ stream->Add(" B%d", first_id);
693
+ } else {
694
+ int second_id = SecondSuccessor()->block_id();
695
+ stream->Add(" goto (B%d, B%d)", first_id, second_id);
696
+ }
697
+ }
698
+ }
699
+
700
+
701
+ void HUnaryControlInstruction::PrintDataTo(StringStream* stream) {
702
+ value()->PrintNameTo(stream);
703
+ HControlInstruction::PrintDataTo(stream);
704
+ }
705
+
706
+
707
+ void HCompareMap::PrintDataTo(StringStream* stream) {
708
+ value()->PrintNameTo(stream);
709
+ stream->Add(" (%p)", *map());
710
+ HControlInstruction::PrintDataTo(stream);
711
+ }
712
+
713
+
714
+ const char* HUnaryMathOperation::OpName() const {
715
+ switch (op()) {
716
+ case kMathFloor: return "floor";
717
+ case kMathRound: return "round";
718
+ case kMathCeil: return "ceil";
719
+ case kMathAbs: return "abs";
720
+ case kMathLog: return "log";
721
+ case kMathSin: return "sin";
722
+ case kMathCos: return "cos";
723
+ case kMathTan: return "tan";
724
+ case kMathASin: return "asin";
725
+ case kMathACos: return "acos";
726
+ case kMathATan: return "atan";
727
+ case kMathExp: return "exp";
728
+ case kMathSqrt: return "sqrt";
729
+ default: break;
730
+ }
731
+ return "(unknown operation)";
732
+ }
733
+
734
+
735
+ void HUnaryMathOperation::PrintDataTo(StringStream* stream) {
736
+ const char* name = OpName();
737
+ stream->Add("%s ", name);
738
+ value()->PrintNameTo(stream);
739
+ }
740
+
741
+
742
+ void HUnaryOperation::PrintDataTo(StringStream* stream) {
743
+ value()->PrintNameTo(stream);
744
+ }
745
+
746
+
747
+ void HHasInstanceType::PrintDataTo(StringStream* stream) {
748
+ value()->PrintNameTo(stream);
749
+ switch (from_) {
750
+ case FIRST_JS_OBJECT_TYPE:
751
+ if (to_ == LAST_TYPE) stream->Add(" spec_object");
752
+ break;
753
+ case JS_REGEXP_TYPE:
754
+ if (to_ == JS_REGEXP_TYPE) stream->Add(" reg_exp");
755
+ break;
756
+ case JS_ARRAY_TYPE:
757
+ if (to_ == JS_ARRAY_TYPE) stream->Add(" array");
758
+ break;
759
+ case JS_FUNCTION_TYPE:
760
+ if (to_ == JS_FUNCTION_TYPE) stream->Add(" function");
761
+ break;
762
+ default:
763
+ break;
764
+ }
765
+ }
766
+
767
+
768
+ void HTypeofIs::PrintDataTo(StringStream* stream) {
769
+ value()->PrintNameTo(stream);
770
+ stream->Add(" == ");
771
+ stream->Add(type_literal_->ToAsciiVector());
772
+ }
773
+
774
+
775
+ void HChange::PrintDataTo(StringStream* stream) {
776
+ HUnaryOperation::PrintDataTo(stream);
777
+ stream->Add(" %s to %s", from_.Mnemonic(), to().Mnemonic());
778
+
779
+ if (CanTruncateToInt32()) stream->Add(" truncating-int32");
780
+ if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
781
+ }
782
+
783
+
784
+ void HCheckInstanceType::GetCheckInterval(InstanceType* first,
785
+ InstanceType* last) {
786
+ ASSERT(is_interval_check());
787
+ switch (check_) {
788
+ case IS_JS_OBJECT_OR_JS_FUNCTION:
789
+ STATIC_ASSERT((LAST_JS_OBJECT_TYPE + 1) == JS_FUNCTION_TYPE);
790
+ *first = FIRST_JS_OBJECT_TYPE;
791
+ *last = JS_FUNCTION_TYPE;
792
+ return;
793
+ case IS_JS_ARRAY:
794
+ *first = *last = JS_ARRAY_TYPE;
795
+ return;
796
+ default:
797
+ UNREACHABLE();
798
+ }
799
+ }
800
+
801
+
802
+ void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) {
803
+ ASSERT(!is_interval_check());
804
+ switch (check_) {
805
+ case IS_STRING:
806
+ *mask = kIsNotStringMask;
807
+ *tag = kStringTag;
808
+ return;
809
+ case IS_SYMBOL:
810
+ *mask = kIsSymbolMask;
811
+ *tag = kSymbolTag;
812
+ return;
813
+ default:
814
+ UNREACHABLE();
815
+ }
816
+ }
817
+
818
+
819
+ void HCheckMap::PrintDataTo(StringStream* stream) {
820
+ value()->PrintNameTo(stream);
821
+ stream->Add(" %p", *map());
822
+ }
823
+
824
+
825
+ void HCheckFunction::PrintDataTo(StringStream* stream) {
826
+ value()->PrintNameTo(stream);
827
+ stream->Add(" %p", *target());
828
+ }
829
+
830
+
831
+ void HCallStub::PrintDataTo(StringStream* stream) {
832
+ stream->Add("%s ",
833
+ CodeStub::MajorName(major_key_, false));
834
+ HUnaryCall::PrintDataTo(stream);
835
+ }
836
+
837
+
838
+ void HInstanceOf::PrintDataTo(StringStream* stream) {
839
+ left()->PrintNameTo(stream);
840
+ stream->Add(" ");
841
+ right()->PrintNameTo(stream);
842
+ stream->Add(" ");
843
+ context()->PrintNameTo(stream);
844
+ }
845
+
846
+
847
+ Range* HValue::InferRange() {
848
+ if (representation().IsTagged()) {
849
+ // Tagged values are always in int32 range when converted to integer,
850
+ // but they can contain -0.
851
+ Range* result = new Range();
852
+ result->set_can_be_minus_zero(true);
853
+ return result;
854
+ } else if (representation().IsNone()) {
855
+ return NULL;
856
+ } else {
857
+ // Untagged integer32 cannot be -0 and we don't compute ranges for
858
+ // untagged doubles.
859
+ return new Range();
860
+ }
861
+ }
862
+
863
+
864
+ Range* HConstant::InferRange() {
865
+ if (has_int32_value_) {
866
+ Range* result = new Range(int32_value_, int32_value_);
867
+ result->set_can_be_minus_zero(false);
868
+ return result;
869
+ }
870
+ return HValue::InferRange();
871
+ }
872
+
873
+
874
+ Range* HPhi::InferRange() {
875
+ if (representation().IsInteger32()) {
876
+ if (block()->IsLoopHeader()) {
877
+ Range* range = new Range(kMinInt, kMaxInt);
878
+ return range;
879
+ } else {
880
+ Range* range = OperandAt(0)->range()->Copy();
881
+ for (int i = 1; i < OperandCount(); ++i) {
882
+ range->Union(OperandAt(i)->range());
883
+ }
884
+ return range;
885
+ }
886
+ } else {
887
+ return HValue::InferRange();
888
+ }
889
+ }
890
+
891
+
892
+ Range* HAdd::InferRange() {
893
+ if (representation().IsInteger32()) {
894
+ Range* a = left()->range();
895
+ Range* b = right()->range();
896
+ Range* res = a->Copy();
897
+ if (!res->AddAndCheckOverflow(b)) {
898
+ ClearFlag(kCanOverflow);
899
+ }
900
+ bool m0 = a->CanBeMinusZero() && b->CanBeMinusZero();
901
+ res->set_can_be_minus_zero(m0);
902
+ return res;
903
+ } else {
904
+ return HValue::InferRange();
905
+ }
906
+ }
907
+
908
+
909
+ Range* HSub::InferRange() {
910
+ if (representation().IsInteger32()) {
911
+ Range* a = left()->range();
912
+ Range* b = right()->range();
913
+ Range* res = a->Copy();
914
+ if (!res->SubAndCheckOverflow(b)) {
915
+ ClearFlag(kCanOverflow);
916
+ }
917
+ res->set_can_be_minus_zero(a->CanBeMinusZero() && b->CanBeZero());
918
+ return res;
919
+ } else {
920
+ return HValue::InferRange();
921
+ }
922
+ }
923
+
924
+
925
+ Range* HMul::InferRange() {
926
+ if (representation().IsInteger32()) {
927
+ Range* a = left()->range();
928
+ Range* b = right()->range();
929
+ Range* res = a->Copy();
930
+ if (!res->MulAndCheckOverflow(b)) {
931
+ ClearFlag(kCanOverflow);
932
+ }
933
+ bool m0 = (a->CanBeZero() && b->CanBeNegative()) ||
934
+ (a->CanBeNegative() && b->CanBeZero());
935
+ res->set_can_be_minus_zero(m0);
936
+ return res;
937
+ } else {
938
+ return HValue::InferRange();
939
+ }
940
+ }
941
+
942
+
943
+ Range* HDiv::InferRange() {
944
+ if (representation().IsInteger32()) {
945
+ Range* result = new Range();
946
+ if (left()->range()->CanBeMinusZero()) {
947
+ result->set_can_be_minus_zero(true);
948
+ }
949
+
950
+ if (left()->range()->CanBeZero() && right()->range()->CanBeNegative()) {
951
+ result->set_can_be_minus_zero(true);
952
+ }
953
+
954
+ if (right()->range()->Includes(-1) && left()->range()->Includes(kMinInt)) {
955
+ SetFlag(HValue::kCanOverflow);
956
+ }
957
+
958
+ if (!right()->range()->CanBeZero()) {
959
+ ClearFlag(HValue::kCanBeDivByZero);
960
+ }
961
+ return result;
962
+ } else {
963
+ return HValue::InferRange();
964
+ }
965
+ }
966
+
967
+
968
+ Range* HMod::InferRange() {
969
+ if (representation().IsInteger32()) {
970
+ Range* a = left()->range();
971
+ Range* result = new Range();
972
+ if (a->CanBeMinusZero() || a->CanBeNegative()) {
973
+ result->set_can_be_minus_zero(true);
974
+ }
975
+ if (!right()->range()->CanBeZero()) {
976
+ ClearFlag(HValue::kCanBeDivByZero);
977
+ }
978
+ return result;
979
+ } else {
980
+ return HValue::InferRange();
981
+ }
982
+ }
983
+
984
+
985
+ void HPhi::PrintTo(StringStream* stream) {
986
+ stream->Add("[");
987
+ for (int i = 0; i < OperandCount(); ++i) {
988
+ HValue* value = OperandAt(i);
989
+ stream->Add(" ");
990
+ value->PrintNameTo(stream);
991
+ stream->Add(" ");
992
+ }
993
+ stream->Add(" uses%d_%di_%dd_%dt]",
994
+ UseCount(),
995
+ int32_non_phi_uses() + int32_indirect_uses(),
996
+ double_non_phi_uses() + double_indirect_uses(),
997
+ tagged_non_phi_uses() + tagged_indirect_uses());
998
+ }
999
+
1000
+
1001
+ void HPhi::AddInput(HValue* value) {
1002
+ inputs_.Add(NULL);
1003
+ SetOperandAt(OperandCount() - 1, value);
1004
+ // Mark phis that may have 'arguments' directly or indirectly as an operand.
1005
+ if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) {
1006
+ SetFlag(kIsArguments);
1007
+ }
1008
+ }
1009
+
1010
+
1011
+ bool HPhi::HasRealUses() {
1012
+ for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
1013
+ if (!it.value()->IsPhi()) return true;
1014
+ }
1015
+ return false;
1016
+ }
1017
+
1018
+
1019
+ HValue* HPhi::GetRedundantReplacement() {
1020
+ HValue* candidate = NULL;
1021
+ int count = OperandCount();
1022
+ int position = 0;
1023
+ while (position < count && candidate == NULL) {
1024
+ HValue* current = OperandAt(position++);
1025
+ if (current != this) candidate = current;
1026
+ }
1027
+ while (position < count) {
1028
+ HValue* current = OperandAt(position++);
1029
+ if (current != this && current != candidate) return NULL;
1030
+ }
1031
+ ASSERT(candidate != this);
1032
+ return candidate;
1033
+ }
1034
+
1035
+
1036
+ void HPhi::DeleteFromGraph() {
1037
+ ASSERT(block() != NULL);
1038
+ block()->RemovePhi(this);
1039
+ ASSERT(block() == NULL);
1040
+ }
1041
+
1042
+
1043
+ void HPhi::InitRealUses(int phi_id) {
1044
+ // Initialize real uses.
1045
+ phi_id_ = phi_id;
1046
+ for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
1047
+ HValue* value = it.value();
1048
+ if (!value->IsPhi()) {
1049
+ Representation rep = value->RequiredInputRepresentation(it.index());
1050
+ ++non_phi_uses_[rep.kind()];
1051
+ }
1052
+ }
1053
+ }
1054
+
1055
+
1056
+ void HPhi::AddNonPhiUsesFrom(HPhi* other) {
1057
+ for (int i = 0; i < Representation::kNumRepresentations; i++) {
1058
+ indirect_uses_[i] += other->non_phi_uses_[i];
1059
+ }
1060
+ }
1061
+
1062
+
1063
+ void HPhi::AddIndirectUsesTo(int* dest) {
1064
+ for (int i = 0; i < Representation::kNumRepresentations; i++) {
1065
+ dest[i] += indirect_uses_[i];
1066
+ }
1067
+ }
1068
+
1069
+
1070
+ void HSimulate::PrintDataTo(StringStream* stream) {
1071
+ stream->Add("id=%d ", ast_id());
1072
+ if (pop_count_ > 0) stream->Add("pop %d", pop_count_);
1073
+ if (values_.length() > 0) {
1074
+ if (pop_count_ > 0) stream->Add(" /");
1075
+ for (int i = 0; i < values_.length(); ++i) {
1076
+ if (!HasAssignedIndexAt(i)) {
1077
+ stream->Add(" push ");
1078
+ } else {
1079
+ stream->Add(" var[%d] = ", GetAssignedIndexAt(i));
1080
+ }
1081
+ values_[i]->PrintNameTo(stream);
1082
+ }
1083
+ }
1084
+ }
1085
+
1086
+
1087
+ void HEnterInlined::PrintDataTo(StringStream* stream) {
1088
+ SmartPointer<char> name = function()->debug_name()->ToCString();
1089
+ stream->Add("%s, id=%d", *name, function()->id());
1090
+ }
1091
+
1092
+
1093
+ HConstant::HConstant(Handle<Object> handle, Representation r)
1094
+ : handle_(handle),
1095
+ has_int32_value_(false),
1096
+ has_double_value_(false),
1097
+ int32_value_(0),
1098
+ double_value_(0) {
1099
+ set_representation(r);
1100
+ SetFlag(kUseGVN);
1101
+ if (handle_->IsNumber()) {
1102
+ double n = handle_->Number();
1103
+ double roundtrip_value = static_cast<double>(static_cast<int32_t>(n));
1104
+ has_int32_value_ = BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(n);
1105
+ if (has_int32_value_) int32_value_ = static_cast<int32_t>(n);
1106
+ double_value_ = n;
1107
+ has_double_value_ = true;
1108
+ }
1109
+ }
1110
+
1111
+
1112
+ HConstant* HConstant::CopyToRepresentation(Representation r) const {
1113
+ if (r.IsInteger32() && !has_int32_value_) return NULL;
1114
+ if (r.IsDouble() && !has_double_value_) return NULL;
1115
+ return new HConstant(handle_, r);
1116
+ }
1117
+
1118
+
1119
+ HConstant* HConstant::CopyToTruncatedInt32() const {
1120
+ if (!has_double_value_) return NULL;
1121
+ int32_t truncated = NumberToInt32(*handle_);
1122
+ return new HConstant(FACTORY->NewNumberFromInt(truncated),
1123
+ Representation::Integer32());
1124
+ }
1125
+
1126
+
1127
+ bool HConstant::ToBoolean() const {
1128
+ // Converts the constant's boolean value according to
1129
+ // ECMAScript section 9.2 ToBoolean conversion.
1130
+ if (HasInteger32Value()) return Integer32Value() != 0;
1131
+ if (HasDoubleValue()) {
1132
+ double v = DoubleValue();
1133
+ return v != 0 && !isnan(v);
1134
+ }
1135
+ if (handle()->IsTrue()) return true;
1136
+ if (handle()->IsFalse()) return false;
1137
+ if (handle()->IsUndefined()) return false;
1138
+ if (handle()->IsNull()) return false;
1139
+ if (handle()->IsString() &&
1140
+ String::cast(*handle())->length() == 0) return false;
1141
+ return true;
1142
+ }
1143
+
1144
+ void HConstant::PrintDataTo(StringStream* stream) {
1145
+ handle()->ShortPrint(stream);
1146
+ }
1147
+
1148
+
1149
+ bool HArrayLiteral::IsCopyOnWrite() const {
1150
+ return constant_elements()->map() == HEAP->fixed_cow_array_map();
1151
+ }
1152
+
1153
+
1154
+ void HBinaryOperation::PrintDataTo(StringStream* stream) {
1155
+ left()->PrintNameTo(stream);
1156
+ stream->Add(" ");
1157
+ right()->PrintNameTo(stream);
1158
+ if (CheckFlag(kCanOverflow)) stream->Add(" !");
1159
+ if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
1160
+ }
1161
+
1162
+
1163
+ Range* HBitAnd::InferRange() {
1164
+ int32_t left_mask = (left()->range() != NULL)
1165
+ ? left()->range()->Mask()
1166
+ : 0xffffffff;
1167
+ int32_t right_mask = (right()->range() != NULL)
1168
+ ? right()->range()->Mask()
1169
+ : 0xffffffff;
1170
+ int32_t result_mask = left_mask & right_mask;
1171
+ return (result_mask >= 0)
1172
+ ? new Range(0, result_mask)
1173
+ : HValue::InferRange();
1174
+ }
1175
+
1176
+
1177
+ Range* HBitOr::InferRange() {
1178
+ int32_t left_mask = (left()->range() != NULL)
1179
+ ? left()->range()->Mask()
1180
+ : 0xffffffff;
1181
+ int32_t right_mask = (right()->range() != NULL)
1182
+ ? right()->range()->Mask()
1183
+ : 0xffffffff;
1184
+ int32_t result_mask = left_mask | right_mask;
1185
+ return (result_mask >= 0)
1186
+ ? new Range(0, result_mask)
1187
+ : HValue::InferRange();
1188
+ }
1189
+
1190
+
1191
+ Range* HSar::InferRange() {
1192
+ if (right()->IsConstant()) {
1193
+ HConstant* c = HConstant::cast(right());
1194
+ if (c->HasInteger32Value()) {
1195
+ Range* result = (left()->range() != NULL)
1196
+ ? left()->range()->Copy()
1197
+ : new Range();
1198
+ result->Sar(c->Integer32Value());
1199
+ return result;
1200
+ }
1201
+ }
1202
+ return HValue::InferRange();
1203
+ }
1204
+
1205
+
1206
+ Range* HShl::InferRange() {
1207
+ if (right()->IsConstant()) {
1208
+ HConstant* c = HConstant::cast(right());
1209
+ if (c->HasInteger32Value()) {
1210
+ Range* result = (left()->range() != NULL)
1211
+ ? left()->range()->Copy()
1212
+ : new Range();
1213
+ result->Shl(c->Integer32Value());
1214
+ return result;
1215
+ }
1216
+ }
1217
+ return HValue::InferRange();
1218
+ }
1219
+
1220
+
1221
+
1222
+ void HCompare::PrintDataTo(StringStream* stream) {
1223
+ stream->Add(Token::Name(token()));
1224
+ stream->Add(" ");
1225
+ HBinaryOperation::PrintDataTo(stream);
1226
+ }
1227
+
1228
+
1229
+ void HCompare::SetInputRepresentation(Representation r) {
1230
+ input_representation_ = r;
1231
+ if (r.IsTagged()) {
1232
+ SetAllSideEffects();
1233
+ ClearFlag(kUseGVN);
1234
+ } else {
1235
+ ClearAllSideEffects();
1236
+ SetFlag(kUseGVN);
1237
+ }
1238
+ }
1239
+
1240
+
1241
+ void HParameter::PrintDataTo(StringStream* stream) {
1242
+ stream->Add("%u", index());
1243
+ }
1244
+
1245
+
1246
+ void HLoadNamedField::PrintDataTo(StringStream* stream) {
1247
+ object()->PrintNameTo(stream);
1248
+ stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : "");
1249
+ }
1250
+
1251
+
1252
+ HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* object,
1253
+ ZoneMapList* types,
1254
+ Handle<String> name)
1255
+ : HUnaryOperation(object),
1256
+ types_(Min(types->length(), kMaxLoadPolymorphism)),
1257
+ name_(name),
1258
+ need_generic_(false) {
1259
+ set_representation(Representation::Tagged());
1260
+ SetFlag(kDependsOnMaps);
1261
+ for (int i = 0;
1262
+ i < types->length() && types_.length() < kMaxLoadPolymorphism;
1263
+ ++i) {
1264
+ Handle<Map> map = types->at(i);
1265
+ LookupResult lookup;
1266
+ map->LookupInDescriptors(NULL, *name, &lookup);
1267
+ if (lookup.IsProperty()) {
1268
+ switch (lookup.type()) {
1269
+ case FIELD: {
1270
+ int index = lookup.GetLocalFieldIndexFromMap(*map);
1271
+ if (index < 0) {
1272
+ SetFlag(kDependsOnInobjectFields);
1273
+ } else {
1274
+ SetFlag(kDependsOnBackingStoreFields);
1275
+ }
1276
+ types_.Add(types->at(i));
1277
+ break;
1278
+ }
1279
+ case CONSTANT_FUNCTION:
1280
+ types_.Add(types->at(i));
1281
+ break;
1282
+ default:
1283
+ break;
1284
+ }
1285
+ }
1286
+ }
1287
+
1288
+ if (types_.length() == types->length() && FLAG_deoptimize_uncommon_cases) {
1289
+ SetFlag(kUseGVN);
1290
+ } else {
1291
+ SetAllSideEffects();
1292
+ need_generic_ = true;
1293
+ }
1294
+ }
1295
+
1296
+
1297
+ bool HLoadNamedFieldPolymorphic::DataEquals(HValue* value) {
1298
+ HLoadNamedFieldPolymorphic* other = HLoadNamedFieldPolymorphic::cast(value);
1299
+ if (types_.length() != other->types()->length()) return false;
1300
+ if (!name_.is_identical_to(other->name())) return false;
1301
+ if (need_generic_ != other->need_generic_) return false;
1302
+ for (int i = 0; i < types_.length(); i++) {
1303
+ bool found = false;
1304
+ for (int j = 0; j < types_.length(); j++) {
1305
+ if (types_.at(j).is_identical_to(other->types()->at(i))) {
1306
+ found = true;
1307
+ break;
1308
+ }
1309
+ }
1310
+ if (!found) return false;
1311
+ }
1312
+ return true;
1313
+ }
1314
+
1315
+
1316
+ void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) {
1317
+ object()->PrintNameTo(stream);
1318
+ stream->Add("[");
1319
+ key()->PrintNameTo(stream);
1320
+ stream->Add("]");
1321
+ }
1322
+
1323
+
1324
+ bool HLoadKeyedFastElement::RequiresHoleCheck() const {
1325
+ for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
1326
+ HValue* use = it.value();
1327
+ if (!use->IsChange()) return true;
1328
+ }
1329
+ return false;
1330
+ }
1331
+
1332
+
1333
+ void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) {
1334
+ object()->PrintNameTo(stream);
1335
+ stream->Add("[");
1336
+ key()->PrintNameTo(stream);
1337
+ stream->Add("]");
1338
+ }
1339
+
1340
+
1341
+ void HLoadKeyedSpecializedArrayElement::PrintDataTo(
1342
+ StringStream* stream) {
1343
+ external_pointer()->PrintNameTo(stream);
1344
+ stream->Add(".");
1345
+ switch (array_type()) {
1346
+ case kExternalByteArray:
1347
+ stream->Add("byte");
1348
+ break;
1349
+ case kExternalUnsignedByteArray:
1350
+ stream->Add("u_byte");
1351
+ break;
1352
+ case kExternalShortArray:
1353
+ stream->Add("short");
1354
+ break;
1355
+ case kExternalUnsignedShortArray:
1356
+ stream->Add("u_short");
1357
+ break;
1358
+ case kExternalIntArray:
1359
+ stream->Add("int");
1360
+ break;
1361
+ case kExternalUnsignedIntArray:
1362
+ stream->Add("u_int");
1363
+ break;
1364
+ case kExternalFloatArray:
1365
+ stream->Add("float");
1366
+ break;
1367
+ case kExternalDoubleArray:
1368
+ stream->Add("double");
1369
+ break;
1370
+ case kExternalPixelArray:
1371
+ stream->Add("pixel");
1372
+ break;
1373
+ }
1374
+ stream->Add("[");
1375
+ key()->PrintNameTo(stream);
1376
+ stream->Add("]");
1377
+ }
1378
+
1379
+
1380
+ void HStoreNamedGeneric::PrintDataTo(StringStream* stream) {
1381
+ object()->PrintNameTo(stream);
1382
+ stream->Add(".");
1383
+ ASSERT(name()->IsString());
1384
+ stream->Add(*String::cast(*name())->ToCString());
1385
+ stream->Add(" = ");
1386
+ value()->PrintNameTo(stream);
1387
+ }
1388
+
1389
+
1390
+ void HStoreNamedField::PrintDataTo(StringStream* stream) {
1391
+ object()->PrintNameTo(stream);
1392
+ stream->Add(".");
1393
+ ASSERT(name()->IsString());
1394
+ stream->Add(*String::cast(*name())->ToCString());
1395
+ stream->Add(" = ");
1396
+ value()->PrintNameTo(stream);
1397
+ if (!transition().is_null()) {
1398
+ stream->Add(" (transition map %p)", *transition());
1399
+ }
1400
+ }
1401
+
1402
+
1403
+ void HStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
1404
+ object()->PrintNameTo(stream);
1405
+ stream->Add("[");
1406
+ key()->PrintNameTo(stream);
1407
+ stream->Add("] = ");
1408
+ value()->PrintNameTo(stream);
1409
+ }
1410
+
1411
+
1412
+ void HStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
1413
+ object()->PrintNameTo(stream);
1414
+ stream->Add("[");
1415
+ key()->PrintNameTo(stream);
1416
+ stream->Add("] = ");
1417
+ value()->PrintNameTo(stream);
1418
+ }
1419
+
1420
+
1421
+ void HStoreKeyedSpecializedArrayElement::PrintDataTo(
1422
+ StringStream* stream) {
1423
+ external_pointer()->PrintNameTo(stream);
1424
+ stream->Add(".");
1425
+ switch (array_type()) {
1426
+ case kExternalByteArray:
1427
+ stream->Add("byte");
1428
+ break;
1429
+ case kExternalUnsignedByteArray:
1430
+ stream->Add("u_byte");
1431
+ break;
1432
+ case kExternalShortArray:
1433
+ stream->Add("short");
1434
+ break;
1435
+ case kExternalUnsignedShortArray:
1436
+ stream->Add("u_short");
1437
+ break;
1438
+ case kExternalIntArray:
1439
+ stream->Add("int");
1440
+ break;
1441
+ case kExternalUnsignedIntArray:
1442
+ stream->Add("u_int");
1443
+ break;
1444
+ case kExternalFloatArray:
1445
+ stream->Add("float");
1446
+ break;
1447
+ case kExternalDoubleArray:
1448
+ stream->Add("double");
1449
+ break;
1450
+ case kExternalPixelArray:
1451
+ stream->Add("pixel");
1452
+ break;
1453
+ }
1454
+ stream->Add("[");
1455
+ key()->PrintNameTo(stream);
1456
+ stream->Add("] = ");
1457
+ value()->PrintNameTo(stream);
1458
+ }
1459
+
1460
+
1461
+ void HLoadGlobalCell::PrintDataTo(StringStream* stream) {
1462
+ stream->Add("[%p]", *cell());
1463
+ if (check_hole_value()) stream->Add(" (deleteable/read-only)");
1464
+ }
1465
+
1466
+
1467
+ void HLoadGlobalGeneric::PrintDataTo(StringStream* stream) {
1468
+ stream->Add("%o ", *name());
1469
+ }
1470
+
1471
+
1472
+ void HStoreGlobalCell::PrintDataTo(StringStream* stream) {
1473
+ stream->Add("[%p] = ", *cell());
1474
+ value()->PrintNameTo(stream);
1475
+ }
1476
+
1477
+
1478
+ void HStoreGlobalGeneric::PrintDataTo(StringStream* stream) {
1479
+ stream->Add("%o = ", *name());
1480
+ value()->PrintNameTo(stream);
1481
+ }
1482
+
1483
+
1484
+ void HLoadContextSlot::PrintDataTo(StringStream* stream) {
1485
+ value()->PrintNameTo(stream);
1486
+ stream->Add("[%d]", slot_index());
1487
+ }
1488
+
1489
+
1490
+ void HStoreContextSlot::PrintDataTo(StringStream* stream) {
1491
+ context()->PrintNameTo(stream);
1492
+ stream->Add("[%d] = ", slot_index());
1493
+ value()->PrintNameTo(stream);
1494
+ }
1495
+
1496
+
1497
+ // Implementation of type inference and type conversions. Calculates
1498
+ // the inferred type of this instruction based on the input operands.
1499
+
1500
+ HType HValue::CalculateInferredType() {
1501
+ return type_;
1502
+ }
1503
+
1504
+
1505
+ HType HCheckMap::CalculateInferredType() {
1506
+ return value()->type();
1507
+ }
1508
+
1509
+
1510
+ HType HCheckFunction::CalculateInferredType() {
1511
+ return value()->type();
1512
+ }
1513
+
1514
+
1515
+ HType HCheckNonSmi::CalculateInferredType() {
1516
+ // TODO(kasperl): Is there any way to signal that this isn't a smi?
1517
+ return HType::Tagged();
1518
+ }
1519
+
1520
+
1521
+ HType HCheckSmi::CalculateInferredType() {
1522
+ return HType::Smi();
1523
+ }
1524
+
1525
+
1526
+ HType HPhi::CalculateInferredType() {
1527
+ HType result = HType::Uninitialized();
1528
+ for (int i = 0; i < OperandCount(); ++i) {
1529
+ HType current = OperandAt(i)->type();
1530
+ result = result.Combine(current);
1531
+ }
1532
+ return result;
1533
+ }
1534
+
1535
+
1536
+ HType HConstant::CalculateInferredType() {
1537
+ return HType::TypeFromValue(handle_);
1538
+ }
1539
+
1540
+
1541
+ HType HCompare::CalculateInferredType() {
1542
+ return HType::Boolean();
1543
+ }
1544
+
1545
+
1546
+ HType HCompareJSObjectEq::CalculateInferredType() {
1547
+ return HType::Boolean();
1548
+ }
1549
+
1550
+
1551
+ HType HUnaryPredicate::CalculateInferredType() {
1552
+ return HType::Boolean();
1553
+ }
1554
+
1555
+
1556
+ HType HBitwiseBinaryOperation::CalculateInferredType() {
1557
+ return HType::TaggedNumber();
1558
+ }
1559
+
1560
+
1561
+ HType HArithmeticBinaryOperation::CalculateInferredType() {
1562
+ return HType::TaggedNumber();
1563
+ }
1564
+
1565
+
1566
+ HType HAdd::CalculateInferredType() {
1567
+ return HType::Tagged();
1568
+ }
1569
+
1570
+
1571
+ HType HBitAnd::CalculateInferredType() {
1572
+ return HType::TaggedNumber();
1573
+ }
1574
+
1575
+
1576
+ HType HBitXor::CalculateInferredType() {
1577
+ return HType::TaggedNumber();
1578
+ }
1579
+
1580
+
1581
+ HType HBitOr::CalculateInferredType() {
1582
+ return HType::TaggedNumber();
1583
+ }
1584
+
1585
+
1586
+ HType HBitNot::CalculateInferredType() {
1587
+ return HType::TaggedNumber();
1588
+ }
1589
+
1590
+
1591
+ HType HUnaryMathOperation::CalculateInferredType() {
1592
+ return HType::TaggedNumber();
1593
+ }
1594
+
1595
+
1596
+ HType HShl::CalculateInferredType() {
1597
+ return HType::TaggedNumber();
1598
+ }
1599
+
1600
+
1601
+ HType HShr::CalculateInferredType() {
1602
+ return HType::TaggedNumber();
1603
+ }
1604
+
1605
+
1606
+ HType HSar::CalculateInferredType() {
1607
+ return HType::TaggedNumber();
1608
+ }
1609
+
1610
+
1611
+ HValue* HUnaryMathOperation::EnsureAndPropagateNotMinusZero(
1612
+ BitVector* visited) {
1613
+ visited->Add(id());
1614
+ if (representation().IsInteger32() &&
1615
+ !value()->representation().IsInteger32()) {
1616
+ if (value()->range() == NULL || value()->range()->CanBeMinusZero()) {
1617
+ SetFlag(kBailoutOnMinusZero);
1618
+ }
1619
+ }
1620
+ if (RequiredInputRepresentation(0).IsInteger32() &&
1621
+ representation().IsInteger32()) {
1622
+ return value();
1623
+ }
1624
+ return NULL;
1625
+ }
1626
+
1627
+
1628
+
1629
+ HValue* HChange::EnsureAndPropagateNotMinusZero(BitVector* visited) {
1630
+ visited->Add(id());
1631
+ if (from().IsInteger32()) return NULL;
1632
+ if (CanTruncateToInt32()) return NULL;
1633
+ if (value()->range() == NULL || value()->range()->CanBeMinusZero()) {
1634
+ SetFlag(kBailoutOnMinusZero);
1635
+ }
1636
+ ASSERT(!from().IsInteger32() || !to().IsInteger32());
1637
+ return NULL;
1638
+ }
1639
+
1640
+
1641
+ HValue* HForceRepresentation::EnsureAndPropagateNotMinusZero(
1642
+ BitVector* visited) {
1643
+ visited->Add(id());
1644
+ return value();
1645
+ }
1646
+
1647
+
1648
+ HValue* HMod::EnsureAndPropagateNotMinusZero(BitVector* visited) {
1649
+ visited->Add(id());
1650
+ if (range() == NULL || range()->CanBeMinusZero()) {
1651
+ SetFlag(kBailoutOnMinusZero);
1652
+ return left();
1653
+ }
1654
+ return NULL;
1655
+ }
1656
+
1657
+
1658
+ HValue* HDiv::EnsureAndPropagateNotMinusZero(BitVector* visited) {
1659
+ visited->Add(id());
1660
+ if (range() == NULL || range()->CanBeMinusZero()) {
1661
+ SetFlag(kBailoutOnMinusZero);
1662
+ }
1663
+ return NULL;
1664
+ }
1665
+
1666
+
1667
+ HValue* HMul::EnsureAndPropagateNotMinusZero(BitVector* visited) {
1668
+ visited->Add(id());
1669
+ if (range() == NULL || range()->CanBeMinusZero()) {
1670
+ SetFlag(kBailoutOnMinusZero);
1671
+ }
1672
+ return NULL;
1673
+ }
1674
+
1675
+
1676
+ HValue* HSub::EnsureAndPropagateNotMinusZero(BitVector* visited) {
1677
+ visited->Add(id());
1678
+ // Propagate to the left argument. If the left argument cannot be -0, then
1679
+ // the result of the add operation cannot be either.
1680
+ if (range() == NULL || range()->CanBeMinusZero()) {
1681
+ return left();
1682
+ }
1683
+ return NULL;
1684
+ }
1685
+
1686
+
1687
+ HValue* HAdd::EnsureAndPropagateNotMinusZero(BitVector* visited) {
1688
+ visited->Add(id());
1689
+ // Propagate to the left argument. If the left argument cannot be -0, then
1690
+ // the result of the sub operation cannot be either.
1691
+ if (range() == NULL || range()->CanBeMinusZero()) {
1692
+ return left();
1693
+ }
1694
+ return NULL;
1695
+ }
1696
+
1697
+
1698
+ void HIn::PrintDataTo(StringStream* stream) {
1699
+ key()->PrintNameTo(stream);
1700
+ stream->Add(" ");
1701
+ object()->PrintNameTo(stream);
1702
+ }
1703
+
1704
+
1705
+ // Node-specific verification code is only included in debug mode.
1706
+ #ifdef DEBUG
1707
+
1708
+ void HPhi::Verify() {
1709
+ ASSERT(OperandCount() == block()->predecessors()->length());
1710
+ for (int i = 0; i < OperandCount(); ++i) {
1711
+ HValue* value = OperandAt(i);
1712
+ HBasicBlock* defining_block = value->block();
1713
+ HBasicBlock* predecessor_block = block()->predecessors()->at(i);
1714
+ ASSERT(defining_block == predecessor_block ||
1715
+ defining_block->Dominates(predecessor_block));
1716
+ }
1717
+ }
1718
+
1719
+
1720
+ void HSimulate::Verify() {
1721
+ HInstruction::Verify();
1722
+ ASSERT(HasAstId());
1723
+ }
1724
+
1725
+
1726
+ void HBoundsCheck::Verify() {
1727
+ HInstruction::Verify();
1728
+ ASSERT(HasNoUses());
1729
+ }
1730
+
1731
+
1732
+ void HCheckSmi::Verify() {
1733
+ HInstruction::Verify();
1734
+ ASSERT(HasNoUses());
1735
+ }
1736
+
1737
+
1738
+ void HCheckNonSmi::Verify() {
1739
+ HInstruction::Verify();
1740
+ ASSERT(HasNoUses());
1741
+ }
1742
+
1743
+
1744
+ void HCheckInstanceType::Verify() {
1745
+ HInstruction::Verify();
1746
+ ASSERT(HasNoUses());
1747
+ }
1748
+
1749
+
1750
+ void HCheckMap::Verify() {
1751
+ HInstruction::Verify();
1752
+ ASSERT(HasNoUses());
1753
+ }
1754
+
1755
+
1756
+ void HCheckFunction::Verify() {
1757
+ HInstruction::Verify();
1758
+ ASSERT(HasNoUses());
1759
+ }
1760
+
1761
+
1762
+ void HCheckPrototypeMaps::Verify() {
1763
+ HInstruction::Verify();
1764
+ ASSERT(HasNoUses());
1765
+ }
1766
+
1767
+ #endif
1768
+
1769
+ } } // namespace v8::internal