libv8 3.3.10.4 → 3.5.10.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/libv8/scons/CHANGES.txt +24 -231
- data/lib/libv8/scons/LICENSE.txt +1 -1
- data/lib/libv8/scons/MANIFEST +0 -1
- data/lib/libv8/scons/PKG-INFO +1 -1
- data/lib/libv8/scons/README.txt +9 -9
- data/lib/libv8/scons/RELEASE.txt +75 -77
- data/lib/libv8/scons/engine/SCons/Action.py +6 -22
- data/lib/libv8/scons/engine/SCons/Builder.py +2 -2
- data/lib/libv8/scons/engine/SCons/CacheDir.py +2 -2
- data/lib/libv8/scons/engine/SCons/Debug.py +2 -2
- data/lib/libv8/scons/engine/SCons/Defaults.py +10 -24
- data/lib/libv8/scons/engine/SCons/Environment.py +19 -118
- data/lib/libv8/scons/engine/SCons/Errors.py +2 -2
- data/lib/libv8/scons/engine/SCons/Executor.py +2 -2
- data/lib/libv8/scons/engine/SCons/Job.py +2 -2
- data/lib/libv8/scons/engine/SCons/Memoize.py +2 -2
- data/lib/libv8/scons/engine/SCons/Node/Alias.py +2 -2
- data/lib/libv8/scons/engine/SCons/Node/FS.py +121 -281
- data/lib/libv8/scons/engine/SCons/Node/Python.py +2 -2
- data/lib/libv8/scons/engine/SCons/Node/__init__.py +5 -6
- data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +2 -2
- data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +2 -2
- data/lib/libv8/scons/engine/SCons/Options/ListOption.py +2 -2
- data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +2 -2
- data/lib/libv8/scons/engine/SCons/Options/PathOption.py +2 -2
- data/lib/libv8/scons/engine/SCons/Options/__init__.py +2 -2
- data/lib/libv8/scons/engine/SCons/PathList.py +2 -2
- data/lib/libv8/scons/engine/SCons/Platform/__init__.py +2 -2
- data/lib/libv8/scons/engine/SCons/Platform/aix.py +2 -2
- data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +2 -2
- data/lib/libv8/scons/engine/SCons/Platform/darwin.py +3 -27
- data/lib/libv8/scons/engine/SCons/Platform/hpux.py +2 -2
- data/lib/libv8/scons/engine/SCons/Platform/irix.py +2 -2
- data/lib/libv8/scons/engine/SCons/Platform/os2.py +2 -2
- data/lib/libv8/scons/engine/SCons/Platform/posix.py +2 -2
- data/lib/libv8/scons/engine/SCons/Platform/sunos.py +2 -2
- data/lib/libv8/scons/engine/SCons/Platform/win32.py +2 -2
- data/lib/libv8/scons/engine/SCons/SConf.py +2 -2
- data/lib/libv8/scons/engine/SCons/SConsign.py +3 -9
- data/lib/libv8/scons/engine/SCons/Scanner/C.py +2 -2
- data/lib/libv8/scons/engine/SCons/Scanner/D.py +2 -2
- data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +2 -2
- data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +2 -2
- data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +2 -2
- data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +2 -5
- data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +2 -2
- data/lib/libv8/scons/engine/SCons/Scanner/RC.py +3 -3
- data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +2 -2
- data/lib/libv8/scons/engine/SCons/Script/Interactive.py +2 -2
- data/lib/libv8/scons/engine/SCons/Script/Main.py +11 -82
- data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +5 -5
- data/lib/libv8/scons/engine/SCons/Script/SConscript.py +2 -2
- data/lib/libv8/scons/engine/SCons/Script/__init__.py +2 -2
- data/lib/libv8/scons/engine/SCons/Sig.py +2 -2
- data/lib/libv8/scons/engine/SCons/Subst.py +2 -2
- data/lib/libv8/scons/engine/SCons/Taskmaster.py +2 -10
- data/lib/libv8/scons/engine/SCons/Tool/386asm.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/CVS.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +2 -19
- data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +6 -9
- data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +2 -29
- data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/RCS.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/__init__.py +3 -3
- data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/applelink.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/ar.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/as.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/c++.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/cc.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/cvf.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/default.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/dmd.py +7 -24
- data/lib/libv8/scons/engine/SCons/Tool/dvi.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +2 -3
- data/lib/libv8/scons/engine/SCons/Tool/dvips.py +2 -3
- data/lib/libv8/scons/engine/SCons/Tool/f77.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/f90.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/f95.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/fortran.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/g++.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/g77.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/gas.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/gcc.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +3 -3
- data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +3 -2
- data/lib/libv8/scons/engine/SCons/Tool/gs.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/hplink.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/icc.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/icl.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/ifl.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/ifort.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/ilink.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/install.py +3 -57
- data/lib/libv8/scons/engine/SCons/Tool/intelc.py +25 -65
- data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/jar.py +3 -9
- data/lib/libv8/scons/engine/SCons/Tool/javac.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/javah.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/latex.py +2 -3
- data/lib/libv8/scons/engine/SCons/Tool/lex.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/link.py +5 -6
- data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/m4.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/masm.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/midl.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/mingw.py +10 -31
- data/lib/libv8/scons/engine/SCons/Tool/mslib.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/mslink.py +9 -61
- data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/msvc.py +11 -21
- data/lib/libv8/scons/engine/SCons/Tool/msvs.py +59 -477
- data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/mwld.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/nasm.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/pdf.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +2 -3
- data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +2 -3
- data/lib/libv8/scons/engine/SCons/Tool/qt.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/rmic.py +3 -9
- data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/rpm.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +3 -2
- data/lib/libv8/scons/engine/SCons/Tool/sunar.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/suncc.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +3 -2
- data/lib/libv8/scons/engine/SCons/Tool/swig.py +5 -6
- data/lib/libv8/scons/engine/SCons/Tool/tar.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/tex.py +43 -96
- data/lib/libv8/scons/engine/SCons/Tool/textfile.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/tlib.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/wix.py +2 -2
- data/lib/libv8/scons/engine/SCons/Tool/yacc.py +2 -12
- data/lib/libv8/scons/engine/SCons/Tool/zip.py +2 -2
- data/lib/libv8/scons/engine/SCons/Util.py +3 -3
- data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +2 -2
- data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +3 -3
- data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +2 -2
- data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +2 -2
- data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +2 -2
- data/lib/libv8/scons/engine/SCons/Variables/__init__.py +2 -2
- data/lib/libv8/scons/engine/SCons/Warnings.py +2 -2
- data/lib/libv8/scons/engine/SCons/__init__.py +6 -6
- data/lib/libv8/scons/engine/SCons/compat/__init__.py +2 -2
- data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +2 -2
- data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +2 -2
- data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +2 -2
- data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +2 -2
- data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +2 -2
- data/lib/libv8/scons/engine/SCons/cpp.py +2 -2
- data/lib/libv8/scons/engine/SCons/dblite.py +1 -4
- data/lib/libv8/scons/engine/SCons/exitfuncs.py +2 -2
- data/lib/libv8/scons/scons-time.1 +3 -3
- data/lib/libv8/scons/scons.1 +1164 -1170
- data/lib/libv8/scons/sconsign.1 +3 -3
- data/lib/libv8/scons/script/scons +22 -22
- data/lib/libv8/scons/script/scons-time +2 -2
- data/lib/libv8/scons/script/scons.bat +4 -7
- data/lib/libv8/scons/script/sconsign +20 -21
- data/lib/libv8/scons/setup.cfg +1 -0
- data/lib/libv8/scons/setup.py +40 -38
- data/lib/libv8/v8/.gitignore +1 -1
- data/lib/libv8/v8/AUTHORS +2 -0
- data/lib/libv8/v8/ChangeLog +387 -0
- data/lib/libv8/v8/Makefile +171 -0
- data/lib/libv8/v8/SConstruct +124 -51
- data/lib/libv8/v8/build/README.txt +31 -14
- data/lib/libv8/v8/build/all.gyp +11 -4
- data/lib/libv8/v8/build/armu.gypi +6 -2
- data/lib/libv8/v8/build/common.gypi +240 -94
- data/lib/libv8/v8/build/gyp_v8 +32 -4
- data/lib/libv8/v8/build/standalone.gypi +200 -0
- data/lib/libv8/v8/include/v8-debug.h +0 -0
- data/lib/libv8/v8/include/v8-profiler.h +8 -11
- data/lib/libv8/v8/include/v8.h +191 -108
- data/lib/libv8/v8/preparser/SConscript +2 -2
- data/lib/libv8/v8/preparser/preparser-process.cc +3 -3
- data/lib/libv8/v8/preparser/preparser.gyp +42 -0
- data/lib/libv8/v8/src/SConscript +33 -8
- data/lib/libv8/v8/src/accessors.cc +77 -43
- data/lib/libv8/v8/src/api.cc +393 -191
- data/lib/libv8/v8/src/api.h +4 -8
- data/lib/libv8/v8/src/apinatives.js +15 -3
- data/lib/libv8/v8/src/arguments.h +8 -0
- data/lib/libv8/v8/src/arm/assembler-arm.cc +120 -120
- data/lib/libv8/v8/src/arm/assembler-arm.h +92 -43
- data/lib/libv8/v8/src/arm/builtins-arm.cc +32 -39
- data/lib/libv8/v8/src/arm/code-stubs-arm.cc +572 -351
- data/lib/libv8/v8/src/arm/code-stubs-arm.h +8 -77
- data/lib/libv8/v8/src/arm/codegen-arm.h +0 -2
- data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +50 -30
- data/lib/libv8/v8/src/arm/disasm-arm.cc +1 -1
- data/lib/libv8/v8/src/arm/frames-arm.h +9 -5
- data/lib/libv8/v8/src/arm/full-codegen-arm.cc +331 -432
- data/lib/libv8/v8/src/arm/ic-arm.cc +192 -124
- data/lib/libv8/v8/src/arm/lithium-arm.cc +216 -232
- data/lib/libv8/v8/src/arm/lithium-arm.h +106 -259
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +633 -642
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +4 -4
- data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +1 -3
- data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +260 -185
- data/lib/libv8/v8/src/arm/macro-assembler-arm.h +45 -25
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +25 -13
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +3 -0
- data/lib/libv8/v8/src/arm/stub-cache-arm.cc +413 -226
- data/lib/libv8/v8/src/array.js +38 -18
- data/lib/libv8/v8/src/assembler.cc +12 -5
- data/lib/libv8/v8/src/assembler.h +15 -9
- data/lib/libv8/v8/src/ast-inl.h +34 -25
- data/lib/libv8/v8/src/ast.cc +141 -72
- data/lib/libv8/v8/src/ast.h +255 -181
- data/lib/libv8/v8/src/bignum.cc +3 -4
- data/lib/libv8/v8/src/bootstrapper.cc +55 -11
- data/lib/libv8/v8/src/bootstrapper.h +3 -2
- data/lib/libv8/v8/src/builtins.cc +8 -2
- data/lib/libv8/v8/src/builtins.h +4 -0
- data/lib/libv8/v8/src/cached-powers.cc +8 -4
- data/lib/libv8/v8/src/checks.h +3 -3
- data/lib/libv8/v8/src/code-stubs.cc +173 -28
- data/lib/libv8/v8/src/code-stubs.h +104 -148
- data/lib/libv8/v8/src/codegen.cc +8 -8
- data/lib/libv8/v8/src/compilation-cache.cc +2 -47
- data/lib/libv8/v8/src/compilation-cache.h +0 -10
- data/lib/libv8/v8/src/compiler.cc +27 -16
- data/lib/libv8/v8/src/compiler.h +13 -18
- data/lib/libv8/v8/src/contexts.cc +107 -72
- data/lib/libv8/v8/src/contexts.h +70 -34
- data/lib/libv8/v8/src/conversions-inl.h +572 -14
- data/lib/libv8/v8/src/conversions.cc +9 -707
- data/lib/libv8/v8/src/conversions.h +23 -12
- data/lib/libv8/v8/src/cpu-profiler-inl.h +2 -19
- data/lib/libv8/v8/src/cpu-profiler.cc +4 -21
- data/lib/libv8/v8/src/cpu-profiler.h +8 -17
- data/lib/libv8/v8/src/d8-debug.cc +5 -3
- data/lib/libv8/v8/src/d8-debug.h +6 -7
- data/lib/libv8/v8/src/d8-posix.cc +1 -10
- data/lib/libv8/v8/src/d8.cc +721 -219
- data/lib/libv8/v8/src/d8.gyp +37 -12
- data/lib/libv8/v8/src/d8.h +141 -19
- data/lib/libv8/v8/src/d8.js +17 -8
- data/lib/libv8/v8/src/date.js +16 -5
- data/lib/libv8/v8/src/dateparser-inl.h +242 -39
- data/lib/libv8/v8/src/dateparser.cc +38 -4
- data/lib/libv8/v8/src/dateparser.h +170 -28
- data/lib/libv8/v8/src/debug-agent.cc +5 -3
- data/lib/libv8/v8/src/debug-agent.h +11 -7
- data/lib/libv8/v8/src/debug-debugger.js +65 -34
- data/lib/libv8/v8/src/debug.cc +30 -60
- data/lib/libv8/v8/src/debug.h +5 -3
- data/lib/libv8/v8/src/deoptimizer.cc +227 -10
- data/lib/libv8/v8/src/deoptimizer.h +133 -9
- data/lib/libv8/v8/src/disassembler.cc +22 -14
- data/lib/libv8/v8/src/diy-fp.cc +4 -3
- data/lib/libv8/v8/src/diy-fp.h +3 -3
- data/lib/libv8/v8/src/elements.cc +634 -0
- data/lib/libv8/v8/src/elements.h +95 -0
- data/lib/libv8/v8/src/execution.cc +5 -21
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +3 -1
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +1 -1
- data/lib/libv8/v8/src/extensions/experimental/collator.cc +6 -2
- data/lib/libv8/v8/src/extensions/experimental/collator.h +1 -2
- data/lib/libv8/v8/src/extensions/experimental/datetime-format.cc +384 -0
- data/lib/libv8/v8/src/extensions/experimental/datetime-format.h +83 -0
- data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +18 -7
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +12 -16
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +1 -1
- data/lib/libv8/v8/src/extensions/experimental/i18n-js2c.py +126 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +3 -4
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +1 -1
- data/lib/libv8/v8/src/{shell.h → extensions/experimental/i18n-natives.h} +8 -20
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +45 -1
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +21 -1
- data/lib/libv8/v8/src/extensions/experimental/i18n.js +211 -11
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +4 -3
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +1 -1
- data/lib/libv8/v8/src/extensions/experimental/number-format.cc +374 -0
- data/lib/libv8/v8/src/extensions/experimental/number-format.h +71 -0
- data/lib/libv8/v8/src/factory.cc +89 -18
- data/lib/libv8/v8/src/factory.h +36 -8
- data/lib/libv8/v8/src/flag-definitions.h +11 -44
- data/lib/libv8/v8/src/frames-inl.h +8 -1
- data/lib/libv8/v8/src/frames.cc +39 -3
- data/lib/libv8/v8/src/frames.h +10 -3
- data/lib/libv8/v8/src/full-codegen.cc +311 -293
- data/lib/libv8/v8/src/full-codegen.h +183 -143
- data/lib/libv8/v8/src/func-name-inferrer.cc +29 -15
- data/lib/libv8/v8/src/func-name-inferrer.h +19 -9
- data/lib/libv8/v8/src/gdb-jit.cc +658 -55
- data/lib/libv8/v8/src/gdb-jit.h +6 -2
- data/lib/libv8/v8/src/global-handles.cc +368 -312
- data/lib/libv8/v8/src/global-handles.h +29 -36
- data/lib/libv8/v8/src/globals.h +3 -1
- data/lib/libv8/v8/src/handles.cc +43 -69
- data/lib/libv8/v8/src/handles.h +21 -16
- data/lib/libv8/v8/src/heap-inl.h +11 -13
- data/lib/libv8/v8/src/heap-profiler.cc +0 -999
- data/lib/libv8/v8/src/heap-profiler.h +0 -303
- data/lib/libv8/v8/src/heap.cc +366 -141
- data/lib/libv8/v8/src/heap.h +87 -26
- data/lib/libv8/v8/src/hydrogen-instructions.cc +192 -81
- data/lib/libv8/v8/src/hydrogen-instructions.h +711 -482
- data/lib/libv8/v8/src/hydrogen.cc +1146 -629
- data/lib/libv8/v8/src/hydrogen.h +100 -64
- data/lib/libv8/v8/src/ia32/assembler-ia32.cc +19 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32.h +15 -2
- data/lib/libv8/v8/src/ia32/builtins-ia32.cc +34 -39
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +675 -377
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +8 -69
- data/lib/libv8/v8/src/ia32/codegen-ia32.cc +1 -0
- data/lib/libv8/v8/src/ia32/codegen-ia32.h +0 -2
- data/lib/libv8/v8/src/ia32/cpu-ia32.cc +3 -2
- data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +28 -3
- data/lib/libv8/v8/src/ia32/disasm-ia32.cc +21 -10
- data/lib/libv8/v8/src/ia32/frames-ia32.h +6 -5
- data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +459 -465
- data/lib/libv8/v8/src/ia32/ic-ia32.cc +196 -147
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +575 -650
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +19 -21
- data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +7 -2
- data/lib/libv8/v8/src/ia32/lithium-ia32.cc +261 -256
- data/lib/libv8/v8/src/ia32/lithium-ia32.h +234 -335
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +224 -67
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +63 -19
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +22 -8
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +3 -0
- data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +380 -239
- data/lib/libv8/v8/src/ic.cc +198 -234
- data/lib/libv8/v8/src/ic.h +32 -30
- data/lib/libv8/v8/src/interpreter-irregexp.cc +6 -4
- data/lib/libv8/v8/src/isolate.cc +112 -95
- data/lib/libv8/v8/src/isolate.h +55 -71
- data/lib/libv8/v8/src/json-parser.h +486 -48
- data/lib/libv8/v8/src/json.js +28 -23
- data/lib/libv8/v8/src/jsregexp.cc +163 -208
- data/lib/libv8/v8/src/jsregexp.h +0 -1
- data/lib/libv8/v8/src/lithium-allocator-inl.h +29 -27
- data/lib/libv8/v8/src/lithium-allocator.cc +22 -17
- data/lib/libv8/v8/src/lithium-allocator.h +8 -8
- data/lib/libv8/v8/src/lithium.cc +16 -11
- data/lib/libv8/v8/src/lithium.h +31 -34
- data/lib/libv8/v8/src/liveedit.cc +111 -15
- data/lib/libv8/v8/src/liveedit.h +3 -4
- data/lib/libv8/v8/src/liveobjectlist.cc +116 -80
- data/lib/libv8/v8/src/liveobjectlist.h +2 -2
- data/lib/libv8/v8/src/log-inl.h +0 -4
- data/lib/libv8/v8/src/log-utils.cc +25 -143
- data/lib/libv8/v8/src/log-utils.h +13 -92
- data/lib/libv8/v8/src/log.cc +26 -249
- data/lib/libv8/v8/src/log.h +6 -17
- data/lib/libv8/v8/src/macros.py +9 -6
- data/lib/libv8/v8/src/mark-compact.cc +276 -56
- data/lib/libv8/v8/src/mark-compact.h +20 -0
- data/lib/libv8/v8/src/messages.js +93 -39
- data/lib/libv8/v8/src/mips/assembler-mips-inl.h +9 -3
- data/lib/libv8/v8/src/mips/assembler-mips.cc +297 -189
- data/lib/libv8/v8/src/mips/assembler-mips.h +121 -54
- data/lib/libv8/v8/src/mips/builtins-mips.cc +23 -24
- data/lib/libv8/v8/src/mips/code-stubs-mips.cc +484 -263
- data/lib/libv8/v8/src/mips/code-stubs-mips.h +8 -83
- data/lib/libv8/v8/src/mips/codegen-mips.h +0 -2
- data/lib/libv8/v8/src/mips/constants-mips.h +37 -11
- data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +6 -1
- data/lib/libv8/v8/src/mips/frames-mips.h +8 -7
- data/lib/libv8/v8/src/mips/full-codegen-mips.cc +258 -419
- data/lib/libv8/v8/src/mips/ic-mips.cc +181 -121
- data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +640 -382
- data/lib/libv8/v8/src/mips/macro-assembler-mips.h +94 -89
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +23 -10
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +6 -1
- data/lib/libv8/v8/src/mips/simulator-mips.cc +249 -49
- data/lib/libv8/v8/src/mips/simulator-mips.h +25 -1
- data/lib/libv8/v8/src/mips/stub-cache-mips.cc +373 -161
- data/lib/libv8/v8/src/mirror-debugger.js +55 -8
- data/lib/libv8/v8/src/misc-intrinsics.h +89 -0
- data/lib/libv8/v8/src/mksnapshot.cc +36 -4
- data/lib/libv8/v8/src/natives.h +5 -2
- data/lib/libv8/v8/src/objects-debug.cc +73 -6
- data/lib/libv8/v8/src/objects-inl.h +529 -164
- data/lib/libv8/v8/src/objects-printer.cc +67 -12
- data/lib/libv8/v8/src/objects-visiting.cc +13 -2
- data/lib/libv8/v8/src/objects-visiting.h +41 -1
- data/lib/libv8/v8/src/objects.cc +2200 -1177
- data/lib/libv8/v8/src/objects.h +912 -283
- data/lib/libv8/v8/src/parser.cc +566 -371
- data/lib/libv8/v8/src/parser.h +35 -33
- data/lib/libv8/v8/src/platform-cygwin.cc +10 -25
- data/lib/libv8/v8/src/platform-freebsd.cc +4 -29
- data/lib/libv8/v8/src/platform-linux.cc +60 -57
- data/lib/libv8/v8/src/platform-macos.cc +4 -27
- data/lib/libv8/v8/src/platform-nullos.cc +3 -16
- data/lib/libv8/v8/src/platform-openbsd.cc +247 -85
- data/lib/libv8/v8/src/platform-posix.cc +43 -1
- data/lib/libv8/v8/src/platform-solaris.cc +151 -112
- data/lib/libv8/v8/src/platform-tls.h +1 -1
- data/lib/libv8/v8/src/platform-win32.cc +65 -39
- data/lib/libv8/v8/src/platform.h +17 -14
- data/lib/libv8/v8/src/preparse-data-format.h +2 -2
- data/lib/libv8/v8/src/preparse-data.h +8 -2
- data/lib/libv8/v8/src/preparser-api.cc +2 -18
- data/lib/libv8/v8/src/preparser.cc +106 -65
- data/lib/libv8/v8/src/preparser.h +26 -5
- data/lib/libv8/v8/src/prettyprinter.cc +25 -43
- data/lib/libv8/v8/src/profile-generator-inl.h +0 -4
- data/lib/libv8/v8/src/profile-generator.cc +213 -34
- data/lib/libv8/v8/src/profile-generator.h +9 -9
- data/lib/libv8/v8/src/property.h +1 -0
- data/lib/libv8/v8/src/proxy.js +74 -4
- data/lib/libv8/v8/src/regexp-macro-assembler.cc +10 -6
- data/lib/libv8/v8/src/regexp.js +16 -11
- data/lib/libv8/v8/src/rewriter.cc +24 -133
- data/lib/libv8/v8/src/runtime-profiler.cc +27 -151
- data/lib/libv8/v8/src/runtime-profiler.h +5 -31
- data/lib/libv8/v8/src/runtime.cc +1450 -681
- data/lib/libv8/v8/src/runtime.h +47 -31
- data/lib/libv8/v8/src/runtime.js +2 -1
- data/lib/libv8/v8/src/scanner-base.cc +358 -220
- data/lib/libv8/v8/src/scanner-base.h +30 -138
- data/lib/libv8/v8/src/scanner.cc +0 -18
- data/lib/libv8/v8/src/scanner.h +0 -15
- data/lib/libv8/v8/src/scopeinfo.cc +3 -1
- data/lib/libv8/v8/src/scopeinfo.h +1 -6
- data/lib/libv8/v8/src/scopes.cc +243 -253
- data/lib/libv8/v8/src/scopes.h +58 -109
- data/lib/libv8/v8/src/serialize.cc +12 -54
- data/lib/libv8/v8/src/serialize.h +47 -0
- data/lib/libv8/v8/src/small-pointer-list.h +25 -0
- data/lib/libv8/v8/src/spaces-inl.h +4 -50
- data/lib/libv8/v8/src/spaces.cc +64 -131
- data/lib/libv8/v8/src/spaces.h +19 -70
- data/lib/libv8/v8/src/string-stream.cc +3 -1
- data/lib/libv8/v8/src/string.js +10 -6
- data/lib/libv8/v8/src/strtod.cc +7 -3
- data/lib/libv8/v8/src/stub-cache.cc +59 -129
- data/lib/libv8/v8/src/stub-cache.h +42 -54
- data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +1447 -1339
- data/lib/libv8/v8/src/token.cc +4 -4
- data/lib/libv8/v8/src/token.h +6 -5
- data/lib/libv8/v8/src/type-info.cc +173 -129
- data/lib/libv8/v8/src/type-info.h +40 -22
- data/lib/libv8/v8/src/utils.cc +25 -304
- data/lib/libv8/v8/src/utils.h +118 -3
- data/lib/libv8/v8/src/v8-counters.h +3 -6
- data/lib/libv8/v8/src/v8.cc +34 -27
- data/lib/libv8/v8/src/v8.h +7 -7
- data/lib/libv8/v8/src/v8conversions.cc +129 -0
- data/lib/libv8/v8/src/v8conversions.h +60 -0
- data/lib/libv8/v8/src/v8globals.h +15 -6
- data/lib/libv8/v8/src/v8natives.js +300 -78
- data/lib/libv8/v8/src/v8threads.cc +14 -6
- data/lib/libv8/v8/src/v8threads.h +4 -1
- data/lib/libv8/v8/src/v8utils.cc +360 -0
- data/lib/libv8/v8/src/v8utils.h +17 -66
- data/lib/libv8/v8/src/variables.cc +7 -12
- data/lib/libv8/v8/src/variables.h +12 -10
- data/lib/libv8/v8/src/version.cc +2 -2
- data/lib/libv8/v8/src/vm-state-inl.h +0 -41
- data/lib/libv8/v8/src/vm-state.h +0 -11
- data/lib/libv8/v8/src/weakmap.js +103 -0
- data/lib/libv8/v8/src/x64/assembler-x64.h +6 -3
- data/lib/libv8/v8/src/x64/builtins-x64.cc +25 -22
- data/lib/libv8/v8/src/x64/code-stubs-x64.cc +523 -250
- data/lib/libv8/v8/src/x64/code-stubs-x64.h +8 -71
- data/lib/libv8/v8/src/x64/codegen-x64.cc +1 -0
- data/lib/libv8/v8/src/x64/codegen-x64.h +0 -2
- data/lib/libv8/v8/src/x64/cpu-x64.cc +2 -1
- data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +40 -8
- data/lib/libv8/v8/src/x64/disasm-x64.cc +12 -10
- data/lib/libv8/v8/src/x64/frames-x64.h +7 -6
- data/lib/libv8/v8/src/x64/full-codegen-x64.cc +310 -415
- data/lib/libv8/v8/src/x64/ic-x64.cc +180 -117
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +411 -523
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +11 -6
- data/lib/libv8/v8/src/x64/lithium-x64.cc +191 -216
- data/lib/libv8/v8/src/x64/lithium-x64.h +112 -263
- data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +177 -61
- data/lib/libv8/v8/src/x64/macro-assembler-x64.h +23 -7
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +21 -9
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +6 -0
- data/lib/libv8/v8/src/x64/stub-cache-x64.cc +273 -107
- data/lib/libv8/v8/src/zone.cc +31 -22
- data/lib/libv8/v8/src/zone.h +12 -6
- data/lib/libv8/v8/tools/codemap.js +8 -0
- data/lib/libv8/v8/tools/gcmole/Makefile +43 -0
- data/lib/libv8/v8/tools/gcmole/gcmole.lua +0 -2
- data/lib/libv8/v8/tools/gdb-v8-support.py +154 -0
- data/lib/libv8/v8/tools/grokdump.py +44 -35
- data/lib/libv8/v8/tools/gyp/v8.gyp +94 -248
- data/lib/libv8/v8/tools/js2c.py +83 -52
- data/lib/libv8/v8/tools/linux-tick-processor +4 -6
- data/lib/libv8/v8/tools/ll_prof.py +3 -3
- data/lib/libv8/v8/tools/oom_dump/README +3 -1
- data/lib/libv8/v8/tools/presubmit.py +11 -4
- data/lib/libv8/v8/tools/profile.js +46 -2
- data/lib/libv8/v8/tools/splaytree.js +11 -0
- data/lib/libv8/v8/tools/stats-viewer.py +15 -11
- data/lib/libv8/v8/tools/test-wrapper-gypbuild.py +227 -0
- data/lib/libv8/v8/tools/test.py +28 -8
- data/lib/libv8/v8/tools/tickprocessor.js +0 -16
- data/lib/libv8/version.rb +1 -1
- data/libv8.gemspec +2 -2
- metadata +31 -19
- data/lib/libv8/scons/engine/SCons/Tool/f03.py +0 -63
- data/lib/libv8/v8/src/json-parser.cc +0 -504
|
@@ -362,7 +362,7 @@ class Scanner {
|
|
|
362
362
|
// Call this after setting source_ to the input.
|
|
363
363
|
void Init() {
|
|
364
364
|
// Set c0_ (one character ahead)
|
|
365
|
-
|
|
365
|
+
STATIC_ASSERT(kCharacterLookaheadBufferSize == 1);
|
|
366
366
|
Advance();
|
|
367
367
|
// Initialize current_ to not refer to a literal.
|
|
368
368
|
current_.literal_chars = NULL;
|
|
@@ -419,7 +419,7 @@ class Scanner {
|
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
|
|
422
|
-
uc32
|
|
422
|
+
uc32 ScanHexNumber(int expected_length);
|
|
423
423
|
|
|
424
424
|
// Return the current source position.
|
|
425
425
|
int source_pos() {
|
|
@@ -471,12 +471,16 @@ class JavaScriptScanner : public Scanner {
|
|
|
471
471
|
|
|
472
472
|
explicit JavaScriptScanner(UnicodeCache* scanner_contants);
|
|
473
473
|
|
|
474
|
+
void Initialize(UC16CharacterStream* source);
|
|
475
|
+
|
|
474
476
|
// Returns the next token.
|
|
475
477
|
Token::Value Next();
|
|
476
478
|
|
|
477
|
-
// Returns true if there was a line terminator before the peek'ed token
|
|
478
|
-
|
|
479
|
-
|
|
479
|
+
// Returns true if there was a line terminator before the peek'ed token,
|
|
480
|
+
// possibly inside a multi-line comment.
|
|
481
|
+
bool HasAnyLineTerminatorBeforeNext() const {
|
|
482
|
+
return has_line_terminator_before_next_ ||
|
|
483
|
+
has_multiline_comment_before_next_;
|
|
480
484
|
}
|
|
481
485
|
|
|
482
486
|
// Scans the input as a regular expression pattern, previous
|
|
@@ -503,6 +507,14 @@ class JavaScriptScanner : public Scanner {
|
|
|
503
507
|
// tokens, which is what it is used for.
|
|
504
508
|
void SeekForward(int pos);
|
|
505
509
|
|
|
510
|
+
bool HarmonyBlockScoping() const {
|
|
511
|
+
return harmony_block_scoping_;
|
|
512
|
+
}
|
|
513
|
+
void SetHarmonyBlockScoping(bool block_scoping) {
|
|
514
|
+
harmony_block_scoping_ = block_scoping;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
|
|
506
518
|
protected:
|
|
507
519
|
bool SkipWhiteSpace();
|
|
508
520
|
Token::Value SkipSingleLineComment();
|
|
@@ -525,146 +537,26 @@ class JavaScriptScanner : public Scanner {
|
|
|
525
537
|
// Decodes a unicode escape-sequence which is part of an identifier.
|
|
526
538
|
// If the escape sequence cannot be decoded the result is kBadChar.
|
|
527
539
|
uc32 ScanIdentifierUnicodeEscape();
|
|
540
|
+
// Recognizes a uniocde escape-sequence and adds its characters,
|
|
541
|
+
// uninterpreted, to the current literal. Used for parsing RegExp
|
|
542
|
+
// flags.
|
|
543
|
+
bool ScanLiteralUnicodeEscape();
|
|
528
544
|
|
|
529
545
|
// Start position of the octal literal last scanned.
|
|
530
546
|
Location octal_pos_;
|
|
531
547
|
|
|
548
|
+
// Whether there is a line terminator whitespace character after
|
|
549
|
+
// the current token, and before the next. Does not count newlines
|
|
550
|
+
// inside multiline comments.
|
|
532
551
|
bool has_line_terminator_before_next_;
|
|
552
|
+
// Whether there is a multi-line comment that contains a
|
|
553
|
+
// line-terminator after the current token, and before the next.
|
|
554
|
+
bool has_multiline_comment_before_next_;
|
|
555
|
+
// Whether we scan 'let' as a keyword for harmony block scoped
|
|
556
|
+
// let bindings.
|
|
557
|
+
bool harmony_block_scoping_;
|
|
533
558
|
};
|
|
534
559
|
|
|
535
|
-
|
|
536
|
-
// ----------------------------------------------------------------------------
|
|
537
|
-
// Keyword matching state machine.
|
|
538
|
-
|
|
539
|
-
class KeywordMatcher {
|
|
540
|
-
// Incrementally recognize keywords.
|
|
541
|
-
//
|
|
542
|
-
// Recognized keywords:
|
|
543
|
-
// break case catch const* continue debugger* default delete do else
|
|
544
|
-
// finally false for function if in instanceof native* new null
|
|
545
|
-
// return switch this throw true try typeof var void while with
|
|
546
|
-
//
|
|
547
|
-
// *: Actually "future reserved keywords". These are the only ones we
|
|
548
|
-
// recognize, the remaining are allowed as identifiers.
|
|
549
|
-
// In ES5 strict mode, we should disallow all reserved keywords.
|
|
550
|
-
public:
|
|
551
|
-
KeywordMatcher()
|
|
552
|
-
: state_(INITIAL),
|
|
553
|
-
token_(Token::IDENTIFIER),
|
|
554
|
-
keyword_(NULL),
|
|
555
|
-
counter_(0),
|
|
556
|
-
keyword_token_(Token::ILLEGAL) {}
|
|
557
|
-
|
|
558
|
-
Token::Value token() { return token_; }
|
|
559
|
-
|
|
560
|
-
inline bool AddChar(unibrow::uchar input) {
|
|
561
|
-
if (state_ != UNMATCHABLE) {
|
|
562
|
-
Step(input);
|
|
563
|
-
}
|
|
564
|
-
return state_ != UNMATCHABLE;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
void Fail() {
|
|
568
|
-
token_ = Token::IDENTIFIER;
|
|
569
|
-
state_ = UNMATCHABLE;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
private:
|
|
573
|
-
enum State {
|
|
574
|
-
UNMATCHABLE,
|
|
575
|
-
INITIAL,
|
|
576
|
-
KEYWORD_PREFIX,
|
|
577
|
-
KEYWORD_MATCHED,
|
|
578
|
-
C,
|
|
579
|
-
CA,
|
|
580
|
-
CO,
|
|
581
|
-
CON,
|
|
582
|
-
D,
|
|
583
|
-
DE,
|
|
584
|
-
E,
|
|
585
|
-
EX,
|
|
586
|
-
F,
|
|
587
|
-
I,
|
|
588
|
-
IM,
|
|
589
|
-
IMP,
|
|
590
|
-
IN,
|
|
591
|
-
N,
|
|
592
|
-
P,
|
|
593
|
-
PR,
|
|
594
|
-
S,
|
|
595
|
-
T,
|
|
596
|
-
TH,
|
|
597
|
-
TR,
|
|
598
|
-
V,
|
|
599
|
-
W
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
struct FirstState {
|
|
603
|
-
const char* keyword;
|
|
604
|
-
State state;
|
|
605
|
-
Token::Value token;
|
|
606
|
-
};
|
|
607
|
-
|
|
608
|
-
// Range of possible first characters of a keyword.
|
|
609
|
-
static const unsigned int kFirstCharRangeMin = 'b';
|
|
610
|
-
static const unsigned int kFirstCharRangeMax = 'y';
|
|
611
|
-
static const unsigned int kFirstCharRangeLength =
|
|
612
|
-
kFirstCharRangeMax - kFirstCharRangeMin + 1;
|
|
613
|
-
// State map for first keyword character range.
|
|
614
|
-
static FirstState first_states_[kFirstCharRangeLength];
|
|
615
|
-
|
|
616
|
-
// If input equals keyword's character at position, continue matching keyword
|
|
617
|
-
// from that position.
|
|
618
|
-
inline bool MatchKeywordStart(unibrow::uchar input,
|
|
619
|
-
const char* keyword,
|
|
620
|
-
int position,
|
|
621
|
-
Token::Value token_if_match) {
|
|
622
|
-
if (input != static_cast<unibrow::uchar>(keyword[position])) {
|
|
623
|
-
return false;
|
|
624
|
-
}
|
|
625
|
-
state_ = KEYWORD_PREFIX;
|
|
626
|
-
this->keyword_ = keyword;
|
|
627
|
-
this->counter_ = position + 1;
|
|
628
|
-
this->keyword_token_ = token_if_match;
|
|
629
|
-
return true;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
// If input equals match character, transition to new state and return true.
|
|
633
|
-
inline bool MatchState(unibrow::uchar input, char match, State new_state) {
|
|
634
|
-
if (input != static_cast<unibrow::uchar>(match)) {
|
|
635
|
-
return false;
|
|
636
|
-
}
|
|
637
|
-
state_ = new_state;
|
|
638
|
-
return true;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
inline bool MatchKeyword(unibrow::uchar input,
|
|
642
|
-
char match,
|
|
643
|
-
State new_state,
|
|
644
|
-
Token::Value keyword_token) {
|
|
645
|
-
if (input != static_cast<unibrow::uchar>(match)) {
|
|
646
|
-
return false;
|
|
647
|
-
}
|
|
648
|
-
state_ = new_state;
|
|
649
|
-
token_ = keyword_token;
|
|
650
|
-
return true;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
void Step(unibrow::uchar input);
|
|
654
|
-
|
|
655
|
-
// Current state.
|
|
656
|
-
State state_;
|
|
657
|
-
// Token for currently added characters.
|
|
658
|
-
Token::Value token_;
|
|
659
|
-
|
|
660
|
-
// Matching a specific keyword string (there is only one possible valid
|
|
661
|
-
// keyword with the current prefix).
|
|
662
|
-
const char* keyword_;
|
|
663
|
-
int counter_;
|
|
664
|
-
Token::Value keyword_token_;
|
|
665
|
-
};
|
|
666
|
-
|
|
667
|
-
|
|
668
560
|
} } // namespace v8::internal
|
|
669
561
|
|
|
670
562
|
#endif // V8_SCANNER_BASE_H_
|
data/lib/libv8/v8/src/scanner.cc
CHANGED
|
@@ -324,22 +324,4 @@ void Scanner::LiteralScope::Complete() {
|
|
|
324
324
|
complete_ = true;
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
|
|
328
|
-
// ----------------------------------------------------------------------------
|
|
329
|
-
// V8JavaScriptScanner
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
void V8JavaScriptScanner::Initialize(UC16CharacterStream* source) {
|
|
333
|
-
source_ = source;
|
|
334
|
-
// Need to capture identifiers in order to recognize "get" and "set"
|
|
335
|
-
// in object literals.
|
|
336
|
-
Init();
|
|
337
|
-
// Skip initial whitespace allowing HTML comment ends just like
|
|
338
|
-
// after a newline and scan first token.
|
|
339
|
-
has_line_terminator_before_next_ = true;
|
|
340
|
-
SkipWhiteSpace();
|
|
341
|
-
Scan();
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
327
|
} } // namespace v8::internal
|
data/lib/libv8/v8/src/scanner.h
CHANGED
|
@@ -126,21 +126,6 @@ class ExternalTwoByteStringUC16CharacterStream: public UC16CharacterStream {
|
|
|
126
126
|
const uc16* raw_data_; // Pointer to the actual array of characters.
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
// ----------------------------------------------------------------------------
|
|
131
|
-
// V8JavaScriptScanner
|
|
132
|
-
// JavaScript scanner getting its input from either a V8 String or a unicode
|
|
133
|
-
// CharacterStream.
|
|
134
|
-
|
|
135
|
-
class V8JavaScriptScanner : public JavaScriptScanner {
|
|
136
|
-
public:
|
|
137
|
-
explicit V8JavaScriptScanner(UnicodeCache* unicode_cache)
|
|
138
|
-
: JavaScriptScanner(unicode_cache) {}
|
|
139
|
-
|
|
140
|
-
void Initialize(UC16CharacterStream* source);
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
|
|
144
129
|
} } // namespace v8::internal
|
|
145
130
|
|
|
146
131
|
#endif // V8_SCANNER_H_
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
#include "scopeinfo.h"
|
|
33
33
|
#include "scopes.h"
|
|
34
34
|
|
|
35
|
+
#include "allocation-inl.h"
|
|
36
|
+
|
|
35
37
|
namespace v8 {
|
|
36
38
|
namespace internal {
|
|
37
39
|
|
|
@@ -311,7 +313,7 @@ Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() {
|
|
|
311
313
|
stack_slots_.length();
|
|
312
314
|
|
|
313
315
|
Handle<SerializedScopeInfo> data(
|
|
314
|
-
SerializedScopeInfo::cast(*FACTORY->
|
|
316
|
+
SerializedScopeInfo::cast(*FACTORY->NewSerializedScopeInfo(length)));
|
|
315
317
|
AssertNoAllocation nogc;
|
|
316
318
|
|
|
317
319
|
Object** p0 = data->data_start();
|
|
@@ -107,7 +107,7 @@ class SerializedScopeInfo : public FixedArray {
|
|
|
107
107
|
public :
|
|
108
108
|
|
|
109
109
|
static SerializedScopeInfo* cast(Object* object) {
|
|
110
|
-
ASSERT(object->
|
|
110
|
+
ASSERT(object->IsSerializedScopeInfo());
|
|
111
111
|
return reinterpret_cast<SerializedScopeInfo*>(object);
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -117,11 +117,6 @@ class SerializedScopeInfo : public FixedArray {
|
|
|
117
117
|
// Is this scope a strict mode scope?
|
|
118
118
|
bool IsStrictMode();
|
|
119
119
|
|
|
120
|
-
// Does this scope have an arguments shadow?
|
|
121
|
-
bool HasArgumentsShadow() {
|
|
122
|
-
return StackSlotIndex(GetHeap()->arguments_shadow_symbol()) >= 0;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
120
|
// Return the number of stack slots for code.
|
|
126
121
|
int NumberOfStackSlots();
|
|
127
122
|
|
data/lib/libv8/v8/src/scopes.cc
CHANGED
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
#include "prettyprinter.h"
|
|
35
35
|
#include "scopeinfo.h"
|
|
36
36
|
|
|
37
|
+
#include "allocation-inl.h"
|
|
38
|
+
|
|
37
39
|
namespace v8 {
|
|
38
40
|
namespace internal {
|
|
39
41
|
|
|
@@ -114,70 +116,74 @@ Variable* VariableMap::Lookup(Handle<String> name) {
|
|
|
114
116
|
|
|
115
117
|
// Dummy constructor
|
|
116
118
|
Scope::Scope(Type type)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
: isolate_(Isolate::Current()),
|
|
120
|
+
inner_scopes_(0),
|
|
121
|
+
variables_(false),
|
|
122
|
+
temps_(0),
|
|
123
|
+
params_(0),
|
|
124
|
+
unresolved_(0),
|
|
125
|
+
decls_(0),
|
|
126
|
+
already_resolved_(false) {
|
|
123
127
|
SetDefaults(type, NULL, Handle<SerializedScopeInfo>::null());
|
|
124
|
-
ASSERT(!resolved());
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
|
|
128
131
|
Scope::Scope(Scope* outer_scope, Type type)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
: isolate_(Isolate::Current()),
|
|
133
|
+
inner_scopes_(4),
|
|
134
|
+
variables_(),
|
|
135
|
+
temps_(4),
|
|
136
|
+
params_(4),
|
|
137
|
+
unresolved_(16),
|
|
138
|
+
decls_(4),
|
|
139
|
+
already_resolved_(false) {
|
|
135
140
|
SetDefaults(type, outer_scope, Handle<SerializedScopeInfo>::null());
|
|
136
141
|
// At some point we might want to provide outer scopes to
|
|
137
142
|
// eval scopes (by walking the stack and reading the scope info).
|
|
138
143
|
// In that case, the ASSERT below needs to be adjusted.
|
|
139
144
|
ASSERT((type == GLOBAL_SCOPE || type == EVAL_SCOPE) == (outer_scope == NULL));
|
|
140
145
|
ASSERT(!HasIllegalRedeclaration());
|
|
141
|
-
ASSERT(!resolved());
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
|
|
145
|
-
Scope::Scope(Scope* inner_scope,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
Scope::Scope(Scope* inner_scope,
|
|
150
|
+
Type type,
|
|
151
|
+
Handle<SerializedScopeInfo> scope_info)
|
|
152
|
+
: isolate_(Isolate::Current()),
|
|
153
|
+
inner_scopes_(4),
|
|
154
|
+
variables_(),
|
|
155
|
+
temps_(4),
|
|
156
|
+
params_(4),
|
|
157
|
+
unresolved_(16),
|
|
158
|
+
decls_(4),
|
|
159
|
+
already_resolved_(true) {
|
|
152
160
|
ASSERT(!scope_info.is_null());
|
|
153
|
-
SetDefaults(
|
|
154
|
-
ASSERT(resolved());
|
|
161
|
+
SetDefaults(type, NULL, scope_info);
|
|
155
162
|
if (scope_info->HasHeapAllocatedLocals()) {
|
|
156
163
|
num_heap_slots_ = scope_info_->NumberOfContextSlots();
|
|
157
164
|
}
|
|
158
|
-
|
|
159
165
|
AddInnerScope(inner_scope);
|
|
166
|
+
}
|
|
160
167
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
168
|
+
|
|
169
|
+
Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name)
|
|
170
|
+
: isolate_(Isolate::Current()),
|
|
171
|
+
inner_scopes_(1),
|
|
172
|
+
variables_(),
|
|
173
|
+
temps_(0),
|
|
174
|
+
params_(0),
|
|
175
|
+
unresolved_(0),
|
|
176
|
+
decls_(0),
|
|
177
|
+
already_resolved_(true) {
|
|
178
|
+
SetDefaults(CATCH_SCOPE, NULL, Handle<SerializedScopeInfo>::null());
|
|
179
|
+
AddInnerScope(inner_scope);
|
|
180
|
+
++num_var_or_const_;
|
|
181
|
+
Variable* variable = variables_.Declare(this,
|
|
182
|
+
catch_variable_name,
|
|
183
|
+
Variable::VAR,
|
|
184
|
+
true, // Valid left-hand side.
|
|
185
|
+
Variable::NORMAL);
|
|
186
|
+
AllocateHeapSlot(variable);
|
|
181
187
|
}
|
|
182
188
|
|
|
183
189
|
|
|
@@ -186,12 +192,11 @@ void Scope::SetDefaults(Type type,
|
|
|
186
192
|
Handle<SerializedScopeInfo> scope_info) {
|
|
187
193
|
outer_scope_ = outer_scope;
|
|
188
194
|
type_ = type;
|
|
189
|
-
scope_name_ =
|
|
195
|
+
scope_name_ = isolate_->factory()->empty_symbol();
|
|
190
196
|
dynamics_ = NULL;
|
|
191
197
|
receiver_ = NULL;
|
|
192
198
|
function_ = NULL;
|
|
193
199
|
arguments_ = NULL;
|
|
194
|
-
arguments_shadow_ = NULL;
|
|
195
200
|
illegal_redecl_ = NULL;
|
|
196
201
|
scope_inside_with_ = false;
|
|
197
202
|
scope_contains_with_ = false;
|
|
@@ -212,30 +217,48 @@ void Scope::SetDefaults(Type type,
|
|
|
212
217
|
|
|
213
218
|
Scope* Scope::DeserializeScopeChain(CompilationInfo* info,
|
|
214
219
|
Scope* global_scope) {
|
|
220
|
+
// Reconstruct the outer scope chain from a closure's context chain.
|
|
215
221
|
ASSERT(!info->closure().is_null());
|
|
216
|
-
|
|
222
|
+
Context* context = info->closure()->context();
|
|
223
|
+
Scope* current_scope = NULL;
|
|
217
224
|
Scope* innermost_scope = NULL;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
bool contains_with = false;
|
|
226
|
+
while (!context->IsGlobalContext()) {
|
|
227
|
+
if (context->IsWithContext()) {
|
|
228
|
+
// All the inner scopes are inside a with.
|
|
229
|
+
contains_with = true;
|
|
230
|
+
for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) {
|
|
231
|
+
s->scope_inside_with_ = true;
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
234
|
+
if (context->IsFunctionContext()) {
|
|
235
|
+
SerializedScopeInfo* scope_info =
|
|
236
|
+
context->closure()->shared()->scope_info();
|
|
237
|
+
current_scope = new Scope(current_scope, FUNCTION_SCOPE,
|
|
238
|
+
Handle<SerializedScopeInfo>(scope_info));
|
|
239
|
+
} else if (context->IsBlockContext()) {
|
|
240
|
+
SerializedScopeInfo* scope_info =
|
|
241
|
+
SerializedScopeInfo::cast(context->extension());
|
|
242
|
+
current_scope = new Scope(current_scope, BLOCK_SCOPE,
|
|
243
|
+
Handle<SerializedScopeInfo>(scope_info));
|
|
229
244
|
} else {
|
|
230
|
-
ASSERT(
|
|
245
|
+
ASSERT(context->IsCatchContext());
|
|
246
|
+
String* name = String::cast(context->extension());
|
|
247
|
+
current_scope = new Scope(current_scope, Handle<String>(name));
|
|
231
248
|
}
|
|
232
|
-
|
|
233
|
-
|
|
249
|
+
if (contains_with) current_scope->RecordWithStatement();
|
|
250
|
+
if (innermost_scope == NULL) innermost_scope = current_scope;
|
|
251
|
+
}
|
|
234
252
|
|
|
235
|
-
|
|
236
|
-
|
|
253
|
+
// Forget about a with when we move to a context for a different function.
|
|
254
|
+
if (context->previous()->closure() != context->closure()) {
|
|
255
|
+
contains_with = false;
|
|
256
|
+
}
|
|
257
|
+
context = context->previous();
|
|
258
|
+
}
|
|
237
259
|
|
|
238
|
-
|
|
260
|
+
global_scope->AddInnerScope(current_scope);
|
|
261
|
+
return (innermost_scope == NULL) ? global_scope : innermost_scope;
|
|
239
262
|
}
|
|
240
263
|
|
|
241
264
|
|
|
@@ -260,7 +283,7 @@ bool Scope::Analyze(CompilationInfo* info) {
|
|
|
260
283
|
|
|
261
284
|
|
|
262
285
|
void Scope::Initialize(bool inside_with) {
|
|
263
|
-
ASSERT(!
|
|
286
|
+
ASSERT(!already_resolved());
|
|
264
287
|
|
|
265
288
|
// Add this scope as a new inner scope of the outer scope.
|
|
266
289
|
if (outer_scope_ != NULL) {
|
|
@@ -278,73 +301,67 @@ void Scope::Initialize(bool inside_with) {
|
|
|
278
301
|
// instead load them directly from the stack. Currently, the only
|
|
279
302
|
// such parameter is 'this' which is passed on the stack when
|
|
280
303
|
// invoking scripts
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
304
|
+
if (is_catch_scope() || is_block_scope()) {
|
|
305
|
+
ASSERT(outer_scope() != NULL);
|
|
306
|
+
receiver_ = outer_scope()->receiver();
|
|
307
|
+
} else {
|
|
308
|
+
ASSERT(is_function_scope() ||
|
|
309
|
+
is_global_scope() ||
|
|
310
|
+
is_eval_scope());
|
|
311
|
+
Variable* var =
|
|
312
|
+
variables_.Declare(this,
|
|
313
|
+
isolate_->factory()->this_symbol(),
|
|
314
|
+
Variable::VAR,
|
|
315
|
+
false,
|
|
316
|
+
Variable::THIS);
|
|
317
|
+
var->set_rewrite(NewSlot(var, Slot::PARAMETER, -1));
|
|
318
|
+
receiver_ = var;
|
|
319
|
+
}
|
|
286
320
|
|
|
287
321
|
if (is_function_scope()) {
|
|
288
322
|
// Declare 'arguments' variable which exists in all functions.
|
|
289
323
|
// Note that it might never be accessed, in which case it won't be
|
|
290
324
|
// allocated during variable allocation.
|
|
291
|
-
variables_.Declare(this,
|
|
292
|
-
|
|
325
|
+
variables_.Declare(this,
|
|
326
|
+
isolate_->factory()->arguments_symbol(),
|
|
327
|
+
Variable::VAR,
|
|
328
|
+
true,
|
|
329
|
+
Variable::ARGUMENTS);
|
|
293
330
|
}
|
|
294
331
|
}
|
|
295
332
|
|
|
296
333
|
|
|
297
334
|
Variable* Scope::LocalLookup(Handle<String> name) {
|
|
298
335
|
Variable* result = variables_.Lookup(name);
|
|
299
|
-
if (result != NULL ||
|
|
336
|
+
if (result != NULL || scope_info_.is_null()) {
|
|
300
337
|
return result;
|
|
301
338
|
}
|
|
302
|
-
// If
|
|
303
|
-
|
|
304
|
-
// We should never lookup 'arguments' in this scope
|
|
305
|
-
//
|
|
306
|
-
ASSERT(*name != *
|
|
307
|
-
|
|
308
|
-
// Assert that there is no local slot with the given name.
|
|
339
|
+
// If we have a serialized scope info, we might find the variable there.
|
|
340
|
+
//
|
|
341
|
+
// We should never lookup 'arguments' in this scope as it is implicitly
|
|
342
|
+
// present in every scope.
|
|
343
|
+
ASSERT(*name != *isolate_->factory()->arguments_symbol());
|
|
344
|
+
// There should be no local slot with the given name.
|
|
309
345
|
ASSERT(scope_info_->StackSlotIndex(*name) < 0);
|
|
310
346
|
|
|
311
347
|
// Check context slot lookup.
|
|
312
348
|
Variable::Mode mode;
|
|
313
349
|
int index = scope_info_->ContextSlotIndex(*name, &mode);
|
|
314
|
-
if (index
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
// ".arguments" must be present in context slots.
|
|
324
|
-
ASSERT(arguments_shadow_ != NULL);
|
|
325
|
-
Variable* var =
|
|
326
|
-
variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL);
|
|
327
|
-
Property* rewrite =
|
|
328
|
-
new Property(new VariableProxy(arguments_shadow_),
|
|
329
|
-
new Literal(Handle<Object>(Smi::FromInt(index))),
|
|
330
|
-
RelocInfo::kNoPosition,
|
|
331
|
-
Property::SYNTHETIC);
|
|
332
|
-
rewrite->set_is_arguments_access(true);
|
|
333
|
-
var->set_rewrite(rewrite);
|
|
334
|
-
return var;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
index = scope_info_->FunctionContextSlotIndex(*name);
|
|
338
|
-
if (index >= 0) {
|
|
339
|
-
// Check that there is no local slot with the given name.
|
|
340
|
-
ASSERT(scope_info_->StackSlotIndex(*name) < 0);
|
|
341
|
-
Variable* var =
|
|
342
|
-
variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL);
|
|
343
|
-
var->set_rewrite(new Slot(var, Slot::CONTEXT, index));
|
|
344
|
-
return var;
|
|
350
|
+
if (index < 0) {
|
|
351
|
+
// Check parameters.
|
|
352
|
+
mode = Variable::VAR;
|
|
353
|
+
index = scope_info_->ParameterIndex(*name);
|
|
354
|
+
if (index < 0) {
|
|
355
|
+
// Check the function name.
|
|
356
|
+
index = scope_info_->FunctionContextSlotIndex(*name);
|
|
357
|
+
if (index < 0) return NULL;
|
|
358
|
+
}
|
|
345
359
|
}
|
|
346
360
|
|
|
347
|
-
|
|
361
|
+
Variable* var =
|
|
362
|
+
variables_.Declare(this, name, mode, true, Variable::NORMAL);
|
|
363
|
+
var->set_rewrite(NewSlot(var, Slot::CONTEXT, index));
|
|
364
|
+
return var;
|
|
348
365
|
}
|
|
349
366
|
|
|
350
367
|
|
|
@@ -366,17 +383,24 @@ Variable* Scope::DeclareFunctionVar(Handle<String> name) {
|
|
|
366
383
|
}
|
|
367
384
|
|
|
368
385
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
386
|
+
void Scope::DeclareParameter(Handle<String> name) {
|
|
387
|
+
ASSERT(!already_resolved());
|
|
388
|
+
ASSERT(is_function_scope());
|
|
389
|
+
Variable* var =
|
|
390
|
+
variables_.Declare(this, name, Variable::VAR, true, Variable::NORMAL);
|
|
391
|
+
params_.Add(var);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
Variable* Scope::DeclareLocal(Handle<String> name, Variable::Mode mode) {
|
|
396
|
+
ASSERT(!already_resolved());
|
|
397
|
+
// This function handles VAR and CONST modes. DYNAMIC variables are
|
|
398
|
+
// introduces during variable allocation, INTERNAL variables are allocated
|
|
399
|
+
// explicitly, and TEMPORARY variables are allocated via NewTemporary().
|
|
400
|
+
ASSERT(mode == Variable::VAR ||
|
|
401
|
+
mode == Variable::CONST ||
|
|
402
|
+
mode == Variable::LET);
|
|
403
|
+
++num_var_or_const_;
|
|
380
404
|
return variables_.Declare(this, name, mode, true, Variable::NORMAL);
|
|
381
405
|
}
|
|
382
406
|
|
|
@@ -388,21 +412,15 @@ Variable* Scope::DeclareGlobal(Handle<String> name) {
|
|
|
388
412
|
}
|
|
389
413
|
|
|
390
414
|
|
|
391
|
-
void Scope::AddParameter(Variable* var) {
|
|
392
|
-
ASSERT(is_function_scope());
|
|
393
|
-
ASSERT(LocalLookup(var->name()) == var);
|
|
394
|
-
params_.Add(var);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
398
415
|
VariableProxy* Scope::NewUnresolved(Handle<String> name,
|
|
399
416
|
bool inside_with,
|
|
400
417
|
int position) {
|
|
401
418
|
// Note that we must not share the unresolved variables with
|
|
402
419
|
// the same name because they may be removed selectively via
|
|
403
420
|
// RemoveUnresolved().
|
|
404
|
-
ASSERT(!
|
|
405
|
-
VariableProxy* proxy = new VariableProxy(
|
|
421
|
+
ASSERT(!already_resolved());
|
|
422
|
+
VariableProxy* proxy = new(isolate_->zone()) VariableProxy(
|
|
423
|
+
isolate_, name, false, inside_with, position);
|
|
406
424
|
unresolved_.Add(proxy);
|
|
407
425
|
return proxy;
|
|
408
426
|
}
|
|
@@ -421,7 +439,7 @@ void Scope::RemoveUnresolved(VariableProxy* var) {
|
|
|
421
439
|
|
|
422
440
|
|
|
423
441
|
Variable* Scope::NewTemporary(Handle<String> name) {
|
|
424
|
-
ASSERT(!
|
|
442
|
+
ASSERT(!already_resolved());
|
|
425
443
|
Variable* var =
|
|
426
444
|
new Variable(this, name, Variable::TEMPORARY, true, Variable::NORMAL);
|
|
427
445
|
temps_.Add(var);
|
|
@@ -551,12 +569,32 @@ int Scope::ContextChainLength(Scope* scope) {
|
|
|
551
569
|
}
|
|
552
570
|
|
|
553
571
|
|
|
572
|
+
Scope* Scope::DeclarationScope() {
|
|
573
|
+
Scope* scope = this;
|
|
574
|
+
while (scope->is_catch_scope() ||
|
|
575
|
+
scope->is_block_scope()) {
|
|
576
|
+
scope = scope->outer_scope();
|
|
577
|
+
}
|
|
578
|
+
return scope;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
Handle<SerializedScopeInfo> Scope::GetSerializedScopeInfo() {
|
|
583
|
+
if (scope_info_.is_null()) {
|
|
584
|
+
scope_info_ = SerializedScopeInfo::Create(this);
|
|
585
|
+
}
|
|
586
|
+
return scope_info_;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
|
|
554
590
|
#ifdef DEBUG
|
|
555
591
|
static const char* Header(Scope::Type type) {
|
|
556
592
|
switch (type) {
|
|
557
593
|
case Scope::EVAL_SCOPE: return "eval";
|
|
558
594
|
case Scope::FUNCTION_SCOPE: return "function";
|
|
559
595
|
case Scope::GLOBAL_SCOPE: return "global";
|
|
596
|
+
case Scope::CATCH_SCOPE: return "catch";
|
|
597
|
+
case Scope::BLOCK_SCOPE: return "block";
|
|
560
598
|
}
|
|
561
599
|
UNREACHABLE();
|
|
562
600
|
return NULL;
|
|
@@ -582,9 +620,11 @@ static void PrintVar(PrettyPrinter* printer, int indent, Variable* var) {
|
|
|
582
620
|
PrintF("; // ");
|
|
583
621
|
if (var->rewrite() != NULL) {
|
|
584
622
|
PrintF("%s, ", printer->Print(var->rewrite()));
|
|
585
|
-
if (var->
|
|
623
|
+
if (var->is_accessed_from_inner_function_scope()) PrintF(", ");
|
|
624
|
+
}
|
|
625
|
+
if (var->is_accessed_from_inner_function_scope()) {
|
|
626
|
+
PrintF("inner scope access");
|
|
586
627
|
}
|
|
587
|
-
if (var->is_accessed_from_inner_scope()) PrintF("inner scope access");
|
|
588
628
|
PrintF("\n");
|
|
589
629
|
}
|
|
590
630
|
}
|
|
@@ -692,7 +732,7 @@ Variable* Scope::NonLocal(Handle<String> name, Variable::Mode mode) {
|
|
|
692
732
|
// Declare a new non-local.
|
|
693
733
|
var = map->Declare(NULL, name, mode, true, Variable::NORMAL);
|
|
694
734
|
// Allocate it by giving it a dynamic lookup.
|
|
695
|
-
var->set_rewrite(
|
|
735
|
+
var->set_rewrite(NewSlot(var, Slot::LOOKUP, -1));
|
|
696
736
|
}
|
|
697
737
|
return var;
|
|
698
738
|
}
|
|
@@ -705,7 +745,7 @@ Variable* Scope::NonLocal(Handle<String> name, Variable::Mode mode) {
|
|
|
705
745
|
// another variable that is introduced dynamically via an 'eval' call
|
|
706
746
|
// or a 'with' statement).
|
|
707
747
|
Variable* Scope::LookupRecursive(Handle<String> name,
|
|
708
|
-
bool
|
|
748
|
+
bool from_inner_function,
|
|
709
749
|
Variable** invalidated_local) {
|
|
710
750
|
// If we find a variable, but the current scope calls 'eval', the found
|
|
711
751
|
// variable may not be the correct one (the 'eval' may introduce a
|
|
@@ -721,7 +761,7 @@ Variable* Scope::LookupRecursive(Handle<String> name,
|
|
|
721
761
|
// (Even if there is an 'eval' in this scope which introduces the
|
|
722
762
|
// same variable again, the resulting variable remains the same.
|
|
723
763
|
// Note that enclosing 'with' statements are handled at the call site.)
|
|
724
|
-
if (!
|
|
764
|
+
if (!from_inner_function)
|
|
725
765
|
return var;
|
|
726
766
|
|
|
727
767
|
} else {
|
|
@@ -737,7 +777,10 @@ Variable* Scope::LookupRecursive(Handle<String> name,
|
|
|
737
777
|
var = function_;
|
|
738
778
|
|
|
739
779
|
} else if (outer_scope_ != NULL) {
|
|
740
|
-
var = outer_scope_->LookupRecursive(
|
|
780
|
+
var = outer_scope_->LookupRecursive(
|
|
781
|
+
name,
|
|
782
|
+
is_function_scope() || from_inner_function,
|
|
783
|
+
invalidated_local);
|
|
741
784
|
// We may have found a variable in an outer scope. However, if
|
|
742
785
|
// the current scope is inside a 'with', the actual variable may
|
|
743
786
|
// be a property introduced via the 'with' statement. Then, the
|
|
@@ -754,8 +797,8 @@ Variable* Scope::LookupRecursive(Handle<String> name,
|
|
|
754
797
|
ASSERT(var != NULL);
|
|
755
798
|
|
|
756
799
|
// If this is a lookup from an inner scope, mark the variable.
|
|
757
|
-
if (
|
|
758
|
-
var->
|
|
800
|
+
if (from_inner_function) {
|
|
801
|
+
var->MarkAsAccessedFromInnerFunctionScope();
|
|
759
802
|
}
|
|
760
803
|
|
|
761
804
|
// If the variable we have found is just a guess, invalidate the
|
|
@@ -906,9 +949,12 @@ bool Scope::MustAllocate(Variable* var) {
|
|
|
906
949
|
// via an eval() call. This is only possible if the variable has a
|
|
907
950
|
// visible name.
|
|
908
951
|
if ((var->is_this() || var->name()->length() > 0) &&
|
|
909
|
-
(var->
|
|
910
|
-
scope_calls_eval_ ||
|
|
911
|
-
|
|
952
|
+
(var->is_accessed_from_inner_function_scope() ||
|
|
953
|
+
scope_calls_eval_ ||
|
|
954
|
+
inner_scope_calls_eval_ ||
|
|
955
|
+
scope_contains_with_ ||
|
|
956
|
+
is_catch_scope() ||
|
|
957
|
+
is_block_scope())) {
|
|
912
958
|
var->set_is_used(true);
|
|
913
959
|
}
|
|
914
960
|
// Global variables do not need to be allocated.
|
|
@@ -917,73 +963,60 @@ bool Scope::MustAllocate(Variable* var) {
|
|
|
917
963
|
|
|
918
964
|
|
|
919
965
|
bool Scope::MustAllocateInContext(Variable* var) {
|
|
920
|
-
// If var is accessed from an inner scope, or if there is a
|
|
921
|
-
//
|
|
922
|
-
//
|
|
923
|
-
// context. Exception: temporary variables are not allocated in the
|
|
966
|
+
// If var is accessed from an inner scope, or if there is a possibility
|
|
967
|
+
// that it might be accessed from the current or an inner scope (through
|
|
968
|
+
// an eval() call or a runtime with lookup), it must be allocated in the
|
|
924
969
|
// context.
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
970
|
+
//
|
|
971
|
+
// Exceptions: temporary variables are never allocated in a context;
|
|
972
|
+
// catch-bound variables are always allocated in a context.
|
|
973
|
+
if (var->mode() == Variable::TEMPORARY) return false;
|
|
974
|
+
if (is_catch_scope() || is_block_scope()) return true;
|
|
975
|
+
return var->is_accessed_from_inner_function_scope() ||
|
|
976
|
+
scope_calls_eval_ ||
|
|
977
|
+
inner_scope_calls_eval_ ||
|
|
978
|
+
scope_contains_with_ ||
|
|
979
|
+
var->is_global();
|
|
930
980
|
}
|
|
931
981
|
|
|
932
982
|
|
|
933
983
|
bool Scope::HasArgumentsParameter() {
|
|
934
984
|
for (int i = 0; i < params_.length(); i++) {
|
|
935
|
-
if (params_[i]->name().is_identical_to(
|
|
985
|
+
if (params_[i]->name().is_identical_to(
|
|
986
|
+
isolate_->factory()->arguments_symbol())) {
|
|
936
987
|
return true;
|
|
988
|
+
}
|
|
937
989
|
}
|
|
938
990
|
return false;
|
|
939
991
|
}
|
|
940
992
|
|
|
941
993
|
|
|
942
994
|
void Scope::AllocateStackSlot(Variable* var) {
|
|
943
|
-
var->set_rewrite(
|
|
995
|
+
var->set_rewrite(NewSlot(var, Slot::LOCAL, num_stack_slots_++));
|
|
944
996
|
}
|
|
945
997
|
|
|
946
998
|
|
|
947
999
|
void Scope::AllocateHeapSlot(Variable* var) {
|
|
948
|
-
var->set_rewrite(
|
|
1000
|
+
var->set_rewrite(NewSlot(var, Slot::CONTEXT, num_heap_slots_++));
|
|
949
1001
|
}
|
|
950
1002
|
|
|
951
1003
|
|
|
952
1004
|
void Scope::AllocateParameterLocals() {
|
|
953
1005
|
ASSERT(is_function_scope());
|
|
954
|
-
Variable* arguments = LocalLookup(
|
|
1006
|
+
Variable* arguments = LocalLookup(isolate_->factory()->arguments_symbol());
|
|
955
1007
|
ASSERT(arguments != NULL); // functions have 'arguments' declared implicitly
|
|
956
1008
|
|
|
957
|
-
|
|
958
|
-
// a non-strict mode function. Strict mode code doesn't alias arguments.
|
|
959
|
-
bool rewrite_parameters = false;
|
|
1009
|
+
bool uses_nonstrict_arguments = false;
|
|
960
1010
|
|
|
961
1011
|
if (MustAllocate(arguments) && !HasArgumentsParameter()) {
|
|
962
1012
|
// 'arguments' is used. Unless there is also a parameter called
|
|
963
|
-
// 'arguments', we must be conservative and
|
|
964
|
-
// the
|
|
965
|
-
//
|
|
966
|
-
//
|
|
967
|
-
//
|
|
968
|
-
//
|
|
969
|
-
//
|
|
970
|
-
//
|
|
971
|
-
// (*) Instead of having a parameter called 'arguments', we may have an
|
|
972
|
-
// assignment to 'arguments' in the function body, at some arbitrary
|
|
973
|
-
// point in time (possibly through an 'eval()' call!). After that
|
|
974
|
-
// assignment any re-write of parameters would be invalid (was bug
|
|
975
|
-
// 881452). Thus, we introduce a shadow '.arguments'
|
|
976
|
-
// variable which also points to the arguments object. For rewrites we
|
|
977
|
-
// use '.arguments' which remains valid even if we assign to
|
|
978
|
-
// 'arguments'. To summarize: If we need to rewrite, we allocate an
|
|
979
|
-
// 'arguments' object dynamically upon function invocation. The compiler
|
|
980
|
-
// introduces 2 local variables 'arguments' and '.arguments', both of
|
|
981
|
-
// which originally point to the arguments object that was
|
|
982
|
-
// allocated. All parameters are rewritten into property accesses via
|
|
983
|
-
// the '.arguments' variable. Thus, any changes to properties of
|
|
984
|
-
// 'arguments' are reflected in the variables and vice versa. If the
|
|
985
|
-
// 'arguments' variable is changed, '.arguments' still points to the
|
|
986
|
-
// correct arguments object and the rewrites still work.
|
|
1013
|
+
// 'arguments', we must be conservative and allocate all parameters to
|
|
1014
|
+
// the context assuming they will be captured by the arguments object.
|
|
1015
|
+
// If we have a parameter named 'arguments', a (new) value is always
|
|
1016
|
+
// assigned to it via the function invocation. Then 'arguments' denotes
|
|
1017
|
+
// that specific parameter value and cannot be used to access the
|
|
1018
|
+
// parameters, which is why we don't need to allocate an arguments
|
|
1019
|
+
// object in that case.
|
|
987
1020
|
|
|
988
1021
|
// We are using 'arguments'. Tell the code generator that is needs to
|
|
989
1022
|
// allocate the arguments object by setting 'arguments_'.
|
|
@@ -992,76 +1025,32 @@ void Scope::AllocateParameterLocals() {
|
|
|
992
1025
|
// In strict mode 'arguments' does not alias formal parameters.
|
|
993
1026
|
// Therefore in strict mode we allocate parameters as if 'arguments'
|
|
994
1027
|
// were not used.
|
|
995
|
-
|
|
1028
|
+
uses_nonstrict_arguments = !is_strict_mode();
|
|
996
1029
|
}
|
|
997
1030
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
FACTORY->arguments_shadow_symbol(),
|
|
1010
|
-
Variable::INTERNAL,
|
|
1011
|
-
true,
|
|
1012
|
-
Variable::ARGUMENTS);
|
|
1013
|
-
arguments_shadow_->set_is_used(true);
|
|
1014
|
-
temps_.Add(arguments_shadow_);
|
|
1015
|
-
|
|
1016
|
-
// Allocate the parameters by rewriting them into '.arguments[i]' accesses.
|
|
1017
|
-
for (int i = 0; i < params_.length(); i++) {
|
|
1018
|
-
Variable* var = params_[i];
|
|
1019
|
-
ASSERT(var->scope() == this);
|
|
1020
|
-
if (MustAllocate(var)) {
|
|
1021
|
-
if (MustAllocateInContext(var)) {
|
|
1022
|
-
// It is ok to set this only now, because arguments is a local
|
|
1023
|
-
// variable that is allocated after the parameters have been
|
|
1024
|
-
// allocated.
|
|
1025
|
-
arguments_shadow_->MarkAsAccessedFromInnerScope();
|
|
1026
|
-
}
|
|
1027
|
-
Property* rewrite =
|
|
1028
|
-
new Property(new VariableProxy(arguments_shadow_),
|
|
1029
|
-
new Literal(Handle<Object>(Smi::FromInt(i))),
|
|
1030
|
-
RelocInfo::kNoPosition,
|
|
1031
|
-
Property::SYNTHETIC);
|
|
1032
|
-
rewrite->set_is_arguments_access(true);
|
|
1033
|
-
var->set_rewrite(rewrite);
|
|
1034
|
-
}
|
|
1031
|
+
// The same parameter may occur multiple times in the parameters_ list.
|
|
1032
|
+
// If it does, and if it is not copied into the context object, it must
|
|
1033
|
+
// receive the highest parameter index for that parameter; thus iteration
|
|
1034
|
+
// order is relevant!
|
|
1035
|
+
for (int i = params_.length() - 1; i >= 0; --i) {
|
|
1036
|
+
Variable* var = params_[i];
|
|
1037
|
+
ASSERT(var->scope() == this);
|
|
1038
|
+
if (uses_nonstrict_arguments) {
|
|
1039
|
+
// Give the parameter a use from an inner scope, to force allocation
|
|
1040
|
+
// to the context.
|
|
1041
|
+
var->MarkAsAccessedFromInnerFunctionScope();
|
|
1035
1042
|
}
|
|
1036
1043
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
if (MustAllocateInContext(var)) {
|
|
1048
|
-
ASSERT(var->rewrite() == NULL ||
|
|
1049
|
-
(var->AsSlot() != NULL &&
|
|
1050
|
-
var->AsSlot()->type() == Slot::CONTEXT));
|
|
1051
|
-
if (var->rewrite() == NULL) {
|
|
1052
|
-
// Only set the heap allocation if the parameter has not
|
|
1053
|
-
// been allocated yet.
|
|
1054
|
-
AllocateHeapSlot(var);
|
|
1055
|
-
}
|
|
1056
|
-
} else {
|
|
1057
|
-
ASSERT(var->rewrite() == NULL ||
|
|
1058
|
-
(var->AsSlot() != NULL &&
|
|
1059
|
-
var->AsSlot()->type() == Slot::PARAMETER));
|
|
1060
|
-
// Set the parameter index always, even if the parameter
|
|
1061
|
-
// was seen before! (We need to access the actual parameter
|
|
1062
|
-
// supplied for the last occurrence of a multiply declared
|
|
1063
|
-
// parameter.)
|
|
1064
|
-
var->set_rewrite(new Slot(var, Slot::PARAMETER, i));
|
|
1044
|
+
if (MustAllocate(var)) {
|
|
1045
|
+
if (MustAllocateInContext(var)) {
|
|
1046
|
+
ASSERT(var->rewrite() == NULL || var->IsContextSlot());
|
|
1047
|
+
if (var->rewrite() == NULL) {
|
|
1048
|
+
AllocateHeapSlot(var);
|
|
1049
|
+
}
|
|
1050
|
+
} else {
|
|
1051
|
+
ASSERT(var->rewrite() == NULL || var->IsParameter());
|
|
1052
|
+
if (var->rewrite() == NULL) {
|
|
1053
|
+
var->set_rewrite(NewSlot(var, Slot::PARAMETER, i));
|
|
1065
1054
|
}
|
|
1066
1055
|
}
|
|
1067
1056
|
}
|
|
@@ -1072,8 +1061,9 @@ void Scope::AllocateParameterLocals() {
|
|
|
1072
1061
|
void Scope::AllocateNonParameterLocal(Variable* var) {
|
|
1073
1062
|
ASSERT(var->scope() == this);
|
|
1074
1063
|
ASSERT(var->rewrite() == NULL ||
|
|
1075
|
-
|
|
1076
|
-
|
|
1064
|
+
!var->IsVariable(isolate_->factory()->result_symbol()) ||
|
|
1065
|
+
var->AsSlot() == NULL ||
|
|
1066
|
+
var->AsSlot()->type() != Slot::LOCAL);
|
|
1077
1067
|
if (var->rewrite() == NULL && MustAllocate(var)) {
|
|
1078
1068
|
if (MustAllocateInContext(var)) {
|
|
1079
1069
|
AllocateHeapSlot(var);
|
|
@@ -1115,7 +1105,7 @@ void Scope::AllocateVariablesRecursively() {
|
|
|
1115
1105
|
|
|
1116
1106
|
// If scope is already resolved, we still need to allocate
|
|
1117
1107
|
// variables in inner scopes which might not had been resolved yet.
|
|
1118
|
-
if (
|
|
1108
|
+
if (already_resolved()) return;
|
|
1119
1109
|
// The number of slots required for variables.
|
|
1120
1110
|
num_stack_slots_ = 0;
|
|
1121
1111
|
num_heap_slots_ = Context::MIN_CONTEXT_SLOTS;
|