libv8 3.3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (700) hide show
  1. data/.gitignore +8 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +44 -0
  5. data/Rakefile +73 -0
  6. data/ext/libv8/extconf.rb +9 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +38 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  11. data/lib/libv8/scons/CHANGES.txt +5334 -0
  12. data/lib/libv8/scons/LICENSE.txt +20 -0
  13. data/lib/libv8/scons/MANIFEST +199 -0
  14. data/lib/libv8/scons/PKG-INFO +13 -0
  15. data/lib/libv8/scons/README.txt +243 -0
  16. data/lib/libv8/scons/RELEASE.txt +98 -0
  17. data/lib/libv8/scons/engine/SCons/Action.py +1241 -0
  18. data/lib/libv8/scons/engine/SCons/Builder.py +877 -0
  19. data/lib/libv8/scons/engine/SCons/CacheDir.py +216 -0
  20. data/lib/libv8/scons/engine/SCons/Conftest.py +793 -0
  21. data/lib/libv8/scons/engine/SCons/Debug.py +220 -0
  22. data/lib/libv8/scons/engine/SCons/Defaults.py +480 -0
  23. data/lib/libv8/scons/engine/SCons/Environment.py +2318 -0
  24. data/lib/libv8/scons/engine/SCons/Errors.py +205 -0
  25. data/lib/libv8/scons/engine/SCons/Executor.py +633 -0
  26. data/lib/libv8/scons/engine/SCons/Job.py +435 -0
  27. data/lib/libv8/scons/engine/SCons/Memoize.py +244 -0
  28. data/lib/libv8/scons/engine/SCons/Node/Alias.py +152 -0
  29. data/lib/libv8/scons/engine/SCons/Node/FS.py +3142 -0
  30. data/lib/libv8/scons/engine/SCons/Node/Python.py +128 -0
  31. data/lib/libv8/scons/engine/SCons/Node/__init__.py +1328 -0
  32. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +50 -0
  33. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +50 -0
  34. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +50 -0
  35. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +50 -0
  36. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +76 -0
  37. data/lib/libv8/scons/engine/SCons/Options/__init__.py +67 -0
  38. data/lib/libv8/scons/engine/SCons/PathList.py +231 -0
  39. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +241 -0
  40. data/lib/libv8/scons/engine/SCons/Platform/aix.py +69 -0
  41. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +55 -0
  42. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +46 -0
  43. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +46 -0
  44. data/lib/libv8/scons/engine/SCons/Platform/irix.py +44 -0
  45. data/lib/libv8/scons/engine/SCons/Platform/os2.py +58 -0
  46. data/lib/libv8/scons/engine/SCons/Platform/posix.py +263 -0
  47. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +50 -0
  48. data/lib/libv8/scons/engine/SCons/Platform/win32.py +385 -0
  49. data/lib/libv8/scons/engine/SCons/SConf.py +1030 -0
  50. data/lib/libv8/scons/engine/SCons/SConsign.py +383 -0
  51. data/lib/libv8/scons/engine/SCons/Scanner/C.py +132 -0
  52. data/lib/libv8/scons/engine/SCons/Scanner/D.py +73 -0
  53. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +109 -0
  54. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +316 -0
  55. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +48 -0
  56. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +384 -0
  57. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +101 -0
  58. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +55 -0
  59. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +413 -0
  60. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +384 -0
  61. data/lib/libv8/scons/engine/SCons/Script/Main.py +1334 -0
  62. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +939 -0
  63. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +640 -0
  64. data/lib/libv8/scons/engine/SCons/Script/__init__.py +412 -0
  65. data/lib/libv8/scons/engine/SCons/Sig.py +63 -0
  66. data/lib/libv8/scons/engine/SCons/Subst.py +904 -0
  67. data/lib/libv8/scons/engine/SCons/Taskmaster.py +1017 -0
  68. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +61 -0
  69. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +67 -0
  70. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +73 -0
  71. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +246 -0
  72. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +323 -0
  73. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  74. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  75. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +240 -0
  76. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +82 -0
  77. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +391 -0
  78. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +456 -0
  79. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +499 -0
  80. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +103 -0
  81. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +137 -0
  82. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +64 -0
  83. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +64 -0
  84. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +71 -0
  85. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +681 -0
  86. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +82 -0
  87. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +74 -0
  88. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +80 -0
  89. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +76 -0
  90. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +71 -0
  91. data/lib/libv8/scons/engine/SCons/Tool/ar.py +63 -0
  92. data/lib/libv8/scons/engine/SCons/Tool/as.py +78 -0
  93. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +81 -0
  94. data/lib/libv8/scons/engine/SCons/Tool/c++.py +99 -0
  95. data/lib/libv8/scons/engine/SCons/Tool/cc.py +102 -0
  96. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +58 -0
  97. data/lib/libv8/scons/engine/SCons/Tool/default.py +50 -0
  98. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +223 -0
  99. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +64 -0
  100. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +124 -0
  101. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +94 -0
  102. data/lib/libv8/scons/engine/SCons/Tool/f77.py +62 -0
  103. data/lib/libv8/scons/engine/SCons/Tool/f90.py +62 -0
  104. data/lib/libv8/scons/engine/SCons/Tool/f95.py +63 -0
  105. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +98 -0
  106. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +62 -0
  107. data/lib/libv8/scons/engine/SCons/Tool/g++.py +90 -0
  108. data/lib/libv8/scons/engine/SCons/Tool/g77.py +73 -0
  109. data/lib/libv8/scons/engine/SCons/Tool/gas.py +53 -0
  110. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +80 -0
  111. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +64 -0
  112. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +63 -0
  113. data/lib/libv8/scons/engine/SCons/Tool/gs.py +81 -0
  114. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +84 -0
  115. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +53 -0
  116. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +77 -0
  117. data/lib/libv8/scons/engine/SCons/Tool/icc.py +59 -0
  118. data/lib/libv8/scons/engine/SCons/Tool/icl.py +52 -0
  119. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +72 -0
  120. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +88 -0
  121. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +59 -0
  122. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +60 -0
  123. data/lib/libv8/scons/engine/SCons/Tool/install.py +229 -0
  124. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +482 -0
  125. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +67 -0
  126. data/lib/libv8/scons/engine/SCons/Tool/jar.py +110 -0
  127. data/lib/libv8/scons/engine/SCons/Tool/javac.py +230 -0
  128. data/lib/libv8/scons/engine/SCons/Tool/javah.py +137 -0
  129. data/lib/libv8/scons/engine/SCons/Tool/latex.py +79 -0
  130. data/lib/libv8/scons/engine/SCons/Tool/lex.py +97 -0
  131. data/lib/libv8/scons/engine/SCons/Tool/link.py +121 -0
  132. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +112 -0
  133. data/lib/libv8/scons/engine/SCons/Tool/m4.py +63 -0
  134. data/lib/libv8/scons/engine/SCons/Tool/masm.py +77 -0
  135. data/lib/libv8/scons/engine/SCons/Tool/midl.py +88 -0
  136. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +158 -0
  137. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +64 -0
  138. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +266 -0
  139. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +50 -0
  140. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +268 -0
  141. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +1388 -0
  142. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +207 -0
  143. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +107 -0
  144. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +72 -0
  145. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +312 -0
  146. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  147. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +527 -0
  148. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +365 -0
  149. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  150. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  151. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  152. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  153. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  154. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  155. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +78 -0
  156. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +83 -0
  157. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +108 -0
  158. data/lib/libv8/scons/engine/SCons/Tool/qt.py +336 -0
  159. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +120 -0
  160. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +70 -0
  161. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +132 -0
  162. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +68 -0
  163. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +58 -0
  164. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +53 -0
  165. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +63 -0
  166. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +67 -0
  167. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +142 -0
  168. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +58 -0
  169. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +63 -0
  170. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +64 -0
  171. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +64 -0
  172. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +77 -0
  173. data/lib/libv8/scons/engine/SCons/Tool/swig.py +182 -0
  174. data/lib/libv8/scons/engine/SCons/Tool/tar.py +73 -0
  175. data/lib/libv8/scons/engine/SCons/Tool/tex.py +813 -0
  176. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +175 -0
  177. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +53 -0
  178. data/lib/libv8/scons/engine/SCons/Tool/wix.py +99 -0
  179. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +130 -0
  180. data/lib/libv8/scons/engine/SCons/Tool/zip.py +99 -0
  181. data/lib/libv8/scons/engine/SCons/Util.py +1492 -0
  182. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +89 -0
  183. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +103 -0
  184. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +135 -0
  185. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +106 -0
  186. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +147 -0
  187. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +312 -0
  188. data/lib/libv8/scons/engine/SCons/Warnings.py +246 -0
  189. data/lib/libv8/scons/engine/SCons/__init__.py +49 -0
  190. data/lib/libv8/scons/engine/SCons/compat/__init__.py +237 -0
  191. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +150 -0
  192. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +45 -0
  193. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +45 -0
  194. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +76 -0
  195. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +45 -0
  196. data/lib/libv8/scons/engine/SCons/compat/_scons_sets.py +563 -0
  197. data/lib/libv8/scons/engine/SCons/compat/_scons_subprocess.py +1281 -0
  198. data/lib/libv8/scons/engine/SCons/cpp.py +589 -0
  199. data/lib/libv8/scons/engine/SCons/dblite.py +251 -0
  200. data/lib/libv8/scons/engine/SCons/exitfuncs.py +77 -0
  201. data/lib/libv8/scons/os_spawnv_fix.diff +83 -0
  202. data/lib/libv8/scons/scons-time.1 +1017 -0
  203. data/lib/libv8/scons/scons.1 +15219 -0
  204. data/lib/libv8/scons/sconsign.1 +208 -0
  205. data/lib/libv8/scons/script/scons +196 -0
  206. data/lib/libv8/scons/script/scons-time +1544 -0
  207. data/lib/libv8/scons/script/scons.bat +31 -0
  208. data/lib/libv8/scons/script/sconsign +513 -0
  209. data/lib/libv8/scons/setup.cfg +6 -0
  210. data/lib/libv8/scons/setup.py +425 -0
  211. data/lib/libv8/v8/.gitignore +35 -0
  212. data/lib/libv8/v8/AUTHORS +44 -0
  213. data/lib/libv8/v8/ChangeLog +2839 -0
  214. data/lib/libv8/v8/LICENSE +52 -0
  215. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  216. data/lib/libv8/v8/LICENSE.v8 +26 -0
  217. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  218. data/lib/libv8/v8/SConstruct +1478 -0
  219. data/lib/libv8/v8/build/README.txt +49 -0
  220. data/lib/libv8/v8/build/all.gyp +18 -0
  221. data/lib/libv8/v8/build/armu.gypi +32 -0
  222. data/lib/libv8/v8/build/common.gypi +144 -0
  223. data/lib/libv8/v8/build/gyp_v8 +145 -0
  224. data/lib/libv8/v8/include/v8-debug.h +395 -0
  225. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  226. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  227. data/lib/libv8/v8/include/v8-testing.h +104 -0
  228. data/lib/libv8/v8/include/v8.h +4124 -0
  229. data/lib/libv8/v8/include/v8stdint.h +53 -0
  230. data/lib/libv8/v8/preparser/SConscript +38 -0
  231. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  232. data/lib/libv8/v8/src/SConscript +368 -0
  233. data/lib/libv8/v8/src/accessors.cc +767 -0
  234. data/lib/libv8/v8/src/accessors.h +123 -0
  235. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  236. data/lib/libv8/v8/src/allocation.cc +122 -0
  237. data/lib/libv8/v8/src/allocation.h +143 -0
  238. data/lib/libv8/v8/src/api.cc +5845 -0
  239. data/lib/libv8/v8/src/api.h +574 -0
  240. data/lib/libv8/v8/src/apinatives.js +110 -0
  241. data/lib/libv8/v8/src/apiutils.h +73 -0
  242. data/lib/libv8/v8/src/arguments.h +118 -0
  243. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  244. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  245. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  246. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  247. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  248. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  249. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  250. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  251. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  252. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  253. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  254. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  255. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  256. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  257. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  258. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  259. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  260. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  261. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  262. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  263. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  264. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  265. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  266. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  267. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  268. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  269. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  270. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  271. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  272. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  273. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  274. data/lib/libv8/v8/src/array.js +1366 -0
  275. data/lib/libv8/v8/src/assembler.cc +1207 -0
  276. data/lib/libv8/v8/src/assembler.h +858 -0
  277. data/lib/libv8/v8/src/ast-inl.h +112 -0
  278. data/lib/libv8/v8/src/ast.cc +1146 -0
  279. data/lib/libv8/v8/src/ast.h +2188 -0
  280. data/lib/libv8/v8/src/atomicops.h +167 -0
  281. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  282. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  283. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  284. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  285. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  286. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  287. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  288. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  289. data/lib/libv8/v8/src/bignum.cc +768 -0
  290. data/lib/libv8/v8/src/bignum.h +140 -0
  291. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  292. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  293. data/lib/libv8/v8/src/builtins.cc +1707 -0
  294. data/lib/libv8/v8/src/builtins.h +371 -0
  295. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  296. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  297. data/lib/libv8/v8/src/cached-powers.h +65 -0
  298. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  299. data/lib/libv8/v8/src/char-predicates.h +67 -0
  300. data/lib/libv8/v8/src/checks.cc +110 -0
  301. data/lib/libv8/v8/src/checks.h +296 -0
  302. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  303. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  304. data/lib/libv8/v8/src/circular-queue.h +103 -0
  305. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  306. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  307. data/lib/libv8/v8/src/code.h +70 -0
  308. data/lib/libv8/v8/src/codegen.cc +231 -0
  309. data/lib/libv8/v8/src/codegen.h +84 -0
  310. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  311. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  312. data/lib/libv8/v8/src/compiler.cc +786 -0
  313. data/lib/libv8/v8/src/compiler.h +312 -0
  314. data/lib/libv8/v8/src/contexts.cc +347 -0
  315. data/lib/libv8/v8/src/contexts.h +391 -0
  316. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  317. data/lib/libv8/v8/src/conversions.cc +1131 -0
  318. data/lib/libv8/v8/src/conversions.h +135 -0
  319. data/lib/libv8/v8/src/counters.cc +93 -0
  320. data/lib/libv8/v8/src/counters.h +254 -0
  321. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  322. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  323. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  324. data/lib/libv8/v8/src/cpu.h +69 -0
  325. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  326. data/lib/libv8/v8/src/d8-debug.h +158 -0
  327. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  328. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  329. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  330. data/lib/libv8/v8/src/d8.cc +803 -0
  331. data/lib/libv8/v8/src/d8.gyp +91 -0
  332. data/lib/libv8/v8/src/d8.h +235 -0
  333. data/lib/libv8/v8/src/d8.js +2798 -0
  334. data/lib/libv8/v8/src/data-flow.cc +66 -0
  335. data/lib/libv8/v8/src/data-flow.h +205 -0
  336. data/lib/libv8/v8/src/date.js +1103 -0
  337. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  338. data/lib/libv8/v8/src/dateparser.cc +178 -0
  339. data/lib/libv8/v8/src/dateparser.h +266 -0
  340. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  341. data/lib/libv8/v8/src/debug-agent.h +129 -0
  342. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  343. data/lib/libv8/v8/src/debug.cc +3165 -0
  344. data/lib/libv8/v8/src/debug.h +1057 -0
  345. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  346. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  347. data/lib/libv8/v8/src/disasm.h +80 -0
  348. data/lib/libv8/v8/src/disassembler.cc +343 -0
  349. data/lib/libv8/v8/src/disassembler.h +58 -0
  350. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  351. data/lib/libv8/v8/src/diy-fp.h +117 -0
  352. data/lib/libv8/v8/src/double.h +238 -0
  353. data/lib/libv8/v8/src/dtoa.cc +103 -0
  354. data/lib/libv8/v8/src/dtoa.h +85 -0
  355. data/lib/libv8/v8/src/execution.cc +849 -0
  356. data/lib/libv8/v8/src/execution.h +297 -0
  357. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  358. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  359. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  360. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  361. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  362. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  363. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  364. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  365. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  366. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  367. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  368. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  369. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  370. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  371. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  372. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  373. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  374. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  375. data/lib/libv8/v8/src/factory.cc +1222 -0
  376. data/lib/libv8/v8/src/factory.h +442 -0
  377. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  378. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  379. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  380. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  381. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  382. data/lib/libv8/v8/src/flags.cc +551 -0
  383. data/lib/libv8/v8/src/flags.h +79 -0
  384. data/lib/libv8/v8/src/frames-inl.h +247 -0
  385. data/lib/libv8/v8/src/frames.cc +1243 -0
  386. data/lib/libv8/v8/src/frames.h +870 -0
  387. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  388. data/lib/libv8/v8/src/full-codegen.h +771 -0
  389. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  390. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  391. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  392. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  393. data/lib/libv8/v8/src/global-handles.cc +665 -0
  394. data/lib/libv8/v8/src/global-handles.h +284 -0
  395. data/lib/libv8/v8/src/globals.h +325 -0
  396. data/lib/libv8/v8/src/handles-inl.h +177 -0
  397. data/lib/libv8/v8/src/handles.cc +987 -0
  398. data/lib/libv8/v8/src/handles.h +382 -0
  399. data/lib/libv8/v8/src/hashmap.cc +230 -0
  400. data/lib/libv8/v8/src/hashmap.h +123 -0
  401. data/lib/libv8/v8/src/heap-inl.h +704 -0
  402. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  403. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  404. data/lib/libv8/v8/src/heap.cc +5930 -0
  405. data/lib/libv8/v8/src/heap.h +2268 -0
  406. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  407. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  408. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  409. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  410. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  411. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  412. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  413. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  414. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  415. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  416. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  417. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  418. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  419. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  420. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  421. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  422. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  423. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  424. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  425. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  426. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  427. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  428. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  429. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  430. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  431. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  432. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  433. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  434. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  435. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  436. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  437. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  438. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  439. data/lib/libv8/v8/src/ic-inl.h +130 -0
  440. data/lib/libv8/v8/src/ic.cc +2577 -0
  441. data/lib/libv8/v8/src/ic.h +736 -0
  442. data/lib/libv8/v8/src/inspector.cc +63 -0
  443. data/lib/libv8/v8/src/inspector.h +62 -0
  444. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  445. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  446. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  447. data/lib/libv8/v8/src/isolate.cc +1869 -0
  448. data/lib/libv8/v8/src/isolate.h +1382 -0
  449. data/lib/libv8/v8/src/json-parser.cc +504 -0
  450. data/lib/libv8/v8/src/json-parser.h +161 -0
  451. data/lib/libv8/v8/src/json.js +342 -0
  452. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  453. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  454. data/lib/libv8/v8/src/list-inl.h +212 -0
  455. data/lib/libv8/v8/src/list.h +174 -0
  456. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  457. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  458. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  459. data/lib/libv8/v8/src/lithium.cc +190 -0
  460. data/lib/libv8/v8/src/lithium.h +597 -0
  461. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  462. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  463. data/lib/libv8/v8/src/liveedit.h +180 -0
  464. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  465. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  466. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  467. data/lib/libv8/v8/src/log-inl.h +59 -0
  468. data/lib/libv8/v8/src/log-utils.cc +428 -0
  469. data/lib/libv8/v8/src/log-utils.h +231 -0
  470. data/lib/libv8/v8/src/log.cc +1993 -0
  471. data/lib/libv8/v8/src/log.h +476 -0
  472. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  473. data/lib/libv8/v8/src/macros.py +178 -0
  474. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  475. data/lib/libv8/v8/src/mark-compact.h +506 -0
  476. data/lib/libv8/v8/src/math.js +264 -0
  477. data/lib/libv8/v8/src/messages.cc +179 -0
  478. data/lib/libv8/v8/src/messages.h +113 -0
  479. data/lib/libv8/v8/src/messages.js +1096 -0
  480. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  481. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  482. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  483. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  484. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  485. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  486. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  487. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  488. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  489. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  490. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  491. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  492. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  493. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  494. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  495. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  496. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  497. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  498. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  499. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  500. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  501. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  502. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  503. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  504. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  505. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  506. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  507. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  508. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  509. data/lib/libv8/v8/src/natives.h +64 -0
  510. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  511. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  512. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  513. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  514. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  515. data/lib/libv8/v8/src/objects.cc +10585 -0
  516. data/lib/libv8/v8/src/objects.h +6838 -0
  517. data/lib/libv8/v8/src/parser.cc +4997 -0
  518. data/lib/libv8/v8/src/parser.h +765 -0
  519. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  520. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  521. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  522. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  523. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  524. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  525. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  526. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  527. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  528. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  529. data/lib/libv8/v8/src/platform-tls.h +50 -0
  530. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  531. data/lib/libv8/v8/src/platform.h +667 -0
  532. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  533. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  534. data/lib/libv8/v8/src/preparse-data.h +225 -0
  535. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  536. data/lib/libv8/v8/src/preparser.cc +1450 -0
  537. data/lib/libv8/v8/src/preparser.h +493 -0
  538. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  539. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  540. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  541. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  542. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  543. data/lib/libv8/v8/src/property.cc +105 -0
  544. data/lib/libv8/v8/src/property.h +365 -0
  545. data/lib/libv8/v8/src/proxy.js +83 -0
  546. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  547. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  548. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  549. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  550. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  551. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  552. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  553. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  554. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  555. data/lib/libv8/v8/src/regexp.js +483 -0
  556. data/lib/libv8/v8/src/rewriter.cc +360 -0
  557. data/lib/libv8/v8/src/rewriter.h +50 -0
  558. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  559. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  560. data/lib/libv8/v8/src/runtime.cc +12227 -0
  561. data/lib/libv8/v8/src/runtime.h +652 -0
  562. data/lib/libv8/v8/src/runtime.js +649 -0
  563. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  564. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  565. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  566. data/lib/libv8/v8/src/scanner-base.h +670 -0
  567. data/lib/libv8/v8/src/scanner.cc +345 -0
  568. data/lib/libv8/v8/src/scanner.h +146 -0
  569. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  570. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  571. data/lib/libv8/v8/src/scopes.cc +1150 -0
  572. data/lib/libv8/v8/src/scopes.h +507 -0
  573. data/lib/libv8/v8/src/serialize.cc +1574 -0
  574. data/lib/libv8/v8/src/serialize.h +589 -0
  575. data/lib/libv8/v8/src/shell.h +55 -0
  576. data/lib/libv8/v8/src/simulator.h +43 -0
  577. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  578. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  579. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  580. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  581. data/lib/libv8/v8/src/snapshot.h +91 -0
  582. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  583. data/lib/libv8/v8/src/spaces.cc +3145 -0
  584. data/lib/libv8/v8/src/spaces.h +2369 -0
  585. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  586. data/lib/libv8/v8/src/splay-tree.h +205 -0
  587. data/lib/libv8/v8/src/string-search.cc +41 -0
  588. data/lib/libv8/v8/src/string-search.h +568 -0
  589. data/lib/libv8/v8/src/string-stream.cc +592 -0
  590. data/lib/libv8/v8/src/string-stream.h +191 -0
  591. data/lib/libv8/v8/src/string.js +994 -0
  592. data/lib/libv8/v8/src/strtod.cc +440 -0
  593. data/lib/libv8/v8/src/strtod.h +40 -0
  594. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  595. data/lib/libv8/v8/src/stub-cache.h +924 -0
  596. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  597. data/lib/libv8/v8/src/token.cc +63 -0
  598. data/lib/libv8/v8/src/token.h +288 -0
  599. data/lib/libv8/v8/src/type-info.cc +507 -0
  600. data/lib/libv8/v8/src/type-info.h +272 -0
  601. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  602. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  603. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  604. data/lib/libv8/v8/src/unicode.cc +1624 -0
  605. data/lib/libv8/v8/src/unicode.h +280 -0
  606. data/lib/libv8/v8/src/uri.js +408 -0
  607. data/lib/libv8/v8/src/utils-inl.h +48 -0
  608. data/lib/libv8/v8/src/utils.cc +371 -0
  609. data/lib/libv8/v8/src/utils.h +800 -0
  610. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  611. data/lib/libv8/v8/src/v8-counters.h +314 -0
  612. data/lib/libv8/v8/src/v8.cc +213 -0
  613. data/lib/libv8/v8/src/v8.h +131 -0
  614. data/lib/libv8/v8/src/v8checks.h +64 -0
  615. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  616. data/lib/libv8/v8/src/v8globals.h +512 -0
  617. data/lib/libv8/v8/src/v8memory.h +82 -0
  618. data/lib/libv8/v8/src/v8natives.js +1310 -0
  619. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  620. data/lib/libv8/v8/src/v8threads.cc +464 -0
  621. data/lib/libv8/v8/src/v8threads.h +165 -0
  622. data/lib/libv8/v8/src/v8utils.h +319 -0
  623. data/lib/libv8/v8/src/variables.cc +114 -0
  624. data/lib/libv8/v8/src/variables.h +167 -0
  625. data/lib/libv8/v8/src/version.cc +116 -0
  626. data/lib/libv8/v8/src/version.h +68 -0
  627. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  628. data/lib/libv8/v8/src/vm-state.h +71 -0
  629. data/lib/libv8/v8/src/win32-headers.h +96 -0
  630. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  631. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  632. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  633. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  634. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  635. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  636. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  637. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  638. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  639. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  640. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  641. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  642. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  643. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  644. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  645. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  646. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  647. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  648. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  649. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  650. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  651. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  652. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  653. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  654. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  655. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  656. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  657. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  658. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  659. data/lib/libv8/v8/src/zone-inl.h +140 -0
  660. data/lib/libv8/v8/src/zone.cc +196 -0
  661. data/lib/libv8/v8/src/zone.h +240 -0
  662. data/lib/libv8/v8/tools/codemap.js +265 -0
  663. data/lib/libv8/v8/tools/consarray.js +93 -0
  664. data/lib/libv8/v8/tools/csvparser.js +78 -0
  665. data/lib/libv8/v8/tools/disasm.py +92 -0
  666. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  667. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  668. data/lib/libv8/v8/tools/gcmole/README +62 -0
  669. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  670. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  671. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  672. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  673. data/lib/libv8/v8/tools/grokdump.py +841 -0
  674. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  675. data/lib/libv8/v8/tools/js2c.py +364 -0
  676. data/lib/libv8/v8/tools/jsmin.py +280 -0
  677. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  678. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  679. data/lib/libv8/v8/tools/logreader.js +185 -0
  680. data/lib/libv8/v8/tools/mac-nm +18 -0
  681. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  682. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  683. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  684. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  685. data/lib/libv8/v8/tools/presubmit.py +305 -0
  686. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  687. data/lib/libv8/v8/tools/profile.js +751 -0
  688. data/lib/libv8/v8/tools/profile_view.js +219 -0
  689. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  690. data/lib/libv8/v8/tools/splaytree.js +316 -0
  691. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  692. data/lib/libv8/v8/tools/test.py +1510 -0
  693. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  694. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  695. data/lib/libv8/v8/tools/utils.py +96 -0
  696. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  697. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  698. data/lib/libv8/version.rb +4 -0
  699. data/libv8.gemspec +31 -0
  700. metadata +800 -0
