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
@@ -26,10 +26,10 @@
26
26
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  from os.path import join
29
- Import('context')
29
+ Import('context tools')
30
30
 
31
31
  def ConfigureObjectFiles():
32
- env = Environment()
32
+ env = Environment(tools=tools)
33
33
  env.Replace(**context.flags['preparser'])
34
34
  context.ApplyEnvOverrides(env)
35
35
  return env.Object('preparser-process.cc')
@@ -208,7 +208,7 @@ void fail(v8::PreParserData* data, const char* message, ...) {
208
208
  fflush(stderr);
209
209
  }
210
210
  exit(EXIT_FAILURE);
211
- };
211
+ }
212
212
 
213
213
 
214
214
  bool IsFlag(const char* arg) {
@@ -290,12 +290,12 @@ ExceptionExpectation ParseExpectation(int argc, const char* argv[]) {
290
290
  arg_index++;
291
291
  } while (argc > arg_index && IsFlag(argv[arg_index]));
292
292
  if (argc > arg_index) {
293
- expects.beg_pos = atoi(argv[arg_index]);
293
+ expects.beg_pos = atoi(argv[arg_index]); // NOLINT
294
294
  do {
295
295
  arg_index++;
296
296
  } while (argc > arg_index && IsFlag(argv[arg_index]));
297
297
  if (argc > arg_index) {
298
- expects.end_pos = atoi(argv[arg_index]);
298
+ expects.end_pos = atoi(argv[arg_index]); // NOLINT
299
299
  }
300
300
  }
301
301
  }
@@ -0,0 +1,42 @@
1
+ # Copyright 2011 the V8 project authors. All rights reserved.
2
+ # Redistribution and use in source and binary forms, with or without
3
+ # modification, are permitted provided that the following conditions are
4
+ # met:
5
+ #
6
+ # * Redistributions of source code must retain the above copyright
7
+ # notice, this list of conditions and the following disclaimer.
8
+ # * Redistributions in binary form must reproduce the above
9
+ # copyright notice, this list of conditions and the following
10
+ # disclaimer in the documentation and/or other materials provided
11
+ # with the distribution.
12
+ # * Neither the name of Google Inc. nor the names of its
13
+ # contributors may be used to endorse or promote products derived
14
+ # from this software without specific prior written permission.
15
+ #
16
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ {
29
+ 'includes': ['../build/common.gypi'],
30
+ 'targets': [
31
+ {
32
+ 'target_name': 'preparser',
33
+ 'type': 'executable',
34
+ 'dependencies': [
35
+ '../tools/gyp/v8.gyp:preparser_lib',
36
+ ],
37
+ 'sources': [
38
+ 'preparser-process.cc',
39
+ ],
40
+ },
41
+ ],
42
+ }
@@ -32,6 +32,7 @@ sys.path.append(join(root_dir, 'tools'))
32
32
  import js2c
33
33
  Import('context')
34
34
  Import('tools')
35
+ Import('d8_env')
35
36
 
36
37
 
