libv8 3.3.10.4 → 3.5.10.beta1
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/lib/libv8/v8/src/isolate.h
CHANGED
@@ -69,7 +69,6 @@ class InlineRuntimeFunctionsTable;
|
|
69
69
|
class NoAllocationStringAllocator;
|
70
70
|
class PcToCodeCache;
|
71
71
|
class PreallocatedMemoryThread;
|
72
|
-
class ProducerHeapProfile;
|
73
72
|
class RegExpStack;
|
74
73
|
class SaveContext;
|
75
74
|
class UnicodeCache;
|
@@ -126,14 +125,8 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
|
|
126
125
|
C(c_entry_fp_address) \
|
127
126
|
C(context_address) \
|
128
127
|
C(pending_exception_address) \
|
129
|
-
C(external_caught_exception_address)
|
130
|
-
|
131
|
-
#ifdef ENABLE_LOGGING_AND_PROFILING
|
132
|
-
#define ISOLATE_ADDRESS_LIST_PROF(C) \
|
128
|
+
C(external_caught_exception_address) \
|
133
129
|
C(js_entry_sp_address)
|
134
|
-
#else
|
135
|
-
#define ISOLATE_ADDRESS_LIST_PROF(C)
|
136
|
-
#endif
|
137
130
|
|
138
131
|
|
139
132
|
// Platform-independent, reliable thread identifier.
|
@@ -253,14 +246,9 @@ class ThreadLocalTop BASE_EMBEDDED {
|
|
253
246
|
#endif
|
254
247
|
#endif // USE_SIMULATOR
|
255
248
|
|
256
|
-
#ifdef ENABLE_LOGGING_AND_PROFILING
|
257
249
|
Address js_entry_sp_; // the stack pointer of the bottom js entry frame
|
258
250
|
Address external_callback_; // the external callback we're currently in
|
259
|
-
#endif
|
260
|
-
|
261
|
-
#ifdef ENABLE_VMSTATE_TRACKING
|
262
251
|
StateTag current_vm_state_;
|
263
|
-
#endif
|
264
252
|
|
265
253
|
// Generated code scratch locations.
|
266
254
|
int32_t formal_count_;
|
@@ -268,6 +256,9 @@ class ThreadLocalTop BASE_EMBEDDED {
|
|
268
256
|
// Call back function to report unsafe JS accesses.
|
269
257
|
v8::FailedAccessCheckCallback failed_access_check_callback_;
|
270
258
|
|
259
|
+
// Whether out of memory exceptions should be ignored.
|
260
|
+
bool ignore_out_of_memory_;
|
261
|
+
|
271
262
|
private:
|
272
263
|
void InitializeInternal();
|
273
264
|
|
@@ -314,18 +305,6 @@ class HashMap;
|
|
314
305
|
|
315
306
|
#endif
|
316
307
|
|
317
|
-
#ifdef ENABLE_LOGGING_AND_PROFILING
|
318
|
-
|
319
|
-
#define ISOLATE_LOGGING_INIT_LIST(V) \
|
320
|
-
V(CpuProfiler*, cpu_profiler, NULL) \
|
321
|
-
V(HeapProfiler*, heap_profiler, NULL)
|
322
|
-
|
323
|
-
#else
|
324
|
-
|
325
|
-
#define ISOLATE_LOGGING_INIT_LIST(V)
|
326
|
-
|
327
|
-
#endif
|
328
|
-
|
329
308
|
#define ISOLATE_INIT_ARRAY_LIST(V) \
|
330
309
|
/* SerializerDeserializer state. */ \
|
331
310
|
V(Object*, serialize_partial_snapshot_cache, kPartialSnapshotCacheCapacity) \
|
@@ -333,6 +312,8 @@ class HashMap;
|
|
333
312
|
V(int, bad_char_shift_table, kUC16AlphabetSize) \
|
334
313
|
V(int, good_suffix_shift_table, (kBMMaxShift + 1)) \
|
335
314
|
V(int, suffix_table, (kBMMaxShift + 1)) \
|
315
|
+
V(uint32_t, random_seed, 2) \
|
316
|
+
V(uint32_t, private_random_seed, 2) \
|
336
317
|
ISOLATE_INIT_DEBUG_ARRAY_LIST(V)
|
337
318
|
|
338
319
|
typedef List<HeapObject*, PreallocatedStorage> DebugObjectCache;
|
@@ -372,8 +353,9 @@ typedef List<HeapObject*, PreallocatedStorage> DebugObjectCache;
|
|
372
353
|
/* SafeStackFrameIterator activations count. */ \
|
373
354
|
V(int, safe_stack_iterator_counter, 0) \
|
374
355
|
V(uint64_t, enabled_cpu_features, 0) \
|
356
|
+
V(CpuProfiler*, cpu_profiler, NULL) \
|
357
|
+
V(HeapProfiler*, heap_profiler, NULL) \
|
375
358
|
ISOLATE_PLATFORM_INIT_LIST(V) \
|
376
|
-
ISOLATE_LOGGING_INIT_LIST(V) \
|
377
359
|
ISOLATE_DEBUGGER_INIT_LIST(V)
|
378
360
|
|
379
361
|
class Isolate {
|
@@ -444,7 +426,6 @@ class Isolate {
|
|
444
426
|
enum AddressId {
|
445
427
|
#define C(name) k_##name,
|
446
428
|
ISOLATE_ADDRESS_LIST(C)
|
447
|
-
ISOLATE_ADDRESS_LIST_PROF(C)
|
448
429
|
#undef C
|
449
430
|
k_isolate_address_count
|
450
431
|
};
|
@@ -468,6 +449,13 @@ class Isolate {
|
|
468
449
|
return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key_));
|
469
450
|
}
|
470
451
|
|
452
|
+
// Usually called by Init(), but can be called early e.g. to allow
|
453
|
+
// testing components that require logging but not the whole
|
454
|
+
// isolate.
|
455
|
+
//
|
456
|
+
// Safe to call more than once.
|
457
|
+
void InitializeLoggingAndCounters();
|
458
|
+
|
471
459
|
bool Init(Deserializer* des);
|
472
460
|
|
473
461
|
bool IsInitialized() { return state_ == INITIALIZED; }
|
@@ -520,15 +508,18 @@ class Isolate {
|
|
520
508
|
// switched to non-legacy behavior).
|
521
509
|
static void EnterDefaultIsolate();
|
522
510
|
|
523
|
-
// Debug.
|
524
511
|
// Mutex for serializing access to break control structures.
|
525
512
|
Mutex* break_access() { return break_access_; }
|
526
513
|
|
514
|
+
// Mutex for serializing access to debugger.
|
515
|
+
Mutex* debugger_access() { return debugger_access_; }
|
516
|
+
|
527
517
|
Address get_address_from_id(AddressId id);
|
528
518
|
|
529
519
|
// Access to top context (where the current function object was created).
|
530
520
|
Context* context() { return thread_local_top_.context_; }
|
531
521
|
void set_context(Context* context) {
|
522
|
+
ASSERT(context == NULL || context->IsContext());
|
532
523
|
thread_local_top_.context_ = context;
|
533
524
|
}
|
534
525
|
Context** context_address() { return &thread_local_top_.context_; }
|
@@ -594,7 +585,7 @@ class Isolate {
|
|
594
585
|
return thread_local_top_.scheduled_exception_;
|
595
586
|
}
|
596
587
|
bool has_scheduled_exception() {
|
597
|
-
return
|
588
|
+
return thread_local_top_.scheduled_exception_ != heap_.the_hole_value();
|
598
589
|
}
|
599
590
|
void clear_scheduled_exception() {
|
600
591
|
thread_local_top_.scheduled_exception_ = heap_.the_hole_value();
|
@@ -618,7 +609,6 @@ class Isolate {
|
|
618
609
|
}
|
619
610
|
inline Address* handler_address() { return &thread_local_top_.handler_; }
|
620
611
|
|
621
|
-
#ifdef ENABLE_LOGGING_AND_PROFILING
|
622
612
|
// Bottom JS entry (see StackTracer::Trace in log.cc).
|
623
613
|
static Address js_entry_sp(ThreadLocalTop* thread) {
|
624
614
|
return thread->js_entry_sp_;
|
@@ -626,7 +616,6 @@ class Isolate {
|
|
626
616
|
inline Address* js_entry_sp_address() {
|
627
617
|
return &thread_local_top_.js_entry_sp_;
|
628
618
|
}
|
629
|
-
#endif
|
630
619
|
|
631
620
|
// Generated code scratch locations.
|
632
621
|
void* formal_count_address() { return &thread_local_top_.formal_count_; }
|
@@ -684,6 +673,12 @@ class Isolate {
|
|
684
673
|
// Tells whether the current context has experienced an out of memory
|
685
674
|
// exception.
|
686
675
|
bool is_out_of_memory();
|
676
|
+
bool ignore_out_of_memory() {
|
677
|
+
return thread_local_top_.ignore_out_of_memory_;
|
678
|
+
}
|
679
|
+
void set_ignore_out_of_memory(bool value) {
|
680
|
+
thread_local_top_.ignore_out_of_memory_ = value;
|
681
|
+
}
|
687
682
|
|
688
683
|
void PrintCurrentStackTrace(FILE* out);
|
689
684
|
void PrintStackTrace(FILE* out, char* thread_data);
|
@@ -792,14 +787,24 @@ class Isolate {
|
|
792
787
|
#undef GLOBAL_CONTEXT_FIELD_ACCESSOR
|
793
788
|
|
794
789
|
Bootstrapper* bootstrapper() { return bootstrapper_; }
|
795
|
-
Counters* counters() {
|
790
|
+
Counters* counters() {
|
791
|
+
// Call InitializeLoggingAndCounters() if logging is needed before
|
792
|
+
// the isolate is fully initialized.
|
793
|
+
ASSERT(counters_ != NULL);
|
794
|
+
return counters_;
|
795
|
+
}
|
796
796
|
CodeRange* code_range() { return code_range_; }
|
797
797
|
RuntimeProfiler* runtime_profiler() { return runtime_profiler_; }
|
798
798
|
CompilationCache* compilation_cache() { return compilation_cache_; }
|
799
|
-
Logger* logger() {
|
799
|
+
Logger* logger() {
|
800
|
+
// Call InitializeLoggingAndCounters() if logging is needed before
|
801
|
+
// the isolate is fully initialized.
|
802
|
+
ASSERT(logger_ != NULL);
|
803
|
+
return logger_;
|
804
|
+
}
|
800
805
|
StackGuard* stack_guard() { return &stack_guard_; }
|
801
806
|
Heap* heap() { return &heap_; }
|
802
|
-
StatsTable* stats_table()
|
807
|
+
StatsTable* stats_table();
|
803
808
|
StubCache* stub_cache() { return stub_cache_; }
|
804
809
|
DeoptimizerData* deoptimizer_data() { return deoptimizer_data_; }
|
805
810
|
ThreadLocalTop* thread_local_top() { return &thread_local_top_; }
|
@@ -895,31 +900,23 @@ class Isolate {
|
|
895
900
|
return &interp_canonicalize_mapping_;
|
896
901
|
}
|
897
902
|
|
898
|
-
ZoneObjectList* frame_element_constant_list() {
|
899
|
-
return &frame_element_constant_list_;
|
900
|
-
}
|
901
|
-
|
902
|
-
ZoneObjectList* result_constant_list() {
|
903
|
-
return &result_constant_list_;
|
904
|
-
}
|
905
|
-
|
906
903
|
void* PreallocatedStorageNew(size_t size);
|
907
904
|
void PreallocatedStorageDelete(void* p);
|
908
905
|
void PreallocatedStorageInit(size_t size);
|
909
906
|
|
910
907
|
#ifdef ENABLE_DEBUGGER_SUPPORT
|
911
|
-
Debugger* debugger() {
|
912
|
-
|
908
|
+
Debugger* debugger() {
|
909
|
+
if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger();
|
910
|
+
return debugger_;
|
911
|
+
}
|
912
|
+
Debug* debug() {
|
913
|
+
if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger();
|
914
|
+
return debug_;
|
915
|
+
}
|
913
916
|
#endif
|
914
917
|
|
915
918
|
inline bool DebuggerHasBreakPoints();
|
916
919
|
|
917
|
-
#ifdef ENABLE_LOGGING_AND_PROFILING
|
918
|
-
ProducerHeapProfile* producer_heap_profile() {
|
919
|
-
return producer_heap_profile_;
|
920
|
-
}
|
921
|
-
#endif
|
922
|
-
|
923
920
|
#ifdef DEBUG
|
924
921
|
HistogramInfo* heap_histograms() { return heap_histograms_; }
|
925
922
|
|
@@ -957,22 +954,21 @@ class Isolate {
|
|
957
954
|
|
958
955
|
static const int kJSRegexpStaticOffsetsVectorSize = 50;
|
959
956
|
|
960
|
-
#ifdef ENABLE_LOGGING_AND_PROFILING
|
961
957
|
Address external_callback() {
|
962
958
|
return thread_local_top_.external_callback_;
|
963
959
|
}
|
964
960
|
void set_external_callback(Address callback) {
|
965
961
|
thread_local_top_.external_callback_ = callback;
|
966
962
|
}
|
967
|
-
#endif
|
968
963
|
|
969
|
-
#ifdef ENABLE_VMSTATE_TRACKING
|
970
964
|
StateTag current_vm_state() {
|
971
965
|
return thread_local_top_.current_vm_state_;
|
972
966
|
}
|
973
967
|
|
974
968
|
void SetCurrentVMState(StateTag state) {
|
975
969
|
if (RuntimeProfiler::IsEnabled()) {
|
970
|
+
// Make sure thread local top is initialized.
|
971
|
+
ASSERT(thread_local_top_.isolate_ == this);
|
976
972
|
StateTag current_state = thread_local_top_.current_vm_state_;
|
977
973
|
if (current_state != JS && state == JS) {
|
978
974
|
// Non-JS -> JS transition.
|
@@ -990,9 +986,6 @@ class Isolate {
|
|
990
986
|
}
|
991
987
|
thread_local_top_.current_vm_state_ = state;
|
992
988
|
}
|
993
|
-
#endif
|
994
|
-
|
995
|
-
void ResetEagerOptimizingData();
|
996
989
|
|
997
990
|
void SetData(void* data) { embedder_data_ = data; }
|
998
991
|
void* GetData() { return embedder_data_; }
|
@@ -1011,6 +1004,7 @@ class Isolate {
|
|
1011
1004
|
void Insert(PerIsolateThreadData* data);
|
1012
1005
|
void Remove(Isolate* isolate, ThreadId thread_id);
|
1013
1006
|
void Remove(PerIsolateThreadData* data);
|
1007
|
+
void RemoveAllThreads(Isolate* isolate);
|
1014
1008
|
|
1015
1009
|
private:
|
1016
1010
|
PerIsolateThreadData* list_;
|
@@ -1050,8 +1044,6 @@ class Isolate {
|
|
1050
1044
|
static Isolate* default_isolate_;
|
1051
1045
|
static ThreadDataTable* thread_data_table_;
|
1052
1046
|
|
1053
|
-
bool PreInit();
|
1054
|
-
|
1055
1047
|
void Deinit();
|
1056
1048
|
|
1057
1049
|
static void SetIsolateThreadLocals(Isolate* isolate,
|
@@ -1059,7 +1051,6 @@ class Isolate {
|
|
1059
1051
|
|
1060
1052
|
enum State {
|
1061
1053
|
UNINITIALIZED, // Some components may not have been allocated.
|
1062
|
-
PREINITIALIZED, // Components have been allocated but not initialized.
|
1063
1054
|
INITIALIZED // All components are fully initialized.
|
1064
1055
|
};
|
1065
1056
|
|
@@ -1103,6 +1094,8 @@ class Isolate {
|
|
1103
1094
|
|
1104
1095
|
void PropagatePendingExceptionToExternalTryCatch();
|
1105
1096
|
|
1097
|
+
void InitializeDebugger();
|
1098
|
+
|
1106
1099
|
int stack_trace_nesting_level_;
|
1107
1100
|
StringStream* incomplete_message_;
|
1108
1101
|
// The preallocated memory thread singleton.
|
@@ -1116,6 +1109,8 @@ class Isolate {
|
|
1116
1109
|
Counters* counters_;
|
1117
1110
|
CodeRange* code_range_;
|
1118
1111
|
Mutex* break_access_;
|
1112
|
+
Atomic32 debugger_initialized_;
|
1113
|
+
Mutex* debugger_access_;
|
1119
1114
|
Heap heap_;
|
1120
1115
|
Logger* logger_;
|
1121
1116
|
StackGuard stack_guard_;
|
@@ -1157,8 +1152,6 @@ class Isolate {
|
|
1157
1152
|
regexp_macro_assembler_canonicalize_;
|
1158
1153
|
RegExpStack* regexp_stack_;
|
1159
1154
|
unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_;
|
1160
|
-
ZoneObjectList frame_element_constant_list_;
|
1161
|
-
ZoneObjectList result_constant_list_;
|
1162
1155
|
void* embedder_data_;
|
1163
1156
|
|
1164
1157
|
#if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \
|
@@ -1180,10 +1173,6 @@ class Isolate {
|
|
1180
1173
|
Debug* debug_;
|
1181
1174
|
#endif
|
1182
1175
|
|
1183
|
-
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1184
|
-
ProducerHeapProfile* producer_heap_profile_;
|
1185
|
-
#endif
|
1186
|
-
|
1187
1176
|
#define GLOBAL_BACKING_STORE(type, name, initialvalue) \
|
1188
1177
|
type name##_;
|
1189
1178
|
ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE)
|
@@ -1211,6 +1200,7 @@ class Isolate {
|
|
1211
1200
|
friend class Simulator;
|
1212
1201
|
friend class StackGuard;
|
1213
1202
|
friend class ThreadId;
|
1203
|
+
friend class TestMemoryAllocatorScope;
|
1214
1204
|
friend class v8::Isolate;
|
1215
1205
|
friend class v8::Locker;
|
1216
1206
|
friend class v8::Unlocker;
|
@@ -1373,10 +1363,4 @@ inline void Context::mark_out_of_memory() {
|
|
1373
1363
|
|
1374
1364
|
} } // namespace v8::internal
|
1375
1365
|
|
1376
|
-
// TODO(isolates): Get rid of these -inl.h includes and place them only where
|
1377
|
-
// they're needed.
|
1378
|
-
#include "allocation-inl.h"
|
1379
|
-
#include "zone-inl.h"
|
1380
|
-
#include "frames-inl.h"
|
1381
|
-
|
1382
1366
|
#endif // V8_ISOLATE_H_
|
@@ -28,12 +28,19 @@
|
|
28
28
|
#ifndef V8_JSON_PARSER_H_
|
29
29
|
#define V8_JSON_PARSER_H_
|
30
30
|
|
31
|
+
#include "v8.h"
|
32
|
+
|
33
|
+
#include "char-predicates-inl.h"
|
34
|
+
#include "v8conversions.h"
|
35
|
+
#include "messages.h"
|
36
|
+
#include "spaces-inl.h"
|
31
37
|
#include "token.h"
|
32
38
|
|
33
39
|
namespace v8 {
|
34
40
|
namespace internal {
|
35
41
|
|
36
42
|
// A simple json parser.
|
43
|
+
template <bool seq_ascii>
|
37
44
|
class JsonParser BASE_EMBEDDED {
|
38
45
|
public:
|
39
46
|
static Handle<Object> Parse(Handle<String> source) {
|
@@ -47,41 +54,64 @@ class JsonParser BASE_EMBEDDED {
|
|
47
54
|
Handle<Object> ParseJson(Handle<String> source);
|
48
55
|
|
49
56
|
inline void Advance() {
|
57
|
+
position_++;
|
50
58
|
if (position_ >= source_length_) {
|
51
|
-
position_++;
|
52
59
|
c0_ = kEndOfString;
|
53
|
-
} else if (
|
54
|
-
position_++;
|
60
|
+
} else if (seq_ascii) {
|
55
61
|
c0_ = seq_source_->SeqAsciiStringGet(position_);
|
56
62
|
} else {
|
57
|
-
position_++;
|
58
63
|
c0_ = source_->Get(position_);
|
59
64
|
}
|
60
65
|
}
|
61
66
|
|
62
|
-
|
67
|
+
// The JSON lexical grammar is specified in the ECMAScript 5 standard,
|
68
|
+
// section 15.12.1.1. The only allowed whitespace characters between tokens
|
69
|
+
// are tab, carriage-return, newline and space.
|
63
70
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
71
|
+
inline void AdvanceSkipWhitespace() {
|
72
|
+
do {
|
73
|
+
Advance();
|
74
|
+
} while (c0_ == '\t' || c0_ == '\r' || c0_ == '\n' || c0_ == ' ');
|
75
|
+
}
|
68
76
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
77
|
+
inline void SkipWhitespace() {
|
78
|
+
while (c0_ == '\t' || c0_ == '\r' || c0_ == '\n' || c0_ == ' ') {
|
79
|
+
Advance();
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
inline uc32 AdvanceGetChar() {
|
84
|
+
Advance();
|
85
|
+
return c0_;
|
86
|
+
}
|
87
|
+
|
88
|
+
// Checks that current charater is c.
|
89
|
+
// If so, then consume c and skip whitespace.
|
90
|
+
inline bool MatchSkipWhiteSpace(uc32 c) {
|
91
|
+
if (c0_ == c) {
|
92
|
+
AdvanceSkipWhitespace();
|
93
|
+
return true;
|
94
|
+
}
|
95
|
+
return false;
|
96
|
+
}
|
76
97
|
|
77
98
|
// A JSON string (production JSONString) is subset of valid JavaScript string
|
78
99
|
// literals. The string must only be double-quoted (not single-quoted), and
|
79
100
|
// the only allowed backslash-escapes are ", /, \, b, f, n, r, t and
|
80
101
|
// four-digit hex escapes (uXXXX). Any other use of backslashes is invalid.
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
102
|
+
Handle<String> ParseJsonString() {
|
103
|
+
return ScanJsonString<false>();
|
104
|
+
}
|
105
|
+
Handle<String> ParseJsonSymbol() {
|
106
|
+
return ScanJsonString<true>();
|
107
|
+
}
|
108
|
+
template <bool is_symbol>
|
109
|
+
Handle<String> ScanJsonString();
|
110
|
+
// Creates a new string and copies prefix[start..end] into the beginning
|
111
|
+
// of it. Then scans the rest of the string, adding characters after the
|
112
|
+
// prefix. Called by ScanJsonString when reaching a '\' or non-ASCII char.
|
113
|
+
template <typename StringType, typename SinkChar>
|
114
|
+
Handle<String> SlowScanJsonString(Handle<String> prefix, int start, int end);
|
85
115
|
|
86
116
|
// A JSON number (production JSONNumber) is a subset of the valid JavaScript
|
87
117
|
// decimal number literals.
|
@@ -89,12 +119,7 @@ class JsonParser BASE_EMBEDDED {
|
|
89
119
|
// digit before and after a decimal point, may not have prefixed zeros (unless
|
90
120
|
// the integer part is zero), and may include an exponent part (e.g., "e-10").
|
91
121
|
// Hexadecimal and octal numbers are not allowed.
|
92
|
-
|
93
|
-
|
94
|
-
// Used to recognizes one of the literals "true", "false", or "null". These
|
95
|
-
// are the only valid JSON identifiers (productions JSONBooleanLiteral,
|
96
|
-
// JSONNullLiteral).
|
97
|
-
Token::Value ScanJsonIdentifier(const char* text, Token::Value token);
|
122
|
+
Handle<Object> ParseJsonNumber();
|
98
123
|
|
99
124
|
// Parse a single JSON value from input (grammar production JSONValue).
|
100
125
|
// A JSON value is either a (double-quoted) string literal, a number literal,
|
@@ -119,23 +144,13 @@ class JsonParser BASE_EMBEDDED {
|
|
119
144
|
|
120
145
|
// Mark that a parsing error has happened at the current token, and
|
121
146
|
// return a null handle. Primarily for readability.
|
122
|
-
Handle<Object>
|
123
|
-
|
124
|
-
|
125
|
-
Token::Value Peek() { return next_.token; }
|
126
|
-
// Scan the next token and return the token scanned on the last call.
|
127
|
-
Token::Value Next();
|
147
|
+
inline Handle<Object> ReportUnexpectedCharacter() {
|
148
|
+
return Handle<Object>::null();
|
149
|
+
}
|
128
150
|
|
129
|
-
|
130
|
-
TokenInfo() : token(Token::ILLEGAL),
|
131
|
-
beg_pos(0),
|
132
|
-
end_pos(0) { }
|
133
|
-
Token::Value token;
|
134
|
-
int beg_pos;
|
135
|
-
int end_pos;
|
136
|
-
};
|
151
|
+
inline Isolate* isolate() { return isolate_; }
|
137
152
|
|
138
|
-
static const int
|
153
|
+
static const int kInitialSpecialStringLength = 1024;
|
139
154
|
|
140
155
|
|
141
156
|
private:
|
@@ -143,18 +158,441 @@ class JsonParser BASE_EMBEDDED {
|
|
143
158
|
int source_length_;
|
144
159
|
Handle<SeqAsciiString> seq_source_;
|
145
160
|
|
146
|
-
bool is_sequential_ascii_;
|
147
|
-
// Current and next token
|
148
|
-
TokenInfo current_;
|
149
|
-
TokenInfo next_;
|
150
161
|
Isolate* isolate_;
|
151
162
|
uc32 c0_;
|
152
163
|
int position_;
|
164
|
+
};
|
153
165
|
|
166
|
+
template <bool seq_ascii>
|
167
|
+
Handle<Object> JsonParser<seq_ascii>::ParseJson(Handle<String> source) {
|
168
|
+
isolate_ = source->map()->isolate();
|
169
|
+
FlattenString(source);
|
170
|
+
source_ = source;
|
171
|
+
source_length_ = source_->length();
|
154
172
|
|
155
|
-
|
156
|
-
|
157
|
-
|
173
|
+
// Optimized fast case where we only have ASCII characters.
|
174
|
+
if (seq_ascii) {
|
175
|
+
seq_source_ = Handle<SeqAsciiString>::cast(source_);
|
176
|
+
}
|
177
|
+
|
178
|
+
// Set initial position right before the string.
|
179
|
+
position_ = -1;
|
180
|
+
// Advance to the first character (posibly EOS)
|
181
|
+
AdvanceSkipWhitespace();
|
182
|
+
Handle<Object> result = ParseJsonValue();
|
183
|
+
if (result.is_null() || c0_ != kEndOfString) {
|
184
|
+
// Parse failed. Current character is the unexpected token.
|
185
|
+
|
186
|
+
const char* message;
|
187
|
+
Factory* factory = isolate()->factory();
|
188
|
+
Handle<JSArray> array;
|
189
|
+
|
190
|
+
switch (c0_) {
|
191
|
+
case kEndOfString:
|
192
|
+
message = "unexpected_eos";
|
193
|
+
array = factory->NewJSArray(0);
|
194
|
+
break;
|
195
|
+
case '-':
|
196
|
+
case '0':
|
197
|
+
case '1':
|
198
|
+
case '2':
|
199
|
+
case '3':
|
200
|
+
case '4':
|
201
|
+
case '5':
|
202
|
+
case '6':
|
203
|
+
case '7':
|
204
|
+
case '8':
|
205
|
+
case '9':
|
206
|
+
message = "unexpected_token_number";
|
207
|
+
array = factory->NewJSArray(0);
|
208
|
+
break;
|
209
|
+
case '"':
|
210
|
+
message = "unexpected_token_string";
|
211
|
+
array = factory->NewJSArray(0);
|
212
|
+
break;
|
213
|
+
default:
|
214
|
+
message = "unexpected_token";
|
215
|
+
Handle<Object> name = LookupSingleCharacterStringFromCode(c0_);
|
216
|
+
Handle<FixedArray> element = factory->NewFixedArray(1);
|
217
|
+
element->set(0, *name);
|
218
|
+
array = factory->NewJSArrayWithElements(element);
|
219
|
+
break;
|
220
|
+
}
|
221
|
+
|
222
|
+
MessageLocation location(factory->NewScript(source),
|
223
|
+
position_,
|
224
|
+
position_ + 1);
|
225
|
+
Handle<Object> result = factory->NewSyntaxError(message, array);
|
226
|
+
isolate()->Throw(*result, &location);
|
227
|
+
return Handle<Object>::null();
|
228
|
+
}
|
229
|
+
return result;
|
230
|
+
}
|
231
|
+
|
232
|
+
|
233
|
+
// Parse any JSON value.
|
234
|
+
template <bool seq_ascii>
|
235
|
+
Handle<Object> JsonParser<seq_ascii>::ParseJsonValue() {
|
236
|
+
switch (c0_) {
|
237
|
+
case '"':
|
238
|
+
return ParseJsonString();
|
239
|
+
case '-':
|
240
|
+
case '0':
|
241
|
+
case '1':
|
242
|
+
case '2':
|
243
|
+
case '3':
|
244
|
+
case '4':
|
245
|
+
case '5':
|
246
|
+
case '6':
|
247
|
+
case '7':
|
248
|
+
case '8':
|
249
|
+
case '9':
|
250
|
+
return ParseJsonNumber();
|
251
|
+
case 'f':
|
252
|
+
if (AdvanceGetChar() == 'a' && AdvanceGetChar() == 'l' &&
|
253
|
+
AdvanceGetChar() == 's' && AdvanceGetChar() == 'e') {
|
254
|
+
AdvanceSkipWhitespace();
|
255
|
+
return isolate()->factory()->false_value();
|
256
|
+
} else {
|
257
|
+
return ReportUnexpectedCharacter();
|
258
|
+
}
|
259
|
+
case 't':
|
260
|
+
if (AdvanceGetChar() == 'r' && AdvanceGetChar() == 'u' &&
|
261
|
+
AdvanceGetChar() == 'e') {
|
262
|
+
AdvanceSkipWhitespace();
|
263
|
+
return isolate()->factory()->true_value();
|
264
|
+
} else {
|
265
|
+
return ReportUnexpectedCharacter();
|
266
|
+
}
|
267
|
+
case 'n':
|
268
|
+
if (AdvanceGetChar() == 'u' && AdvanceGetChar() == 'l' &&
|
269
|
+
AdvanceGetChar() == 'l') {
|
270
|
+
AdvanceSkipWhitespace();
|
271
|
+
return isolate()->factory()->null_value();
|
272
|
+
} else {
|
273
|
+
return ReportUnexpectedCharacter();
|
274
|
+
}
|
275
|
+
case '{':
|
276
|
+
return ParseJsonObject();
|
277
|
+
case '[':
|
278
|
+
return ParseJsonArray();
|
279
|
+
default:
|
280
|
+
return ReportUnexpectedCharacter();
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
|
285
|
+
// Parse a JSON object. Position must be right at '{'.
|
286
|
+
template <bool seq_ascii>
|
287
|
+
Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
|
288
|
+
Handle<JSFunction> object_constructor(
|
289
|
+
isolate()->global_context()->object_function());
|
290
|
+
Handle<JSObject> json_object =
|
291
|
+
isolate()->factory()->NewJSObject(object_constructor);
|
292
|
+
ASSERT_EQ(c0_, '{');
|
293
|
+
|
294
|
+
AdvanceSkipWhitespace();
|
295
|
+
if (c0_ != '}') {
|
296
|
+
do {
|
297
|
+
if (c0_ != '"') return ReportUnexpectedCharacter();
|
298
|
+
Handle<String> key = ParseJsonSymbol();
|
299
|
+
if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter();
|
300
|
+
AdvanceSkipWhitespace();
|
301
|
+
Handle<Object> value = ParseJsonValue();
|
302
|
+
if (value.is_null()) return ReportUnexpectedCharacter();
|
303
|
+
|
304
|
+
uint32_t index;
|
305
|
+
if (key->AsArrayIndex(&index)) {
|
306
|
+
SetOwnElement(json_object, index, value, kNonStrictMode);
|
307
|
+
} else if (key->Equals(isolate()->heap()->Proto_symbol())) {
|
308
|
+
SetPrototype(json_object, value);
|
309
|
+
} else {
|
310
|
+
SetLocalPropertyIgnoreAttributes(json_object, key, value, NONE);
|
311
|
+
}
|
312
|
+
} while (MatchSkipWhiteSpace(','));
|
313
|
+
if (c0_ != '}') {
|
314
|
+
return ReportUnexpectedCharacter();
|
315
|
+
}
|
316
|
+
}
|
317
|
+
AdvanceSkipWhitespace();
|
318
|
+
return json_object;
|
319
|
+
}
|
320
|
+
|
321
|
+
// Parse a JSON array. Position must be right at '['.
|
322
|
+
template <bool seq_ascii>
|
323
|
+
Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() {
|
324
|
+
ZoneScope zone_scope(isolate(), DELETE_ON_EXIT);
|
325
|
+
ZoneList<Handle<Object> > elements(4);
|
326
|
+
ASSERT_EQ(c0_, '[');
|
327
|
+
|
328
|
+
AdvanceSkipWhitespace();
|
329
|
+
if (c0_ != ']') {
|
330
|
+
do {
|
331
|
+
Handle<Object> element = ParseJsonValue();
|
332
|
+
if (element.is_null()) return ReportUnexpectedCharacter();
|
333
|
+
elements.Add(element);
|
334
|
+
} while (MatchSkipWhiteSpace(','));
|
335
|
+
if (c0_ != ']') {
|
336
|
+
return ReportUnexpectedCharacter();
|
337
|
+
}
|
338
|
+
}
|
339
|
+
AdvanceSkipWhitespace();
|
340
|
+
// Allocate a fixed array with all the elements.
|
341
|
+
Handle<FixedArray> fast_elements =
|
342
|
+
isolate()->factory()->NewFixedArray(elements.length());
|
343
|
+
for (int i = 0, n = elements.length(); i < n; i++) {
|
344
|
+
fast_elements->set(i, *elements[i]);
|
345
|
+
}
|
346
|
+
return isolate()->factory()->NewJSArrayWithElements(fast_elements);
|
347
|
+
}
|
348
|
+
|
349
|
+
|
350
|
+
template <bool seq_ascii>
|
351
|
+
Handle<Object> JsonParser<seq_ascii>::ParseJsonNumber() {
|
352
|
+
bool negative = false;
|
353
|
+
int beg_pos = position_;
|
354
|
+
if (c0_ == '-') {
|
355
|
+
Advance();
|
356
|
+
negative = true;
|
357
|
+
}
|
358
|
+
if (c0_ == '0') {
|
359
|
+
Advance();
|
360
|
+
// Prefix zero is only allowed if it's the only digit before
|
361
|
+
// a decimal point or exponent.
|
362
|
+
if ('0' <= c0_ && c0_ <= '9') return ReportUnexpectedCharacter();
|
363
|
+
} else {
|
364
|
+
int i = 0;
|
365
|
+
int digits = 0;
|
366
|
+
if (c0_ < '1' || c0_ > '9') return ReportUnexpectedCharacter();
|
367
|
+
do {
|
368
|
+
i = i * 10 + c0_ - '0';
|
369
|
+
digits++;
|
370
|
+
Advance();
|
371
|
+
} while (c0_ >= '0' && c0_ <= '9');
|
372
|
+
if (c0_ != '.' && c0_ != 'e' && c0_ != 'E' && digits < 10) {
|
373
|
+
SkipWhitespace();
|
374
|
+
return Handle<Smi>(Smi::FromInt((negative ? -i : i)), isolate());
|
375
|
+
}
|
376
|
+
}
|
377
|
+
if (c0_ == '.') {
|
378
|
+
Advance();
|
379
|
+
if (c0_ < '0' || c0_ > '9') return ReportUnexpectedCharacter();
|
380
|
+
do {
|
381
|
+
Advance();
|
382
|
+
} while (c0_ >= '0' && c0_ <= '9');
|
383
|
+
}
|
384
|
+
if (AsciiAlphaToLower(c0_) == 'e') {
|
385
|
+
Advance();
|
386
|
+
if (c0_ == '-' || c0_ == '+') Advance();
|
387
|
+
if (c0_ < '0' || c0_ > '9') return ReportUnexpectedCharacter();
|
388
|
+
do {
|
389
|
+
Advance();
|
390
|
+
} while (c0_ >= '0' && c0_ <= '9');
|
391
|
+
}
|
392
|
+
int length = position_ - beg_pos;
|
393
|
+
double number;
|
394
|
+
if (seq_ascii) {
|
395
|
+
Vector<const char> chars(seq_source_->GetChars() + beg_pos, length);
|
396
|
+
number = StringToDouble(isolate()->unicode_cache(),
|
397
|
+
chars,
|
398
|
+
NO_FLAGS, // Hex, octal or trailing junk.
|
399
|
+
OS::nan_value());
|
400
|
+
} else {
|
401
|
+
Vector<char> buffer = Vector<char>::New(length);
|
402
|
+
String::WriteToFlat(*source_, buffer.start(), beg_pos, position_);
|
403
|
+
Vector<const char> result =
|
404
|
+
Vector<const char>(reinterpret_cast<const char*>(buffer.start()),
|
405
|
+
length);
|
406
|
+
number = StringToDouble(isolate()->unicode_cache(),
|
407
|
+
result,
|
408
|
+
NO_FLAGS, // Hex, octal or trailing junk.
|
409
|
+
0.0);
|
410
|
+
buffer.Dispose();
|
411
|
+
}
|
412
|
+
SkipWhitespace();
|
413
|
+
return isolate()->factory()->NewNumber(number);
|
414
|
+
}
|
415
|
+
|
416
|
+
|
417
|
+
template <typename StringType>
|
418
|
+
inline void SeqStringSet(Handle<StringType> seq_str, int i, uc32 c);
|
419
|
+
|
420
|
+
template <>
|
421
|
+
inline void SeqStringSet(Handle<SeqTwoByteString> seq_str, int i, uc32 c) {
|
422
|
+
seq_str->SeqTwoByteStringSet(i, c);
|
423
|
+
}
|
424
|
+
|
425
|
+
template <>
|
426
|
+
inline void SeqStringSet(Handle<SeqAsciiString> seq_str, int i, uc32 c) {
|
427
|
+
seq_str->SeqAsciiStringSet(i, c);
|
428
|
+
}
|
429
|
+
|
430
|
+
template <typename StringType>
|
431
|
+
inline Handle<StringType> NewRawString(Factory* factory, int length);
|
432
|
+
|
433
|
+
template <>
|
434
|
+
inline Handle<SeqTwoByteString> NewRawString(Factory* factory, int length) {
|
435
|
+
return factory->NewRawTwoByteString(length, NOT_TENURED);
|
436
|
+
}
|
437
|
+
|
438
|
+
template <>
|
439
|
+
inline Handle<SeqAsciiString> NewRawString(Factory* factory, int length) {
|
440
|
+
return factory->NewRawAsciiString(length, NOT_TENURED);
|
441
|
+
}
|
442
|
+
|
443
|
+
|
444
|
+
// Scans the rest of a JSON string starting from position_ and writes
|
445
|
+
// prefix[start..end] along with the scanned characters into a
|
446
|
+
// sequential string of type StringType.
|
447
|
+
template <bool seq_ascii>
|
448
|
+
template <typename StringType, typename SinkChar>
|
449
|
+
Handle<String> JsonParser<seq_ascii>::SlowScanJsonString(
|
450
|
+
Handle<String> prefix, int start, int end) {
|
451
|
+
int count = end - start;
|
452
|
+
int max_length = count + source_length_ - position_;
|
453
|
+
int length = Min(max_length, Max(kInitialSpecialStringLength, 2 * count));
|
454
|
+
Handle<StringType> seq_str = NewRawString<StringType>(isolate()->factory(),
|
455
|
+
length);
|
456
|
+
// Copy prefix into seq_str.
|
457
|
+
SinkChar* dest = seq_str->GetChars();
|
458
|
+
String::WriteToFlat(*prefix, dest, start, end);
|
459
|
+
|
460
|
+
while (c0_ != '"') {
|
461
|
+
// Check for control character (0x00-0x1f) or unterminated string (<0).
|
462
|
+
if (c0_ < 0x20) return Handle<String>::null();
|
463
|
+
if (count >= length) {
|
464
|
+
// We need to create a longer sequential string for the result.
|
465
|
+
return SlowScanJsonString<StringType, SinkChar>(seq_str, 0, count);
|
466
|
+
}
|
467
|
+
if (c0_ != '\\') {
|
468
|
+
// If the sink can contain UC16 characters, or source_ contains only
|
469
|
+
// ASCII characters, there's no need to test whether we can store the
|
470
|
+
// character. Otherwise check whether the UC16 source character can fit
|
471
|
+
// in the ASCII sink.
|
472
|
+
if (sizeof(SinkChar) == kUC16Size ||
|
473
|
+
seq_ascii ||
|
474
|
+
c0_ <= kMaxAsciiCharCode) {
|
475
|
+
SeqStringSet(seq_str, count++, c0_);
|
476
|
+
Advance();
|
477
|
+
} else {
|
478
|
+
// StringType is SeqAsciiString and we just read a non-ASCII char.
|
479
|
+
return SlowScanJsonString<SeqTwoByteString, uc16>(seq_str, 0, count);
|
480
|
+
}
|
481
|
+
} else {
|
482
|
+
Advance(); // Advance past the \.
|
483
|
+
switch (c0_) {
|
484
|
+
case '"':
|
485
|
+
case '\\':
|
486
|
+
case '/':
|
487
|
+
SeqStringSet(seq_str, count++, c0_);
|
488
|
+
break;
|
489
|
+
case 'b':
|
490
|
+
SeqStringSet(seq_str, count++, '\x08');
|
491
|
+
break;
|
492
|
+
case 'f':
|
493
|
+
SeqStringSet(seq_str, count++, '\x0c');
|
494
|
+
break;
|
495
|
+
case 'n':
|
496
|
+
SeqStringSet(seq_str, count++, '\x0a');
|
497
|
+
break;
|
498
|
+
case 'r':
|
499
|
+
SeqStringSet(seq_str, count++, '\x0d');
|
500
|
+
break;
|
501
|
+
case 't':
|
502
|
+
SeqStringSet(seq_str, count++, '\x09');
|
503
|
+
break;
|
504
|
+
case 'u': {
|
505
|
+
uc32 value = 0;
|
506
|
+
for (int i = 0; i < 4; i++) {
|
507
|
+
Advance();
|
508
|
+
int digit = HexValue(c0_);
|
509
|
+
if (digit < 0) {
|
510
|
+
return Handle<String>::null();
|
511
|
+
}
|
512
|
+
value = value * 16 + digit;
|
513
|
+
}
|
514
|
+
if (sizeof(SinkChar) == kUC16Size || value <= kMaxAsciiCharCode) {
|
515
|
+
SeqStringSet(seq_str, count++, value);
|
516
|
+
break;
|
517
|
+
} else {
|
518
|
+
// StringType is SeqAsciiString and we just read a non-ASCII char.
|
519
|
+
position_ -= 6; // Rewind position_ to \ in \uxxxx.
|
520
|
+
Advance();
|
521
|
+
return SlowScanJsonString<SeqTwoByteString, uc16>(seq_str,
|
522
|
+
0,
|
523
|
+
count);
|
524
|
+
}
|
525
|
+
}
|
526
|
+
default:
|
527
|
+
return Handle<String>::null();
|
528
|
+
}
|
529
|
+
Advance();
|
530
|
+
}
|
531
|
+
}
|
532
|
+
// Shrink seq_string length to count.
|
533
|
+
if (isolate()->heap()->InNewSpace(*seq_str)) {
|
534
|
+
isolate()->heap()->new_space()->
|
535
|
+
template ShrinkStringAtAllocationBoundary<StringType>(
|
536
|
+
*seq_str, count);
|
537
|
+
} else {
|
538
|
+
int string_size = StringType::SizeFor(count);
|
539
|
+
int allocated_string_size = StringType::SizeFor(length);
|
540
|
+
int delta = allocated_string_size - string_size;
|
541
|
+
Address start_filler_object = seq_str->address() + string_size;
|
542
|
+
seq_str->set_length(count);
|
543
|
+
isolate()->heap()->CreateFillerObjectAt(start_filler_object, delta);
|
544
|
+
}
|
545
|
+
ASSERT_EQ('"', c0_);
|
546
|
+
// Advance past the last '"'.
|
547
|
+
AdvanceSkipWhitespace();
|
548
|
+
return seq_str;
|
549
|
+
}
|
550
|
+
|
551
|
+
|
552
|
+
template <bool seq_ascii>
|
553
|
+
template <bool is_symbol>
|
554
|
+
Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
|
555
|
+
ASSERT_EQ('"', c0_);
|
556
|
+
Advance();
|
557
|
+
if (c0_ == '"') {
|
558
|
+
AdvanceSkipWhitespace();
|
559
|
+
return Handle<String>(isolate()->heap()->empty_string());
|
560
|
+
}
|
561
|
+
int beg_pos = position_;
|
562
|
+
// Fast case for ASCII only without escape characters.
|
563
|
+
do {
|
564
|
+
// Check for control character (0x00-0x1f) or unterminated string (<0).
|
565
|
+
if (c0_ < 0x20) return Handle<String>::null();
|
566
|
+
if (c0_ != '\\') {
|
567
|
+
if (seq_ascii || c0_ <= kMaxAsciiCharCode) {
|
568
|
+
Advance();
|
569
|
+
} else {
|
570
|
+
return SlowScanJsonString<SeqTwoByteString, uc16>(source_,
|
571
|
+
beg_pos,
|
572
|
+
position_);
|
573
|
+
}
|
574
|
+
} else {
|
575
|
+
return SlowScanJsonString<SeqAsciiString, char>(source_,
|
576
|
+
beg_pos,
|
577
|
+
position_);
|
578
|
+
}
|
579
|
+
} while (c0_ != '"');
|
580
|
+
int length = position_ - beg_pos;
|
581
|
+
Handle<String> result;
|
582
|
+
if (seq_ascii && is_symbol) {
|
583
|
+
result = isolate()->factory()->LookupAsciiSymbol(seq_source_,
|
584
|
+
beg_pos,
|
585
|
+
length);
|
586
|
+
} else {
|
587
|
+
result = isolate()->factory()->NewRawAsciiString(length);
|
588
|
+
char* dest = SeqAsciiString::cast(*result)->GetChars();
|
589
|
+
String::WriteToFlat(*source_, dest, beg_pos, position_);
|
590
|
+
}
|
591
|
+
ASSERT_EQ('"', c0_);
|
592
|
+
// Advance past the last '"'.
|
593
|
+
AdvanceSkipWhitespace();
|
594
|
+
return result;
|
595
|
+
}
|
158
596
|
|
159
597
|
} } // namespace v8::internal
|
160
598
|
|