libv8 3.3.10.4 → 3.5.10.beta1

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 (538) hide show
  1. data/lib/libv8/scons/CHANGES.txt +24 -231
  2. data/lib/libv8/scons/LICENSE.txt +1 -1
  3. data/lib/libv8/scons/MANIFEST +0 -1
  4. data/lib/libv8/scons/PKG-INFO +1 -1
  5. data/lib/libv8/scons/README.txt +9 -9
  6. data/lib/libv8/scons/RELEASE.txt +75 -77
  7. data/lib/libv8/scons/engine/SCons/Action.py +6 -22
  8. data/lib/libv8/scons/engine/SCons/Builder.py +2 -2
  9. data/lib/libv8/scons/engine/SCons/CacheDir.py +2 -2
  10. data/lib/libv8/scons/engine/SCons/Debug.py +2 -2
  11. data/lib/libv8/scons/engine/SCons/Defaults.py +10 -24
  12. data/lib/libv8/scons/engine/SCons/Environment.py +19 -118
  13. data/lib/libv8/scons/engine/SCons/Errors.py +2 -2
  14. data/lib/libv8/scons/engine/SCons/Executor.py +2 -2
  15. data/lib/libv8/scons/engine/SCons/Job.py +2 -2
  16. data/lib/libv8/scons/engine/SCons/Memoize.py +2 -2
  17. data/lib/libv8/scons/engine/SCons/Node/Alias.py +2 -2
  18. data/lib/libv8/scons/engine/SCons/Node/FS.py +121 -281
  19. data/lib/libv8/scons/engine/SCons/Node/Python.py +2 -2
  20. data/lib/libv8/scons/engine/SCons/Node/__init__.py +5 -6
  21. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +2 -2
  22. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +2 -2
  23. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +2 -2
  24. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +2 -2
  25. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +2 -2
  26. data/lib/libv8/scons/engine/SCons/Options/__init__.py +2 -2
  27. data/lib/libv8/scons/engine/SCons/PathList.py +2 -2
  28. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +2 -2
  29. data/lib/libv8/scons/engine/SCons/Platform/aix.py +2 -2
  30. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +2 -2
  31. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +3 -27
  32. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +2 -2
  33. data/lib/libv8/scons/engine/SCons/Platform/irix.py +2 -2
  34. data/lib/libv8/scons/engine/SCons/Platform/os2.py +2 -2
  35. data/lib/libv8/scons/engine/SCons/Platform/posix.py +2 -2
  36. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +2 -2
  37. data/lib/libv8/scons/engine/SCons/Platform/win32.py +2 -2
  38. data/lib/libv8/scons/engine/SCons/SConf.py +2 -2
  39. data/lib/libv8/scons/engine/SCons/SConsign.py +3 -9
  40. data/lib/libv8/scons/engine/SCons/Scanner/C.py +2 -2
  41. data/lib/libv8/scons/engine/SCons/Scanner/D.py +2 -2
  42. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +2 -2
  43. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +2 -2
  44. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +2 -2
  45. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +2 -5
  46. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +2 -2
  47. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +3 -3
  48. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +2 -2
  49. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +2 -2
  50. data/lib/libv8/scons/engine/SCons/Script/Main.py +11 -82
  51. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +5 -5
  52. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +2 -2
  53. data/lib/libv8/scons/engine/SCons/Script/__init__.py +2 -2
  54. data/lib/libv8/scons/engine/SCons/Sig.py +2 -2
  55. data/lib/libv8/scons/engine/SCons/Subst.py +2 -2
  56. data/lib/libv8/scons/engine/SCons/Taskmaster.py +2 -10
  57. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +2 -2
  58. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +2 -2
  59. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +2 -2
  60. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +2 -19
  61. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +2 -2
  62. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +2 -2
  63. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +2 -2
  64. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +2 -2
  65. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +2 -2
  66. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +2 -2
  67. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +6 -9
  68. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +2 -29
  69. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +2 -2
  70. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +2 -2
  71. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +2 -2
  72. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +2 -2
  73. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +2 -2
  74. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +3 -3
  75. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +2 -2
  76. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +2 -2
  77. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +2 -2
  78. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +2 -2
  79. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +2 -2
  80. data/lib/libv8/scons/engine/SCons/Tool/ar.py +2 -2
  81. data/lib/libv8/scons/engine/SCons/Tool/as.py +2 -2
  82. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +2 -2
  83. data/lib/libv8/scons/engine/SCons/Tool/c++.py +2 -2
  84. data/lib/libv8/scons/engine/SCons/Tool/cc.py +2 -2
  85. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +2 -2
  86. data/lib/libv8/scons/engine/SCons/Tool/default.py +2 -2
  87. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +7 -24
  88. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +2 -2
  89. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +2 -3
  90. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +2 -3
  91. data/lib/libv8/scons/engine/SCons/Tool/f77.py +2 -2
  92. data/lib/libv8/scons/engine/SCons/Tool/f90.py +2 -2
  93. data/lib/libv8/scons/engine/SCons/Tool/f95.py +2 -2
  94. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +2 -2
  95. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +2 -2
  96. data/lib/libv8/scons/engine/SCons/Tool/g++.py +2 -2
  97. data/lib/libv8/scons/engine/SCons/Tool/g77.py +2 -2
  98. data/lib/libv8/scons/engine/SCons/Tool/gas.py +2 -2
  99. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +2 -2
  100. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +3 -3
  101. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +3 -2
  102. data/lib/libv8/scons/engine/SCons/Tool/gs.py +2 -2
  103. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +2 -2
  104. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +2 -2
  105. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +2 -2
  106. data/lib/libv8/scons/engine/SCons/Tool/icc.py +2 -2
  107. data/lib/libv8/scons/engine/SCons/Tool/icl.py +2 -2
  108. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +2 -2
  109. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +2 -2
  110. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +2 -2
  111. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +2 -2
  112. data/lib/libv8/scons/engine/SCons/Tool/install.py +3 -57
  113. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +25 -65
  114. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +2 -2
  115. data/lib/libv8/scons/engine/SCons/Tool/jar.py +3 -9
  116. data/lib/libv8/scons/engine/SCons/Tool/javac.py +2 -2
  117. data/lib/libv8/scons/engine/SCons/Tool/javah.py +2 -2
  118. data/lib/libv8/scons/engine/SCons/Tool/latex.py +2 -3
  119. data/lib/libv8/scons/engine/SCons/Tool/lex.py +2 -2
  120. data/lib/libv8/scons/engine/SCons/Tool/link.py +5 -6
  121. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +2 -2
  122. data/lib/libv8/scons/engine/SCons/Tool/m4.py +2 -2
  123. data/lib/libv8/scons/engine/SCons/Tool/masm.py +2 -2
  124. data/lib/libv8/scons/engine/SCons/Tool/midl.py +2 -2
  125. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +10 -31
  126. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +2 -2
  127. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +9 -61
  128. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +2 -2
  129. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +11 -21
  130. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +59 -477
  131. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +2 -2
  132. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +2 -2
  133. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +2 -2
  134. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +2 -2
  135. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +2 -2
  136. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +2 -2
  137. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +2 -2
  138. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +2 -2
  139. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +2 -2
  140. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +2 -2
  141. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +2 -2
  142. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +2 -2
  143. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +2 -2
  144. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +2 -2
  145. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +2 -3
  146. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +2 -3
  147. data/lib/libv8/scons/engine/SCons/Tool/qt.py +2 -2
  148. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +3 -9
  149. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +2 -2
  150. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +2 -2
  151. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +2 -2
  152. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +2 -2
  153. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +2 -2
  154. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +3 -2
  155. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +2 -2
  156. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +2 -2
  157. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +2 -2
  158. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +2 -2
  159. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +2 -2
  160. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +2 -2
  161. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +3 -2
  162. data/lib/libv8/scons/engine/SCons/Tool/swig.py +5 -6
  163. data/lib/libv8/scons/engine/SCons/Tool/tar.py +2 -2
  164. data/lib/libv8/scons/engine/SCons/Tool/tex.py +43 -96
  165. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +2 -2
  166. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +2 -2
  167. data/lib/libv8/scons/engine/SCons/Tool/wix.py +2 -2
  168. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +2 -12
  169. data/lib/libv8/scons/engine/SCons/Tool/zip.py +2 -2
  170. data/lib/libv8/scons/engine/SCons/Util.py +3 -3
  171. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +2 -2
  172. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +3 -3
  173. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +2 -2
  174. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +2 -2
  175. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +2 -2
  176. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +2 -2
  177. data/lib/libv8/scons/engine/SCons/Warnings.py +2 -2
  178. data/lib/libv8/scons/engine/SCons/__init__.py +6 -6
  179. data/lib/libv8/scons/engine/SCons/compat/__init__.py +2 -2
  180. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +2 -2
  181. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +2 -2
  182. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +2 -2
  183. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +2 -2
  184. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +2 -2
  185. data/lib/libv8/scons/engine/SCons/cpp.py +2 -2
  186. data/lib/libv8/scons/engine/SCons/dblite.py +1 -4
  187. data/lib/libv8/scons/engine/SCons/exitfuncs.py +2 -2
  188. data/lib/libv8/scons/scons-time.1 +3 -3
  189. data/lib/libv8/scons/scons.1 +1164 -1170
  190. data/lib/libv8/scons/sconsign.1 +3 -3
  191. data/lib/libv8/scons/script/scons +22 -22
  192. data/lib/libv8/scons/script/scons-time +2 -2
  193. data/lib/libv8/scons/script/scons.bat +4 -7
  194. data/lib/libv8/scons/script/sconsign +20 -21
  195. data/lib/libv8/scons/setup.cfg +1 -0
  196. data/lib/libv8/scons/setup.py +40 -38
  197. data/lib/libv8/v8/.gitignore +1 -1
  198. data/lib/libv8/v8/AUTHORS +2 -0
  199. data/lib/libv8/v8/ChangeLog +387 -0
  200. data/lib/libv8/v8/Makefile +171 -0
  201. data/lib/libv8/v8/SConstruct +124 -51
  202. data/lib/libv8/v8/build/README.txt +31 -14
  203. data/lib/libv8/v8/build/all.gyp +11 -4
  204. data/lib/libv8/v8/build/armu.gypi +6 -2
  205. data/lib/libv8/v8/build/common.gypi +240 -94
  206. data/lib/libv8/v8/build/gyp_v8 +32 -4
  207. data/lib/libv8/v8/build/standalone.gypi +200 -0
  208. data/lib/libv8/v8/include/v8-debug.h +0 -0
  209. data/lib/libv8/v8/include/v8-profiler.h +8 -11
  210. data/lib/libv8/v8/include/v8.h +191 -108
  211. data/lib/libv8/v8/preparser/SConscript +2 -2
  212. data/lib/libv8/v8/preparser/preparser-process.cc +3 -3
  213. data/lib/libv8/v8/preparser/preparser.gyp +42 -0
  214. data/lib/libv8/v8/src/SConscript +33 -8
  215. data/lib/libv8/v8/src/accessors.cc +77 -43
  216. data/lib/libv8/v8/src/api.cc +393 -191
  217. data/lib/libv8/v8/src/api.h +4 -8
  218. data/lib/libv8/v8/src/apinatives.js +15 -3
  219. data/lib/libv8/v8/src/arguments.h +8 -0
  220. data/lib/libv8/v8/src/arm/assembler-arm.cc +120 -120
  221. data/lib/libv8/v8/src/arm/assembler-arm.h +92 -43
  222. data/lib/libv8/v8/src/arm/builtins-arm.cc +32 -39
  223. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +572 -351
  224. data/lib/libv8/v8/src/arm/code-stubs-arm.h +8 -77
  225. data/lib/libv8/v8/src/arm/codegen-arm.h +0 -2
  226. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +50 -30
  227. data/lib/libv8/v8/src/arm/disasm-arm.cc +1 -1
  228. data/lib/libv8/v8/src/arm/frames-arm.h +9 -5
  229. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +331 -432
  230. data/lib/libv8/v8/src/arm/ic-arm.cc +192 -124
  231. data/lib/libv8/v8/src/arm/lithium-arm.cc +216 -232
  232. data/lib/libv8/v8/src/arm/lithium-arm.h +106 -259
  233. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +633 -642
  234. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +4 -4
  235. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +1 -3
  236. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +260 -185
  237. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +45 -25
  238. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +25 -13
  239. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +3 -0
  240. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +413 -226
  241. data/lib/libv8/v8/src/array.js +38 -18
  242. data/lib/libv8/v8/src/assembler.cc +12 -5
  243. data/lib/libv8/v8/src/assembler.h +15 -9
  244. data/lib/libv8/v8/src/ast-inl.h +34 -25
  245. data/lib/libv8/v8/src/ast.cc +141 -72
  246. data/lib/libv8/v8/src/ast.h +255 -181
  247. data/lib/libv8/v8/src/bignum.cc +3 -4
  248. data/lib/libv8/v8/src/bootstrapper.cc +55 -11
  249. data/lib/libv8/v8/src/bootstrapper.h +3 -2
  250. data/lib/libv8/v8/src/builtins.cc +8 -2
  251. data/lib/libv8/v8/src/builtins.h +4 -0
  252. data/lib/libv8/v8/src/cached-powers.cc +8 -4
  253. data/lib/libv8/v8/src/checks.h +3 -3
  254. data/lib/libv8/v8/src/code-stubs.cc +173 -28
  255. data/lib/libv8/v8/src/code-stubs.h +104 -148
  256. data/lib/libv8/v8/src/codegen.cc +8 -8
  257. data/lib/libv8/v8/src/compilation-cache.cc +2 -47
  258. data/lib/libv8/v8/src/compilation-cache.h +0 -10
  259. data/lib/libv8/v8/src/compiler.cc +27 -16
  260. data/lib/libv8/v8/src/compiler.h +13 -18
  261. data/lib/libv8/v8/src/contexts.cc +107 -72
  262. data/lib/libv8/v8/src/contexts.h +70 -34
  263. data/lib/libv8/v8/src/conversions-inl.h +572 -14
  264. data/lib/libv8/v8/src/conversions.cc +9 -707
  265. data/lib/libv8/v8/src/conversions.h +23 -12
  266. data/lib/libv8/v8/src/cpu-profiler-inl.h +2 -19
  267. data/lib/libv8/v8/src/cpu-profiler.cc +4 -21
  268. data/lib/libv8/v8/src/cpu-profiler.h +8 -17
  269. data/lib/libv8/v8/src/d8-debug.cc +5 -3
  270. data/lib/libv8/v8/src/d8-debug.h +6 -7
  271. data/lib/libv8/v8/src/d8-posix.cc +1 -10
  272. data/lib/libv8/v8/src/d8.cc +721 -219
  273. data/lib/libv8/v8/src/d8.gyp +37 -12
  274. data/lib/libv8/v8/src/d8.h +141 -19
  275. data/lib/libv8/v8/src/d8.js +17 -8
  276. data/lib/libv8/v8/src/date.js +16 -5
  277. data/lib/libv8/v8/src/dateparser-inl.h +242 -39
  278. data/lib/libv8/v8/src/dateparser.cc +38 -4
  279. data/lib/libv8/v8/src/dateparser.h +170 -28
  280. data/lib/libv8/v8/src/debug-agent.cc +5 -3
  281. data/lib/libv8/v8/src/debug-agent.h +11 -7
  282. data/lib/libv8/v8/src/debug-debugger.js +65 -34
  283. data/lib/libv8/v8/src/debug.cc +30 -60
  284. data/lib/libv8/v8/src/debug.h +5 -3
  285. data/lib/libv8/v8/src/deoptimizer.cc +227 -10
  286. data/lib/libv8/v8/src/deoptimizer.h +133 -9
  287. data/lib/libv8/v8/src/disassembler.cc +22 -14
  288. data/lib/libv8/v8/src/diy-fp.cc +4 -3
  289. data/lib/libv8/v8/src/diy-fp.h +3 -3
  290. data/lib/libv8/v8/src/elements.cc +634 -0
  291. data/lib/libv8/v8/src/elements.h +95 -0
  292. data/lib/libv8/v8/src/execution.cc +5 -21
  293. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +3 -1
  294. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +1 -1
  295. data/lib/libv8/v8/src/extensions/experimental/collator.cc +6 -2
  296. data/lib/libv8/v8/src/extensions/experimental/collator.h +1 -2
  297. data/lib/libv8/v8/src/extensions/experimental/datetime-format.cc +384 -0
  298. data/lib/libv8/v8/src/extensions/experimental/datetime-format.h +83 -0
  299. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +18 -7
  300. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +12 -16
  301. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +1 -1
  302. data/lib/libv8/v8/src/extensions/experimental/i18n-js2c.py +126 -0
  303. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +3 -4
  304. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +1 -1
  305. data/lib/libv8/v8/src/{shell.h → extensions/experimental/i18n-natives.h} +8 -20
  306. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +45 -1
  307. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +21 -1
  308. data/lib/libv8/v8/src/extensions/experimental/i18n.js +211 -11
  309. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +4 -3
  310. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +1 -1
  311. data/lib/libv8/v8/src/extensions/experimental/number-format.cc +374 -0
  312. data/lib/libv8/v8/src/extensions/experimental/number-format.h +71 -0
  313. data/lib/libv8/v8/src/factory.cc +89 -18
  314. data/lib/libv8/v8/src/factory.h +36 -8
  315. data/lib/libv8/v8/src/flag-definitions.h +11 -44
  316. data/lib/libv8/v8/src/frames-inl.h +8 -1
  317. data/lib/libv8/v8/src/frames.cc +39 -3
  318. data/lib/libv8/v8/src/frames.h +10 -3
  319. data/lib/libv8/v8/src/full-codegen.cc +311 -293
  320. data/lib/libv8/v8/src/full-codegen.h +183 -143
  321. data/lib/libv8/v8/src/func-name-inferrer.cc +29 -15
  322. data/lib/libv8/v8/src/func-name-inferrer.h +19 -9
  323. data/lib/libv8/v8/src/gdb-jit.cc +658 -55
  324. data/lib/libv8/v8/src/gdb-jit.h +6 -2
  325. data/lib/libv8/v8/src/global-handles.cc +368 -312
  326. data/lib/libv8/v8/src/global-handles.h +29 -36
  327. data/lib/libv8/v8/src/globals.h +3 -1
  328. data/lib/libv8/v8/src/handles.cc +43 -69
  329. data/lib/libv8/v8/src/handles.h +21 -16
  330. data/lib/libv8/v8/src/heap-inl.h +11 -13
  331. data/lib/libv8/v8/src/heap-profiler.cc +0 -999
  332. data/lib/libv8/v8/src/heap-profiler.h +0 -303
  333. data/lib/libv8/v8/src/heap.cc +366 -141
  334. data/lib/libv8/v8/src/heap.h +87 -26
  335. data/lib/libv8/v8/src/hydrogen-instructions.cc +192 -81
  336. data/lib/libv8/v8/src/hydrogen-instructions.h +711 -482
  337. data/lib/libv8/v8/src/hydrogen.cc +1146 -629
  338. data/lib/libv8/v8/src/hydrogen.h +100 -64
  339. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +19 -0
  340. data/lib/libv8/v8/src/ia32/assembler-ia32.h +15 -2
  341. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +34 -39
  342. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +675 -377
  343. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +8 -69
  344. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +1 -0
  345. data/lib/libv8/v8/src/ia32/codegen-ia32.h +0 -2
  346. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +3 -2
  347. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +28 -3
  348. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +21 -10
  349. data/lib/libv8/v8/src/ia32/frames-ia32.h +6 -5
  350. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +459 -465
  351. data/lib/libv8/v8/src/ia32/ic-ia32.cc +196 -147
  352. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +575 -650
  353. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +19 -21
  354. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +7 -2
  355. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +261 -256
  356. data/lib/libv8/v8/src/ia32/lithium-ia32.h +234 -335
  357. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +224 -67
  358. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +63 -19
  359. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +22 -8
  360. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +3 -0
  361. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +380 -239
  362. data/lib/libv8/v8/src/ic.cc +198 -234
  363. data/lib/libv8/v8/src/ic.h +32 -30
  364. data/lib/libv8/v8/src/interpreter-irregexp.cc +6 -4
  365. data/lib/libv8/v8/src/isolate.cc +112 -95
  366. data/lib/libv8/v8/src/isolate.h +55 -71
  367. data/lib/libv8/v8/src/json-parser.h +486 -48
  368. data/lib/libv8/v8/src/json.js +28 -23
  369. data/lib/libv8/v8/src/jsregexp.cc +163 -208
  370. data/lib/libv8/v8/src/jsregexp.h +0 -1
  371. data/lib/libv8/v8/src/lithium-allocator-inl.h +29 -27
  372. data/lib/libv8/v8/src/lithium-allocator.cc +22 -17
  373. data/lib/libv8/v8/src/lithium-allocator.h +8 -8
  374. data/lib/libv8/v8/src/lithium.cc +16 -11
  375. data/lib/libv8/v8/src/lithium.h +31 -34
  376. data/lib/libv8/v8/src/liveedit.cc +111 -15
  377. data/lib/libv8/v8/src/liveedit.h +3 -4
  378. data/lib/libv8/v8/src/liveobjectlist.cc +116 -80
  379. data/lib/libv8/v8/src/liveobjectlist.h +2 -2
  380. data/lib/libv8/v8/src/log-inl.h +0 -4
  381. data/lib/libv8/v8/src/log-utils.cc +25 -143
  382. data/lib/libv8/v8/src/log-utils.h +13 -92
  383. data/lib/libv8/v8/src/log.cc +26 -249
  384. data/lib/libv8/v8/src/log.h +6 -17
  385. data/lib/libv8/v8/src/macros.py +9 -6
  386. data/lib/libv8/v8/src/mark-compact.cc +276 -56
  387. data/lib/libv8/v8/src/mark-compact.h +20 -0
  388. data/lib/libv8/v8/src/messages.js +93 -39
  389. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +9 -3
  390. data/lib/libv8/v8/src/mips/assembler-mips.cc +297 -189
  391. data/lib/libv8/v8/src/mips/assembler-mips.h +121 -54
  392. data/lib/libv8/v8/src/mips/builtins-mips.cc +23 -24
  393. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +484 -263
  394. data/lib/libv8/v8/src/mips/code-stubs-mips.h +8 -83
  395. data/lib/libv8/v8/src/mips/codegen-mips.h +0 -2
  396. data/lib/libv8/v8/src/mips/constants-mips.h +37 -11
  397. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +6 -1
  398. data/lib/libv8/v8/src/mips/frames-mips.h +8 -7
  399. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +258 -419
  400. data/lib/libv8/v8/src/mips/ic-mips.cc +181 -121
  401. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +640 -382
  402. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +94 -89
  403. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +23 -10
  404. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +6 -1
  405. data/lib/libv8/v8/src/mips/simulator-mips.cc +249 -49
  406. data/lib/libv8/v8/src/mips/simulator-mips.h +25 -1
  407. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +373 -161
  408. data/lib/libv8/v8/src/mirror-debugger.js +55 -8
  409. data/lib/libv8/v8/src/misc-intrinsics.h +89 -0
  410. data/lib/libv8/v8/src/mksnapshot.cc +36 -4
  411. data/lib/libv8/v8/src/natives.h +5 -2
  412. data/lib/libv8/v8/src/objects-debug.cc +73 -6
  413. data/lib/libv8/v8/src/objects-inl.h +529 -164
  414. data/lib/libv8/v8/src/objects-printer.cc +67 -12
  415. data/lib/libv8/v8/src/objects-visiting.cc +13 -2
  416. data/lib/libv8/v8/src/objects-visiting.h +41 -1
  417. data/lib/libv8/v8/src/objects.cc +2200 -1177
  418. data/lib/libv8/v8/src/objects.h +912 -283
  419. data/lib/libv8/v8/src/parser.cc +566 -371
  420. data/lib/libv8/v8/src/parser.h +35 -33
  421. data/lib/libv8/v8/src/platform-cygwin.cc +10 -25
  422. data/lib/libv8/v8/src/platform-freebsd.cc +4 -29
  423. data/lib/libv8/v8/src/platform-linux.cc +60 -57
  424. data/lib/libv8/v8/src/platform-macos.cc +4 -27
  425. data/lib/libv8/v8/src/platform-nullos.cc +3 -16
  426. data/lib/libv8/v8/src/platform-openbsd.cc +247 -85
  427. data/lib/libv8/v8/src/platform-posix.cc +43 -1
  428. data/lib/libv8/v8/src/platform-solaris.cc +151 -112
  429. data/lib/libv8/v8/src/platform-tls.h +1 -1
  430. data/lib/libv8/v8/src/platform-win32.cc +65 -39
  431. data/lib/libv8/v8/src/platform.h +17 -14
  432. data/lib/libv8/v8/src/preparse-data-format.h +2 -2
  433. data/lib/libv8/v8/src/preparse-data.h +8 -2
  434. data/lib/libv8/v8/src/preparser-api.cc +2 -18
  435. data/lib/libv8/v8/src/preparser.cc +106 -65
  436. data/lib/libv8/v8/src/preparser.h +26 -5
  437. data/lib/libv8/v8/src/prettyprinter.cc +25 -43
  438. data/lib/libv8/v8/src/profile-generator-inl.h +0 -4
  439. data/lib/libv8/v8/src/profile-generator.cc +213 -34
  440. data/lib/libv8/v8/src/profile-generator.h +9 -9
  441. data/lib/libv8/v8/src/property.h +1 -0
  442. data/lib/libv8/v8/src/proxy.js +74 -4
  443. data/lib/libv8/v8/src/regexp-macro-assembler.cc +10 -6
  444. data/lib/libv8/v8/src/regexp.js +16 -11
  445. data/lib/libv8/v8/src/rewriter.cc +24 -133
  446. data/lib/libv8/v8/src/runtime-profiler.cc +27 -151
  447. data/lib/libv8/v8/src/runtime-profiler.h +5 -31
  448. data/lib/libv8/v8/src/runtime.cc +1450 -681
  449. data/lib/libv8/v8/src/runtime.h +47 -31
  450. data/lib/libv8/v8/src/runtime.js +2 -1
  451. data/lib/libv8/v8/src/scanner-base.cc +358 -220
  452. data/lib/libv8/v8/src/scanner-base.h +30 -138
  453. data/lib/libv8/v8/src/scanner.cc +0 -18
  454. data/lib/libv8/v8/src/scanner.h +0 -15
  455. data/lib/libv8/v8/src/scopeinfo.cc +3 -1
  456. data/lib/libv8/v8/src/scopeinfo.h +1 -6
  457. data/lib/libv8/v8/src/scopes.cc +243 -253
  458. data/lib/libv8/v8/src/scopes.h +58 -109
  459. data/lib/libv8/v8/src/serialize.cc +12 -54
  460. data/lib/libv8/v8/src/serialize.h +47 -0
  461. data/lib/libv8/v8/src/small-pointer-list.h +25 -0
  462. data/lib/libv8/v8/src/spaces-inl.h +4 -50
  463. data/lib/libv8/v8/src/spaces.cc +64 -131
  464. data/lib/libv8/v8/src/spaces.h +19 -70
  465. data/lib/libv8/v8/src/string-stream.cc +3 -1
  466. data/lib/libv8/v8/src/string.js +10 -6
  467. data/lib/libv8/v8/src/strtod.cc +7 -3
  468. data/lib/libv8/v8/src/stub-cache.cc +59 -129
  469. data/lib/libv8/v8/src/stub-cache.h +42 -54
  470. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +1447 -1339
  471. data/lib/libv8/v8/src/token.cc +4 -4
  472. data/lib/libv8/v8/src/token.h +6 -5
  473. data/lib/libv8/v8/src/type-info.cc +173 -129
  474. data/lib/libv8/v8/src/type-info.h +40 -22
  475. data/lib/libv8/v8/src/utils.cc +25 -304
  476. data/lib/libv8/v8/src/utils.h +118 -3
  477. data/lib/libv8/v8/src/v8-counters.h +3 -6
  478. data/lib/libv8/v8/src/v8.cc +34 -27
  479. data/lib/libv8/v8/src/v8.h +7 -7
  480. data/lib/libv8/v8/src/v8conversions.cc +129 -0
  481. data/lib/libv8/v8/src/v8conversions.h +60 -0
  482. data/lib/libv8/v8/src/v8globals.h +15 -6
  483. data/lib/libv8/v8/src/v8natives.js +300 -78
  484. data/lib/libv8/v8/src/v8threads.cc +14 -6
  485. data/lib/libv8/v8/src/v8threads.h +4 -1
  486. data/lib/libv8/v8/src/v8utils.cc +360 -0
  487. data/lib/libv8/v8/src/v8utils.h +17 -66
  488. data/lib/libv8/v8/src/variables.cc +7 -12
  489. data/lib/libv8/v8/src/variables.h +12 -10
  490. data/lib/libv8/v8/src/version.cc +2 -2
  491. data/lib/libv8/v8/src/vm-state-inl.h +0 -41
  492. data/lib/libv8/v8/src/vm-state.h +0 -11
  493. data/lib/libv8/v8/src/weakmap.js +103 -0
  494. data/lib/libv8/v8/src/x64/assembler-x64.h +6 -3
  495. data/lib/libv8/v8/src/x64/builtins-x64.cc +25 -22
  496. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +523 -250
  497. data/lib/libv8/v8/src/x64/code-stubs-x64.h +8 -71
  498. data/lib/libv8/v8/src/x64/codegen-x64.cc +1 -0
  499. data/lib/libv8/v8/src/x64/codegen-x64.h +0 -2
  500. data/lib/libv8/v8/src/x64/cpu-x64.cc +2 -1
  501. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +40 -8
  502. data/lib/libv8/v8/src/x64/disasm-x64.cc +12 -10
  503. data/lib/libv8/v8/src/x64/frames-x64.h +7 -6
  504. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +310 -415
  505. data/lib/libv8/v8/src/x64/ic-x64.cc +180 -117
  506. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +411 -523
  507. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +11 -6
  508. data/lib/libv8/v8/src/x64/lithium-x64.cc +191 -216
  509. data/lib/libv8/v8/src/x64/lithium-x64.h +112 -263
  510. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +177 -61
  511. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +23 -7
  512. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +21 -9
  513. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +6 -0
  514. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +273 -107
  515. data/lib/libv8/v8/src/zone.cc +31 -22
  516. data/lib/libv8/v8/src/zone.h +12 -6
  517. data/lib/libv8/v8/tools/codemap.js +8 -0
  518. data/lib/libv8/v8/tools/gcmole/Makefile +43 -0
  519. data/lib/libv8/v8/tools/gcmole/gcmole.lua +0 -2
  520. data/lib/libv8/v8/tools/gdb-v8-support.py +154 -0
  521. data/lib/libv8/v8/tools/grokdump.py +44 -35
  522. data/lib/libv8/v8/tools/gyp/v8.gyp +94 -248
  523. data/lib/libv8/v8/tools/js2c.py +83 -52
  524. data/lib/libv8/v8/tools/linux-tick-processor +4 -6
  525. data/lib/libv8/v8/tools/ll_prof.py +3 -3
  526. data/lib/libv8/v8/tools/oom_dump/README +3 -1
  527. data/lib/libv8/v8/tools/presubmit.py +11 -4
  528. data/lib/libv8/v8/tools/profile.js +46 -2
  529. data/lib/libv8/v8/tools/splaytree.js +11 -0
  530. data/lib/libv8/v8/tools/stats-viewer.py +15 -11
  531. data/lib/libv8/v8/tools/test-wrapper-gypbuild.py +227 -0
  532. data/lib/libv8/v8/tools/test.py +28 -8
  533. data/lib/libv8/v8/tools/tickprocessor.js +0 -16
  534. data/lib/libv8/version.rb +1 -1
  535. data/libv8.gemspec +2 -2
  536. metadata +31 -19
  537. data/lib/libv8/scons/engine/SCons/Tool/f03.py +0 -63
  538. data/lib/libv8/v8/src/json-parser.cc +0 -504