37
38
  SOURCES = {
@@ -65,6 +66,7 @@ SOURCES = {
65
66
  disassembler.cc
66
67
  diy-fp.cc
67
68
  dtoa.cc
69
+ elements.cc
68
70
  execution.cc
69
71
  factory.cc
70
72
  flags.cc
@@ -85,7 +87,6 @@ SOURCES = {
85
87
  inspector.cc
86
88
  interpreter-irregexp.cc
87
89
  isolate.cc
88
- json-parser.cc
89
90
  jsregexp.cc
90
91
  lithium-allocator.cc
91
92
  lithium.cc
@@ -127,7 +128,9 @@ SOURCES = {
127
128
  utils.cc
128
129
  v8-counters.cc
129
130
  v8.cc
131
+ v8conversions.cc
130
132
  v8threads.cc
133
+ v8utils.cc
131
134
  variables.cc
132
135
  version.cc
133
136
  zone.cc
@@ -237,11 +240,19 @@ PREPARSER_SOURCES = {
237
240
  scanner-base.cc
238
241
  token.cc
239
242
  unicode.cc
243
+ utils.cc
240
244
  """)
241
245
  }
242
246
 
243
247
 
244
- D8_FILES = {
248
+ D8_LIGHT_FILES = {
249
+ 'all': [
250
+ 'd8.cc'
251
+ ]
252
+ }
253
+
254
+
255
+ D8_FULL_FILES = {
245
256
  'all': [
246
257
  'd8.cc', 'd8-debug.cc'
247
258
  ],
@@ -298,6 +309,7 @@ debug-debugger.js
298
309
 
299
310
  EXPERIMENTAL_LIBRARY_FILES = '''
300
311
  proxy.js
312
+ weakmap.js
301
313
  '''.split()
302
314
 
303
315
 
@@ -313,26 +325,39 @@ def ConfigureObjectFiles():
313
325
  env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C)
314
326
  env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile "$LOGFILE" --log-snapshot-positions')
315
327
 
328
+ def BuildJS2CEnv(type):
329
+ js2c_env = { 'TYPE': type, 'COMPRESSION': 'off' }
330
+ if 'COMPRESS_STARTUP_DATA_BZ2' in env['CPPDEFINES']:
331
+ js2c_env['COMPRESSION'] = 'bz2'
332
+ return js2c_env
333
+
316
334
  # Build the standard platform-independent source files.
317
335
  source_files = context.GetRelevantSources(SOURCES)
318
-
319
- d8_files = context.GetRelevantSources(D8_FILES)
320
- d8_js = env.JS2C('d8-js.cc', 'd8.js', TYPE='D8')
336
+ d8_js = env.JS2C('d8-js.cc', 'd8.js', **{'TYPE': 'D8', 'COMPRESSION': 'off'})
321
337
  d8_js_obj = context.ConfigureObject(env, d8_js, CPPPATH=['.'])
322
- d8_objs = [context.ConfigureObject(env, [d8_files]), d8_js_obj]
338
+ if context.options['library'] == 'shared':
339
+ d8_files = context.GetRelevantSources(D8_LIGHT_FILES)
340
+ d8_objs = []
341
+ else:
342
+ d8_files = context.GetRelevantSources(D8_FULL_FILES)
343
+ d8_objs = [d8_js_obj]
344
+ d8_objs.append(context.ConfigureObject(d8_env, [d8_files]))
323
345
 
324
346
  # Combine the JavaScript library files into a single C++ file and
325
347
  # compile it.
326
348
  library_files = [s for s in LIBRARY_FILES]
327
349
  library_files.append('macros.py')
328
- libraries_src = env.JS2C(['libraries.cc'], library_files, TYPE='CORE')
350
+ libraries_src = env.JS2C(
351
+ ['libraries.cc'], library_files, **BuildJS2CEnv('CORE'))
329
352
  libraries_obj = context.ConfigureObject(env, libraries_src, CPPPATH=['.'])
330
353
 
331
354
  # Combine the experimental JavaScript library files into a C++ file
332
355
  # and compile it.
333
356
  experimental_library_files = [ s for s in EXPERIMENTAL_LIBRARY_FILES ]
334
357
  experimental_library_files.append('macros.py')
335
- experimental_libraries_src = env.JS2C(['experimental-libraries.cc'], experimental_library_files, TYPE='EXPERIMENTAL')
358
+ experimental_libraries_src = env.JS2C(['experimental-libraries.cc'],
359
+ experimental_library_files,
360
+ **BuildJS2CEnv('EXPERIMENTAL'))
336
361
  experimental_libraries_obj = context.ConfigureObject(env, experimental_libraries_src, CPPPATH=['.'])
337
362
 
338
363
  source_objs = context.ConfigureObject(env, source_files)
@@ -102,6 +102,15 @@ Object* Accessors::FlattenNumber(Object* value) {
102
102
 
103
103
  MaybeObject* Accessors::ArraySetLength(JSObject* object, Object* value, void*) {
104
104
  Isolate* isolate = object->GetIsolate();
105
+
106
+ // This means one of the object's prototypes is a JSArray and the
107
+ // object does not have a 'length' property. Calling SetProperty
108
+ // causes an infinite loop.
109
+ if (!object->IsJSArray()) {
110
+ return object->SetLocalPropertyIgnoreAttributes(
111
+ isolate->heap()->length_symbol(), value, NONE);
112
+ }
113
+
105
114
  value = FlattenNumber(value);
106
115
 
107
116
  // Need to call methods that may trigger GC.
@@ -117,20 +126,8 @@ MaybeObject* Accessors::ArraySetLength(JSObject* object, Object* value, void*) {
117
126
  Handle<Object> number_v = Execution::ToNumber(value_handle, &has_exception);
118
127
  if (has_exception) return Failure::Exception();
119
128
 
120
- // Restore raw pointers,
121
- object = *object_handle;
122
- value = *value_handle;
123
-
124
129
  if (uint32_v->Number() == number_v->Number()) {
125
- if (object->IsJSArray()) {
126
- return JSArray::cast(object)->SetElementsLength(*uint32_v);
127
- } else {
128
- // This means one of the object's prototypes is a JSArray and
129
- // the object does not have a 'length' property.
130
- // Calling SetProperty causes an infinite loop.
131
- return object->SetLocalPropertyIgnoreAttributes(
132
- isolate->heap()->length_symbol(), value, NONE);
133
- }
130
+ return Handle<JSArray>::cast(object_handle)->SetElementsLength(*uint32_v);
134
131
  }
135
132
  return isolate->Throw(
136
133
  *isolate->factory()->NewRangeError("invalid_array_length",
@@ -683,6 +680,51 @@ static MaybeObject* CheckNonStrictCallerOrThrow(
683
680
  }
684
681
 
685
682
 
683
+ class FrameFunctionIterator {
684
+ public:
685
+ FrameFunctionIterator(Isolate* isolate, const AssertNoAllocation& promise)
686
+ : frame_iterator_(isolate),
687
+ functions_(2),
688
+ index_(0) {
689
+ GetFunctions();
690
+ }
691
+ JSFunction* next() {
692
+ if (functions_.length() == 0) return NULL;
693
+ JSFunction* next_function = functions_[index_];
694
+ index_--;
695
+ if (index_ < 0) {
696
+ GetFunctions();
697
+ }
698
+ return next_function;
699
+ }
700
+
701
+ // Iterate through functions until the first occurence of 'function'.
702
+ // Returns true if 'function' is found, and false if the iterator ends
703
+ // without finding it.
704
+ bool Find(JSFunction* function) {
705
+ JSFunction* next_function;
706
+ do {
707
+ next_function = next();
708
+ if (next_function == function) return true;
709
+ } while (next_function != NULL);
710
+ return false;
711
+ }
712
+ private:
713
+ void GetFunctions() {
714
+ functions_.Rewind(0);
715
+ if (frame_iterator_.done()) return;
716
+ JavaScriptFrame* frame = frame_iterator_.frame();
717
+ frame->GetFunctions(&functions_);
718
+ ASSERT(functions_.length() > 0);
719
+ frame_iterator_.Advance();
720
+ index_ = functions_.length() - 1;
721
+ }
722
+ JavaScriptFrameIterator frame_iterator_;
723
+ List<JSFunction*> functions_;
724
+ int index_;
725
+ };
726
+
727
+
686
728
  MaybeObject* Accessors::FunctionGetCaller(Object* object, void*) {
687
729
  Isolate* isolate = Isolate::Current();
688
730
  HandleScope scope(isolate);
@@ -692,38 +734,30 @@ MaybeObject* Accessors::FunctionGetCaller(Object* object, void*) {
692
734
  if (!found_it) return isolate->heap()->undefined_value();
693
735
  Handle<JSFunction> function(holder, isolate);
694
736
 
695
- List<JSFunction*> functions(2);
696
- for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) {
697
- JavaScriptFrame* frame = it.frame();
698
- frame->GetFunctions(&functions);
699
- for (int i = functions.length() - 1; i >= 0; i--) {
700
- if (functions[i] == *function) {
701
- // Once we have found the frame, we need to go to the caller
702
- // frame. This may require skipping through a number of top-level
703
- // frames, e.g. frames for scripts not functions.
704
- if (i > 0) {
705
- ASSERT(!functions[i - 1]->shared()->is_toplevel());
706
- return CheckNonStrictCallerOrThrow(isolate, functions[i - 1]);
707
- } else {
708
- for (it.Advance(); !it.done(); it.Advance()) {
709
- frame = it.frame();
710
- functions.Rewind(0);
711
- frame->GetFunctions(&functions);
712
- if (!functions.last()->shared()->is_toplevel()) {
713
- return CheckNonStrictCallerOrThrow(isolate, functions.last());
714
- }
715
- ASSERT(functions.length() == 1);
716
- }
717
- if (it.done()) return isolate->heap()->null_value();
718
- break;
719
- }
720
- }
721
- }
722
- functions.Rewind(0);
737
+ FrameFunctionIterator it(isolate, no_alloc);
738
+
739
+ // Find the function from the frames.
740
+ if (!it.Find(*function)) {
741
+ // No frame corresponding to the given function found. Return null.
742
+ return isolate->heap()->null_value();
723
743
  }
724
744
 
725
- // No frame corresponding to the given function found. Return null.
726
- return isolate->heap()->null_value();
745
+ // Find previously called non-toplevel function.
746
+ JSFunction* caller;
747
+ do {
748
+ caller = it.next();
749
+ if (caller == NULL) return isolate->heap()->null_value();
750
+ } while (caller->shared()->is_toplevel());
751
+
752
+ // If caller is a built-in function and caller's caller is also built-in,
753
+ // use that instead.
754
+ JSFunction* potential_caller = caller;
755
+ while (potential_caller != NULL && potential_caller->IsBuiltin()) {
756
+ caller = potential_caller;
757
+ potential_caller = it.next();
758
+ }
759
+
760
+ return CheckNonStrictCallerOrThrow(isolate, caller);
727
761
  }
728
762
 
729
763
 
@@ -35,9 +35,11 @@
35
35
  #include "debug.h"
36
36
  #include "deoptimizer.h"
37
37
  #include "execution.h"
38
+ #include "flags.h"
38
39
  #include "global-handles.h"
39
40
  #include "heap-profiler.h"
40
41
  #include "messages.h"
42
+ #include "natives.h"
41
43
  #include "parser.h"
42
44
  #include "platform.h"
43
45
  #include "profile-generator-inl.h"
@@ -53,16 +55,11 @@
53
55
 
54
56
  #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
55
57
 
56
- #ifdef ENABLE_VMSTATE_TRACKING
57
58
  #define ENTER_V8(isolate) \
58
59
  ASSERT((isolate)->IsInitialized()); \
59
60
  i::VMState __state__((isolate), i::OTHER)
60
61
  #define LEAVE_V8(isolate) \
61
62
  i::VMState __state__((isolate), i::EXTERNAL)
62
- #else
63
- #define ENTER_V8(isolate) ((void) 0)
64
- #define LEAVE_V8(isolate) ((void) 0)
65
- #endif
66
63
 
67
64
  namespace v8 {
68
65
 
@@ -88,7 +85,7 @@ namespace v8 {
88
85
  if (has_pending_exception) { \
89
86
  if (handle_scope_implementer->CallDepthIsZero() && \
90
87
  (isolate)->is_out_of_memory()) { \
91
- if (!handle_scope_implementer->ignore_out_of_memory()) \
88
+ if (!(isolate)->ignore_out_of_memory()) \
92
89
  i::V8::FatalProcessOutOfMemory(NULL); \
93
90
  } \
94
91
  bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \
@@ -97,13 +94,11 @@ namespace v8 {
97
94
  } \
98
95
  } while (false)
99
96
 
100
- // TODO(isolates): Add a parameter to this macro for an isolate.
101
97
 
102
- #define API_ENTRY_CHECK(msg) \
98
+ #define API_ENTRY_CHECK(isolate, msg) \
103
99
  do { \
104
100
  if (v8::Locker::IsActive()) { \
105
- ApiCheck(i::Isolate::Current()->thread_manager()-> \
106
- IsLockedByCurrentThread(), \
101
+ ApiCheck(isolate->thread_manager()->IsLockedByCurrentThread(), \
107
102
  msg, \
108
103
  "Entering the V8 API without proper locking in place"); \
109
104
  } \
@@ -115,9 +110,7 @@ namespace v8 {
115
110
 
116
111
  static void DefaultFatalErrorHandler(const char* location,
117
112
  const char* message) {
118
- #ifdef ENABLE_VMSTATE_TRACKING
119
113
  i::VMState __state__(i::Isolate::Current(), i::OTHER);
120
- #endif
121
114
  API_Fatal(location, message);
122
115
  }
123
116
 
@@ -176,8 +169,8 @@ void i::V8::FatalProcessOutOfMemory(const char* location, bool take_snapshot) {
176
169
  heap_stats.pending_global_handle_count = &pending_global_handle_count;
177
170
  int near_death_global_handle_count;
178
171
  heap_stats.near_death_global_handle_count = &near_death_global_handle_count;
179
- int destroyed_global_handle_count;
180
- heap_stats.destroyed_global_handle_count = &destroyed_global_handle_count;
172
+ int free_global_handle_count;
173
+ heap_stats.free_global_handle_count = &free_global_handle_count;
181
174
  intptr_t memory_allocator_size;
182
175
  heap_stats.memory_allocator_size = &memory_allocator_size;
183
176
  intptr_t memory_allocator_capacity;
@@ -311,6 +304,46 @@ static inline i::Isolate* EnterIsolateIfNeeded() {
311
304
  }
312
305
 
313
306
 
307
+ StartupDataDecompressor::StartupDataDecompressor()
308
+ : raw_data(i::NewArray<char*>(V8::GetCompressedStartupDataCount())) {
309
+ for (int i = 0; i < V8::GetCompressedStartupDataCount(); ++i) {
310
+ raw_data[i] = NULL;
311
+ }
312
+ }
313
+
314
+
315
+ StartupDataDecompressor::~StartupDataDecompressor() {
316
+ for (int i = 0; i < V8::GetCompressedStartupDataCount(); ++i) {
317
+ i::DeleteArray(raw_data[i]);
318
+ }
319
+ i::DeleteArray(raw_data);
320
+ }
321
+
322
+
323
+ int StartupDataDecompressor::Decompress() {
324
+ int compressed_data_count = V8::GetCompressedStartupDataCount();
325
+ StartupData* compressed_data =
326
+ i::NewArray<StartupData>(compressed_data_count);
327
+ V8::GetCompressedStartupData(compressed_data);
328
+ for (int i = 0; i < compressed_data_count; ++i) {
329
+ char* decompressed = raw_data[i] =
330
+ i::NewArray<char>(compressed_data[i].raw_size);
331
+ if (compressed_data[i].compressed_size != 0) {
332
+ int result = DecompressData(decompressed,
333
+ &compressed_data[i].raw_size,
334
+ compressed_data[i].data,
335
+ compressed_data[i].compressed_size);
336
+ if (result != 0) return result;
337
+ } else {
338
+ ASSERT_EQ(0, compressed_data[i].raw_size);
339
+ }
340
+ compressed_data[i].data = decompressed;
341
+ }
342
+ V8::SetDecompressedStartupData(compressed_data);
343
+ return 0;
344
+ }
345
+
346
+
314
347
  StartupData::CompressionAlgorithm V8::GetCompressedStartupDataAlgorithm() {
315
348
  #ifdef COMPRESS_STARTUP_DATA_BZ2
316
349
  return StartupData::kBZip2;
@@ -323,6 +356,8 @@ StartupData::CompressionAlgorithm V8::GetCompressedStartupDataAlgorithm() {
323
356
  enum CompressedStartupDataItems {
324
357
  kSnapshot = 0,
325
358
  kSnapshotContext,
359
+ kLibraries,
360
+ kExperimentalLibraries,
326
361
  kCompressedStartupDataCount
327
362
  };
328
363
 
@@ -347,6 +382,21 @@ void V8::GetCompressedStartupData(StartupData* compressed_data) {
347
382
  compressed_data[kSnapshotContext].compressed_size =
348
383
  i::Snapshot::context_size();
349
384
  compressed_data[kSnapshotContext].raw_size = i::Snapshot::context_raw_size();
385
+
386
+ i::Vector<const i::byte> libraries_source = i::Natives::GetScriptsSource();
387
+ compressed_data[kLibraries].data =
388
+ reinterpret_cast<const char*>(libraries_source.start());
389
+ compressed_data[kLibraries].compressed_size = libraries_source.length();
390
+ compressed_data[kLibraries].raw_size = i::Natives::GetRawScriptsSize();
391
+
392
+ i::Vector<const i::byte> exp_libraries_source =
393
+ i::ExperimentalNatives::GetScriptsSource();
394
+ compressed_data[kExperimentalLibraries].data =
395
+ reinterpret_cast<const char*>(exp_libraries_source.start());
396
+ compressed_data[kExperimentalLibraries].compressed_size =
397
+ exp_libraries_source.length();
398
+ compressed_data[kExperimentalLibraries].raw_size =
399
+ i::ExperimentalNatives::GetRawScriptsSize();
350
400
  #endif
351
401
  }
352
402
 
@@ -362,6 +412,20 @@ void V8::SetDecompressedStartupData(StartupData* decompressed_data) {
362
412
  i::Snapshot::set_context_raw_data(
363
413
  reinterpret_cast<const i::byte*>(
364
414
  decompressed_data[kSnapshotContext].data));
415
+
416
+ ASSERT_EQ(i::Natives::GetRawScriptsSize(),
417
+ decompressed_data[kLibraries].raw_size);
418
+ i::Vector<const char> libraries_source(
419
+ decompressed_data[kLibraries].data,
420
+ decompressed_data[kLibraries].raw_size);
421
+ i::Natives::SetRawScriptsSource(libraries_source);
422
+
423
+ ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(),
424
+ decompressed_data[kExperimentalLibraries].raw_size);
425
+ i::Vector<const char> exp_libraries_source(
426
+ decompressed_data[kExperimentalLibraries].data,
427
+ decompressed_data[kExperimentalLibraries].raw_size);
428
+ i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source);
365
429
  #endif
366
430
  }
367
431
 
@@ -573,8 +637,8 @@ void V8::DisposeGlobal(i::Object** obj) {
573
637
 
574
638
 
575
639
  HandleScope::HandleScope() {
576
- API_ENTRY_CHECK("HandleScope::HandleScope");
577
640
  i::Isolate* isolate = i::Isolate::Current();
641
+ API_ENTRY_CHECK(isolate, "HandleScope::HandleScope");
578
642
  v8::ImplementationUtilities::HandleScopeData* current =
579
643
  isolate->handle_scope_data();
580
644
  isolate_ = isolate;
@@ -630,12 +694,11 @@ i::Object** HandleScope::CreateHandle(i::HeapObject* value) {
630
694
 
631
695
 
632
696
  void Context::Enter() {
633
- // TODO(isolates): Context should have a pointer to isolate.
634
- i::Isolate* isolate = i::Isolate::Current();
697
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
698
+ i::Isolate* isolate = env->GetIsolate();
635
699
  if (IsDeadCheck(isolate, "v8::Context::Enter()")) return;
636
700
  ENTER_V8(isolate);
637
701
 
638
- i::Handle<i::Context> env = Utils::OpenHandle(this);
639
702
  isolate->handle_scope_implementer()->EnterContext(env);
640
703
 
641
704
  isolate->handle_scope_implementer()->SaveContext(isolate->context());
@@ -644,7 +707,9 @@ void Context::Enter() {
644
707
 
645
708
 
646
709
  void Context::Exit() {
647
- // TODO(isolates): Context should have a pointer to isolate.
710
+ // Exit is essentially a static function and doesn't use the
711
+ // receiver, so we have to get the current isolate from the thread
712
+ // local.
648
713
  i::Isolate* isolate = i::Isolate::Current();
649
714
  if (!isolate->IsInitialized()) return;
650
715
 
@@ -662,41 +727,31 @@ void Context::Exit() {
662
727
 
663
728
 
664
729
  void Context::SetData(v8::Handle<String> data) {
665
- // TODO(isolates): Context should have a pointer to isolate.
666
- i::Isolate* isolate = i::Isolate::Current();
730
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
731
+ i::Isolate* isolate = env->GetIsolate();
667
732
  if (IsDeadCheck(isolate, "v8::Context::SetData()")) return;
668
- ENTER_V8(isolate);
669
- {
670
- i::HandleScope scope(isolate);
671
- i::Handle<i::Context> env = Utils::OpenHandle(this);
672
- i::Handle<i::Object> raw_data = Utils::OpenHandle(*data);
673
- ASSERT(env->IsGlobalContext());
674
- if (env->IsGlobalContext()) {
675
- env->set_data(*raw_data);
676
- }
733
+ i::Handle<i::Object> raw_data = Utils::OpenHandle(*data);
734
+ ASSERT(env->IsGlobalContext());
735
+ if (env->IsGlobalContext()) {
736
+ env->set_data(*raw_data);
677
737
  }
678
738
  }
679
739
 
680
740
 
681
741
  v8::Local<v8::Value> Context::GetData() {
682
- // TODO(isolates): Context should have a pointer to isolate.
683
- i::Isolate* isolate = i::Isolate::Current();
742
+ i::Handle<i::Context> env = Utils::OpenHandle(this);
743
+ i::Isolate* isolate = env->GetIsolate();
684
744
  if (IsDeadCheck(isolate, "v8::Context::GetData()")) {
685
745
  return v8::Local<Value>();
686
746
  }
687
- ENTER_V8(isolate);
688
747
  i::Object* raw_result = NULL;
689
- {
690
- i::HandleScope scope(isolate);
691
- i::Handle<i::Context> env = Utils::OpenHandle(this);
692
- ASSERT(env->IsGlobalContext());
693
- if (env->IsGlobalContext()) {
694
- raw_result = env->data();
695
- } else {
696
- return Local<Value>();
697
- }
748
+ ASSERT(env->IsGlobalContext());
749
+ if (env->IsGlobalContext()) {
750
+ raw_result = env->data();
751
+ } else {
752
+ return Local<Value>();
698
753
  }
699
- i::Handle<i::Object> result(raw_result);
754
+ i::Handle<i::Object> result(raw_result, isolate);
700
755
  return Utils::ToLocal(result);
701
756
  }
702
757
 
@@ -925,6 +980,7 @@ Local<TypeSwitch> TypeSwitch::New(int argc, Handle<FunctionTemplate> types[]) {
925
980
  int TypeSwitch::match(v8::Handle<Value> value) {
926
981
  i::Isolate* isolate = i::Isolate::Current();
927
982
  LOG_API(isolate, "TypeSwitch::match");
983
+ USE(isolate);
928
984
  i::Handle<i::Object> obj = Utils::OpenHandle(*value);
929
985
  i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this);
930
986
  i::FixedArray* types = i::FixedArray::cast(info->types());
@@ -1044,6 +1100,16 @@ void FunctionTemplate::SetHiddenPrototype(bool value) {
1044
1100
  }
1045
1101
 
1046
1102
 
1103
+ void FunctionTemplate::ReadOnlyPrototype() {
1104
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
1105
+ if (IsDeadCheck(isolate, "v8::FunctionTemplate::SetPrototypeAttributes()")) {
1106
+ return;
1107
+ }
1108
+ ENTER_V8(isolate);
1109
+ Utils::OpenHandle(this)->set_read_only_prototype(true);
1110
+ }
1111
+
1112
+
1047
1113
  void FunctionTemplate::SetNamedInstancePropertyHandler(
1048
1114
  NamedPropertyGetter getter,
1049
1115
  NamedPropertySetter setter,
@@ -1340,7 +1406,7 @@ void ObjectTemplate::SetInternalFieldCount(int value) {
1340
1406
  ScriptData* ScriptData::PreCompile(const char* input, int length) {
1341
1407
  i::Utf8ToUC16CharacterStream stream(
1342
1408
  reinterpret_cast<const unsigned char*>(input), length);
1343
- return i::ParserApi::PreParse(&stream, NULL);
1409
+ return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_block_scoping);
1344
1410
  }
1345
1411
 
1346
1412
 
@@ -1349,10 +1415,10 @@ ScriptData* ScriptData::PreCompile(v8::Handle<String> source) {
1349
1415
  if (str->IsExternalTwoByteString()) {
1350
1416
  i::ExternalTwoByteStringUC16CharacterStream stream(
1351
1417
  i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length());
1352
- return i::ParserApi::PreParse(&stream, NULL);
1418
+ return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_block_scoping);
1353
1419
  } else {
1354
1420
  i::GenericStringUC16CharacterStream stream(str, 0, str->length());
1355
- return i::ParserApi::PreParse(&stream, NULL);
1421
+ return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_block_scoping);
1356
1422
  }
1357
1423
  }
1358
1424
 
@@ -1545,26 +1611,27 @@ void Script::SetData(v8::Handle<String> data) {
1545
1611
 
1546
1612
 
1547
1613
  v8::TryCatch::TryCatch()
1548
- : next_(i::Isolate::Current()->try_catch_handler_address()),
1549
- exception_(HEAP->the_hole_value()),
1614
+ : isolate_(i::Isolate::Current()),
1615
+ next_(isolate_->try_catch_handler_address()),
1616
+ exception_(isolate_->heap()->the_hole_value()),
1550
1617
  message_(i::Smi::FromInt(0)),
1551
1618
  is_verbose_(false),
1552
1619
  can_continue_(true),
1553
1620
  capture_message_(true),
1554
1621
  rethrow_(false) {
1555
- i::Isolate::Current()->RegisterTryCatchHandler(this);
1622
+ isolate_->RegisterTryCatchHandler(this);
1556
1623
  }
1557
1624
 
1558
1625
 
1559
1626
  v8::TryCatch::~TryCatch() {
1560
- i::Isolate* isolate = i::Isolate::Current();
1627
+ ASSERT(isolate_ == i::Isolate::Current());
1561
1628
  if (rethrow_) {
1562
1629
  v8::HandleScope scope;
1563
1630
  v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception());
1564
- isolate->UnregisterTryCatchHandler(this);
1631
+ isolate_->UnregisterTryCatchHandler(this);
1565
1632
  v8::ThrowException(exc);
1566
1633
  } else {
1567
- isolate->UnregisterTryCatchHandler(this);
1634
+ isolate_->UnregisterTryCatchHandler(this);
1568
1635
  }
1569
1636
  }
1570
1637
 
@@ -1587,10 +1654,11 @@ v8::Handle<v8::Value> v8::TryCatch::ReThrow() {
1587
1654
 
1588
1655
 
1589
1656
  v8::Local<Value> v8::TryCatch::Exception() const {
1657
+ ASSERT(isolate_ == i::Isolate::Current());
1590
1658
  if (HasCaught()) {
1591
1659
  // Check for out of memory exception.
1592
1660
  i::Object* exception = reinterpret_cast<i::Object*>(exception_);
1593
- return v8::Utils::ToLocal(i::Handle<i::Object>(exception));
1661
+ return v8::Utils::ToLocal(i::Handle<i::Object>(exception, isolate_));
1594
1662
  } else {
1595
1663
  return v8::Local<Value>();
1596
1664
  }
@@ -1598,15 +1666,17 @@ v8::Local<Value> v8::TryCatch::Exception() const {
1598
1666
 
1599
1667
 
1600
1668
  v8::Local<Value> v8::TryCatch::StackTrace() const {
1669
+ ASSERT(isolate_ == i::Isolate::Current());
1601
1670
  if (HasCaught()) {
1602
1671
  i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_);
1603
1672
  if (!raw_obj->IsJSObject()) return v8::Local<Value>();
1604
- v8::HandleScope scope;
1605
- i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj));
1606
- i::Handle<i::String> name = FACTORY->LookupAsciiSymbol("stack");
1607
- if (!obj->HasProperty(*name))
1608
- return v8::Local<Value>();
1609
- return scope.Close(v8::Utils::ToLocal(i::GetProperty(obj, name)));
1673
+ i::HandleScope scope(isolate_);
1674
+ i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_);
1675
+ i::Handle<i::String> name = isolate_->factory()->LookupAsciiSymbol("stack");
1676
+ if (!obj->HasProperty(*name)) return v8::Local<Value>();
1677
+ i::Handle<i::Object> value = i::GetProperty(obj, name);
1678
+ if (value.is_null()) return v8::Local<Value>();
1679
+ return v8::Utils::ToLocal(scope.CloseAndEscape(value));
1610
1680
  } else {
1611
1681
  return v8::Local<Value>();
1612
1682
  }
@@ -1614,9 +1684,10 @@ v8::Local<Value> v8::TryCatch::StackTrace() const {
1614
1684
 
1615
1685
 
1616
1686
  v8::Local<v8::Message> v8::TryCatch::Message() const {
1687
+ ASSERT(isolate_ == i::Isolate::Current());
1617
1688
  if (HasCaught() && message_ != i::Smi::FromInt(0)) {
1618
1689
  i::Object* message = reinterpret_cast<i::Object*>(message_);
1619
- return v8::Utils::MessageToLocal(i::Handle<i::Object>(message));
1690
+ return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_));
1620
1691
  } else {
1621
1692
  return v8::Local<v8::Message>();
1622
1693
  }
@@ -1624,7 +1695,8 @@ v8::Local<v8::Message> v8::TryCatch::Message() const {
1624
1695
 
1625
1696
 
1626
1697
  void v8::TryCatch::Reset() {
1627
- exception_ = HEAP->the_hole_value();
1698
+ ASSERT(isolate_ == i::Isolate::Current());
1699
+ exception_ = isolate_->heap()->the_hole_value();
1628
1700
  message_ = i::Smi::FromInt(0);
1629
1701
  }
1630
1702
 
@@ -2094,6 +2166,65 @@ bool Value::IsDate() const {
2094
2166
  }
2095
2167
 
2096
2168
 
2169
+ bool Value::IsStringObject() const {
2170
+ i::Isolate* isolate = i::Isolate::Current();
2171
+ if (IsDeadCheck(isolate, "v8::Value::IsStringObject()")) return false;
2172
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
2173
+ return obj->HasSpecificClassOf(isolate->heap()->String_symbol());
2174
+ }
2175
+
2176
+
2177
+ bool Value::IsNumberObject() const {
2178
+ i::Isolate* isolate = i::Isolate::Current();
2179
+ if (IsDeadCheck(isolate, "v8::Value::IsNumberObject()")) return false;
2180
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
2181
+ return obj->HasSpecificClassOf(isolate->heap()->Number_symbol());
2182
+ }
2183
+
2184
+
2185
+ static i::Object* LookupBuiltin(i::Isolate* isolate,
2186
+ const char* builtin_name) {
2187
+ i::Handle<i::String> symbol =
2188
+ isolate->factory()->LookupAsciiSymbol(builtin_name);
2189
+ i::Handle<i::JSBuiltinsObject> builtins = isolate->js_builtins_object();
2190
+ return builtins->GetPropertyNoExceptionThrown(*symbol);
2191
+ }
2192
+
2193
+
2194
+ static bool CheckConstructor(i::Isolate* isolate,
2195
+ i::Handle<i::JSObject> obj,
2196
+ const char* class_name) {
2197
+ return obj->map()->constructor() == LookupBuiltin(isolate, class_name);
2198
+ }
2199
+
2200
+
2201
+ bool Value::IsNativeError() const {
2202
+ i::Isolate* isolate = i::Isolate::Current();
2203
+ if (IsDeadCheck(isolate, "v8::Value::IsNativeError()")) return false;
2204
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
2205
+ if (obj->IsJSObject()) {
2206
+ i::Handle<i::JSObject> js_obj(i::JSObject::cast(*obj));
2207
+ return CheckConstructor(isolate, js_obj, "$Error") ||
2208
+ CheckConstructor(isolate, js_obj, "$EvalError") ||
2209
+ CheckConstructor(isolate, js_obj, "$RangeError") ||
2210
+ CheckConstructor(isolate, js_obj, "$ReferenceError") ||
2211
+ CheckConstructor(isolate, js_obj, "$SyntaxError") ||
2212
+ CheckConstructor(isolate, js_obj, "$TypeError") ||
2213
+ CheckConstructor(isolate, js_obj, "$URIError");
2214
+ } else {
2215
+ return false;
2216
+ }
2217
+ }
2218
+
2219
+
2220
+ bool Value::IsBooleanObject() const {
2221
+ i::Isolate* isolate = i::Isolate::Current();
2222
+ if (IsDeadCheck(isolate, "v8::Value::IsBooleanObject()")) return false;
2223
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
2224
+ return obj->HasSpecificClassOf(isolate->heap()->Boolean_symbol());
2225
+ }
2226
+
2227
+
2097
2228
  bool Value::IsRegExp() const {
2098
2229
  if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsRegExp()")) return false;
2099
2230
  i::Handle<i::Object> obj = Utils::OpenHandle(this);
@@ -2289,6 +2420,36 @@ void v8::Date::CheckCast(v8::Value* that) {
2289
2420
  }
2290
2421
 
2291
2422
 
2423
+ void v8::StringObject::CheckCast(v8::Value* that) {
2424
+ i::Isolate* isolate = i::Isolate::Current();
2425
+ if (IsDeadCheck(isolate, "v8::StringObject::Cast()")) return;
2426
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
2427
+ ApiCheck(obj->HasSpecificClassOf(isolate->heap()->String_symbol()),
2428
+ "v8::StringObject::Cast()",
2429
+ "Could not convert to StringObject");
2430
+ }
2431
+
2432
+
2433
+ void v8::NumberObject::CheckCast(v8::Value* that) {
2434
+ i::Isolate* isolate = i::Isolate::Current();
2435
+ if (IsDeadCheck(isolate, "v8::NumberObject::Cast()")) return;
2436
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
2437
+ ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Number_symbol()),
2438
+ "v8::NumberObject::Cast()",
2439
+ "Could not convert to NumberObject");
2440
+ }
2441
+
2442
+
2443
+ void v8::BooleanObject::CheckCast(v8::Value* that) {
2444
+ i::Isolate* isolate = i::Isolate::Current();
2445
+ if (IsDeadCheck(isolate, "v8::BooleanObject::Cast()")) return;
2446
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
2447
+ ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Boolean_symbol()),
2448
+ "v8::BooleanObject::Cast()",
2449
+ "Could not convert to BooleanObject");
2450
+ }
2451
+
2452
+
2292
2453
  void v8::RegExp::CheckCast(v8::Value* that) {
2293
2454
  if (IsDeadCheck(i::Isolate::Current(), "v8::RegExp::Cast()")) return;
2294
2455
  i::Handle<i::Object> obj = Utils::OpenHandle(that);
@@ -2632,6 +2793,26 @@ Local<Value> v8::Object::Get(uint32_t index) {
2632
2793
  }
2633
2794
 
2634
2795
 
2796
+ PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) {
2797
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2798
+ ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()",
2799
+ return static_cast<PropertyAttribute>(NONE));
2800
+ ENTER_V8(isolate);
2801
+ i::HandleScope scope(isolate);
2802
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2803
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
2804
+ if (!key_obj->IsString()) {
2805
+ EXCEPTION_PREAMBLE(isolate);
2806
+ key_obj = i::Execution::ToString(key_obj, &has_pending_exception);
2807
+ EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE));
2808
+ }
2809
+ i::Handle<i::String> key_string = i::Handle<i::String>::cast(key_obj);
2810
+ PropertyAttributes result = self->GetPropertyAttribute(*key_string);
2811
+ if (result == ABSENT) return static_cast<PropertyAttribute>(NONE);
2812
+ return static_cast<PropertyAttribute>(result);
2813
+ }
2814
+
2815
+
2635
2816
  Local<Value> v8::Object::GetPrototype() {
2636
2817
  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2637
2818
  ON_BAILOUT(isolate, "v8::Object::GetPrototype()",
@@ -2697,6 +2878,25 @@ Local<Array> v8::Object::GetPropertyNames() {
2697
2878
  }
2698
2879
 
2699
2880
 
2881
+ Local<Array> v8::Object::GetOwnPropertyNames() {
2882
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2883
+ ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyNames()",
2884
+ return Local<v8::Array>());
2885
+ ENTER_V8(isolate);
2886
+ i::HandleScope scope(isolate);
2887
+ i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2888
+ i::Handle<i::FixedArray> value =
2889
+ i::GetKeysInFixedArrayFor(self, i::LOCAL_ONLY);
2890
+ // Because we use caching to speed up enumeration it is important
2891
+ // to never change the result of the basic enumeration function so
2892
+ // we clone the result.
2893
+ i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value);
2894
+ i::Handle<i::JSArray> result =
2895
+ isolate->factory()->NewJSArrayWithElements(elms);
2896
+ return Utils::ToLocal(scope.CloseAndEscape(result));
2897
+ }
2898
+
2899
+
2700
2900
  Local<String> v8::Object::ObjectProtoToString() {
2701
2901
  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2702
2902
  ON_BAILOUT(isolate, "v8::Object::ObjectProtoToString()",
@@ -2964,10 +3164,9 @@ static i::Context* GetCreationContext(i::JSObject* object) {
2964
3164
  i::Object* constructor = object->map()->constructor();
2965
3165
  i::JSFunction* function;
2966
3166
  if (!constructor->IsJSFunction()) {
2967
- // API functions have null as a constructor,
3167
+ // Functions have null as a constructor,
2968
3168
  // but any JSFunction knows its context immediately.
2969
- ASSERT(object->IsJSFunction() &&
2970
- i::JSFunction::cast(object)->shared()->IsApiFunction());
3169
+ ASSERT(object->IsJSFunction());
2971
3170
  function = i::JSFunction::cast(object);
2972
3171
  } else {
2973
3172
  function = i::JSFunction::cast(constructor);
@@ -2993,39 +3192,7 @@ int v8::Object::GetIdentityHash() {
2993
3192
  ENTER_V8(isolate);
2994
3193
  i::HandleScope scope(isolate);
2995
3194
  i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2996
- i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true));
2997
- if (!hidden_props_obj->IsJSObject()) {
2998
- // We failed to create hidden properties. That's a detached
2999
- // global proxy.
3000
- ASSERT(hidden_props_obj->IsUndefined());
3001
- return 0;
3002
- }
3003
- i::Handle<i::JSObject> hidden_props =
3004
- i::Handle<i::JSObject>::cast(hidden_props_obj);
3005
- i::Handle<i::String> hash_symbol = isolate->factory()->identity_hash_symbol();
3006
- if (hidden_props->HasLocalProperty(*hash_symbol)) {
3007
- i::Handle<i::Object> hash = i::GetProperty(hidden_props, hash_symbol);
3008
- CHECK(!hash.is_null());
3009
- CHECK(hash->IsSmi());
3010
- return i::Smi::cast(*hash)->value();
3011
- }
3012
-
3013
- int hash_value;
3014
- int attempts = 0;
3015
- do {
3016
- // Generate a random 32-bit hash value but limit range to fit
3017
- // within a smi.
3018
- hash_value = i::V8::Random(self->GetIsolate()) & i::Smi::kMaxValue;
3019
- attempts++;
3020
- } while (hash_value == 0 && attempts < 30);
3021
- hash_value = hash_value != 0 ? hash_value : 1; // never return 0
3022
- CHECK(!i::SetLocalPropertyIgnoreAttributes(
3023
- hidden_props,
3024
- hash_symbol,
3025
- i::Handle<i::Object>(i::Smi::FromInt(hash_value)),
3026
- static_cast<PropertyAttributes>(None)).is_null());
3027
-
3028
- return hash_value;
3195
+ return i::GetIdentityHash(self);
3029
3196
  }
3030
3197
 
3031
3198
 
@@ -3036,7 +3203,9 @@ bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key,
3036
3203
  ENTER_V8(isolate);
3037
3204
  i::HandleScope scope(isolate);
3038
3205
  i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3039
- i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, true));
3206
+ i::Handle<i::Object> hidden_props(i::GetHiddenProperties(
3207
+ self,
3208
+ i::JSObject::ALLOW_CREATION));
3040
3209
  i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3041
3210
  i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3042
3211
  EXCEPTION_PREAMBLE(isolate);
@@ -3058,7 +3227,9 @@ v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
3058
3227
  return Local<v8::Value>());
3059
3228
  ENTER_V8(isolate);
3060
3229
  i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3061
- i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false));
3230
+ i::Handle<i::Object> hidden_props(i::GetHiddenProperties(
3231
+ self,
3232
+ i::JSObject::OMIT_CREATION));
3062
3233
  if (hidden_props->IsUndefined()) {
3063
3234
  return v8::Local<v8::Value>();
3064
3235
  }
@@ -3080,7 +3251,9 @@ bool v8::Object::DeleteHiddenValue(v8::Handle<v8::String> key) {
3080
3251
  ENTER_V8(isolate);
3081
3252
  i::HandleScope scope(isolate);
3082
3253
  i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3083
- i::Handle<i::Object> hidden_props(i::GetHiddenProperties(self, false));
3254
+ i::Handle<i::Object> hidden_props(i::GetHiddenProperties(
3255
+ self,
3256
+ i::JSObject::OMIT_CREATION));
3084
3257
  if (hidden_props->IsUndefined()) {
3085
3258
  return true;
3086
3259
  }
@@ -3392,6 +3565,7 @@ Local<v8::Value> Function::Call(v8::Handle<v8::Object> recv, int argc,
3392
3565
  void Function::SetName(v8::Handle<v8::String> name) {
3393
3566
  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3394
3567
  ENTER_V8(isolate);
3568
+ USE(isolate);
3395
3569
  i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
3396
3570
  func->shared()->set_name(*Utils::OpenHandle(*name));
3397
3571
  }
@@ -3447,7 +3621,7 @@ int String::Utf8Length() const {
3447
3621
  int String::WriteUtf8(char* buffer,
3448
3622
  int capacity,
3449
3623
  int* nchars_ref,
3450
- WriteHints hints) const {
3624
+ int options) const {
3451
3625
  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3452
3626
  if (IsDeadCheck(isolate, "v8::String::WriteUtf8()")) return 0;
3453
3627
  LOG_API(isolate, "String::WriteUtf8");
@@ -3455,7 +3629,7 @@ int String::WriteUtf8(char* buffer,
3455
3629
  i::StringInputBuffer& write_input_buffer = *isolate->write_input_buffer();
3456
3630
  i::Handle<i::String> str = Utils::OpenHandle(this);
3457
3631
  isolate->string_tracker()->RecordWrite(str);
3458
- if (hints & HINT_MANY_WRITES_EXPECTED) {
3632
+ if (options & HINT_MANY_WRITES_EXPECTED) {
3459
3633
  // Flatten the string for efficiency. This applies whether we are
3460
3634
  // using StringInputBuffer or Get(i) to access the characters.
3461
3635
  str->TryFlatten();
@@ -3495,7 +3669,8 @@ int String::WriteUtf8(char* buffer,
3495
3669
  }
3496
3670
  }
3497
3671
  if (nchars_ref != NULL) *nchars_ref = nchars;
3498
- if (i == len && (capacity == -1 || pos < capacity))
3672
+ if (!(options & NO_NULL_TERMINATION) &&
3673
+ (i == len && (capacity == -1 || pos < capacity)))
3499
3674
  buffer[pos++] = '\0';
3500
3675
  return pos;
3501
3676
  }
@@ -3504,7 +3679,7 @@ int String::WriteUtf8(char* buffer,
3504
3679
  int String::WriteAscii(char* buffer,
3505
3680
  int start,
3506
3681
  int length,
3507
- WriteHints hints) const {
3682
+ int options) const {
3508
3683
  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3509
3684
  if (IsDeadCheck(isolate, "v8::String::WriteAscii()")) return 0;
3510
3685
  LOG_API(isolate, "String::WriteAscii");
@@ -3513,7 +3688,7 @@ int String::WriteAscii(char* buffer,
3513
3688
  ASSERT(start >= 0 && length >= -1);
3514
3689
  i::Handle<i::String> str = Utils::OpenHandle(this);
3515
3690
  isolate->string_tracker()->RecordWrite(str);
3516
- if (hints & HINT_MANY_WRITES_EXPECTED) {
3691
+ if (options & HINT_MANY_WRITES_EXPECTED) {
3517
3692
  // Flatten the string for efficiency. This applies whether we are
3518
3693
  // using StringInputBuffer or Get(i) to access the characters.
3519
3694
  str->TryFlatten();
@@ -3529,7 +3704,7 @@ int String::WriteAscii(char* buffer,
3529
3704
  if (c == '\0') c = ' ';
3530
3705
  buffer[i] = c;
3531
3706
  }
3532
- if (length == -1 || i < length)
3707
+ if (!(options & NO_NULL_TERMINATION) && (length == -1 || i < length))
3533
3708
  buffer[i] = '\0';
3534
3709
  return i;
3535
3710
  }
@@ -3538,7 +3713,7 @@ int String::WriteAscii(char* buffer,
3538
3713
  int String::Write(uint16_t* buffer,
3539
3714
  int start,
3540
3715
  int length,
3541
- WriteHints hints) const {
3716
+ int options) const {
3542
3717
  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3543
3718
  if (IsDeadCheck(isolate, "v8::String::Write()")) return 0;
3544
3719
  LOG_API(isolate, "String::Write");
@@ -3546,7 +3721,7 @@ int String::Write(uint16_t* buffer,
3546
3721
  ASSERT(start >= 0 && length >= -1);
3547
3722
  i::Handle<i::String> str = Utils::OpenHandle(this);
3548
3723
  isolate->string_tracker()->RecordWrite(str);
3549
- if (hints & HINT_MANY_WRITES_EXPECTED) {
3724
+ if (options & HINT_MANY_WRITES_EXPECTED) {
3550
3725
  // Flatten the string for efficiency. This applies whether we are
3551
3726
  // using StringInputBuffer or Get(i) to access the characters.
3552
3727
  str->TryFlatten();
@@ -3556,7 +3731,8 @@ int String::Write(uint16_t* buffer,
3556
3731
  end = str->length();
3557
3732
  if (end < 0) return 0;
3558
3733
  i::String::WriteToFlat(*str, buffer, start, end);
3559
- if (length == -1 || end - start < length) {
3734
+ if (!(options & NO_NULL_TERMINATION) &&
3735
+ (length == -1 || end - start < length)) {
3560
3736
  buffer[end - start] = '\0';
3561
3737
  }
3562
3738
  return end - start;
@@ -3751,6 +3927,11 @@ bool v8::V8::Initialize() {
3751
3927
  }
3752
3928
 
3753
3929
 
3930
+ void v8::V8::SetEntropySource(EntropySource source) {
3931
+ i::V8::SetEntropySource(source);
3932
+ }
3933
+
3934
+
3754
3935
  bool v8::V8::Dispose() {
3755
3936
  i::Isolate* isolate = i::Isolate::Current();
3756
3937
  if (!ApiCheck(isolate != NULL && isolate->IsDefaultIsolate(),
@@ -3939,7 +4120,7 @@ bool Context::InContext() {
3939
4120
 
3940
4121
  v8::Local<v8::Context> Context::GetEntered() {
3941
4122
  i::Isolate* isolate = i::Isolate::Current();
3942
- if (IsDeadCheck(isolate, "v8::Context::GetEntered()")) {
4123
+ if (!EnsureInitializedForIsolate(isolate, "v8::Context::GetEntered()")) {
3943
4124
  return Local<Context>();
3944
4125
  }
3945
4126
  i::Handle<i::Object> last =
@@ -4080,8 +4261,8 @@ static void* ExternalValueImpl(i::Handle<i::Object> obj) {
4080
4261
  Local<Value> v8::External::Wrap(void* data) {
4081
4262
  i::Isolate* isolate = i::Isolate::Current();
4082
4263
  STATIC_ASSERT(sizeof(data) == sizeof(i::Address));
4083
- LOG_API(isolate, "External::Wrap");
4084
4264
  EnsureInitializedForIsolate(isolate, "v8::External::Wrap()");
4265
+ LOG_API(isolate, "External::Wrap");
4085
4266
  ENTER_V8(isolate);
4086
4267
 
4087
4268
  v8::Local<v8::Value> result = CanBeEncodedAsSmi(data)
@@ -4125,8 +4306,8 @@ void* v8::External::FullUnwrap(v8::Handle<v8::Value> wrapper) {
4125
4306
  Local<External> v8::External::New(void* data) {
4126
4307
  STATIC_ASSERT(sizeof(data) == sizeof(i::Address));
4127
4308
  i::Isolate* isolate = i::Isolate::Current();
4128
- LOG_API(isolate, "External::New");
4129
4309
  EnsureInitializedForIsolate(isolate, "v8::External::New()");
4310
+ LOG_API(isolate, "External::New");
4130
4311
  ENTER_V8(isolate);
4131
4312
  return ExternalNewImpl(data);
4132
4313
  }
@@ -4262,6 +4443,9 @@ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
4262
4443
  if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
4263
4444
  return false;
4264
4445
  }
4446
+ if (isolate->heap()->IsInGCPostProcessing()) {
4447
+ return false;
4448
+ }
4265
4449
  bool result = obj->MakeExternal(resource);
4266
4450
  if (result && !obj->IsSymbol()) {
4267
4451
  isolate->heap()->external_string_table()->AddString(*obj);
@@ -4294,6 +4478,9 @@ bool v8::String::MakeExternal(
4294
4478
  if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
4295
4479
  return false;
4296
4480
  }
4481
+ if (isolate->heap()->IsInGCPostProcessing()) {
4482
+ return false;
4483
+ }
4297
4484
  bool result = obj->MakeExternal(resource);
4298
4485
  if (result && !obj->IsSymbol()) {
4299
4486
  isolate->heap()->external_string_table()->AddString(*obj);
@@ -4328,6 +4515,73 @@ Local<v8::Object> v8::Object::New() {
4328
4515
  }
4329
4516
 
4330
4517
 
4518
+ Local<v8::Value> v8::NumberObject::New(double value) {
4519
+ i::Isolate* isolate = i::Isolate::Current();
4520
+ EnsureInitializedForIsolate(isolate, "v8::NumberObject::New()");
4521
+ LOG_API(isolate, "NumberObject::New");
4522
+ ENTER_V8(isolate);
4523
+ i::Handle<i::Object> number = isolate->factory()->NewNumber(value);
4524
+ i::Handle<i::Object> obj = isolate->factory()->ToObject(number);
4525
+ return Utils::ToLocal(obj);
4526
+ }
4527
+
4528
+
4529
+ double v8::NumberObject::NumberValue() const {
4530
+ i::Isolate* isolate = i::Isolate::Current();
4531
+ if (IsDeadCheck(isolate, "v8::NumberObject::NumberValue()")) return 0;
4532
+ LOG_API(isolate, "NumberObject::NumberValue");
4533
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
4534
+ i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
4535
+ return jsvalue->value()->Number();
4536
+ }
4537
+
4538
+
4539
+ Local<v8::Value> v8::BooleanObject::New(bool value) {
4540
+ i::Isolate* isolate = i::Isolate::Current();
4541
+ EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()");
4542
+ LOG_API(isolate, "BooleanObject::New");
4543
+ ENTER_V8(isolate);
4544
+ i::Handle<i::Object> boolean(value ? isolate->heap()->true_value()
4545
+ : isolate->heap()->false_value());
4546
+ i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean);
4547
+ return Utils::ToLocal(obj);
4548
+ }
4549
+
4550
+
4551
+ bool v8::BooleanObject::BooleanValue() const {
4552
+ i::Isolate* isolate = i::Isolate::Current();
4553
+ if (IsDeadCheck(isolate, "v8::BooleanObject::BooleanValue()")) return 0;
4554
+ LOG_API(isolate, "BooleanObject::BooleanValue");
4555
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
4556
+ i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
4557
+ return jsvalue->value()->IsTrue();
4558
+ }
4559
+
4560
+
4561
+ Local<v8::Value> v8::StringObject::New(Handle<String> value) {
4562
+ i::Isolate* isolate = i::Isolate::Current();
4563
+ EnsureInitializedForIsolate(isolate, "v8::StringObject::New()");
4564
+ LOG_API(isolate, "StringObject::New");
4565
+ ENTER_V8(isolate);
4566
+ i::Handle<i::Object> obj =
4567
+ isolate->factory()->ToObject(Utils::OpenHandle(*value));
4568
+ return Utils::ToLocal(obj);
4569
+ }
4570
+
4571
+
4572
+ Local<v8::String> v8::StringObject::StringValue() const {
4573
+ i::Isolate* isolate = i::Isolate::Current();
4574
+ if (IsDeadCheck(isolate, "v8::StringObject::StringValue()")) {
4575
+ return Local<v8::String>();
4576
+ }
4577
+ LOG_API(isolate, "StringObject::StringValue");
4578
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
4579
+ i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
4580
+ return Utils::ToLocal(
4581
+ i::Handle<i::String>(i::String::cast(jsvalue->value())));
4582
+ }
4583
+
4584
+
4331
4585
  Local<v8::Value> v8::Date::New(double time) {
4332
4586
  i::Isolate* isolate = i::Isolate::Current();
4333
4587
  EnsureInitializedForIsolate(isolate, "v8::Date::New()");
@@ -4545,8 +4799,7 @@ Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
4545
4799
 
4546
4800
 
4547
4801
  void V8::IgnoreOutOfMemoryException() {
4548
- EnterIsolateIfNeeded()->handle_scope_implementer()->set_ignore_out_of_memory(
4549
- true);
4802
+ EnterIsolateIfNeeded()->set_ignore_out_of_memory(true);
4550
4803
  }
4551
4804
 
4552
4805
 
@@ -4726,73 +4979,20 @@ void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) {
4726
4979
 
4727
4980
 
4728
4981
  void V8::PauseProfiler() {
4729
- #ifdef ENABLE_LOGGING_AND_PROFILING
4730
- PauseProfilerEx(PROFILER_MODULE_CPU);
4731
- #endif
4982
+ i::Isolate* isolate = i::Isolate::Current();
4983
+ isolate->logger()->PauseProfiler();
4732
4984
  }
4733
4985
 
4734
4986
 
4735
4987
  void V8::ResumeProfiler() {
4736
- #ifdef ENABLE_LOGGING_AND_PROFILING
4737
- ResumeProfilerEx(PROFILER_MODULE_CPU);
4738
- #endif
4988
+ i::Isolate* isolate = i::Isolate::Current();
4989
+ isolate->logger()->ResumeProfiler();
4739
4990
  }
4740
4991
 
4741
4992
 
4742
4993
  bool V8::IsProfilerPaused() {
4743
- #ifdef ENABLE_LOGGING_AND_PROFILING
4744
- return LOGGER->GetActiveProfilerModules() & PROFILER_MODULE_CPU;
4745
- #else
4746
- return true;
4747
- #endif
4748
- }
4749
-
4750
-
4751
- void V8::ResumeProfilerEx(int flags, int tag) {
4752
- #ifdef ENABLE_LOGGING_AND_PROFILING
4753
4994
  i::Isolate* isolate = i::Isolate::Current();
4754
- if (flags & PROFILER_MODULE_HEAP_SNAPSHOT) {
4755
- // Snapshot mode: resume modules, perform GC, then pause only
4756
- // those modules which haven't been started prior to making a
4757
- // snapshot.
4758
-
4759
- // Make a GC prior to taking a snapshot.
4760
- isolate->heap()->CollectAllGarbage(false);
4761
- // Reset snapshot flag and CPU module flags.
4762
- flags &= ~(PROFILER_MODULE_HEAP_SNAPSHOT | PROFILER_MODULE_CPU);
4763
- const int current_flags = isolate->logger()->GetActiveProfilerModules();
4764
- isolate->logger()->ResumeProfiler(flags, tag);
4765
- isolate->heap()->CollectAllGarbage(false);
4766
- isolate->logger()->PauseProfiler(~current_flags & flags, tag);
4767
- } else {
4768
- isolate->logger()->ResumeProfiler(flags, tag);
4769
- }
4770
- #endif
4771
- }
4772
-
4773
-
4774
- void V8::PauseProfilerEx(int flags, int tag) {
4775
- #ifdef ENABLE_LOGGING_AND_PROFILING
4776
- LOGGER->PauseProfiler(flags, tag);
4777
- #endif
4778
- }
4779
-
4780
-
4781
- int V8::GetActiveProfilerModules() {
4782
- #ifdef ENABLE_LOGGING_AND_PROFILING
4783
- return LOGGER->GetActiveProfilerModules();
4784
- #else
4785
- return PROFILER_MODULE_NONE;
4786
- #endif
4787
- }
4788
-
4789
-
4790
- int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) {
4791
- #ifdef ENABLE_LOGGING_AND_PROFILING
4792
- ASSERT(max_size >= kMinimumSizeForLogLinesBuffer);
4793
- return LOGGER->GetLogLines(from_pos, dest_buf, max_size);
4794
- #endif
4795
- return 0;
4995
+ return isolate->logger()->IsProfilerPaused();
4796
4996
  }
4797
4997
 
4798
4998
 
@@ -4806,7 +5006,7 @@ int V8::GetCurrentThreadId() {
4806
5006
  void V8::TerminateExecution(int thread_id) {
4807
5007
  i::Isolate* isolate = i::Isolate::Current();
4808
5008
  if (!isolate->IsInitialized()) return;
4809
- API_ENTRY_CHECK("V8::TerminateExecution()");
5009
+ API_ENTRY_CHECK(isolate, "V8::TerminateExecution()");
4810
5010
  // If the thread_id identifies the current thread just terminate
4811
5011
  // execution right away. Otherwise, ask the thread manager to
4812
5012
  // terminate the thread with the given id if any.
@@ -4829,9 +5029,10 @@ void V8::TerminateExecution(Isolate* isolate) {
4829
5029
  }
4830
5030
 
4831
5031
 
4832
- bool V8::IsExecutionTerminating() {
4833
- i::Isolate* isolate = i::Isolate::Current();
4834
- return IsExecutionTerminatingCheck(isolate);
5032
+ bool V8::IsExecutionTerminating(Isolate* isolate) {
5033
+ i::Isolate* i_isolate = isolate != NULL ?
5034
+ reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current();
5035
+ return IsExecutionTerminatingCheck(i_isolate);
4835
5036
  }
4836
5037
 
4837
5038
 
@@ -5255,8 +5456,6 @@ Local<Context> Debug::GetDebugContext() {
5255
5456
  #endif // ENABLE_DEBUGGER_SUPPORT
5256
5457
 
5257
5458
 
5258
- #ifdef ENABLE_LOGGING_AND_PROFILING
5259
-
5260
5459
  Handle<String> CpuProfileNode::GetFunctionName() const {
5261
5460
  i::Isolate* isolate = i::Isolate::Current();
5262
5461
  IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName");
@@ -5443,6 +5642,7 @@ static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
5443
5642
  reinterpret_cast<const i::HeapGraphEdge*>(edge));
5444
5643
  }
5445
5644
 
5645
+
5446
5646
  HeapGraphEdge::Type HeapGraphEdge::GetType() const {
5447
5647
  i::Isolate* isolate = i::Isolate::Current();
5448
5648
  IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType");
@@ -5511,19 +5711,10 @@ Handle<String> HeapGraphNode::GetName() const {
5511
5711
  uint64_t HeapGraphNode::GetId() const {
5512
5712
  i::Isolate* isolate = i::Isolate::Current();
5513
5713
  IsDeadCheck(isolate, "v8::HeapGraphNode::GetId");
5514
- ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated);
5515
5714
  return ToInternal(this)->id();
5516
5715
  }
5517
5716
 
5518
5717
 
5519
- int HeapGraphNode::GetInstancesCount() const {
5520
- i::Isolate* isolate = i::Isolate::Current();
5521
- IsDeadCheck(isolate, "v8::HeapGraphNode::GetInstancesCount");
5522
- ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated);
5523
- return static_cast<int>(ToInternal(this)->id());
5524
- }
5525
-
5526
-
5527
5718
  int HeapGraphNode::GetSelfSize() const {
5528
5719
  i::Isolate* isolate = i::Isolate::Current();
5529
5720
  IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize");
@@ -5630,6 +5821,21 @@ const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const {
5630
5821
  }
5631
5822
 
5632
5823
 
5824
+ int HeapSnapshot::GetNodesCount() const {
5825
+ i::Isolate* isolate = i::Isolate::Current();
5826
+ IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodesCount");
5827
+ return ToInternal(this)->entries()->length();
5828
+ }
5829
+
5830
+
5831
+ const HeapGraphNode* HeapSnapshot::GetNode(int index) const {
5832
+ i::Isolate* isolate = i::Isolate::Current();
5833
+ IsDeadCheck(isolate, "v8::HeapSnapshot::GetNode");
5834
+ return reinterpret_cast<const HeapGraphNode*>(
5835
+ ToInternal(this)->entries()->at(index));
5836
+ }
5837
+
5838
+
5633
5839
  void HeapSnapshot::Serialize(OutputStream* stream,
5634
5840
  HeapSnapshot::SerializationFormat format) const {
5635
5841
  i::Isolate* isolate = i::Isolate::Current();
@@ -5681,9 +5887,6 @@ const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
5681
5887
  case HeapSnapshot::kFull:
5682
5888
  internal_type = i::HeapSnapshot::kFull;
5683
5889
  break;
5684
- case HeapSnapshot::kAggregated:
5685
- internal_type = i::HeapSnapshot::kAggregated;
5686
- break;
5687
5890
  default:
5688
5891
  UNREACHABLE();
5689
5892
  }
@@ -5706,7 +5909,6 @@ void HeapProfiler::DefineWrapperClass(uint16_t class_id,
5706
5909
  callback);
5707
5910
  }
5708
5911
 
5709
- #endif // ENABLE_LOGGING_AND_PROFILING
5710
5912
 
5711
5913
 
5712
5914
  v8::Testing::StressType internal::Testing::stress_type_ =