libv8-freebsd 3.3.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (703) hide show
  1. data/.gitignore +9 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +75 -0
  5. data/Rakefile +115 -0
  6. data/ext/libv8/extconf.rb +27 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +39 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-freebsd-amd64.patch +16 -0
  11. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  12. data/lib/libv8/scons/CHANGES.txt +5541 -0
  13. data/lib/libv8/scons/LICENSE.txt +20 -0
  14. data/lib/libv8/scons/MANIFEST +200 -0
  15. data/lib/libv8/scons/PKG-INFO +13 -0
  16. data/lib/libv8/scons/README.txt +243 -0
  17. data/lib/libv8/scons/RELEASE.txt +100 -0
  18. data/lib/libv8/scons/engine/SCons/Action.py +1257 -0
  19. data/lib/libv8/scons/engine/SCons/Builder.py +877 -0
  20. data/lib/libv8/scons/engine/SCons/CacheDir.py +216 -0
  21. data/lib/libv8/scons/engine/SCons/Conftest.py +793 -0
  22. data/lib/libv8/scons/engine/SCons/Debug.py +220 -0
  23. data/lib/libv8/scons/engine/SCons/Defaults.py +494 -0
  24. data/lib/libv8/scons/engine/SCons/Environment.py +2417 -0
  25. data/lib/libv8/scons/engine/SCons/Errors.py +205 -0
  26. data/lib/libv8/scons/engine/SCons/Executor.py +633 -0
  27. data/lib/libv8/scons/engine/SCons/Job.py +435 -0
  28. data/lib/libv8/scons/engine/SCons/Memoize.py +244 -0
  29. data/lib/libv8/scons/engine/SCons/Node/Alias.py +152 -0
  30. data/lib/libv8/scons/engine/SCons/Node/FS.py +3302 -0
  31. data/lib/libv8/scons/engine/SCons/Node/Python.py +128 -0
  32. data/lib/libv8/scons/engine/SCons/Node/__init__.py +1329 -0
  33. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +50 -0
  34. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +50 -0
  35. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +50 -0
  36. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +50 -0
  37. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +76 -0
  38. data/lib/libv8/scons/engine/SCons/Options/__init__.py +67 -0
  39. data/lib/libv8/scons/engine/SCons/PathList.py +231 -0
  40. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +241 -0
  41. data/lib/libv8/scons/engine/SCons/Platform/aix.py +69 -0
  42. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +55 -0
  43. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +70 -0
  44. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +46 -0
  45. data/lib/libv8/scons/engine/SCons/Platform/irix.py +44 -0
  46. data/lib/libv8/scons/engine/SCons/Platform/os2.py +58 -0
  47. data/lib/libv8/scons/engine/SCons/Platform/posix.py +263 -0
  48. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +50 -0
  49. data/lib/libv8/scons/engine/SCons/Platform/win32.py +385 -0
  50. data/lib/libv8/scons/engine/SCons/SConf.py +1030 -0
  51. data/lib/libv8/scons/engine/SCons/SConsign.py +389 -0
  52. data/lib/libv8/scons/engine/SCons/Scanner/C.py +132 -0
  53. data/lib/libv8/scons/engine/SCons/Scanner/D.py +73 -0
  54. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +109 -0
  55. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +316 -0
  56. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +48 -0
  57. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +387 -0
  58. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +101 -0
  59. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +55 -0
  60. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +413 -0
  61. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +384 -0
  62. data/lib/libv8/scons/engine/SCons/Script/Main.py +1405 -0
  63. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +939 -0
  64. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +640 -0
  65. data/lib/libv8/scons/engine/SCons/Script/__init__.py +412 -0
  66. data/lib/libv8/scons/engine/SCons/Sig.py +63 -0
  67. data/lib/libv8/scons/engine/SCons/Subst.py +904 -0
  68. data/lib/libv8/scons/engine/SCons/Taskmaster.py +1025 -0
  69. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +61 -0
  70. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +67 -0
  71. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +73 -0
  72. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +263 -0
  73. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +323 -0
  74. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  75. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  76. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +240 -0
  77. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +82 -0
  78. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +391 -0
  79. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +459 -0
  80. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +526 -0
  81. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +103 -0
  82. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +137 -0
  83. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +64 -0
  84. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +64 -0
  85. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +71 -0
  86. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +681 -0
  87. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +82 -0
  88. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +74 -0
  89. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +80 -0
  90. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +76 -0
  91. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +71 -0
  92. data/lib/libv8/scons/engine/SCons/Tool/ar.py +63 -0
  93. data/lib/libv8/scons/engine/SCons/Tool/as.py +78 -0
  94. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +81 -0
  95. data/lib/libv8/scons/engine/SCons/Tool/c++.py +99 -0
  96. data/lib/libv8/scons/engine/SCons/Tool/cc.py +102 -0
  97. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +58 -0
  98. data/lib/libv8/scons/engine/SCons/Tool/default.py +50 -0
  99. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +240 -0
  100. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +64 -0
  101. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +125 -0
  102. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +95 -0
  103. data/lib/libv8/scons/engine/SCons/Tool/f03.py +63 -0
  104. data/lib/libv8/scons/engine/SCons/Tool/f77.py +62 -0
  105. data/lib/libv8/scons/engine/SCons/Tool/f90.py +62 -0
  106. data/lib/libv8/scons/engine/SCons/Tool/f95.py +63 -0
  107. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +98 -0
  108. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +62 -0
  109. data/lib/libv8/scons/engine/SCons/Tool/g++.py +90 -0
  110. data/lib/libv8/scons/engine/SCons/Tool/g77.py +73 -0
  111. data/lib/libv8/scons/engine/SCons/Tool/gas.py +53 -0
  112. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +80 -0
  113. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +64 -0
  114. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +62 -0
  115. data/lib/libv8/scons/engine/SCons/Tool/gs.py +81 -0
  116. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +84 -0
  117. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +53 -0
  118. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +77 -0
  119. data/lib/libv8/scons/engine/SCons/Tool/icc.py +59 -0
  120. data/lib/libv8/scons/engine/SCons/Tool/icl.py +52 -0
  121. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +72 -0
  122. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +88 -0
  123. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +59 -0
  124. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +60 -0
  125. data/lib/libv8/scons/engine/SCons/Tool/install.py +283 -0
  126. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +522 -0
  127. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +67 -0
  128. data/lib/libv8/scons/engine/SCons/Tool/jar.py +116 -0
  129. data/lib/libv8/scons/engine/SCons/Tool/javac.py +230 -0
  130. data/lib/libv8/scons/engine/SCons/Tool/javah.py +137 -0
  131. data/lib/libv8/scons/engine/SCons/Tool/latex.py +80 -0
  132. data/lib/libv8/scons/engine/SCons/Tool/lex.py +97 -0
  133. data/lib/libv8/scons/engine/SCons/Tool/link.py +122 -0
  134. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +112 -0
  135. data/lib/libv8/scons/engine/SCons/Tool/m4.py +63 -0
  136. data/lib/libv8/scons/engine/SCons/Tool/masm.py +77 -0
  137. data/lib/libv8/scons/engine/SCons/Tool/midl.py +88 -0
  138. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +179 -0
  139. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +64 -0
  140. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +318 -0
  141. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +50 -0
  142. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +278 -0
  143. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +1806 -0
  144. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +207 -0
  145. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +107 -0
  146. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +72 -0
  147. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +312 -0
  148. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  149. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +527 -0
  150. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +365 -0
  151. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  152. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  153. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  154. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  155. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  156. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  157. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +78 -0
  158. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +84 -0
  159. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +109 -0
  160. data/lib/libv8/scons/engine/SCons/Tool/qt.py +336 -0
  161. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +126 -0
  162. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +70 -0
  163. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +132 -0
  164. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +68 -0
  165. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +58 -0
  166. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +53 -0
  167. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +62 -0
  168. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +67 -0
  169. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +142 -0
  170. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +58 -0
  171. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +63 -0
  172. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +64 -0
  173. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +64 -0
  174. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +76 -0
  175. data/lib/libv8/scons/engine/SCons/Tool/swig.py +183 -0
  176. data/lib/libv8/scons/engine/SCons/Tool/tar.py +73 -0
  177. data/lib/libv8/scons/engine/SCons/Tool/tex.py +866 -0
  178. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +175 -0
  179. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +53 -0
  180. data/lib/libv8/scons/engine/SCons/Tool/wix.py +99 -0
  181. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +140 -0
  182. data/lib/libv8/scons/engine/SCons/Tool/zip.py +99 -0
  183. data/lib/libv8/scons/engine/SCons/Util.py +1492 -0
  184. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +89 -0
  185. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +103 -0
  186. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +135 -0
  187. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +106 -0
  188. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +147 -0
  189. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +312 -0
  190. data/lib/libv8/scons/engine/SCons/Warnings.py +246 -0
  191. data/lib/libv8/scons/engine/SCons/__init__.py +49 -0
  192. data/lib/libv8/scons/engine/SCons/compat/__init__.py +237 -0
  193. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +150 -0
  194. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +45 -0
  195. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +45 -0
  196. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +76 -0
  197. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +45 -0
  198. data/lib/libv8/scons/engine/SCons/compat/_scons_sets.py +563 -0
  199. data/lib/libv8/scons/engine/SCons/compat/_scons_subprocess.py +1281 -0
  200. data/lib/libv8/scons/engine/SCons/cpp.py +589 -0
  201. data/lib/libv8/scons/engine/SCons/dblite.py +254 -0
  202. data/lib/libv8/scons/engine/SCons/exitfuncs.py +77 -0
  203. data/lib/libv8/scons/os_spawnv_fix.diff +83 -0
  204. data/lib/libv8/scons/scons-time.1 +1017 -0
  205. data/lib/libv8/scons/scons.1 +15225 -0
  206. data/lib/libv8/scons/sconsign.1 +208 -0
  207. data/lib/libv8/scons/script/scons +196 -0
  208. data/lib/libv8/scons/script/scons-time +1544 -0
  209. data/lib/libv8/scons/script/scons.bat +34 -0
  210. data/lib/libv8/scons/script/sconsign +514 -0
  211. data/lib/libv8/scons/setup.cfg +5 -0
  212. data/lib/libv8/scons/setup.py +423 -0
  213. data/lib/libv8/v8/.gitignore +35 -0
  214. data/lib/libv8/v8/AUTHORS +44 -0
  215. data/lib/libv8/v8/ChangeLog +2839 -0
  216. data/lib/libv8/v8/LICENSE +52 -0
  217. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  218. data/lib/libv8/v8/LICENSE.v8 +26 -0
  219. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  220. data/lib/libv8/v8/SConstruct +1478 -0
  221. data/lib/libv8/v8/build/README.txt +49 -0
  222. data/lib/libv8/v8/build/all.gyp +18 -0
  223. data/lib/libv8/v8/build/armu.gypi +32 -0
  224. data/lib/libv8/v8/build/common.gypi +144 -0
  225. data/lib/libv8/v8/build/gyp_v8 +145 -0
  226. data/lib/libv8/v8/include/v8-debug.h +395 -0
  227. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  228. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  229. data/lib/libv8/v8/include/v8-testing.h +104 -0
  230. data/lib/libv8/v8/include/v8.h +4124 -0
  231. data/lib/libv8/v8/include/v8stdint.h +53 -0
  232. data/lib/libv8/v8/preparser/SConscript +38 -0
  233. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  234. data/lib/libv8/v8/src/SConscript +368 -0
  235. data/lib/libv8/v8/src/accessors.cc +767 -0
  236. data/lib/libv8/v8/src/accessors.h +123 -0
  237. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  238. data/lib/libv8/v8/src/allocation.cc +122 -0
  239. data/lib/libv8/v8/src/allocation.h +143 -0
  240. data/lib/libv8/v8/src/api.cc +5845 -0
  241. data/lib/libv8/v8/src/api.h +574 -0
  242. data/lib/libv8/v8/src/apinatives.js +110 -0
  243. data/lib/libv8/v8/src/apiutils.h +73 -0
  244. data/lib/libv8/v8/src/arguments.h +118 -0
  245. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  246. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  247. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  248. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  249. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  250. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  251. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  252. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  253. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  254. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  255. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  256. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  257. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  258. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  259. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  260. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  261. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  262. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  263. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  264. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  265. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  266. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  267. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  268. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  269. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  270. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  271. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  272. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  273. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  274. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  275. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  276. data/lib/libv8/v8/src/array.js +1366 -0
  277. data/lib/libv8/v8/src/assembler.cc +1207 -0
  278. data/lib/libv8/v8/src/assembler.h +858 -0
  279. data/lib/libv8/v8/src/ast-inl.h +112 -0
  280. data/lib/libv8/v8/src/ast.cc +1146 -0
  281. data/lib/libv8/v8/src/ast.h +2188 -0
  282. data/lib/libv8/v8/src/atomicops.h +167 -0
  283. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  284. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  285. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  286. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  287. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  288. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  289. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  290. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  291. data/lib/libv8/v8/src/bignum.cc +768 -0
  292. data/lib/libv8/v8/src/bignum.h +140 -0
  293. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  294. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  295. data/lib/libv8/v8/src/builtins.cc +1707 -0
  296. data/lib/libv8/v8/src/builtins.h +371 -0
  297. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  298. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  299. data/lib/libv8/v8/src/cached-powers.h +65 -0
  300. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  301. data/lib/libv8/v8/src/char-predicates.h +67 -0
  302. data/lib/libv8/v8/src/checks.cc +110 -0
  303. data/lib/libv8/v8/src/checks.h +296 -0
  304. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  305. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  306. data/lib/libv8/v8/src/circular-queue.h +103 -0
  307. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  308. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  309. data/lib/libv8/v8/src/code.h +70 -0
  310. data/lib/libv8/v8/src/codegen.cc +231 -0
  311. data/lib/libv8/v8/src/codegen.h +84 -0
  312. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  313. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  314. data/lib/libv8/v8/src/compiler.cc +786 -0
  315. data/lib/libv8/v8/src/compiler.h +312 -0
  316. data/lib/libv8/v8/src/contexts.cc +347 -0
  317. data/lib/libv8/v8/src/contexts.h +391 -0
  318. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  319. data/lib/libv8/v8/src/conversions.cc +1131 -0
  320. data/lib/libv8/v8/src/conversions.h +135 -0
  321. data/lib/libv8/v8/src/counters.cc +93 -0
  322. data/lib/libv8/v8/src/counters.h +254 -0
  323. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  324. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  325. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  326. data/lib/libv8/v8/src/cpu.h +69 -0
  327. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  328. data/lib/libv8/v8/src/d8-debug.h +158 -0
  329. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  330. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  331. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  332. data/lib/libv8/v8/src/d8.cc +803 -0
  333. data/lib/libv8/v8/src/d8.gyp +91 -0
  334. data/lib/libv8/v8/src/d8.h +235 -0
  335. data/lib/libv8/v8/src/d8.js +2798 -0
  336. data/lib/libv8/v8/src/data-flow.cc +66 -0
  337. data/lib/libv8/v8/src/data-flow.h +205 -0
  338. data/lib/libv8/v8/src/date.js +1103 -0
  339. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  340. data/lib/libv8/v8/src/dateparser.cc +178 -0
  341. data/lib/libv8/v8/src/dateparser.h +266 -0
  342. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  343. data/lib/libv8/v8/src/debug-agent.h +129 -0
  344. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  345. data/lib/libv8/v8/src/debug.cc +3165 -0
  346. data/lib/libv8/v8/src/debug.h +1057 -0
  347. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  348. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  349. data/lib/libv8/v8/src/disasm.h +80 -0
  350. data/lib/libv8/v8/src/disassembler.cc +343 -0
  351. data/lib/libv8/v8/src/disassembler.h +58 -0
  352. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  353. data/lib/libv8/v8/src/diy-fp.h +117 -0
  354. data/lib/libv8/v8/src/double.h +238 -0
  355. data/lib/libv8/v8/src/dtoa.cc +103 -0
  356. data/lib/libv8/v8/src/dtoa.h +85 -0
  357. data/lib/libv8/v8/src/execution.cc +849 -0
  358. data/lib/libv8/v8/src/execution.h +297 -0
  359. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  360. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  361. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  362. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  363. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  364. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  365. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  366. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  367. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  368. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  369. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  370. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  371. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  372. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  373. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  374. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  375. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  376. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  377. data/lib/libv8/v8/src/factory.cc +1222 -0
  378. data/lib/libv8/v8/src/factory.h +442 -0
  379. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  380. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  381. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  382. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  383. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  384. data/lib/libv8/v8/src/flags.cc +551 -0
  385. data/lib/libv8/v8/src/flags.h +79 -0
  386. data/lib/libv8/v8/src/frames-inl.h +247 -0
  387. data/lib/libv8/v8/src/frames.cc +1243 -0
  388. data/lib/libv8/v8/src/frames.h +870 -0
  389. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  390. data/lib/libv8/v8/src/full-codegen.h +771 -0
  391. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  392. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  393. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  394. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  395. data/lib/libv8/v8/src/global-handles.cc +665 -0
  396. data/lib/libv8/v8/src/global-handles.h +284 -0
  397. data/lib/libv8/v8/src/globals.h +325 -0
  398. data/lib/libv8/v8/src/handles-inl.h +177 -0
  399. data/lib/libv8/v8/src/handles.cc +987 -0
  400. data/lib/libv8/v8/src/handles.h +382 -0
  401. data/lib/libv8/v8/src/hashmap.cc +230 -0
  402. data/lib/libv8/v8/src/hashmap.h +123 -0
  403. data/lib/libv8/v8/src/heap-inl.h +704 -0
  404. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  405. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  406. data/lib/libv8/v8/src/heap.cc +5930 -0
  407. data/lib/libv8/v8/src/heap.h +2268 -0
  408. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  409. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  410. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  411. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  412. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  413. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  414. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  415. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  416. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  417. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  418. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  419. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  420. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  421. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  422. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  423. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  424. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  425. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  426. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  427. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  428. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  429. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  430. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  431. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  432. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  433. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  434. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  435. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  436. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  437. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  438. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  439. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  440. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  441. data/lib/libv8/v8/src/ic-inl.h +130 -0
  442. data/lib/libv8/v8/src/ic.cc +2577 -0
  443. data/lib/libv8/v8/src/ic.h +736 -0
  444. data/lib/libv8/v8/src/inspector.cc +63 -0
  445. data/lib/libv8/v8/src/inspector.h +62 -0
  446. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  447. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  448. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  449. data/lib/libv8/v8/src/isolate.cc +1869 -0
  450. data/lib/libv8/v8/src/isolate.h +1382 -0
  451. data/lib/libv8/v8/src/json-parser.cc +504 -0
  452. data/lib/libv8/v8/src/json-parser.h +161 -0
  453. data/lib/libv8/v8/src/json.js +342 -0
  454. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  455. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  456. data/lib/libv8/v8/src/list-inl.h +212 -0
  457. data/lib/libv8/v8/src/list.h +174 -0
  458. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  459. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  460. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  461. data/lib/libv8/v8/src/lithium.cc +190 -0
  462. data/lib/libv8/v8/src/lithium.h +597 -0
  463. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  464. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  465. data/lib/libv8/v8/src/liveedit.h +180 -0
  466. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  467. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  468. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  469. data/lib/libv8/v8/src/log-inl.h +59 -0
  470. data/lib/libv8/v8/src/log-utils.cc +428 -0
  471. data/lib/libv8/v8/src/log-utils.h +231 -0
  472. data/lib/libv8/v8/src/log.cc +1993 -0
  473. data/lib/libv8/v8/src/log.h +476 -0
  474. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  475. data/lib/libv8/v8/src/macros.py +178 -0
  476. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  477. data/lib/libv8/v8/src/mark-compact.h +506 -0
  478. data/lib/libv8/v8/src/math.js +264 -0
  479. data/lib/libv8/v8/src/messages.cc +179 -0
  480. data/lib/libv8/v8/src/messages.h +113 -0
  481. data/lib/libv8/v8/src/messages.js +1096 -0
  482. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  483. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  484. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  485. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  486. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  487. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  488. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  489. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  490. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  491. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  492. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  493. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  494. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  495. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  496. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  497. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  498. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  499. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  500. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  501. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  502. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  503. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  504. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  505. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  506. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  507. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  508. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  509. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  510. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  511. data/lib/libv8/v8/src/natives.h +64 -0
  512. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  513. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  514. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  515. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  516. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  517. data/lib/libv8/v8/src/objects.cc +10585 -0
  518. data/lib/libv8/v8/src/objects.h +6838 -0
  519. data/lib/libv8/v8/src/parser.cc +4997 -0
  520. data/lib/libv8/v8/src/parser.h +765 -0
  521. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  522. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  523. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  524. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  525. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  526. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  527. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  528. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  529. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  530. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  531. data/lib/libv8/v8/src/platform-tls.h +50 -0
  532. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  533. data/lib/libv8/v8/src/platform.h +667 -0
  534. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  535. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  536. data/lib/libv8/v8/src/preparse-data.h +225 -0
  537. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  538. data/lib/libv8/v8/src/preparser.cc +1450 -0
  539. data/lib/libv8/v8/src/preparser.h +493 -0
  540. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  541. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  542. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  543. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  544. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  545. data/lib/libv8/v8/src/property.cc +105 -0
  546. data/lib/libv8/v8/src/property.h +365 -0
  547. data/lib/libv8/v8/src/proxy.js +83 -0
  548. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  549. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  550. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  551. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  552. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  553. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  554. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  555. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  556. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  557. data/lib/libv8/v8/src/regexp.js +483 -0
  558. data/lib/libv8/v8/src/rewriter.cc +360 -0
  559. data/lib/libv8/v8/src/rewriter.h +50 -0
  560. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  561. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  562. data/lib/libv8/v8/src/runtime.cc +12227 -0
  563. data/lib/libv8/v8/src/runtime.h +652 -0
  564. data/lib/libv8/v8/src/runtime.js +649 -0
  565. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  566. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  567. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  568. data/lib/libv8/v8/src/scanner-base.h +670 -0
  569. data/lib/libv8/v8/src/scanner.cc +345 -0
  570. data/lib/libv8/v8/src/scanner.h +146 -0
  571. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  572. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  573. data/lib/libv8/v8/src/scopes.cc +1150 -0
  574. data/lib/libv8/v8/src/scopes.h +507 -0
  575. data/lib/libv8/v8/src/serialize.cc +1574 -0
  576. data/lib/libv8/v8/src/serialize.h +589 -0
  577. data/lib/libv8/v8/src/shell.h +55 -0
  578. data/lib/libv8/v8/src/simulator.h +43 -0
  579. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  580. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  581. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  582. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  583. data/lib/libv8/v8/src/snapshot.h +91 -0
  584. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  585. data/lib/libv8/v8/src/spaces.cc +3145 -0
  586. data/lib/libv8/v8/src/spaces.h +2369 -0
  587. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  588. data/lib/libv8/v8/src/splay-tree.h +205 -0
  589. data/lib/libv8/v8/src/string-search.cc +41 -0
  590. data/lib/libv8/v8/src/string-search.h +568 -0
  591. data/lib/libv8/v8/src/string-stream.cc +592 -0
  592. data/lib/libv8/v8/src/string-stream.h +191 -0
  593. data/lib/libv8/v8/src/string.js +994 -0
  594. data/lib/libv8/v8/src/strtod.cc +440 -0
  595. data/lib/libv8/v8/src/strtod.h +40 -0
  596. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  597. data/lib/libv8/v8/src/stub-cache.h +924 -0
  598. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  599. data/lib/libv8/v8/src/token.cc +63 -0
  600. data/lib/libv8/v8/src/token.h +288 -0
  601. data/lib/libv8/v8/src/type-info.cc +507 -0
  602. data/lib/libv8/v8/src/type-info.h +272 -0
  603. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  604. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  605. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  606. data/lib/libv8/v8/src/unicode.cc +1624 -0
  607. data/lib/libv8/v8/src/unicode.h +280 -0
  608. data/lib/libv8/v8/src/uri.js +408 -0
  609. data/lib/libv8/v8/src/utils-inl.h +48 -0
  610. data/lib/libv8/v8/src/utils.cc +371 -0
  611. data/lib/libv8/v8/src/utils.h +800 -0
  612. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  613. data/lib/libv8/v8/src/v8-counters.h +314 -0
  614. data/lib/libv8/v8/src/v8.cc +213 -0
  615. data/lib/libv8/v8/src/v8.h +131 -0
  616. data/lib/libv8/v8/src/v8checks.h +64 -0
  617. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  618. data/lib/libv8/v8/src/v8globals.h +512 -0
  619. data/lib/libv8/v8/src/v8memory.h +82 -0
  620. data/lib/libv8/v8/src/v8natives.js +1310 -0
  621. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  622. data/lib/libv8/v8/src/v8threads.cc +464 -0
  623. data/lib/libv8/v8/src/v8threads.h +165 -0
  624. data/lib/libv8/v8/src/v8utils.h +319 -0
  625. data/lib/libv8/v8/src/variables.cc +114 -0
  626. data/lib/libv8/v8/src/variables.h +167 -0
  627. data/lib/libv8/v8/src/version.cc +116 -0
  628. data/lib/libv8/v8/src/version.h +68 -0
  629. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  630. data/lib/libv8/v8/src/vm-state.h +71 -0
  631. data/lib/libv8/v8/src/win32-headers.h +96 -0
  632. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  633. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  634. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  635. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  636. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  637. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  638. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  639. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  640. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  641. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  642. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  643. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  644. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  645. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  646. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  647. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  648. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  649. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  650. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  651. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  652. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  653. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  654. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  655. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  656. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  657. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  658. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  659. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  660. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  661. data/lib/libv8/v8/src/zone-inl.h +140 -0
  662. data/lib/libv8/v8/src/zone.cc +196 -0
  663. data/lib/libv8/v8/src/zone.h +240 -0
  664. data/lib/libv8/v8/tools/codemap.js +265 -0
  665. data/lib/libv8/v8/tools/consarray.js +93 -0
  666. data/lib/libv8/v8/tools/csvparser.js +78 -0
  667. data/lib/libv8/v8/tools/disasm.py +92 -0
  668. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  669. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  670. data/lib/libv8/v8/tools/gcmole/README +62 -0
  671. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  672. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  673. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  674. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  675. data/lib/libv8/v8/tools/grokdump.py +841 -0
  676. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  677. data/lib/libv8/v8/tools/js2c.py +364 -0
  678. data/lib/libv8/v8/tools/jsmin.py +280 -0
  679. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  680. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  681. data/lib/libv8/v8/tools/logreader.js +185 -0
  682. data/lib/libv8/v8/tools/mac-nm +18 -0
  683. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  684. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  685. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  686. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  687. data/lib/libv8/v8/tools/presubmit.py +305 -0
  688. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  689. data/lib/libv8/v8/tools/profile.js +751 -0
  690. data/lib/libv8/v8/tools/profile_view.js +219 -0
  691. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  692. data/lib/libv8/v8/tools/splaytree.js +316 -0
  693. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  694. data/lib/libv8/v8/tools/test.py +1510 -0
  695. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  696. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  697. data/lib/libv8/v8/tools/utils.py +96 -0
  698. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  699. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  700. data/lib/libv8/version.rb +6 -0
  701. data/libv8.gemspec +36 -0
  702. data/thefrontside.png +0 -0
  703. metadata +776 -0
