libv8 3.3.10.4 → 3.5.10.beta1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -48,41 +48,48 @@
48
48
  // - Object
49
49
  // - Smi (immediate small integer)
50
50
  // - HeapObject (superclass for everything allocated in the heap)
51
- // - JSObject
52
- // - JSArray
53
- // - JSRegExp
54
- // - JSFunction
55
- // - GlobalObject
56
- // - JSGlobalObject
57
- // - JSBuiltinsObject
58
- // - JSGlobalProxy
59
- // - JSValue
60
- // - JSMessageObject
61
- // - ByteArray
62
- // - ExternalArray
63
- // - ExternalPixelArray
64
- // - ExternalByteArray
65
- // - ExternalUnsignedByteArray
66
- // - ExternalShortArray
67
- // - ExternalUnsignedShortArray
68
- // - ExternalIntArray
69
- // - ExternalUnsignedIntArray
70
- // - ExternalFloatArray
71
- // - FixedArray
72
- // - DescriptorArray
73
- // - HashTable
74
- // - Dictionary
75
- // - SymbolTable
76
- // - CompilationCacheTable
77
- // - CodeCacheHashTable
78
- // - MapCache
79
- // - Context
80
- // - JSFunctionResultCache
81
- // - SerializedScopeInfo
51
+ // - JSReceiver (suitable for property access)
52
+ // - JSObject
53
+ // - JSArray
54
+ // - JSWeakMap
55
+ // - JSRegExp
56
+ // - JSFunction
57
+ // - GlobalObject
58
+ // - JSGlobalObject
59
+ // - JSBuiltinsObject
60
+ // - JSGlobalProxy
61
+ // - JSValue
62
+ // - JSMessageObject
63
+ // - JSProxy
64
+ // - JSFunctionProxy
65
+ // - FixedArrayBase
66
+ // - ByteArray
67
+ // - FixedArray
68
+ // - DescriptorArray
69
+ // - HashTable
70
+ // - Dictionary
71
+ // - SymbolTable
72
+ // - CompilationCacheTable
73
+ // - CodeCacheHashTable
74
+ // - MapCache
75
+ // - Context
76
+ // - JSFunctionResultCache
77
+ // - SerializedScopeInfo
78
+ // - FixedDoubleArray
79
+ // - ExternalArray
80
+ // - ExternalPixelArray
81
+ // - ExternalByteArray
82
+ // - ExternalUnsignedByteArray
83
+ // - ExternalShortArray
84
+ // - ExternalUnsignedShortArray
85
+ // - ExternalIntArray
86
+ // - ExternalUnsignedIntArray
87
+ // - ExternalFloatArray
82
88
  // - String
83
89
  // - SeqString
84
90
  // - SeqAsciiString
85
91
  // - SeqTwoByteString
92
+ // - SlicedString
86
93
  // - ConsString
87
94
  // - ExternalString
88
95
  // - ExternalAsciiString
@@ -91,7 +98,6 @@
91
98
  // - Code
92
99
  // - Map
93
100
  // - Oddball
94
- // - JSProxy
95
101
  // - Foreign
96
102
  // - SharedFunctionInfo
97
103
  // - Struct
