therubyracer 0.9.0beta4 → 0.9.0beta5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of therubyracer might be problematic. Click here for more details.

Files changed (771) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +0 -11
  3. data/ext/v8/extconf.rb +9 -9
  4. data/ext/v8/v8_external.cpp +40 -10
  5. data/lib/v8/cli.rb +2 -1
  6. data/lib/v8/version.rb +1 -1
  7. data/spec/redjs/.gitignore +1 -0
  8. data/therubyracer.gemspec +2 -3
  9. metadata +33 -779
  10. data/ext/v8/upstream/Makefile +0 -38
  11. data/ext/v8/upstream/detect_cpu.rb +0 -27
  12. data/ext/v8/upstream/fpic-on-linux-amd64.patch +0 -13
  13. data/ext/v8/upstream/scons/CHANGES.txt +0 -5183
  14. data/ext/v8/upstream/scons/LICENSE.txt +0 -20
  15. data/ext/v8/upstream/scons/MANIFEST +0 -202
  16. data/ext/v8/upstream/scons/PKG-INFO +0 -13
  17. data/ext/v8/upstream/scons/README.txt +0 -273
  18. data/ext/v8/upstream/scons/RELEASE.txt +0 -1040
  19. data/ext/v8/upstream/scons/engine/SCons/Action.py +0 -1256
  20. data/ext/v8/upstream/scons/engine/SCons/Builder.py +0 -868
  21. data/ext/v8/upstream/scons/engine/SCons/CacheDir.py +0 -217
  22. data/ext/v8/upstream/scons/engine/SCons/Conftest.py +0 -794
  23. data/ext/v8/upstream/scons/engine/SCons/Debug.py +0 -237
  24. data/ext/v8/upstream/scons/engine/SCons/Defaults.py +0 -485
  25. data/ext/v8/upstream/scons/engine/SCons/Environment.py +0 -2327
  26. data/ext/v8/upstream/scons/engine/SCons/Errors.py +0 -207
  27. data/ext/v8/upstream/scons/engine/SCons/Executor.py +0 -636
  28. data/ext/v8/upstream/scons/engine/SCons/Job.py +0 -435
  29. data/ext/v8/upstream/scons/engine/SCons/Memoize.py +0 -292
  30. data/ext/v8/upstream/scons/engine/SCons/Node/Alias.py +0 -153
  31. data/ext/v8/upstream/scons/engine/SCons/Node/FS.py +0 -3220
  32. data/ext/v8/upstream/scons/engine/SCons/Node/Python.py +0 -128
  33. data/ext/v8/upstream/scons/engine/SCons/Node/__init__.py +0 -1341
  34. data/ext/v8/upstream/scons/engine/SCons/Options/BoolOption.py +0 -50
  35. data/ext/v8/upstream/scons/engine/SCons/Options/EnumOption.py +0 -50
  36. data/ext/v8/upstream/scons/engine/SCons/Options/ListOption.py +0 -50
  37. data/ext/v8/upstream/scons/engine/SCons/Options/PackageOption.py +0 -50
  38. data/ext/v8/upstream/scons/engine/SCons/Options/PathOption.py +0 -76
  39. data/ext/v8/upstream/scons/engine/SCons/Options/__init__.py +0 -74
  40. data/ext/v8/upstream/scons/engine/SCons/PathList.py +0 -232
  41. data/ext/v8/upstream/scons/engine/SCons/Platform/__init__.py +0 -236
  42. data/ext/v8/upstream/scons/engine/SCons/Platform/aix.py +0 -70
  43. data/ext/v8/upstream/scons/engine/SCons/Platform/cygwin.py +0 -55
  44. data/ext/v8/upstream/scons/engine/SCons/Platform/darwin.py +0 -46
  45. data/ext/v8/upstream/scons/engine/SCons/Platform/hpux.py +0 -46
  46. data/ext/v8/upstream/scons/engine/SCons/Platform/irix.py +0 -44
  47. data/ext/v8/upstream/scons/engine/SCons/Platform/os2.py +0 -58
  48. data/ext/v8/upstream/scons/engine/SCons/Platform/posix.py +0 -264
  49. data/ext/v8/upstream/scons/engine/SCons/Platform/sunos.py +0 -50
  50. data/ext/v8/upstream/scons/engine/SCons/Platform/win32.py +0 -386
  51. data/ext/v8/upstream/scons/engine/SCons/SConf.py +0 -1038
  52. data/ext/v8/upstream/scons/engine/SCons/SConsign.py +0 -381
  53. data/ext/v8/upstream/scons/engine/SCons/Scanner/C.py +0 -132
  54. data/ext/v8/upstream/scons/engine/SCons/Scanner/D.py +0 -74
  55. data/ext/v8/upstream/scons/engine/SCons/Scanner/Dir.py +0 -111
  56. data/ext/v8/upstream/scons/engine/SCons/Scanner/Fortran.py +0 -320
  57. data/ext/v8/upstream/scons/engine/SCons/Scanner/IDL.py +0 -48
  58. data/ext/v8/upstream/scons/engine/SCons/Scanner/LaTeX.py +0 -378
  59. data/ext/v8/upstream/scons/engine/SCons/Scanner/Prog.py +0 -103
  60. data/ext/v8/upstream/scons/engine/SCons/Scanner/RC.py +0 -55
  61. data/ext/v8/upstream/scons/engine/SCons/Scanner/__init__.py +0 -415
  62. data/ext/v8/upstream/scons/engine/SCons/Script/Interactive.py +0 -386
  63. data/ext/v8/upstream/scons/engine/SCons/Script/Main.py +0 -1360
  64. data/ext/v8/upstream/scons/engine/SCons/Script/SConsOptions.py +0 -944
  65. data/ext/v8/upstream/scons/engine/SCons/Script/SConscript.py +0 -642
  66. data/ext/v8/upstream/scons/engine/SCons/Script/__init__.py +0 -414
  67. data/ext/v8/upstream/scons/engine/SCons/Sig.py +0 -63
  68. data/ext/v8/upstream/scons/engine/SCons/Subst.py +0 -911
  69. data/ext/v8/upstream/scons/engine/SCons/Taskmaster.py +0 -1030
  70. data/ext/v8/upstream/scons/engine/SCons/Tool/386asm.py +0 -61
  71. data/ext/v8/upstream/scons/engine/SCons/Tool/BitKeeper.py +0 -65
  72. data/ext/v8/upstream/scons/engine/SCons/Tool/CVS.py +0 -73
  73. data/ext/v8/upstream/scons/engine/SCons/Tool/FortranCommon.py +0 -247
  74. data/ext/v8/upstream/scons/engine/SCons/Tool/JavaCommon.py +0 -324
  75. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/__init__.py +0 -56
  76. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/arch.py +0 -61
  77. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/common.py +0 -210
  78. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/netframework.py +0 -84
  79. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/sdk.py +0 -321
  80. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vc.py +0 -367
  81. data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vs.py +0 -497
  82. data/ext/v8/upstream/scons/engine/SCons/Tool/Perforce.py +0 -104
  83. data/ext/v8/upstream/scons/engine/SCons/Tool/PharLapCommon.py +0 -138
  84. data/ext/v8/upstream/scons/engine/SCons/Tool/RCS.py +0 -64
  85. data/ext/v8/upstream/scons/engine/SCons/Tool/SCCS.py +0 -64
  86. data/ext/v8/upstream/scons/engine/SCons/Tool/Subversion.py +0 -71
  87. data/ext/v8/upstream/scons/engine/SCons/Tool/__init__.py +0 -675
  88. data/ext/v8/upstream/scons/engine/SCons/Tool/aixc++.py +0 -82
  89. data/ext/v8/upstream/scons/engine/SCons/Tool/aixcc.py +0 -74
  90. data/ext/v8/upstream/scons/engine/SCons/Tool/aixf77.py +0 -80
  91. data/ext/v8/upstream/scons/engine/SCons/Tool/aixlink.py +0 -76
  92. data/ext/v8/upstream/scons/engine/SCons/Tool/applelink.py +0 -71
  93. data/ext/v8/upstream/scons/engine/SCons/Tool/ar.py +0 -63
  94. data/ext/v8/upstream/scons/engine/SCons/Tool/as.py +0 -78
  95. data/ext/v8/upstream/scons/engine/SCons/Tool/bcc32.py +0 -82
  96. data/ext/v8/upstream/scons/engine/SCons/Tool/c++.py +0 -99
  97. data/ext/v8/upstream/scons/engine/SCons/Tool/cc.py +0 -114
  98. data/ext/v8/upstream/scons/engine/SCons/Tool/cvf.py +0 -58
  99. data/ext/v8/upstream/scons/engine/SCons/Tool/default.py +0 -50
  100. data/ext/v8/upstream/scons/engine/SCons/Tool/dmd.py +0 -224
  101. data/ext/v8/upstream/scons/engine/SCons/Tool/dvi.py +0 -64
  102. data/ext/v8/upstream/scons/engine/SCons/Tool/dvipdf.py +0 -125
  103. data/ext/v8/upstream/scons/engine/SCons/Tool/dvips.py +0 -94
  104. data/ext/v8/upstream/scons/engine/SCons/Tool/f77.py +0 -62
  105. data/ext/v8/upstream/scons/engine/SCons/Tool/f90.py +0 -62
  106. data/ext/v8/upstream/scons/engine/SCons/Tool/f95.py +0 -63
  107. data/ext/v8/upstream/scons/engine/SCons/Tool/filesystem.py +0 -98
  108. data/ext/v8/upstream/scons/engine/SCons/Tool/fortran.py +0 -63
  109. data/ext/v8/upstream/scons/engine/SCons/Tool/g++.py +0 -90
  110. data/ext/v8/upstream/scons/engine/SCons/Tool/g77.py +0 -73
  111. data/ext/v8/upstream/scons/engine/SCons/Tool/gas.py +0 -53
  112. data/ext/v8/upstream/scons/engine/SCons/Tool/gcc.py +0 -80
  113. data/ext/v8/upstream/scons/engine/SCons/Tool/gfortran.py +0 -64
  114. data/ext/v8/upstream/scons/engine/SCons/Tool/gnulink.py +0 -63
  115. data/ext/v8/upstream/scons/engine/SCons/Tool/gs.py +0 -81
  116. data/ext/v8/upstream/scons/engine/SCons/Tool/hpc++.py +0 -85
  117. data/ext/v8/upstream/scons/engine/SCons/Tool/hpcc.py +0 -53
  118. data/ext/v8/upstream/scons/engine/SCons/Tool/hplink.py +0 -77
  119. data/ext/v8/upstream/scons/engine/SCons/Tool/icc.py +0 -59
  120. data/ext/v8/upstream/scons/engine/SCons/Tool/icl.py +0 -52
  121. data/ext/v8/upstream/scons/engine/SCons/Tool/ifl.py +0 -72
  122. data/ext/v8/upstream/scons/engine/SCons/Tool/ifort.py +0 -90
  123. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink.py +0 -59
  124. data/ext/v8/upstream/scons/engine/SCons/Tool/ilink32.py +0 -60
  125. data/ext/v8/upstream/scons/engine/SCons/Tool/install.py +0 -229
  126. data/ext/v8/upstream/scons/engine/SCons/Tool/intelc.py +0 -490
  127. data/ext/v8/upstream/scons/engine/SCons/Tool/ipkg.py +0 -71
  128. data/ext/v8/upstream/scons/engine/SCons/Tool/jar.py +0 -110
  129. data/ext/v8/upstream/scons/engine/SCons/Tool/javac.py +0 -234
  130. data/ext/v8/upstream/scons/engine/SCons/Tool/javah.py +0 -138
  131. data/ext/v8/upstream/scons/engine/SCons/Tool/latex.py +0 -79
  132. data/ext/v8/upstream/scons/engine/SCons/Tool/lex.py +0 -99
  133. data/ext/v8/upstream/scons/engine/SCons/Tool/link.py +0 -121
  134. data/ext/v8/upstream/scons/engine/SCons/Tool/linkloc.py +0 -112
  135. data/ext/v8/upstream/scons/engine/SCons/Tool/m4.py +0 -63
  136. data/ext/v8/upstream/scons/engine/SCons/Tool/masm.py +0 -77
  137. data/ext/v8/upstream/scons/engine/SCons/Tool/midl.py +0 -90
  138. data/ext/v8/upstream/scons/engine/SCons/Tool/mingw.py +0 -159
  139. data/ext/v8/upstream/scons/engine/SCons/Tool/mslib.py +0 -64
  140. data/ext/v8/upstream/scons/engine/SCons/Tool/mslink.py +0 -266
  141. data/ext/v8/upstream/scons/engine/SCons/Tool/mssdk.py +0 -50
  142. data/ext/v8/upstream/scons/engine/SCons/Tool/msvc.py +0 -269
  143. data/ext/v8/upstream/scons/engine/SCons/Tool/msvs.py +0 -1439
  144. data/ext/v8/upstream/scons/engine/SCons/Tool/mwcc.py +0 -208
  145. data/ext/v8/upstream/scons/engine/SCons/Tool/mwld.py +0 -107
  146. data/ext/v8/upstream/scons/engine/SCons/Tool/nasm.py +0 -72
  147. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/__init__.py +0 -314
  148. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/ipk.py +0 -185
  149. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/msi.py +0 -526
  150. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/rpm.py +0 -367
  151. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_tarbz2.py +0 -43
  152. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_targz.py +0 -43
  153. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_zip.py +0 -43
  154. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/tarbz2.py +0 -44
  155. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/targz.py +0 -44
  156. data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/zip.py +0 -44
  157. data/ext/v8/upstream/scons/engine/SCons/Tool/pdf.py +0 -78
  158. data/ext/v8/upstream/scons/engine/SCons/Tool/pdflatex.py +0 -83
  159. data/ext/v8/upstream/scons/engine/SCons/Tool/pdftex.py +0 -108
  160. data/ext/v8/upstream/scons/engine/SCons/Tool/qt.py +0 -336
  161. data/ext/v8/upstream/scons/engine/SCons/Tool/rmic.py +0 -121
  162. data/ext/v8/upstream/scons/engine/SCons/Tool/rpcgen.py +0 -70
  163. data/ext/v8/upstream/scons/engine/SCons/Tool/rpm.py +0 -132
  164. data/ext/v8/upstream/scons/engine/SCons/Tool/sgiar.py +0 -68
  165. data/ext/v8/upstream/scons/engine/SCons/Tool/sgic++.py +0 -58
  166. data/ext/v8/upstream/scons/engine/SCons/Tool/sgicc.py +0 -53
  167. data/ext/v8/upstream/scons/engine/SCons/Tool/sgilink.py +0 -63
  168. data/ext/v8/upstream/scons/engine/SCons/Tool/sunar.py +0 -67
  169. data/ext/v8/upstream/scons/engine/SCons/Tool/sunc++.py +0 -142
  170. data/ext/v8/upstream/scons/engine/SCons/Tool/suncc.py +0 -58
  171. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf77.py +0 -63
  172. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf90.py +0 -64
  173. data/ext/v8/upstream/scons/engine/SCons/Tool/sunf95.py +0 -64
  174. data/ext/v8/upstream/scons/engine/SCons/Tool/sunlink.py +0 -77
  175. data/ext/v8/upstream/scons/engine/SCons/Tool/swig.py +0 -186
  176. data/ext/v8/upstream/scons/engine/SCons/Tool/tar.py +0 -73
  177. data/ext/v8/upstream/scons/engine/SCons/Tool/tex.py +0 -805
  178. data/ext/v8/upstream/scons/engine/SCons/Tool/textfile.py +0 -175
  179. data/ext/v8/upstream/scons/engine/SCons/Tool/tlib.py +0 -53
  180. data/ext/v8/upstream/scons/engine/SCons/Tool/wix.py +0 -100
  181. data/ext/v8/upstream/scons/engine/SCons/Tool/yacc.py +0 -131
  182. data/ext/v8/upstream/scons/engine/SCons/Tool/zip.py +0 -100
  183. data/ext/v8/upstream/scons/engine/SCons/Util.py +0 -1645
  184. data/ext/v8/upstream/scons/engine/SCons/Variables/BoolVariable.py +0 -91
  185. data/ext/v8/upstream/scons/engine/SCons/Variables/EnumVariable.py +0 -107
  186. data/ext/v8/upstream/scons/engine/SCons/Variables/ListVariable.py +0 -139
  187. data/ext/v8/upstream/scons/engine/SCons/Variables/PackageVariable.py +0 -109
  188. data/ext/v8/upstream/scons/engine/SCons/Variables/PathVariable.py +0 -147
  189. data/ext/v8/upstream/scons/engine/SCons/Variables/__init__.py +0 -317
  190. data/ext/v8/upstream/scons/engine/SCons/Warnings.py +0 -228
  191. data/ext/v8/upstream/scons/engine/SCons/__init__.py +0 -49
  192. data/ext/v8/upstream/scons/engine/SCons/compat/__init__.py +0 -302
  193. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_UserString.py +0 -98
  194. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_hashlib.py +0 -91
  195. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_itertools.py +0 -124
  196. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_optparse.py +0 -1725
  197. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets.py +0 -583
  198. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets15.py +0 -176
  199. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_shlex.py +0 -325
  200. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_subprocess.py +0 -1296
  201. data/ext/v8/upstream/scons/engine/SCons/compat/_scons_textwrap.py +0 -382
  202. data/ext/v8/upstream/scons/engine/SCons/compat/builtins.py +0 -187
  203. data/ext/v8/upstream/scons/engine/SCons/cpp.py +0 -598
  204. data/ext/v8/upstream/scons/engine/SCons/dblite.py +0 -248
  205. data/ext/v8/upstream/scons/engine/SCons/exitfuncs.py +0 -77
  206. data/ext/v8/upstream/scons/os_spawnv_fix.diff +0 -83
  207. data/ext/v8/upstream/scons/scons-time.1 +0 -1017
  208. data/ext/v8/upstream/scons/scons.1 +0 -15179
  209. data/ext/v8/upstream/scons/sconsign.1 +0 -208
  210. data/ext/v8/upstream/scons/script/scons +0 -184
  211. data/ext/v8/upstream/scons/script/scons-time +0 -1529
  212. data/ext/v8/upstream/scons/script/scons.bat +0 -31
  213. data/ext/v8/upstream/scons/script/sconsign +0 -508
  214. data/ext/v8/upstream/scons/setup.cfg +0 -6
  215. data/ext/v8/upstream/scons/setup.py +0 -427
  216. data/ext/v8/upstream/v8/.gitignore +0 -33
  217. data/ext/v8/upstream/v8/AUTHORS +0 -42
  218. data/ext/v8/upstream/v8/ChangeLog +0 -2663
  219. data/ext/v8/upstream/v8/LICENSE +0 -52
  220. data/ext/v8/upstream/v8/LICENSE.strongtalk +0 -29
  221. data/ext/v8/upstream/v8/LICENSE.v8 +0 -26
  222. data/ext/v8/upstream/v8/LICENSE.valgrind +0 -45
  223. data/ext/v8/upstream/v8/SConstruct +0 -1473
  224. data/ext/v8/upstream/v8/build/README.txt +0 -25
  225. data/ext/v8/upstream/v8/build/all.gyp +0 -18
  226. data/ext/v8/upstream/v8/build/armu.gypi +0 -32
  227. data/ext/v8/upstream/v8/build/common.gypi +0 -82
  228. data/ext/v8/upstream/v8/build/gyp_v8 +0 -145
  229. data/ext/v8/upstream/v8/include/v8-debug.h +0 -394
  230. data/ext/v8/upstream/v8/include/v8-preparser.h +0 -116
  231. data/ext/v8/upstream/v8/include/v8-profiler.h +0 -505
  232. data/ext/v8/upstream/v8/include/v8-testing.h +0 -104
  233. data/ext/v8/upstream/v8/include/v8.h +0 -4000
  234. data/ext/v8/upstream/v8/include/v8stdint.h +0 -53
  235. data/ext/v8/upstream/v8/preparser/SConscript +0 -38
  236. data/ext/v8/upstream/v8/preparser/preparser-process.cc +0 -169
  237. data/ext/v8/upstream/v8/src/SConscript +0 -380
  238. data/ext/v8/upstream/v8/src/accessors.cc +0 -766
  239. data/ext/v8/upstream/v8/src/accessors.h +0 -121
  240. data/ext/v8/upstream/v8/src/allocation-inl.h +0 -49
  241. data/ext/v8/upstream/v8/src/allocation.cc +0 -122
  242. data/ext/v8/upstream/v8/src/allocation.h +0 -143
  243. data/ext/v8/upstream/v8/src/api.cc +0 -5678
  244. data/ext/v8/upstream/v8/src/api.h +0 -572
  245. data/ext/v8/upstream/v8/src/apinatives.js +0 -110
  246. data/ext/v8/upstream/v8/src/apiutils.h +0 -73
  247. data/ext/v8/upstream/v8/src/arguments.h +0 -116
  248. data/ext/v8/upstream/v8/src/arm/assembler-arm-inl.h +0 -353
  249. data/ext/v8/upstream/v8/src/arm/assembler-arm.cc +0 -2877
  250. data/ext/v8/upstream/v8/src/arm/assembler-arm.h +0 -1382
  251. data/ext/v8/upstream/v8/src/arm/builtins-arm.cc +0 -1634
  252. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.cc +0 -6917
  253. data/ext/v8/upstream/v8/src/arm/code-stubs-arm.h +0 -623
  254. data/ext/v8/upstream/v8/src/arm/codegen-arm-inl.h +0 -48
  255. data/ext/v8/upstream/v8/src/arm/codegen-arm.cc +0 -7437
  256. data/ext/v8/upstream/v8/src/arm/codegen-arm.h +0 -595
  257. data/ext/v8/upstream/v8/src/arm/constants-arm.cc +0 -152
  258. data/ext/v8/upstream/v8/src/arm/constants-arm.h +0 -778
  259. data/ext/v8/upstream/v8/src/arm/cpu-arm.cc +0 -149
  260. data/ext/v8/upstream/v8/src/arm/debug-arm.cc +0 -317
  261. data/ext/v8/upstream/v8/src/arm/deoptimizer-arm.cc +0 -737
  262. data/ext/v8/upstream/v8/src/arm/disasm-arm.cc +0 -1503
  263. data/ext/v8/upstream/v8/src/arm/frames-arm.cc +0 -45
  264. data/ext/v8/upstream/v8/src/arm/frames-arm.h +0 -168
  265. data/ext/v8/upstream/v8/src/arm/full-codegen-arm.cc +0 -4374
  266. data/ext/v8/upstream/v8/src/arm/ic-arm.cc +0 -1793
  267. data/ext/v8/upstream/v8/src/arm/jump-target-arm.cc +0 -174
  268. data/ext/v8/upstream/v8/src/arm/lithium-arm.cc +0 -2120
  269. data/ext/v8/upstream/v8/src/arm/lithium-arm.h +0 -2179
  270. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.cc +0 -4132
  271. data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.h +0 -329
  272. data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.cc +0 -305
  273. data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.h +0 -84
  274. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.cc +0 -2939
  275. data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.h +0 -1071
  276. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.cc +0 -1287
  277. data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.h +0 -253
  278. data/ext/v8/upstream/v8/src/arm/register-allocator-arm-inl.h +0 -100
  279. data/ext/v8/upstream/v8/src/arm/register-allocator-arm.cc +0 -63
  280. data/ext/v8/upstream/v8/src/arm/register-allocator-arm.h +0 -44
  281. data/ext/v8/upstream/v8/src/arm/simulator-arm.cc +0 -3288
  282. data/ext/v8/upstream/v8/src/arm/simulator-arm.h +0 -413
  283. data/ext/v8/upstream/v8/src/arm/stub-cache-arm.cc +0 -4034
  284. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm-inl.h +0 -59
  285. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.cc +0 -843
  286. data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.h +0 -523
  287. data/ext/v8/upstream/v8/src/array.js +0 -1249
  288. data/ext/v8/upstream/v8/src/assembler.cc +0 -1067
  289. data/ext/v8/upstream/v8/src/assembler.h +0 -823
  290. data/ext/v8/upstream/v8/src/ast-inl.h +0 -112
  291. data/ext/v8/upstream/v8/src/ast.cc +0 -1078
  292. data/ext/v8/upstream/v8/src/ast.h +0 -2234
  293. data/ext/v8/upstream/v8/src/atomicops.h +0 -167
  294. data/ext/v8/upstream/v8/src/atomicops_internals_arm_gcc.h +0 -145
  295. data/ext/v8/upstream/v8/src/atomicops_internals_mips_gcc.h +0 -169
  296. data/ext/v8/upstream/v8/src/atomicops_internals_x86_gcc.cc +0 -126
  297. data/ext/v8/upstream/v8/src/atomicops_internals_x86_gcc.h +0 -287
  298. data/ext/v8/upstream/v8/src/atomicops_internals_x86_macosx.h +0 -301
  299. data/ext/v8/upstream/v8/src/atomicops_internals_x86_msvc.h +0 -203
  300. data/ext/v8/upstream/v8/src/bignum-dtoa.cc +0 -655
  301. data/ext/v8/upstream/v8/src/bignum-dtoa.h +0 -81
  302. data/ext/v8/upstream/v8/src/bignum.cc +0 -768
  303. data/ext/v8/upstream/v8/src/bignum.h +0 -140
  304. data/ext/v8/upstream/v8/src/bootstrapper.cc +0 -2138
  305. data/ext/v8/upstream/v8/src/bootstrapper.h +0 -185
  306. data/ext/v8/upstream/v8/src/builtins.cc +0 -1708
  307. data/ext/v8/upstream/v8/src/builtins.h +0 -368
  308. data/ext/v8/upstream/v8/src/bytecodes-irregexp.h +0 -105
  309. data/ext/v8/upstream/v8/src/cached-powers.cc +0 -177
  310. data/ext/v8/upstream/v8/src/cached-powers.h +0 -65
  311. data/ext/v8/upstream/v8/src/char-predicates-inl.h +0 -94
  312. data/ext/v8/upstream/v8/src/char-predicates.h +0 -65
  313. data/ext/v8/upstream/v8/src/checks.cc +0 -110
  314. data/ext/v8/upstream/v8/src/checks.h +0 -296
  315. data/ext/v8/upstream/v8/src/circular-queue-inl.h +0 -53
  316. data/ext/v8/upstream/v8/src/circular-queue.cc +0 -122
  317. data/ext/v8/upstream/v8/src/circular-queue.h +0 -103
  318. data/ext/v8/upstream/v8/src/code-stubs.cc +0 -240
  319. data/ext/v8/upstream/v8/src/code-stubs.h +0 -971
  320. data/ext/v8/upstream/v8/src/code.h +0 -68
  321. data/ext/v8/upstream/v8/src/codegen-inl.h +0 -68
  322. data/ext/v8/upstream/v8/src/codegen.cc +0 -505
  323. data/ext/v8/upstream/v8/src/codegen.h +0 -245
  324. data/ext/v8/upstream/v8/src/compilation-cache.cc +0 -540
  325. data/ext/v8/upstream/v8/src/compilation-cache.h +0 -287
  326. data/ext/v8/upstream/v8/src/compiler.cc +0 -792
  327. data/ext/v8/upstream/v8/src/compiler.h +0 -307
  328. data/ext/v8/upstream/v8/src/contexts.cc +0 -327
  329. data/ext/v8/upstream/v8/src/contexts.h +0 -382
  330. data/ext/v8/upstream/v8/src/conversions-inl.h +0 -110
  331. data/ext/v8/upstream/v8/src/conversions.cc +0 -1125
  332. data/ext/v8/upstream/v8/src/conversions.h +0 -122
  333. data/ext/v8/upstream/v8/src/counters.cc +0 -93
  334. data/ext/v8/upstream/v8/src/counters.h +0 -254
  335. data/ext/v8/upstream/v8/src/cpu-profiler-inl.h +0 -101
  336. data/ext/v8/upstream/v8/src/cpu-profiler.cc +0 -606
  337. data/ext/v8/upstream/v8/src/cpu-profiler.h +0 -305
  338. data/ext/v8/upstream/v8/src/cpu.h +0 -67
  339. data/ext/v8/upstream/v8/src/d8-debug.cc +0 -367
  340. data/ext/v8/upstream/v8/src/d8-debug.h +0 -158
  341. data/ext/v8/upstream/v8/src/d8-posix.cc +0 -695
  342. data/ext/v8/upstream/v8/src/d8-readline.cc +0 -128
  343. data/ext/v8/upstream/v8/src/d8-windows.cc +0 -42
  344. data/ext/v8/upstream/v8/src/d8.cc +0 -796
  345. data/ext/v8/upstream/v8/src/d8.gyp +0 -88
  346. data/ext/v8/upstream/v8/src/d8.h +0 -231
  347. data/ext/v8/upstream/v8/src/d8.js +0 -2798
  348. data/ext/v8/upstream/v8/src/data-flow.cc +0 -545
  349. data/ext/v8/upstream/v8/src/data-flow.h +0 -379
  350. data/ext/v8/upstream/v8/src/date.js +0 -1103
  351. data/ext/v8/upstream/v8/src/dateparser-inl.h +0 -125
  352. data/ext/v8/upstream/v8/src/dateparser.cc +0 -178
  353. data/ext/v8/upstream/v8/src/dateparser.h +0 -265
  354. data/ext/v8/upstream/v8/src/debug-agent.cc +0 -447
  355. data/ext/v8/upstream/v8/src/debug-agent.h +0 -129
  356. data/ext/v8/upstream/v8/src/debug-debugger.js +0 -2569
  357. data/ext/v8/upstream/v8/src/debug.cc +0 -3188
  358. data/ext/v8/upstream/v8/src/debug.h +0 -1055
  359. data/ext/v8/upstream/v8/src/deoptimizer.cc +0 -1296
  360. data/ext/v8/upstream/v8/src/deoptimizer.h +0 -629
  361. data/ext/v8/upstream/v8/src/disasm.h +0 -80
  362. data/ext/v8/upstream/v8/src/disassembler.cc +0 -339
  363. data/ext/v8/upstream/v8/src/disassembler.h +0 -56
  364. data/ext/v8/upstream/v8/src/diy-fp.cc +0 -58
  365. data/ext/v8/upstream/v8/src/diy-fp.h +0 -117
  366. data/ext/v8/upstream/v8/src/double.h +0 -238
  367. data/ext/v8/upstream/v8/src/dtoa.cc +0 -103
  368. data/ext/v8/upstream/v8/src/dtoa.h +0 -85
  369. data/ext/v8/upstream/v8/src/execution.cc +0 -791
  370. data/ext/v8/upstream/v8/src/execution.h +0 -291
  371. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.cc +0 -250
  372. data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.h +0 -89
  373. data/ext/v8/upstream/v8/src/extensions/experimental/experimental.gyp +0 -55
  374. data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.cc +0 -284
  375. data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.h +0 -64
  376. data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.cc +0 -141
  377. data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.h +0 -50
  378. data/ext/v8/upstream/v8/src/extensions/gc-extension.cc +0 -58
  379. data/ext/v8/upstream/v8/src/extensions/gc-extension.h +0 -49
  380. data/ext/v8/upstream/v8/src/factory.cc +0 -1194
  381. data/ext/v8/upstream/v8/src/factory.h +0 -436
  382. data/ext/v8/upstream/v8/src/fast-dtoa.cc +0 -736
  383. data/ext/v8/upstream/v8/src/fast-dtoa.h +0 -83
  384. data/ext/v8/upstream/v8/src/fixed-dtoa.cc +0 -405
  385. data/ext/v8/upstream/v8/src/fixed-dtoa.h +0 -55
  386. data/ext/v8/upstream/v8/src/flag-definitions.h +0 -556
  387. data/ext/v8/upstream/v8/src/flags.cc +0 -551
  388. data/ext/v8/upstream/v8/src/flags.h +0 -79
  389. data/ext/v8/upstream/v8/src/frame-element.cc +0 -37
  390. data/ext/v8/upstream/v8/src/frame-element.h +0 -269
  391. data/ext/v8/upstream/v8/src/frames-inl.h +0 -236
  392. data/ext/v8/upstream/v8/src/frames.cc +0 -1273
  393. data/ext/v8/upstream/v8/src/frames.h +0 -854
  394. data/ext/v8/upstream/v8/src/full-codegen.cc +0 -1385
  395. data/ext/v8/upstream/v8/src/full-codegen.h +0 -753
  396. data/ext/v8/upstream/v8/src/func-name-inferrer.cc +0 -91
  397. data/ext/v8/upstream/v8/src/func-name-inferrer.h +0 -111
  398. data/ext/v8/upstream/v8/src/gdb-jit.cc +0 -1548
  399. data/ext/v8/upstream/v8/src/gdb-jit.h +0 -138
  400. data/ext/v8/upstream/v8/src/global-handles.cc +0 -596
  401. data/ext/v8/upstream/v8/src/global-handles.h +0 -239
  402. data/ext/v8/upstream/v8/src/globals.h +0 -325
  403. data/ext/v8/upstream/v8/src/handles-inl.h +0 -177
  404. data/ext/v8/upstream/v8/src/handles.cc +0 -965
  405. data/ext/v8/upstream/v8/src/handles.h +0 -372
  406. data/ext/v8/upstream/v8/src/hashmap.cc +0 -230
  407. data/ext/v8/upstream/v8/src/hashmap.h +0 -121
  408. data/ext/v8/upstream/v8/src/heap-inl.h +0 -703
  409. data/ext/v8/upstream/v8/src/heap-profiler.cc +0 -1173
  410. data/ext/v8/upstream/v8/src/heap-profiler.h +0 -396
  411. data/ext/v8/upstream/v8/src/heap.cc +0 -5856
  412. data/ext/v8/upstream/v8/src/heap.h +0 -2264
  413. data/ext/v8/upstream/v8/src/hydrogen-instructions.cc +0 -1639
  414. data/ext/v8/upstream/v8/src/hydrogen-instructions.h +0 -3657
  415. data/ext/v8/upstream/v8/src/hydrogen.cc +0 -6011
  416. data/ext/v8/upstream/v8/src/hydrogen.h +0 -1137
  417. data/ext/v8/upstream/v8/src/ia32/assembler-ia32-inl.h +0 -430
  418. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.cc +0 -2846
  419. data/ext/v8/upstream/v8/src/ia32/assembler-ia32.h +0 -1159
  420. data/ext/v8/upstream/v8/src/ia32/builtins-ia32.cc +0 -1596
  421. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.cc +0 -6549
  422. data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.h +0 -495
  423. data/ext/v8/upstream/v8/src/ia32/codegen-ia32-inl.h +0 -46
  424. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.cc +0 -10385
  425. data/ext/v8/upstream/v8/src/ia32/codegen-ia32.h +0 -801
  426. data/ext/v8/upstream/v8/src/ia32/cpu-ia32.cc +0 -88
  427. data/ext/v8/upstream/v8/src/ia32/debug-ia32.cc +0 -312
  428. data/ext/v8/upstream/v8/src/ia32/deoptimizer-ia32.cc +0 -774
  429. data/ext/v8/upstream/v8/src/ia32/disasm-ia32.cc +0 -1620
  430. data/ext/v8/upstream/v8/src/ia32/frames-ia32.cc +0 -45
  431. data/ext/v8/upstream/v8/src/ia32/frames-ia32.h +0 -140
  432. data/ext/v8/upstream/v8/src/ia32/full-codegen-ia32.cc +0 -4357
  433. data/ext/v8/upstream/v8/src/ia32/ic-ia32.cc +0 -1779
  434. data/ext/v8/upstream/v8/src/ia32/jump-target-ia32.cc +0 -437
  435. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.cc +0 -4158
  436. data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.h +0 -318
  437. data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.cc +0 -466
  438. data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.h +0 -110
  439. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.cc +0 -2181
  440. data/ext/v8/upstream/v8/src/ia32/lithium-ia32.h +0 -2235
  441. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.cc +0 -2056
  442. data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.h +0 -807
  443. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.cc +0 -1264
  444. data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.h +0 -216
  445. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32-inl.h +0 -82
  446. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.cc +0 -157
  447. data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.h +0 -43
  448. data/ext/v8/upstream/v8/src/ia32/simulator-ia32.cc +0 -30
  449. data/ext/v8/upstream/v8/src/ia32/simulator-ia32.h +0 -72
  450. data/ext/v8/upstream/v8/src/ia32/stub-cache-ia32.cc +0 -3711
  451. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.cc +0 -1366
  452. data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.h +0 -650
  453. data/ext/v8/upstream/v8/src/ic-inl.h +0 -130
  454. data/ext/v8/upstream/v8/src/ic.cc +0 -2389
  455. data/ext/v8/upstream/v8/src/ic.h +0 -675
  456. data/ext/v8/upstream/v8/src/inspector.cc +0 -63
  457. data/ext/v8/upstream/v8/src/inspector.h +0 -62
  458. data/ext/v8/upstream/v8/src/interpreter-irregexp.cc +0 -659
  459. data/ext/v8/upstream/v8/src/interpreter-irregexp.h +0 -49
  460. data/ext/v8/upstream/v8/src/isolate.cc +0 -883
  461. data/ext/v8/upstream/v8/src/isolate.h +0 -1306
  462. data/ext/v8/upstream/v8/src/json.js +0 -342
  463. data/ext/v8/upstream/v8/src/jsregexp.cc +0 -5371
  464. data/ext/v8/upstream/v8/src/jsregexp.h +0 -1483
  465. data/ext/v8/upstream/v8/src/jump-target-heavy-inl.h +0 -51
  466. data/ext/v8/upstream/v8/src/jump-target-heavy.cc +0 -427
  467. data/ext/v8/upstream/v8/src/jump-target-heavy.h +0 -238
  468. data/ext/v8/upstream/v8/src/jump-target-inl.h +0 -48
  469. data/ext/v8/upstream/v8/src/jump-target-light-inl.h +0 -56
  470. data/ext/v8/upstream/v8/src/jump-target-light.cc +0 -111
  471. data/ext/v8/upstream/v8/src/jump-target-light.h +0 -193
  472. data/ext/v8/upstream/v8/src/jump-target.cc +0 -91
  473. data/ext/v8/upstream/v8/src/jump-target.h +0 -90
  474. data/ext/v8/upstream/v8/src/list-inl.h +0 -206
  475. data/ext/v8/upstream/v8/src/list.h +0 -164
  476. data/ext/v8/upstream/v8/src/lithium-allocator-inl.h +0 -142
  477. data/ext/v8/upstream/v8/src/lithium-allocator.cc +0 -2105
  478. data/ext/v8/upstream/v8/src/lithium-allocator.h +0 -630
  479. data/ext/v8/upstream/v8/src/lithium.cc +0 -169
  480. data/ext/v8/upstream/v8/src/lithium.h +0 -592
  481. data/ext/v8/upstream/v8/src/liveedit-debugger.js +0 -1082
  482. data/ext/v8/upstream/v8/src/liveedit.cc +0 -1693
  483. data/ext/v8/upstream/v8/src/liveedit.h +0 -179
  484. data/ext/v8/upstream/v8/src/liveobjectlist-inl.h +0 -126
  485. data/ext/v8/upstream/v8/src/liveobjectlist.cc +0 -2589
  486. data/ext/v8/upstream/v8/src/liveobjectlist.h +0 -322
  487. data/ext/v8/upstream/v8/src/log-inl.h +0 -59
  488. data/ext/v8/upstream/v8/src/log-utils.cc +0 -423
  489. data/ext/v8/upstream/v8/src/log-utils.h +0 -229
  490. data/ext/v8/upstream/v8/src/log.cc +0 -1666
  491. data/ext/v8/upstream/v8/src/log.h +0 -446
  492. data/ext/v8/upstream/v8/src/macro-assembler.h +0 -120
  493. data/ext/v8/upstream/v8/src/macros.py +0 -178
  494. data/ext/v8/upstream/v8/src/mark-compact.cc +0 -3092
  495. data/ext/v8/upstream/v8/src/mark-compact.h +0 -506
  496. data/ext/v8/upstream/v8/src/math.js +0 -264
  497. data/ext/v8/upstream/v8/src/messages.cc +0 -166
  498. data/ext/v8/upstream/v8/src/messages.h +0 -114
  499. data/ext/v8/upstream/v8/src/messages.js +0 -1090
  500. data/ext/v8/upstream/v8/src/mips/assembler-mips-inl.h +0 -335
  501. data/ext/v8/upstream/v8/src/mips/assembler-mips.cc +0 -2093
  502. data/ext/v8/upstream/v8/src/mips/assembler-mips.h +0 -1066
  503. data/ext/v8/upstream/v8/src/mips/builtins-mips.cc +0 -148
  504. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.cc +0 -752
  505. data/ext/v8/upstream/v8/src/mips/code-stubs-mips.h +0 -511
  506. data/ext/v8/upstream/v8/src/mips/codegen-mips-inl.h +0 -64
  507. data/ext/v8/upstream/v8/src/mips/codegen-mips.cc +0 -1213
  508. data/ext/v8/upstream/v8/src/mips/codegen-mips.h +0 -633
  509. data/ext/v8/upstream/v8/src/mips/constants-mips.cc +0 -352
  510. data/ext/v8/upstream/v8/src/mips/constants-mips.h +0 -723
  511. data/ext/v8/upstream/v8/src/mips/cpu-mips.cc +0 -90
  512. data/ext/v8/upstream/v8/src/mips/debug-mips.cc +0 -155
  513. data/ext/v8/upstream/v8/src/mips/deoptimizer-mips.cc +0 -91
  514. data/ext/v8/upstream/v8/src/mips/disasm-mips.cc +0 -1023
  515. data/ext/v8/upstream/v8/src/mips/frames-mips.cc +0 -48
  516. data/ext/v8/upstream/v8/src/mips/frames-mips.h +0 -179
  517. data/ext/v8/upstream/v8/src/mips/full-codegen-mips.cc +0 -727
  518. data/ext/v8/upstream/v8/src/mips/ic-mips.cc +0 -244
  519. data/ext/v8/upstream/v8/src/mips/jump-target-mips.cc +0 -80
  520. data/ext/v8/upstream/v8/src/mips/lithium-codegen-mips.h +0 -65
  521. data/ext/v8/upstream/v8/src/mips/lithium-mips.h +0 -304
  522. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.cc +0 -3327
  523. data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.h +0 -1058
  524. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.cc +0 -478
  525. data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.h +0 -250
  526. data/ext/v8/upstream/v8/src/mips/register-allocator-mips-inl.h +0 -134
  527. data/ext/v8/upstream/v8/src/mips/register-allocator-mips.cc +0 -63
  528. data/ext/v8/upstream/v8/src/mips/register-allocator-mips.h +0 -47
  529. data/ext/v8/upstream/v8/src/mips/simulator-mips.cc +0 -2438
  530. data/ext/v8/upstream/v8/src/mips/simulator-mips.h +0 -394
  531. data/ext/v8/upstream/v8/src/mips/stub-cache-mips.cc +0 -601
  532. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips-inl.h +0 -58
  533. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.cc +0 -307
  534. data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.h +0 -530
  535. data/ext/v8/upstream/v8/src/mirror-debugger.js +0 -2381
  536. data/ext/v8/upstream/v8/src/mksnapshot.cc +0 -256
  537. data/ext/v8/upstream/v8/src/natives.h +0 -63
  538. data/ext/v8/upstream/v8/src/objects-debug.cc +0 -722
  539. data/ext/v8/upstream/v8/src/objects-inl.h +0 -4166
  540. data/ext/v8/upstream/v8/src/objects-printer.cc +0 -801
  541. data/ext/v8/upstream/v8/src/objects-visiting.cc +0 -142
  542. data/ext/v8/upstream/v8/src/objects-visiting.h +0 -422
  543. data/ext/v8/upstream/v8/src/objects.cc +0 -10296
  544. data/ext/v8/upstream/v8/src/objects.h +0 -6662
  545. data/ext/v8/upstream/v8/src/parser.cc +0 -5168
  546. data/ext/v8/upstream/v8/src/parser.h +0 -823
  547. data/ext/v8/upstream/v8/src/platform-cygwin.cc +0 -811
  548. data/ext/v8/upstream/v8/src/platform-freebsd.cc +0 -854
  549. data/ext/v8/upstream/v8/src/platform-linux.cc +0 -1120
  550. data/ext/v8/upstream/v8/src/platform-macos.cc +0 -865
  551. data/ext/v8/upstream/v8/src/platform-nullos.cc +0 -504
  552. data/ext/v8/upstream/v8/src/platform-openbsd.cc +0 -672
  553. data/ext/v8/upstream/v8/src/platform-posix.cc +0 -424
  554. data/ext/v8/upstream/v8/src/platform-solaris.cc +0 -796
  555. data/ext/v8/upstream/v8/src/platform-tls-mac.h +0 -62
  556. data/ext/v8/upstream/v8/src/platform-tls-win32.h +0 -62
  557. data/ext/v8/upstream/v8/src/platform-tls.h +0 -50
  558. data/ext/v8/upstream/v8/src/platform-win32.cc +0 -2072
  559. data/ext/v8/upstream/v8/src/platform.h +0 -693
  560. data/ext/v8/upstream/v8/src/preparse-data.cc +0 -185
  561. data/ext/v8/upstream/v8/src/preparse-data.h +0 -249
  562. data/ext/v8/upstream/v8/src/preparser-api.cc +0 -219
  563. data/ext/v8/upstream/v8/src/preparser.cc +0 -1205
  564. data/ext/v8/upstream/v8/src/preparser.h +0 -278
  565. data/ext/v8/upstream/v8/src/prettyprinter.cc +0 -1530
  566. data/ext/v8/upstream/v8/src/prettyprinter.h +0 -223
  567. data/ext/v8/upstream/v8/src/profile-generator-inl.h +0 -128
  568. data/ext/v8/upstream/v8/src/profile-generator.cc +0 -3095
  569. data/ext/v8/upstream/v8/src/profile-generator.h +0 -1125
  570. data/ext/v8/upstream/v8/src/property.cc +0 -102
  571. data/ext/v8/upstream/v8/src/property.h +0 -348
  572. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp-inl.h +0 -78
  573. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.cc +0 -470
  574. data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.h +0 -142
  575. data/ext/v8/upstream/v8/src/regexp-macro-assembler-tracer.cc +0 -373
  576. data/ext/v8/upstream/v8/src/regexp-macro-assembler-tracer.h +0 -104
  577. data/ext/v8/upstream/v8/src/regexp-macro-assembler.cc +0 -266
  578. data/ext/v8/upstream/v8/src/regexp-macro-assembler.h +0 -236
  579. data/ext/v8/upstream/v8/src/regexp-stack.cc +0 -111
  580. data/ext/v8/upstream/v8/src/regexp-stack.h +0 -147
  581. data/ext/v8/upstream/v8/src/regexp.js +0 -483
  582. data/ext/v8/upstream/v8/src/register-allocator-inl.h +0 -141
  583. data/ext/v8/upstream/v8/src/register-allocator.cc +0 -98
  584. data/ext/v8/upstream/v8/src/register-allocator.h +0 -310
  585. data/ext/v8/upstream/v8/src/rewriter.cc +0 -1024
  586. data/ext/v8/upstream/v8/src/rewriter.h +0 -59
  587. data/ext/v8/upstream/v8/src/runtime-profiler.cc +0 -478
  588. data/ext/v8/upstream/v8/src/runtime-profiler.h +0 -192
  589. data/ext/v8/upstream/v8/src/runtime.cc +0 -11949
  590. data/ext/v8/upstream/v8/src/runtime.h +0 -643
  591. data/ext/v8/upstream/v8/src/runtime.js +0 -643
  592. data/ext/v8/upstream/v8/src/safepoint-table.cc +0 -256
  593. data/ext/v8/upstream/v8/src/safepoint-table.h +0 -269
  594. data/ext/v8/upstream/v8/src/scanner-base.cc +0 -964
  595. data/ext/v8/upstream/v8/src/scanner-base.h +0 -664
  596. data/ext/v8/upstream/v8/src/scanner.cc +0 -584
  597. data/ext/v8/upstream/v8/src/scanner.h +0 -196
  598. data/ext/v8/upstream/v8/src/scopeinfo.cc +0 -631
  599. data/ext/v8/upstream/v8/src/scopeinfo.h +0 -249
  600. data/ext/v8/upstream/v8/src/scopes.cc +0 -1093
  601. data/ext/v8/upstream/v8/src/scopes.h +0 -508
  602. data/ext/v8/upstream/v8/src/serialize.cc +0 -1574
  603. data/ext/v8/upstream/v8/src/serialize.h +0 -589
  604. data/ext/v8/upstream/v8/src/shell.h +0 -55
  605. data/ext/v8/upstream/v8/src/simulator.h +0 -43
  606. data/ext/v8/upstream/v8/src/small-pointer-list.h +0 -163
  607. data/ext/v8/upstream/v8/src/smart-pointer.h +0 -109
  608. data/ext/v8/upstream/v8/src/snapshot-common.cc +0 -82
  609. data/ext/v8/upstream/v8/src/snapshot-empty.cc +0 -50
  610. data/ext/v8/upstream/v8/src/snapshot.h +0 -73
  611. data/ext/v8/upstream/v8/src/spaces-inl.h +0 -529
  612. data/ext/v8/upstream/v8/src/spaces.cc +0 -3147
  613. data/ext/v8/upstream/v8/src/spaces.h +0 -2368
  614. data/ext/v8/upstream/v8/src/splay-tree-inl.h +0 -310
  615. data/ext/v8/upstream/v8/src/splay-tree.h +0 -203
  616. data/ext/v8/upstream/v8/src/string-search.cc +0 -41
  617. data/ext/v8/upstream/v8/src/string-search.h +0 -568
  618. data/ext/v8/upstream/v8/src/string-stream.cc +0 -592
  619. data/ext/v8/upstream/v8/src/string-stream.h +0 -191
  620. data/ext/v8/upstream/v8/src/string.js +0 -915
  621. data/ext/v8/upstream/v8/src/strtod.cc +0 -440
  622. data/ext/v8/upstream/v8/src/strtod.h +0 -40
  623. data/ext/v8/upstream/v8/src/stub-cache.cc +0 -1940
  624. data/ext/v8/upstream/v8/src/stub-cache.h +0 -866
  625. data/ext/v8/upstream/v8/src/third_party/valgrind/valgrind.h +0 -3925
  626. data/ext/v8/upstream/v8/src/token.cc +0 -63
  627. data/ext/v8/upstream/v8/src/token.h +0 -288
  628. data/ext/v8/upstream/v8/src/top.cc +0 -983
  629. data/ext/v8/upstream/v8/src/type-info.cc +0 -472
  630. data/ext/v8/upstream/v8/src/type-info.h +0 -290
  631. data/ext/v8/upstream/v8/src/unbound-queue-inl.h +0 -95
  632. data/ext/v8/upstream/v8/src/unbound-queue.h +0 -67
  633. data/ext/v8/upstream/v8/src/unicode-inl.h +0 -238
  634. data/ext/v8/upstream/v8/src/unicode.cc +0 -1624
  635. data/ext/v8/upstream/v8/src/unicode.h +0 -280
  636. data/ext/v8/upstream/v8/src/uri.js +0 -402
  637. data/ext/v8/upstream/v8/src/utils.cc +0 -371
  638. data/ext/v8/upstream/v8/src/utils.h +0 -796
  639. data/ext/v8/upstream/v8/src/v8-counters.cc +0 -62
  640. data/ext/v8/upstream/v8/src/v8-counters.h +0 -311
  641. data/ext/v8/upstream/v8/src/v8.cc +0 -215
  642. data/ext/v8/upstream/v8/src/v8.h +0 -130
  643. data/ext/v8/upstream/v8/src/v8checks.h +0 -64
  644. data/ext/v8/upstream/v8/src/v8dll-main.cc +0 -39
  645. data/ext/v8/upstream/v8/src/v8globals.h +0 -486
  646. data/ext/v8/upstream/v8/src/v8memory.h +0 -82
  647. data/ext/v8/upstream/v8/src/v8natives.js +0 -1293
  648. data/ext/v8/upstream/v8/src/v8preparserdll-main.cc +0 -39
  649. data/ext/v8/upstream/v8/src/v8threads.cc +0 -453
  650. data/ext/v8/upstream/v8/src/v8threads.h +0 -164
  651. data/ext/v8/upstream/v8/src/v8utils.h +0 -317
  652. data/ext/v8/upstream/v8/src/variables.cc +0 -132
  653. data/ext/v8/upstream/v8/src/variables.h +0 -212
  654. data/ext/v8/upstream/v8/src/version.cc +0 -116
  655. data/ext/v8/upstream/v8/src/version.h +0 -68
  656. data/ext/v8/upstream/v8/src/virtual-frame-heavy-inl.h +0 -190
  657. data/ext/v8/upstream/v8/src/virtual-frame-heavy.cc +0 -312
  658. data/ext/v8/upstream/v8/src/virtual-frame-inl.h +0 -39
  659. data/ext/v8/upstream/v8/src/virtual-frame-light-inl.h +0 -171
  660. data/ext/v8/upstream/v8/src/virtual-frame-light.cc +0 -52
  661. data/ext/v8/upstream/v8/src/virtual-frame.cc +0 -49
  662. data/ext/v8/upstream/v8/src/virtual-frame.h +0 -59
  663. data/ext/v8/upstream/v8/src/vm-state-inl.h +0 -138
  664. data/ext/v8/upstream/v8/src/vm-state.h +0 -70
  665. data/ext/v8/upstream/v8/src/win32-headers.h +0 -96
  666. data/ext/v8/upstream/v8/src/x64/assembler-x64-inl.h +0 -456
  667. data/ext/v8/upstream/v8/src/x64/assembler-x64.cc +0 -2954
  668. data/ext/v8/upstream/v8/src/x64/assembler-x64.h +0 -1630
  669. data/ext/v8/upstream/v8/src/x64/builtins-x64.cc +0 -1493
  670. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.cc +0 -5132
  671. data/ext/v8/upstream/v8/src/x64/code-stubs-x64.h +0 -477
  672. data/ext/v8/upstream/v8/src/x64/codegen-x64-inl.h +0 -46
  673. data/ext/v8/upstream/v8/src/x64/codegen-x64.cc +0 -8843
  674. data/ext/v8/upstream/v8/src/x64/codegen-x64.h +0 -753
  675. data/ext/v8/upstream/v8/src/x64/cpu-x64.cc +0 -88
  676. data/ext/v8/upstream/v8/src/x64/debug-x64.cc +0 -318
  677. data/ext/v8/upstream/v8/src/x64/deoptimizer-x64.cc +0 -815
  678. data/ext/v8/upstream/v8/src/x64/disasm-x64.cc +0 -1752
  679. data/ext/v8/upstream/v8/src/x64/frames-x64.cc +0 -45
  680. data/ext/v8/upstream/v8/src/x64/frames-x64.h +0 -130
  681. data/ext/v8/upstream/v8/src/x64/full-codegen-x64.cc +0 -4339
  682. data/ext/v8/upstream/v8/src/x64/ic-x64.cc +0 -1752
  683. data/ext/v8/upstream/v8/src/x64/jump-target-x64.cc +0 -437
  684. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.cc +0 -3970
  685. data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.h +0 -318
  686. data/ext/v8/upstream/v8/src/x64/lithium-gap-resolver-x64.cc +0 -320
  687. data/ext/v8/upstream/v8/src/x64/lithium-gap-resolver-x64.h +0 -74
  688. data/ext/v8/upstream/v8/src/x64/lithium-x64.cc +0 -2115
  689. data/ext/v8/upstream/v8/src/x64/lithium-x64.h +0 -2161
  690. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.cc +0 -2911
  691. data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.h +0 -1984
  692. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.cc +0 -1398
  693. data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.h +0 -282
  694. data/ext/v8/upstream/v8/src/x64/register-allocator-x64-inl.h +0 -87
  695. data/ext/v8/upstream/v8/src/x64/register-allocator-x64.cc +0 -95
  696. data/ext/v8/upstream/v8/src/x64/register-allocator-x64.h +0 -43
  697. data/ext/v8/upstream/v8/src/x64/simulator-x64.cc +0 -27
  698. data/ext/v8/upstream/v8/src/x64/simulator-x64.h +0 -71
  699. data/ext/v8/upstream/v8/src/x64/stub-cache-x64.cc +0 -3460
  700. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.cc +0 -1296
  701. data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.h +0 -597
  702. data/ext/v8/upstream/v8/src/zone-inl.h +0 -129
  703. data/ext/v8/upstream/v8/src/zone.cc +0 -196
  704. data/ext/v8/upstream/v8/src/zone.h +0 -236
  705. data/ext/v8/upstream/v8/tools/codemap.js +0 -265
  706. data/ext/v8/upstream/v8/tools/consarray.js +0 -93
  707. data/ext/v8/upstream/v8/tools/csvparser.js +0 -78
  708. data/ext/v8/upstream/v8/tools/disasm.py +0 -92
  709. data/ext/v8/upstream/v8/tools/freebsd-tick-processor +0 -10
  710. data/ext/v8/upstream/v8/tools/gc-nvp-trace-processor.py +0 -328
  711. data/ext/v8/upstream/v8/tools/generate-ten-powers.scm +0 -286
  712. data/ext/v8/upstream/v8/tools/grokdump.py +0 -840
  713. data/ext/v8/upstream/v8/tools/gyp/v8.gyp +0 -844
  714. data/ext/v8/upstream/v8/tools/js2c.py +0 -380
  715. data/ext/v8/upstream/v8/tools/jsmin.py +0 -280
  716. data/ext/v8/upstream/v8/tools/linux-tick-processor +0 -35
  717. data/ext/v8/upstream/v8/tools/ll_prof.py +0 -919
  718. data/ext/v8/upstream/v8/tools/logreader.js +0 -185
  719. data/ext/v8/upstream/v8/tools/mac-nm +0 -18
  720. data/ext/v8/upstream/v8/tools/mac-tick-processor +0 -6
  721. data/ext/v8/upstream/v8/tools/oom_dump/README +0 -31
  722. data/ext/v8/upstream/v8/tools/oom_dump/SConstruct +0 -42
  723. data/ext/v8/upstream/v8/tools/oom_dump/oom_dump.cc +0 -288
  724. data/ext/v8/upstream/v8/tools/presubmit.py +0 -305
  725. data/ext/v8/upstream/v8/tools/process-heap-prof.py +0 -120
  726. data/ext/v8/upstream/v8/tools/profile.js +0 -751
  727. data/ext/v8/upstream/v8/tools/profile_view.js +0 -219
  728. data/ext/v8/upstream/v8/tools/run-valgrind.py +0 -77
  729. data/ext/v8/upstream/v8/tools/splaytree.js +0 -316
  730. data/ext/v8/upstream/v8/tools/stats-viewer.py +0 -468
  731. data/ext/v8/upstream/v8/tools/test.py +0 -1490
  732. data/ext/v8/upstream/v8/tools/tickprocessor-driver.js +0 -59
  733. data/ext/v8/upstream/v8/tools/tickprocessor.js +0 -877
  734. data/ext/v8/upstream/v8/tools/utils.py +0 -96
  735. data/ext/v8/upstream/v8/tools/visual_studio/README.txt +0 -70
  736. data/ext/v8/upstream/v8/tools/visual_studio/arm.vsprops +0 -14
  737. data/ext/v8/upstream/v8/tools/visual_studio/common.vsprops +0 -34
  738. data/ext/v8/upstream/v8/tools/visual_studio/d8.vcproj +0 -193
  739. data/ext/v8/upstream/v8/tools/visual_studio/d8_arm.vcproj +0 -193
  740. data/ext/v8/upstream/v8/tools/visual_studio/d8_x64.vcproj +0 -209
  741. data/ext/v8/upstream/v8/tools/visual_studio/d8js2c.cmd +0 -6
  742. data/ext/v8/upstream/v8/tools/visual_studio/debug.vsprops +0 -17
  743. data/ext/v8/upstream/v8/tools/visual_studio/ia32.vsprops +0 -17
  744. data/ext/v8/upstream/v8/tools/visual_studio/js2c.cmd +0 -6
  745. data/ext/v8/upstream/v8/tools/visual_studio/release.vsprops +0 -24
  746. data/ext/v8/upstream/v8/tools/visual_studio/v8.sln +0 -101
  747. data/ext/v8/upstream/v8/tools/visual_studio/v8.vcproj +0 -227
  748. data/ext/v8/upstream/v8/tools/visual_studio/v8_arm.sln +0 -74
  749. data/ext/v8/upstream/v8/tools/visual_studio/v8_arm.vcproj +0 -227
  750. data/ext/v8/upstream/v8/tools/visual_studio/v8_base.vcproj +0 -1308
  751. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_arm.vcproj +0 -1238
  752. data/ext/v8/upstream/v8/tools/visual_studio/v8_base_x64.vcproj +0 -1300
  753. data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest.vcproj +0 -265
  754. data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest_arm.vcproj +0 -249
  755. data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest_x64.vcproj +0 -257
  756. data/ext/v8/upstream/v8/tools/visual_studio/v8_mksnapshot.vcproj +0 -145
  757. data/ext/v8/upstream/v8/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -145
  758. data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample.vcproj +0 -145
  759. data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample_arm.vcproj +0 -145
  760. data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample_x64.vcproj +0 -161
  761. data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample.vcproj +0 -147
  762. data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -147
  763. data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -163
  764. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot.vcproj +0 -142
  765. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_cc.vcproj +0 -92
  766. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -92
  767. data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_x64.vcproj +0 -142
  768. data/ext/v8/upstream/v8/tools/visual_studio/v8_x64.sln +0 -101
  769. data/ext/v8/upstream/v8/tools/visual_studio/v8_x64.vcproj +0 -227
  770. data/ext/v8/upstream/v8/tools/visual_studio/x64.vsprops +0 -18
  771. data/ext/v8/upstream/v8/tools/windows-tick-processor.bat +0 -30
