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