therubyracer 0.9.0beta4 → 0.9.0beta5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of therubyracer might be problematic. Click here for more details.
- data/.gitignore +1 -0
- data/Rakefile +0 -11
- data/ext/v8/extconf.rb +9 -9
- data/ext/v8/v8_external.cpp +40 -10
- data/lib/v8/cli.rb +2 -1
- data/lib/v8/version.rb +1 -1
- data/spec/redjs/.gitignore +1 -0
- data/therubyracer.gemspec +2 -3
- metadata +33 -779
- data/ext/v8/upstream/Makefile +0 -38
- data/ext/v8/upstream/detect_cpu.rb +0 -27
- data/ext/v8/upstream/fpic-on-linux-amd64.patch +0 -13
- data/ext/v8/upstream/scons/CHANGES.txt +0 -5183
- data/ext/v8/upstream/scons/LICENSE.txt +0 -20
- data/ext/v8/upstream/scons/MANIFEST +0 -202
- data/ext/v8/upstream/scons/PKG-INFO +0 -13
- data/ext/v8/upstream/scons/README.txt +0 -273
- data/ext/v8/upstream/scons/RELEASE.txt +0 -1040
- data/ext/v8/upstream/scons/engine/SCons/Action.py +0 -1256
- data/ext/v8/upstream/scons/engine/SCons/Builder.py +0 -868
- data/ext/v8/upstream/scons/engine/SCons/CacheDir.py +0 -217
- data/ext/v8/upstream/scons/engine/SCons/Conftest.py +0 -794
- data/ext/v8/upstream/scons/engine/SCons/Debug.py +0 -237
- data/ext/v8/upstream/scons/engine/SCons/Defaults.py +0 -485
- data/ext/v8/upstream/scons/engine/SCons/Environment.py +0 -2327
- data/ext/v8/upstream/scons/engine/SCons/Errors.py +0 -207
- data/ext/v8/upstream/scons/engine/SCons/Executor.py +0 -636
- data/ext/v8/upstream/scons/engine/SCons/Job.py +0 -435
- data/ext/v8/upstream/scons/engine/SCons/Memoize.py +0 -292
- data/ext/v8/upstream/scons/engine/SCons/Node/Alias.py +0 -153
- data/ext/v8/upstream/scons/engine/SCons/Node/FS.py +0 -3220
- data/ext/v8/upstream/scons/engine/SCons/Node/Python.py +0 -128
- data/ext/v8/upstream/scons/engine/SCons/Node/__init__.py +0 -1341
- data/ext/v8/upstream/scons/engine/SCons/Options/BoolOption.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Options/EnumOption.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Options/ListOption.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Options/PackageOption.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Options/PathOption.py +0 -76
- data/ext/v8/upstream/scons/engine/SCons/Options/__init__.py +0 -74
- data/ext/v8/upstream/scons/engine/SCons/PathList.py +0 -232
- data/ext/v8/upstream/scons/engine/SCons/Platform/__init__.py +0 -236
- data/ext/v8/upstream/scons/engine/SCons/Platform/aix.py +0 -70
- data/ext/v8/upstream/scons/engine/SCons/Platform/cygwin.py +0 -55
- data/ext/v8/upstream/scons/engine/SCons/Platform/darwin.py +0 -46
- data/ext/v8/upstream/scons/engine/SCons/Platform/hpux.py +0 -46
- data/ext/v8/upstream/scons/engine/SCons/Platform/irix.py +0 -44
- data/ext/v8/upstream/scons/engine/SCons/Platform/os2.py +0 -58
- data/ext/v8/upstream/scons/engine/SCons/Platform/posix.py +0 -264
- data/ext/v8/upstream/scons/engine/SCons/Platform/sunos.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Platform/win32.py +0 -386
- data/ext/v8/upstream/scons/engine/SCons/SConf.py +0 -1038
- data/ext/v8/upstream/scons/engine/SCons/SConsign.py +0 -381
- data/ext/v8/upstream/scons/engine/SCons/Scanner/C.py +0 -132
- data/ext/v8/upstream/scons/engine/SCons/Scanner/D.py +0 -74
- data/ext/v8/upstream/scons/engine/SCons/Scanner/Dir.py +0 -111
- data/ext/v8/upstream/scons/engine/SCons/Scanner/Fortran.py +0 -320
- data/ext/v8/upstream/scons/engine/SCons/Scanner/IDL.py +0 -48
- data/ext/v8/upstream/scons/engine/SCons/Scanner/LaTeX.py +0 -378
- data/ext/v8/upstream/scons/engine/SCons/Scanner/Prog.py +0 -103
- data/ext/v8/upstream/scons/engine/SCons/Scanner/RC.py +0 -55
- data/ext/v8/upstream/scons/engine/SCons/Scanner/__init__.py +0 -415
- data/ext/v8/upstream/scons/engine/SCons/Script/Interactive.py +0 -386
- data/ext/v8/upstream/scons/engine/SCons/Script/Main.py +0 -1360
- data/ext/v8/upstream/scons/engine/SCons/Script/SConsOptions.py +0 -944
- data/ext/v8/upstream/scons/engine/SCons/Script/SConscript.py +0 -642
- data/ext/v8/upstream/scons/engine/SCons/Script/__init__.py +0 -414
- data/ext/v8/upstream/scons/engine/SCons/Sig.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Subst.py +0 -911
- data/ext/v8/upstream/scons/engine/SCons/Taskmaster.py +0 -1030
- data/ext/v8/upstream/scons/engine/SCons/Tool/386asm.py +0 -61
- data/ext/v8/upstream/scons/engine/SCons/Tool/BitKeeper.py +0 -65
- data/ext/v8/upstream/scons/engine/SCons/Tool/CVS.py +0 -73
- data/ext/v8/upstream/scons/engine/SCons/Tool/FortranCommon.py +0 -247
- data/ext/v8/upstream/scons/engine/SCons/Tool/JavaCommon.py +0 -324
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/__init__.py +0 -56
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/arch.py +0 -61
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/common.py +0 -210
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/netframework.py +0 -84
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/sdk.py +0 -321
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vc.py +0 -367
- data/ext/v8/upstream/scons/engine/SCons/Tool/MSCommon/vs.py +0 -497
- data/ext/v8/upstream/scons/engine/SCons/Tool/Perforce.py +0 -104
- data/ext/v8/upstream/scons/engine/SCons/Tool/PharLapCommon.py +0 -138
- data/ext/v8/upstream/scons/engine/SCons/Tool/RCS.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/SCCS.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/Subversion.py +0 -71
- data/ext/v8/upstream/scons/engine/SCons/Tool/__init__.py +0 -675
- data/ext/v8/upstream/scons/engine/SCons/Tool/aixc++.py +0 -82
- data/ext/v8/upstream/scons/engine/SCons/Tool/aixcc.py +0 -74
- data/ext/v8/upstream/scons/engine/SCons/Tool/aixf77.py +0 -80
- data/ext/v8/upstream/scons/engine/SCons/Tool/aixlink.py +0 -76
- data/ext/v8/upstream/scons/engine/SCons/Tool/applelink.py +0 -71
- data/ext/v8/upstream/scons/engine/SCons/Tool/ar.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/as.py +0 -78
- data/ext/v8/upstream/scons/engine/SCons/Tool/bcc32.py +0 -82
- data/ext/v8/upstream/scons/engine/SCons/Tool/c++.py +0 -99
- data/ext/v8/upstream/scons/engine/SCons/Tool/cc.py +0 -114
- data/ext/v8/upstream/scons/engine/SCons/Tool/cvf.py +0 -58
- data/ext/v8/upstream/scons/engine/SCons/Tool/default.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Tool/dmd.py +0 -224
- data/ext/v8/upstream/scons/engine/SCons/Tool/dvi.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/dvipdf.py +0 -125
- data/ext/v8/upstream/scons/engine/SCons/Tool/dvips.py +0 -94
- data/ext/v8/upstream/scons/engine/SCons/Tool/f77.py +0 -62
- data/ext/v8/upstream/scons/engine/SCons/Tool/f90.py +0 -62
- data/ext/v8/upstream/scons/engine/SCons/Tool/f95.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/filesystem.py +0 -98
- data/ext/v8/upstream/scons/engine/SCons/Tool/fortran.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/g++.py +0 -90
- data/ext/v8/upstream/scons/engine/SCons/Tool/g77.py +0 -73
- data/ext/v8/upstream/scons/engine/SCons/Tool/gas.py +0 -53
- data/ext/v8/upstream/scons/engine/SCons/Tool/gcc.py +0 -80
- data/ext/v8/upstream/scons/engine/SCons/Tool/gfortran.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/gnulink.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/gs.py +0 -81
- data/ext/v8/upstream/scons/engine/SCons/Tool/hpc++.py +0 -85
- data/ext/v8/upstream/scons/engine/SCons/Tool/hpcc.py +0 -53
- data/ext/v8/upstream/scons/engine/SCons/Tool/hplink.py +0 -77
- data/ext/v8/upstream/scons/engine/SCons/Tool/icc.py +0 -59
- data/ext/v8/upstream/scons/engine/SCons/Tool/icl.py +0 -52
- data/ext/v8/upstream/scons/engine/SCons/Tool/ifl.py +0 -72
- data/ext/v8/upstream/scons/engine/SCons/Tool/ifort.py +0 -90
- data/ext/v8/upstream/scons/engine/SCons/Tool/ilink.py +0 -59
- data/ext/v8/upstream/scons/engine/SCons/Tool/ilink32.py +0 -60
- data/ext/v8/upstream/scons/engine/SCons/Tool/install.py +0 -229
- data/ext/v8/upstream/scons/engine/SCons/Tool/intelc.py +0 -490
- data/ext/v8/upstream/scons/engine/SCons/Tool/ipkg.py +0 -71
- data/ext/v8/upstream/scons/engine/SCons/Tool/jar.py +0 -110
- data/ext/v8/upstream/scons/engine/SCons/Tool/javac.py +0 -234
- data/ext/v8/upstream/scons/engine/SCons/Tool/javah.py +0 -138
- data/ext/v8/upstream/scons/engine/SCons/Tool/latex.py +0 -79
- data/ext/v8/upstream/scons/engine/SCons/Tool/lex.py +0 -99
- data/ext/v8/upstream/scons/engine/SCons/Tool/link.py +0 -121
- data/ext/v8/upstream/scons/engine/SCons/Tool/linkloc.py +0 -112
- data/ext/v8/upstream/scons/engine/SCons/Tool/m4.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/masm.py +0 -77
- data/ext/v8/upstream/scons/engine/SCons/Tool/midl.py +0 -90
- data/ext/v8/upstream/scons/engine/SCons/Tool/mingw.py +0 -159
- data/ext/v8/upstream/scons/engine/SCons/Tool/mslib.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/mslink.py +0 -266
- data/ext/v8/upstream/scons/engine/SCons/Tool/mssdk.py +0 -50
- data/ext/v8/upstream/scons/engine/SCons/Tool/msvc.py +0 -269
- data/ext/v8/upstream/scons/engine/SCons/Tool/msvs.py +0 -1439
- data/ext/v8/upstream/scons/engine/SCons/Tool/mwcc.py +0 -208
- data/ext/v8/upstream/scons/engine/SCons/Tool/mwld.py +0 -107
- data/ext/v8/upstream/scons/engine/SCons/Tool/nasm.py +0 -72
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/__init__.py +0 -314
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/ipk.py +0 -185
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/msi.py +0 -526
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/rpm.py +0 -367
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_tarbz2.py +0 -43
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_targz.py +0 -43
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/src_zip.py +0 -43
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/tarbz2.py +0 -44
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/targz.py +0 -44
- data/ext/v8/upstream/scons/engine/SCons/Tool/packaging/zip.py +0 -44
- data/ext/v8/upstream/scons/engine/SCons/Tool/pdf.py +0 -78
- data/ext/v8/upstream/scons/engine/SCons/Tool/pdflatex.py +0 -83
- data/ext/v8/upstream/scons/engine/SCons/Tool/pdftex.py +0 -108
- data/ext/v8/upstream/scons/engine/SCons/Tool/qt.py +0 -336
- data/ext/v8/upstream/scons/engine/SCons/Tool/rmic.py +0 -121
- data/ext/v8/upstream/scons/engine/SCons/Tool/rpcgen.py +0 -70
- data/ext/v8/upstream/scons/engine/SCons/Tool/rpm.py +0 -132
- data/ext/v8/upstream/scons/engine/SCons/Tool/sgiar.py +0 -68
- data/ext/v8/upstream/scons/engine/SCons/Tool/sgic++.py +0 -58
- data/ext/v8/upstream/scons/engine/SCons/Tool/sgicc.py +0 -53
- data/ext/v8/upstream/scons/engine/SCons/Tool/sgilink.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunar.py +0 -67
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunc++.py +0 -142
- data/ext/v8/upstream/scons/engine/SCons/Tool/suncc.py +0 -58
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunf77.py +0 -63
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunf90.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunf95.py +0 -64
- data/ext/v8/upstream/scons/engine/SCons/Tool/sunlink.py +0 -77
- data/ext/v8/upstream/scons/engine/SCons/Tool/swig.py +0 -186
- data/ext/v8/upstream/scons/engine/SCons/Tool/tar.py +0 -73
- data/ext/v8/upstream/scons/engine/SCons/Tool/tex.py +0 -805
- data/ext/v8/upstream/scons/engine/SCons/Tool/textfile.py +0 -175
- data/ext/v8/upstream/scons/engine/SCons/Tool/tlib.py +0 -53
- data/ext/v8/upstream/scons/engine/SCons/Tool/wix.py +0 -100
- data/ext/v8/upstream/scons/engine/SCons/Tool/yacc.py +0 -131
- data/ext/v8/upstream/scons/engine/SCons/Tool/zip.py +0 -100
- data/ext/v8/upstream/scons/engine/SCons/Util.py +0 -1645
- data/ext/v8/upstream/scons/engine/SCons/Variables/BoolVariable.py +0 -91
- data/ext/v8/upstream/scons/engine/SCons/Variables/EnumVariable.py +0 -107
- data/ext/v8/upstream/scons/engine/SCons/Variables/ListVariable.py +0 -139
- data/ext/v8/upstream/scons/engine/SCons/Variables/PackageVariable.py +0 -109
- data/ext/v8/upstream/scons/engine/SCons/Variables/PathVariable.py +0 -147
- data/ext/v8/upstream/scons/engine/SCons/Variables/__init__.py +0 -317
- data/ext/v8/upstream/scons/engine/SCons/Warnings.py +0 -228
- data/ext/v8/upstream/scons/engine/SCons/__init__.py +0 -49
- data/ext/v8/upstream/scons/engine/SCons/compat/__init__.py +0 -302
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_UserString.py +0 -98
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_hashlib.py +0 -91
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_itertools.py +0 -124
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_optparse.py +0 -1725
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets.py +0 -583
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_sets15.py +0 -176
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_shlex.py +0 -325
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_subprocess.py +0 -1296
- data/ext/v8/upstream/scons/engine/SCons/compat/_scons_textwrap.py +0 -382
- data/ext/v8/upstream/scons/engine/SCons/compat/builtins.py +0 -187
- data/ext/v8/upstream/scons/engine/SCons/cpp.py +0 -598
- data/ext/v8/upstream/scons/engine/SCons/dblite.py +0 -248
- data/ext/v8/upstream/scons/engine/SCons/exitfuncs.py +0 -77
- data/ext/v8/upstream/scons/os_spawnv_fix.diff +0 -83
- data/ext/v8/upstream/scons/scons-time.1 +0 -1017
- data/ext/v8/upstream/scons/scons.1 +0 -15179
- data/ext/v8/upstream/scons/sconsign.1 +0 -208
- data/ext/v8/upstream/scons/script/scons +0 -184
- data/ext/v8/upstream/scons/script/scons-time +0 -1529
- data/ext/v8/upstream/scons/script/scons.bat +0 -31
- data/ext/v8/upstream/scons/script/sconsign +0 -508
- data/ext/v8/upstream/scons/setup.cfg +0 -6
- data/ext/v8/upstream/scons/setup.py +0 -427
- data/ext/v8/upstream/v8/.gitignore +0 -33
- data/ext/v8/upstream/v8/AUTHORS +0 -42
- data/ext/v8/upstream/v8/ChangeLog +0 -2663
- data/ext/v8/upstream/v8/LICENSE +0 -52
- data/ext/v8/upstream/v8/LICENSE.strongtalk +0 -29
- data/ext/v8/upstream/v8/LICENSE.v8 +0 -26
- data/ext/v8/upstream/v8/LICENSE.valgrind +0 -45
- data/ext/v8/upstream/v8/SConstruct +0 -1473
- data/ext/v8/upstream/v8/build/README.txt +0 -25
- data/ext/v8/upstream/v8/build/all.gyp +0 -18
- data/ext/v8/upstream/v8/build/armu.gypi +0 -32
- data/ext/v8/upstream/v8/build/common.gypi +0 -82
- data/ext/v8/upstream/v8/build/gyp_v8 +0 -145
- data/ext/v8/upstream/v8/include/v8-debug.h +0 -394
- data/ext/v8/upstream/v8/include/v8-preparser.h +0 -116
- data/ext/v8/upstream/v8/include/v8-profiler.h +0 -505
- data/ext/v8/upstream/v8/include/v8-testing.h +0 -104
- data/ext/v8/upstream/v8/include/v8.h +0 -4000
- data/ext/v8/upstream/v8/include/v8stdint.h +0 -53
- data/ext/v8/upstream/v8/preparser/SConscript +0 -38
- data/ext/v8/upstream/v8/preparser/preparser-process.cc +0 -169
- data/ext/v8/upstream/v8/src/SConscript +0 -380
- data/ext/v8/upstream/v8/src/accessors.cc +0 -766
- data/ext/v8/upstream/v8/src/accessors.h +0 -121
- data/ext/v8/upstream/v8/src/allocation-inl.h +0 -49
- data/ext/v8/upstream/v8/src/allocation.cc +0 -122
- data/ext/v8/upstream/v8/src/allocation.h +0 -143
- data/ext/v8/upstream/v8/src/api.cc +0 -5678
- data/ext/v8/upstream/v8/src/api.h +0 -572
- data/ext/v8/upstream/v8/src/apinatives.js +0 -110
- data/ext/v8/upstream/v8/src/apiutils.h +0 -73
- data/ext/v8/upstream/v8/src/arguments.h +0 -116
- data/ext/v8/upstream/v8/src/arm/assembler-arm-inl.h +0 -353
- data/ext/v8/upstream/v8/src/arm/assembler-arm.cc +0 -2877
- data/ext/v8/upstream/v8/src/arm/assembler-arm.h +0 -1382
- data/ext/v8/upstream/v8/src/arm/builtins-arm.cc +0 -1634
- data/ext/v8/upstream/v8/src/arm/code-stubs-arm.cc +0 -6917
- data/ext/v8/upstream/v8/src/arm/code-stubs-arm.h +0 -623
- data/ext/v8/upstream/v8/src/arm/codegen-arm-inl.h +0 -48
- data/ext/v8/upstream/v8/src/arm/codegen-arm.cc +0 -7437
- data/ext/v8/upstream/v8/src/arm/codegen-arm.h +0 -595
- data/ext/v8/upstream/v8/src/arm/constants-arm.cc +0 -152
- data/ext/v8/upstream/v8/src/arm/constants-arm.h +0 -778
- data/ext/v8/upstream/v8/src/arm/cpu-arm.cc +0 -149
- data/ext/v8/upstream/v8/src/arm/debug-arm.cc +0 -317
- data/ext/v8/upstream/v8/src/arm/deoptimizer-arm.cc +0 -737
- data/ext/v8/upstream/v8/src/arm/disasm-arm.cc +0 -1503
- data/ext/v8/upstream/v8/src/arm/frames-arm.cc +0 -45
- data/ext/v8/upstream/v8/src/arm/frames-arm.h +0 -168
- data/ext/v8/upstream/v8/src/arm/full-codegen-arm.cc +0 -4374
- data/ext/v8/upstream/v8/src/arm/ic-arm.cc +0 -1793
- data/ext/v8/upstream/v8/src/arm/jump-target-arm.cc +0 -174
- data/ext/v8/upstream/v8/src/arm/lithium-arm.cc +0 -2120
- data/ext/v8/upstream/v8/src/arm/lithium-arm.h +0 -2179
- data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.cc +0 -4132
- data/ext/v8/upstream/v8/src/arm/lithium-codegen-arm.h +0 -329
- data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.cc +0 -305
- data/ext/v8/upstream/v8/src/arm/lithium-gap-resolver-arm.h +0 -84
- data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.cc +0 -2939
- data/ext/v8/upstream/v8/src/arm/macro-assembler-arm.h +0 -1071
- data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.cc +0 -1287
- data/ext/v8/upstream/v8/src/arm/regexp-macro-assembler-arm.h +0 -253
- data/ext/v8/upstream/v8/src/arm/register-allocator-arm-inl.h +0 -100
- data/ext/v8/upstream/v8/src/arm/register-allocator-arm.cc +0 -63
- data/ext/v8/upstream/v8/src/arm/register-allocator-arm.h +0 -44
- data/ext/v8/upstream/v8/src/arm/simulator-arm.cc +0 -3288
- data/ext/v8/upstream/v8/src/arm/simulator-arm.h +0 -413
- data/ext/v8/upstream/v8/src/arm/stub-cache-arm.cc +0 -4034
- data/ext/v8/upstream/v8/src/arm/virtual-frame-arm-inl.h +0 -59
- data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.cc +0 -843
- data/ext/v8/upstream/v8/src/arm/virtual-frame-arm.h +0 -523
- data/ext/v8/upstream/v8/src/array.js +0 -1249
- data/ext/v8/upstream/v8/src/assembler.cc +0 -1067
- data/ext/v8/upstream/v8/src/assembler.h +0 -823
- data/ext/v8/upstream/v8/src/ast-inl.h +0 -112
- data/ext/v8/upstream/v8/src/ast.cc +0 -1078
- data/ext/v8/upstream/v8/src/ast.h +0 -2234
- data/ext/v8/upstream/v8/src/atomicops.h +0 -167
- data/ext/v8/upstream/v8/src/atomicops_internals_arm_gcc.h +0 -145
- data/ext/v8/upstream/v8/src/atomicops_internals_mips_gcc.h +0 -169
- data/ext/v8/upstream/v8/src/atomicops_internals_x86_gcc.cc +0 -126
- data/ext/v8/upstream/v8/src/atomicops_internals_x86_gcc.h +0 -287
- data/ext/v8/upstream/v8/src/atomicops_internals_x86_macosx.h +0 -301
- data/ext/v8/upstream/v8/src/atomicops_internals_x86_msvc.h +0 -203
- data/ext/v8/upstream/v8/src/bignum-dtoa.cc +0 -655
- data/ext/v8/upstream/v8/src/bignum-dtoa.h +0 -81
- data/ext/v8/upstream/v8/src/bignum.cc +0 -768
- data/ext/v8/upstream/v8/src/bignum.h +0 -140
- data/ext/v8/upstream/v8/src/bootstrapper.cc +0 -2138
- data/ext/v8/upstream/v8/src/bootstrapper.h +0 -185
- data/ext/v8/upstream/v8/src/builtins.cc +0 -1708
- data/ext/v8/upstream/v8/src/builtins.h +0 -368
- data/ext/v8/upstream/v8/src/bytecodes-irregexp.h +0 -105
- data/ext/v8/upstream/v8/src/cached-powers.cc +0 -177
- data/ext/v8/upstream/v8/src/cached-powers.h +0 -65
- data/ext/v8/upstream/v8/src/char-predicates-inl.h +0 -94
- data/ext/v8/upstream/v8/src/char-predicates.h +0 -65
- data/ext/v8/upstream/v8/src/checks.cc +0 -110
- data/ext/v8/upstream/v8/src/checks.h +0 -296
- data/ext/v8/upstream/v8/src/circular-queue-inl.h +0 -53
- data/ext/v8/upstream/v8/src/circular-queue.cc +0 -122
- data/ext/v8/upstream/v8/src/circular-queue.h +0 -103
- data/ext/v8/upstream/v8/src/code-stubs.cc +0 -240
- data/ext/v8/upstream/v8/src/code-stubs.h +0 -971
- data/ext/v8/upstream/v8/src/code.h +0 -68
- data/ext/v8/upstream/v8/src/codegen-inl.h +0 -68
- data/ext/v8/upstream/v8/src/codegen.cc +0 -505
- data/ext/v8/upstream/v8/src/codegen.h +0 -245
- data/ext/v8/upstream/v8/src/compilation-cache.cc +0 -540
- data/ext/v8/upstream/v8/src/compilation-cache.h +0 -287
- data/ext/v8/upstream/v8/src/compiler.cc +0 -792
- data/ext/v8/upstream/v8/src/compiler.h +0 -307
- data/ext/v8/upstream/v8/src/contexts.cc +0 -327
- data/ext/v8/upstream/v8/src/contexts.h +0 -382
- data/ext/v8/upstream/v8/src/conversions-inl.h +0 -110
- data/ext/v8/upstream/v8/src/conversions.cc +0 -1125
- data/ext/v8/upstream/v8/src/conversions.h +0 -122
- data/ext/v8/upstream/v8/src/counters.cc +0 -93
- data/ext/v8/upstream/v8/src/counters.h +0 -254
- data/ext/v8/upstream/v8/src/cpu-profiler-inl.h +0 -101
- data/ext/v8/upstream/v8/src/cpu-profiler.cc +0 -606
- data/ext/v8/upstream/v8/src/cpu-profiler.h +0 -305
- data/ext/v8/upstream/v8/src/cpu.h +0 -67
- data/ext/v8/upstream/v8/src/d8-debug.cc +0 -367
- data/ext/v8/upstream/v8/src/d8-debug.h +0 -158
- data/ext/v8/upstream/v8/src/d8-posix.cc +0 -695
- data/ext/v8/upstream/v8/src/d8-readline.cc +0 -128
- data/ext/v8/upstream/v8/src/d8-windows.cc +0 -42
- data/ext/v8/upstream/v8/src/d8.cc +0 -796
- data/ext/v8/upstream/v8/src/d8.gyp +0 -88
- data/ext/v8/upstream/v8/src/d8.h +0 -231
- data/ext/v8/upstream/v8/src/d8.js +0 -2798
- data/ext/v8/upstream/v8/src/data-flow.cc +0 -545
- data/ext/v8/upstream/v8/src/data-flow.h +0 -379
- data/ext/v8/upstream/v8/src/date.js +0 -1103
- data/ext/v8/upstream/v8/src/dateparser-inl.h +0 -125
- data/ext/v8/upstream/v8/src/dateparser.cc +0 -178
- data/ext/v8/upstream/v8/src/dateparser.h +0 -265
- data/ext/v8/upstream/v8/src/debug-agent.cc +0 -447
- data/ext/v8/upstream/v8/src/debug-agent.h +0 -129
- data/ext/v8/upstream/v8/src/debug-debugger.js +0 -2569
- data/ext/v8/upstream/v8/src/debug.cc +0 -3188
- data/ext/v8/upstream/v8/src/debug.h +0 -1055
- data/ext/v8/upstream/v8/src/deoptimizer.cc +0 -1296
- data/ext/v8/upstream/v8/src/deoptimizer.h +0 -629
- data/ext/v8/upstream/v8/src/disasm.h +0 -80
- data/ext/v8/upstream/v8/src/disassembler.cc +0 -339
- data/ext/v8/upstream/v8/src/disassembler.h +0 -56
- data/ext/v8/upstream/v8/src/diy-fp.cc +0 -58
- data/ext/v8/upstream/v8/src/diy-fp.h +0 -117
- data/ext/v8/upstream/v8/src/double.h +0 -238
- data/ext/v8/upstream/v8/src/dtoa.cc +0 -103
- data/ext/v8/upstream/v8/src/dtoa.h +0 -85
- data/ext/v8/upstream/v8/src/execution.cc +0 -791
- data/ext/v8/upstream/v8/src/execution.h +0 -291
- data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.cc +0 -250
- data/ext/v8/upstream/v8/src/extensions/experimental/break-iterator.h +0 -89
- data/ext/v8/upstream/v8/src/extensions/experimental/experimental.gyp +0 -55
- data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.cc +0 -284
- data/ext/v8/upstream/v8/src/extensions/experimental/i18n-extension.h +0 -64
- data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.cc +0 -141
- data/ext/v8/upstream/v8/src/extensions/externalize-string-extension.h +0 -50
- data/ext/v8/upstream/v8/src/extensions/gc-extension.cc +0 -58
- data/ext/v8/upstream/v8/src/extensions/gc-extension.h +0 -49
- data/ext/v8/upstream/v8/src/factory.cc +0 -1194
- data/ext/v8/upstream/v8/src/factory.h +0 -436
- data/ext/v8/upstream/v8/src/fast-dtoa.cc +0 -736
- data/ext/v8/upstream/v8/src/fast-dtoa.h +0 -83
- data/ext/v8/upstream/v8/src/fixed-dtoa.cc +0 -405
- data/ext/v8/upstream/v8/src/fixed-dtoa.h +0 -55
- data/ext/v8/upstream/v8/src/flag-definitions.h +0 -556
- data/ext/v8/upstream/v8/src/flags.cc +0 -551
- data/ext/v8/upstream/v8/src/flags.h +0 -79
- data/ext/v8/upstream/v8/src/frame-element.cc +0 -37
- data/ext/v8/upstream/v8/src/frame-element.h +0 -269
- data/ext/v8/upstream/v8/src/frames-inl.h +0 -236
- data/ext/v8/upstream/v8/src/frames.cc +0 -1273
- data/ext/v8/upstream/v8/src/frames.h +0 -854
- data/ext/v8/upstream/v8/src/full-codegen.cc +0 -1385
- data/ext/v8/upstream/v8/src/full-codegen.h +0 -753
- data/ext/v8/upstream/v8/src/func-name-inferrer.cc +0 -91
- data/ext/v8/upstream/v8/src/func-name-inferrer.h +0 -111
- data/ext/v8/upstream/v8/src/gdb-jit.cc +0 -1548
- data/ext/v8/upstream/v8/src/gdb-jit.h +0 -138
- data/ext/v8/upstream/v8/src/global-handles.cc +0 -596
- data/ext/v8/upstream/v8/src/global-handles.h +0 -239
- data/ext/v8/upstream/v8/src/globals.h +0 -325
- data/ext/v8/upstream/v8/src/handles-inl.h +0 -177
- data/ext/v8/upstream/v8/src/handles.cc +0 -965
- data/ext/v8/upstream/v8/src/handles.h +0 -372
- data/ext/v8/upstream/v8/src/hashmap.cc +0 -230
- data/ext/v8/upstream/v8/src/hashmap.h +0 -121
- data/ext/v8/upstream/v8/src/heap-inl.h +0 -703
- data/ext/v8/upstream/v8/src/heap-profiler.cc +0 -1173
- data/ext/v8/upstream/v8/src/heap-profiler.h +0 -396
- data/ext/v8/upstream/v8/src/heap.cc +0 -5856
- data/ext/v8/upstream/v8/src/heap.h +0 -2264
- data/ext/v8/upstream/v8/src/hydrogen-instructions.cc +0 -1639
- data/ext/v8/upstream/v8/src/hydrogen-instructions.h +0 -3657
- data/ext/v8/upstream/v8/src/hydrogen.cc +0 -6011
- data/ext/v8/upstream/v8/src/hydrogen.h +0 -1137
- data/ext/v8/upstream/v8/src/ia32/assembler-ia32-inl.h +0 -430
- data/ext/v8/upstream/v8/src/ia32/assembler-ia32.cc +0 -2846
- data/ext/v8/upstream/v8/src/ia32/assembler-ia32.h +0 -1159
- data/ext/v8/upstream/v8/src/ia32/builtins-ia32.cc +0 -1596
- data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.cc +0 -6549
- data/ext/v8/upstream/v8/src/ia32/code-stubs-ia32.h +0 -495
- data/ext/v8/upstream/v8/src/ia32/codegen-ia32-inl.h +0 -46
- data/ext/v8/upstream/v8/src/ia32/codegen-ia32.cc +0 -10385
- data/ext/v8/upstream/v8/src/ia32/codegen-ia32.h +0 -801
- data/ext/v8/upstream/v8/src/ia32/cpu-ia32.cc +0 -88
- data/ext/v8/upstream/v8/src/ia32/debug-ia32.cc +0 -312
- data/ext/v8/upstream/v8/src/ia32/deoptimizer-ia32.cc +0 -774
- data/ext/v8/upstream/v8/src/ia32/disasm-ia32.cc +0 -1620
- data/ext/v8/upstream/v8/src/ia32/frames-ia32.cc +0 -45
- data/ext/v8/upstream/v8/src/ia32/frames-ia32.h +0 -140
- data/ext/v8/upstream/v8/src/ia32/full-codegen-ia32.cc +0 -4357
- data/ext/v8/upstream/v8/src/ia32/ic-ia32.cc +0 -1779
- data/ext/v8/upstream/v8/src/ia32/jump-target-ia32.cc +0 -437
- data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.cc +0 -4158
- data/ext/v8/upstream/v8/src/ia32/lithium-codegen-ia32.h +0 -318
- data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.cc +0 -466
- data/ext/v8/upstream/v8/src/ia32/lithium-gap-resolver-ia32.h +0 -110
- data/ext/v8/upstream/v8/src/ia32/lithium-ia32.cc +0 -2181
- data/ext/v8/upstream/v8/src/ia32/lithium-ia32.h +0 -2235
- data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.cc +0 -2056
- data/ext/v8/upstream/v8/src/ia32/macro-assembler-ia32.h +0 -807
- data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.cc +0 -1264
- data/ext/v8/upstream/v8/src/ia32/regexp-macro-assembler-ia32.h +0 -216
- data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32-inl.h +0 -82
- data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.cc +0 -157
- data/ext/v8/upstream/v8/src/ia32/register-allocator-ia32.h +0 -43
- data/ext/v8/upstream/v8/src/ia32/simulator-ia32.cc +0 -30
- data/ext/v8/upstream/v8/src/ia32/simulator-ia32.h +0 -72
- data/ext/v8/upstream/v8/src/ia32/stub-cache-ia32.cc +0 -3711
- data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.cc +0 -1366
- data/ext/v8/upstream/v8/src/ia32/virtual-frame-ia32.h +0 -650
- data/ext/v8/upstream/v8/src/ic-inl.h +0 -130
- data/ext/v8/upstream/v8/src/ic.cc +0 -2389
- data/ext/v8/upstream/v8/src/ic.h +0 -675
- data/ext/v8/upstream/v8/src/inspector.cc +0 -63
- data/ext/v8/upstream/v8/src/inspector.h +0 -62
- data/ext/v8/upstream/v8/src/interpreter-irregexp.cc +0 -659
- data/ext/v8/upstream/v8/src/interpreter-irregexp.h +0 -49
- data/ext/v8/upstream/v8/src/isolate.cc +0 -883
- data/ext/v8/upstream/v8/src/isolate.h +0 -1306
- data/ext/v8/upstream/v8/src/json.js +0 -342
- data/ext/v8/upstream/v8/src/jsregexp.cc +0 -5371
- data/ext/v8/upstream/v8/src/jsregexp.h +0 -1483
- data/ext/v8/upstream/v8/src/jump-target-heavy-inl.h +0 -51
- data/ext/v8/upstream/v8/src/jump-target-heavy.cc +0 -427
- data/ext/v8/upstream/v8/src/jump-target-heavy.h +0 -238
- data/ext/v8/upstream/v8/src/jump-target-inl.h +0 -48
- data/ext/v8/upstream/v8/src/jump-target-light-inl.h +0 -56
- data/ext/v8/upstream/v8/src/jump-target-light.cc +0 -111
- data/ext/v8/upstream/v8/src/jump-target-light.h +0 -193
- data/ext/v8/upstream/v8/src/jump-target.cc +0 -91
- data/ext/v8/upstream/v8/src/jump-target.h +0 -90
- data/ext/v8/upstream/v8/src/list-inl.h +0 -206
- data/ext/v8/upstream/v8/src/list.h +0 -164
- data/ext/v8/upstream/v8/src/lithium-allocator-inl.h +0 -142
- data/ext/v8/upstream/v8/src/lithium-allocator.cc +0 -2105
- data/ext/v8/upstream/v8/src/lithium-allocator.h +0 -630
- data/ext/v8/upstream/v8/src/lithium.cc +0 -169
- data/ext/v8/upstream/v8/src/lithium.h +0 -592
- data/ext/v8/upstream/v8/src/liveedit-debugger.js +0 -1082
- data/ext/v8/upstream/v8/src/liveedit.cc +0 -1693
- data/ext/v8/upstream/v8/src/liveedit.h +0 -179
- data/ext/v8/upstream/v8/src/liveobjectlist-inl.h +0 -126
- data/ext/v8/upstream/v8/src/liveobjectlist.cc +0 -2589
- data/ext/v8/upstream/v8/src/liveobjectlist.h +0 -322
- data/ext/v8/upstream/v8/src/log-inl.h +0 -59
- data/ext/v8/upstream/v8/src/log-utils.cc +0 -423
- data/ext/v8/upstream/v8/src/log-utils.h +0 -229
- data/ext/v8/upstream/v8/src/log.cc +0 -1666
- data/ext/v8/upstream/v8/src/log.h +0 -446
- data/ext/v8/upstream/v8/src/macro-assembler.h +0 -120
- data/ext/v8/upstream/v8/src/macros.py +0 -178
- data/ext/v8/upstream/v8/src/mark-compact.cc +0 -3092
- data/ext/v8/upstream/v8/src/mark-compact.h +0 -506
- data/ext/v8/upstream/v8/src/math.js +0 -264
- data/ext/v8/upstream/v8/src/messages.cc +0 -166
- data/ext/v8/upstream/v8/src/messages.h +0 -114
- data/ext/v8/upstream/v8/src/messages.js +0 -1090
- data/ext/v8/upstream/v8/src/mips/assembler-mips-inl.h +0 -335
- data/ext/v8/upstream/v8/src/mips/assembler-mips.cc +0 -2093
- data/ext/v8/upstream/v8/src/mips/assembler-mips.h +0 -1066
- data/ext/v8/upstream/v8/src/mips/builtins-mips.cc +0 -148
- data/ext/v8/upstream/v8/src/mips/code-stubs-mips.cc +0 -752
- data/ext/v8/upstream/v8/src/mips/code-stubs-mips.h +0 -511
- data/ext/v8/upstream/v8/src/mips/codegen-mips-inl.h +0 -64
- data/ext/v8/upstream/v8/src/mips/codegen-mips.cc +0 -1213
- data/ext/v8/upstream/v8/src/mips/codegen-mips.h +0 -633
- data/ext/v8/upstream/v8/src/mips/constants-mips.cc +0 -352
- data/ext/v8/upstream/v8/src/mips/constants-mips.h +0 -723
- data/ext/v8/upstream/v8/src/mips/cpu-mips.cc +0 -90
- data/ext/v8/upstream/v8/src/mips/debug-mips.cc +0 -155
- data/ext/v8/upstream/v8/src/mips/deoptimizer-mips.cc +0 -91
- data/ext/v8/upstream/v8/src/mips/disasm-mips.cc +0 -1023
- data/ext/v8/upstream/v8/src/mips/frames-mips.cc +0 -48
- data/ext/v8/upstream/v8/src/mips/frames-mips.h +0 -179
- data/ext/v8/upstream/v8/src/mips/full-codegen-mips.cc +0 -727
- data/ext/v8/upstream/v8/src/mips/ic-mips.cc +0 -244
- data/ext/v8/upstream/v8/src/mips/jump-target-mips.cc +0 -80
- data/ext/v8/upstream/v8/src/mips/lithium-codegen-mips.h +0 -65
- data/ext/v8/upstream/v8/src/mips/lithium-mips.h +0 -304
- data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.cc +0 -3327
- data/ext/v8/upstream/v8/src/mips/macro-assembler-mips.h +0 -1058
- data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.cc +0 -478
- data/ext/v8/upstream/v8/src/mips/regexp-macro-assembler-mips.h +0 -250
- data/ext/v8/upstream/v8/src/mips/register-allocator-mips-inl.h +0 -134
- data/ext/v8/upstream/v8/src/mips/register-allocator-mips.cc +0 -63
- data/ext/v8/upstream/v8/src/mips/register-allocator-mips.h +0 -47
- data/ext/v8/upstream/v8/src/mips/simulator-mips.cc +0 -2438
- data/ext/v8/upstream/v8/src/mips/simulator-mips.h +0 -394
- data/ext/v8/upstream/v8/src/mips/stub-cache-mips.cc +0 -601
- data/ext/v8/upstream/v8/src/mips/virtual-frame-mips-inl.h +0 -58
- data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.cc +0 -307
- data/ext/v8/upstream/v8/src/mips/virtual-frame-mips.h +0 -530
- data/ext/v8/upstream/v8/src/mirror-debugger.js +0 -2381
- data/ext/v8/upstream/v8/src/mksnapshot.cc +0 -256
- data/ext/v8/upstream/v8/src/natives.h +0 -63
- data/ext/v8/upstream/v8/src/objects-debug.cc +0 -722
- data/ext/v8/upstream/v8/src/objects-inl.h +0 -4166
- data/ext/v8/upstream/v8/src/objects-printer.cc +0 -801
- data/ext/v8/upstream/v8/src/objects-visiting.cc +0 -142
- data/ext/v8/upstream/v8/src/objects-visiting.h +0 -422
- data/ext/v8/upstream/v8/src/objects.cc +0 -10296
- data/ext/v8/upstream/v8/src/objects.h +0 -6662
- data/ext/v8/upstream/v8/src/parser.cc +0 -5168
- data/ext/v8/upstream/v8/src/parser.h +0 -823
- data/ext/v8/upstream/v8/src/platform-cygwin.cc +0 -811
- data/ext/v8/upstream/v8/src/platform-freebsd.cc +0 -854
- data/ext/v8/upstream/v8/src/platform-linux.cc +0 -1120
- data/ext/v8/upstream/v8/src/platform-macos.cc +0 -865
- data/ext/v8/upstream/v8/src/platform-nullos.cc +0 -504
- data/ext/v8/upstream/v8/src/platform-openbsd.cc +0 -672
- data/ext/v8/upstream/v8/src/platform-posix.cc +0 -424
- data/ext/v8/upstream/v8/src/platform-solaris.cc +0 -796
- data/ext/v8/upstream/v8/src/platform-tls-mac.h +0 -62
- data/ext/v8/upstream/v8/src/platform-tls-win32.h +0 -62
- data/ext/v8/upstream/v8/src/platform-tls.h +0 -50
- data/ext/v8/upstream/v8/src/platform-win32.cc +0 -2072
- data/ext/v8/upstream/v8/src/platform.h +0 -693
- data/ext/v8/upstream/v8/src/preparse-data.cc +0 -185
- data/ext/v8/upstream/v8/src/preparse-data.h +0 -249
- data/ext/v8/upstream/v8/src/preparser-api.cc +0 -219
- data/ext/v8/upstream/v8/src/preparser.cc +0 -1205
- data/ext/v8/upstream/v8/src/preparser.h +0 -278
- data/ext/v8/upstream/v8/src/prettyprinter.cc +0 -1530
- data/ext/v8/upstream/v8/src/prettyprinter.h +0 -223
- data/ext/v8/upstream/v8/src/profile-generator-inl.h +0 -128
- data/ext/v8/upstream/v8/src/profile-generator.cc +0 -3095
- data/ext/v8/upstream/v8/src/profile-generator.h +0 -1125
- data/ext/v8/upstream/v8/src/property.cc +0 -102
- data/ext/v8/upstream/v8/src/property.h +0 -348
- data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp-inl.h +0 -78
- data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.cc +0 -470
- data/ext/v8/upstream/v8/src/regexp-macro-assembler-irregexp.h +0 -142
- data/ext/v8/upstream/v8/src/regexp-macro-assembler-tracer.cc +0 -373
- data/ext/v8/upstream/v8/src/regexp-macro-assembler-tracer.h +0 -104
- data/ext/v8/upstream/v8/src/regexp-macro-assembler.cc +0 -266
- data/ext/v8/upstream/v8/src/regexp-macro-assembler.h +0 -236
- data/ext/v8/upstream/v8/src/regexp-stack.cc +0 -111
- data/ext/v8/upstream/v8/src/regexp-stack.h +0 -147
- data/ext/v8/upstream/v8/src/regexp.js +0 -483
- data/ext/v8/upstream/v8/src/register-allocator-inl.h +0 -141
- data/ext/v8/upstream/v8/src/register-allocator.cc +0 -98
- data/ext/v8/upstream/v8/src/register-allocator.h +0 -310
- data/ext/v8/upstream/v8/src/rewriter.cc +0 -1024
- data/ext/v8/upstream/v8/src/rewriter.h +0 -59
- data/ext/v8/upstream/v8/src/runtime-profiler.cc +0 -478
- data/ext/v8/upstream/v8/src/runtime-profiler.h +0 -192
- data/ext/v8/upstream/v8/src/runtime.cc +0 -11949
- data/ext/v8/upstream/v8/src/runtime.h +0 -643
- data/ext/v8/upstream/v8/src/runtime.js +0 -643
- data/ext/v8/upstream/v8/src/safepoint-table.cc +0 -256
- data/ext/v8/upstream/v8/src/safepoint-table.h +0 -269
- data/ext/v8/upstream/v8/src/scanner-base.cc +0 -964
- data/ext/v8/upstream/v8/src/scanner-base.h +0 -664
- data/ext/v8/upstream/v8/src/scanner.cc +0 -584
- data/ext/v8/upstream/v8/src/scanner.h +0 -196
- data/ext/v8/upstream/v8/src/scopeinfo.cc +0 -631
- data/ext/v8/upstream/v8/src/scopeinfo.h +0 -249
- data/ext/v8/upstream/v8/src/scopes.cc +0 -1093
- data/ext/v8/upstream/v8/src/scopes.h +0 -508
- data/ext/v8/upstream/v8/src/serialize.cc +0 -1574
- data/ext/v8/upstream/v8/src/serialize.h +0 -589
- data/ext/v8/upstream/v8/src/shell.h +0 -55
- data/ext/v8/upstream/v8/src/simulator.h +0 -43
- data/ext/v8/upstream/v8/src/small-pointer-list.h +0 -163
- data/ext/v8/upstream/v8/src/smart-pointer.h +0 -109
- data/ext/v8/upstream/v8/src/snapshot-common.cc +0 -82
- data/ext/v8/upstream/v8/src/snapshot-empty.cc +0 -50
- data/ext/v8/upstream/v8/src/snapshot.h +0 -73
- data/ext/v8/upstream/v8/src/spaces-inl.h +0 -529
- data/ext/v8/upstream/v8/src/spaces.cc +0 -3147
- data/ext/v8/upstream/v8/src/spaces.h +0 -2368
- data/ext/v8/upstream/v8/src/splay-tree-inl.h +0 -310
- data/ext/v8/upstream/v8/src/splay-tree.h +0 -203
- data/ext/v8/upstream/v8/src/string-search.cc +0 -41
- data/ext/v8/upstream/v8/src/string-search.h +0 -568
- data/ext/v8/upstream/v8/src/string-stream.cc +0 -592
- data/ext/v8/upstream/v8/src/string-stream.h +0 -191
- data/ext/v8/upstream/v8/src/string.js +0 -915
- data/ext/v8/upstream/v8/src/strtod.cc +0 -440
- data/ext/v8/upstream/v8/src/strtod.h +0 -40
- data/ext/v8/upstream/v8/src/stub-cache.cc +0 -1940
- data/ext/v8/upstream/v8/src/stub-cache.h +0 -866
- data/ext/v8/upstream/v8/src/third_party/valgrind/valgrind.h +0 -3925
- data/ext/v8/upstream/v8/src/token.cc +0 -63
- data/ext/v8/upstream/v8/src/token.h +0 -288
- data/ext/v8/upstream/v8/src/top.cc +0 -983
- data/ext/v8/upstream/v8/src/type-info.cc +0 -472
- data/ext/v8/upstream/v8/src/type-info.h +0 -290
- data/ext/v8/upstream/v8/src/unbound-queue-inl.h +0 -95
- data/ext/v8/upstream/v8/src/unbound-queue.h +0 -67
- data/ext/v8/upstream/v8/src/unicode-inl.h +0 -238
- data/ext/v8/upstream/v8/src/unicode.cc +0 -1624
- data/ext/v8/upstream/v8/src/unicode.h +0 -280
- data/ext/v8/upstream/v8/src/uri.js +0 -402
- data/ext/v8/upstream/v8/src/utils.cc +0 -371
- data/ext/v8/upstream/v8/src/utils.h +0 -796
- data/ext/v8/upstream/v8/src/v8-counters.cc +0 -62
- data/ext/v8/upstream/v8/src/v8-counters.h +0 -311
- data/ext/v8/upstream/v8/src/v8.cc +0 -215
- data/ext/v8/upstream/v8/src/v8.h +0 -130
- data/ext/v8/upstream/v8/src/v8checks.h +0 -64
- data/ext/v8/upstream/v8/src/v8dll-main.cc +0 -39
- data/ext/v8/upstream/v8/src/v8globals.h +0 -486
- data/ext/v8/upstream/v8/src/v8memory.h +0 -82
- data/ext/v8/upstream/v8/src/v8natives.js +0 -1293
- data/ext/v8/upstream/v8/src/v8preparserdll-main.cc +0 -39
- data/ext/v8/upstream/v8/src/v8threads.cc +0 -453
- data/ext/v8/upstream/v8/src/v8threads.h +0 -164
- data/ext/v8/upstream/v8/src/v8utils.h +0 -317
- data/ext/v8/upstream/v8/src/variables.cc +0 -132
- data/ext/v8/upstream/v8/src/variables.h +0 -212
- data/ext/v8/upstream/v8/src/version.cc +0 -116
- data/ext/v8/upstream/v8/src/version.h +0 -68
- data/ext/v8/upstream/v8/src/virtual-frame-heavy-inl.h +0 -190
- data/ext/v8/upstream/v8/src/virtual-frame-heavy.cc +0 -312
- data/ext/v8/upstream/v8/src/virtual-frame-inl.h +0 -39
- data/ext/v8/upstream/v8/src/virtual-frame-light-inl.h +0 -171
- data/ext/v8/upstream/v8/src/virtual-frame-light.cc +0 -52
- data/ext/v8/upstream/v8/src/virtual-frame.cc +0 -49
- data/ext/v8/upstream/v8/src/virtual-frame.h +0 -59
- data/ext/v8/upstream/v8/src/vm-state-inl.h +0 -138
- data/ext/v8/upstream/v8/src/vm-state.h +0 -70
- data/ext/v8/upstream/v8/src/win32-headers.h +0 -96
- data/ext/v8/upstream/v8/src/x64/assembler-x64-inl.h +0 -456
- data/ext/v8/upstream/v8/src/x64/assembler-x64.cc +0 -2954
- data/ext/v8/upstream/v8/src/x64/assembler-x64.h +0 -1630
- data/ext/v8/upstream/v8/src/x64/builtins-x64.cc +0 -1493
- data/ext/v8/upstream/v8/src/x64/code-stubs-x64.cc +0 -5132
- data/ext/v8/upstream/v8/src/x64/code-stubs-x64.h +0 -477
- data/ext/v8/upstream/v8/src/x64/codegen-x64-inl.h +0 -46
- data/ext/v8/upstream/v8/src/x64/codegen-x64.cc +0 -8843
- data/ext/v8/upstream/v8/src/x64/codegen-x64.h +0 -753
- data/ext/v8/upstream/v8/src/x64/cpu-x64.cc +0 -88
- data/ext/v8/upstream/v8/src/x64/debug-x64.cc +0 -318
- data/ext/v8/upstream/v8/src/x64/deoptimizer-x64.cc +0 -815
- data/ext/v8/upstream/v8/src/x64/disasm-x64.cc +0 -1752
- data/ext/v8/upstream/v8/src/x64/frames-x64.cc +0 -45
- data/ext/v8/upstream/v8/src/x64/frames-x64.h +0 -130
- data/ext/v8/upstream/v8/src/x64/full-codegen-x64.cc +0 -4339
- data/ext/v8/upstream/v8/src/x64/ic-x64.cc +0 -1752
- data/ext/v8/upstream/v8/src/x64/jump-target-x64.cc +0 -437
- data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.cc +0 -3970
- data/ext/v8/upstream/v8/src/x64/lithium-codegen-x64.h +0 -318
- data/ext/v8/upstream/v8/src/x64/lithium-gap-resolver-x64.cc +0 -320
- data/ext/v8/upstream/v8/src/x64/lithium-gap-resolver-x64.h +0 -74
- data/ext/v8/upstream/v8/src/x64/lithium-x64.cc +0 -2115
- data/ext/v8/upstream/v8/src/x64/lithium-x64.h +0 -2161
- data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.cc +0 -2911
- data/ext/v8/upstream/v8/src/x64/macro-assembler-x64.h +0 -1984
- data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.cc +0 -1398
- data/ext/v8/upstream/v8/src/x64/regexp-macro-assembler-x64.h +0 -282
- data/ext/v8/upstream/v8/src/x64/register-allocator-x64-inl.h +0 -87
- data/ext/v8/upstream/v8/src/x64/register-allocator-x64.cc +0 -95
- data/ext/v8/upstream/v8/src/x64/register-allocator-x64.h +0 -43
- data/ext/v8/upstream/v8/src/x64/simulator-x64.cc +0 -27
- data/ext/v8/upstream/v8/src/x64/simulator-x64.h +0 -71
- data/ext/v8/upstream/v8/src/x64/stub-cache-x64.cc +0 -3460
- data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.cc +0 -1296
- data/ext/v8/upstream/v8/src/x64/virtual-frame-x64.h +0 -597
- data/ext/v8/upstream/v8/src/zone-inl.h +0 -129
- data/ext/v8/upstream/v8/src/zone.cc +0 -196
- data/ext/v8/upstream/v8/src/zone.h +0 -236
- data/ext/v8/upstream/v8/tools/codemap.js +0 -265
- data/ext/v8/upstream/v8/tools/consarray.js +0 -93
- data/ext/v8/upstream/v8/tools/csvparser.js +0 -78
- data/ext/v8/upstream/v8/tools/disasm.py +0 -92
- data/ext/v8/upstream/v8/tools/freebsd-tick-processor +0 -10
- data/ext/v8/upstream/v8/tools/gc-nvp-trace-processor.py +0 -328
- data/ext/v8/upstream/v8/tools/generate-ten-powers.scm +0 -286
- data/ext/v8/upstream/v8/tools/grokdump.py +0 -840
- data/ext/v8/upstream/v8/tools/gyp/v8.gyp +0 -844
- data/ext/v8/upstream/v8/tools/js2c.py +0 -380
- data/ext/v8/upstream/v8/tools/jsmin.py +0 -280
- data/ext/v8/upstream/v8/tools/linux-tick-processor +0 -35
- data/ext/v8/upstream/v8/tools/ll_prof.py +0 -919
- data/ext/v8/upstream/v8/tools/logreader.js +0 -185
- data/ext/v8/upstream/v8/tools/mac-nm +0 -18
- data/ext/v8/upstream/v8/tools/mac-tick-processor +0 -6
- data/ext/v8/upstream/v8/tools/oom_dump/README +0 -31
- data/ext/v8/upstream/v8/tools/oom_dump/SConstruct +0 -42
- data/ext/v8/upstream/v8/tools/oom_dump/oom_dump.cc +0 -288
- data/ext/v8/upstream/v8/tools/presubmit.py +0 -305
- data/ext/v8/upstream/v8/tools/process-heap-prof.py +0 -120
- data/ext/v8/upstream/v8/tools/profile.js +0 -751
- data/ext/v8/upstream/v8/tools/profile_view.js +0 -219
- data/ext/v8/upstream/v8/tools/run-valgrind.py +0 -77
- data/ext/v8/upstream/v8/tools/splaytree.js +0 -316
- data/ext/v8/upstream/v8/tools/stats-viewer.py +0 -468
- data/ext/v8/upstream/v8/tools/test.py +0 -1490
- data/ext/v8/upstream/v8/tools/tickprocessor-driver.js +0 -59
- data/ext/v8/upstream/v8/tools/tickprocessor.js +0 -877
- data/ext/v8/upstream/v8/tools/utils.py +0 -96
- data/ext/v8/upstream/v8/tools/visual_studio/README.txt +0 -70
- data/ext/v8/upstream/v8/tools/visual_studio/arm.vsprops +0 -14
- data/ext/v8/upstream/v8/tools/visual_studio/common.vsprops +0 -34
- data/ext/v8/upstream/v8/tools/visual_studio/d8.vcproj +0 -193
- data/ext/v8/upstream/v8/tools/visual_studio/d8_arm.vcproj +0 -193
- data/ext/v8/upstream/v8/tools/visual_studio/d8_x64.vcproj +0 -209
- data/ext/v8/upstream/v8/tools/visual_studio/d8js2c.cmd +0 -6
- data/ext/v8/upstream/v8/tools/visual_studio/debug.vsprops +0 -17
- data/ext/v8/upstream/v8/tools/visual_studio/ia32.vsprops +0 -17
- data/ext/v8/upstream/v8/tools/visual_studio/js2c.cmd +0 -6
- data/ext/v8/upstream/v8/tools/visual_studio/release.vsprops +0 -24
- data/ext/v8/upstream/v8/tools/visual_studio/v8.sln +0 -101
- data/ext/v8/upstream/v8/tools/visual_studio/v8.vcproj +0 -227
- data/ext/v8/upstream/v8/tools/visual_studio/v8_arm.sln +0 -74
- data/ext/v8/upstream/v8/tools/visual_studio/v8_arm.vcproj +0 -227
- data/ext/v8/upstream/v8/tools/visual_studio/v8_base.vcproj +0 -1308
- data/ext/v8/upstream/v8/tools/visual_studio/v8_base_arm.vcproj +0 -1238
- data/ext/v8/upstream/v8/tools/visual_studio/v8_base_x64.vcproj +0 -1300
- data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest.vcproj +0 -265
- data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest_arm.vcproj +0 -249
- data/ext/v8/upstream/v8/tools/visual_studio/v8_cctest_x64.vcproj +0 -257
- data/ext/v8/upstream/v8/tools/visual_studio/v8_mksnapshot.vcproj +0 -145
- data/ext/v8/upstream/v8/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -145
- data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample.vcproj +0 -145
- data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample_arm.vcproj +0 -145
- data/ext/v8/upstream/v8/tools/visual_studio/v8_process_sample_x64.vcproj +0 -161
- data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample.vcproj +0 -147
- data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -147
- data/ext/v8/upstream/v8/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -163
- data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot.vcproj +0 -142
- data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_cc.vcproj +0 -92
- data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -92
- data/ext/v8/upstream/v8/tools/visual_studio/v8_snapshot_x64.vcproj +0 -142
- data/ext/v8/upstream/v8/tools/visual_studio/v8_x64.sln +0 -101
- data/ext/v8/upstream/v8/tools/visual_studio/v8_x64.vcproj +0 -227
- data/ext/v8/upstream/v8/tools/visual_studio/x64.vsprops +0 -18
- data/ext/v8/upstream/v8/tools/windows-tick-processor.bat +0 -30
@@ -1,140 +0,0 @@
|
|
1
|
-
// Copyright 2010 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
|
-
#ifndef V8_BIGNUM_H_
|
29
|
-
#define V8_BIGNUM_H_
|
30
|
-
|
31
|
-
namespace v8 {
|
32
|
-
namespace internal {
|
33
|
-
|
34
|
-
class Bignum {
|
35
|
-
public:
|
36
|
-
// 3584 = 128 * 28. We can represent 2^3584 > 10^1000 accurately.
|
37
|
-
// This bignum can encode much bigger numbers, since it contains an
|
38
|
-
// exponent.
|
39
|
-
static const int kMaxSignificantBits = 3584;
|
40
|
-
|
41
|
-
Bignum();
|
42
|
-
void AssignUInt16(uint16_t value);
|
43
|
-
void AssignUInt64(uint64_t value);
|
44
|
-
void AssignBignum(const Bignum& other);
|
45
|
-
|
46
|
-
void AssignDecimalString(Vector<const char> value);
|
47
|
-
void AssignHexString(Vector<const char> value);
|
48
|
-
|
49
|
-
void AssignPowerUInt16(uint16_t base, int exponent);
|
50
|
-
|
51
|
-
void AddUInt16(uint16_t operand);
|
52
|
-
void AddUInt64(uint64_t operand);
|
53
|
-
void AddBignum(const Bignum& other);
|
54
|
-
// Precondition: this >= other.
|
55
|
-
void SubtractBignum(const Bignum& other);
|
56
|
-
|
57
|
-
void Square();
|
58
|
-
void ShiftLeft(int shift_amount);
|
59
|
-
void MultiplyByUInt32(uint32_t factor);
|
60
|
-
void MultiplyByUInt64(uint64_t factor);
|
61
|
-
void MultiplyByPowerOfTen(int exponent);
|
62
|
-
void Times10() { return MultiplyByUInt32(10); }
|
63
|
-
// Pseudocode:
|
64
|
-
// int result = this / other;
|
65
|
-
// this = this % other;
|
66
|
-
// In the worst case this function is in O(this/other).
|
67
|
-
uint16_t DivideModuloIntBignum(const Bignum& other);
|
68
|
-
|
69
|
-
bool ToHexString(char* buffer, int buffer_size) const;
|
70
|
-
|
71
|
-
static int Compare(const Bignum& a, const Bignum& b);
|
72
|
-
static bool Equal(const Bignum& a, const Bignum& b) {
|
73
|
-
return Compare(a, b) == 0;
|
74
|
-
}
|
75
|
-
static bool LessEqual(const Bignum& a, const Bignum& b) {
|
76
|
-
return Compare(a, b) <= 0;
|
77
|
-
}
|
78
|
-
static bool Less(const Bignum& a, const Bignum& b) {
|
79
|
-
return Compare(a, b) < 0;
|
80
|
-
}
|
81
|
-
// Returns Compare(a + b, c);
|
82
|
-
static int PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c);
|
83
|
-
// Returns a + b == c
|
84
|
-
static bool PlusEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
|
85
|
-
return PlusCompare(a, b, c) == 0;
|
86
|
-
}
|
87
|
-
// Returns a + b <= c
|
88
|
-
static bool PlusLessEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
|
89
|
-
return PlusCompare(a, b, c) <= 0;
|
90
|
-
}
|
91
|
-
// Returns a + b < c
|
92
|
-
static bool PlusLess(const Bignum& a, const Bignum& b, const Bignum& c) {
|
93
|
-
return PlusCompare(a, b, c) < 0;
|
94
|
-
}
|
95
|
-
private:
|
96
|
-
typedef uint32_t Chunk;
|
97
|
-
typedef uint64_t DoubleChunk;
|
98
|
-
|
99
|
-
static const int kChunkSize = sizeof(Chunk) * 8;
|
100
|
-
static const int kDoubleChunkSize = sizeof(DoubleChunk) * 8;
|
101
|
-
// With bigit size of 28 we loose some bits, but a double still fits easily
|
102
|
-
// into two chunks, and more importantly we can use the Comba multiplication.
|
103
|
-
static const int kBigitSize = 28;
|
104
|
-
static const Chunk kBigitMask = (1 << kBigitSize) - 1;
|
105
|
-
// Every instance allocates kBigitLength chunks on the stack. Bignums cannot
|
106
|
-
// grow. There are no checks if the stack-allocated space is sufficient.
|
107
|
-
static const int kBigitCapacity = kMaxSignificantBits / kBigitSize;
|
108
|
-
|
109
|
-
void EnsureCapacity(int size) {
|
110
|
-
if (size > kBigitCapacity) {
|
111
|
-
UNREACHABLE();
|
112
|
-
}
|
113
|
-
}
|
114
|
-
void Align(const Bignum& other);
|
115
|
-
void Clamp();
|
116
|
-
bool IsClamped() const;
|
117
|
-
void Zero();
|
118
|
-
// Requires this to have enough capacity (no tests done).
|
119
|
-
// Updates used_digits_ if necessary.
|
120
|
-
// by must be < kBigitSize.
|
121
|
-
void BigitsShiftLeft(int shift_amount);
|
122
|
-
// BigitLength includes the "hidden" digits encoded in the exponent.
|
123
|
-
int BigitLength() const { return used_digits_ + exponent_; }
|
124
|
-
Chunk BigitAt(int index) const;
|
125
|
-
void SubtractTimes(const Bignum& other, int factor);
|
126
|
-
|
127
|
-
Chunk bigits_buffer_[kBigitCapacity];
|
128
|
-
// A vector backed by bigits_buffer_. This way accesses to the array are
|
129
|
-
// checked for out-of-bounds errors.
|
130
|
-
Vector<Chunk> bigits_;
|
131
|
-
int used_digits_;
|
132
|
-
// The Bignum's value equals value(bigits_) * 2^(exponent_ * kBigitSize).
|
133
|
-
int exponent_;
|
134
|
-
|
135
|
-
DISALLOW_COPY_AND_ASSIGN(Bignum);
|
136
|
-
};
|
137
|
-
|
138
|
-
} } // namespace v8::internal
|
139
|
-
|
140
|
-
#endif // V8_BIGNUM_H_
|
@@ -1,2138 +0,0 @@
|
|
1
|
-
// Copyright 2006-2008 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
|
-
#include "v8.h"
|
29
|
-
|
30
|
-
#include "accessors.h"
|
31
|
-
#include "api.h"
|
32
|
-
#include "bootstrapper.h"
|
33
|
-
#include "compiler.h"
|
34
|
-
#include "debug.h"
|
35
|
-
#include "execution.h"
|
36
|
-
#include "global-handles.h"
|
37
|
-
#include "macro-assembler.h"
|
38
|
-
#include "natives.h"
|
39
|
-
#include "objects-visiting.h"
|
40
|
-
#include "snapshot.h"
|
41
|
-
#include "extensions/externalize-string-extension.h"
|
42
|
-
#include "extensions/gc-extension.h"
|
43
|
-
|
44
|
-
namespace v8 {
|
45
|
-
namespace internal {
|
46
|
-
|
47
|
-
|
48
|
-
NativesExternalStringResource::NativesExternalStringResource(
|
49
|
-
Bootstrapper* bootstrapper,
|
50
|
-
const char* source)
|
51
|
-
: data_(source), length_(StrLength(source)) {
|
52
|
-
if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) {
|
53
|
-
bootstrapper->delete_these_non_arrays_on_tear_down_ = new List<char*>(2);
|
54
|
-
}
|
55
|
-
// The resources are small objects and we only make a fixed number of
|
56
|
-
// them, but let's clean them up on exit for neatness.
|
57
|
-
bootstrapper->delete_these_non_arrays_on_tear_down_->
|
58
|
-
Add(reinterpret_cast<char*>(this));
|
59
|
-
}
|
60
|
-
|
61
|
-
|
62
|
-
Bootstrapper::Bootstrapper()
|
63
|
-
: nesting_(0),
|
64
|
-
extensions_cache_(Script::TYPE_EXTENSION),
|
65
|
-
delete_these_non_arrays_on_tear_down_(NULL),
|
66
|
-
delete_these_arrays_on_tear_down_(NULL) {
|
67
|
-
}
|
68
|
-
|
69
|
-
|
70
|
-
Handle<String> Bootstrapper::NativesSourceLookup(int index) {
|
71
|
-
ASSERT(0 <= index && index < Natives::GetBuiltinsCount());
|
72
|
-
Isolate* isolate = Isolate::Current();
|
73
|
-
Factory* factory = isolate->factory();
|
74
|
-
Heap* heap = isolate->heap();
|
75
|
-
if (heap->natives_source_cache()->get(index)->IsUndefined()) {
|
76
|
-
if (!Snapshot::IsEnabled() || FLAG_new_snapshot) {
|
77
|
-
// We can use external strings for the natives.
|
78
|
-
NativesExternalStringResource* resource =
|
79
|
-
new NativesExternalStringResource(this,
|
80
|
-
Natives::GetScriptSource(index).start());
|
81
|
-
Handle<String> source_code =
|
82
|
-
factory->NewExternalStringFromAscii(resource);
|
83
|
-
heap->natives_source_cache()->set(index, *source_code);
|
84
|
-
} else {
|
85
|
-
// Old snapshot code can't cope with external strings at all.
|
86
|
-
Handle<String> source_code =
|
87
|
-
factory->NewStringFromAscii(Natives::GetScriptSource(index));
|
88
|
-
heap->natives_source_cache()->set(index, *source_code);
|
89
|
-
}
|
90
|
-
}
|
91
|
-
Handle<Object> cached_source(heap->natives_source_cache()->get(index));
|
92
|
-
return Handle<String>::cast(cached_source);
|
93
|
-
}
|
94
|
-
|
95
|
-
|
96
|
-
void Bootstrapper::Initialize(bool create_heap_objects) {
|
97
|
-
extensions_cache_.Initialize(create_heap_objects);
|
98
|
-
GCExtension::Register();
|
99
|
-
ExternalizeStringExtension::Register();
|
100
|
-
}
|
101
|
-
|
102
|
-
|
103
|
-
char* Bootstrapper::AllocateAutoDeletedArray(int bytes) {
|
104
|
-
char* memory = new char[bytes];
|
105
|
-
if (memory != NULL) {
|
106
|
-
if (delete_these_arrays_on_tear_down_ == NULL) {
|
107
|
-
delete_these_arrays_on_tear_down_ = new List<char*>(2);
|
108
|
-
}
|
109
|
-
delete_these_arrays_on_tear_down_->Add(memory);
|
110
|
-
}
|
111
|
-
return memory;
|
112
|
-
}
|
113
|
-
|
114
|
-
|
115
|
-
void Bootstrapper::TearDown() {
|
116
|
-
if (delete_these_non_arrays_on_tear_down_ != NULL) {
|
117
|
-
int len = delete_these_non_arrays_on_tear_down_->length();
|
118
|
-
ASSERT(len < 20); // Don't use this mechanism for unbounded allocations.
|
119
|
-
for (int i = 0; i < len; i++) {
|
120
|
-
delete delete_these_non_arrays_on_tear_down_->at(i);
|
121
|
-
delete_these_non_arrays_on_tear_down_->at(i) = NULL;
|
122
|
-
}
|
123
|
-
delete delete_these_non_arrays_on_tear_down_;
|
124
|
-
delete_these_non_arrays_on_tear_down_ = NULL;
|
125
|
-
}
|
126
|
-
|
127
|
-
if (delete_these_arrays_on_tear_down_ != NULL) {
|
128
|
-
int len = delete_these_arrays_on_tear_down_->length();
|
129
|
-
ASSERT(len < 1000); // Don't use this mechanism for unbounded allocations.
|
130
|
-
for (int i = 0; i < len; i++) {
|
131
|
-
delete[] delete_these_arrays_on_tear_down_->at(i);
|
132
|
-
delete_these_arrays_on_tear_down_->at(i) = NULL;
|
133
|
-
}
|
134
|
-
delete delete_these_arrays_on_tear_down_;
|
135
|
-
delete_these_arrays_on_tear_down_ = NULL;
|
136
|
-
}
|
137
|
-
|
138
|
-
extensions_cache_.Initialize(false); // Yes, symmetrical
|
139
|
-
}
|
140
|
-
|
141
|
-
|
142
|
-
class Genesis BASE_EMBEDDED {
|
143
|
-
public:
|
144
|
-
Genesis(Handle<Object> global_object,
|
145
|
-
v8::Handle<v8::ObjectTemplate> global_template,
|
146
|
-
v8::ExtensionConfiguration* extensions);
|
147
|
-
~Genesis() { }
|
148
|
-
|
149
|
-
Handle<Context> result() { return result_; }
|
150
|
-
|
151
|
-
Genesis* previous() { return previous_; }
|
152
|
-
|
153
|
-
private:
|
154
|
-
Handle<Context> global_context_;
|
155
|
-
|
156
|
-
// There may be more than one active genesis object: When GC is
|
157
|
-
// triggered during environment creation there may be weak handle
|
158
|
-
// processing callbacks which may create new environments.
|
159
|
-
Genesis* previous_;
|
160
|
-
|
161
|
-
Handle<Context> global_context() { return global_context_; }
|
162
|
-
|
163
|
-
// Creates some basic objects. Used for creating a context from scratch.
|
164
|
-
void CreateRoots();
|
165
|
-
// Creates the empty function. Used for creating a context from scratch.
|
166
|
-
Handle<JSFunction> CreateEmptyFunction();
|
167
|
-
// Creates the ThrowTypeError function. ECMA 5th Ed. 13.2.3
|
168
|
-
Handle<JSFunction> CreateThrowTypeErrorFunction(Builtins::Name builtin);
|
169
|
-
|
170
|
-
void CreateStrictModeFunctionMaps(Handle<JSFunction> empty);
|
171
|
-
// Creates the global objects using the global and the template passed in
|
172
|
-
// through the API. We call this regardless of whether we are building a
|
173
|
-
// context from scratch or using a deserialized one from the partial snapshot
|
174
|
-
// but in the latter case we don't use the objects it produces directly, as
|
175
|
-
// we have to used the deserialized ones that are linked together with the
|
176
|
-
// rest of the context snapshot.
|
177
|
-
Handle<JSGlobalProxy> CreateNewGlobals(
|
178
|
-
v8::Handle<v8::ObjectTemplate> global_template,
|
179
|
-
Handle<Object> global_object,
|
180
|
-
Handle<GlobalObject>* global_proxy_out);
|
181
|
-
// Hooks the given global proxy into the context. If the context was created
|
182
|
-
// by deserialization then this will unhook the global proxy that was
|
183
|
-
// deserialized, leaving the GC to pick it up.
|
184
|
-
void HookUpGlobalProxy(Handle<GlobalObject> inner_global,
|
185
|
-
Handle<JSGlobalProxy> global_proxy);
|
186
|
-
// Similarly, we want to use the inner global that has been created by the
|
187
|
-
// templates passed through the API. The inner global from the snapshot is
|
188
|
-
// detached from the other objects in the snapshot.
|
189
|
-
void HookUpInnerGlobal(Handle<GlobalObject> inner_global);
|
190
|
-
// New context initialization. Used for creating a context from scratch.
|
191
|
-
void InitializeGlobal(Handle<GlobalObject> inner_global,
|
192
|
-
Handle<JSFunction> empty_function);
|
193
|
-
// Installs the contents of the native .js files on the global objects.
|
194
|
-
// Used for creating a context from scratch.
|
195
|
-
void InstallNativeFunctions();
|
196
|
-
bool InstallNatives();
|
197
|
-
void InstallBuiltinFunctionIds();
|
198
|
-
void InstallJSFunctionResultCaches();
|
199
|
-
void InitializeNormalizedMapCaches();
|
200
|
-
// Used both for deserialized and from-scratch contexts to add the extensions
|
201
|
-
// provided.
|
202
|
-
static bool InstallExtensions(Handle<Context> global_context,
|
203
|
-
v8::ExtensionConfiguration* extensions);
|
204
|
-
static bool InstallExtension(const char* name);
|
205
|
-
static bool InstallExtension(v8::RegisteredExtension* current);
|
206
|
-
static void InstallSpecialObjects(Handle<Context> global_context);
|
207
|
-
bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins);
|
208
|
-
bool ConfigureApiObject(Handle<JSObject> object,
|
209
|
-
Handle<ObjectTemplateInfo> object_template);
|
210
|
-
bool ConfigureGlobalObjects(v8::Handle<v8::ObjectTemplate> global_template);
|
211
|
-
|
212
|
-
// Migrates all properties from the 'from' object to the 'to'
|
213
|
-
// object and overrides the prototype in 'to' with the one from
|
214
|
-
// 'from'.
|
215
|
-
void TransferObject(Handle<JSObject> from, Handle<JSObject> to);
|
216
|
-
void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to);
|
217
|
-
void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to);
|
218
|
-
|
219
|
-
enum PrototypePropertyMode {
|
220
|
-
DONT_ADD_PROTOTYPE,
|
221
|
-
ADD_READONLY_PROTOTYPE,
|
222
|
-
ADD_WRITEABLE_PROTOTYPE
|
223
|
-
};
|
224
|
-
|
225
|
-
Handle<Map> CreateFunctionMap(PrototypePropertyMode prototype_mode);
|
226
|
-
|
227
|
-
Handle<DescriptorArray> ComputeFunctionInstanceDescriptor(
|
228
|
-
PrototypePropertyMode prototypeMode);
|
229
|
-
void MakeFunctionInstancePrototypeWritable();
|
230
|
-
|
231
|
-
Handle<Map> CreateStrictModeFunctionMap(
|
232
|
-
PrototypePropertyMode prototype_mode,
|
233
|
-
Handle<JSFunction> empty_function,
|
234
|
-
Handle<FixedArray> arguments_callbacks,
|
235
|
-
Handle<FixedArray> caller_callbacks);
|
236
|
-
|
237
|
-
Handle<DescriptorArray> ComputeStrictFunctionInstanceDescriptor(
|
238
|
-
PrototypePropertyMode propertyMode,
|
239
|
-
Handle<FixedArray> arguments,
|
240
|
-
Handle<FixedArray> caller);
|
241
|
-
|
242
|
-
static bool CompileBuiltin(int index);
|
243
|
-
static bool CompileNative(Vector<const char> name, Handle<String> source);
|
244
|
-
static bool CompileScriptCached(Vector<const char> name,
|
245
|
-
Handle<String> source,
|
246
|
-
SourceCodeCache* cache,
|
247
|
-
v8::Extension* extension,
|
248
|
-
Handle<Context> top_context,
|
249
|
-
bool use_runtime_context);
|
250
|
-
|
251
|
-
Handle<Context> result_;
|
252
|
-
|
253
|
-
// Function instance maps. Function literal maps are created initially with
|
254
|
-
// a read only prototype for the processing of JS builtins. Later the function
|
255
|
-
// instance maps are replaced in order to make prototype writable.
|
256
|
-
// These are the final, writable prototype, maps.
|
257
|
-
Handle<Map> function_instance_map_writable_prototype_;
|
258
|
-
Handle<Map> strict_mode_function_instance_map_writable_prototype_;
|
259
|
-
|
260
|
-
BootstrapperActive active_;
|
261
|
-
friend class Bootstrapper;
|
262
|
-
};
|
263
|
-
|
264
|
-
|
265
|
-
void Bootstrapper::Iterate(ObjectVisitor* v) {
|
266
|
-
extensions_cache_.Iterate(v);
|
267
|
-
v->Synchronize("Extensions");
|
268
|
-
}
|
269
|
-
|
270
|
-
|
271
|
-
Handle<Context> Bootstrapper::CreateEnvironment(
|
272
|
-
Handle<Object> global_object,
|
273
|
-
v8::Handle<v8::ObjectTemplate> global_template,
|
274
|
-
v8::ExtensionConfiguration* extensions) {
|
275
|
-
HandleScope scope;
|
276
|
-
Handle<Context> env;
|
277
|
-
Genesis genesis(global_object, global_template, extensions);
|
278
|
-
env = genesis.result();
|
279
|
-
if (!env.is_null()) {
|
280
|
-
if (InstallExtensions(env, extensions)) {
|
281
|
-
return env;
|
282
|
-
}
|
283
|
-
}
|
284
|
-
return Handle<Context>();
|
285
|
-
}
|
286
|
-
|
287
|
-
|
288
|
-
static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) {
|
289
|
-
// object.__proto__ = proto;
|
290
|
-
Handle<Map> old_to_map = Handle<Map>(object->map());
|
291
|
-
Handle<Map> new_to_map = FACTORY->CopyMapDropTransitions(old_to_map);
|
292
|
-
new_to_map->set_prototype(*proto);
|
293
|
-
object->set_map(*new_to_map);
|
294
|
-
}
|
295
|
-
|
296
|
-
|
297
|
-
void Bootstrapper::DetachGlobal(Handle<Context> env) {
|
298
|
-
Factory* factory = Isolate::Current()->factory();
|
299
|
-
JSGlobalProxy::cast(env->global_proxy())->set_context(*factory->null_value());
|
300
|
-
SetObjectPrototype(Handle<JSObject>(env->global_proxy()),
|
301
|
-
factory->null_value());
|
302
|
-
env->set_global_proxy(env->global());
|
303
|
-
env->global()->set_global_receiver(env->global());
|
304
|
-
}
|
305
|
-
|
306
|
-
|
307
|
-
void Bootstrapper::ReattachGlobal(Handle<Context> env,
|
308
|
-
Handle<Object> global_object) {
|
309
|
-
ASSERT(global_object->IsJSGlobalProxy());
|
310
|
-
Handle<JSGlobalProxy> global = Handle<JSGlobalProxy>::cast(global_object);
|
311
|
-
env->global()->set_global_receiver(*global);
|
312
|
-
env->set_global_proxy(*global);
|
313
|
-
SetObjectPrototype(global, Handle<JSObject>(env->global()));
|
314
|
-
global->set_context(*env);
|
315
|
-
}
|
316
|
-
|
317
|
-
|
318
|
-
static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
|
319
|
-
const char* name,
|
320
|
-
InstanceType type,
|
321
|
-
int instance_size,
|
322
|
-
Handle<JSObject> prototype,
|
323
|
-
Builtins::Name call,
|
324
|
-
bool is_ecma_native) {
|
325
|
-
Isolate* isolate = Isolate::Current();
|
326
|
-
Factory* factory = isolate->factory();
|
327
|
-
Handle<String> symbol = factory->LookupAsciiSymbol(name);
|
328
|
-
Handle<Code> call_code = Handle<Code>(isolate->builtins()->builtin(call));
|
329
|
-
Handle<JSFunction> function = prototype.is_null() ?
|
330
|
-
factory->NewFunctionWithoutPrototype(symbol, call_code) :
|
331
|
-
factory->NewFunctionWithPrototype(symbol,
|
332
|
-
type,
|
333
|
-
instance_size,
|
334
|
-
prototype,
|
335
|
-
call_code,
|
336
|
-
is_ecma_native);
|
337
|
-
SetLocalPropertyNoThrow(target, symbol, function, DONT_ENUM);
|
338
|
-
if (is_ecma_native) {
|
339
|
-
function->shared()->set_instance_class_name(*symbol);
|
340
|
-
}
|
341
|
-
return function;
|
342
|
-
}
|
343
|
-
|
344
|
-
|
345
|
-
Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor(
|
346
|
-
PrototypePropertyMode prototypeMode) {
|
347
|
-
Factory* factory = Isolate::Current()->factory();
|
348
|
-
Handle<DescriptorArray> descriptors =
|
349
|
-
factory->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE ? 4 : 5);
|
350
|
-
PropertyAttributes attributes =
|
351
|
-
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
|
352
|
-
|
353
|
-
{ // Add length.
|
354
|
-
Handle<Proxy> proxy = factory->NewProxy(&Accessors::FunctionLength);
|
355
|
-
CallbacksDescriptor d(*factory->length_symbol(), *proxy, attributes);
|
356
|
-
descriptors->Set(0, &d);
|
357
|
-
}
|
358
|
-
{ // Add name.
|
359
|
-
Handle<Proxy> proxy = factory->NewProxy(&Accessors::FunctionName);
|
360
|
-
CallbacksDescriptor d(*factory->name_symbol(), *proxy, attributes);
|
361
|
-
descriptors->Set(1, &d);
|
362
|
-
}
|
363
|
-
{ // Add arguments.
|
364
|
-
Handle<Proxy> proxy = factory->NewProxy(&Accessors::FunctionArguments);
|
365
|
-
CallbacksDescriptor d(*factory->arguments_symbol(), *proxy, attributes);
|
366
|
-
descriptors->Set(2, &d);
|
367
|
-
}
|
368
|
-
{ // Add caller.
|
369
|
-
Handle<Proxy> proxy = factory->NewProxy(&Accessors::FunctionCaller);
|
370
|
-
CallbacksDescriptor d(*factory->caller_symbol(), *proxy, attributes);
|
371
|
-
descriptors->Set(3, &d);
|
372
|
-
}
|
373
|
-
if (prototypeMode != DONT_ADD_PROTOTYPE) {
|
374
|
-
// Add prototype.
|
375
|
-
if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
|
376
|
-
attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY);
|
377
|
-
}
|
378
|
-
Handle<Proxy> proxy = factory->NewProxy(&Accessors::FunctionPrototype);
|
379
|
-
CallbacksDescriptor d(*factory->prototype_symbol(), *proxy, attributes);
|
380
|
-
descriptors->Set(4, &d);
|
381
|
-
}
|
382
|
-
descriptors->Sort();
|
383
|
-
return descriptors;
|
384
|
-
}
|
385
|
-
|
386
|
-
|
387
|
-
Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) {
|
388
|
-
Handle<Map> map = FACTORY->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
|
389
|
-
Handle<DescriptorArray> descriptors =
|
390
|
-
ComputeFunctionInstanceDescriptor(prototype_mode);
|
391
|
-
map->set_instance_descriptors(*descriptors);
|
392
|
-
map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE);
|
393
|
-
return map;
|
394
|
-
}
|
395
|
-
|
396
|
-
|
397
|
-
Handle<JSFunction> Genesis::CreateEmptyFunction() {
|
398
|
-
// Allocate the map for function instances. Maps are allocated first and their
|
399
|
-
// prototypes patched later, once empty function is created.
|
400
|
-
|
401
|
-
// Please note that the prototype property for function instances must be
|
402
|
-
// writable.
|
403
|
-
Handle<Map> function_instance_map =
|
404
|
-
CreateFunctionMap(ADD_WRITEABLE_PROTOTYPE);
|
405
|
-
global_context()->set_function_instance_map(*function_instance_map);
|
406
|
-
|
407
|
-
// Functions with this map will not have a 'prototype' property, and
|
408
|
-
// can not be used as constructors.
|
409
|
-
Handle<Map> function_without_prototype_map =
|
410
|
-
CreateFunctionMap(DONT_ADD_PROTOTYPE);
|
411
|
-
global_context()->set_function_without_prototype_map(
|
412
|
-
*function_without_prototype_map);
|
413
|
-
|
414
|
-
// Allocate the function map. This map is temporary, used only for processing
|
415
|
-
// of builtins.
|
416
|
-
// Later the map is replaced with writable prototype map, allocated below.
|
417
|
-
Handle<Map> function_map = CreateFunctionMap(ADD_READONLY_PROTOTYPE);
|
418
|
-
global_context()->set_function_map(*function_map);
|
419
|
-
|
420
|
-
// The final map for functions. Writeable prototype.
|
421
|
-
// This map is installed in MakeFunctionInstancePrototypeWritable.
|
422
|
-
function_instance_map_writable_prototype_ =
|
423
|
-
CreateFunctionMap(ADD_WRITEABLE_PROTOTYPE);
|
424
|
-
|
425
|
-
Isolate* isolate = Isolate::Current();
|
426
|
-
Factory* factory = isolate->factory();
|
427
|
-
Heap* heap = isolate->heap();
|
428
|
-
|
429
|
-
Handle<String> object_name = Handle<String>(heap->Object_symbol());
|
430
|
-
|
431
|
-
{ // --- O b j e c t ---
|
432
|
-
Handle<JSFunction> object_fun =
|
433
|
-
factory->NewFunction(object_name, factory->null_value());
|
434
|
-
Handle<Map> object_function_map =
|
435
|
-
factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
436
|
-
object_fun->set_initial_map(*object_function_map);
|
437
|
-
object_function_map->set_constructor(*object_fun);
|
438
|
-
|
439
|
-
global_context()->set_object_function(*object_fun);
|
440
|
-
|
441
|
-
// Allocate a new prototype for the object function.
|
442
|
-
Handle<JSObject> prototype = factory->NewJSObject(
|
443
|
-
isolate->object_function(),
|
444
|
-
TENURED);
|
445
|
-
|
446
|
-
global_context()->set_initial_object_prototype(*prototype);
|
447
|
-
SetPrototype(object_fun, prototype);
|
448
|
-
object_function_map->
|
449
|
-
set_instance_descriptors(heap->empty_descriptor_array());
|
450
|
-
}
|
451
|
-
|
452
|
-
// Allocate the empty function as the prototype for function ECMAScript
|
453
|
-
// 262 15.3.4.
|
454
|
-
Handle<String> symbol = factory->LookupAsciiSymbol("Empty");
|
455
|
-
Handle<JSFunction> empty_function =
|
456
|
-
factory->NewFunctionWithoutPrototype(symbol, kNonStrictMode);
|
457
|
-
|
458
|
-
// --- E m p t y ---
|
459
|
-
Handle<Code> code =
|
460
|
-
Handle<Code>(isolate->builtins()->builtin(
|
461
|
-
Builtins::kEmptyFunction));
|
462
|
-
empty_function->set_code(*code);
|
463
|
-
empty_function->shared()->set_code(*code);
|
464
|
-
Handle<String> source = factory->NewStringFromAscii(CStrVector("() {}"));
|
465
|
-
Handle<Script> script = factory->NewScript(source);
|
466
|
-
script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
|
467
|
-
empty_function->shared()->set_script(*script);
|
468
|
-
empty_function->shared()->set_start_position(0);
|
469
|
-
empty_function->shared()->set_end_position(source->length());
|
470
|
-
empty_function->shared()->DontAdaptArguments();
|
471
|
-
|
472
|
-
// Set prototypes for the function maps.
|
473
|
-
global_context()->function_map()->set_prototype(*empty_function);
|
474
|
-
global_context()->function_instance_map()->set_prototype(*empty_function);
|
475
|
-
global_context()->function_without_prototype_map()->
|
476
|
-
set_prototype(*empty_function);
|
477
|
-
function_instance_map_writable_prototype_->set_prototype(*empty_function);
|
478
|
-
|
479
|
-
// Allocate the function map first and then patch the prototype later
|
480
|
-
Handle<Map> empty_fm = factory->CopyMapDropDescriptors(
|
481
|
-
function_without_prototype_map);
|
482
|
-
empty_fm->set_instance_descriptors(
|
483
|
-
function_without_prototype_map->instance_descriptors());
|
484
|
-
empty_fm->set_prototype(global_context()->object_function()->prototype());
|
485
|
-
empty_function->set_map(*empty_fm);
|
486
|
-
return empty_function;
|
487
|
-
}
|
488
|
-
|
489
|
-
|
490
|
-
Handle<DescriptorArray> Genesis::ComputeStrictFunctionInstanceDescriptor(
|
491
|
-
PrototypePropertyMode prototypeMode,
|
492
|
-
Handle<FixedArray> arguments,
|
493
|
-
Handle<FixedArray> caller) {
|
494
|
-
Factory* factory = Isolate::Current()->factory();
|
495
|
-
Handle<DescriptorArray> descriptors =
|
496
|
-
factory->NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE ? 4 : 5);
|
497
|
-
PropertyAttributes attributes = static_cast<PropertyAttributes>(
|
498
|
-
DONT_ENUM | DONT_DELETE | READ_ONLY);
|
499
|
-
|
500
|
-
{ // length
|
501
|
-
Handle<Proxy> proxy = factory->NewProxy(&Accessors::FunctionLength);
|
502
|
-
CallbacksDescriptor d(*factory->length_symbol(), *proxy, attributes);
|
503
|
-
descriptors->Set(0, &d);
|
504
|
-
}
|
505
|
-
{ // name
|
506
|
-
Handle<Proxy> proxy = factory->NewProxy(&Accessors::FunctionName);
|
507
|
-
CallbacksDescriptor d(*factory->name_symbol(), *proxy, attributes);
|
508
|
-
descriptors->Set(1, &d);
|
509
|
-
}
|
510
|
-
{ // arguments
|
511
|
-
CallbacksDescriptor d(*factory->arguments_symbol(), *arguments, attributes);
|
512
|
-
descriptors->Set(2, &d);
|
513
|
-
}
|
514
|
-
{ // caller
|
515
|
-
CallbacksDescriptor d(*factory->caller_symbol(), *caller, attributes);
|
516
|
-
descriptors->Set(3, &d);
|
517
|
-
}
|
518
|
-
|
519
|
-
// prototype
|
520
|
-
if (prototypeMode != DONT_ADD_PROTOTYPE) {
|
521
|
-
if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
|
522
|
-
attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY);
|
523
|
-
}
|
524
|
-
Handle<Proxy> proxy = factory->NewProxy(&Accessors::FunctionPrototype);
|
525
|
-
CallbacksDescriptor d(*factory->prototype_symbol(), *proxy, attributes);
|
526
|
-
descriptors->Set(4, &d);
|
527
|
-
}
|
528
|
-
|
529
|
-
descriptors->Sort();
|
530
|
-
return descriptors;
|
531
|
-
}
|
532
|
-
|
533
|
-
|
534
|
-
// ECMAScript 5th Edition, 13.2.3
|
535
|
-
Handle<JSFunction> Genesis::CreateThrowTypeErrorFunction(
|
536
|
-
Builtins::Name builtin) {
|
537
|
-
Isolate* isolate = Isolate::Current();
|
538
|
-
Factory* factory = isolate->factory();
|
539
|
-
|
540
|
-
Handle<String> name = factory->LookupAsciiSymbol("ThrowTypeError");
|
541
|
-
Handle<JSFunction> throw_type_error =
|
542
|
-
factory->NewFunctionWithoutPrototype(name, kStrictMode);
|
543
|
-
Handle<Code> code = Handle<Code>(
|
544
|
-
isolate->builtins()->builtin(builtin));
|
545
|
-
|
546
|
-
throw_type_error->set_map(global_context()->strict_mode_function_map());
|
547
|
-
throw_type_error->set_code(*code);
|
548
|
-
throw_type_error->shared()->set_code(*code);
|
549
|
-
throw_type_error->shared()->DontAdaptArguments();
|
550
|
-
|
551
|
-
PreventExtensions(throw_type_error);
|
552
|
-
|
553
|
-
return throw_type_error;
|
554
|
-
}
|
555
|
-
|
556
|
-
|
557
|
-
Handle<Map> Genesis::CreateStrictModeFunctionMap(
|
558
|
-
PrototypePropertyMode prototype_mode,
|
559
|
-
Handle<JSFunction> empty_function,
|
560
|
-
Handle<FixedArray> arguments_callbacks,
|
561
|
-
Handle<FixedArray> caller_callbacks) {
|
562
|
-
Handle<Map> map = FACTORY->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
|
563
|
-
Handle<DescriptorArray> descriptors =
|
564
|
-
ComputeStrictFunctionInstanceDescriptor(prototype_mode,
|
565
|
-
arguments_callbacks,
|
566
|
-
caller_callbacks);
|
567
|
-
map->set_instance_descriptors(*descriptors);
|
568
|
-
map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE);
|
569
|
-
map->set_prototype(*empty_function);
|
570
|
-
return map;
|
571
|
-
}
|
572
|
-
|
573
|
-
|
574
|
-
void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) {
|
575
|
-
// Create the callbacks arrays for ThrowTypeError functions.
|
576
|
-
// The get/set callacks are filled in after the maps are created below.
|
577
|
-
Factory* factory = Isolate::Current()->factory();
|
578
|
-
Handle<FixedArray> arguments = factory->NewFixedArray(2, TENURED);
|
579
|
-
Handle<FixedArray> caller = factory->NewFixedArray(2, TENURED);
|
580
|
-
|
581
|
-
// Allocate map for the strict mode function instances.
|
582
|
-
Handle<Map> strict_mode_function_instance_map =
|
583
|
-
CreateStrictModeFunctionMap(
|
584
|
-
ADD_WRITEABLE_PROTOTYPE, empty, arguments, caller);
|
585
|
-
global_context()->set_strict_mode_function_instance_map(
|
586
|
-
*strict_mode_function_instance_map);
|
587
|
-
|
588
|
-
// Allocate map for the prototype-less strict mode instances.
|
589
|
-
Handle<Map> strict_mode_function_without_prototype_map =
|
590
|
-
CreateStrictModeFunctionMap(
|
591
|
-
DONT_ADD_PROTOTYPE, empty, arguments, caller);
|
592
|
-
global_context()->set_strict_mode_function_without_prototype_map(
|
593
|
-
*strict_mode_function_without_prototype_map);
|
594
|
-
|
595
|
-
// Allocate map for the strict mode functions. This map is temporary, used
|
596
|
-
// only for processing of builtins.
|
597
|
-
// Later the map is replaced with writable prototype map, allocated below.
|
598
|
-
Handle<Map> strict_mode_function_map =
|
599
|
-
CreateStrictModeFunctionMap(
|
600
|
-
ADD_READONLY_PROTOTYPE, empty, arguments, caller);
|
601
|
-
global_context()->set_strict_mode_function_map(
|
602
|
-
*strict_mode_function_map);
|
603
|
-
|
604
|
-
// The final map for the strict mode functions. Writeable prototype.
|
605
|
-
// This map is installed in MakeFunctionInstancePrototypeWritable.
|
606
|
-
strict_mode_function_instance_map_writable_prototype_ =
|
607
|
-
CreateStrictModeFunctionMap(
|
608
|
-
ADD_WRITEABLE_PROTOTYPE, empty, arguments, caller);
|
609
|
-
|
610
|
-
// Create the ThrowTypeError function instances.
|
611
|
-
Handle<JSFunction> arguments_throw =
|
612
|
-
CreateThrowTypeErrorFunction(Builtins::kStrictFunctionArguments);
|
613
|
-
Handle<JSFunction> caller_throw =
|
614
|
-
CreateThrowTypeErrorFunction(Builtins::kStrictFunctionCaller);
|
615
|
-
|
616
|
-
// Complete the callback fixed arrays.
|
617
|
-
arguments->set(0, *arguments_throw);
|
618
|
-
arguments->set(1, *arguments_throw);
|
619
|
-
caller->set(0, *caller_throw);
|
620
|
-
caller->set(1, *caller_throw);
|
621
|
-
}
|
622
|
-
|
623
|
-
|
624
|
-
static void AddToWeakGlobalContextList(Context* context) {
|
625
|
-
ASSERT(context->IsGlobalContext());
|
626
|
-
Heap* heap = Isolate::Current()->heap();
|
627
|
-
#ifdef DEBUG
|
628
|
-
{ // NOLINT
|
629
|
-
ASSERT(context->get(Context::NEXT_CONTEXT_LINK)->IsUndefined());
|
630
|
-
// Check that context is not in the list yet.
|
631
|
-
for (Object* current = heap->global_contexts_list();
|
632
|
-
!current->IsUndefined();
|
633
|
-
current = Context::cast(current)->get(Context::NEXT_CONTEXT_LINK)) {
|
634
|
-
ASSERT(current != context);
|
635
|
-
}
|
636
|
-
}
|
637
|
-
#endif
|
638
|
-
context->set(Context::NEXT_CONTEXT_LINK, heap->global_contexts_list());
|
639
|
-
heap->set_global_contexts_list(context);
|
640
|
-
}
|
641
|
-
|
642
|
-
|
643
|
-
void Genesis::CreateRoots() {
|
644
|
-
Isolate* isolate = Isolate::Current();
|
645
|
-
// Allocate the global context FixedArray first and then patch the
|
646
|
-
// closure and extension object later (we need the empty function
|
647
|
-
// and the global object, but in order to create those, we need the
|
648
|
-
// global context).
|
649
|
-
global_context_ = Handle<Context>::cast(isolate->global_handles()->Create(
|
650
|
-
*isolate->factory()->NewGlobalContext()));
|
651
|
-
AddToWeakGlobalContextList(*global_context_);
|
652
|
-
isolate->set_context(*global_context());
|
653
|
-
|
654
|
-
// Allocate the message listeners object.
|
655
|
-
{
|
656
|
-
v8::NeanderArray listeners;
|
657
|
-
global_context()->set_message_listeners(*listeners.value());
|
658
|
-
}
|
659
|
-
}
|
660
|
-
|
661
|
-
|
662
|
-
Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
|
663
|
-
v8::Handle<v8::ObjectTemplate> global_template,
|
664
|
-
Handle<Object> global_object,
|
665
|
-
Handle<GlobalObject>* inner_global_out) {
|
666
|
-
// The argument global_template aka data is an ObjectTemplateInfo.
|
667
|
-
// It has a constructor pointer that points at global_constructor which is a
|
668
|
-
// FunctionTemplateInfo.
|
669
|
-
// The global_constructor is used to create or reinitialize the global_proxy.
|
670
|
-
// The global_constructor also has a prototype_template pointer that points at
|
671
|
-
// js_global_template which is an ObjectTemplateInfo.
|
672
|
-
// That in turn has a constructor pointer that points at
|
673
|
-
// js_global_constructor which is a FunctionTemplateInfo.
|
674
|
-
// js_global_constructor is used to make js_global_function
|
675
|
-
// js_global_function is used to make the new inner_global.
|
676
|
-
//
|
677
|
-
// --- G l o b a l ---
|
678
|
-
// Step 1: Create a fresh inner JSGlobalObject.
|
679
|
-
Handle<JSFunction> js_global_function;
|
680
|
-
Handle<ObjectTemplateInfo> js_global_template;
|
681
|
-
if (!global_template.IsEmpty()) {
|
682
|
-
// Get prototype template of the global_template.
|
683
|
-
Handle<ObjectTemplateInfo> data =
|
684
|
-
v8::Utils::OpenHandle(*global_template);
|
685
|
-
Handle<FunctionTemplateInfo> global_constructor =
|
686
|
-
Handle<FunctionTemplateInfo>(
|
687
|
-
FunctionTemplateInfo::cast(data->constructor()));
|
688
|
-
Handle<Object> proto_template(global_constructor->prototype_template());
|
689
|
-
if (!proto_template->IsUndefined()) {
|
690
|
-
js_global_template =
|
691
|
-
Handle<ObjectTemplateInfo>::cast(proto_template);
|
692
|
-
}
|
693
|
-
}
|
694
|
-
|
695
|
-
Isolate* isolate = Isolate::Current();
|
696
|
-
Factory* factory = isolate->factory();
|
697
|
-
Heap* heap = isolate->heap();
|
698
|
-
|
699
|
-
if (js_global_template.is_null()) {
|
700
|
-
Handle<String> name = Handle<String>(heap->empty_symbol());
|
701
|
-
Handle<Code> code = Handle<Code>(isolate->builtins()->builtin(
|
702
|
-
Builtins::kIllegal));
|
703
|
-
js_global_function =
|
704
|
-
factory->NewFunction(name, JS_GLOBAL_OBJECT_TYPE,
|
705
|
-
JSGlobalObject::kSize, code, true);
|
706
|
-
// Change the constructor property of the prototype of the
|
707
|
-
// hidden global function to refer to the Object function.
|
708
|
-
Handle<JSObject> prototype =
|
709
|
-
Handle<JSObject>(
|
710
|
-
JSObject::cast(js_global_function->instance_prototype()));
|
711
|
-
SetLocalPropertyNoThrow(
|
712
|
-
prototype,
|
713
|
-
factory->constructor_symbol(),
|
714
|
-
isolate->object_function(),
|
715
|
-
NONE);
|
716
|
-
} else {
|
717
|
-
Handle<FunctionTemplateInfo> js_global_constructor(
|
718
|
-
FunctionTemplateInfo::cast(js_global_template->constructor()));
|
719
|
-
js_global_function =
|
720
|
-
factory->CreateApiFunction(js_global_constructor,
|
721
|
-
factory->InnerGlobalObject);
|
722
|
-
}
|
723
|
-
|
724
|
-
js_global_function->initial_map()->set_is_hidden_prototype();
|
725
|
-
Handle<GlobalObject> inner_global =
|
726
|
-
factory->NewGlobalObject(js_global_function);
|
727
|
-
if (inner_global_out != NULL) {
|
728
|
-
*inner_global_out = inner_global;
|
729
|
-
}
|
730
|
-
|
731
|
-
// Step 2: create or re-initialize the global proxy object.
|
732
|
-
Handle<JSFunction> global_proxy_function;
|
733
|
-
if (global_template.IsEmpty()) {
|
734
|
-
Handle<String> name = Handle<String>(heap->empty_symbol());
|
735
|
-
Handle<Code> code = Handle<Code>(isolate->builtins()->builtin(
|
736
|
-
Builtins::kIllegal));
|
737
|
-
global_proxy_function =
|
738
|
-
factory->NewFunction(name, JS_GLOBAL_PROXY_TYPE,
|
739
|
-
JSGlobalProxy::kSize, code, true);
|
740
|
-
} else {
|
741
|
-
Handle<ObjectTemplateInfo> data =
|
742
|
-
v8::Utils::OpenHandle(*global_template);
|
743
|
-
Handle<FunctionTemplateInfo> global_constructor(
|
744
|
-
FunctionTemplateInfo::cast(data->constructor()));
|
745
|
-
global_proxy_function =
|
746
|
-
factory->CreateApiFunction(global_constructor,
|
747
|
-
factory->OuterGlobalObject);
|
748
|
-
}
|
749
|
-
|
750
|
-
Handle<String> global_name = factory->LookupAsciiSymbol("global");
|
751
|
-
global_proxy_function->shared()->set_instance_class_name(*global_name);
|
752
|
-
global_proxy_function->initial_map()->set_is_access_check_needed(true);
|
753
|
-
|
754
|
-
// Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects
|
755
|
-
// Return the global proxy.
|
756
|
-
|
757
|
-
if (global_object.location() != NULL) {
|
758
|
-
ASSERT(global_object->IsJSGlobalProxy());
|
759
|
-
return ReinitializeJSGlobalProxy(
|
760
|
-
global_proxy_function,
|
761
|
-
Handle<JSGlobalProxy>::cast(global_object));
|
762
|
-
} else {
|
763
|
-
return Handle<JSGlobalProxy>::cast(
|
764
|
-
factory->NewJSObject(global_proxy_function, TENURED));
|
765
|
-
}
|
766
|
-
}
|
767
|
-
|
768
|
-
|
769
|
-
void Genesis::HookUpGlobalProxy(Handle<GlobalObject> inner_global,
|
770
|
-
Handle<JSGlobalProxy> global_proxy) {
|
771
|
-
// Set the global context for the global object.
|
772
|
-
inner_global->set_global_context(*global_context());
|
773
|
-
inner_global->set_global_receiver(*global_proxy);
|
774
|
-
global_proxy->set_context(*global_context());
|
775
|
-
global_context()->set_global_proxy(*global_proxy);
|
776
|
-
}
|
777
|
-
|
778
|
-
|
779
|
-
void Genesis::HookUpInnerGlobal(Handle<GlobalObject> inner_global) {
|
780
|
-
Handle<GlobalObject> inner_global_from_snapshot(
|
781
|
-
GlobalObject::cast(global_context_->extension()));
|
782
|
-
Handle<JSBuiltinsObject> builtins_global(global_context_->builtins());
|
783
|
-
global_context_->set_extension(*inner_global);
|
784
|
-
global_context_->set_global(*inner_global);
|
785
|
-
global_context_->set_security_token(*inner_global);
|
786
|
-
static const PropertyAttributes attributes =
|
787
|
-
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
|
788
|
-
ForceSetProperty(builtins_global,
|
789
|
-
FACTORY->LookupAsciiSymbol("global"),
|
790
|
-
inner_global,
|
791
|
-
attributes);
|
792
|
-
// Setup the reference from the global object to the builtins object.
|
793
|
-
JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global);
|
794
|
-
TransferNamedProperties(inner_global_from_snapshot, inner_global);
|
795
|
-
TransferIndexedProperties(inner_global_from_snapshot, inner_global);
|
796
|
-
}
|
797
|
-
|
798
|
-
|
799
|
-
// This is only called if we are not using snapshots. The equivalent
|
800
|
-
// work in the snapshot case is done in HookUpInnerGlobal.
|
801
|
-
void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
802
|
-
Handle<JSFunction> empty_function) {
|
803
|
-
// --- G l o b a l C o n t e x t ---
|
804
|
-
// Use the empty function as closure (no scope info).
|
805
|
-
global_context()->set_closure(*empty_function);
|
806
|
-
global_context()->set_fcontext(*global_context());
|
807
|
-
global_context()->set_previous(NULL);
|
808
|
-
// Set extension and global object.
|
809
|
-
global_context()->set_extension(*inner_global);
|
810
|
-
global_context()->set_global(*inner_global);
|
811
|
-
// Security setup: Set the security token of the global object to
|
812
|
-
// its the inner global. This makes the security check between two
|
813
|
-
// different contexts fail by default even in case of global
|
814
|
-
// object reinitialization.
|
815
|
-
global_context()->set_security_token(*inner_global);
|
816
|
-
|
817
|
-
Isolate* isolate = Isolate::Current();
|
818
|
-
Factory* factory = isolate->factory();
|
819
|
-
Heap* heap = isolate->heap();
|
820
|
-
|
821
|
-
Handle<String> object_name = Handle<String>(heap->Object_symbol());
|
822
|
-
SetLocalPropertyNoThrow(inner_global, object_name,
|
823
|
-
isolate->object_function(), DONT_ENUM);
|
824
|
-
|
825
|
-
Handle<JSObject> global = Handle<JSObject>(global_context()->global());
|
826
|
-
|
827
|
-
// Install global Function object
|
828
|
-
InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
|
829
|
-
empty_function, Builtins::kIllegal, true); // ECMA native.
|
830
|
-
|
831
|
-
{ // --- A r r a y ---
|
832
|
-
Handle<JSFunction> array_function =
|
833
|
-
InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
|
834
|
-
isolate->initial_object_prototype(),
|
835
|
-
Builtins::kArrayCode, true);
|
836
|
-
array_function->shared()->set_construct_stub(
|
837
|
-
isolate->builtins()->builtin(Builtins::kArrayConstructCode));
|
838
|
-
array_function->shared()->DontAdaptArguments();
|
839
|
-
|
840
|
-
// This seems a bit hackish, but we need to make sure Array.length
|
841
|
-
// is 1.
|
842
|
-
array_function->shared()->set_length(1);
|
843
|
-
Handle<DescriptorArray> array_descriptors =
|
844
|
-
factory->CopyAppendProxyDescriptor(
|
845
|
-
factory->empty_descriptor_array(),
|
846
|
-
factory->length_symbol(),
|
847
|
-
factory->NewProxy(&Accessors::ArrayLength),
|
848
|
-
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE));
|
849
|
-
|
850
|
-
// Cache the fast JavaScript array map
|
851
|
-
global_context()->set_js_array_map(array_function->initial_map());
|
852
|
-
global_context()->js_array_map()->set_instance_descriptors(
|
853
|
-
*array_descriptors);
|
854
|
-
// array_function is used internally. JS code creating array object should
|
855
|
-
// search for the 'Array' property on the global object and use that one
|
856
|
-
// as the constructor. 'Array' property on a global object can be
|
857
|
-
// overwritten by JS code.
|
858
|
-
global_context()->set_array_function(*array_function);
|
859
|
-
}
|
860
|
-
|
861
|
-
{ // --- N u m b e r ---
|
862
|
-
Handle<JSFunction> number_fun =
|
863
|
-
InstallFunction(global, "Number", JS_VALUE_TYPE, JSValue::kSize,
|
864
|
-
isolate->initial_object_prototype(),
|
865
|
-
Builtins::kIllegal, true);
|
866
|
-
global_context()->set_number_function(*number_fun);
|
867
|
-
}
|
868
|
-
|
869
|
-
{ // --- B o o l e a n ---
|
870
|
-
Handle<JSFunction> boolean_fun =
|
871
|
-
InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize,
|
872
|
-
isolate->initial_object_prototype(),
|
873
|
-
Builtins::kIllegal, true);
|
874
|
-
global_context()->set_boolean_function(*boolean_fun);
|
875
|
-
}
|
876
|
-
|
877
|
-
{ // --- S t r i n g ---
|
878
|
-
Handle<JSFunction> string_fun =
|
879
|
-
InstallFunction(global, "String", JS_VALUE_TYPE, JSValue::kSize,
|
880
|
-
isolate->initial_object_prototype(),
|
881
|
-
Builtins::kIllegal, true);
|
882
|
-
string_fun->shared()->set_construct_stub(
|
883
|
-
isolate->builtins()->builtin(Builtins::kStringConstructCode));
|
884
|
-
global_context()->set_string_function(*string_fun);
|
885
|
-
// Add 'length' property to strings.
|
886
|
-
Handle<DescriptorArray> string_descriptors =
|
887
|
-
factory->CopyAppendProxyDescriptor(
|
888
|
-
factory->empty_descriptor_array(),
|
889
|
-
factory->length_symbol(),
|
890
|
-
factory->NewProxy(&Accessors::StringLength),
|
891
|
-
static_cast<PropertyAttributes>(DONT_ENUM |
|
892
|
-
DONT_DELETE |
|
893
|
-
READ_ONLY));
|
894
|
-
|
895
|
-
Handle<Map> string_map =
|
896
|
-
Handle<Map>(global_context()->string_function()->initial_map());
|
897
|
-
string_map->set_instance_descriptors(*string_descriptors);
|
898
|
-
}
|
899
|
-
|
900
|
-
{ // --- D a t e ---
|
901
|
-
// Builtin functions for Date.prototype.
|
902
|
-
Handle<JSFunction> date_fun =
|
903
|
-
InstallFunction(global, "Date", JS_VALUE_TYPE, JSValue::kSize,
|
904
|
-
isolate->initial_object_prototype(),
|
905
|
-
Builtins::kIllegal, true);
|
906
|
-
|
907
|
-
global_context()->set_date_function(*date_fun);
|
908
|
-
}
|
909
|
-
|
910
|
-
|
911
|
-
{ // -- R e g E x p
|
912
|
-
// Builtin functions for RegExp.prototype.
|
913
|
-
Handle<JSFunction> regexp_fun =
|
914
|
-
InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
|
915
|
-
isolate->initial_object_prototype(),
|
916
|
-
Builtins::kIllegal, true);
|
917
|
-
global_context()->set_regexp_function(*regexp_fun);
|
918
|
-
|
919
|
-
ASSERT(regexp_fun->has_initial_map());
|
920
|
-
Handle<Map> initial_map(regexp_fun->initial_map());
|
921
|
-
|
922
|
-
ASSERT_EQ(0, initial_map->inobject_properties());
|
923
|
-
|
924
|
-
Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(5);
|
925
|
-
PropertyAttributes final =
|
926
|
-
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
|
927
|
-
int enum_index = 0;
|
928
|
-
{
|
929
|
-
// ECMA-262, section 15.10.7.1.
|
930
|
-
FieldDescriptor field(heap->source_symbol(),
|
931
|
-
JSRegExp::kSourceFieldIndex,
|
932
|
-
final,
|
933
|
-
enum_index++);
|
934
|
-
descriptors->Set(0, &field);
|
935
|
-
}
|
936
|
-
{
|
937
|
-
// ECMA-262, section 15.10.7.2.
|
938
|
-
FieldDescriptor field(heap->global_symbol(),
|
939
|
-
JSRegExp::kGlobalFieldIndex,
|
940
|
-
final,
|
941
|
-
enum_index++);
|
942
|
-
descriptors->Set(1, &field);
|
943
|
-
}
|
944
|
-
{
|
945
|
-
// ECMA-262, section 15.10.7.3.
|
946
|
-
FieldDescriptor field(heap->ignore_case_symbol(),
|
947
|
-
JSRegExp::kIgnoreCaseFieldIndex,
|
948
|
-
final,
|
949
|
-
enum_index++);
|
950
|
-
descriptors->Set(2, &field);
|
951
|
-
}
|
952
|
-
{
|
953
|
-
// ECMA-262, section 15.10.7.4.
|
954
|
-
FieldDescriptor field(heap->multiline_symbol(),
|
955
|
-
JSRegExp::kMultilineFieldIndex,
|
956
|
-
final,
|
957
|
-
enum_index++);
|
958
|
-
descriptors->Set(3, &field);
|
959
|
-
}
|
960
|
-
{
|
961
|
-
// ECMA-262, section 15.10.7.5.
|
962
|
-
PropertyAttributes writable =
|
963
|
-
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
|
964
|
-
FieldDescriptor field(heap->last_index_symbol(),
|
965
|
-
JSRegExp::kLastIndexFieldIndex,
|
966
|
-
writable,
|
967
|
-
enum_index++);
|
968
|
-
descriptors->Set(4, &field);
|
969
|
-
}
|
970
|
-
descriptors->SetNextEnumerationIndex(enum_index);
|
971
|
-
descriptors->Sort();
|
972
|
-
|
973
|
-
initial_map->set_inobject_properties(5);
|
974
|
-
initial_map->set_pre_allocated_property_fields(5);
|
975
|
-
initial_map->set_unused_property_fields(0);
|
976
|
-
initial_map->set_instance_size(
|
977
|
-
initial_map->instance_size() + 5 * kPointerSize);
|
978
|
-
initial_map->set_instance_descriptors(*descriptors);
|
979
|
-
initial_map->set_visitor_id(StaticVisitorBase::GetVisitorId(*initial_map));
|
980
|
-
}
|
981
|
-
|
982
|
-
{ // -- J S O N
|
983
|
-
Handle<String> name = factory->NewStringFromAscii(CStrVector("JSON"));
|
984
|
-
Handle<JSFunction> cons = factory->NewFunction(
|
985
|
-
name,
|
986
|
-
factory->the_hole_value());
|
987
|
-
cons->SetInstancePrototype(global_context()->initial_object_prototype());
|
988
|
-
cons->SetInstanceClassName(*name);
|
989
|
-
Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED);
|
990
|
-
ASSERT(json_object->IsJSObject());
|
991
|
-
SetLocalPropertyNoThrow(global, name, json_object, DONT_ENUM);
|
992
|
-
global_context()->set_json_object(*json_object);
|
993
|
-
}
|
994
|
-
|
995
|
-
{ // --- arguments_boilerplate_
|
996
|
-
// Make sure we can recognize argument objects at runtime.
|
997
|
-
// This is done by introducing an anonymous function with
|
998
|
-
// class_name equals 'Arguments'.
|
999
|
-
Handle<String> symbol = factory->LookupAsciiSymbol("Arguments");
|
1000
|
-
Handle<Code> code = Handle<Code>(
|
1001
|
-
isolate->builtins()->builtin(Builtins::kIllegal));
|
1002
|
-
Handle<JSObject> prototype =
|
1003
|
-
Handle<JSObject>(
|
1004
|
-
JSObject::cast(global_context()->object_function()->prototype()));
|
1005
|
-
|
1006
|
-
Handle<JSFunction> function =
|
1007
|
-
factory->NewFunctionWithPrototype(symbol,
|
1008
|
-
JS_OBJECT_TYPE,
|
1009
|
-
JSObject::kHeaderSize,
|
1010
|
-
prototype,
|
1011
|
-
code,
|
1012
|
-
false);
|
1013
|
-
ASSERT(!function->has_initial_map());
|
1014
|
-
function->shared()->set_instance_class_name(*symbol);
|
1015
|
-
function->shared()->set_expected_nof_properties(2);
|
1016
|
-
Handle<JSObject> result = factory->NewJSObject(function);
|
1017
|
-
|
1018
|
-
global_context()->set_arguments_boilerplate(*result);
|
1019
|
-
// Note: length must be added as the first property and
|
1020
|
-
// callee must be added as the second property.
|
1021
|
-
SetLocalPropertyNoThrow(result, factory->length_symbol(),
|
1022
|
-
factory->undefined_value(),
|
1023
|
-
DONT_ENUM);
|
1024
|
-
SetLocalPropertyNoThrow(result, factory->callee_symbol(),
|
1025
|
-
factory->undefined_value(),
|
1026
|
-
DONT_ENUM);
|
1027
|
-
|
1028
|
-
#ifdef DEBUG
|
1029
|
-
LookupResult lookup;
|
1030
|
-
result->LocalLookup(heap->callee_symbol(), &lookup);
|
1031
|
-
ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
|
1032
|
-
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsCalleeIndex);
|
1033
|
-
|
1034
|
-
result->LocalLookup(heap->length_symbol(), &lookup);
|
1035
|
-
ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
|
1036
|
-
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex);
|
1037
|
-
|
1038
|
-
ASSERT(result->map()->inobject_properties() > Heap::kArgumentsCalleeIndex);
|
1039
|
-
ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex);
|
1040
|
-
|
1041
|
-
// Check the state of the object.
|
1042
|
-
ASSERT(result->HasFastProperties());
|
1043
|
-
ASSERT(result->HasFastElements());
|
1044
|
-
#endif
|
1045
|
-
}
|
1046
|
-
|
1047
|
-
{ // --- strict mode arguments boilerplate
|
1048
|
-
const PropertyAttributes attributes =
|
1049
|
-
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
|
1050
|
-
|
1051
|
-
// Create the ThrowTypeError functions.
|
1052
|
-
Handle<FixedArray> callee = factory->NewFixedArray(2, TENURED);
|
1053
|
-
Handle<FixedArray> caller = factory->NewFixedArray(2, TENURED);
|
1054
|
-
|
1055
|
-
Handle<JSFunction> callee_throw =
|
1056
|
-
CreateThrowTypeErrorFunction(Builtins::kStrictArgumentsCallee);
|
1057
|
-
Handle<JSFunction> caller_throw =
|
1058
|
-
CreateThrowTypeErrorFunction(Builtins::kStrictArgumentsCaller);
|
1059
|
-
|
1060
|
-
// Install the ThrowTypeError functions.
|
1061
|
-
callee->set(0, *callee_throw);
|
1062
|
-
callee->set(1, *callee_throw);
|
1063
|
-
caller->set(0, *caller_throw);
|
1064
|
-
caller->set(1, *caller_throw);
|
1065
|
-
|
1066
|
-
// Create the descriptor array for the arguments object.
|
1067
|
-
Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(3);
|
1068
|
-
{ // length
|
1069
|
-
FieldDescriptor d(*factory->length_symbol(), 0, DONT_ENUM);
|
1070
|
-
descriptors->Set(0, &d);
|
1071
|
-
}
|
1072
|
-
{ // callee
|
1073
|
-
CallbacksDescriptor d(*factory->callee_symbol(), *callee, attributes);
|
1074
|
-
descriptors->Set(1, &d);
|
1075
|
-
}
|
1076
|
-
{ // caller
|
1077
|
-
CallbacksDescriptor d(*factory->caller_symbol(), *caller, attributes);
|
1078
|
-
descriptors->Set(2, &d);
|
1079
|
-
}
|
1080
|
-
descriptors->Sort();
|
1081
|
-
|
1082
|
-
// Create the map. Allocate one in-object field for length.
|
1083
|
-
Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE,
|
1084
|
-
Heap::kArgumentsObjectSizeStrict);
|
1085
|
-
map->set_instance_descriptors(*descriptors);
|
1086
|
-
map->set_function_with_prototype(true);
|
1087
|
-
map->set_prototype(global_context()->object_function()->prototype());
|
1088
|
-
map->set_pre_allocated_property_fields(1);
|
1089
|
-
map->set_inobject_properties(1);
|
1090
|
-
|
1091
|
-
// Copy constructor from the non-strict arguments boilerplate.
|
1092
|
-
map->set_constructor(
|
1093
|
-
global_context()->arguments_boilerplate()->map()->constructor());
|
1094
|
-
|
1095
|
-
// Allocate the arguments boilerplate object.
|
1096
|
-
Handle<JSObject> result = factory->NewJSObjectFromMap(map);
|
1097
|
-
global_context()->set_strict_mode_arguments_boilerplate(*result);
|
1098
|
-
|
1099
|
-
// Add length property only for strict mode boilerplate.
|
1100
|
-
SetLocalPropertyNoThrow(result, factory->length_symbol(),
|
1101
|
-
factory->undefined_value(),
|
1102
|
-
DONT_ENUM);
|
1103
|
-
|
1104
|
-
#ifdef DEBUG
|
1105
|
-
LookupResult lookup;
|
1106
|
-
result->LocalLookup(heap->length_symbol(), &lookup);
|
1107
|
-
ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
|
1108
|
-
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex);
|
1109
|
-
|
1110
|
-
ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex);
|
1111
|
-
|
1112
|
-
// Check the state of the object.
|
1113
|
-
ASSERT(result->HasFastProperties());
|
1114
|
-
ASSERT(result->HasFastElements());
|
1115
|
-
#endif
|
1116
|
-
}
|
1117
|
-
|
1118
|
-
{ // --- context extension
|
1119
|
-
// Create a function for the context extension objects.
|
1120
|
-
Handle<Code> code = Handle<Code>(
|
1121
|
-
isolate->builtins()->builtin(Builtins::kIllegal));
|
1122
|
-
Handle<JSFunction> context_extension_fun =
|
1123
|
-
factory->NewFunction(factory->empty_symbol(),
|
1124
|
-
JS_CONTEXT_EXTENSION_OBJECT_TYPE,
|
1125
|
-
JSObject::kHeaderSize,
|
1126
|
-
code,
|
1127
|
-
true);
|
1128
|
-
|
1129
|
-
Handle<String> name = factory->LookupAsciiSymbol("context_extension");
|
1130
|
-
context_extension_fun->shared()->set_instance_class_name(*name);
|
1131
|
-
global_context()->set_context_extension_function(*context_extension_fun);
|
1132
|
-
}
|
1133
|
-
|
1134
|
-
|
1135
|
-
{
|
1136
|
-
// Setup the call-as-function delegate.
|
1137
|
-
Handle<Code> code =
|
1138
|
-
Handle<Code>(isolate->builtins()->builtin(
|
1139
|
-
Builtins::kHandleApiCallAsFunction));
|
1140
|
-
Handle<JSFunction> delegate =
|
1141
|
-
factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE,
|
1142
|
-
JSObject::kHeaderSize, code, true);
|
1143
|
-
global_context()->set_call_as_function_delegate(*delegate);
|
1144
|
-
delegate->shared()->DontAdaptArguments();
|
1145
|
-
}
|
1146
|
-
|
1147
|
-
{
|
1148
|
-
// Setup the call-as-constructor delegate.
|
1149
|
-
Handle<Code> code =
|
1150
|
-
Handle<Code>(isolate->builtins()->builtin(
|
1151
|
-
Builtins::kHandleApiCallAsConstructor));
|
1152
|
-
Handle<JSFunction> delegate =
|
1153
|
-
factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE,
|
1154
|
-
JSObject::kHeaderSize, code, true);
|
1155
|
-
global_context()->set_call_as_constructor_delegate(*delegate);
|
1156
|
-
delegate->shared()->DontAdaptArguments();
|
1157
|
-
}
|
1158
|
-
|
1159
|
-
// Initialize the out of memory slot.
|
1160
|
-
global_context()->set_out_of_memory(heap->false_value());
|
1161
|
-
|
1162
|
-
// Initialize the data slot.
|
1163
|
-
global_context()->set_data(heap->undefined_value());
|
1164
|
-
}
|
1165
|
-
|
1166
|
-
|
1167
|
-
bool Genesis::CompileBuiltin(int index) {
|
1168
|
-
Vector<const char> name = Natives::GetScriptName(index);
|
1169
|
-
Handle<String> source_code =
|
1170
|
-
Isolate::Current()->bootstrapper()->NativesSourceLookup(index);
|
1171
|
-
return CompileNative(name, source_code);
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
|
1175
|
-
bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) {
|
1176
|
-
HandleScope scope;
|
1177
|
-
Isolate* isolate = Isolate::Current();
|
1178
|
-
#ifdef ENABLE_DEBUGGER_SUPPORT
|
1179
|
-
isolate->debugger()->set_compiling_natives(true);
|
1180
|
-
#endif
|
1181
|
-
bool result = CompileScriptCached(name,
|
1182
|
-
source,
|
1183
|
-
NULL,
|
1184
|
-
NULL,
|
1185
|
-
Handle<Context>(isolate->context()),
|
1186
|
-
true);
|
1187
|
-
ASSERT(isolate->has_pending_exception() != result);
|
1188
|
-
if (!result) isolate->clear_pending_exception();
|
1189
|
-
#ifdef ENABLE_DEBUGGER_SUPPORT
|
1190
|
-
isolate->debugger()->set_compiling_natives(false);
|
1191
|
-
#endif
|
1192
|
-
return result;
|
1193
|
-
}
|
1194
|
-
|
1195
|
-
|
1196
|
-
bool Genesis::CompileScriptCached(Vector<const char> name,
|
1197
|
-
Handle<String> source,
|
1198
|
-
SourceCodeCache* cache,
|
1199
|
-
v8::Extension* extension,
|
1200
|
-
Handle<Context> top_context,
|
1201
|
-
bool use_runtime_context) {
|
1202
|
-
Factory* factory = Isolate::Current()->factory();
|
1203
|
-
HandleScope scope;
|
1204
|
-
Handle<SharedFunctionInfo> function_info;
|
1205
|
-
|
1206
|
-
// If we can't find the function in the cache, we compile a new
|
1207
|
-
// function and insert it into the cache.
|
1208
|
-
if (cache == NULL || !cache->Lookup(name, &function_info)) {
|
1209
|
-
ASSERT(source->IsAsciiRepresentation());
|
1210
|
-
Handle<String> script_name = factory->NewStringFromUtf8(name);
|
1211
|
-
function_info = Compiler::Compile(
|
1212
|
-
source,
|
1213
|
-
script_name,
|
1214
|
-
0,
|
1215
|
-
0,
|
1216
|
-
extension,
|
1217
|
-
NULL,
|
1218
|
-
Handle<String>::null(),
|
1219
|
-
use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE);
|
1220
|
-
if (function_info.is_null()) return false;
|
1221
|
-
if (cache != NULL) cache->Add(name, function_info);
|
1222
|
-
}
|
1223
|
-
|
1224
|
-
// Setup the function context. Conceptually, we should clone the
|
1225
|
-
// function before overwriting the context but since we're in a
|
1226
|
-
// single-threaded environment it is not strictly necessary.
|
1227
|
-
ASSERT(top_context->IsGlobalContext());
|
1228
|
-
Handle<Context> context =
|
1229
|
-
Handle<Context>(use_runtime_context
|
1230
|
-
? Handle<Context>(top_context->runtime_context())
|
1231
|
-
: top_context);
|
1232
|
-
Handle<JSFunction> fun =
|
1233
|
-
factory->NewFunctionFromSharedFunctionInfo(function_info, context);
|
1234
|
-
|
1235
|
-
// Call function using either the runtime object or the global
|
1236
|
-
// object as the receiver. Provide no parameters.
|
1237
|
-
Handle<Object> receiver =
|
1238
|
-
Handle<Object>(use_runtime_context
|
1239
|
-
? top_context->builtins()
|
1240
|
-
: top_context->global());
|
1241
|
-
bool has_pending_exception;
|
1242
|
-
Handle<Object> result =
|
1243
|
-
Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
|
1244
|
-
if (has_pending_exception) return false;
|
1245
|
-
return true;
|
1246
|
-
}
|
1247
|
-
|
1248
|
-
|
1249
|
-
#define INSTALL_NATIVE(Type, name, var) \
|
1250
|
-
Handle<String> var##_name = factory->LookupAsciiSymbol(name); \
|
1251
|
-
Object* var##_native = \
|
1252
|
-
global_context()->builtins()->GetPropertyNoExceptionThrown(*var##_name); \
|
1253
|
-
global_context()->set_##var(Type::cast(var##_native));
|
1254
|
-
|
1255
|
-
|
1256
|
-
void Genesis::InstallNativeFunctions() {
|
1257
|
-
Factory* factory = Isolate::Current()->factory();
|
1258
|
-
HandleScope scope;
|
1259
|
-
INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
|
1260
|
-
INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
|
1261
|
-
INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
|
1262
|
-
INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
|
1263
|
-
INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun);
|
1264
|
-
INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
|
1265
|
-
INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
|
1266
|
-
INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
|
1267
|
-
INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
|
1268
|
-
INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
|
1269
|
-
INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance",
|
1270
|
-
configure_instance_fun);
|
1271
|
-
INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun);
|
1272
|
-
INSTALL_NATIVE(JSObject, "functionCache", function_cache);
|
1273
|
-
}
|
1274
|
-
|
1275
|
-
#undef INSTALL_NATIVE
|
1276
|
-
|
1277
|
-
|
1278
|
-
bool Genesis::InstallNatives() {
|
1279
|
-
HandleScope scope;
|
1280
|
-
Isolate* isolate = Isolate::Current();
|
1281
|
-
Factory* factory = isolate->factory();
|
1282
|
-
Heap* heap = isolate->heap();
|
1283
|
-
|
1284
|
-
// Create a function for the builtins object. Allocate space for the
|
1285
|
-
// JavaScript builtins, a reference to the builtins object
|
1286
|
-
// (itself) and a reference to the global_context directly in the object.
|
1287
|
-
Handle<Code> code = Handle<Code>(
|
1288
|
-
isolate->builtins()->builtin(Builtins::kIllegal));
|
1289
|
-
Handle<JSFunction> builtins_fun =
|
1290
|
-
factory->NewFunction(factory->empty_symbol(), JS_BUILTINS_OBJECT_TYPE,
|
1291
|
-
JSBuiltinsObject::kSize, code, true);
|
1292
|
-
|
1293
|
-
Handle<String> name = factory->LookupAsciiSymbol("builtins");
|
1294
|
-
builtins_fun->shared()->set_instance_class_name(*name);
|
1295
|
-
|
1296
|
-
// Allocate the builtins object.
|
1297
|
-
Handle<JSBuiltinsObject> builtins =
|
1298
|
-
Handle<JSBuiltinsObject>::cast(factory->NewGlobalObject(builtins_fun));
|
1299
|
-
builtins->set_builtins(*builtins);
|
1300
|
-
builtins->set_global_context(*global_context());
|
1301
|
-
builtins->set_global_receiver(*builtins);
|
1302
|
-
|
1303
|
-
// Setup the 'global' properties of the builtins object. The
|
1304
|
-
// 'global' property that refers to the global object is the only
|
1305
|
-
// way to get from code running in the builtins context to the
|
1306
|
-
// global object.
|
1307
|
-
static const PropertyAttributes attributes =
|
1308
|
-
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
|
1309
|
-
Handle<String> global_symbol = factory->LookupAsciiSymbol("global");
|
1310
|
-
Handle<Object> global_obj(global_context()->global());
|
1311
|
-
SetLocalPropertyNoThrow(builtins, global_symbol, global_obj, attributes);
|
1312
|
-
|
1313
|
-
// Setup the reference from the global object to the builtins object.
|
1314
|
-
JSGlobalObject::cast(global_context()->global())->set_builtins(*builtins);
|
1315
|
-
|
1316
|
-
// Create a bridge function that has context in the global context.
|
1317
|
-
Handle<JSFunction> bridge =
|
1318
|
-
factory->NewFunction(factory->empty_symbol(), factory->undefined_value());
|
1319
|
-
ASSERT(bridge->context() == *isolate->global_context());
|
1320
|
-
|
1321
|
-
// Allocate the builtins context.
|
1322
|
-
Handle<Context> context =
|
1323
|
-
factory->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, bridge);
|
1324
|
-
context->set_global(*builtins); // override builtins global object
|
1325
|
-
|
1326
|
-
global_context()->set_runtime_context(*context);
|
1327
|
-
|
1328
|
-
{ // -- S c r i p t
|
1329
|
-
// Builtin functions for Script.
|
1330
|
-
Handle<JSFunction> script_fun =
|
1331
|
-
InstallFunction(builtins, "Script", JS_VALUE_TYPE, JSValue::kSize,
|
1332
|
-
isolate->initial_object_prototype(),
|
1333
|
-
Builtins::kIllegal, false);
|
1334
|
-
Handle<JSObject> prototype =
|
1335
|
-
factory->NewJSObject(isolate->object_function(), TENURED);
|
1336
|
-
SetPrototype(script_fun, prototype);
|
1337
|
-
global_context()->set_script_function(*script_fun);
|
1338
|
-
|
1339
|
-
// Add 'source' and 'data' property to scripts.
|
1340
|
-
PropertyAttributes common_attributes =
|
1341
|
-
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
|
1342
|
-
Handle<Proxy> proxy_source = factory->NewProxy(&Accessors::ScriptSource);
|
1343
|
-
Handle<DescriptorArray> script_descriptors =
|
1344
|
-
factory->CopyAppendProxyDescriptor(
|
1345
|
-
factory->empty_descriptor_array(),
|
1346
|
-
factory->LookupAsciiSymbol("source"),
|
1347
|
-
proxy_source,
|
1348
|
-
common_attributes);
|
1349
|
-
Handle<Proxy> proxy_name = factory->NewProxy(&Accessors::ScriptName);
|
1350
|
-
script_descriptors =
|
1351
|
-
factory->CopyAppendProxyDescriptor(
|
1352
|
-
script_descriptors,
|
1353
|
-
factory->LookupAsciiSymbol("name"),
|
1354
|
-
proxy_name,
|
1355
|
-
common_attributes);
|
1356
|
-
Handle<Proxy> proxy_id = factory->NewProxy(&Accessors::ScriptId);
|
1357
|
-
script_descriptors =
|
1358
|
-
factory->CopyAppendProxyDescriptor(
|
1359
|
-
script_descriptors,
|
1360
|
-
factory->LookupAsciiSymbol("id"),
|
1361
|
-
proxy_id,
|
1362
|
-
common_attributes);
|
1363
|
-
Handle<Proxy> proxy_line_offset =
|
1364
|
-
factory->NewProxy(&Accessors::ScriptLineOffset);
|
1365
|
-
script_descriptors =
|
1366
|
-
factory->CopyAppendProxyDescriptor(
|
1367
|
-
script_descriptors,
|
1368
|
-
factory->LookupAsciiSymbol("line_offset"),
|
1369
|
-
proxy_line_offset,
|
1370
|
-
common_attributes);
|
1371
|
-
Handle<Proxy> proxy_column_offset =
|
1372
|
-
factory->NewProxy(&Accessors::ScriptColumnOffset);
|
1373
|
-
script_descriptors =
|
1374
|
-
factory->CopyAppendProxyDescriptor(
|
1375
|
-
script_descriptors,
|
1376
|
-
factory->LookupAsciiSymbol("column_offset"),
|
1377
|
-
proxy_column_offset,
|
1378
|
-
common_attributes);
|
1379
|
-
Handle<Proxy> proxy_data = factory->NewProxy(&Accessors::ScriptData);
|
1380
|
-
script_descriptors =
|
1381
|
-
factory->CopyAppendProxyDescriptor(
|
1382
|
-
script_descriptors,
|
1383
|
-
factory->LookupAsciiSymbol("data"),
|
1384
|
-
proxy_data,
|
1385
|
-
common_attributes);
|
1386
|
-
Handle<Proxy> proxy_type = factory->NewProxy(&Accessors::ScriptType);
|
1387
|
-
script_descriptors =
|
1388
|
-
factory->CopyAppendProxyDescriptor(
|
1389
|
-
script_descriptors,
|
1390
|
-
factory->LookupAsciiSymbol("type"),
|
1391
|
-
proxy_type,
|
1392
|
-
common_attributes);
|
1393
|
-
Handle<Proxy> proxy_compilation_type =
|
1394
|
-
factory->NewProxy(&Accessors::ScriptCompilationType);
|
1395
|
-
script_descriptors =
|
1396
|
-
factory->CopyAppendProxyDescriptor(
|
1397
|
-
script_descriptors,
|
1398
|
-
factory->LookupAsciiSymbol("compilation_type"),
|
1399
|
-
proxy_compilation_type,
|
1400
|
-
common_attributes);
|
1401
|
-
Handle<Proxy> proxy_line_ends =
|
1402
|
-
factory->NewProxy(&Accessors::ScriptLineEnds);
|
1403
|
-
script_descriptors =
|
1404
|
-
factory->CopyAppendProxyDescriptor(
|
1405
|
-
script_descriptors,
|
1406
|
-
factory->LookupAsciiSymbol("line_ends"),
|
1407
|
-
proxy_line_ends,
|
1408
|
-
common_attributes);
|
1409
|
-
Handle<Proxy> proxy_context_data =
|
1410
|
-
factory->NewProxy(&Accessors::ScriptContextData);
|
1411
|
-
script_descriptors =
|
1412
|
-
factory->CopyAppendProxyDescriptor(
|
1413
|
-
script_descriptors,
|
1414
|
-
factory->LookupAsciiSymbol("context_data"),
|
1415
|
-
proxy_context_data,
|
1416
|
-
common_attributes);
|
1417
|
-
Handle<Proxy> proxy_eval_from_script =
|
1418
|
-
factory->NewProxy(&Accessors::ScriptEvalFromScript);
|
1419
|
-
script_descriptors =
|
1420
|
-
factory->CopyAppendProxyDescriptor(
|
1421
|
-
script_descriptors,
|
1422
|
-
factory->LookupAsciiSymbol("eval_from_script"),
|
1423
|
-
proxy_eval_from_script,
|
1424
|
-
common_attributes);
|
1425
|
-
Handle<Proxy> proxy_eval_from_script_position =
|
1426
|
-
factory->NewProxy(&Accessors::ScriptEvalFromScriptPosition);
|
1427
|
-
script_descriptors =
|
1428
|
-
factory->CopyAppendProxyDescriptor(
|
1429
|
-
script_descriptors,
|
1430
|
-
factory->LookupAsciiSymbol("eval_from_script_position"),
|
1431
|
-
proxy_eval_from_script_position,
|
1432
|
-
common_attributes);
|
1433
|
-
Handle<Proxy> proxy_eval_from_function_name =
|
1434
|
-
factory->NewProxy(&Accessors::ScriptEvalFromFunctionName);
|
1435
|
-
script_descriptors =
|
1436
|
-
factory->CopyAppendProxyDescriptor(
|
1437
|
-
script_descriptors,
|
1438
|
-
factory->LookupAsciiSymbol("eval_from_function_name"),
|
1439
|
-
proxy_eval_from_function_name,
|
1440
|
-
common_attributes);
|
1441
|
-
|
1442
|
-
Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
|
1443
|
-
script_map->set_instance_descriptors(*script_descriptors);
|
1444
|
-
|
1445
|
-
// Allocate the empty script.
|
1446
|
-
Handle<Script> script = factory->NewScript(factory->empty_string());
|
1447
|
-
script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
|
1448
|
-
heap->public_set_empty_script(*script);
|
1449
|
-
}
|
1450
|
-
{
|
1451
|
-
// Builtin function for OpaqueReference -- a JSValue-based object,
|
1452
|
-
// that keeps its field isolated from JavaScript code. It may store
|
1453
|
-
// objects, that JavaScript code may not access.
|
1454
|
-
Handle<JSFunction> opaque_reference_fun =
|
1455
|
-
InstallFunction(builtins, "OpaqueReference", JS_VALUE_TYPE,
|
1456
|
-
JSValue::kSize,
|
1457
|
-
isolate->initial_object_prototype(),
|
1458
|
-
Builtins::kIllegal, false);
|
1459
|
-
Handle<JSObject> prototype =
|
1460
|
-
factory->NewJSObject(isolate->object_function(), TENURED);
|
1461
|
-
SetPrototype(opaque_reference_fun, prototype);
|
1462
|
-
global_context()->set_opaque_reference_function(*opaque_reference_fun);
|
1463
|
-
}
|
1464
|
-
|
1465
|
-
{ // --- I n t e r n a l A r r a y ---
|
1466
|
-
// An array constructor on the builtins object that works like
|
1467
|
-
// the public Array constructor, except that its prototype
|
1468
|
-
// doesn't inherit from Object.prototype.
|
1469
|
-
// To be used only for internal work by builtins. Instances
|
1470
|
-
// must not be leaked to user code.
|
1471
|
-
// Only works correctly when called as a constructor. The normal
|
1472
|
-
// Array code uses Array.prototype as prototype when called as
|
1473
|
-
// a function.
|
1474
|
-
Handle<JSFunction> array_function =
|
1475
|
-
InstallFunction(builtins,
|
1476
|
-
"InternalArray",
|
1477
|
-
JS_ARRAY_TYPE,
|
1478
|
-
JSArray::kSize,
|
1479
|
-
isolate->initial_object_prototype(),
|
1480
|
-
Builtins::kArrayCode,
|
1481
|
-
true);
|
1482
|
-
Handle<JSObject> prototype =
|
1483
|
-
factory->NewJSObject(isolate->object_function(), TENURED);
|
1484
|
-
SetPrototype(array_function, prototype);
|
1485
|
-
|
1486
|
-
array_function->shared()->set_construct_stub(
|
1487
|
-
isolate->builtins()->builtin(Builtins::kArrayConstructCode));
|
1488
|
-
array_function->shared()->DontAdaptArguments();
|
1489
|
-
|
1490
|
-
// Make "length" magic on instances.
|
1491
|
-
Handle<DescriptorArray> array_descriptors =
|
1492
|
-
factory->CopyAppendProxyDescriptor(
|
1493
|
-
factory->empty_descriptor_array(),
|
1494
|
-
factory->length_symbol(),
|
1495
|
-
factory->NewProxy(&Accessors::ArrayLength),
|
1496
|
-
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE));
|
1497
|
-
|
1498
|
-
array_function->initial_map()->set_instance_descriptors(
|
1499
|
-
*array_descriptors);
|
1500
|
-
}
|
1501
|
-
|
1502
|
-
if (FLAG_disable_native_files) {
|
1503
|
-
PrintF("Warning: Running without installed natives!\n");
|
1504
|
-
return true;
|
1505
|
-
}
|
1506
|
-
|
1507
|
-
// Install natives.
|
1508
|
-
for (int i = Natives::GetDebuggerCount();
|
1509
|
-
i < Natives::GetBuiltinsCount();
|
1510
|
-
i++) {
|
1511
|
-
Vector<const char> name = Natives::GetScriptName(i);
|
1512
|
-
if (!CompileBuiltin(i)) return false;
|
1513
|
-
// TODO(ager): We really only need to install the JS builtin
|
1514
|
-
// functions on the builtins object after compiling and running
|
1515
|
-
// runtime.js.
|
1516
|
-
if (!InstallJSBuiltins(builtins)) return false;
|
1517
|
-
}
|
1518
|
-
|
1519
|
-
InstallNativeFunctions();
|
1520
|
-
|
1521
|
-
// Store the map for the string prototype after the natives has been compiled
|
1522
|
-
// and the String function has been setup.
|
1523
|
-
Handle<JSFunction> string_function(global_context()->string_function());
|
1524
|
-
ASSERT(JSObject::cast(
|
1525
|
-
string_function->initial_map()->prototype())->HasFastProperties());
|
1526
|
-
global_context()->set_string_function_prototype_map(
|
1527
|
-
HeapObject::cast(string_function->initial_map()->prototype())->map());
|
1528
|
-
|
1529
|
-
InstallBuiltinFunctionIds();
|
1530
|
-
|
1531
|
-
// Install Function.prototype.call and apply.
|
1532
|
-
{ Handle<String> key = factory->function_class_symbol();
|
1533
|
-
Handle<JSFunction> function =
|
1534
|
-
Handle<JSFunction>::cast(GetProperty(isolate->global(), key));
|
1535
|
-
Handle<JSObject> proto =
|
1536
|
-
Handle<JSObject>(JSObject::cast(function->instance_prototype()));
|
1537
|
-
|
1538
|
-
// Install the call and the apply functions.
|
1539
|
-
Handle<JSFunction> call =
|
1540
|
-
InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize,
|
1541
|
-
Handle<JSObject>::null(),
|
1542
|
-
Builtins::kFunctionCall,
|
1543
|
-
false);
|
1544
|
-
Handle<JSFunction> apply =
|
1545
|
-
InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize,
|
1546
|
-
Handle<JSObject>::null(),
|
1547
|
-
Builtins::kFunctionApply,
|
1548
|
-
false);
|
1549
|
-
|
1550
|
-
// Make sure that Function.prototype.call appears to be compiled.
|
1551
|
-
// The code will never be called, but inline caching for call will
|
1552
|
-
// only work if it appears to be compiled.
|
1553
|
-
call->shared()->DontAdaptArguments();
|
1554
|
-
ASSERT(call->is_compiled());
|
1555
|
-
|
1556
|
-
// Set the expected parameters for apply to 2; required by builtin.
|
1557
|
-
apply->shared()->set_formal_parameter_count(2);
|
1558
|
-
|
1559
|
-
// Set the lengths for the functions to satisfy ECMA-262.
|
1560
|
-
call->shared()->set_length(1);
|
1561
|
-
apply->shared()->set_length(2);
|
1562
|
-
}
|
1563
|
-
|
1564
|
-
// Create a constructor for RegExp results (a variant of Array that
|
1565
|
-
// predefines the two properties index and match).
|
1566
|
-
{
|
1567
|
-
// RegExpResult initial map.
|
1568
|
-
|
1569
|
-
// Find global.Array.prototype to inherit from.
|
1570
|
-
Handle<JSFunction> array_constructor(global_context()->array_function());
|
1571
|
-
Handle<JSObject> array_prototype(
|
1572
|
-
JSObject::cast(array_constructor->instance_prototype()));
|
1573
|
-
|
1574
|
-
// Add initial map.
|
1575
|
-
Handle<Map> initial_map =
|
1576
|
-
factory->NewMap(JS_ARRAY_TYPE, JSRegExpResult::kSize);
|
1577
|
-
initial_map->set_constructor(*array_constructor);
|
1578
|
-
|
1579
|
-
// Set prototype on map.
|
1580
|
-
initial_map->set_non_instance_prototype(false);
|
1581
|
-
initial_map->set_prototype(*array_prototype);
|
1582
|
-
|
1583
|
-
// Update map with length accessor from Array and add "index" and "input".
|
1584
|
-
Handle<Map> array_map(global_context()->js_array_map());
|
1585
|
-
Handle<DescriptorArray> array_descriptors(
|
1586
|
-
array_map->instance_descriptors());
|
1587
|
-
ASSERT_EQ(1, array_descriptors->number_of_descriptors());
|
1588
|
-
|
1589
|
-
Handle<DescriptorArray> reresult_descriptors =
|
1590
|
-
factory->NewDescriptorArray(3);
|
1591
|
-
|
1592
|
-
reresult_descriptors->CopyFrom(0, *array_descriptors, 0);
|
1593
|
-
|
1594
|
-
int enum_index = 0;
|
1595
|
-
{
|
1596
|
-
FieldDescriptor index_field(heap->index_symbol(),
|
1597
|
-
JSRegExpResult::kIndexIndex,
|
1598
|
-
NONE,
|
1599
|
-
enum_index++);
|
1600
|
-
reresult_descriptors->Set(1, &index_field);
|
1601
|
-
}
|
1602
|
-
|
1603
|
-
{
|
1604
|
-
FieldDescriptor input_field(heap->input_symbol(),
|
1605
|
-
JSRegExpResult::kInputIndex,
|
1606
|
-
NONE,
|
1607
|
-
enum_index++);
|
1608
|
-
reresult_descriptors->Set(2, &input_field);
|
1609
|
-
}
|
1610
|
-
reresult_descriptors->Sort();
|
1611
|
-
|
1612
|
-
initial_map->set_inobject_properties(2);
|
1613
|
-
initial_map->set_pre_allocated_property_fields(2);
|
1614
|
-
initial_map->set_unused_property_fields(0);
|
1615
|
-
initial_map->set_instance_descriptors(*reresult_descriptors);
|
1616
|
-
|
1617
|
-
global_context()->set_regexp_result_map(*initial_map);
|
1618
|
-
}
|
1619
|
-
|
1620
|
-
|
1621
|
-
#ifdef DEBUG
|
1622
|
-
builtins->Verify();
|
1623
|
-
#endif
|
1624
|
-
|
1625
|
-
return true;
|
1626
|
-
}
|
1627
|
-
|
1628
|
-
|
1629
|
-
static Handle<JSObject> ResolveBuiltinIdHolder(
|
1630
|
-
Handle<Context> global_context,
|
1631
|
-
const char* holder_expr) {
|
1632
|
-
Factory* factory = Isolate::Current()->factory();
|
1633
|
-
Handle<GlobalObject> global(global_context->global());
|
1634
|
-
const char* period_pos = strchr(holder_expr, '.');
|
1635
|
-
if (period_pos == NULL) {
|
1636
|
-
return Handle<JSObject>::cast(
|
1637
|
-
GetProperty(global, factory->LookupAsciiSymbol(holder_expr)));
|
1638
|
-
}
|
1639
|
-
ASSERT_EQ(".prototype", period_pos);
|
1640
|
-
Vector<const char> property(holder_expr,
|
1641
|
-
static_cast<int>(period_pos - holder_expr));
|
1642
|
-
Handle<JSFunction> function = Handle<JSFunction>::cast(
|
1643
|
-
GetProperty(global, factory->LookupSymbol(property)));
|
1644
|
-
return Handle<JSObject>(JSObject::cast(function->prototype()));
|
1645
|
-
}
|
1646
|
-
|
1647
|
-
|
1648
|
-
static void InstallBuiltinFunctionId(Handle<JSObject> holder,
|
1649
|
-
const char* function_name,
|
1650
|
-
BuiltinFunctionId id) {
|
1651
|
-
Handle<String> name = FACTORY->LookupAsciiSymbol(function_name);
|
1652
|
-
Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
|
1653
|
-
Handle<JSFunction> function(JSFunction::cast(function_object));
|
1654
|
-
function->shared()->set_function_data(Smi::FromInt(id));
|
1655
|
-
}
|
1656
|
-
|
1657
|
-
|
1658
|
-
void Genesis::InstallBuiltinFunctionIds() {
|
1659
|
-
HandleScope scope;
|
1660
|
-
#define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \
|
1661
|
-
{ \
|
1662
|
-
Handle<JSObject> holder = ResolveBuiltinIdHolder( \
|
1663
|
-
global_context(), #holder_expr); \
|
1664
|
-
BuiltinFunctionId id = k##name; \
|
1665
|
-
InstallBuiltinFunctionId(holder, #fun_name, id); \
|
1666
|
-
}
|
1667
|
-
FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)
|
1668
|
-
#undef INSTALL_BUILTIN_ID
|
1669
|
-
}
|
1670
|
-
|
1671
|
-
|
1672
|
-
// Do not forget to update macros.py with named constant
|
1673
|
-
// of cache id.
|
1674
|
-
#define JSFUNCTION_RESULT_CACHE_LIST(F) \
|
1675
|
-
F(16, global_context()->regexp_function())
|
1676
|
-
|
1677
|
-
|
1678
|
-
static FixedArray* CreateCache(int size, JSFunction* factory) {
|
1679
|
-
// Caches are supposed to live for a long time, allocate in old space.
|
1680
|
-
int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size;
|
1681
|
-
// Cannot use cast as object is not fully initialized yet.
|
1682
|
-
JSFunctionResultCache* cache = reinterpret_cast<JSFunctionResultCache*>(
|
1683
|
-
*FACTORY->NewFixedArrayWithHoles(array_size, TENURED));
|
1684
|
-
cache->set(JSFunctionResultCache::kFactoryIndex, factory);
|
1685
|
-
cache->MakeZeroSize();
|
1686
|
-
return cache;
|
1687
|
-
}
|
1688
|
-
|
1689
|
-
|
1690
|
-
void Genesis::InstallJSFunctionResultCaches() {
|
1691
|
-
const int kNumberOfCaches = 0 +
|
1692
|
-
#define F(size, func) + 1
|
1693
|
-
JSFUNCTION_RESULT_CACHE_LIST(F)
|
1694
|
-
#undef F
|
1695
|
-
;
|
1696
|
-
|
1697
|
-
Handle<FixedArray> caches = FACTORY->NewFixedArray(kNumberOfCaches, TENURED);
|
1698
|
-
|
1699
|
-
int index = 0;
|
1700
|
-
|
1701
|
-
#define F(size, func) do { \
|
1702
|
-
FixedArray* cache = CreateCache((size), (func)); \
|
1703
|
-
caches->set(index++, cache); \
|
1704
|
-
} while (false)
|
1705
|
-
|
1706
|
-
JSFUNCTION_RESULT_CACHE_LIST(F);
|
1707
|
-
|
1708
|
-
#undef F
|
1709
|
-
|
1710
|
-
global_context()->set_jsfunction_result_caches(*caches);
|
1711
|
-
}
|
1712
|
-
|
1713
|
-
|
1714
|
-
void Genesis::InitializeNormalizedMapCaches() {
|
1715
|
-
Handle<FixedArray> array(
|
1716
|
-
FACTORY->NewFixedArray(NormalizedMapCache::kEntries, TENURED));
|
1717
|
-
global_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array));
|
1718
|
-
}
|
1719
|
-
|
1720
|
-
|
1721
|
-
bool Bootstrapper::InstallExtensions(Handle<Context> global_context,
|
1722
|
-
v8::ExtensionConfiguration* extensions) {
|
1723
|
-
Isolate* isolate = Isolate::Current();
|
1724
|
-
BootstrapperActive active;
|
1725
|
-
SaveContext saved_context(isolate);
|
1726
|
-
isolate->set_context(*global_context);
|
1727
|
-
if (!Genesis::InstallExtensions(global_context, extensions)) return false;
|
1728
|
-
Genesis::InstallSpecialObjects(global_context);
|
1729
|
-
return true;
|
1730
|
-
}
|
1731
|
-
|
1732
|
-
|
1733
|
-
void Genesis::InstallSpecialObjects(Handle<Context> global_context) {
|
1734
|
-
Factory* factory = Isolate::Current()->factory();
|
1735
|
-
HandleScope scope;
|
1736
|
-
Handle<JSGlobalObject> js_global(
|
1737
|
-
JSGlobalObject::cast(global_context->global()));
|
1738
|
-
// Expose the natives in global if a name for it is specified.
|
1739
|
-
if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
|
1740
|
-
Handle<String> natives_string =
|
1741
|
-
factory->LookupAsciiSymbol(FLAG_expose_natives_as);
|
1742
|
-
SetLocalPropertyNoThrow(js_global, natives_string,
|
1743
|
-
Handle<JSObject>(js_global->builtins()), DONT_ENUM);
|
1744
|
-
}
|
1745
|
-
|
1746
|
-
Handle<Object> Error = GetProperty(js_global, "Error");
|
1747
|
-
if (Error->IsJSObject()) {
|
1748
|
-
Handle<String> name = factory->LookupAsciiSymbol("stackTraceLimit");
|
1749
|
-
SetLocalPropertyNoThrow(Handle<JSObject>::cast(Error),
|
1750
|
-
name,
|
1751
|
-
Handle<Smi>(Smi::FromInt(FLAG_stack_trace_limit)),
|
1752
|
-
NONE);
|
1753
|
-
}
|
1754
|
-
|
1755
|
-
#ifdef ENABLE_DEBUGGER_SUPPORT
|
1756
|
-
// Expose the debug global object in global if a name for it is specified.
|
1757
|
-
if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) {
|
1758
|
-
Debug* debug = Isolate::Current()->debug();
|
1759
|
-
// If loading fails we just bail out without installing the
|
1760
|
-
// debugger but without tanking the whole context.
|
1761
|
-
if (!debug->Load()) return;
|
1762
|
-
// Set the security token for the debugger context to the same as
|
1763
|
-
// the shell global context to allow calling between these (otherwise
|
1764
|
-
// exposing debug global object doesn't make much sense).
|
1765
|
-
debug->debug_context()->set_security_token(
|
1766
|
-
global_context->security_token());
|
1767
|
-
|
1768
|
-
Handle<String> debug_string =
|
1769
|
-
factory->LookupAsciiSymbol(FLAG_expose_debug_as);
|
1770
|
-
Handle<Object> global_proxy(debug->debug_context()->global_proxy());
|
1771
|
-
SetLocalPropertyNoThrow(js_global, debug_string, global_proxy, DONT_ENUM);
|
1772
|
-
}
|
1773
|
-
#endif
|
1774
|
-
}
|
1775
|
-
|
1776
|
-
|
1777
|
-
bool Genesis::InstallExtensions(Handle<Context> global_context,
|
1778
|
-
v8::ExtensionConfiguration* extensions) {
|
1779
|
-
// TODO(isolates): Extensions on multiple isolates may take a little more
|
1780
|
-
// effort. (The external API reads 'ignore'-- does that mean
|
1781
|
-
// we can break the interface?)
|
1782
|
-
|
1783
|
-
// Clear coloring of extension list
|
1784
|
-
v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension();
|
1785
|
-
while (current != NULL) {
|
1786
|
-
current->set_state(v8::UNVISITED);
|
1787
|
-
current = current->next();
|
1788
|
-
}
|
1789
|
-
// Install auto extensions.
|
1790
|
-
current = v8::RegisteredExtension::first_extension();
|
1791
|
-
while (current != NULL) {
|
1792
|
-
if (current->extension()->auto_enable())
|
1793
|
-
InstallExtension(current);
|
1794
|
-
current = current->next();
|
1795
|
-
}
|
1796
|
-
|
1797
|
-
if (FLAG_expose_gc) InstallExtension("v8/gc");
|
1798
|
-
if (FLAG_expose_externalize_string) InstallExtension("v8/externalize");
|
1799
|
-
|
1800
|
-
if (extensions == NULL) return true;
|
1801
|
-
// Install required extensions
|
1802
|
-
int count = v8::ImplementationUtilities::GetNameCount(extensions);
|
1803
|
-
const char** names = v8::ImplementationUtilities::GetNames(extensions);
|
1804
|
-
for (int i = 0; i < count; i++) {
|
1805
|
-
if (!InstallExtension(names[i]))
|
1806
|
-
return false;
|
1807
|
-
}
|
1808
|
-
|
1809
|
-
return true;
|
1810
|
-
}
|
1811
|
-
|
1812
|
-
|
1813
|
-
// Installs a named extension. This methods is unoptimized and does
|
1814
|
-
// not scale well if we want to support a large number of extensions.
|
1815
|
-
bool Genesis::InstallExtension(const char* name) {
|
1816
|
-
v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension();
|
1817
|
-
// Loop until we find the relevant extension
|
1818
|
-
while (current != NULL) {
|
1819
|
-
if (strcmp(name, current->extension()->name()) == 0) break;
|
1820
|
-
current = current->next();
|
1821
|
-
}
|
1822
|
-
// Didn't find the extension; fail.
|
1823
|
-
if (current == NULL) {
|
1824
|
-
v8::Utils::ReportApiFailure(
|
1825
|
-
"v8::Context::New()", "Cannot find required extension");
|
1826
|
-
return false;
|
1827
|
-
}
|
1828
|
-
return InstallExtension(current);
|
1829
|
-
}
|
1830
|
-
|
1831
|
-
|
1832
|
-
bool Genesis::InstallExtension(v8::RegisteredExtension* current) {
|
1833
|
-
HandleScope scope;
|
1834
|
-
|
1835
|
-
if (current->state() == v8::INSTALLED) return true;
|
1836
|
-
// The current node has already been visited so there must be a
|
1837
|
-
// cycle in the dependency graph; fail.
|
1838
|
-
if (current->state() == v8::VISITED) {
|
1839
|
-
v8::Utils::ReportApiFailure(
|
1840
|
-
"v8::Context::New()", "Circular extension dependency");
|
1841
|
-
return false;
|
1842
|
-
}
|
1843
|
-
ASSERT(current->state() == v8::UNVISITED);
|
1844
|
-
current->set_state(v8::VISITED);
|
1845
|
-
v8::Extension* extension = current->extension();
|
1846
|
-
// Install the extension's dependencies
|
1847
|
-
for (int i = 0; i < extension->dependency_count(); i++) {
|
1848
|
-
if (!InstallExtension(extension->dependencies()[i])) return false;
|
1849
|
-
}
|
1850
|
-
Isolate* isolate = Isolate::Current();
|
1851
|
-
Vector<const char> source = CStrVector(extension->source());
|
1852
|
-
Handle<String> source_code = isolate->factory()->NewStringFromAscii(source);
|
1853
|
-
bool result = CompileScriptCached(CStrVector(extension->name()),
|
1854
|
-
source_code,
|
1855
|
-
isolate->bootstrapper()->extensions_cache(),
|
1856
|
-
extension,
|
1857
|
-
Handle<Context>(isolate->context()),
|
1858
|
-
false);
|
1859
|
-
ASSERT(isolate->has_pending_exception() != result);
|
1860
|
-
if (!result) {
|
1861
|
-
isolate->clear_pending_exception();
|
1862
|
-
}
|
1863
|
-
current->set_state(v8::INSTALLED);
|
1864
|
-
return result;
|
1865
|
-
}
|
1866
|
-
|
1867
|
-
|
1868
|
-
bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
|
1869
|
-
HandleScope scope;
|
1870
|
-
for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
|
1871
|
-
Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
|
1872
|
-
Handle<String> name = FACTORY->LookupAsciiSymbol(Builtins::GetName(id));
|
1873
|
-
Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
|
1874
|
-
Handle<JSFunction> function
|
1875
|
-
= Handle<JSFunction>(JSFunction::cast(function_object));
|
1876
|
-
builtins->set_javascript_builtin(id, *function);
|
1877
|
-
Handle<SharedFunctionInfo> shared
|
1878
|
-
= Handle<SharedFunctionInfo>(function->shared());
|
1879
|
-
if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false;
|
1880
|
-
// Set the code object on the function object.
|
1881
|
-
function->ReplaceCode(function->shared()->code());
|
1882
|
-
builtins->set_javascript_builtin_code(id, shared->code());
|
1883
|
-
}
|
1884
|
-
return true;
|
1885
|
-
}
|
1886
|
-
|
1887
|
-
|
1888
|
-
bool Genesis::ConfigureGlobalObjects(
|
1889
|
-
v8::Handle<v8::ObjectTemplate> global_proxy_template) {
|
1890
|
-
Handle<JSObject> global_proxy(
|
1891
|
-
JSObject::cast(global_context()->global_proxy()));
|
1892
|
-
Handle<JSObject> inner_global(JSObject::cast(global_context()->global()));
|
1893
|
-
|
1894
|
-
if (!global_proxy_template.IsEmpty()) {
|
1895
|
-
// Configure the global proxy object.
|
1896
|
-
Handle<ObjectTemplateInfo> proxy_data =
|
1897
|
-
v8::Utils::OpenHandle(*global_proxy_template);
|
1898
|
-
if (!ConfigureApiObject(global_proxy, proxy_data)) return false;
|
1899
|
-
|
1900
|
-
// Configure the inner global object.
|
1901
|
-
Handle<FunctionTemplateInfo> proxy_constructor(
|
1902
|
-
FunctionTemplateInfo::cast(proxy_data->constructor()));
|
1903
|
-
if (!proxy_constructor->prototype_template()->IsUndefined()) {
|
1904
|
-
Handle<ObjectTemplateInfo> inner_data(
|
1905
|
-
ObjectTemplateInfo::cast(proxy_constructor->prototype_template()));
|
1906
|
-
if (!ConfigureApiObject(inner_global, inner_data)) return false;
|
1907
|
-
}
|
1908
|
-
}
|
1909
|
-
|
1910
|
-
SetObjectPrototype(global_proxy, inner_global);
|
1911
|
-
return true;
|
1912
|
-
}
|
1913
|
-
|
1914
|
-
|
1915
|
-
bool Genesis::ConfigureApiObject(Handle<JSObject> object,
|
1916
|
-
Handle<ObjectTemplateInfo> object_template) {
|
1917
|
-
ASSERT(!object_template.is_null());
|
1918
|
-
ASSERT(object->IsInstanceOf(
|
1919
|
-
FunctionTemplateInfo::cast(object_template->constructor())));
|
1920
|
-
|
1921
|
-
Isolate* isolate = Isolate::Current();
|
1922
|
-
bool pending_exception = false;
|
1923
|
-
Handle<JSObject> obj =
|
1924
|
-
Execution::InstantiateObject(object_template, &pending_exception);
|
1925
|
-
if (pending_exception) {
|
1926
|
-
ASSERT(isolate->has_pending_exception());
|
1927
|
-
isolate->clear_pending_exception();
|
1928
|
-
return false;
|
1929
|
-
}
|
1930
|
-
TransferObject(obj, object);
|
1931
|
-
return true;
|
1932
|
-
}
|
1933
|
-
|
1934
|
-
|
1935
|
-
void Genesis::TransferNamedProperties(Handle<JSObject> from,
|
1936
|
-
Handle<JSObject> to) {
|
1937
|
-
if (from->HasFastProperties()) {
|
1938
|
-
Handle<DescriptorArray> descs =
|
1939
|
-
Handle<DescriptorArray>(from->map()->instance_descriptors());
|
1940
|
-
for (int i = 0; i < descs->number_of_descriptors(); i++) {
|
1941
|
-
PropertyDetails details = PropertyDetails(descs->GetDetails(i));
|
1942
|
-
switch (details.type()) {
|
1943
|
-
case FIELD: {
|
1944
|
-
HandleScope inner;
|
1945
|
-
Handle<String> key = Handle<String>(descs->GetKey(i));
|
1946
|
-
int index = descs->GetFieldIndex(i);
|
1947
|
-
Handle<Object> value = Handle<Object>(from->FastPropertyAt(index));
|
1948
|
-
SetLocalPropertyNoThrow(to, key, value, details.attributes());
|
1949
|
-
break;
|
1950
|
-
}
|
1951
|
-
case CONSTANT_FUNCTION: {
|
1952
|
-
HandleScope inner;
|
1953
|
-
Handle<String> key = Handle<String>(descs->GetKey(i));
|
1954
|
-
Handle<JSFunction> fun =
|
1955
|
-
Handle<JSFunction>(descs->GetConstantFunction(i));
|
1956
|
-
SetLocalPropertyNoThrow(to, key, fun, details.attributes());
|
1957
|
-
break;
|
1958
|
-
}
|
1959
|
-
case CALLBACKS: {
|
1960
|
-
LookupResult result;
|
1961
|
-
to->LocalLookup(descs->GetKey(i), &result);
|
1962
|
-
// If the property is already there we skip it
|
1963
|
-
if (result.IsProperty()) continue;
|
1964
|
-
HandleScope inner;
|
1965
|
-
ASSERT(!to->HasFastProperties());
|
1966
|
-
// Add to dictionary.
|
1967
|
-
Handle<String> key = Handle<String>(descs->GetKey(i));
|
1968
|
-
Handle<Object> callbacks(descs->GetCallbacksObject(i));
|
1969
|
-
PropertyDetails d =
|
1970
|
-
PropertyDetails(details.attributes(), CALLBACKS, details.index());
|
1971
|
-
SetNormalizedProperty(to, key, callbacks, d);
|
1972
|
-
break;
|
1973
|
-
}
|
1974
|
-
case MAP_TRANSITION:
|
1975
|
-
case EXTERNAL_ARRAY_TRANSITION:
|
1976
|
-
case CONSTANT_TRANSITION:
|
1977
|
-
case NULL_DESCRIPTOR:
|
1978
|
-
// Ignore non-properties.
|
1979
|
-
break;
|
1980
|
-
case NORMAL:
|
1981
|
-
// Do not occur since the from object has fast properties.
|
1982
|
-
case INTERCEPTOR:
|
1983
|
-
// No element in instance descriptors have interceptor type.
|
1984
|
-
UNREACHABLE();
|
1985
|
-
break;
|
1986
|
-
}
|
1987
|
-
}
|
1988
|
-
} else {
|
1989
|
-
Handle<StringDictionary> properties =
|
1990
|
-
Handle<StringDictionary>(from->property_dictionary());
|
1991
|
-
int capacity = properties->Capacity();
|
1992
|
-
for (int i = 0; i < capacity; i++) {
|
1993
|
-
Object* raw_key(properties->KeyAt(i));
|
1994
|
-
if (properties->IsKey(raw_key)) {
|
1995
|
-
ASSERT(raw_key->IsString());
|
1996
|
-
// If the property is already there we skip it.
|
1997
|
-
LookupResult result;
|
1998
|
-
to->LocalLookup(String::cast(raw_key), &result);
|
1999
|
-
if (result.IsProperty()) continue;
|
2000
|
-
// Set the property.
|
2001
|
-
Handle<String> key = Handle<String>(String::cast(raw_key));
|
2002
|
-
Handle<Object> value = Handle<Object>(properties->ValueAt(i));
|
2003
|
-
if (value->IsJSGlobalPropertyCell()) {
|
2004
|
-
value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value());
|
2005
|
-
}
|
2006
|
-
PropertyDetails details = properties->DetailsAt(i);
|
2007
|
-
SetLocalPropertyNoThrow(to, key, value, details.attributes());
|
2008
|
-
}
|
2009
|
-
}
|
2010
|
-
}
|
2011
|
-
}
|
2012
|
-
|
2013
|
-
|
2014
|
-
void Genesis::TransferIndexedProperties(Handle<JSObject> from,
|
2015
|
-
Handle<JSObject> to) {
|
2016
|
-
// Cloning the elements array is sufficient.
|
2017
|
-
Handle<FixedArray> from_elements =
|
2018
|
-
Handle<FixedArray>(FixedArray::cast(from->elements()));
|
2019
|
-
Handle<FixedArray> to_elements = FACTORY->CopyFixedArray(from_elements);
|
2020
|
-
to->set_elements(*to_elements);
|
2021
|
-
}
|
2022
|
-
|
2023
|
-
|
2024
|
-
void Genesis::TransferObject(Handle<JSObject> from, Handle<JSObject> to) {
|
2025
|
-
HandleScope outer;
|
2026
|
-
|
2027
|
-
ASSERT(!from->IsJSArray());
|
2028
|
-
ASSERT(!to->IsJSArray());
|
2029
|
-
|
2030
|
-
TransferNamedProperties(from, to);
|
2031
|
-
TransferIndexedProperties(from, to);
|
2032
|
-
|
2033
|
-
// Transfer the prototype (new map is needed).
|
2034
|
-
Handle<Map> old_to_map = Handle<Map>(to->map());
|
2035
|
-
Handle<Map> new_to_map = FACTORY->CopyMapDropTransitions(old_to_map);
|
2036
|
-
new_to_map->set_prototype(from->map()->prototype());
|
2037
|
-
to->set_map(*new_to_map);
|
2038
|
-
}
|
2039
|
-
|
2040
|
-
|
2041
|
-
void Genesis::MakeFunctionInstancePrototypeWritable() {
|
2042
|
-
// The maps with writable prototype are created in CreateEmptyFunction
|
2043
|
-
// and CreateStrictModeFunctionMaps respectively. Initially the maps are
|
2044
|
-
// created with read-only prototype for JS builtins processing.
|
2045
|
-
ASSERT(!function_instance_map_writable_prototype_.is_null());
|
2046
|
-
ASSERT(!strict_mode_function_instance_map_writable_prototype_.is_null());
|
2047
|
-
|
2048
|
-
// Replace function instance maps to make prototype writable.
|
2049
|
-
global_context()->set_function_map(
|
2050
|
-
*function_instance_map_writable_prototype_);
|
2051
|
-
global_context()->set_strict_mode_function_map(
|
2052
|
-
*strict_mode_function_instance_map_writable_prototype_);
|
2053
|
-
}
|
2054
|
-
|
2055
|
-
|
2056
|
-
Genesis::Genesis(Handle<Object> global_object,
|
2057
|
-
v8::Handle<v8::ObjectTemplate> global_template,
|
2058
|
-
v8::ExtensionConfiguration* extensions) {
|
2059
|
-
Isolate* isolate = Isolate::Current();
|
2060
|
-
result_ = Handle<Context>::null();
|
2061
|
-
// If V8 isn't running and cannot be initialized, just return.
|
2062
|
-
if (!V8::IsRunning() && !V8::Initialize(NULL)) return;
|
2063
|
-
|
2064
|
-
// Before creating the roots we must save the context and restore it
|
2065
|
-
// on all function exits.
|
2066
|
-
HandleScope scope;
|
2067
|
-
SaveContext saved_context(isolate);
|
2068
|
-
|
2069
|
-
Handle<Context> new_context = Snapshot::NewContextFromSnapshot();
|
2070
|
-
if (!new_context.is_null()) {
|
2071
|
-
global_context_ =
|
2072
|
-
Handle<Context>::cast(isolate->global_handles()->Create(*new_context));
|
2073
|
-
AddToWeakGlobalContextList(*global_context_);
|
2074
|
-
isolate->set_context(*global_context_);
|
2075
|
-
isolate->counters()->contexts_created_by_snapshot()->Increment();
|
2076
|
-
Handle<GlobalObject> inner_global;
|
2077
|
-
Handle<JSGlobalProxy> global_proxy =
|
2078
|
-
CreateNewGlobals(global_template,
|
2079
|
-
global_object,
|
2080
|
-
&inner_global);
|
2081
|
-
|
2082
|
-
HookUpGlobalProxy(inner_global, global_proxy);
|
2083
|
-
HookUpInnerGlobal(inner_global);
|
2084
|
-
|
2085
|
-
if (!ConfigureGlobalObjects(global_template)) return;
|
2086
|
-
} else {
|
2087
|
-
// We get here if there was no context snapshot.
|
2088
|
-
CreateRoots();
|
2089
|
-
Handle<JSFunction> empty_function = CreateEmptyFunction();
|
2090
|
-
CreateStrictModeFunctionMaps(empty_function);
|
2091
|
-
Handle<GlobalObject> inner_global;
|
2092
|
-
Handle<JSGlobalProxy> global_proxy =
|
2093
|
-
CreateNewGlobals(global_template, global_object, &inner_global);
|
2094
|
-
HookUpGlobalProxy(inner_global, global_proxy);
|
2095
|
-
InitializeGlobal(inner_global, empty_function);
|
2096
|
-
InstallJSFunctionResultCaches();
|
2097
|
-
InitializeNormalizedMapCaches();
|
2098
|
-
if (!InstallNatives()) return;
|
2099
|
-
|
2100
|
-
MakeFunctionInstancePrototypeWritable();
|
2101
|
-
|
2102
|
-
if (!ConfigureGlobalObjects(global_template)) return;
|
2103
|
-
isolate->counters()->contexts_created_from_scratch()->Increment();
|
2104
|
-
}
|
2105
|
-
|
2106
|
-
result_ = global_context_;
|
2107
|
-
}
|
2108
|
-
|
2109
|
-
|
2110
|
-
// Support for thread preemption.
|
2111
|
-
|
2112
|
-
// Reserve space for statics needing saving and restoring.
|
2113
|
-
int Bootstrapper::ArchiveSpacePerThread() {
|
2114
|
-
return sizeof(NestingCounterType);
|
2115
|
-
}
|
2116
|
-
|
2117
|
-
|
2118
|
-
// Archive statics that are thread local.
|
2119
|
-
char* Bootstrapper::ArchiveState(char* to) {
|
2120
|
-
*reinterpret_cast<NestingCounterType*>(to) = nesting_;
|
2121
|
-
nesting_ = 0;
|
2122
|
-
return to + sizeof(NestingCounterType);
|
2123
|
-
}
|
2124
|
-
|
2125
|
-
|
2126
|
-
// Restore statics that are thread local.
|
2127
|
-
char* Bootstrapper::RestoreState(char* from) {
|
2128
|
-
nesting_ = *reinterpret_cast<NestingCounterType*>(from);
|
2129
|
-
return from + sizeof(NestingCounterType);
|
2130
|
-
}
|
2131
|
-
|
2132
|
-
|
2133
|
-
// Called when the top-level V8 mutex is destroyed.
|
2134
|
-
void Bootstrapper::FreeThreadResources() {
|
2135
|
-
ASSERT(!IsActive());
|
2136
|
-
}
|
2137
|
-
|
2138
|
-
} } // namespace v8::internal
|