@@ -0,0 +1,2188 @@
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_AST_H_
29
+ #define V8_AST_H_
30
+
31
+ #include "allocation.h"
32
+ #include "execution.h"
33
+ #include "factory.h"
34
+ #include "jsregexp.h"
35
+ #include "runtime.h"
36
+ #include "token.h"
37
+ #include "variables.h"
38
+
39
+ namespace v8 {
40
+ namespace internal {
41
+
42
+ // The abstract syntax tree is an intermediate, light-weight
43
+ // representation of the parsed JavaScript code suitable for
44
+ // compilation to native code.
45
+
46
+ // Nodes are allocated in a separate zone, which allows faster
47
+ // allocation and constant-time deallocation of the entire syntax
48
+ // tree.
49
+
50
+
51
+ // ----------------------------------------------------------------------------
52
+ // Nodes of the abstract syntax tree. Only concrete classes are
53
+ // enumerated here.
54
+
55
+ #define STATEMENT_NODE_LIST(V) \
56
+ V(Block) \
57
+ V(ExpressionStatement) \
58
+ V(EmptyStatement) \
59
+ V(IfStatement) \
60
+ V(ContinueStatement) \
61
+ V(BreakStatement) \
62
+ V(ReturnStatement) \
63
+ V(WithEnterStatement) \
64
+ V(WithExitStatement) \
65
+ V(SwitchStatement) \
66
+ V(DoWhileStatement) \
67
+ V(WhileStatement) \
68
+ V(ForStatement) \
69
+ V(ForInStatement) \
70
+ V(TryCatchStatement) \
71
+ V(TryFinallyStatement) \
72
+ V(DebuggerStatement)
73
+
74
+ #define EXPRESSION_NODE_LIST(V) \
75
+ V(FunctionLiteral) \
76
+ V(SharedFunctionInfoLiteral) \
77
+ V(Conditional) \
78
+ V(VariableProxy) \
79
+ V(Literal) \
80
+ V(RegExpLiteral) \
81
+ V(ObjectLiteral) \
82
+ V(ArrayLiteral) \
83
+ V(CatchExtensionObject) \
84
+ V(Assignment) \
85
+ V(Throw) \
86
+ V(Property) \
87
+ V(Call) \
88
+ V(CallNew) \
89
+ V(CallRuntime) \
90
+ V(UnaryOperation) \
91
+ V(CountOperation) \
92
+ V(BinaryOperation) \
93
+ V(CompareOperation) \
94
+ V(CompareToNull) \
95
+ V(ThisFunction)
96
+
97
+ #define AST_NODE_LIST(V) \
98
+ V(Declaration) \
99
+ STATEMENT_NODE_LIST(V) \
100
+ EXPRESSION_NODE_LIST(V)
101
+
102
+ // Forward declarations
103
+ class BitVector;
104
+ class DefinitionInfo;
105
+ class MaterializedLiteral;
106
+ class TargetCollector;
107
+ class TypeFeedbackOracle;
108
+
109
+ #define DEF_FORWARD_DECLARATION(type) class type;
110
+ AST_NODE_LIST(DEF_FORWARD_DECLARATION)
111
+ #undef DEF_FORWARD_DECLARATION
112
+
113
+
114
+ // Typedef only introduced to avoid unreadable code.
115
+ // Please do appreciate the required space in "> >".
116
+ typedef ZoneList<Handle<String> > ZoneStringList;
117
+ typedef ZoneList<Handle<Object> > ZoneObjectList;
118
+
119
+
120
+ #define DECLARE_NODE_TYPE(type) \
121
+ virtual void Accept(AstVisitor* v); \
122
+ virtual AstNode::Type node_type() const { return AstNode::k##type; } \
123
+ virtual type* As##type() { return this; }
124
+
125
+
126
+ class AstNode: public ZoneObject {
127
+ public:
128
+ #define DECLARE_TYPE_ENUM(type) k##type,
129
+ enum Type {
130
+ AST_NODE_LIST(DECLARE_TYPE_ENUM)
131
+ kInvalid = -1
132
+ };
133
+ #undef DECLARE_TYPE_ENUM
134
+
135
+ static const int kNoNumber = -1;
136
+ static const int kFunctionEntryId = 2; // Using 0 could disguise errors.
137
+
138
+ AstNode() : id_(GetNextId()) {
139
+ Isolate* isolate = Isolate::Current();
140
+ isolate->set_ast_node_count(isolate->ast_node_count() + 1);
141
+ }
142
+
143
+ virtual ~AstNode() { }
144
+
145
+ virtual void Accept(AstVisitor* v) = 0;
146
+ virtual Type node_type() const { return kInvalid; }
147
+
148
+ // Type testing & conversion functions overridden by concrete subclasses.
149
+ #define DECLARE_NODE_FUNCTIONS(type) \
150
+ virtual type* As##type() { return NULL; }
151
+ AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
152
+ #undef DECLARE_NODE_FUNCTIONS
153
+
154
+ virtual Statement* AsStatement() { return NULL; }
155
+ virtual Expression* AsExpression() { return NULL; }
156
+ virtual TargetCollector* AsTargetCollector() { return NULL; }
157
+ virtual BreakableStatement* AsBreakableStatement() { return NULL; }
158
+ virtual IterationStatement* AsIterationStatement() { return NULL; }
159
+ virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
160
+ virtual Slot* AsSlot() { return NULL; }
161
+
162
+ // True if the node is simple enough for us to inline calls containing it.
163
+ virtual bool IsInlineable() const = 0;
164
+
165
+ static int Count() { return Isolate::Current()->ast_node_count(); }
166
+ static void ResetIds() { Isolate::Current()->set_ast_node_id(0); }
167
+ unsigned id() const { return id_; }
168
+
169
+ protected:
170
+ static unsigned GetNextId() {
171
+ Isolate* isolate = Isolate::Current();
172
+ unsigned tmp = isolate->ast_node_id();
173
+ isolate->set_ast_node_id(tmp + 1);
174
+ return tmp;
175
+ }
176
+ static unsigned ReserveIdRange(int n) {
177
+ Isolate* isolate = Isolate::Current();
178
+ unsigned tmp = isolate->ast_node_id();
179
+ isolate->set_ast_node_id(tmp + n);
180
+ return tmp;
181
+ }
182
+
183
+ private:
184
+ unsigned id_;
185
+
186
+ friend class CaseClause; // Generates AST IDs.
187
+ };
188
+
189
+
190
+ class Statement: public AstNode {
191
+ public:
192
+ Statement() : statement_pos_(RelocInfo::kNoPosition) {}
193
+
194
+ virtual Statement* AsStatement() { return this; }
195
+
196
+ virtual Assignment* StatementAsSimpleAssignment() { return NULL; }
197
+ virtual CountOperation* StatementAsCountOperation() { return NULL; }
198
+
199
+ bool IsEmpty() { return AsEmptyStatement() != NULL; }
200
+
201
+ void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; }
202
+ int statement_pos() const { return statement_pos_; }
203
+
204
+ private:
205
+ int statement_pos_;
206
+ };
207
+
208
+
209
+ class Expression: public AstNode {
210
+ public:
211
+ enum Context {
212
+ // Not assigned a context yet, or else will not be visited during
213
+ // code generation.
214
+ kUninitialized,
215
+ // Evaluated for its side effects.
216
+ kEffect,
217
+ // Evaluated for its value (and side effects).
218
+ kValue,
219
+ // Evaluated for control flow (and side effects).
220
+ kTest
221
+ };
222
+
223
+ Expression() {}
224
+
225
+ virtual int position() const {
226
+ UNREACHABLE();
227
+ return 0;
228
+ }
229
+
230
+ virtual Expression* AsExpression() { return this; }
231
+
232
+ virtual bool IsTrivial() { return false; }
233
+ virtual bool IsValidLeftHandSide() { return false; }
234
+
235
+ // Helpers for ToBoolean conversion.
236
+ virtual bool ToBooleanIsTrue() { return false; }
237
+ virtual bool ToBooleanIsFalse() { return false; }
238
+
239
+ // Symbols that cannot be parsed as array indices are considered property
240
+ // names. We do not treat symbols that can be array indexes as property
241
+ // names because [] for string objects is handled only by keyed ICs.
242
+ virtual bool IsPropertyName() { return false; }
243
+
244
+ // Mark the expression as being compiled as an expression
245
+ // statement. This is used to transform postfix increments to
246
+ // (faster) prefix increments.
247
+ virtual void MarkAsStatement() { /* do nothing */ }
248
+
249
+ // True iff the result can be safely overwritten (to avoid allocation).
250
+ // False for operations that can return one of their operands.
251
+ virtual bool ResultOverwriteAllowed() { return false; }
252
+
253
+ // True iff the expression is a literal represented as a smi.
254
+ virtual bool IsSmiLiteral() { return false; }
255
+
256
+ // Type feedback information for assignments and properties.
257
+ virtual bool IsMonomorphic() {
258
+ UNREACHABLE();
259
+ return false;
260
+ }
261
+ virtual bool IsArrayLength() {
262
+ UNREACHABLE();
263
+ return false;
264
+ }
265
+ virtual ZoneMapList* GetReceiverTypes() {
266
+ UNREACHABLE();
267
+ return NULL;
268
+ }
269
+ virtual Handle<Map> GetMonomorphicReceiverType() {
270
+ UNREACHABLE();
271
+ return Handle<Map>();
272
+ }
273
+
274
+ ExternalArrayType external_array_type() const {
275
+ return external_array_type_;
276
+ }
277
+ void set_external_array_type(ExternalArrayType array_type) {
278
+ external_array_type_ = array_type;
279
+ }
280
+
281
+ private:
282
+ ExternalArrayType external_array_type_;
283
+ };
284
+
285
+
286
+ /**
287
+ * A sentinel used during pre parsing that represents some expression
288
+ * that is a valid left hand side without having to actually build
289
+ * the expression.
290
+ */
291
+ class ValidLeftHandSideSentinel: public Expression {
292
+ public:
293
+ virtual bool IsValidLeftHandSide() { return true; }
294
+ virtual void Accept(AstVisitor* v) { UNREACHABLE(); }
295
+ virtual bool IsInlineable() const;
296
+ };
297
+
298
+
299
+ class BreakableStatement: public Statement {
300
+ public:
301
+ enum Type {
302
+ TARGET_FOR_ANONYMOUS,
303
+ TARGET_FOR_NAMED_ONLY
304
+ };
305
+
306
+ // The labels associated with this statement. May be NULL;
307
+ // if it is != NULL, guaranteed to contain at least one entry.
308
+ ZoneStringList* labels() const { return labels_; }
309
+
310
+ // Type testing & conversion.
311
+ virtual BreakableStatement* AsBreakableStatement() { return this; }
312
+
313
+ // Code generation
314
+ Label* break_target() { return &break_target_; }
315
+
316
+ // Testers.
317
+ bool is_target_for_anonymous() const { return type_ == TARGET_FOR_ANONYMOUS; }
318
+
319
+ // Bailout support.
320
+ int EntryId() const { return entry_id_; }
321
+ int ExitId() const { return exit_id_; }
322
+
323
+ protected:
324
+ inline BreakableStatement(ZoneStringList* labels, Type type);
325
+
326
+ private:
327
+ ZoneStringList* labels_;
328
+ Type type_;
329
+ Label break_target_;
330
+ int entry_id_;
331
+ int exit_id_;
332
+ };
333
+
334
+
335
+ class Block: public BreakableStatement {
336
+ public:
337
+ inline Block(ZoneStringList* labels, int capacity, bool is_initializer_block);
338
+
339
+ DECLARE_NODE_TYPE(Block)
340
+
341
+ virtual Assignment* StatementAsSimpleAssignment() {
342
+ if (statements_.length() != 1) return NULL;
343
+ return statements_[0]->StatementAsSimpleAssignment();
344
+ }
345
+
346
+ virtual CountOperation* StatementAsCountOperation() {
347
+ if (statements_.length() != 1) return NULL;
348
+ return statements_[0]->StatementAsCountOperation();
349
+ }
350
+
351
+ virtual bool IsInlineable() const;
352
+
353
+ void AddStatement(Statement* statement) { statements_.Add(statement); }
354
+
355
+ ZoneList<Statement*>* statements() { return &statements_; }
356
+ bool is_initializer_block() const { return is_initializer_block_; }
357
+
358
+ private:
359
+ ZoneList<Statement*> statements_;
360
+ bool is_initializer_block_;
361
+ };
362
+
363
+
364
+ class Declaration: public AstNode {
365
+ public:
366
+ Declaration(VariableProxy* proxy, Variable::Mode mode, FunctionLiteral* fun)
367
+ : proxy_(proxy),
368
+ mode_(mode),
369
+ fun_(fun) {
370
+ ASSERT(mode == Variable::VAR || mode == Variable::CONST);
371
+ // At the moment there are no "const functions"'s in JavaScript...
372
+ ASSERT(fun == NULL || mode == Variable::VAR);
373
+ }
374
+
375
+ DECLARE_NODE_TYPE(Declaration)
376
+
377
+ VariableProxy* proxy() const { return proxy_; }
378
+ Variable::Mode mode() const { return mode_; }
379
+ FunctionLiteral* fun() const { return fun_; } // may be NULL
380
+ virtual bool IsInlineable() const;
381
+
382
+ private:
383
+ VariableProxy* proxy_;
384
+ Variable::Mode mode_;
385
+ FunctionLiteral* fun_;
386
+ };
387
+
388
+
389
+ class IterationStatement: public BreakableStatement {
390
+ public:
391
+ // Type testing & conversion.
392
+ virtual IterationStatement* AsIterationStatement() { return this; }
393
+
394
+ Statement* body() const { return body_; }
395
+
396
+ // Bailout support.
397
+ int OsrEntryId() const { return osr_entry_id_; }
398
+ virtual int ContinueId() const = 0;
399
+
400
+ // Code generation
401
+ Label* continue_target() { return &continue_target_; }
402
+
403
+ protected:
404
+ explicit inline IterationStatement(ZoneStringList* labels);
405
+
406
+ void Initialize(Statement* body) {
407
+ body_ = body;
408
+ }
409
+
410
+ private:
411
+ Statement* body_;
412
+ Label continue_target_;
413
+ int osr_entry_id_;
414
+ };
415
+
416
+
417
+ class DoWhileStatement: public IterationStatement {
418
+ public:
419
+ explicit inline DoWhileStatement(ZoneStringList* labels);
420
+
421
+ DECLARE_NODE_TYPE(DoWhileStatement)
422
+
423
+ void Initialize(Expression* cond, Statement* body) {
424
+ IterationStatement::Initialize(body);
425
+ cond_ = cond;
426
+ }
427
+
428
+ Expression* cond() const { return cond_; }
429
+
430
+ // Position where condition expression starts. We need it to make
431
+ // the loop's condition a breakable location.
432
+ int condition_position() { return condition_position_; }
433
+ void set_condition_position(int pos) { condition_position_ = pos; }
434
+
435
+ // Bailout support.
436
+ virtual int ContinueId() const { return continue_id_; }
437
+ int BackEdgeId() const { return back_edge_id_; }
438
+
439
+ virtual bool IsInlineable() const;
440
+
441
+ private:
442
+ Expression* cond_;
443
+ int condition_position_;
444
+ int continue_id_;
445
+ int back_edge_id_;
446
+ };
447
+
448
+
449
+ class WhileStatement: public IterationStatement {
450
+ public:
451
+ explicit inline WhileStatement(ZoneStringList* labels);
452
+
453
+ DECLARE_NODE_TYPE(WhileStatement)
454
+
455
+ void Initialize(Expression* cond, Statement* body) {
456
+ IterationStatement::Initialize(body);
457
+ cond_ = cond;
458
+ }
459
+
460
+ Expression* cond() const { return cond_; }
461
+ bool may_have_function_literal() const {
462
+ return may_have_function_literal_;
463
+ }
464
+ void set_may_have_function_literal(bool value) {
465
+ may_have_function_literal_ = value;
466
+ }
467
+ virtual bool IsInlineable() const;
468
+
469
+ // Bailout support.
470
+ virtual int ContinueId() const { return EntryId(); }
471
+ int BodyId() const { return body_id_; }
472
+
473
+ private:
474
+ Expression* cond_;
475
+ // True if there is a function literal subexpression in the condition.
476
+ bool may_have_function_literal_;
477
+ int body_id_;
478
+ };
479
+
480
+
481
+ class ForStatement: public IterationStatement {
482
+ public:
483
+ explicit inline ForStatement(ZoneStringList* labels);
484
+
485
+ DECLARE_NODE_TYPE(ForStatement)
486
+
487
+ void Initialize(Statement* init,
488
+ Expression* cond,
489
+ Statement* next,
490
+ Statement* body) {
491
+ IterationStatement::Initialize(body);
492
+ init_ = init;
493
+ cond_ = cond;
494
+ next_ = next;
495
+ }
496
+
497
+ Statement* init() const { return init_; }
498
+ Expression* cond() const { return cond_; }
499
+ Statement* next() const { return next_; }
500
+
501
+ bool may_have_function_literal() const {
502
+ return may_have_function_literal_;
503
+ }
504
+ void set_may_have_function_literal(bool value) {
505
+ may_have_function_literal_ = value;
506
+ }
507
+
508
+ // Bailout support.
509
+ virtual int ContinueId() const { return continue_id_; }
510
+ int BodyId() const { return body_id_; }
511
+
512
+ bool is_fast_smi_loop() { return loop_variable_ != NULL; }
513
+ Variable* loop_variable() { return loop_variable_; }
514
+ void set_loop_variable(Variable* var) { loop_variable_ = var; }
515
+ virtual bool IsInlineable() const;
516
+
517
+ private:
518
+ Statement* init_;
519
+ Expression* cond_;
520
+ Statement* next_;
521
+ // True if there is a function literal subexpression in the condition.
522
+ bool may_have_function_literal_;
523
+ Variable* loop_variable_;
524
+ int continue_id_;
525
+ int body_id_;
526
+ };
527
+
528
+
529
+ class ForInStatement: public IterationStatement {
530
+ public:
531
+ explicit inline ForInStatement(ZoneStringList* labels);
532
+
533
+ DECLARE_NODE_TYPE(ForInStatement)
534
+
535
+ void Initialize(Expression* each, Expression* enumerable, Statement* body) {
536
+ IterationStatement::Initialize(body);
537
+ each_ = each;
538
+ enumerable_ = enumerable;
539
+ }
540
+
541
+ Expression* each() const { return each_; }
542
+ Expression* enumerable() const { return enumerable_; }
543
+ virtual bool IsInlineable() const;
544
+
545
+ // Bailout support.
546
+ int AssignmentId() const { return assignment_id_; }
547
+ virtual int ContinueId() const { return EntryId(); }
548
+
549
+ private:
550
+ Expression* each_;
551
+ Expression* enumerable_;
552
+ int assignment_id_;
553
+ };
554
+
555
+
556
+ class ExpressionStatement: public Statement {
557
+ public:
558
+ explicit ExpressionStatement(Expression* expression)
559
+ : expression_(expression) { }
560
+
561
+ DECLARE_NODE_TYPE(ExpressionStatement)
562
+
563
+ virtual bool IsInlineable() const;
564
+
565
+ virtual Assignment* StatementAsSimpleAssignment();
566
+ virtual CountOperation* StatementAsCountOperation();
567
+
568
+ void set_expression(Expression* e) { expression_ = e; }
569
+ Expression* expression() const { return expression_; }
570
+
571
+ private:
572
+ Expression* expression_;
573
+ };
574
+
575
+
576
+ class ContinueStatement: public Statement {
577
+ public:
578
+ explicit ContinueStatement(IterationStatement* target)
579
+ : target_(target) { }
580
+
581
+ DECLARE_NODE_TYPE(ContinueStatement)
582
+
583
+ IterationStatement* target() const { return target_; }
584
+ virtual bool IsInlineable() const;
585
+
586
+ private:
587
+ IterationStatement* target_;
588
+ };
589
+
590
+
591
+ class BreakStatement: public Statement {
592
+ public:
593
+ explicit BreakStatement(BreakableStatement* target)
594
+ : target_(target) { }
595
+
596
+ DECLARE_NODE_TYPE(BreakStatement)
597
+
598
+ BreakableStatement* target() const { return target_; }
599
+ virtual bool IsInlineable() const;
600
+
601
+ private:
602
+ BreakableStatement* target_;
603
+ };
604
+
605
+
606
+ class ReturnStatement: public Statement {
607
+ public:
608
+ explicit ReturnStatement(Expression* expression)
609
+ : expression_(expression) { }
610
+
611
+ DECLARE_NODE_TYPE(ReturnStatement)
612
+
613
+ Expression* expression() const { return expression_; }
614
+ virtual bool IsInlineable() const;
615
+
616
+ private:
617
+ Expression* expression_;
618
+ };
619
+
620
+
621
+ class WithEnterStatement: public Statement {
622
+ public:
623
+ explicit WithEnterStatement(Expression* expression, bool is_catch_block)
624
+ : expression_(expression), is_catch_block_(is_catch_block) { }
625
+
626
+ DECLARE_NODE_TYPE(WithEnterStatement)
627
+
628
+ Expression* expression() const { return expression_; }
629
+
630
+ bool is_catch_block() const { return is_catch_block_; }
631
+ virtual bool IsInlineable() const;
632
+
633
+ private:
634
+ Expression* expression_;
635
+ bool is_catch_block_;
636
+ };
637
+
638
+
639
+ class WithExitStatement: public Statement {
640
+ public:
641
+ WithExitStatement() { }
642
+
643
+ virtual bool IsInlineable() const;
644
+
645
+ DECLARE_NODE_TYPE(WithExitStatement)
646
+ };
647
+
648
+
649
+ class CaseClause: public ZoneObject {
650
+ public:
651
+ CaseClause(Expression* label, ZoneList<Statement*>* statements, int pos);
652
+
653
+ bool is_default() const { return label_ == NULL; }
654
+ Expression* label() const {
655
+ CHECK(!is_default());
656
+ return label_;
657
+ }
658
+ Label* body_target() { return &body_target_; }
659
+ ZoneList<Statement*>* statements() const { return statements_; }
660
+
661
+ int position() const { return position_; }
662
+ void set_position(int pos) { position_ = pos; }
663
+
664
+ int EntryId() { return entry_id_; }
665
+ int CompareId() { return compare_id_; }
666
+
667
+ // Type feedback information.
668
+ void RecordTypeFeedback(TypeFeedbackOracle* oracle);
669
+ bool IsSmiCompare() { return compare_type_ == SMI_ONLY; }
670
+ bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; }
671
+
672
+ private:
673
+ Expression* label_;
674
+ Label body_target_;
675
+ ZoneList<Statement*>* statements_;
676
+ int position_;
677
+ enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY };
678
+ CompareTypeFeedback compare_type_;
679
+ int compare_id_;
680
+ int entry_id_;
681
+ };
682
+
683
+
684
+ class SwitchStatement: public BreakableStatement {
685
+ public:
686
+ explicit inline SwitchStatement(ZoneStringList* labels);
687
+
688
+ DECLARE_NODE_TYPE(SwitchStatement)
689
+
690
+ void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
691
+ tag_ = tag;
692
+ cases_ = cases;
693
+ }
694
+
695
+ Expression* tag() const { return tag_; }
696
+ ZoneList<CaseClause*>* cases() const { return cases_; }
697
+ virtual bool IsInlineable() const;
698
+
699
+ private:
700
+ Expression* tag_;
701
+ ZoneList<CaseClause*>* cases_;
702
+ };
703
+
704
+
705
+ // If-statements always have non-null references to their then- and
706
+ // else-parts. When parsing if-statements with no explicit else-part,
707
+ // the parser implicitly creates an empty statement. Use the
708
+ // HasThenStatement() and HasElseStatement() functions to check if a
709
+ // given if-statement has a then- or an else-part containing code.
710
+ class IfStatement: public Statement {
711
+ public:
712
+ IfStatement(Expression* condition,
713
+ Statement* then_statement,
714
+ Statement* else_statement)
715
+ : condition_(condition),
716
+ then_statement_(then_statement),
717
+ else_statement_(else_statement),
718
+ then_id_(GetNextId()),
719
+ else_id_(GetNextId()) {
720
+ }
721
+
722
+ DECLARE_NODE_TYPE(IfStatement)
723
+
724
+ virtual bool IsInlineable() const;
725
+
726
+ bool HasThenStatement() const { return !then_statement()->IsEmpty(); }
727
+ bool HasElseStatement() const { return !else_statement()->IsEmpty(); }
728
+
729
+ Expression* condition() const { return condition_; }
730
+ Statement* then_statement() const { return then_statement_; }
731
+ Statement* else_statement() const { return else_statement_; }
732
+
733
+ int ThenId() const { return then_id_; }
734
+ int ElseId() const { return else_id_; }
735
+
736
+ private:
737
+ Expression* condition_;
738
+ Statement* then_statement_;
739
+ Statement* else_statement_;
740
+ int then_id_;
741
+ int else_id_;
742
+ };
743
+
744
+
745
+ // NOTE: TargetCollectors are represented as nodes to fit in the target
746
+ // stack in the compiler; this should probably be reworked.
747
+ class TargetCollector: public AstNode {
748
+ public:
749
+ explicit TargetCollector(ZoneList<Label*>* targets)
750
+ : targets_(targets) {
751
+ }
752
+
753
+ // Adds a jump target to the collector. The collector stores a pointer not
754
+ // a copy of the target to make binding work, so make sure not to pass in
755
+ // references to something on the stack.
756
+ void AddTarget(Label* target);
757
+
758
+ // Virtual behaviour. TargetCollectors are never part of the AST.
759
+ virtual void Accept(AstVisitor* v) { UNREACHABLE(); }
760
+ virtual TargetCollector* AsTargetCollector() { return this; }
761
+
762
+ ZoneList<Label*>* targets() { return targets_; }
763
+ virtual bool IsInlineable() const;
764
+
765
+ private:
766
+ ZoneList<Label*>* targets_;
767
+ };
768
+
769
+
770
+ class TryStatement: public Statement {
771
+ public:
772
+ explicit TryStatement(Block* try_block)
773
+ : try_block_(try_block), escaping_targets_(NULL) { }
774
+
775
+ void set_escaping_targets(ZoneList<Label*>* targets) {
776
+ escaping_targets_ = targets;
777
+ }
778
+
779
+ Block* try_block() const { return try_block_; }
780
+ ZoneList<Label*>* escaping_targets() const { return escaping_targets_; }
781
+ virtual bool IsInlineable() const;
782
+
783
+ private:
784
+ Block* try_block_;
785
+ ZoneList<Label*>* escaping_targets_;
786
+ };
787
+
788
+
789
+ class TryCatchStatement: public TryStatement {
790
+ public:
791
+ TryCatchStatement(Block* try_block,
792
+ VariableProxy* catch_var,
793
+ Block* catch_block)
794
+ : TryStatement(try_block),
795
+ catch_var_(catch_var),
796
+ catch_block_(catch_block) {
797
+ }
798
+
799
+ DECLARE_NODE_TYPE(TryCatchStatement)
800
+
801
+ VariableProxy* catch_var() const { return catch_var_; }
802
+ Block* catch_block() const { return catch_block_; }
803
+ virtual bool IsInlineable() const;
804
+
805
+ private:
806
+ VariableProxy* catch_var_;
807
+ Block* catch_block_;
808
+ };
809
+
810
+
811
+ class TryFinallyStatement: public TryStatement {
812
+ public:
813
+ TryFinallyStatement(Block* try_block, Block* finally_block)
814
+ : TryStatement(try_block),
815
+ finally_block_(finally_block) { }
816
+
817
+ DECLARE_NODE_TYPE(TryFinallyStatement)
818
+
819
+ Block* finally_block() const { return finally_block_; }
820
+ virtual bool IsInlineable() const;
821
+
822
+ private:
823
+ Block* finally_block_;
824
+ };
825
+
826
+
827
+ class DebuggerStatement: public Statement {
828
+ public:
829
+ DECLARE_NODE_TYPE(DebuggerStatement)
830
+ virtual bool IsInlineable() const;
831
+ };
832
+
833
+
834
+ class EmptyStatement: public Statement {
835
+ public:
836
+ DECLARE_NODE_TYPE(EmptyStatement)
837
+
838
+ virtual bool IsInlineable() const;
839
+ };
840
+
841
+
842
+ class Literal: public Expression {
843
+ public:
844
+ explicit Literal(Handle<Object> handle) : handle_(handle) { }
845
+
846
+ DECLARE_NODE_TYPE(Literal)
847
+
848
+ virtual bool IsTrivial() { return true; }
849
+ virtual bool IsSmiLiteral() { return handle_->IsSmi(); }
850
+
851
+ // Check if this literal is identical to the other literal.
852
+ bool IsIdenticalTo(const Literal* other) const {
853
+ return handle_.is_identical_to(other->handle_);
854
+ }
855
+
856
+ virtual bool IsPropertyName() {
857
+ if (handle_->IsSymbol()) {
858
+ uint32_t ignored;
859
+ return !String::cast(*handle_)->AsArrayIndex(&ignored);
860
+ }
861
+ return false;
862
+ }
863
+
864
+ Handle<String> AsPropertyName() {
865
+ ASSERT(IsPropertyName());
866
+ return Handle<String>::cast(handle_);
867
+ }
868
+
869
+ virtual bool ToBooleanIsTrue() { return handle_->ToBoolean()->IsTrue(); }
870
+ virtual bool ToBooleanIsFalse() { return handle_->ToBoolean()->IsFalse(); }
871
+
872
+ // Identity testers.
873
+ bool IsNull() const {
874
+ ASSERT(!handle_.is_null());
875
+ return handle_->IsNull();
876
+ }
877
+ bool IsTrue() const {
878
+ ASSERT(!handle_.is_null());
879
+ return handle_->IsTrue();
880
+ }
881
+ bool IsFalse() const {
882
+ ASSERT(!handle_.is_null());
883
+ return handle_->IsFalse();
884
+ }
885
+
886
+ Handle<Object> handle() const { return handle_; }
887
+ virtual bool IsInlineable() const;
888
+
889
+ private:
890
+ Handle<Object> handle_;
891
+ };
892
+
893
+
894
+ // Base class for literals that needs space in the corresponding JSFunction.
895
+ class MaterializedLiteral: public Expression {
896
+ public:
897
+ explicit MaterializedLiteral(int literal_index, bool is_simple, int depth)
898
+ : literal_index_(literal_index), is_simple_(is_simple), depth_(depth) {}
899
+
900
+ virtual MaterializedLiteral* AsMaterializedLiteral() { return this; }
901
+
902
+ int literal_index() { return literal_index_; }
903
+
904
+ // A materialized literal is simple if the values consist of only
905
+ // constants and simple object and array literals.
906
+ bool is_simple() const { return is_simple_; }
907
+
908
+ int depth() const { return depth_; }
909
+ virtual bool IsInlineable() const;
910
+
911
+ private:
912
+ int literal_index_;
913
+ bool is_simple_;
914
+ int depth_;
915
+ };
916
+
917
+
918
+ // An object literal has a boilerplate object that is used
919
+ // for minimizing the work when constructing it at runtime.
920
+ class ObjectLiteral: public MaterializedLiteral {
921
+ public:
922
+ // Property is used for passing information
923
+ // about an object literal's properties from the parser
924
+ // to the code generator.
925
+ class Property: public ZoneObject {
926
+ public:
927
+ enum Kind {
928
+ CONSTANT, // Property with constant value (compile time).
929
+ COMPUTED, // Property with computed value (execution time).
930
+ MATERIALIZED_LITERAL, // Property value is a materialized literal.
931
+ GETTER, SETTER, // Property is an accessor function.
932
+ PROTOTYPE // Property is __proto__.
933
+ };
934
+
935
+ Property(Literal* key, Expression* value);
936
+ Property(bool is_getter, FunctionLiteral* value);
937
+
938
+ Literal* key() { return key_; }
939
+ Expression* value() { return value_; }
940
+ Kind kind() { return kind_; }
941
+
942
+ bool IsCompileTimeValue();
943
+
944
+ void set_emit_store(bool emit_store);
945
+ bool emit_store();
946
+
947
+ private:
948
+ Literal* key_;
949
+ Expression* value_;
950
+ Kind kind_;
951
+ bool emit_store_;
952
+ };
953
+
954
+ ObjectLiteral(Handle<FixedArray> constant_properties,
955
+ ZoneList<Property*>* properties,
956
+ int literal_index,
957
+ bool is_simple,
958
+ bool fast_elements,
959
+ int depth,
960
+ bool has_function)
961
+ : MaterializedLiteral(literal_index, is_simple, depth),
962
+ constant_properties_(constant_properties),
963
+ properties_(properties),
964
+ fast_elements_(fast_elements),
965
+ has_function_(has_function) {}
966
+
967
+ DECLARE_NODE_TYPE(ObjectLiteral)
968
+
969
+ Handle<FixedArray> constant_properties() const {
970
+ return constant_properties_;
971
+ }
972
+ ZoneList<Property*>* properties() const { return properties_; }
973
+
974
+ bool fast_elements() const { return fast_elements_; }
975
+
976
+ bool has_function() { return has_function_; }
977
+
978
+ // Mark all computed expressions that are bound to a key that
979
+ // is shadowed by a later occurrence of the same key. For the
980
+ // marked expressions, no store code is emitted.
981
+ void CalculateEmitStore();
982
+
983
+ enum Flags {
984
+ kNoFlags = 0,
985
+ kFastElements = 1,
986
+ kHasFunction = 1 << 1
987
+ };
988
+
989
+ private:
990
+ Handle<FixedArray> constant_properties_;
991
+ ZoneList<Property*>* properties_;
992
+ bool fast_elements_;
993
+ bool has_function_;
994
+ };
995
+
996
+
997
+ // Node for capturing a regexp literal.
998
+ class RegExpLiteral: public MaterializedLiteral {
999
+ public:
1000
+ RegExpLiteral(Handle<String> pattern,
1001
+ Handle<String> flags,
1002
+ int literal_index)
1003
+ : MaterializedLiteral(literal_index, false, 1),
1004
+ pattern_(pattern),
1005
+ flags_(flags) {}
1006
+
1007
+ DECLARE_NODE_TYPE(RegExpLiteral)
1008
+
1009
+ Handle<String> pattern() const { return pattern_; }
1010
+ Handle<String> flags() const { return flags_; }
1011
+
1012
+ private:
1013
+ Handle<String> pattern_;
1014
+ Handle<String> flags_;
1015
+ };
1016
+
1017
+ // An array literal has a literals object that is used
1018
+ // for minimizing the work when constructing it at runtime.
1019
+ class ArrayLiteral: public MaterializedLiteral {
1020
+ public:
1021
+ ArrayLiteral(Handle<FixedArray> constant_elements,
1022
+ ZoneList<Expression*>* values,
1023
+ int literal_index,
1024
+ bool is_simple,
1025
+ int depth)
1026
+ : MaterializedLiteral(literal_index, is_simple, depth),
1027
+ constant_elements_(constant_elements),
1028
+ values_(values),
1029
+ first_element_id_(ReserveIdRange(values->length())) {}
1030
+
1031
+ DECLARE_NODE_TYPE(ArrayLiteral)
1032
+
1033
+ Handle<FixedArray> constant_elements() const { return constant_elements_; }
1034
+ ZoneList<Expression*>* values() const { return values_; }
1035
+
1036
+ // Return an AST id for an element that is used in simulate instructions.
1037
+ int GetIdForElement(int i) { return first_element_id_ + i; }
1038
+
1039
+ private:
1040
+ Handle<FixedArray> constant_elements_;
1041
+ ZoneList<Expression*>* values_;
1042
+ int first_element_id_;
1043
+ };
1044
+
1045
+
1046
+ // Node for constructing a context extension object for a catch block.
1047
+ // The catch context extension object has one property, the catch
1048
+ // variable, which should be DontDelete.
1049
+ class CatchExtensionObject: public Expression {
1050
+ public:
1051
+ CatchExtensionObject(Literal* key, VariableProxy* value)
1052
+ : key_(key), value_(value) {
1053
+ }
1054
+
1055
+ DECLARE_NODE_TYPE(CatchExtensionObject)
1056
+
1057
+ Literal* key() const { return key_; }
1058
+ VariableProxy* value() const { return value_; }
1059
+ virtual bool IsInlineable() const;
1060
+
1061
+ private:
1062
+ Literal* key_;
1063
+ VariableProxy* value_;
1064
+ };
1065
+
1066
+
1067
+ class VariableProxy: public Expression {
1068
+ public:
1069
+ explicit VariableProxy(Variable* var);
1070
+
1071
+ DECLARE_NODE_TYPE(VariableProxy)
1072
+
1073
+ // Type testing & conversion
1074
+ virtual Property* AsProperty() {
1075
+ return var_ == NULL ? NULL : var_->AsProperty();
1076
+ }
1077
+
1078
+ Variable* AsVariable() {
1079
+ if (this == NULL || var_ == NULL) return NULL;
1080
+ Expression* rewrite = var_->rewrite();
1081
+ if (rewrite == NULL || rewrite->AsSlot() != NULL) return var_;
1082
+ return NULL;
1083
+ }
1084
+
1085
+ virtual bool IsValidLeftHandSide() {
1086
+ return var_ == NULL ? true : var_->IsValidLeftHandSide();
1087
+ }
1088
+
1089
+ virtual bool IsTrivial() {
1090
+ // Reading from a mutable variable is a side effect, but the
1091
+ // variable for 'this' is immutable.
1092
+ return is_this_ || is_trivial_;
1093
+ }
1094
+
1095
+ virtual bool IsInlineable() const;
1096
+
1097
+ bool IsVariable(Handle<String> n) {
1098
+ return !is_this() && name().is_identical_to(n);
1099
+ }
1100
+
1101
+ bool IsArguments() {
1102
+ Variable* variable = AsVariable();
1103
+ return (variable == NULL) ? false : variable->is_arguments();
1104
+ }
1105
+
1106
+ Handle<String> name() const { return name_; }
1107
+ Variable* var() const { return var_; }
1108
+ bool is_this() const { return is_this_; }
1109
+ bool inside_with() const { return inside_with_; }
1110
+ int position() const { return position_; }
1111
+
1112
+ void MarkAsTrivial() { is_trivial_ = true; }
1113
+
1114
+ // Bind this proxy to the variable var.
1115
+ void BindTo(Variable* var);
1116
+
1117
+ protected:
1118
+ Handle<String> name_;
1119
+ Variable* var_; // resolved variable, or NULL
1120
+ bool is_this_;
1121
+ bool inside_with_;
1122
+ bool is_trivial_;
1123
+ int position_;
1124
+
1125
+ VariableProxy(Handle<String> name,
1126
+ bool is_this,
1127
+ bool inside_with,
1128
+ int position = RelocInfo::kNoPosition);
1129
+ explicit VariableProxy(bool is_this);
1130
+
1131
+ friend class Scope;
1132
+ };
1133
+
1134
+
1135
+ class VariableProxySentinel: public VariableProxy {
1136
+ public:
1137
+ virtual bool IsValidLeftHandSide() { return !is_this(); }
1138
+
1139
+ private:
1140
+ explicit VariableProxySentinel(bool is_this) : VariableProxy(is_this) { }
1141
+
1142
+ friend class AstSentinels;
1143
+ };
1144
+
1145
+
1146
+ class Slot: public Expression {
1147
+ public:
1148
+ enum Type {
1149
+ // A slot in the parameter section on the stack. index() is
1150
+ // the parameter index, counting left-to-right, starting at 0.
1151
+ PARAMETER,
1152
+
1153
+ // A slot in the local section on the stack. index() is
1154
+ // the variable index in the stack frame, starting at 0.
1155
+ LOCAL,
1156
+
1157
+ // An indexed slot in a heap context. index() is the
1158
+ // variable index in the context object on the heap,
1159
+ // starting at 0. var()->scope() is the corresponding
1160
+ // scope.
1161
+ CONTEXT,
1162
+
1163
+ // A named slot in a heap context. var()->name() is the
1164
+ // variable name in the context object on the heap,
1165
+ // with lookup starting at the current context. index()
1166
+ // is invalid.
1167
+ LOOKUP
1168
+ };
1169
+
1170
+ Slot(Variable* var, Type type, int index)
1171
+ : var_(var), type_(type), index_(index) {
1172
+ ASSERT(var != NULL);
1173
+ }
1174
+
1175
+ virtual void Accept(AstVisitor* v);
1176
+
1177
+ virtual Slot* AsSlot() { return this; }
1178
+
1179
+ bool IsStackAllocated() { return type_ == PARAMETER || type_ == LOCAL; }
1180
+
1181
+ // Accessors
1182
+ Variable* var() const { return var_; }
1183
+ Type type() const { return type_; }
1184
+ int index() const { return index_; }
1185
+ bool is_arguments() const { return var_->is_arguments(); }
1186
+ virtual bool IsInlineable() const;
1187
+
1188
+ private:
1189
+ Variable* var_;
1190
+ Type type_;
1191
+ int index_;
1192
+ };
1193
+
1194
+
1195
+ class Property: public Expression {
1196
+ public:
1197
+ // Synthetic properties are property lookups introduced by the system,
1198
+ // to objects that aren't visible to the user. Function calls to synthetic
1199
+ // properties should use the global object as receiver, not the base object
1200
+ // of the resolved Reference.
1201
+ enum Type { NORMAL, SYNTHETIC };
1202
+ Property(Expression* obj, Expression* key, int pos, Type type = NORMAL)
1203
+ : obj_(obj),
1204
+ key_(key),
1205
+ pos_(pos),
1206
+ type_(type),
1207
+ receiver_types_(NULL),
1208
+ is_monomorphic_(false),
1209
+ is_array_length_(false),
1210
+ is_string_length_(false),
1211
+ is_string_access_(false),
1212
+ is_function_prototype_(false),
1213
+ is_arguments_access_(false) { }
1214
+
1215
+ DECLARE_NODE_TYPE(Property)
1216
+
1217
+ virtual bool IsValidLeftHandSide() { return true; }
1218
+ virtual bool IsInlineable() const;
1219
+
1220
+ Expression* obj() const { return obj_; }
1221
+ Expression* key() const { return key_; }
1222
+ virtual int position() const { return pos_; }
1223
+ bool is_synthetic() const { return type_ == SYNTHETIC; }
1224
+
1225
+ bool IsStringLength() const { return is_string_length_; }
1226
+ bool IsStringAccess() const { return is_string_access_; }
1227
+ bool IsFunctionPrototype() const { return is_function_prototype_; }
1228
+
1229
+ // Marks that this is actually an argument rewritten to a keyed property
1230
+ // accessing the argument through the arguments shadow object.
1231
+ void set_is_arguments_access(bool is_arguments_access) {
1232
+ is_arguments_access_ = is_arguments_access;
1233
+ }
1234
+ bool is_arguments_access() const { return is_arguments_access_; }
1235
+
1236
+ // Type feedback information.
1237
+ void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1238
+ virtual bool IsMonomorphic() { return is_monomorphic_; }
1239
+ virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; }
1240
+ virtual bool IsArrayLength() { return is_array_length_; }
1241
+ virtual Handle<Map> GetMonomorphicReceiverType() {
1242
+ return monomorphic_receiver_type_;
1243
+ }
1244
+
1245
+ private:
1246
+ Expression* obj_;
1247
+ Expression* key_;
1248
+ int pos_;
1249
+ Type type_;
1250
+
1251
+ ZoneMapList* receiver_types_;
1252
+ bool is_monomorphic_ : 1;
1253
+ bool is_array_length_ : 1;
1254
+ bool is_string_length_ : 1;
1255
+ bool is_string_access_ : 1;
1256
+ bool is_function_prototype_ : 1;
1257
+ bool is_arguments_access_ : 1;
1258
+ Handle<Map> monomorphic_receiver_type_;
1259
+ };
1260
+
1261
+
1262
+ class Call: public Expression {
1263
+ public:
1264
+ Call(Expression* expression, ZoneList<Expression*>* arguments, int pos)
1265
+ : expression_(expression),
1266
+ arguments_(arguments),
1267
+ pos_(pos),
1268
+ is_monomorphic_(false),
1269
+ check_type_(RECEIVER_MAP_CHECK),
1270
+ receiver_types_(NULL),
1271
+ return_id_(GetNextId()) {
1272
+ }
1273
+
1274
+ DECLARE_NODE_TYPE(Call)
1275
+
1276
+ virtual bool IsInlineable() const;
1277
+
1278
+ Expression* expression() const { return expression_; }
1279
+ ZoneList<Expression*>* arguments() const { return arguments_; }
1280
+ virtual int position() const { return pos_; }
1281
+
1282
+ void RecordTypeFeedback(TypeFeedbackOracle* oracle,
1283
+ CallKind call_kind);
1284
+ virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; }
1285
+ virtual bool IsMonomorphic() { return is_monomorphic_; }
1286
+ CheckType check_type() const { return check_type_; }
1287
+ Handle<JSFunction> target() { return target_; }
1288
+ Handle<JSObject> holder() { return holder_; }
1289
+ Handle<JSGlobalPropertyCell> cell() { return cell_; }
1290
+
1291
+ bool ComputeTarget(Handle<Map> type, Handle<String> name);
1292
+ bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup);
1293
+
1294
+ // Bailout support.
1295
+ int ReturnId() const { return return_id_; }
1296
+
1297
+ #ifdef DEBUG
1298
+ // Used to assert that the FullCodeGenerator records the return site.
1299
+ bool return_is_recorded_;
1300
+ #endif
1301
+
1302
+ private:
1303
+ Expression* expression_;
1304
+ ZoneList<Expression*>* arguments_;
1305
+ int pos_;
1306
+
1307
+ bool is_monomorphic_;
1308
+ CheckType check_type_;
1309
+ ZoneMapList* receiver_types_;
1310
+ Handle<JSFunction> target_;
1311
+ Handle<JSObject> holder_;
1312
+ Handle<JSGlobalPropertyCell> cell_;
1313
+
1314
+ int return_id_;
1315
+ };
1316
+
1317
+
1318
+ class AstSentinels {
1319
+ public:
1320
+ ~AstSentinels() { }
1321
+
1322
+ // Returns a property singleton property access on 'this'. Used
1323
+ // during preparsing.
1324
+ Property* this_property() { return &this_property_; }
1325
+ VariableProxySentinel* this_proxy() { return &this_proxy_; }
1326
+ VariableProxySentinel* identifier_proxy() { return &identifier_proxy_; }
1327
+ ValidLeftHandSideSentinel* valid_left_hand_side_sentinel() {
1328
+ return &valid_left_hand_side_sentinel_;
1329
+ }
1330
+ Call* call_sentinel() { return &call_sentinel_; }
1331
+ EmptyStatement* empty_statement() { return &empty_statement_; }
1332
+
1333
+ private:
1334
+ AstSentinels();
1335
+ VariableProxySentinel this_proxy_;
1336
+ VariableProxySentinel identifier_proxy_;
1337
+ ValidLeftHandSideSentinel valid_left_hand_side_sentinel_;
1338
+ Property this_property_;
1339
+ Call call_sentinel_;
1340
+ EmptyStatement empty_statement_;
1341
+
1342
+ friend class Isolate;
1343
+
1344
+ DISALLOW_COPY_AND_ASSIGN(AstSentinels);
1345
+ };
1346
+
1347
+
1348
+ class CallNew: public Expression {
1349
+ public:
1350
+ CallNew(Expression* expression, ZoneList<Expression*>* arguments, int pos)
1351
+ : expression_(expression), arguments_(arguments), pos_(pos) { }
1352
+
1353
+ DECLARE_NODE_TYPE(CallNew)
1354
+
1355
+ virtual bool IsInlineable() const;
1356
+
1357
+ Expression* expression() const { return expression_; }
1358
+ ZoneList<Expression*>* arguments() const { return arguments_; }
1359
+ virtual int position() const { return pos_; }
1360
+
1361
+ private:
1362
+ Expression* expression_;
1363
+ ZoneList<Expression*>* arguments_;
1364
+ int pos_;
1365
+ };
1366
+
1367
+
1368
+ // The CallRuntime class does not represent any official JavaScript
1369
+ // language construct. Instead it is used to call a C or JS function
1370
+ // with a set of arguments. This is used from the builtins that are
1371
+ // implemented in JavaScript (see "v8natives.js").
1372
+ class CallRuntime: public Expression {
1373
+ public:
1374
+ CallRuntime(Handle<String> name,
1375
+ const Runtime::Function* function,
1376
+ ZoneList<Expression*>* arguments)
1377
+ : name_(name), function_(function), arguments_(arguments) { }
1378
+
1379
+ DECLARE_NODE_TYPE(CallRuntime)
1380
+
1381
+ virtual bool IsInlineable() const;
1382
+
1383
+ Handle<String> name() const { return name_; }
1384
+ const Runtime::Function* function() const { return function_; }
1385
+ ZoneList<Expression*>* arguments() const { return arguments_; }
1386
+ bool is_jsruntime() const { return function_ == NULL; }
1387
+
1388
+ private:
1389
+ Handle<String> name_;
1390
+ const Runtime::Function* function_;
1391
+ ZoneList<Expression*>* arguments_;
1392
+ };
1393
+
1394
+
1395
+ class UnaryOperation: public Expression {
1396
+ public:
1397
+ UnaryOperation(Token::Value op, Expression* expression, int pos)
1398
+ : op_(op), expression_(expression), pos_(pos) {
1399
+ ASSERT(Token::IsUnaryOp(op));
1400
+ }
1401
+
1402
+ DECLARE_NODE_TYPE(UnaryOperation)
1403
+
1404
+ virtual bool IsInlineable() const;
1405
+
1406
+ virtual bool ResultOverwriteAllowed();
1407
+
1408
+ Token::Value op() const { return op_; }
1409
+ Expression* expression() const { return expression_; }
1410
+ virtual int position() const { return pos_; }
1411
+
1412
+ private:
1413
+ Token::Value op_;
1414
+ Expression* expression_;
1415
+ int pos_;
1416
+ };
1417
+
1418
+
1419
+ class BinaryOperation: public Expression {
1420
+ public:
1421
+ BinaryOperation(Token::Value op,
1422
+ Expression* left,
1423
+ Expression* right,
1424
+ int pos)
1425
+ : op_(op), left_(left), right_(right), pos_(pos) {
1426
+ ASSERT(Token::IsBinaryOp(op));
1427
+ right_id_ = (op == Token::AND || op == Token::OR)
1428
+ ? static_cast<int>(GetNextId())
1429
+ : AstNode::kNoNumber;
1430
+ }
1431
+
1432
+ DECLARE_NODE_TYPE(BinaryOperation)
1433
+
1434
+ virtual bool IsInlineable() const;
1435
+
1436
+ virtual bool ResultOverwriteAllowed();
1437
+
1438
+ Token::Value op() const { return op_; }
1439
+ Expression* left() const { return left_; }
1440
+ Expression* right() const { return right_; }
1441
+ virtual int position() const { return pos_; }
1442
+
1443
+ // Bailout support.
1444
+ int RightId() const { return right_id_; }
1445
+
1446
+ private:
1447
+ Token::Value op_;
1448
+ Expression* left_;
1449
+ Expression* right_;
1450
+ int pos_;
1451
+ // The short-circuit logical operations have an AST ID for their
1452
+ // right-hand subexpression.
1453
+ int right_id_;
1454
+ };
1455
+
1456
+
1457
+ class CountOperation: public Expression {
1458
+ public:
1459
+ CountOperation(Token::Value op, bool is_prefix, Expression* expr, int pos)
1460
+ : op_(op),
1461
+ is_prefix_(is_prefix),
1462
+ expression_(expr),
1463
+ pos_(pos),
1464
+ assignment_id_(GetNextId()),
1465
+ count_id_(GetNextId()) { }
1466
+
1467
+ DECLARE_NODE_TYPE(CountOperation)
1468
+
1469
+ bool is_prefix() const { return is_prefix_; }
1470
+ bool is_postfix() const { return !is_prefix_; }
1471
+
1472
+ Token::Value op() const { return op_; }
1473
+ Token::Value binary_op() {
1474
+ return (op() == Token::INC) ? Token::ADD : Token::SUB;
1475
+ }
1476
+
1477
+ Expression* expression() const { return expression_; }
1478
+ virtual int position() const { return pos_; }
1479
+
1480
+ virtual void MarkAsStatement() { is_prefix_ = true; }
1481
+
1482
+ virtual bool IsInlineable() const;
1483
+
1484
+ void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1485
+ virtual bool IsMonomorphic() { return is_monomorphic_; }
1486
+ virtual Handle<Map> GetMonomorphicReceiverType() {
1487
+ return monomorphic_receiver_type_;
1488
+ }
1489
+
1490
+ // Bailout support.
1491
+ int AssignmentId() const { return assignment_id_; }
1492
+ int CountId() const { return count_id_; }
1493
+
1494
+ private:
1495
+ Token::Value op_;
1496
+ bool is_prefix_;
1497
+ bool is_monomorphic_;
1498
+ Expression* expression_;
1499
+ int pos_;
1500
+ int assignment_id_;
1501
+ int count_id_;
1502
+ Handle<Map> monomorphic_receiver_type_;
1503
+ };
1504
+
1505
+
1506
+ class CompareOperation: public Expression {
1507
+ public:
1508
+ CompareOperation(Token::Value op,
1509
+ Expression* left,
1510
+ Expression* right,
1511
+ int pos)
1512
+ : op_(op), left_(left), right_(right), pos_(pos), compare_type_(NONE) {
1513
+ ASSERT(Token::IsCompareOp(op));
1514
+ }
1515
+
1516
+ DECLARE_NODE_TYPE(CompareOperation)
1517
+
1518
+ Token::Value op() const { return op_; }
1519
+ Expression* left() const { return left_; }
1520
+ Expression* right() const { return right_; }
1521
+ virtual int position() const { return pos_; }
1522
+
1523
+ virtual bool IsInlineable() const;
1524
+
1525
+ // Type feedback information.
1526
+ void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1527
+ bool IsSmiCompare() { return compare_type_ == SMI_ONLY; }
1528
+ bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; }
1529
+
1530
+ private:
1531
+ Token::Value op_;
1532
+ Expression* left_;
1533
+ Expression* right_;
1534
+ int pos_;
1535
+
1536
+ enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY };
1537
+ CompareTypeFeedback compare_type_;
1538
+ };
1539
+
1540
+
1541
+ class CompareToNull: public Expression {
1542
+ public:
1543
+ CompareToNull(bool is_strict, Expression* expression)
1544
+ : is_strict_(is_strict), expression_(expression) { }
1545
+
1546
+ DECLARE_NODE_TYPE(CompareToNull)
1547
+
1548
+ virtual bool IsInlineable() const;
1549
+
1550
+ bool is_strict() const { return is_strict_; }
1551
+ Token::Value op() const { return is_strict_ ? Token::EQ_STRICT : Token::EQ; }
1552
+ Expression* expression() const { return expression_; }
1553
+
1554
+ private:
1555
+ bool is_strict_;
1556
+ Expression* expression_;
1557
+ };
1558
+
1559
+
1560
+ class Conditional: public Expression {
1561
+ public:
1562
+ Conditional(Expression* condition,
1563
+ Expression* then_expression,
1564
+ Expression* else_expression,
1565
+ int then_expression_position,
1566
+ int else_expression_position)
1567
+ : condition_(condition),
1568
+ then_expression_(then_expression),
1569
+ else_expression_(else_expression),
1570
+ then_expression_position_(then_expression_position),
1571
+ else_expression_position_(else_expression_position),
1572
+ then_id_(GetNextId()),
1573
+ else_id_(GetNextId()) {
1574
+ }
1575
+
1576
+ DECLARE_NODE_TYPE(Conditional)
1577
+
1578
+ virtual bool IsInlineable() const;
1579
+
1580
+ Expression* condition() const { return condition_; }
1581
+ Expression* then_expression() const { return then_expression_; }
1582
+ Expression* else_expression() const { return else_expression_; }
1583
+
1584
+ int then_expression_position() const { return then_expression_position_; }
1585
+ int else_expression_position() const { return else_expression_position_; }
1586
+
1587
+ int ThenId() const { return then_id_; }
1588
+ int ElseId() const { return else_id_; }
1589
+
1590
+ private:
1591
+ Expression* condition_;
1592
+ Expression* then_expression_;
1593
+ Expression* else_expression_;
1594
+ int then_expression_position_;
1595
+ int else_expression_position_;
1596
+ int then_id_;
1597
+ int else_id_;
1598
+ };
1599
+
1600
+
1601
+ class Assignment: public Expression {
1602
+ public:
1603
+ Assignment(Token::Value op, Expression* target, Expression* value, int pos);
1604
+
1605
+ DECLARE_NODE_TYPE(Assignment)
1606
+
1607
+ virtual bool IsInlineable() const;
1608
+
1609
+ Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; }
1610
+
1611
+ Token::Value binary_op() const;
1612
+
1613
+ Token::Value op() const { return op_; }
1614
+ Expression* target() const { return target_; }
1615
+ Expression* value() const { return value_; }
1616
+ virtual int position() const { return pos_; }
1617
+ BinaryOperation* binary_operation() const { return binary_operation_; }
1618
+
1619
+ // This check relies on the definition order of token in token.h.
1620
+ bool is_compound() const { return op() > Token::ASSIGN; }
1621
+
1622
+ // An initialization block is a series of statments of the form
1623
+ // x.y.z.a = ...; x.y.z.b = ...; etc. The parser marks the beginning and
1624
+ // ending of these blocks to allow for optimizations of initialization
1625
+ // blocks.
1626
+ bool starts_initialization_block() { return block_start_; }
1627
+ bool ends_initialization_block() { return block_end_; }
1628
+ void mark_block_start() { block_start_ = true; }
1629
+ void mark_block_end() { block_end_ = true; }
1630
+
1631
+ // Type feedback information.
1632
+ void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1633
+ virtual bool IsMonomorphic() { return is_monomorphic_; }
1634
+ virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; }
1635
+ virtual Handle<Map> GetMonomorphicReceiverType() {
1636
+ return monomorphic_receiver_type_;
1637
+ }
1638
+
1639
+ // Bailout support.
1640
+ int CompoundLoadId() const { return compound_load_id_; }
1641
+ int AssignmentId() const { return assignment_id_; }
1642
+
1643
+ private:
1644
+ Token::Value op_;
1645
+ Expression* target_;
1646
+ Expression* value_;
1647
+ int pos_;
1648
+ BinaryOperation* binary_operation_;
1649
+ int compound_load_id_;
1650
+ int assignment_id_;
1651
+
1652
+ bool block_start_;
1653
+ bool block_end_;
1654
+
1655
+ bool is_monomorphic_;
1656
+ ZoneMapList* receiver_types_;
1657
+ Handle<Map> monomorphic_receiver_type_;
1658
+ };
1659
+
1660
+
1661
+ class Throw: public Expression {
1662
+ public:
1663
+ Throw(Expression* exception, int pos)
1664
+ : exception_(exception), pos_(pos) {}
1665
+
1666
+ DECLARE_NODE_TYPE(Throw)
1667
+
1668
+ Expression* exception() const { return exception_; }
1669
+ virtual int position() const { return pos_; }
1670
+ virtual bool IsInlineable() const;
1671
+
1672
+ private:
1673
+ Expression* exception_;
1674
+ int pos_;
1675
+ };
1676
+
1677
+
1678
+ class FunctionLiteral: public Expression {
1679
+ public:
1680
+ FunctionLiteral(Handle<String> name,
1681
+ Scope* scope,
1682
+ ZoneList<Statement*>* body,
1683
+ int materialized_literal_count,
1684
+ int expected_property_count,
1685
+ bool has_only_simple_this_property_assignments,
1686
+ Handle<FixedArray> this_property_assignments,
1687
+ int num_parameters,
1688
+ int start_position,
1689
+ int end_position,
1690
+ bool is_expression)
1691
+ : name_(name),
1692
+ scope_(scope),
1693
+ body_(body),
1694
+ materialized_literal_count_(materialized_literal_count),
1695
+ expected_property_count_(expected_property_count),
1696
+ has_only_simple_this_property_assignments_(
1697
+ has_only_simple_this_property_assignments),
1698
+ this_property_assignments_(this_property_assignments),
1699
+ num_parameters_(num_parameters),
1700
+ start_position_(start_position),
1701
+ end_position_(end_position),
1702
+ is_expression_(is_expression),
1703
+ function_token_position_(RelocInfo::kNoPosition),
1704
+ inferred_name_(HEAP->empty_string()),
1705
+ pretenure_(false) { }
1706
+
1707
+ DECLARE_NODE_TYPE(FunctionLiteral)
1708
+
1709
+ Handle<String> name() const { return name_; }
1710
+ Scope* scope() const { return scope_; }
1711
+ ZoneList<Statement*>* body() const { return body_; }
1712
+ void set_function_token_position(int pos) { function_token_position_ = pos; }
1713
+ int function_token_position() const { return function_token_position_; }
1714
+ int start_position() const { return start_position_; }
1715
+ int end_position() const { return end_position_; }
1716
+ bool is_expression() const { return is_expression_; }
1717
+ bool strict_mode() const;
1718
+
1719
+ int materialized_literal_count() { return materialized_literal_count_; }
1720
+ int expected_property_count() { return expected_property_count_; }
1721
+ bool has_only_simple_this_property_assignments() {
1722
+ return has_only_simple_this_property_assignments_;
1723
+ }
1724
+ Handle<FixedArray> this_property_assignments() {
1725
+ return this_property_assignments_;
1726
+ }
1727
+ int num_parameters() { return num_parameters_; }
1728
+
1729
+ bool AllowsLazyCompilation();
1730
+
1731
+ Handle<String> debug_name() const {
1732
+ if (name_->length() > 0) return name_;
1733
+ return inferred_name();
1734
+ }
1735
+
1736
+ Handle<String> inferred_name() const { return inferred_name_; }
1737
+ void set_inferred_name(Handle<String> inferred_name) {
1738
+ inferred_name_ = inferred_name;
1739
+ }
1740
+
1741
+ bool pretenure() { return pretenure_; }
1742
+ void set_pretenure(bool value) { pretenure_ = value; }
1743
+ virtual bool IsInlineable() const;
1744
+
1745
+ private:
1746
+ Handle<String> name_;
1747
+ Scope* scope_;
1748
+ ZoneList<Statement*>* body_;
1749
+ int materialized_literal_count_;
1750
+ int expected_property_count_;
1751
+ bool has_only_simple_this_property_assignments_;
1752
+ Handle<FixedArray> this_property_assignments_;
1753
+ int num_parameters_;
1754
+ int start_position_;
1755
+ int end_position_;
1756
+ bool is_expression_;
1757
+ int function_token_position_;
1758
+ Handle<String> inferred_name_;
1759
+ bool pretenure_;
1760
+ };
1761
+
1762
+
1763
+ class SharedFunctionInfoLiteral: public Expression {
1764
+ public:
1765
+ explicit SharedFunctionInfoLiteral(
1766
+ Handle<SharedFunctionInfo> shared_function_info)
1767
+ : shared_function_info_(shared_function_info) { }
1768
+
1769
+ DECLARE_NODE_TYPE(SharedFunctionInfoLiteral)
1770
+
1771
+ Handle<SharedFunctionInfo> shared_function_info() const {
1772
+ return shared_function_info_;
1773
+ }
1774
+ virtual bool IsInlineable() const;
1775
+
1776
+ private:
1777
+ Handle<SharedFunctionInfo> shared_function_info_;
1778
+ };
1779
+
1780
+
1781
+ class ThisFunction: public Expression {
1782
+ public:
1783
+ DECLARE_NODE_TYPE(ThisFunction)
1784
+ virtual bool IsInlineable() const;
1785
+ };
1786
+
1787
+
1788
+ // ----------------------------------------------------------------------------
1789
+ // Regular expressions
1790
+
1791
+
1792
+ class RegExpVisitor BASE_EMBEDDED {
1793
+ public:
1794
+ virtual ~RegExpVisitor() { }
1795
+ #define MAKE_CASE(Name) \
1796
+ virtual void* Visit##Name(RegExp##Name*, void* data) = 0;
1797
+ FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE)
1798
+ #undef MAKE_CASE
1799
+ };
1800
+
1801
+
1802
+ class RegExpTree: public ZoneObject {
1803
+ public:
1804
+ static const int kInfinity = kMaxInt;
1805
+ virtual ~RegExpTree() { }
1806
+ virtual void* Accept(RegExpVisitor* visitor, void* data) = 0;
1807
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1808
+ RegExpNode* on_success) = 0;
1809
+ virtual bool IsTextElement() { return false; }
1810
+ virtual bool IsAnchoredAtStart() { return false; }
1811
+ virtual bool IsAnchoredAtEnd() { return false; }
1812
+ virtual int min_match() = 0;
1813
+ virtual int max_match() = 0;
1814
+ // Returns the interval of registers used for captures within this
1815
+ // expression.
1816
+ virtual Interval CaptureRegisters() { return Interval::Empty(); }
1817
+ virtual void AppendToText(RegExpText* text);
1818
+ SmartPointer<const char> ToString();
1819
+ #define MAKE_ASTYPE(Name) \
1820
+ virtual RegExp##Name* As##Name(); \
1821
+ virtual bool Is##Name();
1822
+ FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE)
1823
+ #undef MAKE_ASTYPE
1824
+ };
1825
+
1826
+
1827
+ class RegExpDisjunction: public RegExpTree {
1828
+ public:
1829
+ explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives);
1830
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
1831
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1832
+ RegExpNode* on_success);
1833
+ virtual RegExpDisjunction* AsDisjunction();
1834
+ virtual Interval CaptureRegisters();
1835
+ virtual bool IsDisjunction();
1836
+ virtual bool IsAnchoredAtStart();
1837
+ virtual bool IsAnchoredAtEnd();
1838
+ virtual int min_match() { return min_match_; }
1839
+ virtual int max_match() { return max_match_; }
1840
+ ZoneList<RegExpTree*>* alternatives() { return alternatives_; }
1841
+ private:
1842
+ ZoneList<RegExpTree*>* alternatives_;
1843
+ int min_match_;
1844
+ int max_match_;
1845
+ };
1846
+
1847
+
1848
+ class RegExpAlternative: public RegExpTree {
1849
+ public:
1850
+ explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes);
1851
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
1852
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1853
+ RegExpNode* on_success);
1854
+ virtual RegExpAlternative* AsAlternative();
1855
+ virtual Interval CaptureRegisters();
1856
+ virtual bool IsAlternative();
1857
+ virtual bool IsAnchoredAtStart();
1858
+ virtual bool IsAnchoredAtEnd();
1859
+ virtual int min_match() { return min_match_; }
1860
+ virtual int max_match() { return max_match_; }
1861
+ ZoneList<RegExpTree*>* nodes() { return nodes_; }
1862
+ private:
1863
+ ZoneList<RegExpTree*>* nodes_;
1864
+ int min_match_;
1865
+ int max_match_;
1866
+ };
1867
+
1868
+
1869
+ class RegExpAssertion: public RegExpTree {
1870
+ public:
1871
+ enum Type {
1872
+ START_OF_LINE,
1873
+ START_OF_INPUT,
1874
+ END_OF_LINE,
1875
+ END_OF_INPUT,
1876
+ BOUNDARY,
1877
+ NON_BOUNDARY
1878
+ };
1879
+ explicit RegExpAssertion(Type type) : type_(type) { }
1880
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
1881
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1882
+ RegExpNode* on_success);
1883
+ virtual RegExpAssertion* AsAssertion();
1884
+ virtual bool IsAssertion();
1885
+ virtual bool IsAnchoredAtStart();
1886
+ virtual bool IsAnchoredAtEnd();
1887
+ virtual int min_match() { return 0; }
1888
+ virtual int max_match() { return 0; }
1889
+ Type type() { return type_; }
1890
+ private:
1891
+ Type type_;
1892
+ };
1893
+
1894
+
1895
+ class CharacterSet BASE_EMBEDDED {
1896
+ public:
1897
+ explicit CharacterSet(uc16 standard_set_type)
1898
+ : ranges_(NULL),
1899
+ standard_set_type_(standard_set_type) {}
1900
+ explicit CharacterSet(ZoneList<CharacterRange>* ranges)
1901
+ : ranges_(ranges),
1902
+ standard_set_type_(0) {}
1903
+ ZoneList<CharacterRange>* ranges();
1904
+ uc16 standard_set_type() { return standard_set_type_; }
1905
+ void set_standard_set_type(uc16 special_set_type) {
1906
+ standard_set_type_ = special_set_type;
1907
+ }
1908
+ bool is_standard() { return standard_set_type_ != 0; }
1909
+ void Canonicalize();
1910
+ private:
1911
+ ZoneList<CharacterRange>* ranges_;
1912
+ // If non-zero, the value represents a standard set (e.g., all whitespace
1913
+ // characters) without having to expand the ranges.
1914
+ uc16 standard_set_type_;
1915
+ };
1916
+
1917
+
1918
+ class RegExpCharacterClass: public RegExpTree {
1919
+ public:
1920
+ RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated)
1921
+ : set_(ranges),
1922
+ is_negated_(is_negated) { }
1923
+ explicit RegExpCharacterClass(uc16 type)
1924
+ : set_(type),
1925
+ is_negated_(false) { }
1926
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
1927
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1928
+ RegExpNode* on_success);
1929
+ virtual RegExpCharacterClass* AsCharacterClass();
1930
+ virtual bool IsCharacterClass();
1931
+ virtual bool IsTextElement() { return true; }
1932
+ virtual int min_match() { return 1; }
1933
+ virtual int max_match() { return 1; }
1934
+ virtual void AppendToText(RegExpText* text);
1935
+ CharacterSet character_set() { return set_; }
1936
+ // TODO(lrn): Remove need for complex version if is_standard that
1937
+ // recognizes a mangled standard set and just do { return set_.is_special(); }
1938
+ bool is_standard();
1939
+ // Returns a value representing the standard character set if is_standard()
1940
+ // returns true.
1941
+ // Currently used values are:
1942
+ // s : unicode whitespace
1943
+ // S : unicode non-whitespace
1944
+ // w : ASCII word character (digit, letter, underscore)
1945
+ // W : non-ASCII word character
1946
+ // d : ASCII digit
1947
+ // D : non-ASCII digit
1948
+ // . : non-unicode non-newline
1949
+ // * : All characters
1950
+ uc16 standard_type() { return set_.standard_set_type(); }
1951
+ ZoneList<CharacterRange>* ranges() { return set_.ranges(); }
1952
+ bool is_negated() { return is_negated_; }
1953
+ private:
1954
+ CharacterSet set_;
1955
+ bool is_negated_;
1956
+ };
1957
+
1958
+
1959
+ class RegExpAtom: public RegExpTree {
1960
+ public:
1961
+ explicit RegExpAtom(Vector<const uc16> data) : data_(data) { }
1962
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
1963
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1964
+ RegExpNode* on_success);
1965
+ virtual RegExpAtom* AsAtom();
1966
+ virtual bool IsAtom();
1967
+ virtual bool IsTextElement() { return true; }
1968
+ virtual int min_match() { return data_.length(); }
1969
+ virtual int max_match() { return data_.length(); }
1970
+ virtual void AppendToText(RegExpText* text);
1971
+ Vector<const uc16> data() { return data_; }
1972
+ int length() { return data_.length(); }
1973
+ private:
1974
+ Vector<const uc16> data_;
1975
+ };
1976
+
1977
+
1978
+ class RegExpText: public RegExpTree {
1979
+ public:
1980
+ RegExpText() : elements_(2), length_(0) {}
1981
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
1982
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
1983
+ RegExpNode* on_success);
1984
+ virtual RegExpText* AsText();
1985
+ virtual bool IsText();
1986
+ virtual bool IsTextElement() { return true; }
1987
+ virtual int min_match() { return length_; }
1988
+ virtual int max_match() { return length_; }
1989
+ virtual void AppendToText(RegExpText* text);
1990
+ void AddElement(TextElement elm) {
1991
+ elements_.Add(elm);
1992
+ length_ += elm.length();
1993
+ }
1994
+ ZoneList<TextElement>* elements() { return &elements_; }
1995
+ private:
1996
+ ZoneList<TextElement> elements_;
1997
+ int length_;
1998
+ };
1999
+
2000
+
2001
+ class RegExpQuantifier: public RegExpTree {
2002
+ public:
2003
+ enum Type { GREEDY, NON_GREEDY, POSSESSIVE };
2004
+ RegExpQuantifier(int min, int max, Type type, RegExpTree* body)
2005
+ : body_(body),
2006
+ min_(min),
2007
+ max_(max),
2008
+ min_match_(min * body->min_match()),
2009
+ type_(type) {
2010
+ if (max > 0 && body->max_match() > kInfinity / max) {
2011
+ max_match_ = kInfinity;
2012
+ } else {
2013
+ max_match_ = max * body->max_match();
2014
+ }
2015
+ }
2016
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
2017
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2018
+ RegExpNode* on_success);
2019
+ static RegExpNode* ToNode(int min,
2020
+ int max,
2021
+ bool is_greedy,
2022
+ RegExpTree* body,
2023
+ RegExpCompiler* compiler,
2024
+ RegExpNode* on_success,
2025
+ bool not_at_start = false);
2026
+ virtual RegExpQuantifier* AsQuantifier();
2027
+ virtual Interval CaptureRegisters();
2028
+ virtual bool IsQuantifier();
2029
+ virtual int min_match() { return min_match_; }
2030
+ virtual int max_match() { return max_match_; }
2031
+ int min() { return min_; }
2032
+ int max() { return max_; }
2033
+ bool is_possessive() { return type_ == POSSESSIVE; }
2034
+ bool is_non_greedy() { return type_ == NON_GREEDY; }
2035
+ bool is_greedy() { return type_ == GREEDY; }
2036
+ RegExpTree* body() { return body_; }
2037
+ private:
2038
+ RegExpTree* body_;
2039
+ int min_;
2040
+ int max_;
2041
+ int min_match_;
2042
+ int max_match_;
2043
+ Type type_;
2044
+ };
2045
+
2046
+
2047
+ class RegExpCapture: public RegExpTree {
2048
+ public:
2049
+ explicit RegExpCapture(RegExpTree* body, int index)
2050
+ : body_(body), index_(index) { }
2051
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
2052
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2053
+ RegExpNode* on_success);
2054
+ static RegExpNode* ToNode(RegExpTree* body,
2055
+ int index,
2056
+ RegExpCompiler* compiler,
2057
+ RegExpNode* on_success);
2058
+ virtual RegExpCapture* AsCapture();
2059
+ virtual bool IsAnchoredAtStart();
2060
+ virtual bool IsAnchoredAtEnd();
2061
+ virtual Interval CaptureRegisters();
2062
+ virtual bool IsCapture();
2063
+ virtual int min_match() { return body_->min_match(); }
2064
+ virtual int max_match() { return body_->max_match(); }
2065
+ RegExpTree* body() { return body_; }
2066
+ int index() { return index_; }
2067
+ static int StartRegister(int index) { return index * 2; }
2068
+ static int EndRegister(int index) { return index * 2 + 1; }
2069
+ private:
2070
+ RegExpTree* body_;
2071
+ int index_;
2072
+ };
2073
+
2074
+
2075
+ class RegExpLookahead: public RegExpTree {
2076
+ public:
2077
+ RegExpLookahead(RegExpTree* body,
2078
+ bool is_positive,
2079
+ int capture_count,
2080
+ int capture_from)
2081
+ : body_(body),
2082
+ is_positive_(is_positive),
2083
+ capture_count_(capture_count),
2084
+ capture_from_(capture_from) { }
2085
+
2086
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
2087
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2088
+ RegExpNode* on_success);
2089
+ virtual RegExpLookahead* AsLookahead();
2090
+ virtual Interval CaptureRegisters();
2091
+ virtual bool IsLookahead();
2092
+ virtual bool IsAnchoredAtStart();
2093
+ virtual int min_match() { return 0; }
2094
+ virtual int max_match() { return 0; }
2095
+ RegExpTree* body() { return body_; }
2096
+ bool is_positive() { return is_positive_; }
2097
+ int capture_count() { return capture_count_; }
2098
+ int capture_from() { return capture_from_; }
2099
+ private:
2100
+ RegExpTree* body_;
2101
+ bool is_positive_;
2102
+ int capture_count_;
2103
+ int capture_from_;
2104
+ };
2105
+
2106
+
2107
+ class RegExpBackReference: public RegExpTree {
2108
+ public:
2109
+ explicit RegExpBackReference(RegExpCapture* capture)
2110
+ : capture_(capture) { }
2111
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
2112
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2113
+ RegExpNode* on_success);
2114
+ virtual RegExpBackReference* AsBackReference();
2115
+ virtual bool IsBackReference();
2116
+ virtual int min_match() { return 0; }
2117
+ virtual int max_match() { return capture_->max_match(); }
2118
+ int index() { return capture_->index(); }
2119
+ RegExpCapture* capture() { return capture_; }
2120
+ private:
2121
+ RegExpCapture* capture_;
2122
+ };
2123
+
2124
+
2125
+ class RegExpEmpty: public RegExpTree {
2126
+ public:
2127
+ RegExpEmpty() { }
2128
+ virtual void* Accept(RegExpVisitor* visitor, void* data);
2129
+ virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2130
+ RegExpNode* on_success);
2131
+ virtual RegExpEmpty* AsEmpty();
2132
+ virtual bool IsEmpty();
2133
+ virtual int min_match() { return 0; }
2134
+ virtual int max_match() { return 0; }
2135
+ static RegExpEmpty* GetInstance() { return &kInstance; }
2136
+ private:
2137
+ static RegExpEmpty kInstance;
2138
+ };
2139
+
2140
+
2141
+ // ----------------------------------------------------------------------------
2142
+ // Basic visitor
2143
+ // - leaf node visitors are abstract.
2144
+
2145
+ class AstVisitor BASE_EMBEDDED {
2146
+ public:
2147
+ AstVisitor() : isolate_(Isolate::Current()), stack_overflow_(false) { }
2148
+ virtual ~AstVisitor() { }
2149
+
2150
+ // Stack overflow check and dynamic dispatch.
2151
+ void Visit(AstNode* node) { if (!CheckStackOverflow()) node->Accept(this); }
2152
+
2153
+ // Iteration left-to-right.
2154
+ virtual void VisitDeclarations(ZoneList<Declaration*>* declarations);
2155
+ virtual void VisitStatements(ZoneList<Statement*>* statements);
2156
+ virtual void VisitExpressions(ZoneList<Expression*>* expressions);
2157
+
2158
+ // Stack overflow tracking support.
2159
+ bool HasStackOverflow() const { return stack_overflow_; }
2160
+ bool CheckStackOverflow();
2161
+
2162
+ // If a stack-overflow exception is encountered when visiting a
2163
+ // node, calling SetStackOverflow will make sure that the visitor
2164
+ // bails out without visiting more nodes.
2165
+ void SetStackOverflow() { stack_overflow_ = true; }
2166
+ void ClearStackOverflow() { stack_overflow_ = false; }
2167
+
2168
+ // Nodes not appearing in the AST, including slots.
2169
+ virtual void VisitSlot(Slot* node) { UNREACHABLE(); }
2170
+
2171
+ // Individual AST nodes.
2172
+ #define DEF_VISIT(type) \
2173
+ virtual void Visit##type(type* node) = 0;
2174
+ AST_NODE_LIST(DEF_VISIT)
2175
+ #undef DEF_VISIT
2176
+
2177
+ protected:
2178
+ Isolate* isolate() { return isolate_; }
2179
+
2180
+ private:
2181
+ Isolate* isolate_;
2182
+ bool stack_overflow_;
2183
+ };
2184
+
2185
+
2186
+ } } // namespace v8::internal
2187
+
2188
+ #endif // V8_AST_H_