@@ -134,7 +140,6 @@ namespace internal {
134
140
  // They are used both in property dictionaries and instance descriptors.
135
141
  class PropertyDetails BASE_EMBEDDED {
136
142
  public:
137
-
138
143
  PropertyDetails(PropertyAttributes attributes,
139
144
  PropertyType type,
140
145
  int index = 0) {
@@ -214,6 +219,7 @@ class PropertyDetails BASE_EMBEDDED {
214
219
  class StorageField: public BitField<uint32_t, 8, 32-8> {};
215
220
 
216
221
  static const int kInitialIndex = 1;
222
+
217
223
  private:
218
224
  uint32_t value_;
219
225
  };
@@ -278,6 +284,7 @@ static const int kVariableSizeSentinel = 0;
278
284
  V(ASCII_STRING_TYPE) \
279
285
  V(CONS_STRING_TYPE) \
280
286
  V(CONS_ASCII_STRING_TYPE) \
287
+ V(SLICED_STRING_TYPE) \
281
288
  V(EXTERNAL_STRING_TYPE) \
282
289
  V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \
283
290
  V(EXTERNAL_ASCII_STRING_TYPE) \
@@ -289,7 +296,6 @@ static const int kVariableSizeSentinel = 0;
289
296
  V(JS_GLOBAL_PROPERTY_CELL_TYPE) \
290
297
  \
291
298
  V(HEAP_NUMBER_TYPE) \
292
- V(JS_PROXY_TYPE) \
293
299
  V(FOREIGN_TYPE) \
294
300
  V(BYTE_ARRAY_TYPE) \
295
301
  /* Note: the order of these external array */ \
@@ -315,8 +321,10 @@ static const int kVariableSizeSentinel = 0;
315
321
  V(TYPE_SWITCH_INFO_TYPE) \
316
322
  V(SCRIPT_TYPE) \
317
323
  V(CODE_CACHE_TYPE) \
324
+ V(POLYMORPHIC_CODE_CACHE_TYPE) \
318
325
  \
319
326
  V(FIXED_ARRAY_TYPE) \
327
+ V(FIXED_DOUBLE_ARRAY_TYPE) \
320
328
  V(SHARED_FUNCTION_INFO_TYPE) \
321
329
  \
322
330
  V(JS_MESSAGE_OBJECT_TYPE) \
@@ -328,9 +336,12 @@ static const int kVariableSizeSentinel = 0;
328
336
  V(JS_BUILTINS_OBJECT_TYPE) \
329
337
  V(JS_GLOBAL_PROXY_TYPE) \
330
338
  V(JS_ARRAY_TYPE) \
339
+ V(JS_PROXY_TYPE) \
340
+ V(JS_WEAK_MAP_TYPE) \
331
341
  V(JS_REGEXP_TYPE) \
332
342
  \
333
343
  V(JS_FUNCTION_TYPE) \
344
+ V(JS_FUNCTION_PROXY_TYPE) \
334
345
 
335
346
  #ifdef ENABLE_DEBUGGER_SUPPORT
336
347
  #define INSTANCE_TYPE_LIST_DEBUGGER(V) \
@@ -392,6 +403,14 @@ static const int kVariableSizeSentinel = 0;
392
403
  ConsString::kSize, \
393
404
  cons_ascii_string, \
394
405
  ConsAsciiString) \
406
+ V(SLICED_STRING_TYPE, \
407
+ SlicedString::kSize, \
408
+ sliced_string, \
409
+ SlicedString) \
410
+ V(SLICED_ASCII_STRING_TYPE, \
411
+ SlicedString::kSize, \
412
+ sliced_ascii_string, \
413
+ SlicedAsciiString) \
395
414
  V(EXTERNAL_STRING_TYPE, \
396
415
  ExternalTwoByteString::kSize, \
397
416
  external_string, \
@@ -424,7 +443,8 @@ static const int kVariableSizeSentinel = 0;
424
443
  V(SIGNATURE_INFO, SignatureInfo, signature_info) \
425
444
  V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \
426
445
  V(SCRIPT, Script, script) \
427
- V(CODE_CACHE, CodeCache, code_cache)
446
+ V(CODE_CACHE, CodeCache, code_cache) \
447
+ V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache)
428
448
 
429
449
  #ifdef ENABLE_DEBUGGER_SUPPORT
430
450
  #define STRUCT_LIST_DEBUGGER(V) \
@@ -464,9 +484,22 @@ const uint32_t kStringRepresentationMask = 0x03;
464
484
  enum StringRepresentationTag {
465
485
  kSeqStringTag = 0x0,
466
486
  kConsStringTag = 0x1,
467
- kExternalStringTag = 0x2
487
+ kExternalStringTag = 0x2,
488
+ kSlicedStringTag = 0x3
468
489
  };
469
- const uint32_t kIsConsStringMask = 0x1;
490
+ const uint32_t kIsIndirectStringMask = 0x1;
491
+ const uint32_t kIsIndirectStringTag = 0x1;
492
+ STATIC_ASSERT((kSeqStringTag & kIsIndirectStringMask) == 0);
493
+ STATIC_ASSERT((kExternalStringTag & kIsIndirectStringMask) == 0);
494
+ STATIC_ASSERT(
495
+ (kConsStringTag & kIsIndirectStringMask) == kIsIndirectStringTag);
496
+ STATIC_ASSERT(
497
+ (kSlicedStringTag & kIsIndirectStringMask) == kIsIndirectStringTag);
498
+
499
+ // Use this mask to distinguish between cons and slice only after making
500
+ // sure that the string is one of the two (an indirect string).
501
+ const uint32_t kSlicedNotConsMask = kSlicedStringTag & ~kConsStringTag;
502
+ STATIC_ASSERT(IS_POWER_OF_TWO(kSlicedNotConsMask) && kSlicedNotConsMask != 0);
470
503
 
471
504
  // If bit 7 is clear, then bit 3 indicates whether this two-byte
472
505
  // string actually contains ascii data.
@@ -501,6 +534,8 @@ enum InstanceType {
501
534
  ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag,
502
535
  CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag,
503
536
  CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag,
537
+ SLICED_STRING_TYPE = kTwoByteStringTag | kSlicedStringTag,
538
+ SLICED_ASCII_STRING_TYPE = kAsciiStringTag | kSlicedStringTag,
504
539
  EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag,
505
540
  EXTERNAL_STRING_WITH_ASCII_DATA_TYPE =
506
541
  kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag,
@@ -518,7 +553,6 @@ enum InstanceType {
518
553
  // objects.
519
554
  HEAP_NUMBER_TYPE,
520
555
  FOREIGN_TYPE,
521
- JS_PROXY_TYPE,
522
556
  BYTE_ARRAY_TYPE,
523
557
  EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
524
558
  EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
@@ -529,6 +563,7 @@ enum InstanceType {
529
563
  EXTERNAL_FLOAT_ARRAY_TYPE,
530
564
  EXTERNAL_DOUBLE_ARRAY_TYPE,
531
565
  EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
566
+ FIXED_DOUBLE_ARRAY_TYPE,
532
567
  FILLER_TYPE, // LAST_DATA_TYPE
533
568
 
534
569
  // Structs.
@@ -542,6 +577,7 @@ enum InstanceType {
542
577
  TYPE_SWITCH_INFO_TYPE,
543
578
  SCRIPT_TYPE,
544
579
  CODE_CACHE_TYPE,
580
+ POLYMORPHIC_CODE_CACHE_TYPE,
545
581
  // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT
546
582
  // is defined. However as include/v8.h contain some of the instance type
547
583
  // constants always having them avoids them getting different numbers
@@ -554,21 +590,24 @@ enum InstanceType {
554
590
 
555
591
  JS_MESSAGE_OBJECT_TYPE,
556
592
 
557
- JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE
593
+ JS_VALUE_TYPE, // FIRST_NON_CALLABLE_OBJECT_TYPE, FIRST_JS_RECEIVER_TYPE
558
594
  JS_OBJECT_TYPE,
559
595
  JS_CONTEXT_EXTENSION_OBJECT_TYPE,
560
596
  JS_GLOBAL_OBJECT_TYPE,
561
597
  JS_BUILTINS_OBJECT_TYPE,
562
598
  JS_GLOBAL_PROXY_TYPE,
563
599
  JS_ARRAY_TYPE,
600
+ JS_PROXY_TYPE,
601
+ JS_WEAK_MAP_TYPE,
564
602
 
565
- JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE, FIRST_FUNCTION_CLASS_TYPE
603
+ JS_REGEXP_TYPE, // LAST_NONCALLABLE_SPEC_OBJECT_TYPE
566
604
 
567
- JS_FUNCTION_TYPE,
605
+ JS_FUNCTION_TYPE, // FIRST_CALLABLE_SPEC_OBJECT_TYPE
606
+ JS_FUNCTION_PROXY_TYPE, // LAST_CALLABLE_SPEC_OBJECT_TYPE
568
607
 
569
608
  // Pseudo-types
570
609
  FIRST_TYPE = 0x0,
571
- LAST_TYPE = JS_FUNCTION_TYPE,
610
+ LAST_TYPE = JS_FUNCTION_PROXY_TYPE,
572
611
  INVALID_TYPE = FIRST_TYPE - 1,
573
612
  FIRST_NONSTRING_TYPE = MAP_TYPE,
574
613
  // Boundaries for testing for an external array.
@@ -576,14 +615,22 @@ enum InstanceType {
576
615
  LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE,
577
616
  // Boundary for promotion to old data space/old pointer space.
578
617
  LAST_DATA_TYPE = FILLER_TYPE,
579
- // Boundaries for testing the type is a JavaScript "object". Note that
580
- // function objects are not counted as objects, even though they are
581
- // implemented as such; only values whose typeof is "object" are included.
582
- FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE,
583
- LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE,
584
- // RegExp objects have [[Class]] "function" because they are callable.
585
- // All types from this type and above are objects with [[Class]] "function".
586
- FIRST_FUNCTION_CLASS_TYPE = JS_REGEXP_TYPE
618
+ // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy).
619
+ // Note that there is no range for JSObject or JSProxy, since their subtypes
620
+ // are not continuous in this enum! The enum ranges instead reflect the
621
+ // external class names, where proxies are treated as either ordinary objects,
622
+ // or functions.
623
+ FIRST_JS_RECEIVER_TYPE = JS_VALUE_TYPE,
624
+ LAST_JS_RECEIVER_TYPE = LAST_TYPE,
625
+ // Boundaries for testing the types for which typeof is "object".
626
+ FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_VALUE_TYPE,
627
+ LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE,
628
+ // Boundaries for testing the types for which typeof is "function".
629
+ FIRST_CALLABLE_SPEC_OBJECT_TYPE = JS_FUNCTION_TYPE,
630
+ LAST_CALLABLE_SPEC_OBJECT_TYPE = JS_FUNCTION_PROXY_TYPE,
631
+ // Boundaries for testing whether the type is a JavaScript object.
632
+ FIRST_SPEC_OBJECT_TYPE = FIRST_NONCALLABLE_SPEC_OBJECT_TYPE,
633
+ LAST_SPEC_OBJECT_TYPE = LAST_CALLABLE_SPEC_OBJECT_TYPE
587
634
  };
588
635
 
589
636
  static const int kExternalArrayTypeCount = LAST_EXTERNAL_ARRAY_TYPE -
@@ -614,8 +661,11 @@ enum CompareResult {
614
661
  WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
615
662
 
616
663
 
617
- class StringStream;
664
+ class DictionaryElementsAccessor;
665
+ class ElementsAccessor;
666
+ class FixedArrayBase;
618
667
  class ObjectVisitor;
668
+ class StringStream;
619
669
 
620
670
  struct ValueInfo : public Malloced {
621
671
  ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
@@ -693,6 +743,7 @@ class MaybeObject BASE_EMBEDDED {
693
743
  V(SeqString) \
694
744
  V(ExternalString) \
695
745
  V(ConsString) \
746
+ V(SlicedString) \
696
747
  V(ExternalTwoByteString) \
697
748
  V(ExternalAsciiString) \
698
749
  V(SeqTwoByteString) \
@@ -709,6 +760,7 @@ class MaybeObject BASE_EMBEDDED {
709
760
  V(ExternalDoubleArray) \
710
761
  V(ExternalPixelArray) \
711
762
  V(ByteArray) \
763
+ V(JSReceiver) \
712
764
  V(JSObject) \
713
765
  V(JSContextExtensionObject) \
714
766
  V(Map) \
@@ -716,9 +768,10 @@ class MaybeObject BASE_EMBEDDED {
716
768
  V(DeoptimizationInputData) \
717
769
  V(DeoptimizationOutputData) \
718
770
  V(FixedArray) \
771
+ V(FixedDoubleArray) \
719
772
  V(Context) \
720
- V(CatchContext) \
721
773
  V(GlobalContext) \
774
+ V(SerializedScopeInfo) \
722
775
  V(JSFunction) \
723
776
  V(Code) \
724
777
  V(Oddball) \
@@ -730,6 +783,8 @@ class MaybeObject BASE_EMBEDDED {
730
783
  V(Boolean) \
731
784
  V(JSArray) \
732
785
  V(JSProxy) \
786
+ V(JSFunctionProxy) \
787
+ V(JSWeakMap) \
733
788
  V(JSRegExp) \
734
789
  V(HashTable) \
735
790
  V(Dictionary) \
@@ -738,6 +793,7 @@ class MaybeObject BASE_EMBEDDED {
738
793
  V(NormalizedMapCache) \
739
794
  V(CompilationCacheTable) \
740
795
  V(CodeCacheHashTable) \
796
+ V(PolymorphicCodeCacheHashTable) \
741
797
  V(MapCache) \
742
798
  V(Primitive) \
743
799
  V(GlobalObject) \
@@ -771,6 +827,8 @@ class Object : public MaybeObject {
771
827
  STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
772
828
  #undef DECLARE_STRUCT_PREDICATE
773
829
 
830
+ INLINE(bool IsSpecObject());
831
+
774
832
  // Oddball testing.
775
833
  INLINE(bool IsUndefined());
776
834
  INLINE(bool IsNull());
@@ -782,6 +840,10 @@ class Object : public MaybeObject {
782
840
  // Extract the number.
783
841
  inline double Number();
784
842
 
843
+ // Returns true if the object is of the correct type to be used as a
844
+ // implementation of a JSObject's elements.
845
+ inline bool HasValidElements();
846
+
785
847
  inline bool HasSpecificClassOf(String* name);
786
848
 
787
849
  MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9.
@@ -1332,11 +1394,9 @@ class HeapNumber: public HeapObject {
1332
1394
  };
1333
1395
 
1334
1396
 
1335
- // The JSObject describes real heap allocated JavaScript objects with
1336
- // properties.
1337
- // Note that the map of JSObject changes during execution to enable inline
1338
- // caching.
1339
- class JSObject: public HeapObject {
1397
+ // JSReceiver includes types on which properties can be defined, i.e.,
1398
+ // JSObject and JSProxy.
1399
+ class JSReceiver: public HeapObject {
1340
1400
  public:
1341
1401
  enum DeleteMode {
1342
1402
  NORMAL_DELETION,
@@ -1344,11 +1404,77 @@ class JSObject: public HeapObject {
1344
1404
  FORCE_DELETION
1345
1405
  };
1346
1406
 
1407
+ // Casting.
1408
+ static inline JSReceiver* cast(Object* obj);
1409
+
1410
+ // Can cause GC.
1411
+ MUST_USE_RESULT MaybeObject* SetProperty(String* key,
1412
+ Object* value,
1413
+ PropertyAttributes attributes,
1414
+ StrictModeFlag strict_mode);
1415
+ MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result,
1416
+ String* key,
1417
+ Object* value,
1418
+ PropertyAttributes attributes,
1419
+ StrictModeFlag strict_mode);
1420
+
1421
+ MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode);
1422
+
1423
+ // Returns the class name ([[Class]] property in the specification).
1424
+ String* class_name();
1425
+
1426
+ // Returns the constructor name (the name (possibly, inferred name) of the
1427
+ // function that was used to instantiate the object).
1428
+ String* constructor_name();
1429
+
1430
+ inline PropertyAttributes GetPropertyAttribute(String* name);
1431
+ PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver,
1432
+ String* name);
1433
+ PropertyAttributes GetLocalPropertyAttribute(String* name);
1434
+
1435
+ // Can cause a GC.
1436
+ inline bool HasProperty(String* name);
1437
+ inline bool HasLocalProperty(String* name);
1438
+
1439
+ // Return the object's prototype (might be Heap::null_value()).
1440
+ inline Object* GetPrototype();
1441
+
1442
+ // Set the object's prototype (only JSReceiver and null are allowed).
1443
+ MUST_USE_RESULT MaybeObject* SetPrototype(Object* value,
1444
+ bool skip_hidden_prototypes);
1445
+
1446
+ // Lookup a property. If found, the result is valid and has
1447
+ // detailed information.
1448
+ void LocalLookup(String* name, LookupResult* result);
1449
+ void Lookup(String* name, LookupResult* result);
1450
+
1451
+ private:
1452
+ PropertyAttributes GetPropertyAttribute(JSReceiver* receiver,
1453
+ LookupResult* result,
1454
+ String* name,
1455
+ bool continue_search);
1456
+
1457
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver);
1458
+ };
1459
+
1460
+ // The JSObject describes real heap allocated JavaScript objects with
1461
+ // properties.
1462
+ // Note that the map of JSObject changes during execution to enable inline
1463
+ // caching.
1464
+ class JSObject: public JSReceiver {
1465
+ public:
1347
1466
  enum ElementsKind {
1348
- // The only "fast" kind.
1467
+ // The "fast" kind for tagged values. Must be first to make it possible
1468
+ // to efficiently check maps if they have fast elements.
1349
1469
  FAST_ELEMENTS,
1350
- // All the kinds below are "slow".
1470
+
1471
+ // The "fast" kind for unwrapped, non-tagged double values.
1472
+ FAST_DOUBLE_ELEMENTS,
1473
+
1474
+ // The "slow" kind.
1351
1475
  DICTIONARY_ELEMENTS,
1476
+ NON_STRICT_ARGUMENTS_ELEMENTS,
1477
+ // The "fast" kind for external arrays
1352
1478
  EXTERNAL_BYTE_ELEMENTS,
1353
1479
  EXTERNAL_UNSIGNED_BYTE_ELEMENTS,
1354
1480
  EXTERNAL_SHORT_ELEMENTS,
@@ -1357,9 +1483,18 @@ class JSObject: public HeapObject {
1357
1483
  EXTERNAL_UNSIGNED_INT_ELEMENTS,
1358
1484
  EXTERNAL_FLOAT_ELEMENTS,
1359
1485
  EXTERNAL_DOUBLE_ELEMENTS,
1360
- EXTERNAL_PIXEL_ELEMENTS
1486
+ EXTERNAL_PIXEL_ELEMENTS,
1487
+
1488
+ // Derived constants from ElementsKind
1489
+ FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_BYTE_ELEMENTS,
1490
+ LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS,
1491
+ FIRST_ELEMENTS_KIND = FAST_ELEMENTS,
1492
+ LAST_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS
1361
1493
  };
1362
1494
 
1495
+ static const int kElementsKindCount =
1496
+ LAST_ELEMENTS_KIND - FIRST_ELEMENTS_KIND + 1;
1497
+
1363
1498
  // [properties]: Backing storage for properties.
1364
1499
  // properties is a FixedArray in the fast case and a Dictionary in the
1365
1500
  // slow case.
@@ -1376,18 +1511,23 @@ class JSObject: public HeapObject {
1376
1511
  //
1377
1512
  // In the fast mode elements is a FixedArray and so each element can
1378
1513
  // be quickly accessed. This fact is used in the generated code. The
1379
- // elements array can have one of the two maps in this mode:
1380
- // fixed_array_map or fixed_cow_array_map (for copy-on-write
1381
- // arrays). In the latter case the elements array may be shared by a
1382
- // few objects and so before writing to any element the array must
1383
- // be copied. Use EnsureWritableFastElements in this case.
1514
+ // elements array can have one of three maps in this mode:
1515
+ // fixed_array_map, non_strict_arguments_elements_map or
1516
+ // fixed_cow_array_map (for copy-on-write arrays). In the latter case
1517
+ // the elements array may be shared by a few objects and so before
1518
+ // writing to any element the array must be copied. Use
1519
+ // EnsureWritableFastElements in this case.
1384
1520
  //
1385
- // In the slow mode elements is either a NumberDictionary or an ExternalArray.
1386
- DECL_ACCESSORS(elements, HeapObject)
1521
+ // In the slow mode the elements is either a NumberDictionary, an
1522
+ // ExternalArray, or a FixedArray parameter map for a (non-strict)
1523
+ // arguments object.
1524
+ DECL_ACCESSORS(elements, FixedArrayBase)
1387
1525
  inline void initialize_elements();
1388
1526
  MUST_USE_RESULT inline MaybeObject* ResetElements();
1389
1527
  inline ElementsKind GetElementsKind();
1528
+ inline ElementsAccessor* GetElementsAccessor();
1390
1529
  inline bool HasFastElements();
1530
+ inline bool HasFastDoubleElements();
1391
1531
  inline bool HasDictionaryElements();
1392
1532
  inline bool HasExternalPixelElements();
1393
1533
  inline bool HasExternalArrayElements();
@@ -1399,9 +1539,12 @@ class JSObject: public HeapObject {
1399
1539
  inline bool HasExternalUnsignedIntElements();
1400
1540
  inline bool HasExternalFloatElements();
1401
1541
  inline bool HasExternalDoubleElements();
1542
+ bool HasFastArgumentsElements();
1543
+ bool HasDictionaryArgumentsElements();
1402
1544
  inline bool AllowsSetElementsLength();
1403
1545
  inline NumberDictionary* element_dictionary(); // Gets slow elements.
1404
- // Requires: this->HasFastElements().
1546
+
1547
+ // Requires: HasFastElements().
1405
1548
  MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements();
1406
1549
 
1407
1550
  // Collects elements starting at index 0.
@@ -1412,11 +1555,7 @@ class JSObject: public HeapObject {
1412
1555
  // a dictionary, and it will stay a dictionary.
1413
1556
  MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit);
1414
1557
 
1415
- MUST_USE_RESULT MaybeObject* SetProperty(String* key,
1416
- Object* value,
1417
- PropertyAttributes attributes,
1418
- StrictModeFlag strict_mode);
1419
- MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result,
1558
+ MUST_USE_RESULT MaybeObject* SetPropertyForResult(LookupResult* result,
1420
1559
  String* key,
1421
1560
  Object* value,
1422
1561
  PropertyAttributes attributes,
@@ -1425,11 +1564,14 @@ class JSObject: public HeapObject {
1425
1564
  LookupResult* result,
1426
1565
  String* name,
1427
1566
  Object* value,
1428
- bool check_prototype);
1429
- MUST_USE_RESULT MaybeObject* SetPropertyWithCallback(Object* structure,
1430
- String* name,
1431
- Object* value,
1432
- JSObject* holder);
1567
+ bool check_prototype,
1568
+ StrictModeFlag strict_mode);
1569
+ MUST_USE_RESULT MaybeObject* SetPropertyWithCallback(
1570
+ Object* structure,
1571
+ String* name,
1572
+ Object* value,
1573
+ JSObject* holder,
1574
+ StrictModeFlag strict_mode);
1433
1575
  MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSFunction* setter,
1434
1576
  Object* value);
1435
1577
  MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor(
@@ -1465,21 +1607,22 @@ class JSObject: public HeapObject {
1465
1607
  MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(String* name,
1466
1608
  DeleteMode mode);
1467
1609
 
1468
- // Returns the class name ([[Class]] property in the specification).
1469
- String* class_name();
1470
-
1471
- // Returns the constructor name (the name (possibly, inferred name) of the
1472
- // function that was used to instantiate the object).
1473
- String* constructor_name();
1474
-
1475
1610
  // Retrieve interceptors.
1476
1611
  InterceptorInfo* GetNamedInterceptor();
1477
1612
  InterceptorInfo* GetIndexedInterceptor();
1478
1613
 
1479
- inline PropertyAttributes GetPropertyAttribute(String* name);
1480
- PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver,
1481
- String* name);
1482
- PropertyAttributes GetLocalPropertyAttribute(String* name);
1614
+ // Used from JSReceiver.
1615
+ PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver,
1616
+ String* name,
1617
+ bool continue_search);
1618
+ PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver,
1619
+ String* name,
1620
+ bool continue_search);
1621
+ PropertyAttributes GetPropertyAttributeWithFailedAccessCheck(
1622
+ Object* receiver,
1623
+ LookupResult* result,
1624
+ String* name,
1625
+ bool continue_search);
1483
1626
 
1484
1627
  MUST_USE_RESULT MaybeObject* DefineAccessor(String* name,
1485
1628
  bool is_getter,
@@ -1496,14 +1639,14 @@ class JSObject: public HeapObject {
1496
1639
  String* name,
1497
1640
  PropertyAttributes* attributes);
1498
1641
  MaybeObject* GetPropertyWithInterceptor(
1499
- JSObject* receiver,
1642
+ JSReceiver* receiver,
1500
1643
  String* name,
1501
1644
  PropertyAttributes* attributes);
1502
1645
  MaybeObject* GetPropertyPostInterceptor(
1503
- JSObject* receiver,
1646
+ JSReceiver* receiver,
1504
1647
  String* name,
1505
1648
  PropertyAttributes* attributes);
1506
- MaybeObject* GetLocalPropertyPostInterceptor(JSObject* receiver,
1649
+ MaybeObject* GetLocalPropertyPostInterceptor(JSReceiver* receiver,
1507
1650
  String* name,
1508
1651
  PropertyAttributes* attributes);
1509
1652
 
@@ -1511,15 +1654,6 @@ class JSObject: public HeapObject {
1511
1654
  // been modified since it was created. May give false positives.
1512
1655
  bool IsDirty();
1513
1656
 
1514
- bool HasProperty(String* name) {
1515
- return GetPropertyAttribute(name) != ABSENT;
1516
- }
1517
-
1518
- // Can cause a GC if it hits an interceptor.
1519
- bool HasLocalProperty(String* name) {
1520
- return GetLocalPropertyAttribute(name) != ABSENT;
1521
- }
1522
-
1523
1657
  // If the receiver is a JSGlobalProxy this method will return its prototype,
1524
1658
  // otherwise the result is the receiver itself.
1525
1659
  inline Object* BypassGlobalProxy();
@@ -1542,6 +1676,23 @@ class JSObject: public HeapObject {
1542
1676
  MUST_USE_RESULT inline MaybeObject* SetHiddenPropertiesObject(
1543
1677
  Object* hidden_obj);
1544
1678
 
1679
+ // Indicates whether the hidden properties object should be created.
1680
+ enum HiddenPropertiesFlag { ALLOW_CREATION, OMIT_CREATION };
1681
+
1682
+ // Retrieves the hidden properties object.
1683
+ //
1684
+ // The undefined value might be returned in case no hidden properties object
1685
+ // is present and creation was omitted.
1686
+ inline bool HasHiddenProperties();
1687
+ MUST_USE_RESULT MaybeObject* GetHiddenProperties(HiddenPropertiesFlag flag);
1688
+
1689
+ // Retrieves a permanent object identity hash code.
1690
+ //
1691
+ // The identity hash is stored as a hidden property. The undefined value might
1692
+ // be returned in case no hidden properties object is present and creation was
1693
+ // omitted.
1694
+ MUST_USE_RESULT MaybeObject* GetIdentityHash(HiddenPropertiesFlag flag);
1695
+
1545
1696
  MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode);
1546
1697
  MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode);
1547
1698
 
@@ -1556,17 +1707,13 @@ class JSObject: public HeapObject {
1556
1707
  // storage would. In that case the JSObject should have fast
1557
1708
  // elements.
1558
1709
  bool ShouldConvertToFastElements();
1559
-
1560
- // Return the object's prototype (might be Heap::null_value()).
1561
- inline Object* GetPrototype();
1562
-
1563
- // Set the object's prototype (only JSObject and null are allowed).
1564
- MUST_USE_RESULT MaybeObject* SetPrototype(Object* value,
1565
- bool skip_hidden_prototypes);
1710
+ // Returns true if the elements of JSObject contains only values that can be
1711
+ // represented in a FixedDoubleArray.
1712
+ bool CanConvertToFastDoubleElements();
1566
1713
 
1567
1714
  // Tells whether the index'th element is present.
1568
1715
  inline bool HasElement(uint32_t index);
1569
- bool HasElementWithReceiver(JSObject* receiver, uint32_t index);
1716
+ bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index);
1570
1717
 
1571
1718
  // Computes the new capacity when expanding the elements of a JSObject.
1572
1719
  static int NewElementsCapacity(int old_capacity) {
@@ -1594,33 +1741,43 @@ class JSObject: public HeapObject {
1594
1741
 
1595
1742
  LocalElementType HasLocalElement(uint32_t index);
1596
1743
 
1597
- bool HasElementWithInterceptor(JSObject* receiver, uint32_t index);
1598
- bool HasElementPostInterceptor(JSObject* receiver, uint32_t index);
1744
+ bool HasElementWithInterceptor(JSReceiver* receiver, uint32_t index);
1745
+ bool HasElementPostInterceptor(JSReceiver* receiver, uint32_t index);
1599
1746
 
1600
1747
  MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index,
1601
1748
  Object* value,
1602
1749
  StrictModeFlag strict_mode,
1603
- bool check_prototype = true);
1750
+ bool check_prototype);
1751
+ MUST_USE_RESULT MaybeObject* SetDictionaryElement(uint32_t index,
1752
+ Object* value,
1753
+ StrictModeFlag strict_mode,
1754
+ bool check_prototype);
1755
+
1756
+ MUST_USE_RESULT MaybeObject* SetFastDoubleElement(
1757
+ uint32_t index,
1758
+ Object* value,
1759
+ StrictModeFlag strict_mode,
1760
+ bool check_prototype = true);
1604
1761
 
1605
1762
  // Set the index'th array element.
1606
1763
  // A Failure object is returned if GC is needed.
1607
1764
  MUST_USE_RESULT MaybeObject* SetElement(uint32_t index,
1608
1765
  Object* value,
1609
1766
  StrictModeFlag strict_mode,
1610
- bool check_prototype = true);
1767
+ bool check_prototype);
1611
1768
 
1612
1769
  // Returns the index'th element.
1613
1770
  // The undefined object if index is out of bounds.
1614
- MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index);
1615
1771
  MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index);
1616
1772
 
1617
- // Get external element value at index if there is one and undefined
1618
- // otherwise. Can return a failure if allocation of a heap number
1619
- // failed.
1620
- MaybeObject* GetExternalElement(uint32_t index);
1621
-
1773
+ // Replace the elements' backing store with fast elements of the given
1774
+ // capacity. Update the length for JSArrays. Returns the new backing
1775
+ // store.
1622
1776
  MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity,
1623
1777
  int length);
1778
+ MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
1779
+ int capacity,
1780
+ int length);
1624
1781
  MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length);
1625
1782
 
1626
1783
  // Lookup interceptors are used for handling properties controlled by host
@@ -1648,7 +1805,6 @@ class JSObject: public HeapObject {
1648
1805
  // Lookup a property. If found, the result is valid and has
1649
1806
  // detailed information.
1650
1807
  void LocalLookup(String* name, LookupResult* result);
1651
- void Lookup(String* name, LookupResult* result);
1652
1808
 
1653
1809
  // The following lookup functions skip interceptors.
1654
1810
  void LocalLookupRealNamedProperty(String* name, LookupResult* result);
@@ -1656,7 +1812,7 @@ class JSObject: public HeapObject {
1656
1812
  void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result);
1657
1813
  void LookupCallbackSetterInPrototypes(String* name, LookupResult* result);
1658
1814
  MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes(
1659
- uint32_t index, Object* value, bool* found);
1815
+ uint32_t index, Object* value, bool* found, StrictModeFlag strict_mode);
1660
1816
  void LookupCallback(String* name, LookupResult* result);
1661
1817
 
1662
1818
  // Returns the number of properties on this object filtering out properties
@@ -1746,6 +1902,9 @@ class JSObject: public HeapObject {
1746
1902
  MUST_USE_RESULT MaybeObject* NormalizeProperties(
1747
1903
  PropertyNormalizationMode mode,
1748
1904
  int expected_additional_properties);
1905
+
1906
+ // Convert and update the elements backing store to be a NumberDictionary
1907
+ // dictionary. Returns the backing after conversion.
1749
1908
  MUST_USE_RESULT MaybeObject* NormalizeElements();
1750
1909
 
1751
1910
  MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code);
@@ -1838,8 +1997,21 @@ class JSObject: public HeapObject {
1838
1997
  // Also maximal value of JSArray's length property.
1839
1998
  static const uint32_t kMaxElementCount = 0xffffffffu;
1840
1999
 
2000
+ // Constants for heuristics controlling conversion of fast elements
2001
+ // to slow elements.
2002
+
2003
+ // Maximal gap that can be introduced by adding an element beyond
2004
+ // the current elements length.
1841
2005
  static const uint32_t kMaxGap = 1024;
1842
- static const int kMaxFastElementsLength = 5000;
2006
+
2007
+ // Maximal length of fast elements array that won't be checked for
2008
+ // being dense enough on expansion.
2009
+ static const int kMaxUncheckedFastElementsLength = 5000;
2010
+
2011
+ // Same as above but for old arrays. This limit is more strict. We
2012
+ // don't want to be wasteful with long lived objects.
2013
+ static const int kMaxUncheckedOldFastElementsLength = 500;
2014
+
1843
2015
  static const int kInitialMaxFastElementArray = 100000;
1844
2016
  static const int kMaxFastProperties = 12;
1845
2017
  static const int kMaxInstanceSize = 255 * kPointerSize;
@@ -1861,6 +2033,8 @@ class JSObject: public HeapObject {
1861
2033
  };
1862
2034
 
1863
2035
  private:
2036
+ friend class DictionaryElementsAccessor;
2037
+
1864
2038
  MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
1865
2039
  Object* structure,
1866
2040
  uint32_t index,
@@ -1868,7 +2042,8 @@ class JSObject: public HeapObject {
1868
2042
  MaybeObject* SetElementWithCallback(Object* structure,
1869
2043
  uint32_t index,
1870
2044
  Object* value,
1871
- JSObject* holder);
2045
+ JSObject* holder,
2046
+ StrictModeFlag strict_mode);
1872
2047
  MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(
1873
2048
  uint32_t index,
1874
2049
  Object* value,
@@ -1880,35 +2055,29 @@ class JSObject: public HeapObject {
1880
2055
  StrictModeFlag strict_mode,
1881
2056
  bool check_prototype);
1882
2057
 
1883
- MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index);
1884
-
1885
2058
  MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name,
1886
2059
  DeleteMode mode);
1887
2060
  MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name);
1888
2061
 
1889
- MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index,
1890
- DeleteMode mode);
1891
2062
  MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index);
1892
2063
 
1893
- PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver,
1894
- String* name,
1895
- bool continue_search);
1896
- PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver,
1897
- String* name,
1898
- bool continue_search);
1899
- PropertyAttributes GetPropertyAttributeWithFailedAccessCheck(
1900
- Object* receiver,
1901
- LookupResult* result,
1902
- String* name,
1903
- bool continue_search);
1904
- PropertyAttributes GetPropertyAttribute(JSObject* receiver,
1905
- LookupResult* result,
1906
- String* name,
1907
- bool continue_search);
2064
+ MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index);
2065
+ MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index,
2066
+ DeleteMode mode);
2067
+
2068
+ bool ReferencesObjectFromElements(FixedArray* elements,
2069
+ ElementsKind kind,
2070
+ Object* object);
2071
+ bool HasElementInElements(FixedArray* elements,
2072
+ ElementsKind kind,
2073
+ uint32_t index);
1908
2074
 
1909
2075
  // Returns true if most of the elements backing storage is used.
1910
2076
  bool HasDenseElements();
1911
2077
 
2078
+ // Gets the current elements capacity and the number of used elements.
2079
+ void GetElementsCapacityAndUsage(int* capacity, int* used);
2080
+
1912
2081
  bool CanSetCallback(String* name);
1913
2082
  MUST_USE_RESULT MaybeObject* SetElementCallback(
1914
2083
  uint32_t index,
@@ -1928,17 +2097,33 @@ class JSObject: public HeapObject {
1928
2097
  };
1929
2098
 
1930
2099
 
1931
- // FixedArray describes fixed-sized arrays with element type Object*.
1932
- class FixedArray: public HeapObject {
2100
+ // Common superclass for FixedArrays that allow implementations to share
2101
+ // common accessors and some code paths.
2102
+ class FixedArrayBase: public HeapObject {
1933
2103
  public:
1934
2104
  // [length]: length of the array.
1935
2105
  inline int length();
1936
2106
  inline void set_length(int value);
1937
2107
 
2108
+ inline static FixedArrayBase* cast(Object* object);
2109
+
2110
+ // Layout description.
2111
+ // Length is smi tagged when it is stored.
2112
+ static const int kLengthOffset = HeapObject::kHeaderSize;
2113
+ static const int kHeaderSize = kLengthOffset + kPointerSize;
2114
+ };
2115
+
2116
+
2117
+ class FixedDoubleArray;
2118
+
2119
+ // FixedArray describes fixed-sized arrays with element type Object*.
2120
+ class FixedArray: public FixedArrayBase {
2121
+ public:
1938
2122
  // Setter and getter for elements.
1939
2123
  inline Object* get(int index);
1940
2124
  // Setter that uses write barrier.
1941
2125
  inline void set(int index, Object* value);
2126
+ inline bool is_the_hole(int index);
1942
2127
 
1943
2128
  // Setter that doesn't need write barrier).
1944
2129
  inline void set(int index, Smi* value);
@@ -1985,11 +2170,6 @@ class FixedArray: public HeapObject {
1985
2170
  // Casting.
1986
2171
  static inline FixedArray* cast(Object* obj);
1987
2172
 
1988
- // Layout description.
1989
- // Length is smi tagged when it is stored.
1990
- static const int kLengthOffset = HeapObject::kHeaderSize;
1991
- static const int kHeaderSize = kLengthOffset + kPointerSize;
1992
-
1993
2173
  // Maximal allowed size, in bytes, of a single FixedArray.
1994
2174
  // Prevents overflowing size computations, as well as extreme memory
1995
2175
  // consumption.
@@ -2037,6 +2217,61 @@ class FixedArray: public HeapObject {
2037
2217
  };
2038
2218
 
2039
2219
 
2220
+ // FixedDoubleArray describes fixed-sized arrays with element type double.
2221
+ class FixedDoubleArray: public FixedArrayBase {
2222
+ public:
2223
+ inline void Initialize(FixedArray* from);
2224
+ inline void Initialize(FixedDoubleArray* from);
2225
+ inline void Initialize(NumberDictionary* from);
2226
+
2227
+ // Setter and getter for elements.
2228
+ inline double get_scalar(int index);
2229
+ inline MaybeObject* get(int index);
2230
+ inline void set(int index, double value);
2231
+ inline void set_the_hole(int index);
2232
+
2233
+ // Checking for the hole.
2234
+ inline bool is_the_hole(int index);
2235
+
2236
+ // Garbage collection support.
2237
+ inline static int SizeFor(int length) {
2238
+ return kHeaderSize + length * kDoubleSize;
2239
+ }
2240
+
2241
+ // Code Generation support.
2242
+ static int OffsetOfElementAt(int index) { return SizeFor(index); }
2243
+
2244
+ inline static bool is_the_hole_nan(double value);
2245
+ inline static double hole_nan_as_double();
2246
+ inline static double canonical_not_the_hole_nan_as_double();
2247
+
2248
+ // Casting.
2249
+ static inline FixedDoubleArray* cast(Object* obj);
2250
+
2251
+ // Maximal allowed size, in bytes, of a single FixedDoubleArray.
2252
+ // Prevents overflowing size computations, as well as extreme memory
2253
+ // consumption.
2254
+ static const int kMaxSize = 512 * MB;
2255
+ // Maximally allowed length of a FixedArray.
2256
+ static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize;
2257
+
2258
+ // Dispatched behavior.
2259
+ #ifdef OBJECT_PRINT
2260
+ inline void FixedDoubleArrayPrint() {
2261
+ FixedDoubleArrayPrint(stdout);
2262
+ }
2263
+ void FixedDoubleArrayPrint(FILE* out);
2264
+ #endif
2265
+
2266
+ #ifdef DEBUG
2267
+ void FixedDoubleArrayVerify();
2268
+ #endif
2269
+
2270
+ private:
2271
+ DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray);
2272
+ };
2273
+
2274
+
2040
2275
  // DescriptorArrays are fixed arrays used to hold instance descriptors.
2041
2276
  // The format of the these objects is:
2042
2277
  // TODO(1399): It should be possible to make room for bit_field3 in the map
@@ -2318,6 +2553,10 @@ class HashTable: public FixedArray {
2318
2553
  int at_least_space_for,
2319
2554
  PretenureFlag pretenure = NOT_TENURED);
2320
2555
 
2556
+ // Computes the required capacity for a table holding the given
2557
+ // number of elements. May be more than HashTable::kMaxCapacity.
2558
+ static int ComputeCapacity(int at_least_space_for);
2559
+
2321
2560
  // Returns the key at entry.
2322
2561
  Object* KeyAt(int entry) { return get(EntryToIndex(entry)); }
2323
2562
 
@@ -2365,7 +2604,6 @@ class HashTable: public FixedArray {
2365
2604
  int FindEntry(Isolate* isolate, Key key);
2366
2605
 
2367
2606
  protected:
2368
-
2369
2607
  // Find the entry at which to insert element with the given key that
2370
2608
  // has the given hash value.
2371
2609
  uint32_t FindInsertionEntry(uint32_t hash);
@@ -2410,6 +2648,12 @@ class HashTable: public FixedArray {
2410
2648
  return (last + number) & (size - 1);
2411
2649
  }
2412
2650
 
2651
+ // Rehashes this hash-table into the new table.
2652
+ MUST_USE_RESULT MaybeObject* Rehash(HashTable* new_table, Key key);
2653
+
2654
+ // Attempt to shrink hash table after removal of key.
2655
+ MUST_USE_RESULT MaybeObject* Shrink(Key key);
2656
+
2413
2657
  // Ensure enough space for n additional elements.
2414
2658
  MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key);
2415
2659
  };
@@ -2532,7 +2776,6 @@ class MapCache: public HashTable<MapCacheShape, HashTableKey*> {
2532
2776
  template <typename Shape, typename Key>
2533
2777
  class Dictionary: public HashTable<Shape, Key> {
2534
2778
  public:
2535
-
2536
2779
  static inline Dictionary<Shape, Key>* cast(Object* obj) {
2537
2780
  return reinterpret_cast<Dictionary<Shape, Key>*>(obj);
2538
2781
  }
@@ -2575,6 +2818,9 @@ class Dictionary: public HashTable<Shape, Key> {
2575
2818
  // Delete a property from the dictionary.
2576
2819
  Object* DeleteProperty(int entry, JSObject::DeleteMode mode);
2577
2820
 
2821
+ // Attempt to shrink the dictionary after deletion of key.
2822
+ MUST_USE_RESULT MaybeObject* Shrink(Key key);
2823
+
2578
2824
  // Returns the number of elements in the dictionary filtering out properties
2579
2825
  // with the specified attributes.
2580
2826
  int NumberOfElementsFilterAttributes(PropertyAttributes filter);
@@ -2582,10 +2828,13 @@ class Dictionary: public HashTable<Shape, Key> {
2582
2828
  // Returns the number of enumerable elements in the dictionary.
2583
2829
  int NumberOfEnumElements();
2584
2830
 
2831
+ enum SortMode { UNSORTED, SORTED };
2585
2832
  // Copies keys to preallocated fixed array.
2586
- void CopyKeysTo(FixedArray* storage, PropertyAttributes filter);
2833
+ void CopyKeysTo(FixedArray* storage,
2834
+ PropertyAttributes filter,
2835
+ SortMode sort_mode);
2587
2836
  // Fill in details for properties into storage.
2588
- void CopyKeysTo(FixedArray* storage);
2837
+ void CopyKeysTo(FixedArray* storage, int index, SortMode sort_mode);
2589
2838
 
2590
2839
  // Accessors for next enumeration index.
2591
2840
  void SetNextEnumerationIndex(int index) {
@@ -2730,6 +2979,48 @@ class NumberDictionary: public Dictionary<NumberDictionaryShape, uint32_t> {
2730
2979
  };
2731
2980
 
2732
2981
 
2982
+ class ObjectHashTableShape {
2983
+ public:
2984
+ static inline bool IsMatch(JSObject* key, Object* other);
2985
+ static inline uint32_t Hash(JSObject* key);
2986
+ static inline uint32_t HashForObject(JSObject* key, Object* object);
2987
+ MUST_USE_RESULT static inline MaybeObject* AsObject(JSObject* key);
2988
+ static const int kPrefixSize = 0;
2989
+ static const int kEntrySize = 2;
2990
+ };
2991
+
2992
+
2993
+ // ObjectHashTable maps keys that are JavaScript objects to object values by
2994
+ // using the identity hash of the key for hashing purposes.
2995
+ class ObjectHashTable: public HashTable<ObjectHashTableShape, JSObject*> {
2996
+ public:
2997
+ static inline ObjectHashTable* cast(Object* obj) {
2998
+ ASSERT(obj->IsHashTable());
2999
+ return reinterpret_cast<ObjectHashTable*>(obj);
3000
+ }
3001
+
3002
+ // Looks up the value associated with the given key. The undefined value is
3003
+ // returned in case the key is not present.
3004
+ Object* Lookup(JSObject* key);
3005
+
3006
+ // Adds (or overwrites) the value associated with the given key. Mapping a
3007
+ // key to the undefined value causes removal of the whole entry.
3008
+ MUST_USE_RESULT MaybeObject* Put(JSObject* key, Object* value);
3009
+
3010
+ private:
3011
+ friend class MarkCompactCollector;
3012
+
3013
+ void AddEntry(int entry, JSObject* key, Object* value);
3014
+ void RemoveEntry(int entry, Heap* heap);
3015
+ inline void RemoveEntry(int entry);
3016
+
3017
+ // Returns the index to the value of an entry.
3018
+ static inline int EntryToValueIndex(int entry) {
3019
+ return EntryToIndex(entry) + 1;
3020
+ }
3021
+ };
3022
+
3023
+
2733
3024
  // JSFunctionResultCache caches results of some JSFunction invocation.
2734
3025
  // It is a fixed array with fixed structure:
2735
3026
  // [0]: factory function
@@ -2786,23 +3077,14 @@ class NormalizedMapCache: public FixedArray {
2786
3077
  #ifdef DEBUG
2787
3078
  void NormalizedMapCacheVerify();
2788
3079
  #endif
2789
-
2790
- private:
2791
- static int Hash(Map* fast);
2792
-
2793
- static bool CheckHit(Map* slow, Map* fast, PropertyNormalizationMode mode);
2794
3080
  };
2795
3081
 
2796
3082
 
2797
3083
  // ByteArray represents fixed sized byte arrays. Used by the outside world,
2798
3084
  // such as PCRE, and also by the memory allocator and garbage collector to
2799
3085
  // fill in free blocks in the heap.
2800
- class ByteArray: public HeapObject {
3086
+ class ByteArray: public FixedArrayBase {
2801
3087
  public:
2802
- // [length]: length of the array.
2803
- inline int length();
2804
- inline void set_length(int value);
2805
-
2806
3088
  // Setter and getter.
2807
3089
  inline byte get(int index);
2808
3090
  inline void set(int index, byte value);
@@ -2847,10 +3129,6 @@ class ByteArray: public HeapObject {
2847
3129
  #endif
2848
3130
 
2849
3131
  // Layout description.
2850
- // Length is smi tagged when it is stored.
2851
- static const int kLengthOffset = HeapObject::kHeaderSize;
2852
- static const int kHeaderSize = kLengthOffset + kPointerSize;
2853
-
2854
3132
  static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
2855
3133
 
2856
3134
  // Maximal memory consumption for a single ByteArray.
@@ -2874,11 +3152,10 @@ class ByteArray: public HeapObject {
2874
3152
  // Out-of-range values passed to the setter are converted via a C
2875
3153
  // cast, not clamping. Out-of-range indices cause exceptions to be
2876
3154
  // raised rather than being silently ignored.
2877
- class ExternalArray: public HeapObject {
3155
+ class ExternalArray: public FixedArrayBase {
2878
3156
  public:
2879
- // [length]: length of the array.
2880
- inline int length();
2881
- inline void set_length(int value);
3157
+
3158
+ inline bool is_the_hole(int index) { return false; }
2882
3159
 
2883
3160
  // [external_pointer]: The pointer to the external memory area backing this
2884
3161
  // external array.
@@ -2891,9 +3168,8 @@ class ExternalArray: public HeapObject {
2891
3168
  static const int kMaxLength = 0x3fffffff;
2892
3169
 
2893
3170
  // ExternalArray headers are not quadword aligned.
2894
- static const int kLengthOffset = HeapObject::kHeaderSize;
2895
3171
  static const int kExternalPointerOffset =
2896
- POINTER_SIZE_ALIGN(kLengthOffset + kIntSize);
3172
+ POINTER_SIZE_ALIGN(FixedArrayBase::kLengthOffset + kPointerSize);
2897
3173
  static const int kHeaderSize = kExternalPointerOffset + kPointerSize;
2898
3174
  static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
2899
3175
 
@@ -2915,7 +3191,8 @@ class ExternalPixelArray: public ExternalArray {
2915
3191
  inline uint8_t* external_pixel_pointer();
2916
3192
 
2917
3193
  // Setter and getter.
2918
- inline uint8_t get(int index);
3194
+ inline uint8_t get_scalar(int index);
3195
+ inline MaybeObject* get(int index);
2919
3196
  inline void set(int index, uint8_t value);
2920
3197
 
2921
3198
  // This accessor applies the correct conversion from Smi, HeapNumber and
@@ -2943,7 +3220,8 @@ class ExternalPixelArray: public ExternalArray {
2943
3220
  class ExternalByteArray: public ExternalArray {
2944
3221
  public:
2945
3222
  // Setter and getter.
2946
- inline int8_t get(int index);
3223
+ inline int8_t get_scalar(int index);
3224
+ inline MaybeObject* get(int index);
2947
3225
  inline void set(int index, int8_t value);
2948
3226
 
2949
3227
  // This accessor applies the correct conversion from Smi, HeapNumber
@@ -2971,7 +3249,8 @@ class ExternalByteArray: public ExternalArray {
2971
3249
  class ExternalUnsignedByteArray: public ExternalArray {
2972
3250
  public:
2973
3251
  // Setter and getter.
2974
- inline uint8_t get(int index);
3252
+ inline uint8_t get_scalar(int index);
3253
+ inline MaybeObject* get(int index);
2975
3254
  inline void set(int index, uint8_t value);
2976
3255
 
2977
3256
  // This accessor applies the correct conversion from Smi, HeapNumber
@@ -2999,7 +3278,8 @@ class ExternalUnsignedByteArray: public ExternalArray {
2999
3278
  class ExternalShortArray: public ExternalArray {
3000
3279
  public:
3001
3280
  // Setter and getter.
3002
- inline int16_t get(int index);
3281
+ inline int16_t get_scalar(int index);
3282
+ inline MaybeObject* get(int index);
3003
3283
  inline void set(int index, int16_t value);
3004
3284
 
3005
3285
  // This accessor applies the correct conversion from Smi, HeapNumber
@@ -3027,7 +3307,8 @@ class ExternalShortArray: public ExternalArray {
3027
3307
  class ExternalUnsignedShortArray: public ExternalArray {
3028
3308
  public:
3029
3309
  // Setter and getter.
3030
- inline uint16_t get(int index);
3310
+ inline uint16_t get_scalar(int index);
3311
+ inline MaybeObject* get(int index);
3031
3312
  inline void set(int index, uint16_t value);
3032
3313
 
3033
3314
  // This accessor applies the correct conversion from Smi, HeapNumber
@@ -3055,7 +3336,8 @@ class ExternalUnsignedShortArray: public ExternalArray {
3055
3336
  class ExternalIntArray: public ExternalArray {
3056
3337
  public:
3057
3338
  // Setter and getter.
3058
- inline int32_t get(int index);
3339
+ inline int32_t get_scalar(int index);
3340
+ inline MaybeObject* get(int index);
3059
3341
  inline void set(int index, int32_t value);
3060
3342
 
3061
3343
  // This accessor applies the correct conversion from Smi, HeapNumber
@@ -3083,7 +3365,8 @@ class ExternalIntArray: public ExternalArray {
3083
3365
  class ExternalUnsignedIntArray: public ExternalArray {
3084
3366
  public:
3085
3367
  // Setter and getter.
3086
- inline uint32_t get(int index);
3368
+ inline uint32_t get_scalar(int index);
3369
+ inline MaybeObject* get(int index);
3087
3370
  inline void set(int index, uint32_t value);
3088
3371
 
3089
3372
  // This accessor applies the correct conversion from Smi, HeapNumber
@@ -3111,7 +3394,8 @@ class ExternalUnsignedIntArray: public ExternalArray {
3111
3394
  class ExternalFloatArray: public ExternalArray {
3112
3395
  public:
3113
3396
  // Setter and getter.
3114
- inline float get(int index);
3397
+ inline float get_scalar(int index);
3398
+ inline MaybeObject* get(int index);
3115
3399
  inline void set(int index, float value);
3116
3400
 
3117
3401
  // This accessor applies the correct conversion from Smi, HeapNumber
@@ -3139,7 +3423,8 @@ class ExternalFloatArray: public ExternalArray {
3139
3423
  class ExternalDoubleArray: public ExternalArray {
3140
3424
  public:
3141
3425
  // Setter and getter.
3142
- inline double get(int index);
3426
+ inline double get_scalar(int index);
3427
+ inline MaybeObject* get(int index);
3143
3428
  inline void set(int index, double value);
3144
3429
 
3145
3430
  // This accessor applies the correct conversion from Smi, HeapNumber
@@ -3235,7 +3520,7 @@ class DeoptimizationInputData: public FixedArray {
3235
3520
  // Casting.
3236
3521
  static inline DeoptimizationInputData* cast(Object* obj);
3237
3522
 
3238
- #ifdef OBJECT_PRINT
3523
+ #ifdef ENABLE_DISASSEMBLER
3239
3524
  void DeoptimizationInputDataPrint(FILE* out);
3240
3525
  #endif
3241
3526
 
@@ -3274,7 +3559,7 @@ class DeoptimizationOutputData: public FixedArray {
3274
3559
  // Casting.
3275
3560
  static inline DeoptimizationOutputData* cast(Object* obj);
3276
3561
 
3277
- #ifdef OBJECT_PRINT
3562
+ #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
3278
3563
  void DeoptimizationOutputDataPrint(FILE* out);
3279
3564
  #endif
3280
3565
  };
@@ -3309,13 +3594,14 @@ class Code: public HeapObject {
3309
3594
  UNARY_OP_IC,
3310
3595
  BINARY_OP_IC,
3311
3596
  COMPARE_IC,
3597
+ TO_BOOLEAN_IC,
3312
3598
  // No more than 16 kinds. The value currently encoded in four bits in
3313
3599
  // Flags.
3314
3600
 
3315
3601
  // Pseudo-kinds.
3316
3602
  REGEXP = BUILTIN,
3317
3603
  FIRST_IC_KIND = LOAD_IC,
3318
- LAST_IC_KIND = COMPARE_IC
3604
+ LAST_IC_KIND = TO_BOOLEAN_IC
3319
3605
  };
3320
3606
 
3321
3607
  enum {
@@ -3381,13 +3667,10 @@ class Code: public HeapObject {
3381
3667
  inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; }
3382
3668
  inline bool is_call_stub() { return kind() == CALL_IC; }
3383
3669
  inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; }
3384
- inline bool is_unary_op_stub() {
3385
- return kind() == UNARY_OP_IC;
3386
- }
3387
- inline bool is_binary_op_stub() {
3388
- return kind() == BINARY_OP_IC;
3389
- }
3670
+ inline bool is_unary_op_stub() { return kind() == UNARY_OP_IC; }
3671
+ inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; }
3390
3672
  inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; }
3673
+ inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; }
3391
3674
 
3392
3675
  // [major_key]: For kind STUB or BINARY_OP_IC, the major key.
3393
3676
  inline int major_key();
@@ -3429,27 +3712,24 @@ class Code: public HeapObject {
3429
3712
  inline CheckType check_type();
3430
3713
  inline void set_check_type(CheckType value);
3431
3714
 
3432
- // [external array type]: For kind KEYED_EXTERNAL_ARRAY_LOAD_IC and
3433
- // KEYED_EXTERNAL_ARRAY_STORE_IC, identifies the type of external
3434
- // array that the code stub is specialized for.
3435
- inline ExternalArrayType external_array_type();
3436
- inline void set_external_array_type(ExternalArrayType value);
3437
-
3438
- // [type-recording unary op type]: For all UNARY_OP_IC.
3715
+ // [type-recording unary op type]: For kind UNARY_OP_IC.
3439
3716
  inline byte unary_op_type();
3440
3717
  inline void set_unary_op_type(byte value);
3441
3718
 
3442
- // [type-recording binary op type]: For all TYPE_RECORDING_BINARY_OP_IC.
3719
+ // [type-recording binary op type]: For kind BINARY_OP_IC.
3443
3720
  inline byte binary_op_type();
3444
3721
  inline void set_binary_op_type(byte value);
3445
3722
  inline byte binary_op_result_type();
3446
3723
  inline void set_binary_op_result_type(byte value);
3447
3724
 
3448
- // [compare state]: For kind compare IC stubs, tells what state the
3449
- // stub is in.
3725
+ // [compare state]: For kind COMPARE_IC, tells what state the stub is in.
3450
3726
  inline byte compare_state();
3451
3727
  inline void set_compare_state(byte value);
3452
3728
 
3729
+ // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in.
3730
+ inline byte to_boolean_state();
3731
+ inline void set_to_boolean_state(byte value);
3732
+
3453
3733
  // Get the safepoint entry for the given pc.
3454
3734
  SafepointEntry GetSafepointEntry(Address pc);
3455
3735
 
@@ -3590,11 +3870,11 @@ class Code: public HeapObject {
3590
3870
  static const int kOptimizableOffset = kKindSpecificFlagsOffset;
3591
3871
  static const int kStackSlotsOffset = kKindSpecificFlagsOffset;
3592
3872
  static const int kCheckTypeOffset = kKindSpecificFlagsOffset;
3593
- static const int kExternalArrayTypeOffset = kKindSpecificFlagsOffset;
3594
3873
 
3595
- static const int kCompareStateOffset = kStubMajorKeyOffset + 1;
3596
3874
  static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1;
3597
3875
  static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1;
3876
+ static const int kCompareStateOffset = kStubMajorKeyOffset + 1;
3877
+ static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1;
3598
3878
  static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1;
3599
3879
 
3600
3880
  static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1;
@@ -3741,31 +4021,37 @@ class Map: public HeapObject {
3741
4021
  inline void set_is_extensible(bool value);
3742
4022
  inline bool is_extensible();
3743
4023
 
3744
- // Tells whether the instance has fast elements.
3745
- // Equivalent to instance->GetElementsKind() == FAST_ELEMENTS.
3746
- inline void set_has_fast_elements(bool value) {
3747
- if (value) {
3748
- set_bit_field2(bit_field2() | (1 << kHasFastElements));
3749
- } else {
3750
- set_bit_field2(bit_field2() & ~(1 << kHasFastElements));
3751
- }
4024
+ inline void set_elements_kind(JSObject::ElementsKind elements_kind) {
4025
+ ASSERT(elements_kind < JSObject::kElementsKindCount);
4026
+ ASSERT(JSObject::kElementsKindCount <= (1 << kElementsKindBitCount));
4027
+ set_bit_field2((bit_field2() & ~kElementsKindMask) |
4028
+ (elements_kind << kElementsKindShift));
4029
+ ASSERT(this->elements_kind() == elements_kind);
4030
+ }
4031
+
4032
+ inline JSObject::ElementsKind elements_kind() {
4033
+ return static_cast<JSObject::ElementsKind>(
4034
+ (bit_field2() & kElementsKindMask) >> kElementsKindShift);
3752
4035
  }
3753
4036
 
4037
+ // Tells whether the instance has fast elements.
4038
+ // Equivalent to instance->GetElementsKind() == FAST_ELEMENTS.
3754
4039
  inline bool has_fast_elements() {
3755
- return ((1 << kHasFastElements) & bit_field2()) != 0;
4040
+ return elements_kind() == JSObject::FAST_ELEMENTS;
3756
4041
  }
3757
4042
 
3758
- // Tells whether an instance has pixel array elements.
3759
- inline void set_has_external_array_elements(bool value) {
3760
- if (value) {
3761
- set_bit_field2(bit_field2() | (1 << kHasExternalArrayElements));
3762
- } else {
3763
- set_bit_field2(bit_field2() & ~(1 << kHasExternalArrayElements));
3764
- }
4043
+ inline bool has_fast_double_elements() {
4044
+ return elements_kind() == JSObject::FAST_DOUBLE_ELEMENTS;
3765
4045
  }
3766
4046
 
3767
4047
  inline bool has_external_array_elements() {
3768
- return ((1 << kHasExternalArrayElements) & bit_field2()) != 0;
4048
+ JSObject::ElementsKind kind(elements_kind());
4049
+ return kind >= JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND &&
4050
+ kind <= JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND;
4051
+ }
4052
+
4053
+ inline bool has_dictionary_elements() {
4054
+ return elements_kind() == JSObject::DICTIONARY_ELEMENTS;
3769
4055
  }
3770
4056
 
3771
4057
  // Tells whether the map is attached to SharedFunctionInfo
@@ -3818,6 +4104,26 @@ class Map: public HeapObject {
3818
4104
  DECL_ACCESSORS(prototype_transitions, FixedArray)
3819
4105
  inline FixedArray* unchecked_prototype_transitions();
3820
4106
 
4107
+ static const int kProtoTransitionHeaderSize = 1;
4108
+ static const int kProtoTransitionNumberOfEntriesOffset = 0;
4109
+ static const int kProtoTransitionElementsPerEntry = 2;
4110
+ static const int kProtoTransitionPrototypeOffset = 0;
4111
+ static const int kProtoTransitionMapOffset = 1;
4112
+
4113
+ inline int NumberOfProtoTransitions() {
4114
+ FixedArray* cache = unchecked_prototype_transitions();
4115
+ if (cache->length() == 0) return 0;
4116
+ return
4117
+ Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value();
4118
+ }
4119
+
4120
+ inline void SetNumberOfProtoTransitions(int value) {
4121
+ FixedArray* cache = unchecked_prototype_transitions();
4122
+ ASSERT(cache->length() != 0);
4123
+ cache->set_unchecked(kProtoTransitionNumberOfEntriesOffset,
4124
+ Smi::FromInt(value));
4125
+ }
4126
+
3821
4127
  // Lookup in the map's instance descriptors and fill out the result
3822
4128
  // with the given holder if the name is found. The holder may be
3823
4129
  // NULL when this function is used from the compiler.
@@ -3834,18 +4140,23 @@ class Map: public HeapObject {
3834
4140
  // instance descriptors.
3835
4141
  MUST_USE_RESULT MaybeObject* CopyDropTransitions();
3836
4142
 
3837
- // Returns this map if it has the fast elements bit set, otherwise
4143
+ // Returns this map if it already has elements that are fast, otherwise
3838
4144
  // returns a copy of the map, with all transitions dropped from the
3839
- // descriptors and the fast elements bit set.
4145
+ // descriptors and the ElementsKind set to FAST_ELEMENTS.
3840
4146
  MUST_USE_RESULT inline MaybeObject* GetFastElementsMap();
3841
4147
 
3842
- // Returns this map if it has the fast elements bit cleared,
3843
- // otherwise returns a copy of the map, with all transitions dropped
3844
- // from the descriptors and the fast elements bit cleared.
4148
+ // Returns this map if it already has fast elements that are doubles,
4149
+ // otherwise returns a copy of the map, with all transitions dropped from the
4150
+ // descriptors and the ElementsKind set to FAST_DOUBLE_ELEMENTS.
4151
+ MUST_USE_RESULT inline MaybeObject* GetFastDoubleElementsMap();
4152
+
4153
+ // Returns this map if already has dictionary elements, otherwise returns a
4154
+ // copy of the map, with all transitions dropped from the descriptors and the
4155
+ // ElementsKind set to DICTIONARY_ELEMENTS.
3845
4156
  MUST_USE_RESULT inline MaybeObject* GetSlowElementsMap();
3846
4157
 
3847
4158
  // Returns a new map with all transitions dropped from the descriptors and the
3848
- // external array elements bit set.
4159
+ // ElementsKind set to one of the value corresponding to array_type.
3849
4160
  MUST_USE_RESULT MaybeObject* GetExternalArrayElementsMap(
3850
4161
  ExternalArrayType array_type,
3851
4162
  bool safe_to_add_transition);
@@ -3894,6 +4205,21 @@ class Map: public HeapObject {
3894
4205
  // following back pointers.
3895
4206
  void ClearNonLiveTransitions(Heap* heap, Object* real_prototype);
3896
4207
 
4208
+ // Computes a hash value for this map, to be used in HashTables and such.
4209
+ int Hash();
4210
+
4211
+ // Compares this map to another to see if they describe equivalent objects.
4212
+ // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if
4213
+ // it had exactly zero inobject properties.
4214
+ // The "shared" flags of both this map and |other| are ignored.
4215
+ bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode);
4216
+
4217
+ // Returns true if this map and |other| describe equivalent objects.
4218
+ // The "shared" flags of both this map and |other| are ignored.
4219
+ bool EquivalentTo(Map* other) {
4220
+ return EquivalentToForNormalization(other, KEEP_INOBJECT_PROPERTIES);
4221
+ }
4222
+
3897
4223
  // Dispatched behavior.
3898
4224
  #ifdef OBJECT_PRINT
3899
4225
  inline void MapPrint() {
@@ -3986,13 +4312,21 @@ class Map: public HeapObject {
3986
4312
  // Bit positions for bit field 2
3987
4313
  static const int kIsExtensible = 0;
3988
4314
  static const int kFunctionWithPrototype = 1;
3989
- static const int kHasFastElements = 2;
3990
- static const int kStringWrapperSafeForDefaultValueOf = 3;
3991
- static const int kAttachedToSharedFunctionInfo = 4;
3992
- static const int kHasExternalArrayElements = 5;
4315
+ static const int kStringWrapperSafeForDefaultValueOf = 2;
4316
+ static const int kAttachedToSharedFunctionInfo = 3;
4317
+ // No bits can be used after kElementsKindFirstBit, they are all reserved for
4318
+ // storing ElementKind. for anything other than storing the ElementKind.
4319
+ static const int kElementsKindShift = 4;
4320
+ static const int kElementsKindBitCount = 4;
4321
+
4322
+ // Derived values from bit field 2
4323
+ static const int kElementsKindMask = (-1 << kElementsKindShift) &
4324
+ ((1 << (kElementsKindShift + kElementsKindBitCount)) - 1);
4325
+ static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>(
4326
+ (JSObject::FAST_ELEMENTS + 1) << Map::kElementsKindShift) - 1;
3993
4327
 
3994
4328
  // Bit positions for bit field 3
3995
- static const int kIsShared = 1;
4329
+ static const int kIsShared = 0;
3996
4330
 
3997
4331
  // Layout of the default cache. It holds alternating name and code objects.
3998
4332
  static const int kCodeCacheEntrySize = 2;
@@ -4128,6 +4462,7 @@ class Script: public Struct {
4128
4462
  #define FUNCTIONS_WITH_ID_LIST(V) \
4129
4463
  V(Array.prototype, push, ArrayPush) \
4130
4464
  V(Array.prototype, pop, ArrayPop) \
4465
+ V(Function.prototype, apply, FunctionApply) \
4131
4466
  V(String.prototype, charCodeAt, StringCharCodeAt) \
4132
4467
  V(String.prototype, charAt, StringCharAt) \
4133
4468
  V(String, fromCharCode, StringFromCharCode) \
@@ -4287,9 +4622,7 @@ class SharedFunctionInfo: public HeapObject {
4287
4622
  // False if there are definitely no live objects created from this function.
4288
4623
  // True if live objects _may_ exist (existence not guaranteed).
4289
4624
  // May go back from true to false after GC.
4290
- inline bool live_objects_may_exist();
4291
-
4292
- inline void set_live_objects_may_exist(bool value);
4625
+ DECL_BOOLEAN_ACCESSORS(live_objects_may_exist)
4293
4626
 
4294
4627
  // [instance class name]: class name for instances.
4295
4628
  DECL_ACCESSORS(instance_class_name, Object)
@@ -4348,12 +4681,10 @@ class SharedFunctionInfo: public HeapObject {
4348
4681
  inline void set_end_position(int end_position);
4349
4682
 
4350
4683
  // Is this function a function expression in the source code.
4351
- inline bool is_expression();
4352
- inline void set_is_expression(bool value);
4684
+ DECL_BOOLEAN_ACCESSORS(is_expression)
4353
4685
 
4354
4686
  // Is this function a top-level function (scripts, evals).
4355
- inline bool is_toplevel();
4356
- inline void set_is_toplevel(bool value);
4687
+ DECL_BOOLEAN_ACCESSORS(is_toplevel)
4357
4688
 
4358
4689
  // Bit field containing various information collected by the compiler to
4359
4690
  // drive optimization.
@@ -4380,8 +4711,7 @@ class SharedFunctionInfo: public HeapObject {
4380
4711
  // Indicates if this function can be lazy compiled.
4381
4712
  // This is used to determine if we can safely flush code from a function
4382
4713
  // when doing GC if we expect that the function will no longer be used.
4383
- inline bool allows_lazy_compilation();
4384
- inline void set_allows_lazy_compilation(bool flag);
4714
+ DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation)
4385
4715
 
4386
4716
  // Indicates how many full GCs this function has survived with assigned
4387
4717
  // code object. Used to determine when it is relatively safe to flush
@@ -4395,19 +4725,36 @@ class SharedFunctionInfo: public HeapObject {
4395
4725
  // shared function info. If a function is repeatedly optimized or if
4396
4726
  // we cannot optimize the function we disable optimization to avoid
4397
4727
  // spending time attempting to optimize it again.
4398
- inline bool optimization_disabled();
4399
- inline void set_optimization_disabled(bool value);
4728
+ DECL_BOOLEAN_ACCESSORS(optimization_disabled)
4400
4729
 
4401
4730
  // Indicates whether the function is a strict mode function.
4402
- inline bool strict_mode();
4403
- inline void set_strict_mode(bool value);
4731
+ DECL_BOOLEAN_ACCESSORS(strict_mode)
4732
+
4733
+ // False if the function definitely does not allocate an arguments object.
4734
+ DECL_BOOLEAN_ACCESSORS(uses_arguments)
4735
+
4736
+ // True if the function has any duplicated parameter names.
4737
+ DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters)
4404
4738
 
4405
- // Indicates whether the function is a native ES5 function.
4739
+ // Indicates whether the function is a native function.
4406
4740
  // These needs special threatment in .call and .apply since
4407
4741
  // null passed as the receiver should not be translated to the
4408
4742
  // global object.
4409
- inline bool es5_native();
4410
- inline void set_es5_native(bool value);
4743
+ DECL_BOOLEAN_ACCESSORS(native)
4744
+
4745
+ // Indicates that the function was created by the Function function.
4746
+ // Though it's anonymous, toString should treat it as if it had the name
4747
+ // "anonymous". We don't set the name itself so that the system does not
4748
+ // see a binding for it.
4749
+ DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous)
4750
+
4751
+ // Indicates whether the function is a bound function created using
4752
+ // the bind function.
4753
+ DECL_BOOLEAN_ACCESSORS(bound)
4754
+
4755
+ // Indicates that the function is anonymous (the name field can be set
4756
+ // through the API, which does not change this flag).
4757
+ DECL_BOOLEAN_ACCESSORS(is_anonymous)
4411
4758
 
4412
4759
  // Indicates whether or not the code in the shared function support
4413
4760
  // deoptimization.
@@ -4587,14 +4934,24 @@ class SharedFunctionInfo: public HeapObject {
4587
4934
  static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1);
4588
4935
 
4589
4936
  // Bit positions in compiler_hints.
4590
- static const int kHasOnlySimpleThisPropertyAssignments = 0;
4591
- static const int kAllowLazyCompilation = 1;
4592
- static const int kLiveObjectsMayExist = 2;
4593
- static const int kCodeAgeShift = 3;
4594
- static const int kCodeAgeMask = 0x7;
4595
- static const int kOptimizationDisabled = 6;
4596
- static const int kStrictModeFunction = 7;
4597
- static const int kES5Native = 8;
4937
+ static const int kCodeAgeSize = 3;
4938
+ static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1;
4939
+
4940
+ enum CompilerHints {
4941
+ kHasOnlySimpleThisPropertyAssignments,
4942
+ kAllowLazyCompilation,
4943
+ kLiveObjectsMayExist,
4944
+ kCodeAgeShift,
4945
+ kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
4946
+ kStrictModeFunction,
4947
+ kUsesArguments,
4948
+ kHasDuplicateParameters,
4949
+ kNative,
4950
+ kBoundFunction,
4951
+ kIsAnonymous,
4952
+ kNameShouldPrintAsAnonymous,
4953
+ kCompilerHintsCount // Pseudo entry
4954
+ };
4598
4955
 
4599
4956
  private:
4600
4957
  #if V8_HOST_ARCH_32_BIT
@@ -4607,28 +4964,31 @@ class SharedFunctionInfo: public HeapObject {
4607
4964
  static const int kCompilerHintsSize = kIntSize;
4608
4965
  #endif
4609
4966
 
4967
+ STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <=
4968
+ SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte);
4969
+
4610
4970
  public:
4611
4971
  // Constants for optimizing codegen for strict mode function and
4612
- // es5 native tests.
4972
+ // native tests.
4613
4973
  // Allows to use byte-widgh instructions.
4614
4974
  static const int kStrictModeBitWithinByte =
4615
4975
  (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte;
4616
4976
 
4617
- static const int kES5NativeBitWithinByte =
4618
- (kES5Native + kCompilerHintsSmiTagSize) % kBitsPerByte;
4977
+ static const int kNativeBitWithinByte =
4978
+ (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte;
4619
4979
 
4620
4980
  #if __BYTE_ORDER == __LITTLE_ENDIAN
4621
4981
  static const int kStrictModeByteOffset = kCompilerHintsOffset +
4622
4982
  (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte;
4623
- static const int kES5NativeByteOffset = kCompilerHintsOffset +
4624
- (kES5Native + kCompilerHintsSmiTagSize) / kBitsPerByte;
4983
+ static const int kNativeByteOffset = kCompilerHintsOffset +
4984
+ (kNative + kCompilerHintsSmiTagSize) / kBitsPerByte;
4625
4985
  #elif __BYTE_ORDER == __BIG_ENDIAN
4626
4986
  static const int kStrictModeByteOffset = kCompilerHintsOffset +
4627
4987
  (kCompilerHintsSize - 1) -
4628
4988
  ((kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte);
4629
- static const int kES5NativeByteOffset = kCompilerHintsOffset +
4989
+ static const int kNativeByteOffset = kCompilerHintsOffset +
4630
4990
  (kCompilerHintsSize - 1) -
4631
- ((kES5Native + kCompilerHintsSmiTagSize) / kBitsPerByte);
4991
+ ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte);
4632
4992
  #else
4633
4993
  #error Unknown byte ordering
4634
4994
  #endif
@@ -4685,9 +5045,6 @@ class JSFunction: public JSObject {
4685
5045
  // recompilation.
4686
5046
  inline bool IsMarkedForLazyRecompilation();
4687
5047
 
4688
- // Compute a hash code for the source code of this function.
4689
- uint32_t SourceHash();
4690
-
4691
5048
  // Check whether or not this function is inlineable.
4692
5049
  bool IsInlineable();
4693
5050
 
@@ -4787,6 +5144,7 @@ class JSFunction: public JSObject {
4787
5144
  // Layout of the literals array.
4788
5145
  static const int kLiteralsPrefixSize = 1;
4789
5146
  static const int kLiteralGlobalContextIndex = 0;
5147
+
4790
5148
  private:
4791
5149
  DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction);
4792
5150
  };
@@ -4825,7 +5183,6 @@ class JSGlobalProxy : public JSObject {
4825
5183
  static const int kSize = kContextOffset + kPointerSize;
4826
5184
 
4827
5185
  private:
4828
-
4829
5186
  DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy);
4830
5187
  };
4831
5188
 
@@ -4881,7 +5238,6 @@ class GlobalObject: public JSObject {
4881
5238
  // JavaScript global object.
4882
5239
  class JSGlobalObject: public GlobalObject {
4883
5240
  public:
4884
-
4885
5241
  // Casting.
4886
5242
  static inline JSGlobalObject* cast(Object* obj);
4887
5243
 
@@ -5053,8 +5409,10 @@ class JSMessageObject: public JSObject {
5053
5409
  // If it is an atom regexp
5054
5410
  // - a reference to a literal string to search for
5055
5411
  // If it is an irregexp regexp:
5056
- // - a reference to code for ASCII inputs (bytecode or compiled).
5057
- // - a reference to code for UC16 inputs (bytecode or compiled).
5412
+ // - a reference to code for ASCII inputs (bytecode or compiled), or a smi
5413
+ // used for tracking the last usage (used for code flushing).
5414
+ // - a reference to code for UC16 inputs (bytecode or compiled), or a smi
5415
+ // used for tracking the last usage (used for code flushing)..
5058
5416
  // - max number of registers used by irregexp implementations.
5059
5417
  // - number of capture registers (output values) of the regexp.
5060
5418
  class JSRegExp: public JSObject {
@@ -5087,6 +5445,12 @@ class JSRegExp: public JSObject {
5087
5445
  inline Object* DataAt(int index);
5088
5446
  // Set implementation data after the object has been prepared.
5089
5447
  inline void SetDataAt(int index, Object* value);
5448
+
5449
+ // Used during GC when flushing code or setting age.
5450
+ inline Object* DataAtUnchecked(int index);
5451
+ inline void SetDataAtUnchecked(int index, Object* value, Heap* heap);
5452
+ inline Type TypeTagUnchecked();
5453
+
5090
5454
  static int code_index(bool is_ascii) {
5091
5455
  if (is_ascii) {
5092
5456
  return kIrregexpASCIICodeIndex;
@@ -5095,6 +5459,14 @@ class JSRegExp: public JSObject {
5095
5459
  }
5096
5460
  }
5097
5461
 
5462
+ static int saved_code_index(bool is_ascii) {
5463
+ if (is_ascii) {
5464
+ return kIrregexpASCIICodeSavedIndex;
5465
+ } else {
5466
+ return kIrregexpUC16CodeSavedIndex;
5467
+ }
5468
+ }
5469
+
5098
5470
  static inline JSRegExp* cast(Object* obj);
5099
5471
 
5100
5472
  // Dispatched behavior.
@@ -5125,11 +5497,19 @@ class JSRegExp: public JSObject {
5125
5497
  // fails, this fields hold an exception object that should be
5126
5498
  // thrown if the regexp is used again.
5127
5499
  static const int kIrregexpUC16CodeIndex = kDataIndex + 1;
5500
+
5501
+ // Saved instance of Irregexp compiled code or bytecode for ASCII that
5502
+ // is a potential candidate for flushing.
5503
+ static const int kIrregexpASCIICodeSavedIndex = kDataIndex + 2;
5504
+ // Saved instance of Irregexp compiled code or bytecode for UC16 that is
5505
+ // a potential candidate for flushing.
5506
+ static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3;
5507
+
5128
5508
  // Maximal number of registers used by either ASCII or UC16.
5129
5509
  // Only used to check that there is enough stack space
5130
- static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 2;
5510
+ static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4;
5131
5511
  // Number of captures in the compiled regexp.
5132
- static const int kIrregexpCaptureCountIndex = kDataIndex + 3;
5512
+ static const int kIrregexpCaptureCountIndex = kDataIndex + 5;
5133
5513
 
5134
5514
  static const int kIrregexpDataSize = kIrregexpCaptureCountIndex + 1;
5135
5515
 
@@ -5150,6 +5530,18 @@ class JSRegExp: public JSObject {
5150
5530
  static const int kMultilineFieldIndex = 3;
5151
5531
  static const int kLastIndexFieldIndex = 4;
5152
5532
  static const int kInObjectFieldCount = 5;
5533
+
5534
+ // The uninitialized value for a regexp code object.
5535
+ static const int kUninitializedValue = -1;
5536
+
5537
+ // The compilation error value for the regexp code object. The real error
5538
+ // object is in the saved code field.
5539
+ static const int kCompilationErrorValue = -2;
5540
+
5541
+ // When we store the sweep generation at which we moved the code from the
5542
+ // code index to the saved code index we mask it of to be in the [0:255]
5543
+ // range.
5544
+ static const int kCodeAgeMask = 0xff;
5153
5545
  };
5154
5546
 
5155
5547
 
@@ -5295,6 +5687,49 @@ class CodeCacheHashTable: public HashTable<CodeCacheHashTableShape,
5295
5687
  };
5296
5688
 
5297
5689
 
5690
+ class PolymorphicCodeCache: public Struct {
5691
+ public:
5692
+ DECL_ACCESSORS(cache, Object)
5693
+
5694
+ MUST_USE_RESULT MaybeObject* Update(MapList* maps,
5695
+ Code::Flags flags,
5696
+ Code* code);
5697
+ Object* Lookup(MapList* maps, Code::Flags flags);
5698
+
5699
+ static inline PolymorphicCodeCache* cast(Object* obj);
5700
+
5701
+ #ifdef OBJECT_PRINT
5702
+ inline void PolymorphicCodeCachePrint() {
5703
+ PolymorphicCodeCachePrint(stdout);
5704
+ }
5705
+ void PolymorphicCodeCachePrint(FILE* out);
5706
+ #endif
5707
+ #ifdef DEBUG
5708
+ void PolymorphicCodeCacheVerify();
5709
+ #endif
5710
+
5711
+ static const int kCacheOffset = HeapObject::kHeaderSize;
5712
+ static const int kSize = kCacheOffset + kPointerSize;
5713
+
5714
+ private:
5715
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache);
5716
+ };
5717
+
5718
+
5719
+ class PolymorphicCodeCacheHashTable
5720
+ : public HashTable<CodeCacheHashTableShape, HashTableKey*> {
5721
+ public:
5722
+ Object* Lookup(MapList* maps, int code_kind);
5723
+ MUST_USE_RESULT MaybeObject* Put(MapList* maps, int code_kind, Code* code);
5724
+
5725
+ static inline PolymorphicCodeCacheHashTable* cast(Object* obj);
5726
+
5727
+ static const int kInitialSize = 64;
5728
+ private:
5729
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable);
5730
+ };
5731
+
5732
+
5298
5733
  enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS};
5299
5734
  enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL};
5300
5735
 
@@ -5333,7 +5768,6 @@ class StringHasher {
5333
5768
  static uint32_t MakeArrayIndexHash(uint32_t value, int length);
5334
5769
 
5335
5770
  private:
5336
-
5337
5771
  uint32_t array_index() {
5338
5772
  ASSERT(is_array_index());
5339
5773
  return array_index_;
@@ -5375,12 +5809,15 @@ class StringShape BASE_EMBEDDED {
5375
5809
  inline bool IsSequential();
5376
5810
  inline bool IsExternal();
5377
5811
  inline bool IsCons();
5812
+ inline bool IsSliced();
5813
+ inline bool IsIndirect();
5378
5814
  inline bool IsExternalAscii();
5379
5815
  inline bool IsExternalTwoByte();
5380
5816
  inline bool IsSequentialAscii();
5381
5817
  inline bool IsSequentialTwoByte();
5382
5818
  inline bool IsSymbol();
5383
5819
  inline StringRepresentationTag representation_tag();
5820
+ inline uint32_t encoding_tag();
5384
5821
  inline uint32_t full_representation_tag();
5385
5822
  inline uint32_t size_tag();
5386
5823
  #ifdef DEBUG
@@ -5390,6 +5827,7 @@ class StringShape BASE_EMBEDDED {
5390
5827
  #else
5391
5828
  inline void invalidate() { }
5392
5829
  #endif
5830
+
5393
5831
  private:
5394
5832
  uint32_t type_;
5395
5833
  #ifdef DEBUG
@@ -5411,6 +5849,51 @@ class StringShape BASE_EMBEDDED {
5411
5849
  // All string values have a length field.
5412
5850
  class String: public HeapObject {
5413
5851
  public:
5852
+ // Representation of the flat content of a String.
5853
+ // A non-flat string doesn't have flat content.
5854
+ // A flat string has content that's encoded as a sequence of either
5855
+ // ASCII chars or two-byte UC16.
5856
+ // Returned by String::GetFlatContent().
5857
+ class FlatContent {
5858
+ public:
5859
+ // Returns true if the string is flat and this structure contains content.
5860
+ bool IsFlat() { return state_ != NON_FLAT; }
5861
+ // Returns true if the structure contains ASCII content.
5862
+ bool IsAscii() { return state_ == ASCII; }
5863
+ // Returns true if the structure contains two-byte content.
5864
+ bool IsTwoByte() { return state_ == TWO_BYTE; }
5865
+
5866
+ // Return the ASCII content of the string. Only use if IsAscii() returns
5867
+ // true.
5868
+ Vector<const char> ToAsciiVector() {
5869
+ ASSERT_EQ(ASCII, state_);
5870
+ return Vector<const char>::cast(buffer_);
5871
+ }
5872
+ // Return the two-byte content of the string. Only use if IsTwoByte()
5873
+ // returns true.
5874
+ Vector<const uc16> ToUC16Vector() {
5875
+ ASSERT_EQ(TWO_BYTE, state_);
5876
+ return Vector<const uc16>::cast(buffer_);
5877
+ }
5878
+
5879
+ private:
5880
+ enum State { NON_FLAT, ASCII, TWO_BYTE };
5881
+
5882
+ // Constructors only used by String::GetFlatContent().
5883
+ explicit FlatContent(Vector<const char> chars)
5884
+ : buffer_(Vector<const byte>::cast(chars)),
5885
+ state_(ASCII) { }
5886
+ explicit FlatContent(Vector<const uc16> chars)
5887
+ : buffer_(Vector<const byte>::cast(chars)),
5888
+ state_(TWO_BYTE) { }
5889
+ FlatContent() : buffer_(), state_(NON_FLAT) { }
5890
+
5891
+ Vector<const byte> buffer_;
5892
+ State state_;
5893
+
5894
+ friend class String;
5895
+ };
5896
+
5414
5897
  // Get and set the length of the string.
5415
5898
  inline int length();
5416
5899
  inline void set_length(int value);
@@ -5419,14 +5902,19 @@ class String: public HeapObject {
5419
5902
  inline uint32_t hash_field();
5420
5903
  inline void set_hash_field(uint32_t value);
5421
5904
 
5905
+ // Returns whether this string has only ASCII chars, i.e. all of them can
5906
+ // be ASCII encoded. This might be the case even if the string is
5907
+ // two-byte. Such strings may appear when the embedder prefers
5908
+ // two-byte external representations even for ASCII data.
5422
5909
  inline bool IsAsciiRepresentation();
5423
5910
  inline bool IsTwoByteRepresentation();
5424
5911
 
5425
- // Returns whether this string has ascii chars, i.e. all of them can
5426
- // be ascii encoded. This might be the case even if the string is
5427
- // two-byte. Such strings may appear when the embedder prefers
5428
- // two-byte external representations even for ascii data.
5429
- //
5912
+ // Cons and slices have an encoding flag that may not represent the actual
5913
+ // encoding of the underlying string. This is taken into account here.
5914
+ // Requires: this->IsFlat()
5915
+ inline bool IsAsciiRepresentationUnderneath();
5916
+ inline bool IsTwoByteRepresentationUnderneath();
5917
+
5430
5918
  // NOTE: this should be considered only a hint. False negatives are
5431
5919
  // possible.
5432
5920
  inline bool HasOnlyAsciiChars();
@@ -5459,8 +5947,16 @@ class String: public HeapObject {
5459
5947
  // string.
5460
5948
  inline String* TryFlattenGetString(PretenureFlag pretenure = NOT_TENURED);
5461
5949
 
5462
- Vector<const char> ToAsciiVector();
5463
- Vector<const uc16> ToUC16Vector();
5950
+ // Tries to return the content of a flat string as a structure holding either
5951
+ // a flat vector of char or of uc16.
5952
+ // If the string isn't flat, and therefore doesn't have flat content, the
5953
+ // returned structure will report so, and can't provide a vector of either
5954
+ // kind.
5955
+ FlatContent GetFlatContent();
5956
+
5957
+ // Returns the parent of a sliced string or first part of a flat cons string.
5958
+ // Requires: StringShape(this).IsIndirect() && this->IsFlat()
5959
+ inline String* GetUnderlying();
5464
5960
 
5465
5961
  // Mark the string as an undetectable object. It only applies to
5466
5962
  // ascii and two byte string types.
@@ -5541,6 +6037,8 @@ class String: public HeapObject {
5541
6037
  StringPrint(stdout);
5542
6038
  }
5543
6039
  void StringPrint(FILE* out);
6040
+
6041
+ char* ToAsciiArray();
5544
6042
  #endif
5545
6043
  #ifdef DEBUG
5546
6044
  void StringVerify();
@@ -5727,7 +6225,6 @@ class String: public HeapObject {
5727
6225
  // The SeqString abstract class captures sequential string values.
5728
6226
  class SeqString: public String {
5729
6227
  public:
5730
-
5731
6228
  // Casting.
5732
6229
  static inline SeqString* cast(Object* obj);
5733
6230
 
@@ -5889,11 +6386,69 @@ class ConsString: public String {
5889
6386
  typedef FixedBodyDescriptor<kFirstOffset, kSecondOffset + kPointerSize, kSize>
5890
6387
  BodyDescriptor;
5891
6388
 
6389
+ #ifdef DEBUG
6390
+ void ConsStringVerify();
6391
+ #endif
6392
+
5892
6393
  private:
5893
6394
  DISALLOW_IMPLICIT_CONSTRUCTORS(ConsString);
5894
6395
  };
5895
6396
 
5896
6397
 
6398
+ // The Sliced String class describes strings that are substrings of another
6399
+ // sequential string. The motivation is to save time and memory when creating
6400
+ // a substring. A Sliced String is described as a pointer to the parent,
6401
+ // the offset from the start of the parent string and the length. Using
6402
+ // a Sliced String therefore requires unpacking of the parent string and
6403
+ // adding the offset to the start address. A substring of a Sliced String
6404
+ // are not nested since the double indirection is simplified when creating
6405
+ // such a substring.
6406
+ // Currently missing features are:
6407
+ // - handling externalized parent strings
6408
+ // - external strings as parent
6409
+ // - truncating sliced string to enable otherwise unneeded parent to be GC'ed.
6410
+ class SlicedString: public String {
6411
+ public:
6412
+
6413
+ inline String* parent();
6414
+ inline void set_parent(String* parent);
6415
+ inline int offset();
6416
+ inline void set_offset(int offset);
6417
+
6418
+ // Dispatched behavior.
6419
+ uint16_t SlicedStringGet(int index);
6420
+
6421
+ // Casting.
6422
+ static inline SlicedString* cast(Object* obj);
6423
+
6424
+ // Layout description.
6425
+ static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize);
6426
+ static const int kOffsetOffset = kParentOffset + kPointerSize;
6427
+ static const int kSize = kOffsetOffset + kPointerSize;
6428
+
6429
+ // Support for StringInputBuffer
6430
+ inline const unibrow::byte* SlicedStringReadBlock(ReadBlockBuffer* buffer,
6431
+ unsigned* offset_ptr,
6432
+ unsigned chars);
6433
+ inline void SlicedStringReadBlockIntoBuffer(ReadBlockBuffer* buffer,
6434
+ unsigned* offset_ptr,
6435
+ unsigned chars);
6436
+ // Minimum length for a sliced string.
6437
+ static const int kMinLength = 13;
6438
+
6439
+ typedef FixedBodyDescriptor<kParentOffset,
6440
+ kOffsetOffset + kPointerSize, kSize>
6441
+ BodyDescriptor;
6442
+
6443
+ #ifdef DEBUG
6444
+ void SlicedStringVerify();
6445
+ #endif
6446
+
6447
+ private:
6448
+ DISALLOW_IMPLICIT_CONSTRUCTORS(SlicedString);
6449
+ };
6450
+
6451
+
5897
6452
  // The ExternalString class describes string values that are backed by
5898
6453
  // a string resource that lies outside the V8 heap. ExternalStrings
5899
6454
  // consist of the length field common to all strings, a pointer to the
@@ -6162,14 +6717,37 @@ class JSGlobalPropertyCell: public HeapObject {
6162
6717
 
6163
6718
 
6164
6719
  // The JSProxy describes EcmaScript Harmony proxies
6165
- class JSProxy: public HeapObject {
6720
+ class JSProxy: public JSReceiver {
6166
6721
  public:
6167
6722
  // [handler]: The handler property.
6168
6723
  DECL_ACCESSORS(handler, Object)
6169
6724
 
6725
+ // [padding]: The padding slot (unused, see below).
6726
+ DECL_ACCESSORS(padding, Object)
6727
+
6170
6728
  // Casting.
6171
6729
  static inline JSProxy* cast(Object* obj);
6172
6730
 
6731
+ bool HasPropertyWithHandler(String* name);
6732
+
6733
+ MUST_USE_RESULT MaybeObject* SetPropertyWithHandler(
6734
+ String* name,
6735
+ Object* value,
6736
+ PropertyAttributes attributes,
6737
+ StrictModeFlag strict_mode);
6738
+
6739
+ MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler(
6740
+ String* name,
6741
+ DeleteMode mode);
6742
+
6743
+ MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler(
6744
+ JSReceiver* receiver,
6745
+ String* name,
6746
+ bool* has_exception);
6747
+
6748
+ // Turn this into an (empty) JSObject.
6749
+ void Fix();
6750
+
6173
6751
  // Dispatched behavior.
6174
6752
  #ifdef OBJECT_PRINT
6175
6753
  inline void JSProxyPrint() {
@@ -6181,9 +6759,14 @@ class JSProxy: public HeapObject {
6181
6759
  void JSProxyVerify();
6182
6760
  #endif
6183
6761
 
6184
- // Layout description.
6762
+ // Layout description. We add padding so that a proxy has the same
6763
+ // size as a virgin JSObject. This is essential for becoming a JSObject
6764
+ // upon freeze.
6185
6765
  static const int kHandlerOffset = HeapObject::kHeaderSize;
6186
- static const int kSize = kHandlerOffset + kPointerSize;
6766
+ static const int kPaddingOffset = kHandlerOffset + kPointerSize;
6767
+ static const int kSize = kPaddingOffset + kPointerSize;
6768
+
6769
+ STATIC_CHECK(kSize == JSObject::kHeaderSize);
6187
6770
 
6188
6771
  typedef FixedBodyDescriptor<kHandlerOffset,
6189
6772
  kHandlerOffset + kPointerSize,
@@ -6194,6 +6777,50 @@ class JSProxy: public HeapObject {
6194
6777
  };
6195
6778
 
6196
6779
 
6780
+ // TODO(rossberg): Only a stub for now.
6781
+ class JSFunctionProxy: public JSProxy {
6782
+ public:
6783
+ // Casting.
6784
+ static inline JSFunctionProxy* cast(Object* obj);
6785
+
6786
+ private:
6787
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy);
6788
+ };
6789
+
6790
+
6791
+ // The JSWeakMap describes EcmaScript Harmony weak maps
6792
+ class JSWeakMap: public JSObject {
6793
+ public:
6794
+ // [table]: the backing hash table mapping keys to values.
6795
+ DECL_ACCESSORS(table, ObjectHashTable)
6796
+
6797
+ // [next]: linked list of encountered weak maps during GC.
6798
+ DECL_ACCESSORS(next, Object)
6799
+
6800
+ // Unchecked accessors to be used during GC.
6801
+ inline ObjectHashTable* unchecked_table();
6802
+
6803
+ // Casting.
6804
+ static inline JSWeakMap* cast(Object* obj);
6805
+
6806
+ #ifdef OBJECT_PRINT
6807
+ inline void JSWeakMapPrint() {
6808
+ JSWeakMapPrint(stdout);
6809
+ }
6810
+ void JSWeakMapPrint(FILE* out);
6811
+ #endif
6812
+ #ifdef DEBUG
6813
+ void JSWeakMapVerify();
6814
+ #endif
6815
+
6816
+ static const int kTableOffset = JSObject::kHeaderSize;
6817
+ static const int kNextOffset = kTableOffset + kPointerSize;
6818
+ static const int kSize = kNextOffset + kPointerSize;
6819
+
6820
+ private:
6821
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap);
6822
+ };
6823
+
6197
6824
 
6198
6825
  // Foreign describes objects pointing from JavaScript to C structures.
6199
6826
  // Since they cannot contain references to JS HeapObjects they can be
@@ -6501,6 +7128,7 @@ class FunctionTemplateInfo: public TemplateInfo {
6501
7128
  // If the bit is set, object instances created by this function
6502
7129
  // requires access check.
6503
7130
  DECL_BOOLEAN_ACCESSORS(needs_access_check)
7131
+ DECL_BOOLEAN_ACCESSORS(read_only_prototype)
6504
7132
 
6505
7133
  static inline FunctionTemplateInfo* cast(Object* obj);
6506
7134
 
@@ -6540,6 +7168,7 @@ class FunctionTemplateInfo: public TemplateInfo {
6540
7168
  static const int kHiddenPrototypeBit = 0;
6541
7169
  static const int kUndetectableBit = 1;
6542
7170
  static const int kNeedsAccessCheckBit = 2;
7171
+ static const int kReadOnlyPrototypeBit = 3;
6543
7172
 
6544
7173
  DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
6545
7174
  };