@@ -362,7 +362,7 @@ class Scanner {
362
362
  // Call this after setting source_ to the input.
363
363
  void Init() {
364
364
  // Set c0_ (one character ahead)
365
- ASSERT(kCharacterLookaheadBufferSize == 1);
365
+ STATIC_ASSERT(kCharacterLookaheadBufferSize == 1);
366
366
  Advance();
367
367
  // Initialize current_ to not refer to a literal.
368
368
  current_.literal_chars = NULL;
@@ -419,7 +419,7 @@ class Scanner {
419
419
  }
420
420
  }
421
421
 
422
- uc32 ScanHexEscape(uc32 c, int length);
422
+ uc32 ScanHexNumber(int expected_length);
423
423
 
424
424
  // Return the current source position.
425
425
  int source_pos() {
@@ -471,12 +471,16 @@ class JavaScriptScanner : public Scanner {
471
471
 
472
472
  explicit JavaScriptScanner(UnicodeCache* scanner_contants);
473
473
 
474
+ void Initialize(UC16CharacterStream* source);
475
+
474
476
  // Returns the next token.
475
477
  Token::Value Next();
476
478
 
477
- // Returns true if there was a line terminator before the peek'ed token.
478
- bool has_line_terminator_before_next() const {
479
- return has_line_terminator_before_next_;
479
+ // Returns true if there was a line terminator before the peek'ed token,
480
+ // possibly inside a multi-line comment.
481
+ bool HasAnyLineTerminatorBeforeNext() const {
482
+ return has_line_terminator_before_next_ ||
483
+ has_multiline_comment_before_next_;
480
484
  }
481
485
 
482
486
  // Scans the input as a regular expression pattern, previous
@@ -503,6 +507,14 @@ class JavaScriptScanner : public Scanner {
503
507
  // tokens, which is what it is used for.
504
508
  void SeekForward(int pos);
505
509
 
510
+ bool HarmonyBlockScoping() const {
511
+ return harmony_block_scoping_;
512
+ }
513
+ void SetHarmonyBlockScoping(bool block_scoping) {
514
+ harmony_block_scoping_ = block_scoping;
515
+ }
516
+
517
+
506
518
  protected:
507
519
  bool SkipWhiteSpace();
508
520
  Token::Value SkipSingleLineComment();
@@ -525,146 +537,26 @@ class JavaScriptScanner : public Scanner {
525
537
  // Decodes a unicode escape-sequence which is part of an identifier.
526
538
  // If the escape sequence cannot be decoded the result is kBadChar.
527
539
  uc32 ScanIdentifierUnicodeEscape();
540
+ // Recognizes a uniocde escape-sequence and adds its characters,
541
+ // uninterpreted, to the current literal. Used for parsing RegExp
542
+ // flags.
543
+ bool ScanLiteralUnicodeEscape();
528
544
 
529
545
  // Start position of the octal literal last scanned.
530
546
  Location octal_pos_;
531
547
 
548
+ // Whether there is a line terminator whitespace character after
549
+ // the current token, and before the next. Does not count newlines
550
+ // inside multiline comments.
532
551
  bool has_line_terminator_before_next_;
552
+ // Whether there is a multi-line comment that contains a
553
+ // line-terminator after the current token, and before the next.
554
+ bool has_multiline_comment_before_next_;
555
+ // Whether we scan 'let' as a keyword for harmony block scoped
556
+ // let bindings.
557
+ bool harmony_block_scoping_;
533
558
  };
534
559
 
535
-
536
- // ----------------------------------------------------------------------------
537
- // Keyword matching state machine.
538
-
539
- class KeywordMatcher {
540
- // Incrementally recognize keywords.
541
- //
542
- // Recognized keywords:
543
- // break case catch const* continue debugger* default delete do else
544
- // finally false for function if in instanceof native* new null
545
- // return switch this throw true try typeof var void while with
546
- //
547
- // *: Actually "future reserved keywords". These are the only ones we
548
- // recognize, the remaining are allowed as identifiers.
549
- // In ES5 strict mode, we should disallow all reserved keywords.
550
- public:
551
- KeywordMatcher()
552
- : state_(INITIAL),
553
- token_(Token::IDENTIFIER),
554
- keyword_(NULL),
555
- counter_(0),
556
- keyword_token_(Token::ILLEGAL) {}
557
-
558
- Token::Value token() { return token_; }
559
-
560
- inline bool AddChar(unibrow::uchar input) {
561
- if (state_ != UNMATCHABLE) {
562
- Step(input);
563
- }
564
- return state_ != UNMATCHABLE;
565
- }
566
-
567
- void Fail() {
568
- token_ = Token::IDENTIFIER;
569
- state_ = UNMATCHABLE;
570
- }
571
-
572
- private:
573
- enum State {
574
- UNMATCHABLE,
575
- INITIAL,
576
- KEYWORD_PREFIX,
577
- KEYWORD_MATCHED,
578
- C,
579
- CA,
580
- CO,
581
- CON,
582
- D,
583
- DE,
584
- E,
585
- EX,
586
- F,
587
- I,
588
- IM,
589
- IMP,
590
- IN,
591
- N,
592
- P,
593
- PR,
594
- S,
595
- T,
596
- TH,
597
- TR,
598
- V,
599
- W
600
- };
601
-
602
- struct FirstState {
603
- const char* keyword;
604
- State state;
605
- Token::Value token;
606
- };
607
-
608
- // Range of possible first characters of a keyword.
609
- static const unsigned int kFirstCharRangeMin = 'b';
610
- static const unsigned int kFirstCharRangeMax = 'y';
611
- static const unsigned int kFirstCharRangeLength =
612
- kFirstCharRangeMax - kFirstCharRangeMin + 1;
613
- // State map for first keyword character range.
614
- static FirstState first_states_[kFirstCharRangeLength];
615
-
616
- // If input equals keyword's character at position, continue matching keyword
617
- // from that position.
618
- inline bool MatchKeywordStart(unibrow::uchar input,
619
- const char* keyword,
620
- int position,
621
- Token::Value token_if_match) {
622
- if (input != static_cast<unibrow::uchar>(keyword[position])) {
623
- return false;
624
- }
625
- state_ = KEYWORD_PREFIX;
626
- this->keyword_ = keyword;
627
- this->counter_ = position + 1;
628
- this->keyword_token_ = token_if_match;
629
- return true;
630
- }
631
-
632
- // If input equals match character, transition to new state and return true.
633
- inline bool MatchState(unibrow::uchar input, char match, State new_state) {
634
- if (input != static_cast<unibrow::uchar>(match)) {
635
- return false;
636
- }
637
- state_ = new_state;
638
- return true;
639
- }
640
-
641
- inline bool MatchKeyword(unibrow::uchar input,
642
- char match,
643
- State new_state,
644
- Token::Value keyword_token) {
645
- if (input != static_cast<unibrow::uchar>(match)) {
646
- return false;
647
- }
648
- state_ = new_state;
649
- token_ = keyword_token;
650
- return true;
651
- }
652
-
653
- void Step(unibrow::uchar input);
654
-
655
- // Current state.
656
- State state_;
657
- // Token for currently added characters.
658
- Token::Value token_;
659
-
660
- // Matching a specific keyword string (there is only one possible valid
661
- // keyword with the current prefix).
662
- const char* keyword_;
663
- int counter_;
664
- Token::Value keyword_token_;
665
- };
666
-
667
-
668
560
  } } // namespace v8::internal
669
561
 
670
562
  #endif // V8_SCANNER_BASE_H_
@@ -324,22 +324,4 @@ void Scanner::LiteralScope::Complete() {
324
324
  complete_ = true;
325
325
  }
326
326
 
327
-
328
- // ----------------------------------------------------------------------------
329
- // V8JavaScriptScanner
330
-
331
-
332
- void V8JavaScriptScanner::Initialize(UC16CharacterStream* source) {
333
- source_ = source;
334
- // Need to capture identifiers in order to recognize "get" and "set"
335
- // in object literals.
336
- Init();
337
- // Skip initial whitespace allowing HTML comment ends just like
338
- // after a newline and scan first token.
339
- has_line_terminator_before_next_ = true;
340
- SkipWhiteSpace();
341
- Scan();
342
- }
343
-
344
-
345
327
  } } // namespace v8::internal
@@ -126,21 +126,6 @@ class ExternalTwoByteStringUC16CharacterStream: public UC16CharacterStream {
126
126
  const uc16* raw_data_; // Pointer to the actual array of characters.
127
127
  };
128
128
 
129
-
130
- // ----------------------------------------------------------------------------
131
- // V8JavaScriptScanner
132
- // JavaScript scanner getting its input from either a V8 String or a unicode
133
- // CharacterStream.
134
-
135
- class V8JavaScriptScanner : public JavaScriptScanner {
136
- public:
137
- explicit V8JavaScriptScanner(UnicodeCache* unicode_cache)
138
- : JavaScriptScanner(unicode_cache) {}
139
-
140
- void Initialize(UC16CharacterStream* source);
141
- };
142
-
143
-
144
129
  } } // namespace v8::internal