@@ -1,4166 +0,0 @@
1
- // Copyright 2011 the V8 project authors. All rights reserved.
2
- // Redistribution and use in source and binary forms, with or without
3
- // modification, are permitted provided that the following conditions are
4
- // met:
5
- //
6
- // * Redistributions of source code must retain the above copyright
7
- // notice, this list of conditions and the following disclaimer.
8
- // * Redistributions in binary form must reproduce the above
9
- // copyright notice, this list of conditions and the following
10
- // disclaimer in the documentation and/or other materials provided
11
- // with the distribution.
12
- // * Neither the name of Google Inc. nor the names of its
13
- // contributors may be used to endorse or promote products derived
14
- // from this software without specific prior written permission.
15
- //
16
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
- //
28
- // Review notes:
29
- //
30
- // - The use of macros in these inline functions may seem superfluous
31
- // but it is absolutely needed to make sure gcc generates optimal
32
- // code. gcc is not happy when attempting to inline too deep.
33
- //
34
-
35
- #ifndef V8_OBJECTS_INL_H_
36
- #define V8_OBJECTS_INL_H_
37
-
38
- #include "objects.h"
39
- #include "contexts.h"
40
- #include "conversions-inl.h"
41
- #include "heap.h"
42
- #include "isolate.h"
43
- #include "property.h"
44
- #include "spaces.h"
45
- #include "v8memory.h"
46
-
47
- namespace v8 {
48
- namespace internal {
49
-
50
- PropertyDetails::PropertyDetails(Smi* smi) {
51
- value_ = smi->value();
52
- }
53
-
54
-
55
- Smi* PropertyDetails::AsSmi() {
56
- return Smi::FromInt(value_);
57
- }
58
-
59
-
60
- PropertyDetails PropertyDetails::AsDeleted() {
61
- Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1));
62
- return PropertyDetails(smi);
63
- }
64
-
65
-
66
- #define CAST_ACCESSOR(type) \
67
- type* type::cast(Object* object) { \
68
- ASSERT(object->Is##type()); \
69
- return reinterpret_cast<type*>(object); \
70
- }
71
-
72
-
73
- #define INT_ACCESSORS(holder, name, offset) \
74
- int holder::name() { return READ_INT_FIELD(this, offset); } \
75
- void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); }
76
-
77
-
78
- #define ACCESSORS(holder, name, type, offset) \
79
- type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \
80
- void holder::set_##name(type* value, WriteBarrierMode mode) { \
81
- WRITE_FIELD(this, offset, value); \
82
- CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, mode); \
83
- }
84
-
85
-
86
- // GC-safe accessors do not use HeapObject::GetHeap(), but access TLS instead.
87
- #define ACCESSORS_GCSAFE(holder, name, type, offset) \
88
- type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \
89
- void holder::set_##name(type* value, WriteBarrierMode mode) { \
90
- WRITE_FIELD(this, offset, value); \
91
- CONDITIONAL_WRITE_BARRIER(HEAP, this, offset, mode); \
92
- }
93
-
94
-
95
- #define SMI_ACCESSORS(holder, name, offset) \
96
- int holder::name() { \
97
- Object* value = READ_FIELD(this, offset); \
98
- return Smi::cast(value)->value(); \
99
- } \
100
- void holder::set_##name(int value) { \
101
- WRITE_FIELD(this, offset, Smi::FromInt(value)); \
102
- }
103
-
104
-
105
- #define BOOL_GETTER(holder, field, name, offset) \
106
- bool holder::name() { \
107
- return BooleanBit::get(field(), offset); \
108
- } \
109
-
110
-
111
- #define BOOL_ACCESSORS(holder, field, name, offset) \
112
- bool holder::name() { \
113
- return BooleanBit::get(field(), offset); \
114
- } \
115
- void holder::set_##name(bool value) { \
116
- set_##field(BooleanBit::set(field(), offset, value)); \
117
- }
118
-
119
-
120
- bool Object::IsInstanceOf(FunctionTemplateInfo* expected) {
121
- // There is a constraint on the object; check.
122
- if (!this->IsJSObject()) return false;
123
- // Fetch the constructor function of the object.
124
- Object* cons_obj = JSObject::cast(this)->map()->constructor();
125
- if (!cons_obj->IsJSFunction()) return false;
126
- JSFunction* fun = JSFunction::cast(cons_obj);
127
- // Iterate through the chain of inheriting function templates to
128
- // see if the required one occurs.
129
- for (Object* type = fun->shared()->function_data();
130
- type->IsFunctionTemplateInfo();
131
- type = FunctionTemplateInfo::cast(type)->parent_template()) {
132
- if (type == expected) return true;
133
- }
134
- // Didn't find the required type in the inheritance chain.
135
- return false;
136
- }
137
-
138
-
139
- bool Object::IsSmi() {
140
- return HAS_SMI_TAG(this);
141
- }
142
-
143
-
144
- bool Object::IsHeapObject() {
145
- return Internals::HasHeapObjectTag(this);
146
- }
147
-
148
-
149
- bool Object::IsHeapNumber() {
150
- return Object::IsHeapObject()
151
- && HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE;
152
- }
153
-
154
-
155
- bool Object::IsString() {
156
- return Object::IsHeapObject()
157
- && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE;
158
- }
159
-
160
-
161
- bool Object::IsSymbol() {
162
- if (!this->IsHeapObject()) return false;
163
- uint32_t type = HeapObject::cast(this)->map()->instance_type();
164
- // Because the symbol tag is non-zero and no non-string types have the
165
- // symbol bit set we can test for symbols with a very simple test
166
- // operation.
167
- ASSERT(kSymbolTag != 0);
168
- ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE);
169
- return (type & kIsSymbolMask) != 0;
170
- }
171
-
172
-
173
- bool Object::IsConsString() {
174
- if (!this->IsHeapObject()) return false;
175
- uint32_t type = HeapObject::cast(this)->map()->instance_type();
176
- return (type & (kIsNotStringMask | kStringRepresentationMask)) ==
177
- (kStringTag | kConsStringTag);
178
- }
179
-
180
-
181
- bool Object::IsSeqString() {
182
- if (!IsString()) return false;
183
- return StringShape(String::cast(this)).IsSequential();
184
- }
185
-
186
-
187
- bool Object::IsSeqAsciiString() {
188
- if (!IsString()) return false;
189
- return StringShape(String::cast(this)).IsSequential() &&
190
- String::cast(this)->IsAsciiRepresentation();
191
- }
192
-
193
-
194
- bool Object::IsSeqTwoByteString() {
195
- if (!IsString()) return false;
196
- return StringShape(String::cast(this)).IsSequential() &&
197
- String::cast(this)->IsTwoByteRepresentation();
198
- }
199
-
200
-
201
- bool Object::IsExternalString() {
202
- if (!IsString()) return false;
203
- return StringShape(String::cast(this)).IsExternal();
204
- }
205
-
206
-
207
- bool Object::IsExternalAsciiString() {
208
- if (!IsString()) return false;
209
- return StringShape(String::cast(this)).IsExternal() &&
210
- String::cast(this)->IsAsciiRepresentation();
211
- }
212
-
213
-
214
- bool Object::IsExternalTwoByteString() {
215
- if (!IsString()) return false;
216
- return StringShape(String::cast(this)).IsExternal() &&
217
- String::cast(this)->IsTwoByteRepresentation();
218
- }
219
-
220
-
221
- StringShape::StringShape(String* str)
222
- : type_(str->map()->instance_type()) {
223
- set_valid();
224
- ASSERT((type_ & kIsNotStringMask) == kStringTag);
225
- }
226
-
227
-
228
- StringShape::StringShape(Map* map)
229
- : type_(map->instance_type()) {
230
- set_valid();
231
- ASSERT((type_ & kIsNotStringMask) == kStringTag);
232
- }
233
-
234
-
235
- StringShape::StringShape(InstanceType t)
236
- : type_(static_cast<uint32_t>(t)) {
237
- set_valid();
238
- ASSERT((type_ & kIsNotStringMask) == kStringTag);
239
- }
240
-
241
-
242
- bool StringShape::IsSymbol() {
243
- ASSERT(valid());
244
- ASSERT(kSymbolTag != 0);
245
- return (type_ & kIsSymbolMask) != 0;
246
- }
247
-
248
-
249
- bool String::IsAsciiRepresentation() {
250
- uint32_t type = map()->instance_type();
251
- return (type & kStringEncodingMask) == kAsciiStringTag;
252
- }
253
-
254
-
255
- bool String::IsTwoByteRepresentation() {
256
- uint32_t type = map()->instance_type();
257
- return (type & kStringEncodingMask) == kTwoByteStringTag;
258
- }
259
-
260
-
261
- bool String::HasOnlyAsciiChars() {
262
- uint32_t type = map()->instance_type();
263
- return (type & kStringEncodingMask) == kAsciiStringTag ||
264
- (type & kAsciiDataHintMask) == kAsciiDataHintTag;
265
- }
266
-
267
-
268
- bool StringShape::IsCons() {
269
- return (type_ & kStringRepresentationMask) == kConsStringTag;
270
- }
271
-
272
-
273
- bool StringShape::IsExternal() {
274
- return (type_ & kStringRepresentationMask) == kExternalStringTag;
275
- }
276
-
277
-
278
- bool StringShape::IsSequential() {
279
- return (type_ & kStringRepresentationMask) == kSeqStringTag;
280
- }
281
-
282
-
283
- StringRepresentationTag StringShape::representation_tag() {
284
- uint32_t tag = (type_ & kStringRepresentationMask);
285
- return static_cast<StringRepresentationTag>(tag);
286
- }
287
-
288
-
289
- uint32_t StringShape::full_representation_tag() {
290
- return (type_ & (kStringRepresentationMask | kStringEncodingMask));
291
- }
292
-
293
-
294
- STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) ==
295
- Internals::kFullStringRepresentationMask);
296
-
297
-
298
- bool StringShape::IsSequentialAscii() {
299
- return full_representation_tag() == (kSeqStringTag | kAsciiStringTag);
300
- }
301
-
302
-
303
- bool StringShape::IsSequentialTwoByte() {
304
- return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag);
305
- }
306
-
307
-
308
- bool StringShape::IsExternalAscii() {
309
- return full_representation_tag() == (kExternalStringTag | kAsciiStringTag);
310
- }
311
-
312
-
313
- bool StringShape::IsExternalTwoByte() {
314
- return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag);
315
- }
316
-
317
-
318
- STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) ==
319
- Internals::kExternalTwoByteRepresentationTag);
320
-
321
-
322
- uc32 FlatStringReader::Get(int index) {
323
- ASSERT(0 <= index && index <= length_);
324
- if (is_ascii_) {
325
- return static_cast<const byte*>(start_)[index];
326
- } else {
327
- return static_cast<const uc16*>(start_)[index];
328
- }
329
- }
330
-
331
-
332
- bool Object::IsNumber() {
333
- return IsSmi() || IsHeapNumber();
334
- }
335
-
336
-
337
- bool Object::IsByteArray() {
338
- return Object::IsHeapObject()
339
- && HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE;
340
- }
341
-
342
-
343
- bool Object::IsExternalPixelArray() {
344
- return Object::IsHeapObject() &&
345
- HeapObject::cast(this)->map()->instance_type() ==
346
- EXTERNAL_PIXEL_ARRAY_TYPE;
347
- }
348
-
349
-
350
- bool Object::IsExternalArray() {
351
- if (!Object::IsHeapObject())
352
- return false;
353
- InstanceType instance_type =
354
- HeapObject::cast(this)->map()->instance_type();
355
- return (instance_type >= FIRST_EXTERNAL_ARRAY_TYPE &&
356
- instance_type <= LAST_EXTERNAL_ARRAY_TYPE);
357
- }
358
-
359
-
360
- bool Object::IsExternalByteArray() {
361
- return Object::IsHeapObject() &&
362
- HeapObject::cast(this)->map()->instance_type() ==
363
- EXTERNAL_BYTE_ARRAY_TYPE;
364
- }
365
-
366
-
367
- bool Object::IsExternalUnsignedByteArray() {
368
- return Object::IsHeapObject() &&
369
- HeapObject::cast(this)->map()->instance_type() ==
370
- EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE;
371
- }
372
-
373
-
374
- bool Object::IsExternalShortArray() {
375
- return Object::IsHeapObject() &&
376
- HeapObject::cast(this)->map()->instance_type() ==
377
- EXTERNAL_SHORT_ARRAY_TYPE;
378
- }
379
-
380
-
381
- bool Object::IsExternalUnsignedShortArray() {
382
- return Object::IsHeapObject() &&
383
- HeapObject::cast(this)->map()->instance_type() ==
384
- EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE;
385
- }
386
-
387
-
388
- bool Object::IsExternalIntArray() {
389
- return Object::IsHeapObject() &&
390
- HeapObject::cast(this)->map()->instance_type() ==
391
- EXTERNAL_INT_ARRAY_TYPE;
392
- }
393
-
394
-
395
- bool Object::IsExternalUnsignedIntArray() {
396
- return Object::IsHeapObject() &&
397
- HeapObject::cast(this)->map()->instance_type() ==
398
- EXTERNAL_UNSIGNED_INT_ARRAY_TYPE;
399
- }
400
-
401
-
402
- bool Object::IsExternalFloatArray() {
403
- return Object::IsHeapObject() &&
404
- HeapObject::cast(this)->map()->instance_type() ==
405
- EXTERNAL_FLOAT_ARRAY_TYPE;
406
- }
407
-
408
-
409
- bool MaybeObject::IsFailure() {
410
- return HAS_FAILURE_TAG(this);
411
- }
412
-
413
-
414
- bool MaybeObject::IsRetryAfterGC() {
415
- return HAS_FAILURE_TAG(this)
416
- && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC;
417
- }
418
-
419
-
420
- bool MaybeObject::IsOutOfMemory() {
421
- return HAS_FAILURE_TAG(this)
422
- && Failure::cast(this)->IsOutOfMemoryException();
423
- }
424
-
425
-
426
- bool MaybeObject::IsException() {
427
- return this == Failure::Exception();
428
- }
429
-
430
-
431
- bool MaybeObject::IsTheHole() {
432
- return !IsFailure() && ToObjectUnchecked()->IsTheHole();
433
- }
434
-
435
-
436
- Failure* Failure::cast(MaybeObject* obj) {
437
- ASSERT(HAS_FAILURE_TAG(obj));
438
- return reinterpret_cast<Failure*>(obj);
439
- }
440
-
441
-
442
- bool Object::IsJSObject() {
443
- return IsHeapObject()
444
- && HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE;
445
- }
446
-
447
-
448
- bool Object::IsJSContextExtensionObject() {
449
- return IsHeapObject()
450
- && (HeapObject::cast(this)->map()->instance_type() ==
451
- JS_CONTEXT_EXTENSION_OBJECT_TYPE);
452
- }
453
-
454
-
455
- bool Object::IsMap() {
456
- return Object::IsHeapObject()
457
- && HeapObject::cast(this)->map()->instance_type() == MAP_TYPE;
458
- }
459
-
460
-
461
- bool Object::IsFixedArray() {
462
- return Object::IsHeapObject()
463
- && HeapObject::cast(this)->map()->instance_type() == FIXED_ARRAY_TYPE;
464
- }
465
-
466
-
467
- bool Object::IsDescriptorArray() {
468
- return IsFixedArray();
469
- }
470
-
471
-
472
- bool Object::IsDeoptimizationInputData() {
473
- // Must be a fixed array.
474
- if (!IsFixedArray()) return false;
475
-
476
- // There's no sure way to detect the difference between a fixed array and
477
- // a deoptimization data array. Since this is used for asserts we can
478
- // check that the length is zero or else the fixed size plus a multiple of
479
- // the entry size.
480
- int length = FixedArray::cast(this)->length();
481
- if (length == 0) return true;
482
-
483
- length -= DeoptimizationInputData::kFirstDeoptEntryIndex;
484
- return length >= 0 &&
485
- length % DeoptimizationInputData::kDeoptEntrySize == 0;
486
- }
487
-
488
-
489
- bool Object::IsDeoptimizationOutputData() {
490
- if (!IsFixedArray()) return false;
491
- // There's actually no way to see the difference between a fixed array and
492
- // a deoptimization data array. Since this is used for asserts we can check
493
- // that the length is plausible though.
494
- if (FixedArray::cast(this)->length() % 2 != 0) return false;
495
- return true;
496
- }
497
-
498
-
499
- bool Object::IsContext() {
500
- if (Object::IsHeapObject()) {
501
- Heap* heap = HeapObject::cast(this)->GetHeap();
502
- return (HeapObject::cast(this)->map() == heap->context_map() ||
503
- HeapObject::cast(this)->map() == heap->catch_context_map() ||
504
- HeapObject::cast(this)->map() == heap->global_context_map());
505
- }
506
- return false;
507
- }
508
-
509
-
510
- bool Object::IsCatchContext() {
511
- return Object::IsHeapObject() &&
512
- HeapObject::cast(this)->map() ==
513
- HeapObject::cast(this)->GetHeap()->catch_context_map();
514
- }
515
-
516
-
517
- bool Object::IsGlobalContext() {
518
- return Object::IsHeapObject() &&
519
- HeapObject::cast(this)->map() ==
520
- HeapObject::cast(this)->GetHeap()->global_context_map();
521
- }
522
-
523
-
524
- bool Object::IsJSFunction() {
525
- return Object::IsHeapObject()
526
- && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE;
527
- }
528
-
529
-
530
- template <> inline bool Is<JSFunction>(Object* obj) {
531
- return obj->IsJSFunction();
532
- }
533
-
534
-
535
- bool Object::IsCode() {
536
- return Object::IsHeapObject()
537
- && HeapObject::cast(this)->map()->instance_type() == CODE_TYPE;
538
- }
539
-
540
-
541
- bool Object::IsOddball() {
542
- ASSERT(HEAP->is_safe_to_read_maps());
543
- return Object::IsHeapObject()
544
- && HeapObject::cast(this)->map()->instance_type() == ODDBALL_TYPE;
545
- }
546
-
547
-
548
- bool Object::IsJSGlobalPropertyCell() {
549
- return Object::IsHeapObject()
550
- && HeapObject::cast(this)->map()->instance_type()
551
- == JS_GLOBAL_PROPERTY_CELL_TYPE;
552
- }
553
-
554
-
555
- bool Object::IsSharedFunctionInfo() {
556
- return Object::IsHeapObject() &&
557
- (HeapObject::cast(this)->map()->instance_type() ==
558
- SHARED_FUNCTION_INFO_TYPE);
559
- }
560
-
561
-
562
- bool Object::IsJSValue() {
563
- return Object::IsHeapObject()
564
- && HeapObject::cast(this)->map()->instance_type() == JS_VALUE_TYPE;
565
- }
566
-
567
-
568
- bool Object::IsJSMessageObject() {
569
- return Object::IsHeapObject()
570
- && (HeapObject::cast(this)->map()->instance_type() ==
571
- JS_MESSAGE_OBJECT_TYPE);
572
- }
573
-
574
-
575
- bool Object::IsStringWrapper() {
576
- return IsJSValue() && JSValue::cast(this)->value()->IsString();
577
- }
578
-
579
-
580
- bool Object::IsProxy() {
581
- return Object::IsHeapObject()
582
- && HeapObject::cast(this)->map()->instance_type() == PROXY_TYPE;
583
- }
584
-
585
-
586
- bool Object::IsBoolean() {
587
- return IsOddball() &&
588
- ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0);
589
- }
590
-
591
-
592
- bool Object::IsJSArray() {
593
- return Object::IsHeapObject()
594
- && HeapObject::cast(this)->map()->instance_type() == JS_ARRAY_TYPE;
595
- }
596
-
597
-
598
- bool Object::IsJSRegExp() {
599
- return Object::IsHeapObject()
600
- && HeapObject::cast(this)->map()->instance_type() == JS_REGEXP_TYPE;
601
- }
602
-
603
-
604
- template <> inline bool Is<JSArray>(Object* obj) {
605
- return obj->IsJSArray();
606
- }
607
-
608
-
609
- bool Object::IsHashTable() {
610
- return Object::IsHeapObject() &&
611
- HeapObject::cast(this)->map() ==
612
- HeapObject::cast(this)->GetHeap()->hash_table_map();
613
- }
614
-
615
-
616
- bool Object::IsDictionary() {
617
- return IsHashTable() && this !=
618
- HeapObject::cast(this)->GetHeap()->symbol_table();
619
- }
620
-
621
-
622
- bool Object::IsSymbolTable() {
623
- return IsHashTable() && this ==
624
- HeapObject::cast(this)->GetHeap()->raw_unchecked_symbol_table();
625
- }
626
-
627
-
628
- bool Object::IsJSFunctionResultCache() {
629
- if (!IsFixedArray()) return false;
630
- FixedArray* self = FixedArray::cast(this);
631
- int length = self->length();
632
- if (length < JSFunctionResultCache::kEntriesIndex) return false;
633
- if ((length - JSFunctionResultCache::kEntriesIndex)
634
- % JSFunctionResultCache::kEntrySize != 0) {
635
- return false;
636
- }
637
- #ifdef DEBUG
638
- reinterpret_cast<JSFunctionResultCache*>(this)->JSFunctionResultCacheVerify();
639
- #endif
640
- return true;
641
- }
642
-
643
-
644
- bool Object::IsNormalizedMapCache() {
645
- if (!IsFixedArray()) return false;
646
- if (FixedArray::cast(this)->length() != NormalizedMapCache::kEntries) {
647
- return false;
648
- }
649
- #ifdef DEBUG
650
- reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify();
651
- #endif
652
- return true;
653
- }
654
-
655
-
656
- bool Object::IsCompilationCacheTable() {
657
- return IsHashTable();
658
- }
659
-
660
-
661
- bool Object::IsCodeCacheHashTable() {
662
- return IsHashTable();
663
- }
664
-
665
-
666
- bool Object::IsMapCache() {
667
- return IsHashTable();
668
- }
669
-
670
-
671
- bool Object::IsPrimitive() {
672
- return IsOddball() || IsNumber() || IsString();
673
- }
674
-
675
-
676
- bool Object::IsJSGlobalProxy() {
677
- bool result = IsHeapObject() &&
678
- (HeapObject::cast(this)->map()->instance_type() ==
679
- JS_GLOBAL_PROXY_TYPE);
680
- ASSERT(!result || IsAccessCheckNeeded());
681
- return result;
682
- }
683
-
684
-
685
- bool Object::IsGlobalObject() {
686
- if (!IsHeapObject()) return false;
687
-
688
- InstanceType type = HeapObject::cast(this)->map()->instance_type();
689
- return type == JS_GLOBAL_OBJECT_TYPE ||
690
- type == JS_BUILTINS_OBJECT_TYPE;
691
- }
692
-
693
-
694
- bool Object::IsJSGlobalObject() {
695
- return IsHeapObject() &&
696
- (HeapObject::cast(this)->map()->instance_type() ==
697
- JS_GLOBAL_OBJECT_TYPE);
698
- }
699
-
700
-
701
- bool Object::IsJSBuiltinsObject() {
702
- return IsHeapObject() &&
703
- (HeapObject::cast(this)->map()->instance_type() ==
704
- JS_BUILTINS_OBJECT_TYPE);
705
- }
706
-
707
-
708
- bool Object::IsUndetectableObject() {
709
- return IsHeapObject()
710
- && HeapObject::cast(this)->map()->is_undetectable();
711
- }
712
-
713
-
714
- bool Object::IsAccessCheckNeeded() {
715
- return IsHeapObject()
716
- && HeapObject::cast(this)->map()->is_access_check_needed();
717
- }
718
-
719
-
720
- bool Object::IsStruct() {
721
- if (!IsHeapObject()) return false;
722
- switch (HeapObject::cast(this)->map()->instance_type()) {
723
- #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true;
724
- STRUCT_LIST(MAKE_STRUCT_CASE)
725
- #undef MAKE_STRUCT_CASE
726
- default: return false;
727
- }
728
- }
729
-
730
-
731
- #define MAKE_STRUCT_PREDICATE(NAME, Name, name) \
732
- bool Object::Is##Name() { \
733
- return Object::IsHeapObject() \
734
- && HeapObject::cast(this)->map()->instance_type() == NAME##_TYPE; \
735
- }
736
- STRUCT_LIST(MAKE_STRUCT_PREDICATE)
737
- #undef MAKE_STRUCT_PREDICATE
738
-
739
-
740
- bool Object::IsUndefined() {
741
- return IsOddball() && Oddball::cast(this)->kind() == Oddball::kUndefined;
742
- }
743
-
744
-
745
- bool Object::IsNull() {
746
- return IsOddball() && Oddball::cast(this)->kind() == Oddball::kNull;
747
- }
748
-
749
-
750
- bool Object::IsTheHole() {
751
- return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTheHole;
752
- }
753
-
754
-
755
- bool Object::IsTrue() {
756
- return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTrue;
757
- }
758
-
759
-
760
- bool Object::IsFalse() {
761
- return IsOddball() && Oddball::cast(this)->kind() == Oddball::kFalse;
762
- }
763
-
764
-
765
- bool Object::IsArgumentsMarker() {
766
- return IsOddball() && Oddball::cast(this)->kind() == Oddball::kArgumentMarker;
767
- }
768
-
769
-
770
- double Object::Number() {
771
- ASSERT(IsNumber());
772
- return IsSmi()
773
- ? static_cast<double>(reinterpret_cast<Smi*>(this)->value())
774
- : reinterpret_cast<HeapNumber*>(this)->value();
775
- }
776
-
777
-
778
- MaybeObject* Object::ToSmi() {
779
- if (IsSmi()) return this;
780
- if (IsHeapNumber()) {
781
- double value = HeapNumber::cast(this)->value();
782
- int int_value = FastD2I(value);
783
- if (value == FastI2D(int_value) && Smi::IsValid(int_value)) {
784
- return Smi::FromInt(int_value);
785
- }
786
- }
787
- return Failure::Exception();
788
- }
789
-
790
-
791
- bool Object::HasSpecificClassOf(String* name) {
792
- return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
793
- }
794
-
795
-
796
- MaybeObject* Object::GetElement(uint32_t index) {
797
- // GetElement can trigger a getter which can cause allocation.
798
- // This was not always the case. This ASSERT is here to catch
799
- // leftover incorrect uses.
800
- ASSERT(HEAP->IsAllocationAllowed());
801
- return GetElementWithReceiver(this, index);
802
- }
803
-
804
-
805
- Object* Object::GetElementNoExceptionThrown(uint32_t index) {
806
- MaybeObject* maybe = GetElementWithReceiver(this, index);
807
- ASSERT(!maybe->IsFailure());
808
- Object* result = NULL; // Initialization to please compiler.
809
- maybe->ToObject(&result);
810
- return result;
811
- }
812
-
813
-
814
- MaybeObject* Object::GetProperty(String* key) {
815
- PropertyAttributes attributes;
816
- return GetPropertyWithReceiver(this, key, &attributes);
817
- }
818
-
819
-
820
- MaybeObject* Object::GetProperty(String* key, PropertyAttributes* attributes) {
821
- return GetPropertyWithReceiver(this, key, attributes);
822
- }
823
-
824
-
825
- #define FIELD_ADDR(p, offset) \
826
- (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag)
827
-
828
- #define READ_FIELD(p, offset) \
829
- (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)))
830
-
831
- #define WRITE_FIELD(p, offset, value) \
832
- (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value)
833
-
834
- // TODO(isolates): Pass heap in to these macros.
835
- #define WRITE_BARRIER(object, offset) \
836
- object->GetHeap()->RecordWrite(object->address(), offset);
837
-
838
- // CONDITIONAL_WRITE_BARRIER must be issued after the actual
839
- // write due to the assert validating the written value.
840
- #define CONDITIONAL_WRITE_BARRIER(heap, object, offset, mode) \
841
- if (mode == UPDATE_WRITE_BARRIER) { \
842
- heap->RecordWrite(object->address(), offset); \
843
- } else { \
844
- ASSERT(mode == SKIP_WRITE_BARRIER); \
845
- ASSERT(heap->InNewSpace(object) || \
846
- !heap->InNewSpace(READ_FIELD(object, offset)) || \
847
- Page::FromAddress(object->address())-> \
848
- IsRegionDirty(object->address() + offset)); \
849
- }
850
-
851
- #ifndef V8_TARGET_ARCH_MIPS
852
- #define READ_DOUBLE_FIELD(p, offset) \
853
- (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)))
854
- #else // V8_TARGET_ARCH_MIPS
855
- // Prevent gcc from using load-double (mips ldc1) on (possibly)
856
- // non-64-bit aligned HeapNumber::value.
857
- static inline double read_double_field(HeapNumber* p, int offset) {
858
- union conversion {
859
- double d;
860
- uint32_t u[2];
861
- } c;
862
- c.u[0] = (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)));
863
- c.u[1] = (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset + 4)));
864
- return c.d;
865
- }
866
- #define READ_DOUBLE_FIELD(p, offset) read_double_field(p, offset)
867
- #endif // V8_TARGET_ARCH_MIPS
868
-
869
-
870
- #ifndef V8_TARGET_ARCH_MIPS
871
- #define WRITE_DOUBLE_FIELD(p, offset, value) \
872
- (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value)
873
- #else // V8_TARGET_ARCH_MIPS
874
- // Prevent gcc from using store-double (mips sdc1) on (possibly)
875
- // non-64-bit aligned HeapNumber::value.
876
- static inline void write_double_field(HeapNumber* p, int offset,
877
- double value) {
878
- union conversion {
879
- double d;
880
- uint32_t u[2];
881
- } c;
882
- c.d = value;
883
- (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) = c.u[0];
884
- (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset + 4))) = c.u[1];
885
- }
886
- #define WRITE_DOUBLE_FIELD(p, offset, value) \
887
- write_double_field(p, offset, value)
888
- #endif // V8_TARGET_ARCH_MIPS
889
-
890
-
891
- #define READ_INT_FIELD(p, offset) \
892
- (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)))
893
-
894
- #define WRITE_INT_FIELD(p, offset, value) \
895
- (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value)
896
-
897
- #define READ_INTPTR_FIELD(p, offset) \
898
- (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)))
899
-
900
- #define WRITE_INTPTR_FIELD(p, offset, value) \
901
- (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value)
902
-
903
- #define READ_UINT32_FIELD(p, offset) \
904
- (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)))
905
-
906
- #define WRITE_UINT32_FIELD(p, offset, value) \
907
- (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value)
908
-
909
- #define READ_SHORT_FIELD(p, offset) \
910
- (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)))
911
-
912
- #define WRITE_SHORT_FIELD(p, offset, value) \
913
- (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value)
914
-
915
- #define READ_BYTE_FIELD(p, offset) \
916
- (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)))
917
-
918
- #define WRITE_BYTE_FIELD(p, offset, value) \
919
- (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value)
920
-
921
-
922
- Object** HeapObject::RawField(HeapObject* obj, int byte_offset) {
923
- return &READ_FIELD(obj, byte_offset);
924
- }
925
-
926
-
927
- int Smi::value() {
928
- return Internals::SmiValue(this);
929
- }
930
-
931
-
932
- Smi* Smi::FromInt(int value) {
933
- ASSERT(Smi::IsValid(value));
934
- int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
935
- intptr_t tagged_value =
936
- (static_cast<intptr_t>(value) << smi_shift_bits) | kSmiTag;
937
- return reinterpret_cast<Smi*>(tagged_value);
938
- }
939
-
940
-
941
- Smi* Smi::FromIntptr(intptr_t value) {
942
- ASSERT(Smi::IsValid(value));
943
- int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
944
- return reinterpret_cast<Smi*>((value << smi_shift_bits) | kSmiTag);
945
- }
946
-
947
-
948
- Failure::Type Failure::type() const {
949
- return static_cast<Type>(value() & kFailureTypeTagMask);
950
- }
951
-
952
-
953
- bool Failure::IsInternalError() const {
954
- return type() == INTERNAL_ERROR;
955
- }
956
-
957
-
958
- bool Failure::IsOutOfMemoryException() const {
959
- return type() == OUT_OF_MEMORY_EXCEPTION;
960
- }
961
-
962
-
963
- AllocationSpace Failure::allocation_space() const {
964
- ASSERT_EQ(RETRY_AFTER_GC, type());
965
- return static_cast<AllocationSpace>((value() >> kFailureTypeTagSize)
966
- & kSpaceTagMask);
967
- }
968
-
969
-
970
- Failure* Failure::InternalError() {
971
- return Construct(INTERNAL_ERROR);
972
- }
973
-
974
-
975
- Failure* Failure::Exception() {
976
- return Construct(EXCEPTION);
977
- }
978
-
979
-
980
- Failure* Failure::OutOfMemoryException() {
981
- return Construct(OUT_OF_MEMORY_EXCEPTION);
982
- }
983
-
984
-
985
- intptr_t Failure::value() const {
986
- return static_cast<intptr_t>(
987
- reinterpret_cast<uintptr_t>(this) >> kFailureTagSize);
988
- }
989
-
990
-
991
- Failure* Failure::RetryAfterGC() {
992
- return RetryAfterGC(NEW_SPACE);
993
- }
994
-
995
-
996
- Failure* Failure::RetryAfterGC(AllocationSpace space) {
997
- ASSERT((space & ~kSpaceTagMask) == 0);
998
- return Construct(RETRY_AFTER_GC, space);
999
- }
1000
-
1001
-
1002
- Failure* Failure::Construct(Type type, intptr_t value) {
1003
- uintptr_t info =
1004
- (static_cast<uintptr_t>(value) << kFailureTypeTagSize) | type;
1005
- ASSERT(((info << kFailureTagSize) >> kFailureTagSize) == info);
1006
- return reinterpret_cast<Failure*>((info << kFailureTagSize) | kFailureTag);
1007
- }
1008
-
1009
-
1010
- bool Smi::IsValid(intptr_t value) {
1011
- #ifdef DEBUG
1012
- bool in_range = (value >= kMinValue) && (value <= kMaxValue);
1013
- #endif
1014
-
1015
- #ifdef V8_TARGET_ARCH_X64
1016
- // To be representable as a long smi, the value must be a 32-bit integer.
1017
- bool result = (value == static_cast<int32_t>(value));
1018
- #else
1019
- // To be representable as an tagged small integer, the two
1020
- // most-significant bits of 'value' must be either 00 or 11 due to
1021
- // sign-extension. To check this we add 01 to the two
1022
- // most-significant bits, and check if the most-significant bit is 0
1023
- //
1024
- // CAUTION: The original code below:
1025
- // bool result = ((value + 0x40000000) & 0x80000000) == 0;
1026
- // may lead to incorrect results according to the C language spec, and
1027
- // in fact doesn't work correctly with gcc4.1.1 in some cases: The
1028
- // compiler may produce undefined results in case of signed integer
1029
- // overflow. The computation must be done w/ unsigned ints.
1030
- bool result = (static_cast<uintptr_t>(value + 0x40000000U) < 0x80000000U);
1031
- #endif
1032
- ASSERT(result == in_range);
1033
- return result;
1034
- }
1035
-
1036
-
1037
- MapWord MapWord::FromMap(Map* map) {
1038
- return MapWord(reinterpret_cast<uintptr_t>(map));
1039
- }
1040
-
1041
-
1042
- Map* MapWord::ToMap() {
1043
- return reinterpret_cast<Map*>(value_);
1044
- }
1045
-
1046
-
1047
- bool MapWord::IsForwardingAddress() {
1048
- return HAS_SMI_TAG(reinterpret_cast<Object*>(value_));
1049
- }
1050
-
1051
-
1052
- MapWord MapWord::FromForwardingAddress(HeapObject* object) {
1053
- Address raw = reinterpret_cast<Address>(object) - kHeapObjectTag;
1054
- return MapWord(reinterpret_cast<uintptr_t>(raw));
1055
- }
1056
-
1057
-
1058
- HeapObject* MapWord::ToForwardingAddress() {
1059
- ASSERT(IsForwardingAddress());
1060
- return HeapObject::FromAddress(reinterpret_cast<Address>(value_));
1061
- }
1062
-
1063
-
1064
- bool MapWord::IsMarked() {
1065
- return (value_ & kMarkingMask) == 0;
1066
- }
1067
-
1068
-
1069
- void MapWord::SetMark() {
1070
- value_ &= ~kMarkingMask;
1071
- }
1072
-
1073
-
1074
- void MapWord::ClearMark() {
1075
- value_ |= kMarkingMask;
1076
- }
1077
-
1078
-
1079
- bool MapWord::IsOverflowed() {
1080
- return (value_ & kOverflowMask) != 0;
1081
- }
1082
-
1083
-
1084
- void MapWord::SetOverflow() {
1085
- value_ |= kOverflowMask;
1086
- }
1087
-
1088
-
1089
- void MapWord::ClearOverflow() {
1090
- value_ &= ~kOverflowMask;
1091
- }
1092
-
1093
-
1094
- MapWord MapWord::EncodeAddress(Address map_address, int offset) {
1095
- // Offset is the distance in live bytes from the first live object in the
1096
- // same page. The offset between two objects in the same page should not
1097
- // exceed the object area size of a page.
1098
- ASSERT(0 <= offset && offset < Page::kObjectAreaSize);
1099
-
1100
- uintptr_t compact_offset = offset >> kObjectAlignmentBits;
1101
- ASSERT(compact_offset < (1 << kForwardingOffsetBits));
1102
-
1103
- Page* map_page = Page::FromAddress(map_address);
1104
- ASSERT_MAP_PAGE_INDEX(map_page->mc_page_index);
1105
-
1106
- uintptr_t map_page_offset =
1107
- map_page->Offset(map_address) >> kMapAlignmentBits;
1108
-
1109
- uintptr_t encoding =
1110
- (compact_offset << kForwardingOffsetShift) |
1111
- (map_page_offset << kMapPageOffsetShift) |
1112
- (map_page->mc_page_index << kMapPageIndexShift);
1113
- return MapWord(encoding);
1114
- }
1115
-
1116
-
1117
- Address MapWord::DecodeMapAddress(MapSpace* map_space) {
1118
- int map_page_index =
1119
- static_cast<int>((value_ & kMapPageIndexMask) >> kMapPageIndexShift);
1120
- ASSERT_MAP_PAGE_INDEX(map_page_index);
1121
-
1122
- int map_page_offset = static_cast<int>(
1123
- ((value_ & kMapPageOffsetMask) >> kMapPageOffsetShift) <<
1124
- kMapAlignmentBits);
1125
-
1126
- return (map_space->PageAddress(map_page_index) + map_page_offset);
1127
- }
1128
-
1129
-
1130
- int MapWord::DecodeOffset() {
1131
- // The offset field is represented in the kForwardingOffsetBits
1132
- // most-significant bits.
1133
- uintptr_t offset = (value_ >> kForwardingOffsetShift) << kObjectAlignmentBits;
1134
- ASSERT(offset < static_cast<uintptr_t>(Page::kObjectAreaSize));
1135
- return static_cast<int>(offset);
1136
- }
1137
-
1138
-
1139
- MapWord MapWord::FromEncodedAddress(Address address) {
1140
- return MapWord(reinterpret_cast<uintptr_t>(address));
1141
- }
1142
-
1143
-
1144
- Address MapWord::ToEncodedAddress() {
1145
- return reinterpret_cast<Address>(value_);
1146
- }
1147
-
1148
-
1149
- #ifdef DEBUG
1150
- void HeapObject::VerifyObjectField(int offset) {
1151
- VerifyPointer(READ_FIELD(this, offset));
1152
- }
1153
-
1154
- void HeapObject::VerifySmiField(int offset) {
1155
- ASSERT(READ_FIELD(this, offset)->IsSmi());
1156
- }
1157
- #endif
1158
-
1159
-
1160
- Heap* HeapObject::GetHeap() {
1161
- // During GC, the map pointer in HeapObject is used in various ways that
1162
- // prevent us from retrieving Heap from the map.
1163
- // Assert that we are not in GC, implement GC code in a way that it doesn't
1164
- // pull heap from the map.
1165
- ASSERT(HEAP->is_safe_to_read_maps());
1166
- return map()->heap();
1167
- }
1168
-
1169
-
1170
- Isolate* HeapObject::GetIsolate() {
1171
- return GetHeap()->isolate();
1172
- }
1173
-
1174
-
1175
- Map* HeapObject::map() {
1176
- return map_word().ToMap();
1177
- }
1178
-
1179
-
1180
- void HeapObject::set_map(Map* value) {
1181
- set_map_word(MapWord::FromMap(value));
1182
- }
1183
-
1184
-
1185
- MapWord HeapObject::map_word() {
1186
- return MapWord(reinterpret_cast<uintptr_t>(READ_FIELD(this, kMapOffset)));
1187
- }
1188
-
1189
-
1190
- void HeapObject::set_map_word(MapWord map_word) {
1191
- // WRITE_FIELD does not invoke write barrier, but there is no need
1192
- // here.
1193
- WRITE_FIELD(this, kMapOffset, reinterpret_cast<Object*>(map_word.value_));
1194
- }
1195
-
1196
-
1197
- HeapObject* HeapObject::FromAddress(Address address) {
1198
- ASSERT_TAG_ALIGNED(address);
1199
- return reinterpret_cast<HeapObject*>(address + kHeapObjectTag);
1200
- }
1201
-
1202
-
1203
- Address HeapObject::address() {
1204
- return reinterpret_cast<Address>(this) - kHeapObjectTag;
1205
- }
1206
-
1207
-
1208
- int HeapObject::Size() {
1209
- return SizeFromMap(map());
1210
- }
1211
-
1212
-
1213
- void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) {
1214
- v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)),
1215
- reinterpret_cast<Object**>(FIELD_ADDR(this, end)));
1216
- }
1217
-
1218
-
1219
- void HeapObject::IteratePointer(ObjectVisitor* v, int offset) {
1220
- v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset)));
1221
- }
1222
-
1223
-
1224
- bool HeapObject::IsMarked() {
1225
- return map_word().IsMarked();
1226
- }
1227
-
1228
-
1229
- void HeapObject::SetMark() {
1230
- ASSERT(!IsMarked());
1231
- MapWord first_word = map_word();
1232
- first_word.SetMark();
1233
- set_map_word(first_word);
1234
- }
1235
-
1236
-
1237
- void HeapObject::ClearMark() {
1238
- ASSERT(IsMarked());
1239
- MapWord first_word = map_word();
1240
- first_word.ClearMark();
1241
- set_map_word(first_word);
1242
- }
1243
-
1244
-
1245
- bool HeapObject::IsOverflowed() {
1246
- return map_word().IsOverflowed();
1247
- }
1248
-
1249
-
1250
- void HeapObject::SetOverflow() {
1251
- MapWord first_word = map_word();
1252
- first_word.SetOverflow();
1253
- set_map_word(first_word);
1254
- }
1255
-
1256
-
1257
- void HeapObject::ClearOverflow() {
1258
- ASSERT(IsOverflowed());
1259
- MapWord first_word = map_word();
1260
- first_word.ClearOverflow();
1261
- set_map_word(first_word);
1262
- }
1263
-
1264
-
1265
- double HeapNumber::value() {
1266
- return READ_DOUBLE_FIELD(this, kValueOffset);
1267
- }
1268
-
1269
-
1270
- void HeapNumber::set_value(double value) {
1271
- WRITE_DOUBLE_FIELD(this, kValueOffset, value);
1272
- }
1273
-
1274
-
1275
- int HeapNumber::get_exponent() {
1276
- return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >>
1277
- kExponentShift) - kExponentBias;
1278
- }
1279
-
1280
-
1281
- int HeapNumber::get_sign() {
1282
- return READ_INT_FIELD(this, kExponentOffset) & kSignMask;
1283
- }
1284
-
1285
-
1286
- ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset)
1287
-
1288
-
1289
- HeapObject* JSObject::elements() {
1290
- Object* array = READ_FIELD(this, kElementsOffset);
1291
- // In the assert below Dictionary is covered under FixedArray.
1292
- ASSERT(array->IsFixedArray() || array->IsExternalArray());
1293
- return reinterpret_cast<HeapObject*>(array);
1294
- }
1295
-
1296
-
1297
- void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) {
1298
- ASSERT(map()->has_fast_elements() ==
1299
- (value->map() == GetHeap()->fixed_array_map() ||
1300
- value->map() == GetHeap()->fixed_cow_array_map()));
1301
- // In the assert below Dictionary is covered under FixedArray.
1302
- ASSERT(value->IsFixedArray() || value->IsExternalArray());
1303
- WRITE_FIELD(this, kElementsOffset, value);
1304
- CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, mode);
1305
- }
1306
-
1307
-
1308
- void JSObject::initialize_properties() {
1309
- ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
1310
- WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array());
1311
- }
1312
-
1313
-
1314
- void JSObject::initialize_elements() {
1315
- ASSERT(map()->has_fast_elements());
1316
- ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
1317
- WRITE_FIELD(this, kElementsOffset, GetHeap()->empty_fixed_array());
1318
- }
1319
-
1320
-
1321
- MaybeObject* JSObject::ResetElements() {
1322
- Object* obj;
1323
- { MaybeObject* maybe_obj = map()->GetFastElementsMap();
1324
- if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1325
- }
1326
- set_map(Map::cast(obj));
1327
- initialize_elements();
1328
- return this;
1329
- }
1330
-
1331
-
1332
- ACCESSORS(Oddball, to_string, String, kToStringOffset)
1333
- ACCESSORS(Oddball, to_number, Object, kToNumberOffset)
1334
-
1335
-
1336
- byte Oddball::kind() {
1337
- return READ_BYTE_FIELD(this, kKindOffset);
1338
- }
1339
-
1340
-
1341
- void Oddball::set_kind(byte value) {
1342
- WRITE_BYTE_FIELD(this, kKindOffset, value);
1343
- }
1344
-
1345
-
1346
- Object* JSGlobalPropertyCell::value() {
1347
- return READ_FIELD(this, kValueOffset);
1348
- }
1349
-
1350
-
1351
- void JSGlobalPropertyCell::set_value(Object* val, WriteBarrierMode ignored) {
1352
- // The write barrier is not used for global property cells.
1353
- ASSERT(!val->IsJSGlobalPropertyCell());
1354
- WRITE_FIELD(this, kValueOffset, val);
1355
- }
1356
-
1357
-
1358
- int JSObject::GetHeaderSize() {
1359
- InstanceType type = map()->instance_type();
1360
- // Check for the most common kind of JavaScript object before
1361
- // falling into the generic switch. This speeds up the internal
1362
- // field operations considerably on average.
1363
- if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize;
1364
- switch (type) {
1365
- case JS_GLOBAL_PROXY_TYPE:
1366
- return JSGlobalProxy::kSize;
1367
- case JS_GLOBAL_OBJECT_TYPE:
1368
- return JSGlobalObject::kSize;
1369
- case JS_BUILTINS_OBJECT_TYPE:
1370
- return JSBuiltinsObject::kSize;
1371
- case JS_FUNCTION_TYPE:
1372
- return JSFunction::kSize;
1373
- case JS_VALUE_TYPE:
1374
- return JSValue::kSize;
1375
- case JS_ARRAY_TYPE:
1376
- return JSValue::kSize;
1377
- case JS_REGEXP_TYPE:
1378
- return JSValue::kSize;
1379
- case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1380
- return JSObject::kHeaderSize;
1381
- case JS_MESSAGE_OBJECT_TYPE:
1382
- return JSMessageObject::kSize;
1383
- default:
1384
- UNREACHABLE();
1385
- return 0;
1386
- }
1387
- }
1388
-
1389
-
1390
- int JSObject::GetInternalFieldCount() {
1391
- ASSERT(1 << kPointerSizeLog2 == kPointerSize);
1392
- // Make sure to adjust for the number of in-object properties. These
1393
- // properties do contribute to the size, but are not internal fields.
1394
- return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) -
1395
- map()->inobject_properties();
1396
- }
1397
-
1398
-
1399
- int JSObject::GetInternalFieldOffset(int index) {
1400
- ASSERT(index < GetInternalFieldCount() && index >= 0);
1401
- return GetHeaderSize() + (kPointerSize * index);
1402
- }
1403
-
1404
-
1405
- Object* JSObject::GetInternalField(int index) {
1406
- ASSERT(index < GetInternalFieldCount() && index >= 0);
1407
- // Internal objects do follow immediately after the header, whereas in-object
1408
- // properties are at the end of the object. Therefore there is no need
1409
- // to adjust the index here.
1410
- return READ_FIELD(this, GetHeaderSize() + (kPointerSize * index));
1411
- }
1412
-
1413
-
1414
- void JSObject::SetInternalField(int index, Object* value) {
1415
- ASSERT(index < GetInternalFieldCount() && index >= 0);
1416
- // Internal objects do follow immediately after the header, whereas in-object
1417
- // properties are at the end of the object. Therefore there is no need
1418
- // to adjust the index here.
1419
- int offset = GetHeaderSize() + (kPointerSize * index);
1420
- WRITE_FIELD(this, offset, value);
1421
- WRITE_BARRIER(this, offset);
1422
- }
1423
-
1424
-
1425
- // Access fast-case object properties at index. The use of these routines
1426
- // is needed to correctly distinguish between properties stored in-object and
1427
- // properties stored in the properties array.
1428
- Object* JSObject::FastPropertyAt(int index) {
1429
- // Adjust for the number of properties stored in the object.
1430
- index -= map()->inobject_properties();
1431
- if (index < 0) {
1432
- int offset = map()->instance_size() + (index * kPointerSize);
1433
- return READ_FIELD(this, offset);
1434
- } else {
1435
- ASSERT(index < properties()->length());
1436
- return properties()->get(index);
1437
- }
1438
- }
1439
-
1440
-
1441
- Object* JSObject::FastPropertyAtPut(int index, Object* value) {
1442
- // Adjust for the number of properties stored in the object.
1443
- index -= map()->inobject_properties();
1444
- if (index < 0) {
1445
- int offset = map()->instance_size() + (index * kPointerSize);
1446
- WRITE_FIELD(this, offset, value);
1447
- WRITE_BARRIER(this, offset);
1448
- } else {
1449
- ASSERT(index < properties()->length());
1450
- properties()->set(index, value);
1451
- }
1452
- return value;
1453
- }
1454
-
1455
-
1456
- int JSObject::GetInObjectPropertyOffset(int index) {
1457
- // Adjust for the number of properties stored in the object.
1458
- index -= map()->inobject_properties();
1459
- ASSERT(index < 0);
1460
- return map()->instance_size() + (index * kPointerSize);
1461
- }
1462
-
1463
-
1464
- Object* JSObject::InObjectPropertyAt(int index) {
1465
- // Adjust for the number of properties stored in the object.
1466
- index -= map()->inobject_properties();
1467
- ASSERT(index < 0);
1468
- int offset = map()->instance_size() + (index * kPointerSize);
1469
- return READ_FIELD(this, offset);
1470
- }
1471
-
1472
-
1473
- Object* JSObject::InObjectPropertyAtPut(int index,
1474
- Object* value,
1475
- WriteBarrierMode mode) {
1476
- // Adjust for the number of properties stored in the object.
1477
- index -= map()->inobject_properties();
1478
- ASSERT(index < 0);
1479
- int offset = map()->instance_size() + (index * kPointerSize);
1480
- WRITE_FIELD(this, offset, value);
1481
- CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, mode);
1482
- return value;
1483
- }
1484
-
1485
-
1486
-
1487
- void JSObject::InitializeBody(int object_size, Object* value) {
1488
- ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value));
1489
- for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
1490
- WRITE_FIELD(this, offset, value);
1491
- }
1492
- }
1493
-
1494
-
1495
- bool JSObject::HasFastProperties() {
1496
- return !properties()->IsDictionary();
1497
- }
1498
-
1499
-
1500
- int JSObject::MaxFastProperties() {
1501
- // Allow extra fast properties if the object has more than
1502
- // kMaxFastProperties in-object properties. When this is the case,
1503
- // it is very unlikely that the object is being used as a dictionary
1504
- // and there is a good chance that allowing more map transitions
1505
- // will be worth it.
1506
- return Max(map()->inobject_properties(), kMaxFastProperties);
1507
- }
1508
-
1509
-
1510
- void Struct::InitializeBody(int object_size) {
1511
- Object* value = GetHeap()->undefined_value();
1512
- for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
1513
- WRITE_FIELD(this, offset, value);
1514
- }
1515
- }
1516
-
1517
-
1518
- bool Object::ToArrayIndex(uint32_t* index) {
1519
- if (IsSmi()) {
1520
- int value = Smi::cast(this)->value();
1521
- if (value < 0) return false;
1522
- *index = value;
1523
- return true;
1524
- }
1525
- if (IsHeapNumber()) {
1526
- double value = HeapNumber::cast(this)->value();
1527
- uint32_t uint_value = static_cast<uint32_t>(value);
1528
- if (value == static_cast<double>(uint_value)) {
1529
- *index = uint_value;
1530
- return true;
1531
- }
1532
- }
1533
- return false;
1534
- }
1535
-
1536
-
1537
- bool Object::IsStringObjectWithCharacterAt(uint32_t index) {
1538
- if (!this->IsJSValue()) return false;
1539
-
1540
- JSValue* js_value = JSValue::cast(this);
1541
- if (!js_value->value()->IsString()) return false;
1542
-
1543
- String* str = String::cast(js_value->value());
1544
- if (index >= (uint32_t)str->length()) return false;
1545
-
1546
- return true;
1547
- }
1548
-
1549
-
1550
- Object* FixedArray::get(int index) {
1551
- ASSERT(index >= 0 && index < this->length());
1552
- return READ_FIELD(this, kHeaderSize + index * kPointerSize);
1553
- }
1554
-
1555
-
1556
- void FixedArray::set(int index, Smi* value) {
1557
- ASSERT(map() != HEAP->fixed_cow_array_map());
1558
- ASSERT(reinterpret_cast<Object*>(value)->IsSmi());
1559
- int offset = kHeaderSize + index * kPointerSize;
1560
- WRITE_FIELD(this, offset, value);
1561
- }
1562
-
1563
-
1564
- void FixedArray::set(int index, Object* value) {
1565
- ASSERT(map() != HEAP->fixed_cow_array_map());
1566
- ASSERT(index >= 0 && index < this->length());
1567
- int offset = kHeaderSize + index * kPointerSize;
1568
- WRITE_FIELD(this, offset, value);
1569
- WRITE_BARRIER(this, offset);
1570
- }
1571
-
1572
-
1573
- WriteBarrierMode HeapObject::GetWriteBarrierMode(const AssertNoAllocation&) {
1574
- if (GetHeap()->InNewSpace(this)) return SKIP_WRITE_BARRIER;
1575
- return UPDATE_WRITE_BARRIER;
1576
- }
1577
-
1578
-
1579
- void FixedArray::set(int index,
1580
- Object* value,
1581
- WriteBarrierMode mode) {
1582
- ASSERT(map() != HEAP->fixed_cow_array_map());
1583
- ASSERT(index >= 0 && index < this->length());
1584
- int offset = kHeaderSize + index * kPointerSize;
1585
- WRITE_FIELD(this, offset, value);
1586
- CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, mode);
1587
- }
1588
-
1589
-
1590
- void FixedArray::fast_set(FixedArray* array, int index, Object* value) {
1591
- ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map());
1592
- ASSERT(index >= 0 && index < array->length());
1593
- ASSERT(!HEAP->InNewSpace(value));
1594
- WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value);
1595
- }
1596
-
1597
-
1598
- void FixedArray::set_undefined(int index) {
1599
- ASSERT(map() != HEAP->fixed_cow_array_map());
1600
- set_undefined(GetHeap(), index);
1601
- }
1602
-
1603
-
1604
- void FixedArray::set_undefined(Heap* heap, int index) {
1605
- ASSERT(index >= 0 && index < this->length());
1606
- ASSERT(!heap->InNewSpace(heap->undefined_value()));
1607
- WRITE_FIELD(this, kHeaderSize + index * kPointerSize,
1608
- heap->undefined_value());
1609
- }
1610
-
1611
-
1612
- void FixedArray::set_null(int index) {
1613
- set_null(GetHeap(), index);
1614
- }
1615
-
1616
-
1617
- void FixedArray::set_null(Heap* heap, int index) {
1618
- ASSERT(index >= 0 && index < this->length());
1619
- ASSERT(!heap->InNewSpace(heap->null_value()));
1620
- WRITE_FIELD(this, kHeaderSize + index * kPointerSize, heap->null_value());
1621
- }
1622
-
1623
-
1624
- void FixedArray::set_the_hole(int index) {
1625
- ASSERT(map() != HEAP->fixed_cow_array_map());
1626
- ASSERT(index >= 0 && index < this->length());
1627
- ASSERT(!HEAP->InNewSpace(HEAP->the_hole_value()));
1628
- WRITE_FIELD(this,
1629
- kHeaderSize + index * kPointerSize,
1630
- GetHeap()->the_hole_value());
1631
- }
1632
-
1633
-
1634
- void FixedArray::set_unchecked(int index, Smi* value) {
1635
- ASSERT(reinterpret_cast<Object*>(value)->IsSmi());
1636
- int offset = kHeaderSize + index * kPointerSize;
1637
- WRITE_FIELD(this, offset, value);
1638
- }
1639
-
1640
-
1641
- void FixedArray::set_unchecked(Heap* heap,
1642
- int index,
1643
- Object* value,
1644
- WriteBarrierMode mode) {
1645
- int offset = kHeaderSize + index * kPointerSize;
1646
- WRITE_FIELD(this, offset, value);
1647
- CONDITIONAL_WRITE_BARRIER(heap, this, offset, mode);
1648
- }
1649
-
1650
-
1651
- void FixedArray::set_null_unchecked(Heap* heap, int index) {
1652
- ASSERT(index >= 0 && index < this->length());
1653
- ASSERT(!HEAP->InNewSpace(heap->null_value()));
1654
- WRITE_FIELD(this, kHeaderSize + index * kPointerSize, heap->null_value());
1655
- }
1656
-
1657
-
1658
- Object** FixedArray::data_start() {
1659
- return HeapObject::RawField(this, kHeaderSize);
1660
- }
1661
-
1662
-
1663
- bool DescriptorArray::IsEmpty() {
1664
- ASSERT(this->length() > kFirstIndex ||
1665
- this == HEAP->empty_descriptor_array());
1666
- return length() <= kFirstIndex;
1667
- }
1668
-
1669
-
1670
- void DescriptorArray::fast_swap(FixedArray* array, int first, int second) {
1671
- Object* tmp = array->get(first);
1672
- fast_set(array, first, array->get(second));
1673
- fast_set(array, second, tmp);
1674
- }
1675
-
1676
-
1677
- int DescriptorArray::Search(String* name) {
1678
- SLOW_ASSERT(IsSortedNoDuplicates());
1679
-
1680
- // Check for empty descriptor array.
1681
- int nof = number_of_descriptors();
1682
- if (nof == 0) return kNotFound;
1683
-
1684
- // Fast case: do linear search for small arrays.
1685
- const int kMaxElementsForLinearSearch = 8;
1686
- if (StringShape(name).IsSymbol() && nof < kMaxElementsForLinearSearch) {
1687
- return LinearSearch(name, nof);
1688
- }
1689
-
1690
- // Slow case: perform binary search.
1691
- return BinarySearch(name, 0, nof - 1);
1692
- }
1693
-
1694
-
1695
- int DescriptorArray::SearchWithCache(String* name) {
1696
- int number = GetIsolate()->descriptor_lookup_cache()->Lookup(this, name);
1697
- if (number == DescriptorLookupCache::kAbsent) {
1698
- number = Search(name);
1699
- GetIsolate()->descriptor_lookup_cache()->Update(this, name, number);
1700
- }
1701
- return number;
1702
- }
1703
-
1704
-
1705
- String* DescriptorArray::GetKey(int descriptor_number) {
1706
- ASSERT(descriptor_number < number_of_descriptors());
1707
- return String::cast(get(ToKeyIndex(descriptor_number)));
1708
- }
1709
-
1710
-
1711
- Object* DescriptorArray::GetValue(int descriptor_number) {
1712
- ASSERT(descriptor_number < number_of_descriptors());
1713
- return GetContentArray()->get(ToValueIndex(descriptor_number));
1714
- }
1715
-
1716
-
1717
- Smi* DescriptorArray::GetDetails(int descriptor_number) {
1718
- ASSERT(descriptor_number < number_of_descriptors());
1719
- return Smi::cast(GetContentArray()->get(ToDetailsIndex(descriptor_number)));
1720
- }
1721
-
1722
-
1723
- PropertyType DescriptorArray::GetType(int descriptor_number) {
1724
- ASSERT(descriptor_number < number_of_descriptors());
1725
- return PropertyDetails(GetDetails(descriptor_number)).type();
1726
- }
1727
-
1728
-
1729
- int DescriptorArray::GetFieldIndex(int descriptor_number) {
1730
- return Descriptor::IndexFromValue(GetValue(descriptor_number));
1731
- }
1732
-
1733
-
1734
- JSFunction* DescriptorArray::GetConstantFunction(int descriptor_number) {
1735
- return JSFunction::cast(GetValue(descriptor_number));
1736
- }
1737
-
1738
-
1739
- Object* DescriptorArray::GetCallbacksObject(int descriptor_number) {
1740
- ASSERT(GetType(descriptor_number) == CALLBACKS);
1741
- return GetValue(descriptor_number);
1742
- }
1743
-
1744
-
1745
- AccessorDescriptor* DescriptorArray::GetCallbacks(int descriptor_number) {
1746
- ASSERT(GetType(descriptor_number) == CALLBACKS);
1747
- Proxy* p = Proxy::cast(GetCallbacksObject(descriptor_number));
1748
- return reinterpret_cast<AccessorDescriptor*>(p->proxy());
1749
- }
1750
-
1751
-
1752
- bool DescriptorArray::IsProperty(int descriptor_number) {
1753
- return GetType(descriptor_number) < FIRST_PHANTOM_PROPERTY_TYPE;
1754
- }
1755
-
1756
-
1757
- bool DescriptorArray::IsTransition(int descriptor_number) {
1758
- PropertyType t = GetType(descriptor_number);
1759
- return t == MAP_TRANSITION || t == CONSTANT_TRANSITION ||
1760
- t == EXTERNAL_ARRAY_TRANSITION;
1761
- }
1762
-
1763
-
1764
- bool DescriptorArray::IsNullDescriptor(int descriptor_number) {
1765
- return GetType(descriptor_number) == NULL_DESCRIPTOR;
1766
- }
1767
-
1768
-
1769
- bool DescriptorArray::IsDontEnum(int descriptor_number) {
1770
- return PropertyDetails(GetDetails(descriptor_number)).IsDontEnum();
1771
- }
1772
-
1773
-
1774
- void DescriptorArray::Get(int descriptor_number, Descriptor* desc) {
1775
- desc->Init(GetKey(descriptor_number),
1776
- GetValue(descriptor_number),
1777
- GetDetails(descriptor_number));
1778
- }
1779
-
1780
-
1781
- void DescriptorArray::Set(int descriptor_number, Descriptor* desc) {
1782
- // Range check.
1783
- ASSERT(descriptor_number < number_of_descriptors());
1784
-
1785
- // Make sure none of the elements in desc are in new space.
1786
- ASSERT(!HEAP->InNewSpace(desc->GetKey()));
1787
- ASSERT(!HEAP->InNewSpace(desc->GetValue()));
1788
-
1789
- fast_set(this, ToKeyIndex(descriptor_number), desc->GetKey());
1790
- FixedArray* content_array = GetContentArray();
1791
- fast_set(content_array, ToValueIndex(descriptor_number), desc->GetValue());
1792
- fast_set(content_array, ToDetailsIndex(descriptor_number),
1793
- desc->GetDetails().AsSmi());
1794
- }
1795
-
1796
-
1797
- void DescriptorArray::CopyFrom(int index, DescriptorArray* src, int src_index) {
1798
- Descriptor desc;
1799
- src->Get(src_index, &desc);
1800
- Set(index, &desc);
1801
- }
1802
-
1803
-
1804
- void DescriptorArray::Swap(int first, int second) {
1805
- fast_swap(this, ToKeyIndex(first), ToKeyIndex(second));
1806
- FixedArray* content_array = GetContentArray();
1807
- fast_swap(content_array, ToValueIndex(first), ToValueIndex(second));
1808
- fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second));
1809
- }
1810
-
1811
-
1812
- template<typename Shape, typename Key>
1813
- int HashTable<Shape, Key>::FindEntry(Key key) {
1814
- return FindEntry(GetIsolate(), key);
1815
- }
1816
-
1817
-
1818
- // Find entry for key otherwise return kNotFound.
1819
- template<typename Shape, typename Key>
1820
- int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) {
1821
- uint32_t capacity = Capacity();
1822
- uint32_t entry = FirstProbe(Shape::Hash(key), capacity);
1823
- uint32_t count = 1;
1824
- // EnsureCapacity will guarantee the hash table is never full.
1825
- while (true) {
1826
- Object* element = KeyAt(entry);
1827
- if (element == isolate->heap()->undefined_value()) break; // Empty entry.
1828
- if (element != isolate->heap()->null_value() &&
1829
- Shape::IsMatch(key, element)) return entry;
1830
- entry = NextProbe(entry, count++, capacity);
1831
- }
1832
- return kNotFound;
1833
- }
1834
-
1835
-
1836
- bool NumberDictionary::requires_slow_elements() {
1837
- Object* max_index_object = get(kMaxNumberKeyIndex);
1838
- if (!max_index_object->IsSmi()) return false;
1839
- return 0 !=
1840
- (Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask);
1841
- }
1842
-
1843
- uint32_t NumberDictionary::max_number_key() {
1844
- ASSERT(!requires_slow_elements());
1845
- Object* max_index_object = get(kMaxNumberKeyIndex);
1846
- if (!max_index_object->IsSmi()) return 0;
1847
- uint32_t value = static_cast<uint32_t>(Smi::cast(max_index_object)->value());
1848
- return value >> kRequiresSlowElementsTagSize;
1849
- }
1850
-
1851
- void NumberDictionary::set_requires_slow_elements() {
1852
- set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask));
1853
- }
1854
-
1855
-
1856
- // ------------------------------------
1857
- // Cast operations
1858
-
1859
-
1860
- CAST_ACCESSOR(FixedArray)
1861
- CAST_ACCESSOR(DescriptorArray)
1862
- CAST_ACCESSOR(DeoptimizationInputData)
1863
- CAST_ACCESSOR(DeoptimizationOutputData)
1864
- CAST_ACCESSOR(SymbolTable)
1865
- CAST_ACCESSOR(JSFunctionResultCache)
1866
- CAST_ACCESSOR(NormalizedMapCache)
1867
- CAST_ACCESSOR(CompilationCacheTable)
1868
- CAST_ACCESSOR(CodeCacheHashTable)
1869
- CAST_ACCESSOR(MapCache)
1870
- CAST_ACCESSOR(String)
1871
- CAST_ACCESSOR(SeqString)
1872
- CAST_ACCESSOR(SeqAsciiString)
1873
- CAST_ACCESSOR(SeqTwoByteString)
1874
- CAST_ACCESSOR(ConsString)
1875
- CAST_ACCESSOR(ExternalString)
1876
- CAST_ACCESSOR(ExternalAsciiString)
1877
- CAST_ACCESSOR(ExternalTwoByteString)
1878
- CAST_ACCESSOR(JSObject)
1879
- CAST_ACCESSOR(Smi)
1880
- CAST_ACCESSOR(HeapObject)
1881
- CAST_ACCESSOR(HeapNumber)
1882
- CAST_ACCESSOR(Oddball)
1883
- CAST_ACCESSOR(JSGlobalPropertyCell)
1884
- CAST_ACCESSOR(SharedFunctionInfo)
1885
- CAST_ACCESSOR(Map)
1886
- CAST_ACCESSOR(JSFunction)
1887
- CAST_ACCESSOR(GlobalObject)
1888
- CAST_ACCESSOR(JSGlobalProxy)
1889
- CAST_ACCESSOR(JSGlobalObject)
1890
- CAST_ACCESSOR(JSBuiltinsObject)
1891
- CAST_ACCESSOR(Code)
1892
- CAST_ACCESSOR(JSArray)
1893
- CAST_ACCESSOR(JSRegExp)
1894
- CAST_ACCESSOR(Proxy)
1895
- CAST_ACCESSOR(ByteArray)
1896
- CAST_ACCESSOR(ExternalArray)
1897
- CAST_ACCESSOR(ExternalByteArray)
1898
- CAST_ACCESSOR(ExternalUnsignedByteArray)
1899
- CAST_ACCESSOR(ExternalShortArray)
1900
- CAST_ACCESSOR(ExternalUnsignedShortArray)
1901
- CAST_ACCESSOR(ExternalIntArray)
1902
- CAST_ACCESSOR(ExternalUnsignedIntArray)
1903
- CAST_ACCESSOR(ExternalFloatArray)
1904
- CAST_ACCESSOR(ExternalPixelArray)
1905
- CAST_ACCESSOR(Struct)
1906
-
1907
-
1908
- #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name)
1909
- STRUCT_LIST(MAKE_STRUCT_CAST)
1910
- #undef MAKE_STRUCT_CAST
1911
-
1912
-
1913
- template <typename Shape, typename Key>
1914
- HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) {
1915
- ASSERT(obj->IsHashTable());
1916
- return reinterpret_cast<HashTable*>(obj);
1917
- }
1918
-
1919
-
1920
- SMI_ACCESSORS(FixedArray, length, kLengthOffset)
1921
- SMI_ACCESSORS(ByteArray, length, kLengthOffset)
1922
-
1923
- INT_ACCESSORS(ExternalArray, length, kLengthOffset)
1924
-
1925
-
1926
- SMI_ACCESSORS(String, length, kLengthOffset)
1927
-
1928
-
1929
- uint32_t String::hash_field() {
1930
- return READ_UINT32_FIELD(this, kHashFieldOffset);
1931
- }
1932
-
1933
-
1934
- void String::set_hash_field(uint32_t value) {
1935
- WRITE_UINT32_FIELD(this, kHashFieldOffset, value);
1936
- #if V8_HOST_ARCH_64_BIT
1937
- WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0);
1938
- #endif
1939
- }
1940
-
1941
-
1942
- bool String::Equals(String* other) {
1943
- if (other == this) return true;
1944
- if (StringShape(this).IsSymbol() && StringShape(other).IsSymbol()) {
1945
- return false;
1946
- }
1947
- return SlowEquals(other);
1948
- }
1949
-
1950
-
1951
- MaybeObject* String::TryFlatten(PretenureFlag pretenure) {
1952
- if (!StringShape(this).IsCons()) return this;
1953
- ConsString* cons = ConsString::cast(this);
1954
- if (cons->second()->length() == 0) return cons->first();
1955
- return SlowTryFlatten(pretenure);
1956
- }
1957
-
1958
-
1959
- String* String::TryFlattenGetString(PretenureFlag pretenure) {
1960
- MaybeObject* flat = TryFlatten(pretenure);
1961
- Object* successfully_flattened;
1962
- if (flat->ToObject(&successfully_flattened)) {
1963
- return String::cast(successfully_flattened);
1964
- }
1965
- return this;
1966
- }
1967
-
1968
-
1969
- uint16_t String::Get(int index) {
1970
- ASSERT(index >= 0 && index < length());
1971
- switch (StringShape(this).full_representation_tag()) {
1972
- case kSeqStringTag | kAsciiStringTag:
1973
- return SeqAsciiString::cast(this)->SeqAsciiStringGet(index);
1974
- case kSeqStringTag | kTwoByteStringTag:
1975
- return SeqTwoByteString::cast(this)->SeqTwoByteStringGet(index);
1976
- case kConsStringTag | kAsciiStringTag:
1977
- case kConsStringTag | kTwoByteStringTag:
1978
- return ConsString::cast(this)->ConsStringGet(index);
1979
- case kExternalStringTag | kAsciiStringTag:
1980
- return ExternalAsciiString::cast(this)->ExternalAsciiStringGet(index);
1981
- case kExternalStringTag | kTwoByteStringTag:
1982
- return ExternalTwoByteString::cast(this)->ExternalTwoByteStringGet(index);
1983
- default:
1984
- break;
1985
- }
1986
-
1987
- UNREACHABLE();
1988
- return 0;
1989
- }
1990
-
1991
-
1992
- void String::Set(int index, uint16_t value) {
1993
- ASSERT(index >= 0 && index < length());
1994
- ASSERT(StringShape(this).IsSequential());
1995
-
1996
- return this->IsAsciiRepresentation()
1997
- ? SeqAsciiString::cast(this)->SeqAsciiStringSet(index, value)
1998
- : SeqTwoByteString::cast(this)->SeqTwoByteStringSet(index, value);
1999
- }
2000
-
2001
-
2002
- bool String::IsFlat() {
2003
- switch (StringShape(this).representation_tag()) {
2004
- case kConsStringTag: {
2005
- String* second = ConsString::cast(this)->second();
2006
- // Only flattened strings have second part empty.
2007
- return second->length() == 0;
2008
- }
2009
- default:
2010
- return true;
2011
- }
2012
- }
2013
-
2014
-
2015
- uint16_t SeqAsciiString::SeqAsciiStringGet(int index) {
2016
- ASSERT(index >= 0 && index < length());
2017
- return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
2018
- }
2019
-
2020
-
2021
- void SeqAsciiString::SeqAsciiStringSet(int index, uint16_t value) {
2022
- ASSERT(index >= 0 && index < length() && value <= kMaxAsciiCharCode);
2023
- WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize,
2024
- static_cast<byte>(value));
2025
- }
2026
-
2027
-
2028
- Address SeqAsciiString::GetCharsAddress() {
2029
- return FIELD_ADDR(this, kHeaderSize);
2030
- }
2031
-
2032
-
2033
- char* SeqAsciiString::GetChars() {
2034
- return reinterpret_cast<char*>(GetCharsAddress());
2035
- }
2036
-
2037
-
2038
- Address SeqTwoByteString::GetCharsAddress() {
2039
- return FIELD_ADDR(this, kHeaderSize);
2040
- }
2041
-
2042
-
2043
- uc16* SeqTwoByteString::GetChars() {
2044
- return reinterpret_cast<uc16*>(FIELD_ADDR(this, kHeaderSize));
2045
- }
2046
-
2047
-
2048
- uint16_t SeqTwoByteString::SeqTwoByteStringGet(int index) {
2049
- ASSERT(index >= 0 && index < length());
2050
- return READ_SHORT_FIELD(this, kHeaderSize + index * kShortSize);
2051
- }
2052
-
2053
-
2054
- void SeqTwoByteString::SeqTwoByteStringSet(int index, uint16_t value) {
2055
- ASSERT(index >= 0 && index < length());
2056
- WRITE_SHORT_FIELD(this, kHeaderSize + index * kShortSize, value);
2057
- }
2058
-
2059
-
2060
- int SeqTwoByteString::SeqTwoByteStringSize(InstanceType instance_type) {
2061
- return SizeFor(length());
2062
- }
2063
-
2064
-
2065
- int SeqAsciiString::SeqAsciiStringSize(InstanceType instance_type) {
2066
- return SizeFor(length());
2067
- }
2068
-
2069
-
2070
- String* ConsString::first() {
2071
- return String::cast(READ_FIELD(this, kFirstOffset));
2072
- }
2073
-
2074
-
2075
- Object* ConsString::unchecked_first() {
2076
- return READ_FIELD(this, kFirstOffset);
2077
- }
2078
-
2079
-
2080
- void ConsString::set_first(String* value, WriteBarrierMode mode) {
2081
- WRITE_FIELD(this, kFirstOffset, value);
2082
- CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kFirstOffset, mode);
2083
- }
2084
-
2085
-
2086
- String* ConsString::second() {
2087
- return String::cast(READ_FIELD(this, kSecondOffset));
2088
- }
2089
-
2090
-
2091
- Object* ConsString::unchecked_second() {
2092
- return READ_FIELD(this, kSecondOffset);
2093
- }
2094
-
2095
-
2096
- void ConsString::set_second(String* value, WriteBarrierMode mode) {
2097
- WRITE_FIELD(this, kSecondOffset, value);
2098
- CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kSecondOffset, mode);
2099
- }
2100
-
2101
-
2102
- ExternalAsciiString::Resource* ExternalAsciiString::resource() {
2103
- return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
2104
- }
2105
-
2106
-
2107
- void ExternalAsciiString::set_resource(
2108
- ExternalAsciiString::Resource* resource) {
2109
- *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)) = resource;
2110
- }
2111
-
2112
-
2113
- ExternalTwoByteString::Resource* ExternalTwoByteString::resource() {
2114
- return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
2115
- }
2116
-
2117
-
2118
- void ExternalTwoByteString::set_resource(
2119
- ExternalTwoByteString::Resource* resource) {
2120
- *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)) = resource;
2121
- }
2122
-
2123
-
2124
- void JSFunctionResultCache::MakeZeroSize() {
2125
- set_finger_index(kEntriesIndex);
2126
- set_size(kEntriesIndex);
2127
- }
2128
-
2129
-
2130
- void JSFunctionResultCache::Clear() {
2131
- int cache_size = size();
2132
- Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex));
2133
- MemsetPointer(entries_start,
2134
- GetHeap()->the_hole_value(),
2135
- cache_size - kEntriesIndex);
2136
- MakeZeroSize();
2137
- }
2138
-
2139
-
2140
- int JSFunctionResultCache::size() {
2141
- return Smi::cast(get(kCacheSizeIndex))->value();
2142
- }
2143
-
2144
-
2145
- void JSFunctionResultCache::set_size(int size) {
2146
- set(kCacheSizeIndex, Smi::FromInt(size));
2147
- }
2148
-
2149
-
2150
- int JSFunctionResultCache::finger_index() {
2151
- return Smi::cast(get(kFingerIndex))->value();
2152
- }
2153
-
2154
-
2155
- void JSFunctionResultCache::set_finger_index(int finger_index) {
2156
- set(kFingerIndex, Smi::FromInt(finger_index));
2157
- }
2158
-
2159
-
2160
- byte ByteArray::get(int index) {
2161
- ASSERT(index >= 0 && index < this->length());
2162
- return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
2163
- }
2164
-
2165
-
2166
- void ByteArray::set(int index, byte value) {
2167
- ASSERT(index >= 0 && index < this->length());
2168
- WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value);
2169
- }
2170
-
2171
-
2172
- int ByteArray::get_int(int index) {
2173
- ASSERT(index >= 0 && (index * kIntSize) < this->length());
2174
- return READ_INT_FIELD(this, kHeaderSize + index * kIntSize);
2175
- }
2176
-
2177
-
2178
- ByteArray* ByteArray::FromDataStartAddress(Address address) {
2179
- ASSERT_TAG_ALIGNED(address);
2180
- return reinterpret_cast<ByteArray*>(address - kHeaderSize + kHeapObjectTag);
2181
- }
2182
-
2183
-
2184
- Address ByteArray::GetDataStartAddress() {
2185
- return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize;
2186
- }
2187
-
2188
-
2189
- uint8_t* ExternalPixelArray::external_pixel_pointer() {
2190
- return reinterpret_cast<uint8_t*>(external_pointer());
2191
- }
2192
-
2193
-
2194
- uint8_t ExternalPixelArray::get(int index) {
2195
- ASSERT((index >= 0) && (index < this->length()));
2196
- uint8_t* ptr = external_pixel_pointer();
2197
- return ptr[index];
2198
- }
2199
-
2200
-
2201
- void ExternalPixelArray::set(int index, uint8_t value) {
2202
- ASSERT((index >= 0) && (index < this->length()));
2203
- uint8_t* ptr = external_pixel_pointer();
2204
- ptr[index] = value;
2205
- }
2206
-
2207
-
2208
- void* ExternalArray::external_pointer() {
2209
- intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset);
2210
- return reinterpret_cast<void*>(ptr);
2211
- }
2212
-
2213
-
2214
- void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) {
2215
- intptr_t ptr = reinterpret_cast<intptr_t>(value);
2216
- WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr);
2217
- }
2218
-
2219
-
2220
- int8_t ExternalByteArray::get(int index) {
2221
- ASSERT((index >= 0) && (index < this->length()));
2222
- int8_t* ptr = static_cast<int8_t*>(external_pointer());
2223
- return ptr[index];
2224
- }
2225
-
2226
-
2227
- void ExternalByteArray::set(int index, int8_t value) {
2228
- ASSERT((index >= 0) && (index < this->length()));
2229
- int8_t* ptr = static_cast<int8_t*>(external_pointer());
2230
- ptr[index] = value;
2231
- }
2232
-
2233
-
2234
- uint8_t ExternalUnsignedByteArray::get(int index) {
2235
- ASSERT((index >= 0) && (index < this->length()));
2236
- uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
2237
- return ptr[index];
2238
- }
2239
-
2240
-
2241
- void ExternalUnsignedByteArray::set(int index, uint8_t value) {
2242
- ASSERT((index >= 0) && (index < this->length()));
2243
- uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
2244
- ptr[index] = value;
2245
- }
2246
-
2247
-
2248
- int16_t ExternalShortArray::get(int index) {
2249
- ASSERT((index >= 0) && (index < this->length()));
2250
- int16_t* ptr = static_cast<int16_t*>(external_pointer());
2251
- return ptr[index];
2252
- }
2253
-
2254
-
2255
- void ExternalShortArray::set(int index, int16_t value) {
2256
- ASSERT((index >= 0) && (index < this->length()));
2257
- int16_t* ptr = static_cast<int16_t*>(external_pointer());
2258
- ptr[index] = value;
2259
- }
2260
-
2261
-
2262
- uint16_t ExternalUnsignedShortArray::get(int index) {
2263
- ASSERT((index >= 0) && (index < this->length()));
2264
- uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
2265
- return ptr[index];
2266
- }
2267
-
2268
-
2269
- void ExternalUnsignedShortArray::set(int index, uint16_t value) {
2270
- ASSERT((index >= 0) && (index < this->length()));
2271
- uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
2272
- ptr[index] = value;
2273
- }
2274
-
2275
-
2276
- int32_t ExternalIntArray::get(int index) {
2277
- ASSERT((index >= 0) && (index < this->length()));
2278
- int32_t* ptr = static_cast<int32_t*>(external_pointer());
2279
- return ptr[index];
2280
- }
2281
-
2282
-
2283
- void ExternalIntArray::set(int index, int32_t value) {
2284
- ASSERT((index >= 0) && (index < this->length()));
2285
- int32_t* ptr = static_cast<int32_t*>(external_pointer());
2286
- ptr[index] = value;
2287
- }
2288
-
2289
-
2290
- uint32_t ExternalUnsignedIntArray::get(int index) {
2291
- ASSERT((index >= 0) && (index < this->length()));
2292
- uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
2293
- return ptr[index];
2294
- }
2295
-
2296
-
2297
- void ExternalUnsignedIntArray::set(int index, uint32_t value) {
2298
- ASSERT((index >= 0) && (index < this->length()));
2299
- uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
2300
- ptr[index] = value;
2301
- }
2302
-
2303
-
2304
- float ExternalFloatArray::get(int index) {
2305
- ASSERT((index >= 0) && (index < this->length()));
2306
- float* ptr = static_cast<float*>(external_pointer());
2307
- return ptr[index];
2308
- }
2309
-
2310
-
2311
- void ExternalFloatArray::set(int index, float value) {
2312
- ASSERT((index >= 0) && (index < this->length()));
2313
- float* ptr = static_cast<float*>(external_pointer());
2314
- ptr[index] = value;
2315
- }
2316
-
2317
-
2318
- int Map::visitor_id() {
2319
- return READ_BYTE_FIELD(this, kVisitorIdOffset);
2320
- }
2321
-
2322
-
2323
- void Map::set_visitor_id(int id) {
2324
- ASSERT(0 <= id && id < 256);
2325
- WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id));
2326
- }
2327
-
2328
-
2329
- int Map::instance_size() {
2330
- return READ_BYTE_FIELD(this, kInstanceSizeOffset) << kPointerSizeLog2;
2331
- }
2332
-
2333
-
2334
- int Map::inobject_properties() {
2335
- return READ_BYTE_FIELD(this, kInObjectPropertiesOffset);
2336
- }
2337
-
2338
-
2339
- int Map::pre_allocated_property_fields() {
2340
- return READ_BYTE_FIELD(this, kPreAllocatedPropertyFieldsOffset);
2341
- }
2342
-
2343
-
2344
- int HeapObject::SizeFromMap(Map* map) {
2345
- int instance_size = map->instance_size();
2346
- if (instance_size != kVariableSizeSentinel) return instance_size;
2347
- // We can ignore the "symbol" bit becase it is only set for symbols
2348
- // and implies a string type.
2349
- int instance_type = static_cast<int>(map->instance_type()) & ~kIsSymbolMask;
2350
- // Only inline the most frequent cases.
2351
- if (instance_type == FIXED_ARRAY_TYPE) {
2352
- return FixedArray::BodyDescriptor::SizeOf(map, this);
2353
- }
2354
- if (instance_type == ASCII_STRING_TYPE) {
2355
- return SeqAsciiString::SizeFor(
2356
- reinterpret_cast<SeqAsciiString*>(this)->length());
2357
- }
2358
- if (instance_type == BYTE_ARRAY_TYPE) {
2359
- return reinterpret_cast<ByteArray*>(this)->ByteArraySize();
2360
- }
2361
- if (instance_type == STRING_TYPE) {
2362
- return SeqTwoByteString::SizeFor(
2363
- reinterpret_cast<SeqTwoByteString*>(this)->length());
2364
- }
2365
- ASSERT(instance_type == CODE_TYPE);
2366
- return reinterpret_cast<Code*>(this)->CodeSize();
2367
- }
2368
-
2369
-
2370
- void Map::set_instance_size(int value) {
2371
- ASSERT_EQ(0, value & (kPointerSize - 1));
2372
- value >>= kPointerSizeLog2;
2373
- ASSERT(0 <= value && value < 256);
2374
- WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value));
2375
- }
2376
-
2377
-
2378
- void Map::set_inobject_properties(int value) {
2379
- ASSERT(0 <= value && value < 256);
2380
- WRITE_BYTE_FIELD(this, kInObjectPropertiesOffset, static_cast<byte>(value));
2381
- }
2382
-
2383
-
2384
- void Map::set_pre_allocated_property_fields(int value) {
2385
- ASSERT(0 <= value && value < 256);
2386
- WRITE_BYTE_FIELD(this,
2387
- kPreAllocatedPropertyFieldsOffset,
2388
- static_cast<byte>(value));
2389
- }
2390
-
2391
-
2392
- InstanceType Map::instance_type() {
2393
- return static_cast<InstanceType>(READ_BYTE_FIELD(this, kInstanceTypeOffset));
2394
- }
2395
-
2396
-
2397
- void Map::set_instance_type(InstanceType value) {
2398
- WRITE_BYTE_FIELD(this, kInstanceTypeOffset, value);
2399
- }
2400
-
2401
-
2402
- int Map::unused_property_fields() {
2403
- return READ_BYTE_FIELD(this, kUnusedPropertyFieldsOffset);
2404
- }
2405
-
2406
-
2407
- void Map::set_unused_property_fields(int value) {
2408
- WRITE_BYTE_FIELD(this, kUnusedPropertyFieldsOffset, Min(value, 255));
2409
- }
2410
-
2411
-
2412
- byte Map::bit_field() {
2413
- return READ_BYTE_FIELD(this, kBitFieldOffset);
2414
- }
2415
-
2416
-
2417
- void Map::set_bit_field(byte value) {
2418
- WRITE_BYTE_FIELD(this, kBitFieldOffset, value);
2419
- }
2420
-
2421
-
2422
- byte Map::bit_field2() {
2423
- return READ_BYTE_FIELD(this, kBitField2Offset);
2424
- }
2425
-
2426
-
2427
- void Map::set_bit_field2(byte value) {
2428
- WRITE_BYTE_FIELD(this, kBitField2Offset, value);
2429
- }
2430
-
2431
-
2432
- void Map::set_non_instance_prototype(bool value) {
2433
- if (value) {
2434
- set_bit_field(bit_field() | (1 << kHasNonInstancePrototype));
2435
- } else {
2436
- set_bit_field(bit_field() & ~(1 << kHasNonInstancePrototype));
2437
- }
2438
- }
2439
-
2440
-
2441
- bool Map::has_non_instance_prototype() {
2442
- return ((1 << kHasNonInstancePrototype) & bit_field()) != 0;
2443
- }
2444
-
2445
-
2446
- void Map::set_function_with_prototype(bool value) {
2447
- if (value) {
2448
- set_bit_field2(bit_field2() | (1 << kFunctionWithPrototype));
2449
- } else {
2450
- set_bit_field2(bit_field2() & ~(1 << kFunctionWithPrototype));
2451
- }
2452
- }
2453
-
2454
-
2455
- bool Map::function_with_prototype() {
2456
- return ((1 << kFunctionWithPrototype) & bit_field2()) != 0;
2457
- }
2458
-
2459
-
2460
- void Map::set_is_access_check_needed(bool access_check_needed) {
2461
- if (access_check_needed) {
2462
- set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded));
2463
- } else {
2464
- set_bit_field(bit_field() & ~(1 << kIsAccessCheckNeeded));
2465
- }
2466
- }
2467
-
2468
-
2469
- bool Map::is_access_check_needed() {
2470
- return ((1 << kIsAccessCheckNeeded) & bit_field()) != 0;
2471
- }
2472
-
2473
-
2474
- void Map::set_is_extensible(bool value) {
2475
- if (value) {
2476
- set_bit_field2(bit_field2() | (1 << kIsExtensible));
2477
- } else {
2478
- set_bit_field2(bit_field2() & ~(1 << kIsExtensible));
2479
- }
2480
- }
2481
-
2482
- bool Map::is_extensible() {
2483
- return ((1 << kIsExtensible) & bit_field2()) != 0;
2484
- }
2485
-
2486
-
2487
- void Map::set_attached_to_shared_function_info(bool value) {
2488
- if (value) {
2489
- set_bit_field2(bit_field2() | (1 << kAttachedToSharedFunctionInfo));
2490
- } else {
2491
- set_bit_field2(bit_field2() & ~(1 << kAttachedToSharedFunctionInfo));
2492
- }
2493
- }
2494
-
2495
- bool Map::attached_to_shared_function_info() {
2496
- return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0;
2497
- }
2498
-
2499
-
2500
- void Map::set_is_shared(bool value) {
2501
- if (value) {
2502
- set_bit_field2(bit_field2() | (1 << kIsShared));
2503
- } else {
2504
- set_bit_field2(bit_field2() & ~(1 << kIsShared));
2505
- }
2506
- }
2507
-
2508
- bool Map::is_shared() {
2509
- return ((1 << kIsShared) & bit_field2()) != 0;
2510
- }
2511
-
2512
-
2513
- JSFunction* Map::unchecked_constructor() {
2514
- return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset));
2515
- }
2516
-
2517
-
2518
- Code::Flags Code::flags() {
2519
- return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset));
2520
- }
2521
-
2522
-
2523
- void Code::set_flags(Code::Flags flags) {
2524
- STATIC_ASSERT(Code::NUMBER_OF_KINDS <= (kFlagsKindMask >> kFlagsKindShift)+1);
2525
- // Make sure that all call stubs have an arguments count.
2526
- ASSERT((ExtractKindFromFlags(flags) != CALL_IC &&
2527
- ExtractKindFromFlags(flags) != KEYED_CALL_IC) ||
2528
- ExtractArgumentsCountFromFlags(flags) >= 0);
2529
- WRITE_INT_FIELD(this, kFlagsOffset, flags);
2530
- }
2531
-
2532
-
2533
- Code::Kind Code::kind() {
2534
- return ExtractKindFromFlags(flags());
2535
- }
2536
-
2537
-
2538
- InLoopFlag Code::ic_in_loop() {
2539
- return ExtractICInLoopFromFlags(flags());
2540
- }
2541
-
2542
-
2543
- InlineCacheState Code::ic_state() {
2544
- InlineCacheState result = ExtractICStateFromFlags(flags());
2545
- // Only allow uninitialized or debugger states for non-IC code
2546
- // objects. This is used in the debugger to determine whether or not
2547
- // a call to code object has been replaced with a debug break call.
2548
- ASSERT(is_inline_cache_stub() ||
2549
- result == UNINITIALIZED ||
2550
- result == DEBUG_BREAK ||
2551
- result == DEBUG_PREPARE_STEP_IN);
2552
- return result;
2553
- }
2554
-
2555
-
2556
- Code::ExtraICState Code::extra_ic_state() {
2557
- ASSERT(is_inline_cache_stub());
2558
- return ExtractExtraICStateFromFlags(flags());
2559
- }
2560
-
2561
-
2562
- PropertyType Code::type() {
2563
- ASSERT(ic_state() == MONOMORPHIC);
2564
- return ExtractTypeFromFlags(flags());
2565
- }
2566
-
2567
-
2568
- int Code::arguments_count() {
2569
- ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB);
2570
- return ExtractArgumentsCountFromFlags(flags());
2571
- }
2572
-
2573
-
2574
- int Code::major_key() {
2575
- ASSERT(kind() == STUB ||
2576
- kind() == BINARY_OP_IC ||
2577
- kind() == TYPE_RECORDING_BINARY_OP_IC ||
2578
- kind() == COMPARE_IC);
2579
- return READ_BYTE_FIELD(this, kStubMajorKeyOffset);
2580
- }
2581
-
2582
-
2583
- void Code::set_major_key(int major) {
2584
- ASSERT(kind() == STUB ||
2585
- kind() == BINARY_OP_IC ||
2586
- kind() == TYPE_RECORDING_BINARY_OP_IC ||
2587
- kind() == COMPARE_IC);
2588
- ASSERT(0 <= major && major < 256);
2589
- WRITE_BYTE_FIELD(this, kStubMajorKeyOffset, major);
2590
- }
2591
-
2592
-
2593
- bool Code::optimizable() {
2594
- ASSERT(kind() == FUNCTION);
2595
- return READ_BYTE_FIELD(this, kOptimizableOffset) == 1;
2596
- }
2597
-
2598
-
2599
- void Code::set_optimizable(bool value) {
2600
- ASSERT(kind() == FUNCTION);
2601
- WRITE_BYTE_FIELD(this, kOptimizableOffset, value ? 1 : 0);
2602
- }
2603
-
2604
-
2605
- bool Code::has_deoptimization_support() {
2606
- ASSERT(kind() == FUNCTION);
2607
- return READ_BYTE_FIELD(this, kHasDeoptimizationSupportOffset) == 1;
2608
- }
2609
-
2610
-
2611
- void Code::set_has_deoptimization_support(bool value) {
2612
- ASSERT(kind() == FUNCTION);
2613
- WRITE_BYTE_FIELD(this, kHasDeoptimizationSupportOffset, value ? 1 : 0);
2614
- }
2615
-
2616
-
2617
- int Code::allow_osr_at_loop_nesting_level() {
2618
- ASSERT(kind() == FUNCTION);
2619
- return READ_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset);
2620
- }
2621
-
2622
-
2623
- void Code::set_allow_osr_at_loop_nesting_level(int level) {
2624
- ASSERT(kind() == FUNCTION);
2625
- ASSERT(level >= 0 && level <= kMaxLoopNestingMarker);
2626
- WRITE_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset, level);
2627
- }
2628
-
2629
-
2630
- unsigned Code::stack_slots() {
2631
- ASSERT(kind() == OPTIMIZED_FUNCTION);
2632
- return READ_UINT32_FIELD(this, kStackSlotsOffset);
2633
- }
2634
-
2635
-
2636
- void Code::set_stack_slots(unsigned slots) {
2637
- ASSERT(kind() == OPTIMIZED_FUNCTION);
2638
- WRITE_UINT32_FIELD(this, kStackSlotsOffset, slots);
2639
- }
2640
-
2641
-
2642
- unsigned Code::safepoint_table_offset() {
2643
- ASSERT(kind() == OPTIMIZED_FUNCTION);
2644
- return READ_UINT32_FIELD(this, kSafepointTableOffsetOffset);
2645
- }
2646
-
2647
-
2648
- void Code::set_safepoint_table_offset(unsigned offset) {
2649
- ASSERT(kind() == OPTIMIZED_FUNCTION);
2650
- ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize)));
2651
- WRITE_UINT32_FIELD(this, kSafepointTableOffsetOffset, offset);
2652
- }
2653
-
2654
-
2655
- unsigned Code::stack_check_table_offset() {
2656
- ASSERT(kind() == FUNCTION);
2657
- return READ_UINT32_FIELD(this, kStackCheckTableOffsetOffset);
2658
- }
2659
-
2660
-
2661
- void Code::set_stack_check_table_offset(unsigned offset) {
2662
- ASSERT(kind() == FUNCTION);
2663
- ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize)));
2664
- WRITE_UINT32_FIELD(this, kStackCheckTableOffsetOffset, offset);
2665
- }
2666
-
2667
-
2668
- CheckType Code::check_type() {
2669
- ASSERT(is_call_stub() || is_keyed_call_stub());
2670
- byte type = READ_BYTE_FIELD(this, kCheckTypeOffset);
2671
- return static_cast<CheckType>(type);
2672
- }
2673
-
2674
-
2675
- void Code::set_check_type(CheckType value) {
2676
- ASSERT(is_call_stub() || is_keyed_call_stub());
2677
- WRITE_BYTE_FIELD(this, kCheckTypeOffset, value);
2678
- }
2679
-
2680
-
2681
- ExternalArrayType Code::external_array_type() {
2682
- ASSERT(is_external_array_load_stub() || is_external_array_store_stub());
2683
- byte type = READ_BYTE_FIELD(this, kExternalArrayTypeOffset);
2684
- return static_cast<ExternalArrayType>(type);
2685
- }
2686
-
2687
-
2688
- void Code::set_external_array_type(ExternalArrayType value) {
2689
- ASSERT(is_external_array_load_stub() || is_external_array_store_stub());
2690
- WRITE_BYTE_FIELD(this, kExternalArrayTypeOffset, value);
2691
- }
2692
-
2693
-
2694
- byte Code::binary_op_type() {
2695
- ASSERT(is_binary_op_stub());
2696
- return READ_BYTE_FIELD(this, kBinaryOpTypeOffset);
2697
- }
2698
-
2699
-
2700
- void Code::set_binary_op_type(byte value) {
2701
- ASSERT(is_binary_op_stub());
2702
- WRITE_BYTE_FIELD(this, kBinaryOpTypeOffset, value);
2703
- }
2704
-
2705
-
2706
- byte Code::type_recording_binary_op_type() {
2707
- ASSERT(is_type_recording_binary_op_stub());
2708
- return READ_BYTE_FIELD(this, kBinaryOpTypeOffset);
2709
- }
2710
-
2711
-
2712
- void Code::set_type_recording_binary_op_type(byte value) {
2713
- ASSERT(is_type_recording_binary_op_stub());
2714
- WRITE_BYTE_FIELD(this, kBinaryOpTypeOffset, value);
2715
- }
2716
-
2717
-
2718
- byte Code::type_recording_binary_op_result_type() {
2719
- ASSERT(is_type_recording_binary_op_stub());
2720
- return READ_BYTE_FIELD(this, kBinaryOpReturnTypeOffset);
2721
- }
2722
-
2723
-
2724
- void Code::set_type_recording_binary_op_result_type(byte value) {
2725
- ASSERT(is_type_recording_binary_op_stub());
2726
- WRITE_BYTE_FIELD(this, kBinaryOpReturnTypeOffset, value);
2727
- }
2728
-
2729
-
2730
- byte Code::compare_state() {
2731
- ASSERT(is_compare_ic_stub());
2732
- return READ_BYTE_FIELD(this, kCompareStateOffset);
2733
- }
2734
-
2735
-
2736
- void Code::set_compare_state(byte value) {
2737
- ASSERT(is_compare_ic_stub());
2738
- WRITE_BYTE_FIELD(this, kCompareStateOffset, value);
2739
- }
2740
-
2741
-
2742
- bool Code::is_inline_cache_stub() {
2743
- Kind kind = this->kind();
2744
- return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND;
2745
- }
2746
-
2747
-
2748
- Code::Flags Code::ComputeFlags(Kind kind,
2749
- InLoopFlag in_loop,
2750
- InlineCacheState ic_state,
2751
- ExtraICState extra_ic_state,
2752
- PropertyType type,
2753
- int argc,
2754
- InlineCacheHolderFlag holder) {
2755
- // Extra IC state is only allowed for monomorphic call IC stubs
2756
- // or for store IC stubs.
2757
- ASSERT(extra_ic_state == kNoExtraICState ||
2758
- (kind == CALL_IC && (ic_state == MONOMORPHIC ||
2759
- ic_state == MONOMORPHIC_PROTOTYPE_FAILURE)) ||
2760
- (kind == STORE_IC) ||
2761
- (kind == KEYED_STORE_IC));
2762
- // Compute the bit mask.
2763
- int bits = kind << kFlagsKindShift;
2764
- if (in_loop) bits |= kFlagsICInLoopMask;
2765
- bits |= ic_state << kFlagsICStateShift;
2766
- bits |= type << kFlagsTypeShift;
2767
- bits |= extra_ic_state << kFlagsExtraICStateShift;
2768
- bits |= argc << kFlagsArgumentsCountShift;
2769
- if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask;
2770
- // Cast to flags and validate result before returning it.
2771
- Flags result = static_cast<Flags>(bits);
2772
- ASSERT(ExtractKindFromFlags(result) == kind);
2773
- ASSERT(ExtractICStateFromFlags(result) == ic_state);
2774
- ASSERT(ExtractICInLoopFromFlags(result) == in_loop);
2775
- ASSERT(ExtractTypeFromFlags(result) == type);
2776
- ASSERT(ExtractExtraICStateFromFlags(result) == extra_ic_state);
2777
- ASSERT(ExtractArgumentsCountFromFlags(result) == argc);
2778
- return result;
2779
- }
2780
-
2781
-
2782
- Code::Flags Code::ComputeMonomorphicFlags(Kind kind,
2783
- PropertyType type,
2784
- ExtraICState extra_ic_state,
2785
- InlineCacheHolderFlag holder,
2786
- InLoopFlag in_loop,
2787
- int argc) {
2788
- return ComputeFlags(
2789
- kind, in_loop, MONOMORPHIC, extra_ic_state, type, argc, holder);
2790
- }
2791
-
2792
-
2793
- Code::Kind Code::ExtractKindFromFlags(Flags flags) {
2794
- int bits = (flags & kFlagsKindMask) >> kFlagsKindShift;
2795
- return static_cast<Kind>(bits);
2796
- }
2797
-
2798
-
2799
- InlineCacheState Code::ExtractICStateFromFlags(Flags flags) {
2800
- int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift;
2801
- return static_cast<InlineCacheState>(bits);
2802
- }
2803
-
2804
-
2805
- Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
2806
- int bits = (flags & kFlagsExtraICStateMask) >> kFlagsExtraICStateShift;
2807
- return static_cast<ExtraICState>(bits);
2808
- }
2809
-
2810
-
2811
- InLoopFlag Code::ExtractICInLoopFromFlags(Flags flags) {
2812
- int bits = (flags & kFlagsICInLoopMask);
2813
- return bits != 0 ? IN_LOOP : NOT_IN_LOOP;
2814
- }
2815
-
2816
-
2817
- PropertyType Code::ExtractTypeFromFlags(Flags flags) {
2818
- int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift;
2819
- return static_cast<PropertyType>(bits);
2820
- }
2821
-
2822
-
2823
- int Code::ExtractArgumentsCountFromFlags(Flags flags) {
2824
- return (flags & kFlagsArgumentsCountMask) >> kFlagsArgumentsCountShift;
2825
- }
2826
-
2827
-
2828
- InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) {
2829
- int bits = (flags & kFlagsCacheInPrototypeMapMask);
2830
- return bits != 0 ? PROTOTYPE_MAP : OWN_MAP;
2831
- }
2832
-
2833
-
2834
- Code::Flags Code::RemoveTypeFromFlags(Flags flags) {
2835
- int bits = flags & ~kFlagsTypeMask;
2836
- return static_cast<Flags>(bits);
2837
- }
2838
-
2839
-
2840
- Code* Code::GetCodeFromTargetAddress(Address address) {
2841
- HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize);
2842
- // GetCodeFromTargetAddress might be called when marking objects during mark
2843
- // sweep. reinterpret_cast is therefore used instead of the more appropriate
2844
- // Code::cast. Code::cast does not work when the object's map is
2845
- // marked.
2846
- Code* result = reinterpret_cast<Code*>(code);
2847
- return result;
2848
- }
2849
-
2850
-
2851
- Isolate* Map::isolate() {
2852
- return heap()->isolate();
2853
- }
2854
-
2855
-
2856
- Heap* Map::heap() {
2857
- // NOTE: address() helper is not used to save one instruction.
2858
- Heap* heap = Page::FromAddress(reinterpret_cast<Address>(this))->heap_;
2859
- ASSERT(heap != NULL);
2860
- ASSERT(heap->isolate() == Isolate::Current());
2861
- return heap;
2862
- }
2863
-
2864
-
2865
- Heap* Code::heap() {
2866
- // NOTE: address() helper is not used to save one instruction.
2867
- Heap* heap = Page::FromAddress(reinterpret_cast<Address>(this))->heap_;
2868
- ASSERT(heap != NULL);
2869
- ASSERT(heap->isolate() == Isolate::Current());
2870
- return heap;
2871
- }
2872
-
2873
-
2874
- Isolate* Code::isolate() {
2875
- return heap()->isolate();
2876
- }
2877
-
2878
-
2879
- Heap* JSGlobalPropertyCell::heap() {
2880
- // NOTE: address() helper is not used to save one instruction.
2881
- Heap* heap = Page::FromAddress(reinterpret_cast<Address>(this))->heap_;
2882
- ASSERT(heap != NULL);
2883
- ASSERT(heap->isolate() == Isolate::Current());
2884
- return heap;
2885
- }
2886
-
2887
-
2888
- Isolate* JSGlobalPropertyCell::isolate() {
2889
- return heap()->isolate();
2890
- }
2891
-
2892
-
2893
- Object* Code::GetObjectFromEntryAddress(Address location_of_address) {
2894
- return HeapObject::
2895
- FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize);
2896
- }
2897
-
2898
-
2899
- Object* Map::prototype() {
2900
- return READ_FIELD(this, kPrototypeOffset);
2901
- }
2902
-
2903
-
2904
- void Map::set_prototype(Object* value, WriteBarrierMode mode) {
2905
- ASSERT(value->IsNull() || value->IsJSObject());
2906
- WRITE_FIELD(this, kPrototypeOffset, value);
2907
- CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, mode);
2908
- }
2909
-
2910
-
2911
- MaybeObject* Map::GetFastElementsMap() {
2912
- if (has_fast_elements()) return this;
2913
- Object* obj;
2914
- { MaybeObject* maybe_obj = CopyDropTransitions();
2915
- if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2916
- }
2917
- Map* new_map = Map::cast(obj);
2918
- new_map->set_has_fast_elements(true);
2919
- isolate()->counters()->map_slow_to_fast_elements()->Increment();
2920
- return new_map;
2921
- }
2922
-
2923
-
2924
- MaybeObject* Map::GetSlowElementsMap() {
2925
- if (!has_fast_elements()) return this;
2926
- Object* obj;
2927
- { MaybeObject* maybe_obj = CopyDropTransitions();
2928
- if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2929
- }
2930
- Map* new_map = Map::cast(obj);
2931
- new_map->set_has_fast_elements(false);
2932
- isolate()->counters()->map_fast_to_slow_elements()->Increment();
2933
- return new_map;
2934
- }
2935
-
2936
-
2937
- ACCESSORS(Map, instance_descriptors, DescriptorArray,
2938
- kInstanceDescriptorsOffset)
2939
- ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
2940
- ACCESSORS(Map, constructor, Object, kConstructorOffset)
2941
-
2942
- ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
2943
- ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset)
2944
- ACCESSORS_GCSAFE(JSFunction, next_function_link, Object,
2945
- kNextFunctionLinkOffset)
2946
-
2947
- ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
2948
- ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
2949
- ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset)
2950
-
2951
- ACCESSORS(JSGlobalProxy, context, Object, kContextOffset)
2952
-
2953
- ACCESSORS(AccessorInfo, getter, Object, kGetterOffset)
2954
- ACCESSORS(AccessorInfo, setter, Object, kSetterOffset)
2955
- ACCESSORS(AccessorInfo, data, Object, kDataOffset)
2956
- ACCESSORS(AccessorInfo, name, Object, kNameOffset)
2957
- ACCESSORS(AccessorInfo, flag, Smi, kFlagOffset)
2958
-
2959
- ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset)
2960
- ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset)
2961
- ACCESSORS(AccessCheckInfo, data, Object, kDataOffset)
2962
-
2963
- ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset)
2964
- ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset)
2965
- ACCESSORS(InterceptorInfo, query, Object, kQueryOffset)
2966
- ACCESSORS(InterceptorInfo, deleter, Object, kDeleterOffset)
2967
- ACCESSORS(InterceptorInfo, enumerator, Object, kEnumeratorOffset)
2968
- ACCESSORS(InterceptorInfo, data, Object, kDataOffset)
2969
-
2970
- ACCESSORS(CallHandlerInfo, callback, Object, kCallbackOffset)
2971
- ACCESSORS(CallHandlerInfo, data, Object, kDataOffset)
2972
-
2973
- ACCESSORS(TemplateInfo, tag, Object, kTagOffset)
2974
- ACCESSORS(TemplateInfo, property_list, Object, kPropertyListOffset)
2975
-
2976
- ACCESSORS(FunctionTemplateInfo, serial_number, Object, kSerialNumberOffset)
2977
- ACCESSORS(FunctionTemplateInfo, call_code, Object, kCallCodeOffset)
2978
- ACCESSORS(FunctionTemplateInfo, property_accessors, Object,
2979
- kPropertyAccessorsOffset)
2980
- ACCESSORS(FunctionTemplateInfo, prototype_template, Object,
2981
- kPrototypeTemplateOffset)
2982
- ACCESSORS(FunctionTemplateInfo, parent_template, Object, kParentTemplateOffset)
2983
- ACCESSORS(FunctionTemplateInfo, named_property_handler, Object,
2984
- kNamedPropertyHandlerOffset)
2985
- ACCESSORS(FunctionTemplateInfo, indexed_property_handler, Object,
2986
- kIndexedPropertyHandlerOffset)
2987
- ACCESSORS(FunctionTemplateInfo, instance_template, Object,
2988
- kInstanceTemplateOffset)
2989
- ACCESSORS(FunctionTemplateInfo, class_name, Object, kClassNameOffset)
2990
- ACCESSORS(FunctionTemplateInfo, signature, Object, kSignatureOffset)
2991
- ACCESSORS(FunctionTemplateInfo, instance_call_handler, Object,
2992
- kInstanceCallHandlerOffset)
2993
- ACCESSORS(FunctionTemplateInfo, access_check_info, Object,
2994
- kAccessCheckInfoOffset)
2995
- ACCESSORS(FunctionTemplateInfo, flag, Smi, kFlagOffset)
2996
-
2997
- ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset)
2998
- ACCESSORS(ObjectTemplateInfo, internal_field_count, Object,
2999
- kInternalFieldCountOffset)
3000
-
3001
- ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset)
3002
- ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
3003
-
3004
- ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
3005
-
3006
- ACCESSORS(Script, source, Object, kSourceOffset)
3007
- ACCESSORS(Script, name, Object, kNameOffset)
3008
- ACCESSORS(Script, id, Object, kIdOffset)
3009
- ACCESSORS(Script, line_offset, Smi, kLineOffsetOffset)
3010
- ACCESSORS(Script, column_offset, Smi, kColumnOffsetOffset)
3011
- ACCESSORS(Script, data, Object, kDataOffset)
3012
- ACCESSORS(Script, context_data, Object, kContextOffset)
3013
- ACCESSORS(Script, wrapper, Proxy, kWrapperOffset)
3014
- ACCESSORS(Script, type, Smi, kTypeOffset)
3015
- ACCESSORS(Script, compilation_type, Smi, kCompilationTypeOffset)
3016
- ACCESSORS(Script, line_ends, Object, kLineEndsOffset)
3017
- ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset)
3018
- ACCESSORS(Script, eval_from_instructions_offset, Smi,
3019
- kEvalFrominstructionsOffsetOffset)
3020
-
3021
- #ifdef ENABLE_DEBUGGER_SUPPORT
3022
- ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex)
3023
- ACCESSORS(DebugInfo, original_code, Code, kOriginalCodeIndex)
3024
- ACCESSORS(DebugInfo, code, Code, kPatchedCodeIndex)
3025
- ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex)
3026
-
3027
- ACCESSORS(BreakPointInfo, code_position, Smi, kCodePositionIndex)
3028
- ACCESSORS(BreakPointInfo, source_position, Smi, kSourcePositionIndex)
3029
- ACCESSORS(BreakPointInfo, statement_position, Smi, kStatementPositionIndex)
3030
- ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
3031
- #endif
3032
-
3033
- ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
3034
- ACCESSORS_GCSAFE(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
3035
- ACCESSORS_GCSAFE(SharedFunctionInfo, initial_map, Object, kInitialMapOffset)
3036
- ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
3037
- kInstanceClassNameOffset)
3038
- ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset)
3039
- ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
3040
- ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
3041
- ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
3042
- ACCESSORS(SharedFunctionInfo, this_property_assignments, Object,
3043
- kThisPropertyAssignmentsOffset)
3044
-
3045
- BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype,
3046
- kHiddenPrototypeBit)
3047
- BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit)
3048
- BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check,
3049
- kNeedsAccessCheckBit)
3050
- BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression,
3051
- kIsExpressionBit)
3052
- BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel,
3053
- kIsTopLevelBit)
3054
- BOOL_GETTER(SharedFunctionInfo, compiler_hints,
3055
- has_only_simple_this_property_assignments,
3056
- kHasOnlySimpleThisPropertyAssignments)
3057
- BOOL_ACCESSORS(SharedFunctionInfo,
3058
- compiler_hints,
3059
- allows_lazy_compilation,
3060
- kAllowLazyCompilation)
3061
-
3062
-
3063
- #if V8_HOST_ARCH_32_BIT
3064
- SMI_ACCESSORS(SharedFunctionInfo, length, kLengthOffset)
3065
- SMI_ACCESSORS(SharedFunctionInfo, formal_parameter_count,
3066
- kFormalParameterCountOffset)
3067
- SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties,
3068
- kExpectedNofPropertiesOffset)
3069
- SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset)
3070
- SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type,
3071
- kStartPositionAndTypeOffset)
3072
- SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset)
3073
- SMI_ACCESSORS(SharedFunctionInfo, function_token_position,
3074
- kFunctionTokenPositionOffset)
3075
- SMI_ACCESSORS(SharedFunctionInfo, compiler_hints,
3076
- kCompilerHintsOffset)
3077
- SMI_ACCESSORS(SharedFunctionInfo, this_property_assignments_count,
3078
- kThisPropertyAssignmentsCountOffset)
3079
- SMI_ACCESSORS(SharedFunctionInfo, opt_count, kOptCountOffset)
3080
- #else
3081
-
3082
- #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \
3083
- STATIC_ASSERT(holder::offset % kPointerSize == 0); \
3084
- int holder::name() { \
3085
- int value = READ_INT_FIELD(this, offset); \
3086
- ASSERT(kHeapObjectTag == 1); \
3087
- ASSERT((value & kHeapObjectTag) == 0); \
3088
- return value >> 1; \
3089
- } \
3090
- void holder::set_##name(int value) { \
3091
- ASSERT(kHeapObjectTag == 1); \
3092
- ASSERT((value & 0xC0000000) == 0xC0000000 || \
3093
- (value & 0xC0000000) == 0x000000000); \
3094
- WRITE_INT_FIELD(this, \
3095
- offset, \
3096
- (value << 1) & ~kHeapObjectTag); \
3097
- }
3098
-
3099
- #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \
3100
- STATIC_ASSERT(holder::offset % kPointerSize == kIntSize); \
3101
- INT_ACCESSORS(holder, name, offset)
3102
-
3103
-
3104
- PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset)
3105
- PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
3106
- formal_parameter_count,
3107
- kFormalParameterCountOffset)
3108
-
3109
- PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
3110
- expected_nof_properties,
3111
- kExpectedNofPropertiesOffset)
3112
- PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, num_literals, kNumLiteralsOffset)
3113
-
3114
- PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, end_position, kEndPositionOffset)
3115
- PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
3116
- start_position_and_type,
3117
- kStartPositionAndTypeOffset)
3118
-
3119
- PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
3120
- function_token_position,
3121
- kFunctionTokenPositionOffset)
3122
- PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
3123
- compiler_hints,
3124
- kCompilerHintsOffset)
3125
-
3126
- PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
3127
- this_property_assignments_count,
3128
- kThisPropertyAssignmentsCountOffset)
3129
- PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, opt_count, kOptCountOffset)
3130
- #endif
3131
-
3132
-
3133
- int SharedFunctionInfo::construction_count() {
3134
- return READ_BYTE_FIELD(this, kConstructionCountOffset);
3135
- }
3136
-
3137
-
3138
- void SharedFunctionInfo::set_construction_count(int value) {
3139
- ASSERT(0 <= value && value < 256);
3140
- WRITE_BYTE_FIELD(this, kConstructionCountOffset, static_cast<byte>(value));
3141
- }
3142
-
3143
-
3144
- bool SharedFunctionInfo::live_objects_may_exist() {
3145
- return (compiler_hints() & (1 << kLiveObjectsMayExist)) != 0;
3146
- }
3147
-
3148
-
3149
- void SharedFunctionInfo::set_live_objects_may_exist(bool value) {
3150
- if (value) {
3151
- set_compiler_hints(compiler_hints() | (1 << kLiveObjectsMayExist));
3152
- } else {
3153
- set_compiler_hints(compiler_hints() & ~(1 << kLiveObjectsMayExist));
3154
- }
3155
- }
3156
-
3157
-
3158
- bool SharedFunctionInfo::IsInobjectSlackTrackingInProgress() {
3159
- return initial_map() != HEAP->undefined_value();
3160
- }
3161
-
3162
-
3163
- bool SharedFunctionInfo::optimization_disabled() {
3164
- return BooleanBit::get(compiler_hints(), kOptimizationDisabled);
3165
- }
3166
-
3167
-
3168
- void SharedFunctionInfo::set_optimization_disabled(bool disable) {
3169
- set_compiler_hints(BooleanBit::set(compiler_hints(),
3170
- kOptimizationDisabled,
3171
- disable));
3172
- // If disabling optimizations we reflect that in the code object so
3173
- // it will not be counted as optimizable code.
3174
- if ((code()->kind() == Code::FUNCTION) && disable) {
3175
- code()->set_optimizable(false);
3176
- }
3177
- }
3178
-
3179
-
3180
- bool SharedFunctionInfo::strict_mode() {
3181
- return BooleanBit::get(compiler_hints(), kStrictModeFunction);
3182
- }
3183
-
3184
-
3185
- void SharedFunctionInfo::set_strict_mode(bool value) {
3186
- set_compiler_hints(BooleanBit::set(compiler_hints(),
3187
- kStrictModeFunction,
3188
- value));
3189
- }
3190
-
3191
-
3192
- ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset)
3193
- ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset)
3194
-
3195
- bool Script::HasValidSource() {
3196
- Object* src = this->source();
3197
- if (!src->IsString()) return true;
3198
- String* src_str = String::cast(src);
3199
- if (!StringShape(src_str).IsExternal()) return true;
3200
- if (src_str->IsAsciiRepresentation()) {
3201
- return ExternalAsciiString::cast(src)->resource() != NULL;
3202
- } else if (src_str->IsTwoByteRepresentation()) {
3203
- return ExternalTwoByteString::cast(src)->resource() != NULL;
3204
- }
3205
- return true;
3206
- }
3207
-
3208
-
3209
- void SharedFunctionInfo::DontAdaptArguments() {
3210
- ASSERT(code()->kind() == Code::BUILTIN);
3211
- set_formal_parameter_count(kDontAdaptArgumentsSentinel);
3212
- }
3213
-
3214
-
3215
- int SharedFunctionInfo::start_position() {
3216
- return start_position_and_type() >> kStartPositionShift;
3217
- }
3218
-
3219
-
3220
- void SharedFunctionInfo::set_start_position(int start_position) {
3221
- set_start_position_and_type((start_position << kStartPositionShift)
3222
- | (start_position_and_type() & ~kStartPositionMask));
3223
- }
3224
-
3225
-
3226
- Code* SharedFunctionInfo::code() {
3227
- return Code::cast(READ_FIELD(this, kCodeOffset));
3228
- }
3229
-
3230
-
3231
- Code* SharedFunctionInfo::unchecked_code() {
3232
- return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset));
3233
- }
3234
-
3235
-
3236
- void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) {
3237
- WRITE_FIELD(this, kCodeOffset, value);
3238
- ASSERT(!Isolate::Current()->heap()->InNewSpace(value));
3239
- }
3240
-
3241
-
3242
- SerializedScopeInfo* SharedFunctionInfo::scope_info() {
3243
- return reinterpret_cast<SerializedScopeInfo*>(
3244
- READ_FIELD(this, kScopeInfoOffset));
3245
- }
3246
-
3247
-
3248
- void SharedFunctionInfo::set_scope_info(SerializedScopeInfo* value,
3249
- WriteBarrierMode mode) {
3250
- WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value));
3251
- CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kScopeInfoOffset, mode);
3252
- }
3253
-
3254
-
3255
- Smi* SharedFunctionInfo::deopt_counter() {
3256
- return reinterpret_cast<Smi*>(READ_FIELD(this, kDeoptCounterOffset));
3257
- }
3258
-
3259
-
3260
- void SharedFunctionInfo::set_deopt_counter(Smi* value) {
3261
- WRITE_FIELD(this, kDeoptCounterOffset, value);
3262
- }
3263
-
3264
-
3265
- bool SharedFunctionInfo::is_compiled() {
3266
- return code() !=
3267
- Isolate::Current()->builtins()->builtin(Builtins::kLazyCompile);
3268
- }
3269
-
3270
-
3271
- bool SharedFunctionInfo::IsApiFunction() {
3272
- return function_data()->IsFunctionTemplateInfo();
3273
- }
3274
-
3275
-
3276
- FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() {
3277
- ASSERT(IsApiFunction());
3278
- return FunctionTemplateInfo::cast(function_data());
3279
- }
3280
-
3281
-
3282
- bool SharedFunctionInfo::HasBuiltinFunctionId() {
3283
- return function_data()->IsSmi();
3284
- }
3285
-
3286
-
3287
- BuiltinFunctionId SharedFunctionInfo::builtin_function_id() {
3288
- ASSERT(HasBuiltinFunctionId());
3289
- return static_cast<BuiltinFunctionId>(Smi::cast(function_data())->value());
3290
- }
3291
-
3292
-
3293
- int SharedFunctionInfo::code_age() {
3294
- return (compiler_hints() >> kCodeAgeShift) & kCodeAgeMask;
3295
- }
3296
-
3297
-
3298
- void SharedFunctionInfo::set_code_age(int code_age) {
3299
- set_compiler_hints(compiler_hints() |
3300
- ((code_age & kCodeAgeMask) << kCodeAgeShift));
3301
- }
3302
-
3303
-
3304
- bool SharedFunctionInfo::has_deoptimization_support() {
3305
- Code* code = this->code();
3306
- return code->kind() == Code::FUNCTION && code->has_deoptimization_support();
3307
- }
3308
-
3309
-
3310
- bool JSFunction::IsBuiltin() {
3311
- return context()->global()->IsJSBuiltinsObject();
3312
- }
3313
-
3314
-
3315
- bool JSFunction::NeedsArgumentsAdaption() {
3316
- return shared()->formal_parameter_count() !=
3317
- SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3318
- }
3319
-
3320
-
3321
- bool JSFunction::IsOptimized() {
3322
- return code()->kind() == Code::OPTIMIZED_FUNCTION;
3323
- }
3324
-
3325
-
3326
- bool JSFunction::IsMarkedForLazyRecompilation() {
3327
- return code() == GetIsolate()->builtins()->builtin(Builtins::kLazyRecompile);
3328
- }
3329
-
3330
-
3331
- Code* JSFunction::code() {
3332
- return Code::cast(unchecked_code());
3333
- }
3334
-
3335
-
3336
- Code* JSFunction::unchecked_code() {
3337
- return reinterpret_cast<Code*>(
3338
- Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset)));
3339
- }
3340
-
3341
-
3342
- void JSFunction::set_code(Code* value) {
3343
- // Skip the write barrier because code is never in new space.
3344
- ASSERT(!HEAP->InNewSpace(value));
3345
- Address entry = value->entry();
3346
- WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry));
3347
- }
3348
-
3349
-
3350
- void JSFunction::ReplaceCode(Code* code) {
3351
- bool was_optimized = IsOptimized();
3352
- bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION;
3353
-
3354
- set_code(code);
3355
-
3356
- // Add/remove the function from the list of optimized functions for this
3357
- // context based on the state change.
3358
- if (!was_optimized && is_optimized) {
3359
- context()->global_context()->AddOptimizedFunction(this);
3360
- }
3361
- if (was_optimized && !is_optimized) {
3362
- context()->global_context()->RemoveOptimizedFunction(this);
3363
- }
3364
- }
3365
-
3366
-
3367
- Context* JSFunction::context() {
3368
- return Context::cast(READ_FIELD(this, kContextOffset));
3369
- }
3370
-
3371
-
3372
- Object* JSFunction::unchecked_context() {
3373
- return READ_FIELD(this, kContextOffset);
3374
- }
3375
-
3376
-
3377
- SharedFunctionInfo* JSFunction::unchecked_shared() {
3378
- return reinterpret_cast<SharedFunctionInfo*>(
3379
- READ_FIELD(this, kSharedFunctionInfoOffset));
3380
- }
3381
-
3382
-
3383
- void JSFunction::set_context(Object* value) {
3384
- ASSERT(value->IsUndefined() || value->IsContext());
3385
- WRITE_FIELD(this, kContextOffset, value);
3386
- WRITE_BARRIER(this, kContextOffset);
3387
- }
3388
-
3389
- ACCESSORS(JSFunction, prototype_or_initial_map, Object,
3390
- kPrototypeOrInitialMapOffset)
3391
-
3392
-
3393
- Map* JSFunction::initial_map() {
3394
- return Map::cast(prototype_or_initial_map());
3395
- }
3396
-
3397
-
3398
- void JSFunction::set_initial_map(Map* value) {
3399
- set_prototype_or_initial_map(value);
3400
- }
3401
-
3402
-
3403
- bool JSFunction::has_initial_map() {
3404
- return prototype_or_initial_map()->IsMap();
3405
- }
3406
-
3407
-
3408
- bool JSFunction::has_instance_prototype() {
3409
- return has_initial_map() || !prototype_or_initial_map()->IsTheHole();
3410
- }
3411
-
3412
-
3413
- bool JSFunction::has_prototype() {
3414
- return map()->has_non_instance_prototype() || has_instance_prototype();
3415
- }
3416
-
3417
-
3418
- Object* JSFunction::instance_prototype() {
3419
- ASSERT(has_instance_prototype());
3420
- if (has_initial_map()) return initial_map()->prototype();
3421
- // When there is no initial map and the prototype is a JSObject, the
3422
- // initial map field is used for the prototype field.
3423
- return prototype_or_initial_map();
3424
- }
3425
-
3426
-
3427
- Object* JSFunction::prototype() {
3428
- ASSERT(has_prototype());
3429
- // If the function's prototype property has been set to a non-JSObject
3430
- // value, that value is stored in the constructor field of the map.
3431
- if (map()->has_non_instance_prototype()) return map()->constructor();
3432
- return instance_prototype();
3433
- }
3434
-
3435
- bool JSFunction::should_have_prototype() {
3436
- return map()->function_with_prototype();
3437
- }
3438
-
3439
-
3440
- bool JSFunction::is_compiled() {
3441
- return code() != GetIsolate()->builtins()->builtin(Builtins::kLazyCompile);
3442
- }
3443
-
3444
-
3445
- int JSFunction::NumberOfLiterals() {
3446
- return literals()->length();
3447
- }
3448
-
3449
-
3450
- Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) {
3451
- ASSERT(id < kJSBuiltinsCount); // id is unsigned.
3452
- return READ_FIELD(this, OffsetOfFunctionWithId(id));
3453
- }
3454
-
3455
-
3456
- void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id,
3457
- Object* value) {
3458
- ASSERT(id < kJSBuiltinsCount); // id is unsigned.
3459
- WRITE_FIELD(this, OffsetOfFunctionWithId(id), value);
3460
- WRITE_BARRIER(this, OffsetOfFunctionWithId(id));
3461
- }
3462
-
3463
-
3464
- Code* JSBuiltinsObject::javascript_builtin_code(Builtins::JavaScript id) {
3465
- ASSERT(id < kJSBuiltinsCount); // id is unsigned.
3466
- return Code::cast(READ_FIELD(this, OffsetOfCodeWithId(id)));
3467
- }
3468
-
3469
-
3470
- void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id,
3471
- Code* value) {
3472
- ASSERT(id < kJSBuiltinsCount); // id is unsigned.
3473
- WRITE_FIELD(this, OffsetOfCodeWithId(id), value);
3474
- ASSERT(!HEAP->InNewSpace(value));
3475
- }
3476
-
3477
-
3478
- Address Proxy::proxy() {
3479
- return AddressFrom<Address>(READ_INTPTR_FIELD(this, kProxyOffset));
3480
- }
3481
-
3482
-
3483
- void Proxy::set_proxy(Address value) {
3484
- WRITE_INTPTR_FIELD(this, kProxyOffset, OffsetFrom(value));
3485
- }
3486
-
3487
-
3488
- ACCESSORS(JSValue, value, Object, kValueOffset)
3489
-
3490
-
3491
- JSValue* JSValue::cast(Object* obj) {
3492
- ASSERT(obj->IsJSValue());
3493
- ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize);
3494
- return reinterpret_cast<JSValue*>(obj);
3495
- }
3496
-
3497
-
3498
- ACCESSORS(JSMessageObject, type, String, kTypeOffset)
3499
- ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset)
3500
- ACCESSORS(JSMessageObject, script, Object, kScriptOffset)
3501
- ACCESSORS(JSMessageObject, stack_trace, Object, kStackTraceOffset)
3502
- ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset)
3503
- SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset)
3504
- SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset)
3505
-
3506
-
3507
- JSMessageObject* JSMessageObject::cast(Object* obj) {
3508
- ASSERT(obj->IsJSMessageObject());
3509
- ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize);
3510
- return reinterpret_cast<JSMessageObject*>(obj);
3511
- }
3512
-
3513
-
3514
- INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset)
3515
- ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
3516
- ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset)
3517
-
3518
-
3519
- byte* Code::instruction_start() {
3520
- return FIELD_ADDR(this, kHeaderSize);
3521
- }
3522
-
3523
-
3524
- byte* Code::instruction_end() {
3525
- return instruction_start() + instruction_size();
3526
- }
3527
-
3528
-
3529
- int Code::body_size() {
3530
- return RoundUp(instruction_size(), kObjectAlignment);
3531
- }
3532
-
3533
-
3534
- FixedArray* Code::unchecked_deoptimization_data() {
3535
- return reinterpret_cast<FixedArray*>(
3536
- READ_FIELD(this, kDeoptimizationDataOffset));
3537
- }
3538
-
3539
-
3540
- ByteArray* Code::unchecked_relocation_info() {
3541
- return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset));
3542
- }
3543
-
3544
-
3545
- byte* Code::relocation_start() {
3546
- return unchecked_relocation_info()->GetDataStartAddress();
3547
- }
3548
-
3549
-
3550
- int Code::relocation_size() {
3551
- return unchecked_relocation_info()->length();
3552
- }
3553
-
3554
-
3555
- byte* Code::entry() {
3556
- return instruction_start();
3557
- }
3558
-
3559
-
3560
- bool Code::contains(byte* pc) {
3561
- return (instruction_start() <= pc) &&
3562
- (pc <= instruction_start() + instruction_size());
3563
- }
3564
-
3565
-
3566
- ACCESSORS(JSArray, length, Object, kLengthOffset)
3567
-
3568
-
3569
- ACCESSORS(JSRegExp, data, Object, kDataOffset)
3570
-
3571
-
3572
- JSRegExp::Type JSRegExp::TypeTag() {
3573
- Object* data = this->data();
3574
- if (data->IsUndefined()) return JSRegExp::NOT_COMPILED;
3575
- Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex));
3576
- return static_cast<JSRegExp::Type>(smi->value());
3577
- }
3578
-
3579
-
3580
- int JSRegExp::CaptureCount() {
3581
- switch (TypeTag()) {
3582
- case ATOM:
3583
- return 0;
3584
- case IRREGEXP:
3585
- return Smi::cast(DataAt(kIrregexpCaptureCountIndex))->value();
3586
- default:
3587
- UNREACHABLE();
3588
- return -1;
3589
- }
3590
- }
3591
-
3592
-
3593
- JSRegExp::Flags JSRegExp::GetFlags() {
3594
- ASSERT(this->data()->IsFixedArray());
3595
- Object* data = this->data();
3596
- Smi* smi = Smi::cast(FixedArray::cast(data)->get(kFlagsIndex));
3597
- return Flags(smi->value());
3598
- }
3599
-
3600
-
3601
- String* JSRegExp::Pattern() {
3602
- ASSERT(this->data()->IsFixedArray());
3603
- Object* data = this->data();
3604
- String* pattern= String::cast(FixedArray::cast(data)->get(kSourceIndex));
3605
- return pattern;
3606
- }
3607
-
3608
-
3609
- Object* JSRegExp::DataAt(int index) {
3610
- ASSERT(TypeTag() != NOT_COMPILED);
3611
- return FixedArray::cast(data())->get(index);
3612
- }
3613
-
3614
-
3615
- void JSRegExp::SetDataAt(int index, Object* value) {
3616
- ASSERT(TypeTag() != NOT_COMPILED);
3617
- ASSERT(index >= kDataIndex); // Only implementation data can be set this way.
3618
- FixedArray::cast(data())->set(index, value);
3619
- }
3620
-
3621
-
3622
- JSObject::ElementsKind JSObject::GetElementsKind() {
3623
- if (map()->has_fast_elements()) {
3624
- ASSERT(elements()->map() == GetHeap()->fixed_array_map() ||
3625
- elements()->map() == GetHeap()->fixed_cow_array_map());
3626
- return FAST_ELEMENTS;
3627
- }
3628
- HeapObject* array = elements();
3629
- if (array->IsFixedArray()) {
3630
- // FAST_ELEMENTS or DICTIONARY_ELEMENTS are both stored in a
3631
- // FixedArray, but FAST_ELEMENTS is already handled above.
3632
- ASSERT(array->IsDictionary());
3633
- return DICTIONARY_ELEMENTS;
3634
- }
3635
- ASSERT(!map()->has_fast_elements());
3636
- if (array->IsExternalArray()) {
3637
- switch (array->map()->instance_type()) {
3638
- case EXTERNAL_BYTE_ARRAY_TYPE:
3639
- return EXTERNAL_BYTE_ELEMENTS;
3640
- case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
3641
- return EXTERNAL_UNSIGNED_BYTE_ELEMENTS;
3642
- case EXTERNAL_SHORT_ARRAY_TYPE:
3643
- return EXTERNAL_SHORT_ELEMENTS;
3644
- case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
3645
- return EXTERNAL_UNSIGNED_SHORT_ELEMENTS;
3646
- case EXTERNAL_INT_ARRAY_TYPE:
3647
- return EXTERNAL_INT_ELEMENTS;
3648
- case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
3649
- return EXTERNAL_UNSIGNED_INT_ELEMENTS;
3650
- case EXTERNAL_PIXEL_ARRAY_TYPE:
3651
- return EXTERNAL_PIXEL_ELEMENTS;
3652
- default:
3653
- break;
3654
- }
3655
- }
3656
- ASSERT(array->map()->instance_type() == EXTERNAL_FLOAT_ARRAY_TYPE);
3657
- return EXTERNAL_FLOAT_ELEMENTS;
3658
- }
3659
-
3660
-
3661
- bool JSObject::HasFastElements() {
3662
- return GetElementsKind() == FAST_ELEMENTS;
3663
- }
3664
-
3665
-
3666
- bool JSObject::HasDictionaryElements() {
3667
- return GetElementsKind() == DICTIONARY_ELEMENTS;
3668
- }
3669
-
3670
-
3671
- bool JSObject::HasExternalArrayElements() {
3672
- HeapObject* array = elements();
3673
- ASSERT(array != NULL);
3674
- return array->IsExternalArray();
3675
- }
3676
-
3677
-
3678
- #define EXTERNAL_ELEMENTS_CHECK(name, type) \
3679
- bool JSObject::HasExternal##name##Elements() { \
3680
- HeapObject* array = elements(); \
3681
- ASSERT(array != NULL); \
3682
- if (!array->IsHeapObject()) \
3683
- return false; \
3684
- return array->map()->instance_type() == type; \
3685
- }
3686
-
3687
-
3688
- EXTERNAL_ELEMENTS_CHECK(Byte, EXTERNAL_BYTE_ARRAY_TYPE)
3689
- EXTERNAL_ELEMENTS_CHECK(UnsignedByte, EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE)
3690
- EXTERNAL_ELEMENTS_CHECK(Short, EXTERNAL_SHORT_ARRAY_TYPE)
3691
- EXTERNAL_ELEMENTS_CHECK(UnsignedShort,
3692
- EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE)
3693
- EXTERNAL_ELEMENTS_CHECK(Int, EXTERNAL_INT_ARRAY_TYPE)
3694
- EXTERNAL_ELEMENTS_CHECK(UnsignedInt,
3695
- EXTERNAL_UNSIGNED_INT_ARRAY_TYPE)
3696
- EXTERNAL_ELEMENTS_CHECK(Float,
3697
- EXTERNAL_FLOAT_ARRAY_TYPE)
3698
- EXTERNAL_ELEMENTS_CHECK(Pixel, EXTERNAL_PIXEL_ARRAY_TYPE)
3699
-
3700
-
3701
- bool JSObject::HasNamedInterceptor() {
3702
- return map()->has_named_interceptor();
3703
- }
3704
-
3705
-
3706
- bool JSObject::HasIndexedInterceptor() {
3707
- return map()->has_indexed_interceptor();
3708
- }
3709
-
3710
-
3711
- bool JSObject::AllowsSetElementsLength() {
3712
- bool result = elements()->IsFixedArray();
3713
- ASSERT(result == !HasExternalArrayElements());
3714
- return result;
3715
- }
3716
-
3717
-
3718
- MaybeObject* JSObject::EnsureWritableFastElements() {
3719
- ASSERT(HasFastElements());
3720
- FixedArray* elems = FixedArray::cast(elements());
3721
- Isolate* isolate = GetIsolate();
3722
- if (elems->map() != isolate->heap()->fixed_cow_array_map()) return elems;
3723
- Object* writable_elems;
3724
- { MaybeObject* maybe_writable_elems = isolate->heap()->CopyFixedArrayWithMap(
3725
- elems, isolate->heap()->fixed_array_map());
3726
- if (!maybe_writable_elems->ToObject(&writable_elems)) {
3727
- return maybe_writable_elems;
3728
- }
3729
- }
3730
- set_elements(FixedArray::cast(writable_elems));
3731
- isolate->counters()->cow_arrays_converted()->Increment();
3732
- return writable_elems;
3733
- }
3734
-
3735
-
3736
- StringDictionary* JSObject::property_dictionary() {
3737
- ASSERT(!HasFastProperties());
3738
- return StringDictionary::cast(properties());
3739
- }
3740
-
3741
-
3742
- NumberDictionary* JSObject::element_dictionary() {
3743
- ASSERT(HasDictionaryElements());
3744
- return NumberDictionary::cast(elements());
3745
- }
3746
-
3747
-
3748
- bool String::IsHashFieldComputed(uint32_t field) {
3749
- return (field & kHashNotComputedMask) == 0;
3750
- }
3751
-
3752
-
3753
- bool String::HasHashCode() {
3754
- return IsHashFieldComputed(hash_field());
3755
- }
3756
-
3757
-
3758
- uint32_t String::Hash() {
3759
- // Fast case: has hash code already been computed?
3760
- uint32_t field = hash_field();
3761
- if (IsHashFieldComputed(field)) return field >> kHashShift;
3762
- // Slow case: compute hash code and set it.
3763
- return ComputeAndSetHash();
3764
- }
3765
-
3766
-
3767
- StringHasher::StringHasher(int length)
3768
- : length_(length),
3769
- raw_running_hash_(0),
3770
- array_index_(0),
3771
- is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize),
3772
- is_first_char_(true),
3773
- is_valid_(true) { }
3774
-
3775
-
3776
- bool StringHasher::has_trivial_hash() {
3777
- return length_ > String::kMaxHashCalcLength;
3778
- }
3779
-
3780
-
3781
- void StringHasher::AddCharacter(uc32 c) {
3782
- // Use the Jenkins one-at-a-time hash function to update the hash
3783
- // for the given character.
3784
- raw_running_hash_ += c;
3785
- raw_running_hash_ += (raw_running_hash_ << 10);
3786
- raw_running_hash_ ^= (raw_running_hash_ >> 6);
3787
- // Incremental array index computation.
3788
- if (is_array_index_) {
3789
- if (c < '0' || c > '9') {
3790
- is_array_index_ = false;
3791
- } else {
3792
- int d = c - '0';
3793
- if (is_first_char_) {
3794
- is_first_char_ = false;
3795
- if (c == '0' && length_ > 1) {
3796
- is_array_index_ = false;
3797
- return;
3798
- }
3799
- }
3800
- if (array_index_ > 429496729U - ((d + 2) >> 3)) {
3801
- is_array_index_ = false;
3802
- } else {
3803
- array_index_ = array_index_ * 10 + d;
3804
- }
3805
- }
3806
- }
3807
- }
3808
-
3809
-
3810
- void StringHasher::AddCharacterNoIndex(uc32 c) {
3811
- ASSERT(!is_array_index());
3812
- raw_running_hash_ += c;
3813
- raw_running_hash_ += (raw_running_hash_ << 10);
3814
- raw_running_hash_ ^= (raw_running_hash_ >> 6);
3815
- }
3816
-
3817
-
3818
- uint32_t StringHasher::GetHash() {
3819
- // Get the calculated raw hash value and do some more bit ops to distribute
3820
- // the hash further. Ensure that we never return zero as the hash value.
3821
- uint32_t result = raw_running_hash_;
3822
- result += (result << 3);
3823
- result ^= (result >> 11);
3824
- result += (result << 15);
3825
- if (result == 0) {
3826
- result = 27;
3827
- }
3828
- return result;
3829
- }
3830
-
3831
-
3832
- template <typename schar>
3833
- uint32_t HashSequentialString(const schar* chars, int length) {
3834
- StringHasher hasher(length);
3835
- if (!hasher.has_trivial_hash()) {
3836
- int i;
3837
- for (i = 0; hasher.is_array_index() && (i < length); i++) {
3838
- hasher.AddCharacter(chars[i]);
3839
- }
3840
- for (; i < length; i++) {
3841
- hasher.AddCharacterNoIndex(chars[i]);
3842
- }
3843
- }
3844
- return hasher.GetHashField();
3845
- }
3846
-
3847
-
3848
- bool String::AsArrayIndex(uint32_t* index) {
3849
- uint32_t field = hash_field();
3850
- if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) {
3851
- return false;
3852
- }
3853
- return SlowAsArrayIndex(index);
3854
- }
3855
-
3856
-
3857
- Object* JSObject::GetPrototype() {
3858
- return JSObject::cast(this)->map()->prototype();
3859
- }
3860
-
3861
-
3862
- PropertyAttributes JSObject::GetPropertyAttribute(String* key) {
3863
- return GetPropertyAttributeWithReceiver(this, key);
3864
- }
3865
-
3866
- // TODO(504): this may be useful in other places too where JSGlobalProxy
3867
- // is used.
3868
- Object* JSObject::BypassGlobalProxy() {
3869
- if (IsJSGlobalProxy()) {
3870
- Object* proto = GetPrototype();
3871
- if (proto->IsNull()) return GetHeap()->undefined_value();
3872
- ASSERT(proto->IsJSGlobalObject());
3873
- return proto;
3874
- }
3875
- return this;
3876
- }
3877
-
3878
-
3879
- bool JSObject::HasHiddenPropertiesObject() {
3880
- ASSERT(!IsJSGlobalProxy());
3881
- return GetPropertyAttributePostInterceptor(this,
3882
- GetHeap()->hidden_symbol(),
3883
- false) != ABSENT;
3884
- }
3885
-
3886
-
3887
- Object* JSObject::GetHiddenPropertiesObject() {
3888
- ASSERT(!IsJSGlobalProxy());
3889
- PropertyAttributes attributes;
3890
- // You can't install a getter on a property indexed by the hidden symbol,
3891
- // so we can be sure that GetLocalPropertyPostInterceptor returns a real
3892
- // object.
3893
- Object* result =
3894
- GetLocalPropertyPostInterceptor(this,
3895
- GetHeap()->hidden_symbol(),
3896
- &attributes)->ToObjectUnchecked();
3897
- return result;
3898
- }
3899
-
3900
-
3901
- MaybeObject* JSObject::SetHiddenPropertiesObject(Object* hidden_obj) {
3902
- ASSERT(!IsJSGlobalProxy());
3903
- return SetPropertyPostInterceptor(GetHeap()->hidden_symbol(),
3904
- hidden_obj,
3905
- DONT_ENUM,
3906
- kNonStrictMode);
3907
- }
3908
-
3909
-
3910
- bool JSObject::HasElement(uint32_t index) {
3911
- return HasElementWithReceiver(this, index);
3912
- }
3913
-
3914
-
3915
- bool AccessorInfo::all_can_read() {
3916
- return BooleanBit::get(flag(), kAllCanReadBit);
3917
- }
3918
-
3919
-
3920
- void AccessorInfo::set_all_can_read(bool value) {
3921
- set_flag(BooleanBit::set(flag(), kAllCanReadBit, value));
3922
- }
3923
-
3924
-
3925
- bool AccessorInfo::all_can_write() {
3926
- return BooleanBit::get(flag(), kAllCanWriteBit);
3927
- }
3928
-
3929
-
3930
- void AccessorInfo::set_all_can_write(bool value) {
3931
- set_flag(BooleanBit::set(flag(), kAllCanWriteBit, value));
3932
- }
3933
-
3934
-
3935
- bool AccessorInfo::prohibits_overwriting() {
3936
- return BooleanBit::get(flag(), kProhibitsOverwritingBit);
3937
- }
3938
-
3939
-
3940
- void AccessorInfo::set_prohibits_overwriting(bool value) {
3941
- set_flag(BooleanBit::set(flag(), kProhibitsOverwritingBit, value));
3942
- }
3943
-
3944
-
3945
- PropertyAttributes AccessorInfo::property_attributes() {
3946
- return AttributesField::decode(static_cast<uint32_t>(flag()->value()));
3947
- }
3948
-
3949
-
3950
- void AccessorInfo::set_property_attributes(PropertyAttributes attributes) {
3951
- ASSERT(AttributesField::is_valid(attributes));
3952
- int rest_value = flag()->value() & ~AttributesField::mask();
3953
- set_flag(Smi::FromInt(rest_value | AttributesField::encode(attributes)));
3954
- }
3955
-
3956
- template<typename Shape, typename Key>
3957
- void Dictionary<Shape, Key>::SetEntry(int entry,
3958
- Object* key,
3959
- Object* value,
3960
- PropertyDetails details) {
3961
- ASSERT(!key->IsString() || details.IsDeleted() || details.index() > 0);
3962
- int index = HashTable<Shape, Key>::EntryToIndex(entry);
3963
- AssertNoAllocation no_gc;
3964
- WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc);
3965
- FixedArray::set(index, key, mode);
3966
- FixedArray::set(index+1, value, mode);
3967
- FixedArray::fast_set(this, index+2, details.AsSmi());
3968
- }
3969
-
3970
-
3971
- bool NumberDictionaryShape::IsMatch(uint32_t key, Object* other) {
3972
- ASSERT(other->IsNumber());
3973
- return key == static_cast<uint32_t>(other->Number());
3974
- }
3975
-
3976
-
3977
- uint32_t NumberDictionaryShape::Hash(uint32_t key) {
3978
- return ComputeIntegerHash(key);
3979
- }
3980
-
3981
-
3982
- uint32_t NumberDictionaryShape::HashForObject(uint32_t key, Object* other) {
3983
- ASSERT(other->IsNumber());
3984
- return ComputeIntegerHash(static_cast<uint32_t>(other->Number()));
3985
- }
3986
-
3987
-
3988
- MaybeObject* NumberDictionaryShape::AsObject(uint32_t key) {
3989
- return Isolate::Current()->heap()->NumberFromUint32(key);
3990
- }
3991
-
3992
-
3993
- bool StringDictionaryShape::IsMatch(String* key, Object* other) {
3994
- // We know that all entries in a hash table had their hash keys created.
3995
- // Use that knowledge to have fast failure.
3996
- if (key->Hash() != String::cast(other)->Hash()) return false;
3997
- return key->Equals(String::cast(other));
3998
- }
3999
-
4000
-
4001
- uint32_t StringDictionaryShape::Hash(String* key) {
4002
- return key->Hash();
4003
- }
4004
-
4005
-
4006
- uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) {
4007
- return String::cast(other)->Hash();
4008
- }
4009
-
4010
-
4011
- MaybeObject* StringDictionaryShape::AsObject(String* key) {
4012
- return key;
4013
- }
4014
-
4015
-
4016
- void Map::ClearCodeCache(Heap* heap) {
4017
- // No write barrier is needed since empty_fixed_array is not in new space.
4018
- // Please note this function is used during marking:
4019
- // - MarkCompactCollector::MarkUnmarkedObject
4020
- ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array()));
4021
- WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array());
4022
- }
4023
-
4024
-
4025
- void JSArray::EnsureSize(int required_size) {
4026
- ASSERT(HasFastElements());
4027
- FixedArray* elts = FixedArray::cast(elements());
4028
- const int kArraySizeThatFitsComfortablyInNewSpace = 128;
4029
- if (elts->length() < required_size) {
4030
- // Doubling in size would be overkill, but leave some slack to avoid
4031
- // constantly growing.
4032
- Expand(required_size + (required_size >> 3));
4033
- // It's a performance benefit to keep a frequently used array in new-space.
4034
- } else if (!GetHeap()->new_space()->Contains(elts) &&
4035
- required_size < kArraySizeThatFitsComfortablyInNewSpace) {
4036
- // Expand will allocate a new backing store in new space even if the size
4037
- // we asked for isn't larger than what we had before.
4038
- Expand(required_size);
4039
- }
4040
- }
4041
-
4042
-
4043
- void JSArray::set_length(Smi* length) {
4044
- set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER);
4045
- }
4046
-
4047
-
4048
- void JSArray::SetContent(FixedArray* storage) {
4049
- set_length(Smi::FromInt(storage->length()));
4050
- set_elements(storage);
4051
- }
4052
-
4053
-
4054
- MaybeObject* FixedArray::Copy() {
4055
- if (length() == 0) return this;
4056
- return GetHeap()->CopyFixedArray(this);
4057
- }
4058
-
4059
-
4060
- Relocatable::Relocatable(Isolate* isolate) {
4061
- ASSERT(isolate == Isolate::Current());
4062
- isolate_ = isolate;
4063
- prev_ = isolate->relocatable_top();
4064
- isolate->set_relocatable_top(this);
4065
- }
4066
-
4067
-
4068
- Relocatable::~Relocatable() {
4069
- ASSERT(isolate_ == Isolate::Current());
4070
- ASSERT_EQ(isolate_->relocatable_top(), this);
4071
- isolate_->set_relocatable_top(prev_);
4072
- }
4073
-
4074
-
4075
- int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) {
4076
- return map->instance_size();
4077
- }
4078
-
4079
-
4080
- void Proxy::ProxyIterateBody(ObjectVisitor* v) {
4081
- v->VisitExternalReference(
4082
- reinterpret_cast<Address *>(FIELD_ADDR(this, kProxyOffset)));
4083
- }
4084
-
4085
-
4086
- template<typename StaticVisitor>
4087
- void Proxy::ProxyIterateBody() {
4088
- StaticVisitor::VisitExternalReference(
4089
- reinterpret_cast<Address *>(FIELD_ADDR(this, kProxyOffset)));
4090
- }
4091
-
4092
-
4093
- void ExternalAsciiString::ExternalAsciiStringIterateBody(ObjectVisitor* v) {
4094
- typedef v8::String::ExternalAsciiStringResource Resource;
4095
- v->VisitExternalAsciiString(
4096
- reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
4097
- }
4098
-
4099
-
4100
- template<typename StaticVisitor>
4101
- void ExternalAsciiString::ExternalAsciiStringIterateBody() {
4102
- typedef v8::String::ExternalAsciiStringResource Resource;
4103
- StaticVisitor::VisitExternalAsciiString(
4104
- reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
4105
- }
4106
-
4107
-
4108
- void ExternalTwoByteString::ExternalTwoByteStringIterateBody(ObjectVisitor* v) {
4109
- typedef v8::String::ExternalStringResource Resource;
4110
- v->VisitExternalTwoByteString(
4111
- reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
4112
- }
4113
-
4114
-
4115
- template<typename StaticVisitor>
4116
- void ExternalTwoByteString::ExternalTwoByteStringIterateBody() {
4117
- typedef v8::String::ExternalStringResource Resource;
4118
- StaticVisitor::VisitExternalTwoByteString(
4119
- reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
4120
- }
4121
-
4122
- #define SLOT_ADDR(obj, offset) \
4123
- reinterpret_cast<Object**>((obj)->address() + offset)
4124
-
4125
- template<int start_offset, int end_offset, int size>
4126
- void FixedBodyDescriptor<start_offset, end_offset, size>::IterateBody(
4127
- HeapObject* obj,
4128
- ObjectVisitor* v) {
4129
- v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, end_offset));
4130
- }
4131
-
4132
-
4133
- template<int start_offset>
4134
- void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj,
4135
- int object_size,
4136
- ObjectVisitor* v) {
4137
- v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, object_size));
4138
- }
4139
-
4140
- #undef SLOT_ADDR
4141
-
4142
-
4143
- #undef CAST_ACCESSOR
4144
- #undef INT_ACCESSORS
4145
- #undef SMI_ACCESSORS
4146
- #undef ACCESSORS
4147
- #undef FIELD_ADDR
4148
- #undef READ_FIELD
4149
- #undef WRITE_FIELD
4150
- #undef WRITE_BARRIER
4151
- #undef CONDITIONAL_WRITE_BARRIER
4152
- #undef READ_MEMADDR_FIELD
4153
- #undef WRITE_MEMADDR_FIELD
4154
- #undef READ_DOUBLE_FIELD
4155
- #undef WRITE_DOUBLE_FIELD
4156
- #undef READ_INT_FIELD
4157
- #undef WRITE_INT_FIELD
4158
- #undef READ_SHORT_FIELD
4159
- #undef WRITE_SHORT_FIELD
4160
- #undef READ_BYTE_FIELD
4161
- #undef WRITE_BYTE_FIELD
4162
-
4163
-
4164
- } } // namespace v8::internal
4165
-
4166
- #endif // V8_OBJECTS_INL_H_