@@ -0,0 +1,1493 @@
1
+ // Copyright 2006-2008 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ #include <stdarg.h>
29
+
30
+ #include "v8.h"
31
+
32
+ #include "prettyprinter.h"
33
+ #include "scopes.h"
34
+ #include "platform.h"
35
+
36
+ namespace v8 {
37
+ namespace internal {
38
+
39
+ #ifdef DEBUG
40
+
41
+ PrettyPrinter::PrettyPrinter() {
42
+ output_ = NULL;
43
+ size_ = 0;
44
+ pos_ = 0;
45
+ }
46
+
47
+
48
+ PrettyPrinter::~PrettyPrinter() {
49
+ DeleteArray(output_);
50
+ }
51
+
52
+
53
+ void PrettyPrinter::VisitBlock(Block* node) {
54
+ if (!node->is_initializer_block()) Print("{ ");
55
+ PrintStatements(node->statements());
56
+ if (node->statements()->length() > 0) Print(" ");
57
+ if (!node->is_initializer_block()) Print("}");
58
+ }
59
+
60
+
61
+ void PrettyPrinter::VisitDeclaration(Declaration* node) {
62
+ Print("var ");
63
+ PrintLiteral(node->proxy()->name(), false);
64
+ if (node->fun() != NULL) {
65
+ Print(" = ");
66
+ PrintFunctionLiteral(node->fun());
67
+ }
68
+ Print(";");
69
+ }
70
+
71
+
72
+ void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) {
73
+ Visit(node->expression());
74
+ Print(";");
75
+ }
76
+
77
+
78
+ void PrettyPrinter::VisitEmptyStatement(EmptyStatement* node) {
79
+ Print(";");
80
+ }
81
+
82
+
83
+ void PrettyPrinter::VisitIfStatement(IfStatement* node) {
84
+ Print("if (");
85
+ Visit(node->condition());
86
+ Print(") ");
87
+ Visit(node->then_statement());
88
+ if (node->HasElseStatement()) {
89
+ Print(" else ");
90
+ Visit(node->else_statement());
91
+ }
92
+ }
93
+
94
+
95
+ void PrettyPrinter::VisitContinueStatement(ContinueStatement* node) {
96
+ Print("continue");
97
+ ZoneStringList* labels = node->target()->labels();
98
+ if (labels != NULL) {
99
+ Print(" ");
100
+ ASSERT(labels->length() > 0); // guaranteed to have at least one entry
101
+ PrintLiteral(labels->at(0), false); // any label from the list is fine
102
+ }
103
+ Print(";");
104
+ }
105
+
106
+
107
+ void PrettyPrinter::VisitBreakStatement(BreakStatement* node) {
108
+ Print("break");
109
+ ZoneStringList* labels = node->target()->labels();
110
+ if (labels != NULL) {
111
+ Print(" ");
112
+ ASSERT(labels->length() > 0); // guaranteed to have at least one entry
113
+ PrintLiteral(labels->at(0), false); // any label from the list is fine
114
+ }
115
+ Print(";");
116
+ }
117
+
118
+
119
+ void PrettyPrinter::VisitReturnStatement(ReturnStatement* node) {
120
+ Print("return ");
121
+ Visit(node->expression());
122
+ Print(";");
123
+ }
124
+
125
+
126
+ void PrettyPrinter::VisitWithEnterStatement(WithEnterStatement* node) {
127
+ Print("<enter with> (");
128
+ Visit(node->expression());
129
+ Print(") ");
130
+ }
131
+
132
+
133
+ void PrettyPrinter::VisitWithExitStatement(WithExitStatement* node) {
134
+ Print("<exit with>");
135
+ }
136
+
137
+
138
+ void PrettyPrinter::VisitSwitchStatement(SwitchStatement* node) {
139
+ PrintLabels(node->labels());
140
+ Print("switch (");
141
+ Visit(node->tag());
142
+ Print(") { ");
143
+ ZoneList<CaseClause*>* cases = node->cases();
144
+ for (int i = 0; i < cases->length(); i++)
145
+ PrintCaseClause(cases->at(i));
146
+ Print("}");
147
+ }
148
+
149
+
150
+ void PrettyPrinter::VisitDoWhileStatement(DoWhileStatement* node) {
151
+ PrintLabels(node->labels());
152
+ Print("do ");
153
+ Visit(node->body());
154
+ Print(" while (");
155
+ Visit(node->cond());
156
+ Print(");");
157
+ }
158
+
159
+
160
+ void PrettyPrinter::VisitWhileStatement(WhileStatement* node) {
161
+ PrintLabels(node->labels());
162
+ Print("while (");
163
+ Visit(node->cond());
164
+ Print(") ");
165
+ Visit(node->body());
166
+ }
167
+
168
+
169
+ void PrettyPrinter::VisitForStatement(ForStatement* node) {
170
+ PrintLabels(node->labels());
171
+ Print("for (");
172
+ if (node->init() != NULL) {
173
+ Visit(node->init());
174
+ Print(" ");
175
+ } else {
176
+ Print("; ");
177
+ }
178
+ if (node->cond() != NULL) Visit(node->cond());
179
+ Print("; ");
180
+ if (node->next() != NULL) {
181
+ Visit(node->next()); // prints extra ';', unfortunately
182
+ // to fix: should use Expression for next
183
+ }
184
+ Print(") ");
185
+ Visit(node->body());
186
+ }
187
+
188
+
189
+ void PrettyPrinter::VisitForInStatement(ForInStatement* node) {
190
+ PrintLabels(node->labels());
191
+ Print("for (");
192
+ Visit(node->each());
193
+ Print(" in ");
194
+ Visit(node->enumerable());
195
+ Print(") ");
196
+ Visit(node->body());
197
+ }
198
+
199
+
200
+ void PrettyPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
201
+ Print("try ");
202
+ Visit(node->try_block());
203
+ Print(" catch (");
204
+ Visit(node->catch_var());
205
+ Print(") ");
206
+ Visit(node->catch_block());
207
+ }
208
+
209
+
210
+ void PrettyPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {
211
+ Print("try ");
212
+ Visit(node->try_block());
213
+ Print(" finally ");
214
+ Visit(node->finally_block());
215
+ }
216
+
217
+
218
+ void PrettyPrinter::VisitDebuggerStatement(DebuggerStatement* node) {
219
+ Print("debugger ");
220
+ }
221
+
222
+
223
+ void PrettyPrinter::VisitFunctionLiteral(FunctionLiteral* node) {
224
+ Print("(");
225
+ PrintFunctionLiteral(node);
226
+ Print(")");
227
+ }
228
+
229
+
230
+ void PrettyPrinter::VisitSharedFunctionInfoLiteral(
231
+ SharedFunctionInfoLiteral* node) {
232
+ Print("(");
233
+ PrintLiteral(node->shared_function_info(), true);
234
+ Print(")");
235
+ }
236
+
237
+
238
+ void PrettyPrinter::VisitConditional(Conditional* node) {
239
+ Visit(node->condition());
240
+ Print(" ? ");
241
+ Visit(node->then_expression());
242
+ Print(" : ");
243
+ Visit(node->else_expression());
244
+ }
245
+
246
+
247
+ void PrettyPrinter::VisitLiteral(Literal* node) {
248
+ PrintLiteral(node->handle(), true);
249
+ }
250
+
251
+
252
+ void PrettyPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
253
+ Print(" RegExp(");
254
+ PrintLiteral(node->pattern(), false);
255
+ Print(",");
256
+ PrintLiteral(node->flags(), false);
257
+ Print(") ");
258
+ }
259
+
260
+
261
+ void PrettyPrinter::VisitObjectLiteral(ObjectLiteral* node) {
262
+ Print("{ ");
263
+ for (int i = 0; i < node->properties()->length(); i++) {
264
+ if (i != 0) Print(",");
265
+ ObjectLiteral::Property* property = node->properties()->at(i);
266
+ Print(" ");
267
+ Visit(property->key());
268
+ Print(": ");
269
+ Visit(property->value());
270
+ }
271
+ Print(" }");
272
+ }
273
+
274
+
275
+ void PrettyPrinter::VisitArrayLiteral(ArrayLiteral* node) {
276
+ Print("[ ");
277
+ for (int i = 0; i < node->values()->length(); i++) {
278
+ if (i != 0) Print(",");
279
+ Visit(node->values()->at(i));
280
+ }
281
+ Print(" ]");
282
+ }
283
+
284
+
285
+ void PrettyPrinter::VisitCatchExtensionObject(CatchExtensionObject* node) {
286
+ Print("{ ");
287
+ Visit(node->key());
288
+ Print(": ");
289
+ Visit(node->value());
290
+ Print(" }");
291
+ }
292
+
293
+
294
+ void PrettyPrinter::VisitSlot(Slot* node) {
295
+ switch (node->type()) {
296
+ case Slot::PARAMETER:
297
+ Print("parameter[%d]", node->index());
298
+ break;
299
+ case Slot::LOCAL:
300
+ Print("local[%d]", node->index());
301
+ break;
302
+ case Slot::CONTEXT:
303
+ Print("context[%d]", node->index());
304
+ break;
305
+ case Slot::LOOKUP:
306
+ Print("lookup[");
307
+ PrintLiteral(node->var()->name(), false);
308
+ Print("]");
309
+ break;
310
+ default:
311
+ UNREACHABLE();
312
+ }
313
+ }
314
+
315
+
316
+ void PrettyPrinter::VisitVariableProxy(VariableProxy* node) {
317
+ PrintLiteral(node->name(), false);
318
+ }
319
+
320
+
321
+ void PrettyPrinter::VisitAssignment(Assignment* node) {
322
+ Visit(node->target());
323
+ Print(" %s ", Token::String(node->op()));
324
+ Visit(node->value());
325
+ }
326
+
327
+
328
+ void PrettyPrinter::VisitThrow(Throw* node) {
329
+ Print("throw ");
330
+ Visit(node->exception());
331
+ }
332
+
333
+
334
+ void PrettyPrinter::VisitProperty(Property* node) {
335
+ Expression* key = node->key();
336
+ Literal* literal = key->AsLiteral();
337
+ if (literal != NULL && literal->handle()->IsSymbol()) {
338
+ Print("(");
339
+ Visit(node->obj());
340
+ Print(").");
341
+ PrintLiteral(literal->handle(), false);
342
+ } else {
343
+ Visit(node->obj());
344
+ Print("[");
345
+ Visit(key);
346
+ Print("]");
347
+ }
348
+ }
349
+
350
+
351
+ void PrettyPrinter::VisitCall(Call* node) {
352
+ Visit(node->expression());
353
+ PrintArguments(node->arguments());
354
+ }
355
+
356
+
357
+ void PrettyPrinter::VisitCallNew(CallNew* node) {
358
+ Print("new (");
359
+ Visit(node->expression());
360
+ Print(")");
361
+ PrintArguments(node->arguments());
362
+ }
363
+
364
+
365
+ void PrettyPrinter::VisitCallRuntime(CallRuntime* node) {
366
+ Print("%%");
367
+ PrintLiteral(node->name(), false);
368
+ PrintArguments(node->arguments());
369
+ }
370
+
371
+
372
+ void PrettyPrinter::VisitUnaryOperation(UnaryOperation* node) {
373
+ Token::Value op = node->op();
374
+ bool needsSpace =
375
+ op == Token::DELETE || op == Token::TYPEOF || op == Token::VOID;
376
+ Print("(%s%s", Token::String(op), needsSpace ? " " : "");
377
+ Visit(node->expression());
378
+ Print(")");
379
+ }
380
+
381
+
382
+ void PrettyPrinter::VisitCountOperation(CountOperation* node) {
383
+ Print("(");
384
+ if (node->is_prefix()) Print("%s", Token::String(node->op()));
385
+ Visit(node->expression());
386
+ if (node->is_postfix()) Print("%s", Token::String(node->op()));
387
+ Print(")");
388
+ }
389
+
390
+
391
+ void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) {
392
+ Print("(");
393
+ Visit(node->left());
394
+ Print(" %s ", Token::String(node->op()));
395
+ Visit(node->right());
396
+ Print(")");
397
+ }
398
+
399
+
400
+ void PrettyPrinter::VisitCompareOperation(CompareOperation* node) {
401
+ Print("(");
402
+ Visit(node->left());
403
+ Print(" %s ", Token::String(node->op()));
404
+ Visit(node->right());
405
+ Print(")");
406
+ }
407
+
408
+
409
+ void PrettyPrinter::VisitCompareToNull(CompareToNull* node) {
410
+ Print("(");
411
+ Visit(node->expression());
412
+ Print("%s null)", Token::String(node->op()));
413
+ }
414
+
415
+
416
+ void PrettyPrinter::VisitThisFunction(ThisFunction* node) {
417
+ Print("<this-function>");
418
+ }
419
+
420
+
421
+ const char* PrettyPrinter::Print(AstNode* node) {
422
+ Init();
423
+ Visit(node);
424
+ return output_;
425
+ }
426
+
427
+
428
+ const char* PrettyPrinter::PrintExpression(FunctionLiteral* program) {
429
+ Init();
430
+ ExpressionStatement* statement =
431
+ program->body()->at(0)->AsExpressionStatement();
432
+ Visit(statement->expression());
433
+ return output_;
434
+ }
435
+
436
+
437
+ const char* PrettyPrinter::PrintProgram(FunctionLiteral* program) {
438
+ Init();
439
+ PrintStatements(program->body());
440
+ Print("\n");
441
+ return output_;
442
+ }
443
+
444
+
445
+ void PrettyPrinter::PrintOut(AstNode* node) {
446
+ PrettyPrinter printer;
447
+ PrintF("%s", printer.Print(node));
448
+ }
449
+
450
+
451
+ void PrettyPrinter::Init() {
452
+ if (size_ == 0) {
453
+ ASSERT(output_ == NULL);
454
+ const int initial_size = 256;
455
+ output_ = NewArray<char>(initial_size);
456
+ size_ = initial_size;
457
+ }
458
+ output_[0] = '\0';
459
+ pos_ = 0;
460
+ }
461
+
462
+
463
+ void PrettyPrinter::Print(const char* format, ...) {
464
+ for (;;) {
465
+ va_list arguments;
466
+ va_start(arguments, format);
467
+ int n = OS::VSNPrintF(Vector<char>(output_, size_) + pos_,
468
+ format,
469
+ arguments);
470
+ va_end(arguments);
471
+
472
+ if (n >= 0) {
473
+ // there was enough space - we are done
474
+ pos_ += n;
475
+ return;
476
+ } else {
477
+ // there was not enough space - allocate more and try again
478
+ const int slack = 32;
479
+ int new_size = size_ + (size_ >> 1) + slack;
480
+ char* new_output = NewArray<char>(new_size);
481
+ memcpy(new_output, output_, pos_);
482
+ DeleteArray(output_);
483
+ output_ = new_output;
484
+ size_ = new_size;
485
+ }
486
+ }
487
+ }
488
+
489
+
490
+ void PrettyPrinter::PrintStatements(ZoneList<Statement*>* statements) {
491
+ for (int i = 0; i < statements->length(); i++) {
492
+ if (i != 0) Print(" ");
493
+ Visit(statements->at(i));
494
+ }
495
+ }
496
+
497
+
498
+ void PrettyPrinter::PrintLabels(ZoneStringList* labels) {
499
+ if (labels != NULL) {
500
+ for (int i = 0; i < labels->length(); i++) {
501
+ PrintLiteral(labels->at(i), false);
502
+ Print(": ");
503
+ }
504
+ }
505
+ }
506
+
507
+
508
+ void PrettyPrinter::PrintArguments(ZoneList<Expression*>* arguments) {
509
+ Print("(");
510
+ for (int i = 0; i < arguments->length(); i++) {
511
+ if (i != 0) Print(", ");
512
+ Visit(arguments->at(i));
513
+ }
514
+ Print(")");
515
+ }
516
+
517
+
518
+ void PrettyPrinter::PrintLiteral(Handle<Object> value, bool quote) {
519
+ Object* object = *value;
520
+ if (object->IsString()) {
521
+ String* string = String::cast(object);
522
+ if (quote) Print("\"");
523
+ for (int i = 0; i < string->length(); i++) {
524
+ Print("%c", string->Get(i));
525
+ }
526
+ if (quote) Print("\"");
527
+ } else if (object->IsNull()) {
528
+ Print("null");
529
+ } else if (object->IsTrue()) {
530
+ Print("true");
531
+ } else if (object->IsFalse()) {
532
+ Print("false");
533
+ } else if (object->IsUndefined()) {
534
+ Print("undefined");
535
+ } else if (object->IsNumber()) {
536
+ Print("%g", object->Number());
537
+ } else if (object->IsJSObject()) {
538
+ // regular expression
539
+ if (object->IsJSFunction()) {
540
+ Print("JS-Function");
541
+ } else if (object->IsJSArray()) {
542
+ Print("JS-array[%u]", JSArray::cast(object)->length());
543
+ } else if (object->IsJSObject()) {
544
+ Print("JS-Object");
545
+ } else {
546
+ Print("?UNKNOWN?");
547
+ }
548
+ } else if (object->IsFixedArray()) {
549
+ Print("FixedArray");
550
+ } else {
551
+ Print("<unknown literal %p>", object);
552
+ }
553
+ }
554
+
555
+
556
+ void PrettyPrinter::PrintParameters(Scope* scope) {
557
+ Print("(");
558
+ for (int i = 0; i < scope->num_parameters(); i++) {
559
+ if (i > 0) Print(", ");
560
+ PrintLiteral(scope->parameter(i)->name(), false);
561
+ }
562
+ Print(")");
563
+ }
564
+
565
+
566
+ void PrettyPrinter::PrintDeclarations(ZoneList<Declaration*>* declarations) {
567
+ for (int i = 0; i < declarations->length(); i++) {
568
+ if (i > 0) Print(" ");
569
+ Visit(declarations->at(i));
570
+ }
571
+ }
572
+
573
+
574
+ void PrettyPrinter::PrintFunctionLiteral(FunctionLiteral* function) {
575
+ Print("function ");
576
+ PrintLiteral(function->name(), false);
577
+ PrintParameters(function->scope());
578
+ Print(" { ");
579
+ PrintDeclarations(function->scope()->declarations());
580
+ PrintStatements(function->body());
581
+ Print(" }");
582
+ }
583
+
584
+
585
+ void PrettyPrinter::PrintCaseClause(CaseClause* clause) {
586
+ if (clause->is_default()) {
587
+ Print("default");
588
+ } else {
589
+ Print("case ");
590
+ Visit(clause->label());
591
+ }
592
+ Print(": ");
593
+ PrintStatements(clause->statements());
594
+ if (clause->statements()->length() > 0)
595
+ Print(" ");
596
+ }
597
+
598
+
599
+ //-----------------------------------------------------------------------------
600
+
601
+ class IndentedScope BASE_EMBEDDED {
602
+ public:
603
+ explicit IndentedScope(AstPrinter* printer) : ast_printer_(printer) {
604
+ ast_printer_->inc_indent();
605
+ }
606
+
607
+ IndentedScope(AstPrinter* printer, const char* txt, AstNode* node = NULL)
608
+ : ast_printer_(printer) {
609
+ ast_printer_->PrintIndented(txt);
610
+ ast_printer_->Print("\n");
611
+ ast_printer_->inc_indent();
612
+ }
613
+
614
+ virtual ~IndentedScope() {
615
+ ast_printer_->dec_indent();
616
+ }
617
+
618
+ private:
619
+ AstPrinter* ast_printer_;
620
+ };
621
+
622
+
623
+ //-----------------------------------------------------------------------------
624
+
625
+
626
+ AstPrinter::AstPrinter() : indent_(0) {
627
+ }
628
+
629
+
630
+ AstPrinter::~AstPrinter() {
631
+ ASSERT(indent_ == 0);
632
+ }
633
+
634
+
635
+ void AstPrinter::PrintIndented(const char* txt) {
636
+ for (int i = 0; i < indent_; i++) {
637
+ Print(". ");
638
+ }
639
+ Print(txt);
640
+ }
641
+
642
+
643
+ void AstPrinter::PrintLiteralIndented(const char* info,
644
+ Handle<Object> value,
645
+ bool quote) {
646
+ PrintIndented(info);
647
+ Print(" ");
648
+ PrintLiteral(value, quote);
649
+ Print("\n");
650
+ }
651
+
652
+
653
+ void AstPrinter::PrintLiteralWithModeIndented(const char* info,
654
+ Variable* var,
655
+ Handle<Object> value) {
656
+ if (var == NULL) {
657
+ PrintLiteralIndented(info, value, true);
658
+ } else {
659
+ EmbeddedVector<char, 256> buf;
660
+ int pos = OS::SNPrintF(buf, "%s (mode = %s", info,
661
+ Variable::Mode2String(var->mode()));
662
+ OS::SNPrintF(buf + pos, ")");
663
+ PrintLiteralIndented(buf.start(), value, true);
664
+ }
665
+ }
666
+
667
+
668
+ void AstPrinter::PrintLabelsIndented(const char* info, ZoneStringList* labels) {
669
+ if (labels != NULL && labels->length() > 0) {
670
+ if (info == NULL) {
671
+ PrintIndented("LABELS ");
672
+ } else {
673
+ PrintIndented(info);
674
+ Print(" ");
675
+ }
676
+ PrintLabels(labels);
677
+ } else if (info != NULL) {
678
+ PrintIndented(info);
679
+ }
680
+ Print("\n");
681
+ }
682
+
683
+
684
+ void AstPrinter::PrintIndentedVisit(const char* s, AstNode* node) {
685
+ IndentedScope indent(this, s, node);
686
+ Visit(node);
687
+ }
688
+
689
+
690
+ const char* AstPrinter::PrintProgram(FunctionLiteral* program) {
691
+ Init();
692
+ { IndentedScope indent(this, "FUNC");
693
+ PrintLiteralIndented("NAME", program->name(), true);
694
+ PrintLiteralIndented("INFERRED NAME", program->inferred_name(), true);
695
+ PrintParameters(program->scope());
696
+ PrintDeclarations(program->scope()->declarations());
697
+ PrintStatements(program->body());
698
+ }
699
+ return Output();
700
+ }
701
+
702
+
703
+ void AstPrinter::PrintDeclarations(ZoneList<Declaration*>* declarations) {
704
+ if (declarations->length() > 0) {
705
+ IndentedScope indent(this, "DECLS");
706
+ for (int i = 0; i < declarations->length(); i++) {
707
+ Visit(declarations->at(i));
708
+ }
709
+ }
710
+ }
711
+
712
+
713
+ void AstPrinter::PrintParameters(Scope* scope) {
714
+ if (scope->num_parameters() > 0) {
715
+ IndentedScope indent(this, "PARAMS");
716
+ for (int i = 0; i < scope->num_parameters(); i++) {
717
+ PrintLiteralWithModeIndented("VAR", scope->parameter(i),
718
+ scope->parameter(i)->name());
719
+ }
720
+ }
721
+ }
722
+
723
+
724
+ void AstPrinter::PrintStatements(ZoneList<Statement*>* statements) {
725
+ for (int i = 0; i < statements->length(); i++) {
726
+ Visit(statements->at(i));
727
+ }
728
+ }
729
+
730
+
731
+ void AstPrinter::PrintArguments(ZoneList<Expression*>* arguments) {
732
+ for (int i = 0; i < arguments->length(); i++) {
733
+ Visit(arguments->at(i));
734
+ }
735
+ }
736
+
737
+
738
+ void AstPrinter::PrintCaseClause(CaseClause* clause) {
739
+ if (clause->is_default()) {
740
+ IndentedScope indent(this, "DEFAULT");
741
+ PrintStatements(clause->statements());
742
+ } else {
743
+ IndentedScope indent(this, "CASE");
744
+ Visit(clause->label());
745
+ PrintStatements(clause->statements());
746
+ }
747
+ }
748
+
749
+
750
+ void AstPrinter::VisitBlock(Block* node) {
751
+ const char* block_txt = node->is_initializer_block() ? "BLOCK INIT" : "BLOCK";
752
+ IndentedScope indent(this, block_txt);
753
+ PrintStatements(node->statements());
754
+ }
755
+
756
+
757
+ void AstPrinter::VisitDeclaration(Declaration* node) {
758
+ if (node->fun() == NULL) {
759
+ // var or const declarations
760
+ PrintLiteralWithModeIndented(Variable::Mode2String(node->mode()),
761
+ node->proxy()->AsVariable(),
762
+ node->proxy()->name());
763
+ } else {
764
+ // function declarations
765
+ PrintIndented("FUNCTION ");
766
+ PrintLiteral(node->proxy()->name(), true);
767
+ Print(" = function ");
768
+ PrintLiteral(node->fun()->name(), false);
769
+ Print("\n");
770
+ }
771
+ }
772
+
773
+
774
+ void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) {
775
+ Visit(node->expression());
776
+ }
777
+
778
+
779
+ void AstPrinter::VisitEmptyStatement(EmptyStatement* node) {
780
+ PrintIndented("EMPTY\n");
781
+ }
782
+
783
+
784
+ void AstPrinter::VisitIfStatement(IfStatement* node) {
785
+ PrintIndentedVisit("IF", node->condition());
786
+ PrintIndentedVisit("THEN", node->then_statement());
787
+ if (node->HasElseStatement()) {
788
+ PrintIndentedVisit("ELSE", node->else_statement());
789
+ }
790
+ }
791
+
792
+
793
+ void AstPrinter::VisitContinueStatement(ContinueStatement* node) {
794
+ PrintLabelsIndented("CONTINUE", node->target()->labels());
795
+ }
796
+
797
+
798
+ void AstPrinter::VisitBreakStatement(BreakStatement* node) {
799
+ PrintLabelsIndented("BREAK", node->target()->labels());
800
+ }
801
+
802
+
803
+ void AstPrinter::VisitReturnStatement(ReturnStatement* node) {
804
+ PrintIndentedVisit("RETURN", node->expression());
805
+ }
806
+
807
+
808
+ void AstPrinter::VisitWithEnterStatement(WithEnterStatement* node) {
809
+ PrintIndentedVisit("WITH ENTER", node->expression());
810
+ }
811
+
812
+
813
+ void AstPrinter::VisitWithExitStatement(WithExitStatement* node) {
814
+ PrintIndented("WITH EXIT\n");
815
+ }
816
+
817
+
818
+ void AstPrinter::VisitSwitchStatement(SwitchStatement* node) {
819
+ IndentedScope indent(this, "SWITCH");
820
+ PrintLabelsIndented(NULL, node->labels());
821
+ PrintIndentedVisit("TAG", node->tag());
822
+ for (int i = 0; i < node->cases()->length(); i++) {
823
+ PrintCaseClause(node->cases()->at(i));
824
+ }
825
+ }
826
+
827
+
828
+ void AstPrinter::VisitDoWhileStatement(DoWhileStatement* node) {
829
+ IndentedScope indent(this, "DO");
830
+ PrintLabelsIndented(NULL, node->labels());
831
+ PrintIndentedVisit("BODY", node->body());
832
+ PrintIndentedVisit("COND", node->cond());
833
+ }
834
+
835
+
836
+ void AstPrinter::VisitWhileStatement(WhileStatement* node) {
837
+ IndentedScope indent(this, "WHILE");
838
+ PrintLabelsIndented(NULL, node->labels());
839
+ PrintIndentedVisit("COND", node->cond());
840
+ PrintIndentedVisit("BODY", node->body());
841
+ }
842
+
843
+
844
+ void AstPrinter::VisitForStatement(ForStatement* node) {
845
+ IndentedScope indent(this, "FOR");
846
+ PrintLabelsIndented(NULL, node->labels());
847
+ if (node->init()) PrintIndentedVisit("INIT", node->init());
848
+ if (node->cond()) PrintIndentedVisit("COND", node->cond());
849
+ PrintIndentedVisit("BODY", node->body());
850
+ if (node->next()) PrintIndentedVisit("NEXT", node->next());
851
+ }
852
+
853
+
854
+ void AstPrinter::VisitForInStatement(ForInStatement* node) {
855
+ IndentedScope indent(this, "FOR IN");
856
+ PrintIndentedVisit("FOR", node->each());
857
+ PrintIndentedVisit("IN", node->enumerable());
858
+ PrintIndentedVisit("BODY", node->body());
859
+ }
860
+
861
+
862
+ void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) {
863
+ IndentedScope indent(this, "TRY CATCH");
864
+ PrintIndentedVisit("TRY", node->try_block());
865
+ PrintIndentedVisit("CATCHVAR", node->catch_var());
866
+ PrintIndentedVisit("CATCH", node->catch_block());
867
+ }
868
+
869
+
870
+ void AstPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {
871
+ IndentedScope indent(this, "TRY FINALLY");
872
+ PrintIndentedVisit("TRY", node->try_block());
873
+ PrintIndentedVisit("FINALLY", node->finally_block());
874
+ }
875
+
876
+
877
+ void AstPrinter::VisitDebuggerStatement(DebuggerStatement* node) {
878
+ IndentedScope indent(this, "DEBUGGER");
879
+ }
880
+
881
+
882
+ void AstPrinter::VisitFunctionLiteral(FunctionLiteral* node) {
883
+ IndentedScope indent(this, "FUNC LITERAL");
884
+ PrintLiteralIndented("NAME", node->name(), false);
885
+ PrintLiteralIndented("INFERRED NAME", node->inferred_name(), false);
886
+ PrintParameters(node->scope());
887
+ // We don't want to see the function literal in this case: it
888
+ // will be printed via PrintProgram when the code for it is
889
+ // generated.
890
+ // PrintStatements(node->body());
891
+ }
892
+
893
+
894
+ void AstPrinter::VisitSharedFunctionInfoLiteral(
895
+ SharedFunctionInfoLiteral* node) {
896
+ IndentedScope indent(this, "FUNC LITERAL");
897
+ PrintLiteralIndented("SHARED INFO", node->shared_function_info(), true);
898
+ }
899
+
900
+
901
+ void AstPrinter::VisitConditional(Conditional* node) {
902
+ IndentedScope indent(this, "CONDITIONAL");
903
+ PrintIndentedVisit("?", node->condition());
904
+ PrintIndentedVisit("THEN", node->then_expression());
905
+ PrintIndentedVisit("ELSE", node->else_expression());
906
+ }
907
+
908
+
909
+ void AstPrinter::VisitLiteral(Literal* node) {
910
+ PrintLiteralIndented("LITERAL", node->handle(), true);
911
+ }
912
+
913
+
914
+ void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) {
915
+ IndentedScope indent(this, "REGEXP LITERAL");
916
+ PrintLiteralIndented("PATTERN", node->pattern(), false);
917
+ PrintLiteralIndented("FLAGS", node->flags(), false);
918
+ }
919
+
920
+
921
+ void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) {
922
+ IndentedScope indent(this, "OBJ LITERAL");
923
+ for (int i = 0; i < node->properties()->length(); i++) {
924
+ const char* prop_kind = NULL;
925
+ switch (node->properties()->at(i)->kind()) {
926
+ case ObjectLiteral::Property::CONSTANT:
927
+ prop_kind = "PROPERTY - CONSTANT";
928
+ break;
929
+ case ObjectLiteral::Property::COMPUTED:
930
+ prop_kind = "PROPERTY - COMPUTED";
931
+ break;
932
+ case ObjectLiteral::Property::MATERIALIZED_LITERAL:
933
+ prop_kind = "PROPERTY - MATERIALIZED_LITERAL";
934
+ break;
935
+ case ObjectLiteral::Property::PROTOTYPE:
936
+ prop_kind = "PROPERTY - PROTOTYPE";
937
+ break;
938
+ case ObjectLiteral::Property::GETTER:
939
+ prop_kind = "PROPERTY - GETTER";
940
+ break;
941
+ case ObjectLiteral::Property::SETTER:
942
+ prop_kind = "PROPERTY - SETTER";
943
+ break;
944
+ default:
945
+ UNREACHABLE();
946
+ }
947
+ IndentedScope prop(this, prop_kind);
948
+ PrintIndentedVisit("KEY", node->properties()->at(i)->key());
949
+ PrintIndentedVisit("VALUE", node->properties()->at(i)->value());
950
+ }
951
+ }
952
+
953
+
954
+ void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) {
955
+ IndentedScope indent(this, "ARRAY LITERAL");
956
+ if (node->values()->length() > 0) {
957
+ IndentedScope indent(this, "VALUES");
958
+ for (int i = 0; i < node->values()->length(); i++) {
959
+ Visit(node->values()->at(i));
960
+ }
961
+ }
962
+ }
963
+
964
+
965
+ void AstPrinter::VisitCatchExtensionObject(CatchExtensionObject* node) {
966
+ IndentedScope indent(this, "CatchExtensionObject");
967
+ PrintIndentedVisit("KEY", node->key());
968
+ PrintIndentedVisit("VALUE", node->value());
969
+ }
970
+
971
+
972
+ void AstPrinter::VisitSlot(Slot* node) {
973
+ PrintIndented("SLOT ");
974
+ PrettyPrinter::VisitSlot(node);
975
+ Print("\n");
976
+ }
977
+
978
+
979
+ void AstPrinter::VisitVariableProxy(VariableProxy* node) {
980
+ PrintLiteralWithModeIndented("VAR PROXY", node->AsVariable(), node->name());
981
+ Variable* var = node->var();
982
+ if (var != NULL && var->rewrite() != NULL) {
983
+ IndentedScope indent(this);
984
+ Visit(var->rewrite());
985
+ }
986
+ }
987
+
988
+
989
+ void AstPrinter::VisitAssignment(Assignment* node) {
990
+ IndentedScope indent(this, Token::Name(node->op()), node);
991
+ Visit(node->target());
992
+ Visit(node->value());
993
+ }
994
+
995
+
996
+ void AstPrinter::VisitThrow(Throw* node) {
997
+ PrintIndentedVisit("THROW", node->exception());
998
+ }
999
+
1000
+
1001
+ void AstPrinter::VisitProperty(Property* node) {
1002
+ IndentedScope indent(this, "PROPERTY", node);
1003
+ Visit(node->obj());
1004
+ Literal* literal = node->key()->AsLiteral();
1005
+ if (literal != NULL && literal->handle()->IsSymbol()) {
1006
+ PrintLiteralIndented("NAME", literal->handle(), false);
1007
+ } else {
1008
+ PrintIndentedVisit("KEY", node->key());
1009
+ }
1010
+ }
1011
+
1012
+
1013
+ void AstPrinter::VisitCall(Call* node) {
1014
+ IndentedScope indent(this, "CALL");
1015
+ Visit(node->expression());
1016
+ PrintArguments(node->arguments());
1017
+ }
1018
+
1019
+
1020
+ void AstPrinter::VisitCallNew(CallNew* node) {
1021
+ IndentedScope indent(this, "CALL NEW");
1022
+ Visit(node->expression());
1023
+ PrintArguments(node->arguments());
1024
+ }
1025
+
1026
+
1027
+ void AstPrinter::VisitCallRuntime(CallRuntime* node) {
1028
+ PrintLiteralIndented("CALL RUNTIME ", node->name(), false);
1029
+ IndentedScope indent(this);
1030
+ PrintArguments(node->arguments());
1031
+ }
1032
+
1033
+
1034
+ void AstPrinter::VisitUnaryOperation(UnaryOperation* node) {
1035
+ PrintIndentedVisit(Token::Name(node->op()), node->expression());
1036
+ }
1037
+
1038
+
1039
+ void AstPrinter::VisitCountOperation(CountOperation* node) {
1040
+ EmbeddedVector<char, 128> buf;
1041
+ OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"),
1042
+ Token::Name(node->op()));
1043
+ PrintIndentedVisit(buf.start(), node->expression());
1044
+ }
1045
+
1046
+
1047
+ void AstPrinter::VisitBinaryOperation(BinaryOperation* node) {
1048
+ IndentedScope indent(this, Token::Name(node->op()), node);
1049
+ Visit(node->left());
1050
+ Visit(node->right());
1051
+ }
1052
+
1053
+
1054
+ void AstPrinter::VisitCompareOperation(CompareOperation* node) {
1055
+ IndentedScope indent(this, Token::Name(node->op()), node);
1056
+ Visit(node->left());
1057
+ Visit(node->right());
1058
+ }
1059
+
1060
+
1061
+ void AstPrinter::VisitCompareToNull(CompareToNull* node) {
1062
+ const char* name = node->is_strict()
1063
+ ? "COMPARE-TO-NULL-STRICT"
1064
+ : "COMPARE-TO-NULL";
1065
+ IndentedScope indent(this, name, node);
1066
+ Visit(node->expression());
1067
+ }
1068
+
1069
+
1070
+ void AstPrinter::VisitThisFunction(ThisFunction* node) {
1071
+ IndentedScope indent(this, "THIS-FUNCTION");
1072
+ }
1073
+
1074
+
1075
+ TagScope::TagScope(JsonAstBuilder* builder, const char* name)
1076
+ : builder_(builder), next_(builder->tag()), has_body_(false) {
1077
+ if (next_ != NULL) {
1078
+ next_->use();
1079
+ builder->Print(",\n");
1080
+ }
1081
+ builder->set_tag(this);
1082
+ builder->PrintIndented("[");
1083
+ builder->Print("\"%s\"", name);
1084
+ builder->increase_indent(JsonAstBuilder::kTagIndentSize);
1085
+ }
1086
+
1087
+
1088
+ TagScope::~TagScope() {
1089
+ builder_->decrease_indent(JsonAstBuilder::kTagIndentSize);
1090
+ if (has_body_) {
1091
+ builder_->Print("\n");
1092
+ builder_->PrintIndented("]");
1093
+ } else {
1094
+ builder_->Print("]");
1095
+ }
1096
+ builder_->set_tag(next_);
1097
+ }
1098
+
1099
+
1100
+ AttributesScope::AttributesScope(JsonAstBuilder* builder)
1101
+ : builder_(builder), attribute_count_(0) {
1102
+ builder->set_attributes(this);
1103
+ builder->tag()->use();
1104
+ builder->Print(",\n");
1105
+ builder->PrintIndented("{");
1106
+ builder->increase_indent(JsonAstBuilder::kAttributesIndentSize);
1107
+ }
1108
+
1109
+
1110
+ AttributesScope::~AttributesScope() {
1111
+ builder_->decrease_indent(JsonAstBuilder::kAttributesIndentSize);
1112
+ if (attribute_count_ > 1) {
1113
+ builder_->Print("\n");
1114
+ builder_->PrintIndented("}");
1115
+ } else {
1116
+ builder_->Print("}");
1117
+ }
1118
+ builder_->set_attributes(NULL);
1119
+ }
1120
+
1121
+
1122
+ const char* JsonAstBuilder::BuildProgram(FunctionLiteral* program) {
1123
+ Init();
1124
+ Visit(program);
1125
+ Print("\n");
1126
+ return Output();
1127
+ }
1128
+
1129
+
1130
+ void JsonAstBuilder::AddAttributePrefix(const char* name) {
1131
+ if (attributes()->is_used()) {
1132
+ Print(",\n");
1133
+ PrintIndented("\"");
1134
+ } else {
1135
+ Print("\"");
1136
+ }
1137
+ Print("%s\":", name);
1138
+ attributes()->use();
1139
+ }
1140
+
1141
+
1142
+ void JsonAstBuilder::AddAttribute(const char* name, Handle<String> value) {
1143
+ SmartPointer<char> value_string = value->ToCString();
1144
+ AddAttributePrefix(name);
1145
+ Print("\"%s\"", *value_string);
1146
+ }
1147
+
1148
+
1149
+ void JsonAstBuilder::AddAttribute(const char* name, const char* value) {
1150
+ AddAttributePrefix(name);
1151
+ Print("\"%s\"", value);
1152
+ }
1153
+
1154
+
1155
+ void JsonAstBuilder::AddAttribute(const char* name, int value) {
1156
+ AddAttributePrefix(name);
1157
+ Print("%d", value);
1158
+ }
1159
+
1160
+
1161
+ void JsonAstBuilder::AddAttribute(const char* name, bool value) {
1162
+ AddAttributePrefix(name);
1163
+ Print(value ? "true" : "false");
1164
+ }
1165
+
1166
+
1167
+ void JsonAstBuilder::VisitBlock(Block* stmt) {
1168
+ TagScope tag(this, "Block");
1169
+ VisitStatements(stmt->statements());
1170
+ }
1171
+
1172
+
1173
+ void JsonAstBuilder::VisitExpressionStatement(ExpressionStatement* stmt) {
1174
+ TagScope tag(this, "ExpressionStatement");
1175
+ Visit(stmt->expression());
1176
+ }
1177
+
1178
+
1179
+ void JsonAstBuilder::VisitEmptyStatement(EmptyStatement* stmt) {
1180
+ TagScope tag(this, "EmptyStatement");
1181
+ }
1182
+
1183
+
1184
+ void JsonAstBuilder::VisitIfStatement(IfStatement* stmt) {
1185
+ TagScope tag(this, "IfStatement");
1186
+ Visit(stmt->condition());
1187
+ Visit(stmt->then_statement());
1188
+ Visit(stmt->else_statement());
1189
+ }
1190
+
1191
+
1192
+ void JsonAstBuilder::VisitContinueStatement(ContinueStatement* stmt) {
1193
+ TagScope tag(this, "ContinueStatement");
1194
+ }
1195
+
1196
+
1197
+ void JsonAstBuilder::VisitBreakStatement(BreakStatement* stmt) {
1198
+ TagScope tag(this, "BreakStatement");
1199
+ }
1200
+
1201
+
1202
+ void JsonAstBuilder::VisitReturnStatement(ReturnStatement* stmt) {
1203
+ TagScope tag(this, "ReturnStatement");
1204
+ Visit(stmt->expression());
1205
+ }
1206
+
1207
+
1208
+ void JsonAstBuilder::VisitWithEnterStatement(WithEnterStatement* stmt) {
1209
+ TagScope tag(this, "WithEnterStatement");
1210
+ Visit(stmt->expression());
1211
+ }
1212
+
1213
+
1214
+ void JsonAstBuilder::VisitWithExitStatement(WithExitStatement* stmt) {
1215
+ TagScope tag(this, "WithExitStatement");
1216
+ }
1217
+
1218
+
1219
+ void JsonAstBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
1220
+ TagScope tag(this, "SwitchStatement");
1221
+ }
1222
+
1223
+
1224
+ void JsonAstBuilder::VisitDoWhileStatement(DoWhileStatement* stmt) {
1225
+ TagScope tag(this, "DoWhileStatement");
1226
+ Visit(stmt->body());
1227
+ Visit(stmt->cond());
1228
+ }
1229
+
1230
+
1231
+ void JsonAstBuilder::VisitWhileStatement(WhileStatement* stmt) {
1232
+ TagScope tag(this, "WhileStatement");
1233
+ Visit(stmt->cond());
1234
+ Visit(stmt->body());
1235
+ }
1236
+
1237
+
1238
+ void JsonAstBuilder::VisitForStatement(ForStatement* stmt) {
1239
+ TagScope tag(this, "ForStatement");
1240
+ if (stmt->init() != NULL) Visit(stmt->init());
1241
+ if (stmt->cond() != NULL) Visit(stmt->cond());
1242
+ Visit(stmt->body());
1243
+ if (stmt->next() != NULL) Visit(stmt->next());
1244
+ }
1245
+
1246
+
1247
+ void JsonAstBuilder::VisitForInStatement(ForInStatement* stmt) {
1248
+ TagScope tag(this, "ForInStatement");
1249
+ Visit(stmt->each());
1250
+ Visit(stmt->enumerable());
1251
+ Visit(stmt->body());
1252
+ }
1253
+
1254
+
1255
+ void JsonAstBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) {
1256
+ TagScope tag(this, "TryCatchStatement");
1257
+ Visit(stmt->try_block());
1258
+ Visit(stmt->catch_var());
1259
+ Visit(stmt->catch_block());
1260
+ }
1261
+
1262
+
1263
+ void JsonAstBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
1264
+ TagScope tag(this, "TryFinallyStatement");
1265
+ Visit(stmt->try_block());
1266
+ Visit(stmt->finally_block());
1267
+ }
1268
+
1269
+
1270
+ void JsonAstBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) {
1271
+ TagScope tag(this, "DebuggerStatement");
1272
+ }
1273
+
1274
+
1275
+ void JsonAstBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
1276
+ TagScope tag(this, "FunctionLiteral");
1277
+ {
1278
+ AttributesScope attributes(this);
1279
+ AddAttribute("name", expr->name());
1280
+ }
1281
+ VisitDeclarations(expr->scope()->declarations());
1282
+ VisitStatements(expr->body());
1283
+ }
1284
+
1285
+
1286
+ void JsonAstBuilder::VisitSharedFunctionInfoLiteral(
1287
+ SharedFunctionInfoLiteral* expr) {
1288
+ TagScope tag(this, "SharedFunctionInfoLiteral");
1289
+ }
1290
+
1291
+
1292
+ void JsonAstBuilder::VisitConditional(Conditional* expr) {
1293
+ TagScope tag(this, "Conditional");
1294
+ }
1295
+
1296
+
1297
+ void JsonAstBuilder::VisitSlot(Slot* expr) {
1298
+ TagScope tag(this, "Slot");
1299
+ {
1300
+ AttributesScope attributes(this);
1301
+ switch (expr->type()) {
1302
+ case Slot::PARAMETER:
1303
+ AddAttribute("type", "PARAMETER");
1304
+ break;
1305
+ case Slot::LOCAL:
1306
+ AddAttribute("type", "LOCAL");
1307
+ break;
1308
+ case Slot::CONTEXT:
1309
+ AddAttribute("type", "CONTEXT");
1310
+ break;
1311
+ case Slot::LOOKUP:
1312
+ AddAttribute("type", "LOOKUP");
1313
+ break;
1314
+ }
1315
+ AddAttribute("index", expr->index());
1316
+ }
1317
+ }
1318
+
1319
+
1320
+ void JsonAstBuilder::VisitVariableProxy(VariableProxy* expr) {
1321
+ if (expr->var()->rewrite() == NULL) {
1322
+ TagScope tag(this, "VariableProxy");
1323
+ {
1324
+ AttributesScope attributes(this);
1325
+ AddAttribute("name", expr->name());
1326
+ AddAttribute("mode", Variable::Mode2String(expr->var()->mode()));
1327
+ }
1328
+ } else {
1329
+ Visit(expr->var()->rewrite());
1330
+ }
1331
+ }
1332
+
1333
+
1334
+ void JsonAstBuilder::VisitLiteral(Literal* expr) {
1335
+ TagScope tag(this, "Literal");
1336
+ {
1337
+ AttributesScope attributes(this);
1338
+ Handle<Object> handle = expr->handle();
1339
+ if (handle->IsString()) {
1340
+ AddAttribute("handle", Handle<String>(String::cast(*handle)));
1341
+ } else if (handle->IsSmi()) {
1342
+ AddAttribute("handle", Smi::cast(*handle)->value());
1343
+ }
1344
+ }
1345
+ }
1346
+
1347
+
1348
+ void JsonAstBuilder::VisitRegExpLiteral(RegExpLiteral* expr) {
1349
+ TagScope tag(this, "RegExpLiteral");
1350
+ }
1351
+
1352
+
1353
+ void JsonAstBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
1354
+ TagScope tag(this, "ObjectLiteral");
1355
+ }
1356
+
1357
+
1358
+ void JsonAstBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
1359
+ TagScope tag(this, "ArrayLiteral");
1360
+ }
1361
+
1362
+
1363
+ void JsonAstBuilder::VisitCatchExtensionObject(CatchExtensionObject* expr) {
1364
+ TagScope tag(this, "CatchExtensionObject");
1365
+ Visit(expr->key());
1366
+ Visit(expr->value());
1367
+ }
1368
+
1369
+
1370
+ void JsonAstBuilder::VisitAssignment(Assignment* expr) {
1371
+ TagScope tag(this, "Assignment");
1372
+ {
1373
+ AttributesScope attributes(this);
1374
+ AddAttribute("op", Token::Name(expr->op()));
1375
+ }
1376
+ Visit(expr->target());
1377
+ Visit(expr->value());
1378
+ }
1379
+
1380
+
1381
+ void JsonAstBuilder::VisitThrow(Throw* expr) {
1382
+ TagScope tag(this, "Throw");
1383
+ Visit(expr->exception());
1384
+ }
1385
+
1386
+
1387
+ void JsonAstBuilder::VisitProperty(Property* expr) {
1388
+ TagScope tag(this, "Property");
1389
+ {
1390
+ AttributesScope attributes(this);
1391
+ AddAttribute("type", expr->is_synthetic() ? "SYNTHETIC" : "NORMAL");
1392
+ }
1393
+ Visit(expr->obj());
1394
+ Visit(expr->key());
1395
+ }
1396
+
1397
+
1398
+ void JsonAstBuilder::VisitCall(Call* expr) {
1399
+ TagScope tag(this, "Call");
1400
+ Visit(expr->expression());
1401
+ VisitExpressions(expr->arguments());
1402
+ }
1403
+
1404
+
1405
+ void JsonAstBuilder::VisitCallNew(CallNew* expr) {
1406
+ TagScope tag(this, "CallNew");
1407
+ Visit(expr->expression());
1408
+ VisitExpressions(expr->arguments());
1409
+ }
1410
+
1411
+
1412
+ void JsonAstBuilder::VisitCallRuntime(CallRuntime* expr) {
1413
+ TagScope tag(this, "CallRuntime");
1414
+ {
1415
+ AttributesScope attributes(this);
1416
+ AddAttribute("name", expr->name());
1417
+ }
1418
+ VisitExpressions(expr->arguments());
1419
+ }
1420
+
1421
+
1422
+ void JsonAstBuilder::VisitUnaryOperation(UnaryOperation* expr) {
1423
+ TagScope tag(this, "UnaryOperation");
1424
+ {
1425
+ AttributesScope attributes(this);
1426
+ AddAttribute("op", Token::Name(expr->op()));
1427
+ }
1428
+ Visit(expr->expression());
1429
+ }
1430
+
1431
+
1432
+ void JsonAstBuilder::VisitCountOperation(CountOperation* expr) {
1433
+ TagScope tag(this, "CountOperation");
1434
+ {
1435
+ AttributesScope attributes(this);
1436
+ AddAttribute("is_prefix", expr->is_prefix());
1437
+ AddAttribute("op", Token::Name(expr->op()));
1438
+ }
1439
+ Visit(expr->expression());
1440
+ }
1441
+
1442
+
1443
+ void JsonAstBuilder::VisitBinaryOperation(BinaryOperation* expr) {
1444
+ TagScope tag(this, "BinaryOperation");
1445
+ {
1446
+ AttributesScope attributes(this);
1447
+ AddAttribute("op", Token::Name(expr->op()));
1448
+ }
1449
+ Visit(expr->left());
1450
+ Visit(expr->right());
1451
+ }
1452
+
1453
+
1454
+ void JsonAstBuilder::VisitCompareOperation(CompareOperation* expr) {
1455
+ TagScope tag(this, "CompareOperation");
1456
+ {
1457
+ AttributesScope attributes(this);
1458
+ AddAttribute("op", Token::Name(expr->op()));
1459
+ }
1460
+ Visit(expr->left());
1461
+ Visit(expr->right());
1462
+ }
1463
+
1464
+
1465
+ void JsonAstBuilder::VisitCompareToNull(CompareToNull* expr) {
1466
+ TagScope tag(this, "CompareToNull");
1467
+ {
1468
+ AttributesScope attributes(this);
1469
+ AddAttribute("is_strict", expr->is_strict());
1470
+ }
1471
+ Visit(expr->expression());
1472
+ }
1473
+
1474
+
1475
+ void JsonAstBuilder::VisitThisFunction(ThisFunction* expr) {
1476
+ TagScope tag(this, "ThisFunction");
1477
+ }
1478
+
1479
+
1480
+ void JsonAstBuilder::VisitDeclaration(Declaration* decl) {
1481
+ TagScope tag(this, "Declaration");
1482
+ {
1483
+ AttributesScope attributes(this);
1484
+ AddAttribute("mode", Variable::Mode2String(decl->mode()));
1485
+ }
1486
+ Visit(decl->proxy());
1487
+ if (decl->fun() != NULL) Visit(decl->fun());
1488
+ }
1489
+
1490
+
1491
+ #endif // DEBUG
1492
+
1493
+ } } // namespace v8::internal