145
130
 
146
131
  #endif // V8_SCANNER_H_
@@ -32,6 +32,8 @@
32
32
  #include "scopeinfo.h"
33
33
  #include "scopes.h"
34
34
 
35
+ #include "allocation-inl.h"
36
+
35
37
  namespace v8 {
36
38
  namespace internal {
37
39
 
@@ -311,7 +313,7 @@ Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() {
311
313
  stack_slots_.length();
312
314
 
313
315
  Handle<SerializedScopeInfo> data(
314
- SerializedScopeInfo::cast(*FACTORY->NewFixedArray(length, TENURED)));
316
+ SerializedScopeInfo::cast(*FACTORY->NewSerializedScopeInfo(length)));
315
317
  AssertNoAllocation nogc;
316
318
 
317
319
  Object** p0 = data->data_start();
@@ -107,7 +107,7 @@ class SerializedScopeInfo : public FixedArray {
107
107
  public :
108
108
 
109
109
  static SerializedScopeInfo* cast(Object* object) {
110
- ASSERT(object->IsFixedArray());
110
+ ASSERT(object->IsSerializedScopeInfo());
111
111
  return reinterpret_cast<SerializedScopeInfo*>(object);
112
112
  }
113
113
 
@@ -117,11 +117,6 @@ class SerializedScopeInfo : public FixedArray {
117
117
  // Is this scope a strict mode scope?
118
118
  bool IsStrictMode();
119
119
 
120
- // Does this scope have an arguments shadow?
121
- bool HasArgumentsShadow() {
122
- return StackSlotIndex(GetHeap()->arguments_shadow_symbol()) >= 0;
123
- }
124
-
125
120
  // Return the number of stack slots for code.
126
121
  int NumberOfStackSlots();
127
122
 
@@ -34,6 +34,8 @@
34
34
  #include "prettyprinter.h"
35
35
  #include "scopeinfo.h"
36
36
 
37
+ #include "allocation-inl.h"
38
+
37
39
  namespace v8 {
38
40
  namespace internal {
39
41
 
@@ -114,70 +116,74 @@ Variable* VariableMap::Lookup(Handle<String> name) {
114
116
 
115
117
  // Dummy constructor
116
118
  Scope::Scope(Type type)
117
- : inner_scopes_(0),
118
- variables_(false),
119
- temps_(0),
120
- params_(0),
121
- unresolved_(0),
122
- decls_(0) {
119
+ : isolate_(Isolate::Current()),
120
+ inner_scopes_(0),
121
+ variables_(false),
122
+ temps_(0),
123
+ params_(0),
124
+ unresolved_(0),
125
+ decls_(0),
126
+ already_resolved_(false) {
123
127
  SetDefaults(type, NULL, Handle<SerializedScopeInfo>::null());
124
- ASSERT(!resolved());
125
128
  }
126
129
 
127
130
 
128
131
  Scope::Scope(Scope* outer_scope, Type type)
129
- : inner_scopes_(4),
130
- variables_(),
131
- temps_(4),
132
- params_(4),
133
- unresolved_(16),
134
- decls_(4) {
132
+ : isolate_(Isolate::Current()),
133
+ inner_scopes_(4),
134
+ variables_(),
135
+ temps_(4),
136
+ params_(4),
137
+ unresolved_(16),
138
+ decls_(4),
139
+ already_resolved_(false) {
135
140
  SetDefaults(type, outer_scope, Handle<SerializedScopeInfo>::null());
136
141
  // At some point we might want to provide outer scopes to
137
142
  // eval scopes (by walking the stack and reading the scope info).
138
143
  // In that case, the ASSERT below needs to be adjusted.
139
144
  ASSERT((type == GLOBAL_SCOPE || type == EVAL_SCOPE) == (outer_scope == NULL));
140
145
  ASSERT(!HasIllegalRedeclaration());
141
- ASSERT(!resolved());
142
146
  }
143
147
 
144
148
 
145
- Scope::Scope(Scope* inner_scope, Handle<SerializedScopeInfo> scope_info)
146
- : inner_scopes_(4),
147
- variables_(),
148
- temps_(4),
149
- params_(4),
150
- unresolved_(16),
151
- decls_(4) {
149
+ Scope::Scope(Scope* inner_scope,
150
+ Type type,
151
+ Handle<SerializedScopeInfo> scope_info)
152
+ : isolate_(Isolate::Current()),
153
+ inner_scopes_(4),
154
+ variables_(),
155
+ temps_(4),
156
+ params_(4),
157
+ unresolved_(16),
158
+ decls_(4),
159
+ already_resolved_(true) {
152
160
  ASSERT(!scope_info.is_null());
153
- SetDefaults(FUNCTION_SCOPE, NULL, scope_info);
154
- ASSERT(resolved());
161
+ SetDefaults(type, NULL, scope_info);
155
162
  if (scope_info->HasHeapAllocatedLocals()) {
156
163
  num_heap_slots_ = scope_info_->NumberOfContextSlots();
157
164
  }
158
-
159
165
  AddInnerScope(inner_scope);
166
+ }
160
167
 
161
- // This scope's arguments shadow (if present) is context-allocated if an inner
162
- // scope accesses this one's parameters. Allocate the arguments_shadow_
163
- // variable if necessary.
164
- Isolate* isolate = Isolate::Current();
165
- Variable::Mode mode;
166
- int arguments_shadow_index =
167
- scope_info_->ContextSlotIndex(
168
- isolate->heap()->arguments_shadow_symbol(), &mode);
169
- if (arguments_shadow_index >= 0) {
170
- ASSERT(mode == Variable::INTERNAL);
171
- arguments_shadow_ = new Variable(
172
- this,
173
- isolate->factory()->arguments_shadow_symbol(),
174
- Variable::INTERNAL,
175
- true,
176
- Variable::ARGUMENTS);
177
- arguments_shadow_->set_rewrite(
178
- new Slot(arguments_shadow_, Slot::CONTEXT, arguments_shadow_index));
179
- arguments_shadow_->set_is_used(true);
180
- }
168
+
169
+ Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name)
170
+ : isolate_(Isolate::Current()),
171
+ inner_scopes_(1),
172
+ variables_(),
173
+ temps_(0),
174
+ params_(0),
175
+ unresolved_(0),
176
+ decls_(0),
177
+ already_resolved_(true) {
178
+ SetDefaults(CATCH_SCOPE, NULL, Handle<SerializedScopeInfo>::null());
179
+ AddInnerScope(inner_scope);
180
+ ++num_var_or_const_;
181
+ Variable* variable = variables_.Declare(this,
182
+ catch_variable_name,
183
+ Variable::VAR,
184
+ true, // Valid left-hand side.
185
+ Variable::NORMAL);
186
+ AllocateHeapSlot(variable);
181
187
  }
182
188
 
183
189
 
@@ -186,12 +192,11 @@ void Scope::SetDefaults(Type type,
186
192
  Handle<SerializedScopeInfo> scope_info) {
187
193
  outer_scope_ = outer_scope;
188
194
  type_ = type;
189
- scope_name_ = FACTORY->empty_symbol();
195
+ scope_name_ = isolate_->factory()->empty_symbol();
190
196
  dynamics_ = NULL;
191
197
  receiver_ = NULL;
192
198
  function_ = NULL;
193
199
  arguments_ = NULL;
194
- arguments_shadow_ = NULL;
195
200
  illegal_redecl_ = NULL;
196
201
  scope_inside_with_ = false;
197
202
  scope_contains_with_ = false;
@@ -212,30 +217,48 @@ void Scope::SetDefaults(Type type,
212
217
 
213
218
  Scope* Scope::DeserializeScopeChain(CompilationInfo* info,
214
219
  Scope* global_scope) {
220
+ // Reconstruct the outer scope chain from a closure's context chain.
215
221
  ASSERT(!info->closure().is_null());
216
- // If we have a serialized scope info, reuse it.
222
+ Context* context = info->closure()->context();
223
+ Scope* current_scope = NULL;
217
224
  Scope* innermost_scope = NULL;
218
- Scope* scope = NULL;
219
-
220
- SerializedScopeInfo* scope_info = info->closure()->shared()->scope_info();
221
- if (scope_info != SerializedScopeInfo::Empty()) {
222
- JSFunction* current = *info->closure();
223
- do {
224
- current = current->context()->closure();
225
- Handle<SerializedScopeInfo> scope_info(current->shared()->scope_info());
226
- if (*scope_info != SerializedScopeInfo::Empty()) {
227
- scope = new Scope(scope, scope_info);
228
- if (innermost_scope == NULL) innermost_scope = scope;
225
+ bool contains_with = false;
226
+ while (!context->IsGlobalContext()) {
227
+ if (context->IsWithContext()) {
228
+ // All the inner scopes are inside a with.
229
+ contains_with = true;
230
+ for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) {
231
+ s->scope_inside_with_ = true;
232
+ }
233
+ } else {
234
+ if (context->IsFunctionContext()) {
235
+ SerializedScopeInfo* scope_info =
236
+ context->closure()->shared()->scope_info();
237
+ current_scope = new Scope(current_scope, FUNCTION_SCOPE,
238
+ Handle<SerializedScopeInfo>(scope_info));
239
+ } else if (context->IsBlockContext()) {
240
+ SerializedScopeInfo* scope_info =
241
+ SerializedScopeInfo::cast(context->extension());
242
+ current_scope = new Scope(current_scope, BLOCK_SCOPE,
243
+ Handle<SerializedScopeInfo>(scope_info));
229
244
  } else {
230
- ASSERT(current->context()->IsGlobalContext());
245
+ ASSERT(context->IsCatchContext());
246
+ String* name = String::cast(context->extension());
247
+ current_scope = new Scope(current_scope, Handle<String>(name));
231
248
  }
232
- } while (!current->context()->IsGlobalContext());
233
- }
249
+ if (contains_with) current_scope->RecordWithStatement();
250
+ if (innermost_scope == NULL) innermost_scope = current_scope;
251
+ }
234
252
 
235
- global_scope->AddInnerScope(scope);
236
- if (innermost_scope == NULL) innermost_scope = global_scope;
253
+ // Forget about a with when we move to a context for a different function.
254
+ if (context->previous()->closure() != context->closure()) {
255
+ contains_with = false;
256
+ }
257
+ context = context->previous();
258
+ }
237
259
 
238
- return innermost_scope;
260
+ global_scope->AddInnerScope(current_scope);
261
+ return (innermost_scope == NULL) ? global_scope : innermost_scope;
239
262
  }
240
263
 
241
264
 
@@ -260,7 +283,7 @@ bool Scope::Analyze(CompilationInfo* info) {
260
283
 
261
284
 
262
285
  void Scope::Initialize(bool inside_with) {
263
- ASSERT(!resolved());
286
+ ASSERT(!already_resolved());
264
287
 
265
288
  // Add this scope as a new inner scope of the outer scope.
266
289
  if (outer_scope_ != NULL) {
@@ -278,73 +301,67 @@ void Scope::Initialize(bool inside_with) {
278
301
  // instead load them directly from the stack. Currently, the only
279
302
  // such parameter is 'this' which is passed on the stack when
280
303
  // invoking scripts
281
- Variable* var =
282
- variables_.Declare(this, FACTORY->this_symbol(), Variable::VAR,
283
- false, Variable::THIS);
284
- var->set_rewrite(new Slot(var, Slot::PARAMETER, -1));
285
- receiver_ = var;
304
+ if (is_catch_scope() || is_block_scope()) {
305
+ ASSERT(outer_scope() != NULL);
306
+ receiver_ = outer_scope()->receiver();
307
+ } else {
308
+ ASSERT(is_function_scope() ||
309
+ is_global_scope() ||
310
+ is_eval_scope());
311
+ Variable* var =
312
+ variables_.Declare(this,
313
+ isolate_->factory()->this_symbol(),
314
+ Variable::VAR,
315
+ false,
316
+ Variable::THIS);
317
+ var->set_rewrite(NewSlot(var, Slot::PARAMETER, -1));
318
+ receiver_ = var;
319
+ }
286
320
 
287
321
  if (is_function_scope()) {
288
322
  // Declare 'arguments' variable which exists in all functions.
289
323
  // Note that it might never be accessed, in which case it won't be
290
324
  // allocated during variable allocation.
291
- variables_.Declare(this, FACTORY->arguments_symbol(), Variable::VAR,
292
- true, Variable::ARGUMENTS);
325
+ variables_.Declare(this,
326
+ isolate_->factory()->arguments_symbol(),
327
+ Variable::VAR,
328
+ true,
329
+ Variable::ARGUMENTS);
293
330
  }
294
331
  }
295
332
 
296
333
 
297
334
  Variable* Scope::LocalLookup(Handle<String> name) {
298
335
  Variable* result = variables_.Lookup(name);
299
- if (result != NULL || !resolved()) {
336
+ if (result != NULL || scope_info_.is_null()) {
300
337
  return result;
301
338
  }
302
- // If the scope is resolved, we can find a variable in serialized scope info.
303
-
304
- // We should never lookup 'arguments' in this scope
305
- // as it is implicitly present in any scope.
306
- ASSERT(*name != *FACTORY->arguments_symbol());
307
-
308
- // Assert that there is no local slot with the given name.
339
+ // If we have a serialized scope info, we might find the variable there.
340
+ //
341
+ // We should never lookup 'arguments' in this scope as it is implicitly
342
+ // present in every scope.
343
+ ASSERT(*name != *isolate_->factory()->arguments_symbol());
344
+ // There should be no local slot with the given name.
309
345
  ASSERT(scope_info_->StackSlotIndex(*name) < 0);
310
346
 
311
347
  // Check context slot lookup.
312
348
  Variable::Mode mode;
313
349
  int index = scope_info_->ContextSlotIndex(*name, &mode);
314
- if (index >= 0) {
315
- Variable* var =
316
- variables_.Declare(this, name, mode, true, Variable::NORMAL);
317
- var->set_rewrite(new Slot(var, Slot::CONTEXT, index));
318
- return var;
319
- }
320
-
321
- index = scope_info_->ParameterIndex(*name);
322
- if (index >= 0) {
323
- // ".arguments" must be present in context slots.
324
- ASSERT(arguments_shadow_ != NULL);
325
- Variable* var =
326
- variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL);
327
- Property* rewrite =
328
- new Property(new VariableProxy(arguments_shadow_),
329
- new Literal(Handle<Object>(Smi::FromInt(index))),
330
- RelocInfo::kNoPosition,
331
- Property::SYNTHETIC);
332
- rewrite->set_is_arguments_access(true);
333
- var->set_rewrite(rewrite);
334
- return var;
335
- }
336
-
337
- index = scope_info_->FunctionContextSlotIndex(*name);
338
- if (index >= 0) {
339
- // Check that there is no local slot with the given name.
340
- ASSERT(scope_info_->StackSlotIndex(*name) < 0);
341
- Variable* var =
342
- variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL);
343
- var->set_rewrite(new Slot(var, Slot::CONTEXT, index));
344
- return var;
350
+ if (index < 0) {
351
+ // Check parameters.
352
+ mode = Variable::VAR;
353
+ index = scope_info_->ParameterIndex(*name);
354
+ if (index < 0) {
355
+ // Check the function name.
356
+ index = scope_info_->FunctionContextSlotIndex(*name);
357
+ if (index < 0) return NULL;
358
+ }
345
359
  }
346
360
 
347
- return NULL;
361
+ Variable* var =
362
+ variables_.Declare(this, name, mode, true, Variable::NORMAL);
363
+ var->set_rewrite(NewSlot(var, Slot::CONTEXT, index));
364
+ return var;
348
365
  }
349
366
 
350
367
 
@@ -366,17 +383,24 @@ Variable* Scope::DeclareFunctionVar(Handle<String> name) {
366
383
  }
367
384
 
368
385
 
369
- Variable* Scope::DeclareLocal(Handle<String> name,
370
- Variable::Mode mode,
371
- LocalType type) {
372
- // DYNAMIC variables are introduces during variable allocation,
373
- // INTERNAL variables are allocated explicitly, and TEMPORARY
374
- // variables are allocated via NewTemporary().
375
- ASSERT(!resolved());
376
- ASSERT(mode == Variable::VAR || mode == Variable::CONST);
377
- if (type == VAR_OR_CONST) {
378
- num_var_or_const_++;
379
- }
386
+ void Scope::DeclareParameter(Handle<String> name) {
387
+ ASSERT(!already_resolved());
388
+ ASSERT(is_function_scope());
389
+ Variable* var =
390
+ variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL);
391
+ params_.Add(var);
392
+ }
393
+
394
+
395
+ Variable* Scope::DeclareLocal(Handle<String> name, Variable::Mode mode) {
396
+ ASSERT(!already_resolved());
397
+ // This function handles VAR and CONST modes. DYNAMIC variables are
398
+ // introduces during variable allocation, INTERNAL variables are allocated
399
+ // explicitly, and TEMPORARY variables are allocated via NewTemporary().
400
+ ASSERT(mode == Variable::VAR ||
401
+ mode == Variable::CONST ||
402
+ mode == Variable::LET);
403
+ ++num_var_or_const_;
380
404
  return variables_.Declare(this, name, mode, true, Variable::NORMAL);
381
405
  }
382
406
 
@@ -388,21 +412,15 @@ Variable* Scope::DeclareGlobal(Handle<String> name) {
388
412
  }
389
413
 
390
414
 
391
- void Scope::AddParameter(Variable* var) {
392
- ASSERT(is_function_scope());
393
- ASSERT(LocalLookup(var->name()) == var);
394
- params_.Add(var);
395
- }
396
-
397
-
398
415
  VariableProxy* Scope::NewUnresolved(Handle<String> name,
399
416
  bool inside_with,
400
417
  int position) {
401
418
  // Note that we must not share the unresolved variables with
402
419
  // the same name because they may be removed selectively via
403
420
  // RemoveUnresolved().
404
- ASSERT(!resolved());
405
- VariableProxy* proxy = new VariableProxy(name, false, inside_with, position);
421
+ ASSERT(!already_resolved());
422
+ VariableProxy* proxy = new(isolate_->zone()) VariableProxy(
423
+ isolate_, name, false, inside_with, position);
406
424
  unresolved_.Add(proxy);
407
425
  return proxy;
408
426
  }
@@ -421,7 +439,7 @@ void Scope::RemoveUnresolved(VariableProxy* var) {
421
439
 
422
440
 
423
441
  Variable* Scope::NewTemporary(Handle<String> name) {
424
- ASSERT(!resolved());
442
+ ASSERT(!already_resolved());
425
443
  Variable* var =
426
444
  new Variable(this, name, Variable::TEMPORARY, true, Variable::NORMAL);
427
445
  temps_.Add(var);
@@ -551,12 +569,32 @@ int Scope::ContextChainLength(Scope* scope) {
551
569
  }
552
570
 
553
571
 
572
+ Scope* Scope::DeclarationScope() {
573
+ Scope* scope = this;
574
+ while (scope->is_catch_scope() ||
575
+ scope->is_block_scope()) {
576
+ scope = scope->outer_scope();
577
+ }
578
+ return scope;
579
+ }
580
+
581
+
582
+ Handle<SerializedScopeInfo> Scope::GetSerializedScopeInfo() {
583
+ if (scope_info_.is_null()) {
584
+ scope_info_ = SerializedScopeInfo::Create(this);
585
+ }
586
+ return scope_info_;
587
+ }
588
+
589
+
554
590
  #ifdef DEBUG
555
591
  static const char* Header(Scope::Type type) {
556
592
  switch (type) {
557
593
  case Scope::EVAL_SCOPE: return "eval";
558
594
  case Scope::FUNCTION_SCOPE: return "function";
559
595
  case Scope::GLOBAL_SCOPE: return "global";
596
+ case Scope::CATCH_SCOPE: return "catch";
597
+ case Scope::BLOCK_SCOPE: return "block";
560
598
  }
561
599
  UNREACHABLE();
562
600
  return NULL;
@@ -582,9 +620,11 @@ static void PrintVar(PrettyPrinter* printer, int indent, Variable* var) {
582
620
  PrintF("; // ");
583
621
  if (var->rewrite() != NULL) {
584
622
  PrintF("%s, ", printer->Print(var->rewrite()));
585
- if (var->is_accessed_from_inner_scope()) PrintF(", ");
623
+ if (var->is_accessed_from_inner_function_scope()) PrintF(", ");
624
+ }
625
+ if (var->is_accessed_from_inner_function_scope()) {
626
+ PrintF("inner scope access");
586
627
  }
587
- if (var->is_accessed_from_inner_scope()) PrintF("inner scope access");
588
628
  PrintF("\n");
589
629
  }
590
630
  }
@@ -692,7 +732,7 @@ Variable* Scope::NonLocal(Handle<String> name, Variable::Mode mode) {
692
732
  // Declare a new non-local.
693
733
  var = map->Declare(NULL, name, mode, true, Variable::NORMAL);
694
734
  // Allocate it by giving it a dynamic lookup.
695
- var->set_rewrite(new Slot(var, Slot::LOOKUP, -1));
735
+ var->set_rewrite(NewSlot(var, Slot::LOOKUP, -1));
696
736
  }
697
737
  return var;
698
738
  }
@@ -705,7 +745,7 @@ Variable* Scope::NonLocal(Handle<String> name, Variable::Mode mode) {
705
745
  // another variable that is introduced dynamically via an 'eval' call
706
746
  // or a 'with' statement).
707
747
  Variable* Scope::LookupRecursive(Handle<String> name,
708
- bool inner_lookup,
748
+ bool from_inner_function,
709
749
  Variable** invalidated_local) {
710
750
  // If we find a variable, but the current scope calls 'eval', the found
711
751
  // variable may not be the correct one (the 'eval' may introduce a
@@ -721,7 +761,7 @@ Variable* Scope::LookupRecursive(Handle<String> name,
721
761
  // (Even if there is an 'eval' in this scope which introduces the
722
762
  // same variable again, the resulting variable remains the same.
723
763
  // Note that enclosing 'with' statements are handled at the call site.)
724
- if (!inner_lookup)
764
+ if (!from_inner_function)
725
765
  return var;
726
766
 
727
767
  } else {
@@ -737,7 +777,10 @@ Variable* Scope::LookupRecursive(Handle<String> name,
737
777
  var = function_;
738
778
 
739
779
  } else if (outer_scope_ != NULL) {
740
- var = outer_scope_->LookupRecursive(name, true, invalidated_local);
780
+ var = outer_scope_->LookupRecursive(
781
+ name,
782
+ is_function_scope() || from_inner_function,
783
+ invalidated_local);
741
784
  // We may have found a variable in an outer scope. However, if
742
785
  // the current scope is inside a 'with', the actual variable may
743
786
  // be a property introduced via the 'with' statement. Then, the
@@ -754,8 +797,8 @@ Variable* Scope::LookupRecursive(Handle<String> name,
754
797
  ASSERT(var != NULL);
755
798
 
756
799
  // If this is a lookup from an inner scope, mark the variable.
757
- if (inner_lookup) {
758
- var->MarkAsAccessedFromInnerScope();
800
+ if (from_inner_function) {
801
+ var->MarkAsAccessedFromInnerFunctionScope();
759
802
  }
760
803
 
761
804
  // If the variable we have found is just a guess, invalidate the
@@ -906,9 +949,12 @@ bool Scope::MustAllocate(Variable* var) {
906
949
  // via an eval() call. This is only possible if the variable has a
907
950
  // visible name.
908
951
  if ((var->is_this() || var->name()->length() > 0) &&
909
- (var->is_accessed_from_inner_scope() ||
910
- scope_calls_eval_ || inner_scope_calls_eval_ ||
911
- scope_contains_with_)) {
952
+ (var->is_accessed_from_inner_function_scope() ||
953
+ scope_calls_eval_ ||
954
+ inner_scope_calls_eval_ ||
955
+ scope_contains_with_ ||
956
+ is_catch_scope() ||
957
+ is_block_scope())) {
912
958
  var->set_is_used(true);
913
959
  }
914
960
  // Global variables do not need to be allocated.
@@ -917,73 +963,60 @@ bool Scope::MustAllocate(Variable* var) {
917
963
 
918
964
 
919
965
  bool Scope::MustAllocateInContext(Variable* var) {
920
- // If var is accessed from an inner scope, or if there is a
921
- // possibility that it might be accessed from the current or an inner
922
- // scope (through an eval() call), it must be allocated in the
923
- // context. Exception: temporary variables are not allocated in the
966
+ // If var is accessed from an inner scope, or if there is a possibility
967
+ // that it might be accessed from the current or an inner scope (through
968
+ // an eval() call or a runtime with lookup), it must be allocated in the
924
969
  // context.
925
- return
926
- var->mode() != Variable::TEMPORARY &&
927
- (var->is_accessed_from_inner_scope() ||
928
- scope_calls_eval_ || inner_scope_calls_eval_ ||
929
- scope_contains_with_ || var->is_global());
970
+ //
971
+ // Exceptions: temporary variables are never allocated in a context;
972
+ // catch-bound variables are always allocated in a context.
973
+ if (var->mode() == Variable::TEMPORARY) return false;
974
+ if (is_catch_scope() || is_block_scope()) return true;
975
+ return var->is_accessed_from_inner_function_scope() ||
976
+ scope_calls_eval_ ||
977
+ inner_scope_calls_eval_ ||
978
+ scope_contains_with_ ||
979
+ var->is_global();
930
980
  }
931
981
 
932
982
 
933
983
  bool Scope::HasArgumentsParameter() {
934
984
  for (int i = 0; i < params_.length(); i++) {
935
- if (params_[i]->name().is_identical_to(FACTORY->arguments_symbol()))
985
+ if (params_[i]->name().is_identical_to(
986
+ isolate_->factory()->arguments_symbol())) {
936
987
  return true;
988
+ }
937
989
  }
938
990
  return false;
939
991
  }
940
992
 
941
993
 
942
994
  void Scope::AllocateStackSlot(Variable* var) {
943
- var->set_rewrite(new Slot(var, Slot::LOCAL, num_stack_slots_++));
995
+ var->set_rewrite(NewSlot(var, Slot::LOCAL, num_stack_slots_++));
944
996
  }
945
997
 
946
998
 
947
999
  void Scope::AllocateHeapSlot(Variable* var) {
948
- var->set_rewrite(new Slot(var, Slot::CONTEXT, num_heap_slots_++));
1000
+ var->set_rewrite(NewSlot(var, Slot::CONTEXT, num_heap_slots_++));
949
1001
  }
950
1002
 
951
1003
 
952
1004
  void Scope::AllocateParameterLocals() {
953
1005
  ASSERT(is_function_scope());
954
- Variable* arguments = LocalLookup(FACTORY->arguments_symbol());
1006
+ Variable* arguments = LocalLookup(isolate_->factory()->arguments_symbol());
955
1007
  ASSERT(arguments != NULL); // functions have 'arguments' declared implicitly
956
1008
 
957
- // Parameters are rewritten to arguments[i] if 'arguments' is used in
958
- // a non-strict mode function. Strict mode code doesn't alias arguments.
959
- bool rewrite_parameters = false;
1009
+ bool uses_nonstrict_arguments = false;
960
1010
 
961
1011
  if (MustAllocate(arguments) && !HasArgumentsParameter()) {
962
1012
  // 'arguments' is used. Unless there is also a parameter called
963
- // 'arguments', we must be conservative and access all parameters via
964
- // the arguments object: The i'th parameter is rewritten into
965
- // '.arguments[i]' (*). If we have a parameter named 'arguments', a
966
- // (new) value is always assigned to it via the function
967
- // invocation. Then 'arguments' denotes that specific parameter value
968
- // and cannot be used to access the parameters, which is why we don't
969
- // need to rewrite in that case.
970
- //
971
- // (*) Instead of having a parameter called 'arguments', we may have an
972
- // assignment to 'arguments' in the function body, at some arbitrary
973
- // point in time (possibly through an 'eval()' call!). After that
974
- // assignment any re-write of parameters would be invalid (was bug
975
- // 881452). Thus, we introduce a shadow '.arguments'
976
- // variable which also points to the arguments object. For rewrites we
977
- // use '.arguments' which remains valid even if we assign to
978
- // 'arguments'. To summarize: If we need to rewrite, we allocate an
979
- // 'arguments' object dynamically upon function invocation. The compiler
980
- // introduces 2 local variables 'arguments' and '.arguments', both of
981
- // which originally point to the arguments object that was
982
- // allocated. All parameters are rewritten into property accesses via
983
- // the '.arguments' variable. Thus, any changes to properties of
984
- // 'arguments' are reflected in the variables and vice versa. If the
985
- // 'arguments' variable is changed, '.arguments' still points to the
986
- // correct arguments object and the rewrites still work.
1013
+ // 'arguments', we must be conservative and allocate all parameters to
1014
+ // the context assuming they will be captured by the arguments object.
1015
+ // If we have a parameter named 'arguments', a (new) value is always
1016
+ // assigned to it via the function invocation. Then 'arguments' denotes
1017
+ // that specific parameter value and cannot be used to access the
1018
+ // parameters, which is why we don't need to allocate an arguments
1019
+ // object in that case.
987
1020
 
988
1021
  // We are using 'arguments'. Tell the code generator that is needs to
989
1022
  // allocate the arguments object by setting 'arguments_'.
@@ -992,76 +1025,32 @@ void Scope::AllocateParameterLocals() {
992
1025
  // In strict mode 'arguments' does not alias formal parameters.
993
1026
  // Therefore in strict mode we allocate parameters as if 'arguments'
994
1027
  // were not used.
995
- rewrite_parameters = !is_strict_mode();
1028
+ uses_nonstrict_arguments = !is_strict_mode();
996
1029
  }
997
1030
 
998
- if (rewrite_parameters) {
999
- // We also need the '.arguments' shadow variable. Declare it and create
1000
- // and bind the corresponding proxy. It's ok to declare it only now
1001
- // because it's a local variable that is allocated after the parameters
1002
- // have been allocated.
1003
- //
1004
- // Note: This is "almost" at temporary variable but we cannot use
1005
- // NewTemporary() because the mode needs to be INTERNAL since this
1006
- // variable may be allocated in the heap-allocated context (temporaries
1007
- // are never allocated in the context).
1008
- arguments_shadow_ = new Variable(this,
1009
- FACTORY->arguments_shadow_symbol(),
1010
- Variable::INTERNAL,
1011
- true,
1012
- Variable::ARGUMENTS);
1013
- arguments_shadow_->set_is_used(true);
1014
- temps_.Add(arguments_shadow_);
1015
-
1016
- // Allocate the parameters by rewriting them into '.arguments[i]' accesses.
1017
- for (int i = 0; i < params_.length(); i++) {
1018
- Variable* var = params_[i];
1019
- ASSERT(var->scope() == this);
1020
- if (MustAllocate(var)) {
1021
- if (MustAllocateInContext(var)) {
1022
- // It is ok to set this only now, because arguments is a local
1023
- // variable that is allocated after the parameters have been
1024
- // allocated.
1025
- arguments_shadow_->MarkAsAccessedFromInnerScope();
1026
- }
1027
- Property* rewrite =
1028
- new Property(new VariableProxy(arguments_shadow_),
1029
- new Literal(Handle<Object>(Smi::FromInt(i))),
1030
- RelocInfo::kNoPosition,
1031
- Property::SYNTHETIC);
1032
- rewrite->set_is_arguments_access(true);
1033
- var->set_rewrite(rewrite);
1034
- }
1031
+ // The same parameter may occur multiple times in the parameters_ list.
1032
+ // If it does, and if it is not copied into the context object, it must
1033
+ // receive the highest parameter index for that parameter; thus iteration
1034
+ // order is relevant!
1035
+ for (int i = params_.length() - 1; i >= 0; --i) {
1036
+ Variable* var = params_[i];
1037
+ ASSERT(var->scope() == this);
1038
+ if (uses_nonstrict_arguments) {
1039
+ // Give the parameter a use from an inner scope, to force allocation
1040
+ // to the context.
1041
+ var->MarkAsAccessedFromInnerFunctionScope();
1035
1042
  }
1036
1043
 
1037
- } else {
1038
- // The arguments object is not used, so we can access parameters directly.
1039
- // The same parameter may occur multiple times in the parameters_ list.
1040
- // If it does, and if it is not copied into the context object, it must
1041
- // receive the highest parameter index for that parameter; thus iteration
1042
- // order is relevant!
1043
- for (int i = 0; i < params_.length(); i++) {
1044
- Variable* var = params_[i];
1045
- ASSERT(var->scope() == this);
1046
- if (MustAllocate(var)) {
1047
- if (MustAllocateInContext(var)) {
1048
- ASSERT(var->rewrite() == NULL ||
1049
- (var->AsSlot() != NULL &&
1050
- var->AsSlot()->type() == Slot::CONTEXT));
1051
- if (var->rewrite() == NULL) {
1052
- // Only set the heap allocation if the parameter has not
1053
- // been allocated yet.
1054
- AllocateHeapSlot(var);
1055
- }
1056
- } else {
1057
- ASSERT(var->rewrite() == NULL ||
1058
- (var->AsSlot() != NULL &&
1059
- var->AsSlot()->type() == Slot::PARAMETER));
1060
- // Set the parameter index always, even if the parameter
1061
- // was seen before! (We need to access the actual parameter
1062
- // supplied for the last occurrence of a multiply declared
1063
- // parameter.)
1064
- var->set_rewrite(new Slot(var, Slot::PARAMETER, i));
1044
+ if (MustAllocate(var)) {
1045
+ if (MustAllocateInContext(var)) {
1046
+ ASSERT(var->rewrite() == NULL || var->IsContextSlot());
1047
+ if (var->rewrite() == NULL) {
1048
+ AllocateHeapSlot(var);
1049
+ }
1050
+ } else {
1051
+ ASSERT(var->rewrite() == NULL || var->IsParameter());
1052
+ if (var->rewrite() == NULL) {
1053
+ var->set_rewrite(NewSlot(var, Slot::PARAMETER, i));
1065
1054
  }
1066
1055
  }
1067
1056
  }
@@ -1072,8 +1061,9 @@ void Scope::AllocateParameterLocals() {
1072
1061
  void Scope::AllocateNonParameterLocal(Variable* var) {
1073
1062
  ASSERT(var->scope() == this);
1074
1063
  ASSERT(var->rewrite() == NULL ||
1075
- (!var->IsVariable(FACTORY->result_symbol())) ||
1076
- (var->AsSlot() == NULL || var->AsSlot()->type() != Slot::LOCAL));
1064
+ !var->IsVariable(isolate_->factory()->result_symbol()) ||
1065
+ var->AsSlot() == NULL ||
1066
+ var->AsSlot()->type() != Slot::LOCAL);
1077
1067
  if (var->rewrite() == NULL && MustAllocate(var)) {
1078
1068
  if (MustAllocateInContext(var)) {
1079
1069
  AllocateHeapSlot(var);
@@ -1115,7 +1105,7 @@ void Scope::AllocateVariablesRecursively() {
1115
1105
 
1116
1106
  // If scope is already resolved, we still need to allocate
1117
1107
  // variables in inner scopes which might not had been resolved yet.
1118
- if (resolved()) return;
1108
+ if (already_resolved()) return;
1119
1109
  // The number of slots required for variables.
1120
1110
  num_stack_slots_ = 0;
1121
1111
  num_heap_slots_ = Context::MIN_CONTEXT_SLOTS;