diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index 2eac3035c33dbb..cc424333d31334 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -24,6 +24,7 @@ .cproject .d8_history .gclient_entries +.landmines .project .pydevproject .settings diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 39fb88c57b7975..5b976b8b79f103 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -64,6 +64,7 @@ Jianghua Yang Joel Stanley Johan Bergström Jonathan Liu +JunHo Seo Kang-Hao (Kenny) Lu Luis Reis Luke Zarko diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 713ab6de57d461..fc0ea8eb6802bf 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -2,6 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/android/config.gni") +import("//build/config/arm.gni") +import("//build/config/mips.gni") + # Because standalone V8 builds are not supported, assume this is part of a # Chromium build. import("//build/module_args/v8.gni") @@ -18,10 +22,23 @@ v8_interpreted_regexp = false v8_object_print = false v8_postmortem_support = false v8_use_snapshot = true -v8_target_arch = cpu_arch +v8_target_arch = target_cpu v8_random_seed = "314159265" v8_toolset_for_d8 = "host" +# The snapshot needs to be compiled for the host, but compiled with +# a toolchain that matches the bit-width of the target. +# +# TODO(GYP): For now we only support 32-bit little-endian target builds from an +# x64 Linux host. Eventually we need to support all of the host/target +# configurations v8 runs on. +if (host_cpu == "x64" && host_os == "linux" && + (target_cpu == "arm" || target_cpu == "mipsel" || target_cpu == "x86")) { + snapshot_toolchain = "//build/toolchain/linux:clang_x86" +} else { + snapshot_toolchain = default_toolchain +} + ############################################################################### # Configurations # @@ -96,37 +113,49 @@ config("toolchain") { defines = [] cflags = [] - # TODO(jochen): Add support for arm subarchs, mips, mipsel. + # TODO(jochen): Add support for arm subarchs, mips, mipsel, mips64el. if (v8_target_arch == "arm") { defines += [ "V8_TARGET_ARCH_ARM" ] - if (arm_version == 7) { - defines += [ "CAN_USE_ARMV7_INSTRUCTIONS" ] - } - if (arm_fpu == "vfpv3-d16") { - defines += [ "CAN_USE_VFP3_INSTRUCTIONS" ] - } - if (arm_fpu == "vfpv3") { - defines += [ - "CAN_USE_VFP3_INSTRUCTIONS", - "CAN_USE_VFP32DREGS", - ] - } - if (arm_fpu == "neon") { + if (current_cpu == "arm") { + if (arm_version == 7) { + defines += [ "CAN_USE_ARMV7_INSTRUCTIONS" ] + } + if (arm_fpu == "vfpv3-d16") { + defines += [ "CAN_USE_VFP3_INSTRUCTIONS" ] + } else if (arm_fpu == "vfpv3") { + defines += [ + "CAN_USE_VFP3_INSTRUCTIONS", + "CAN_USE_VFP32DREGS", + ] + } else if (arm_fpu == "neon") { + defines += [ + "CAN_USE_VFP3_INSTRUCTIONS", + "CAN_USE_VFP32DREGS", + "CAN_USE_NEON", + ] + } + } else { + # These defines ares used for the ARM simulator. defines += [ + "CAN_USE_ARMV7_INSTRUCTIONS", "CAN_USE_VFP3_INSTRUCTIONS", "CAN_USE_VFP32DREGS", - "CAN_USE_NEON", + "USE_EABI_HARDFLOAT=0", ] } # TODO(jochen): Add support for arm_test_noprobe. - - # TODO(jochen): Add support for cpu_arch != v8_target_arch/ } if (v8_target_arch == "arm64") { defines += [ "V8_TARGET_ARCH_ARM64" ] } + if (v8_target_arch == "mipsel") { + defines += [ "V8_TARGET_ARCH_MIPS" ] + } + if (v8_target_arch == "mips64el") { + defines += [ "V8_TARGET_ARCH_MIPS64" ] + } if (v8_target_arch == "x86") { defines += [ "V8_TARGET_ARCH_IA32" ] } @@ -173,8 +202,8 @@ action("js2c") { "src/array.js", "src/string.js", "src/uri.js", - "src/third_party/fdlibm/fdlibm.js", "src/math.js", + "src/third_party/fdlibm/fdlibm.js", "src/date.js", "src/regexp.js", "src/arraybuffer.js", @@ -192,6 +221,7 @@ action("js2c") { "src/debug-debugger.js", "src/mirror-debugger.js", "src/liveedit-debugger.js", + "src/templates.js", "src/macros.py", ] @@ -230,13 +260,12 @@ action("js2c_experimental") { "src/macros.py", "src/proxy.js", "src/generator.js", - "src/harmony-string.js", "src/harmony-array.js", "src/harmony-array-includes.js", "src/harmony-typedarray.js", "src/harmony-tostring.js", - "src/harmony-templates.js", "src/harmony-regexp.js", + "src/harmony-reflect.js" ] outputs = [ @@ -322,7 +351,7 @@ action("run_mksnapshot") { visibility = [ ":*" ] # Only targets in this file can depend on this. deps = [ - ":mksnapshot($host_toolchain)", + ":mksnapshot($snapshot_toolchain)", ] script = "tools/run.py" @@ -332,7 +361,7 @@ action("run_mksnapshot") { ] args = [ - "./" + rebase_path(get_label_info(":mksnapshot($host_toolchain)", + "./" + rebase_path(get_label_info(":mksnapshot($snapshot_toolchain)", "root_out_dir") + "/mksnapshot", root_build_dir), "--log-snapshot-positions", @@ -373,7 +402,7 @@ source_set("v8_nosnapshot") { sources = [ "$target_gen_dir/libraries.cc", "$target_gen_dir/experimental-libraries.cc", - "src/snapshot-empty.cc", + "src/snapshot/snapshot-empty.cc", ] configs -= [ "//build/config/compiler:chromium_code" ] @@ -423,8 +452,8 @@ if (v8_use_external_startup_data) { ] sources = [ - "src/natives-external.cc", - "src/snapshot-external.cc", + "src/snapshot/natives-external.cc", + "src/snapshot/snapshot-external.cc", ] configs -= [ "//build/config/compiler:chromium_code" ] @@ -535,9 +564,7 @@ source_set("v8_base") { "src/compiler/frame.h", "src/compiler/gap-resolver.cc", "src/compiler/gap-resolver.h", - "src/compiler/generic-algorithm.h", "src/compiler/graph-builder.h", - "src/compiler/graph-inl.h", "src/compiler/graph-reducer.cc", "src/compiler/graph-reducer.h", "src/compiler/graph-replay.cc", @@ -566,6 +593,8 @@ source_set("v8_base") { "src/compiler/js-intrinsic-lowering.h", "src/compiler/js-operator.cc", "src/compiler/js-operator.h", + "src/compiler/js-type-feedback.cc", + "src/compiler/js-type-feedback.h", "src/compiler/js-typed-lowering.cc", "src/compiler/js-typed-lowering.h", "src/compiler/jump-threading.cc", @@ -573,6 +602,8 @@ source_set("v8_base") { "src/compiler/linkage-impl.h", "src/compiler/linkage.cc", "src/compiler/linkage.h", + "src/compiler/liveness-analyzer.cc", + "src/compiler/liveness-analyzer.h", "src/compiler/load-elimination.cc", "src/compiler/load-elimination.h", "src/compiler/loop-peeling.cc", @@ -591,6 +622,7 @@ source_set("v8_base") { "src/compiler/node-cache.h", "src/compiler/node-marker.cc", "src/compiler/node-marker.h", + "src/compiler/node-matchers.cc", "src/compiler/node-matchers.h", "src/compiler/node-properties.cc", "src/compiler/node-properties.h", @@ -631,6 +663,8 @@ source_set("v8_base") { "src/compiler/simplified-operator.h", "src/compiler/source-position.cc", "src/compiler/source-position.h", + "src/compiler/state-values-utils.cc", + "src/compiler/state-values-utils.h", "src/compiler/typer.cc", "src/compiler/typer.h", "src/compiler/value-numbering-reducer.cc", @@ -848,7 +882,6 @@ source_set("v8_base") { "src/modules.cc", "src/modules.h", "src/msan.h", - "src/natives.h", "src/objects-debug.cc", "src/objects-inl.h", "src/objects-printer.cc", @@ -860,6 +893,8 @@ source_set("v8_base") { "src/ostreams.h", "src/parser.cc", "src/parser.h", + "src/pending-compilation-error-handler.cc", + "src/pending-compilation-error-handler.h", "src/perf-jit.cc", "src/perf-jit.h", "src/preparse-data-format.h", @@ -929,20 +964,23 @@ source_set("v8_base") { "src/scopeinfo.h", "src/scopes.cc", "src/scopes.h", - "src/serialize.cc", - "src/serialize.h", "src/small-pointer-list.h", "src/smart-pointers.h", - "src/snapshot-common.cc", - "src/snapshot-source-sink.cc", - "src/snapshot-source-sink.h", - "src/snapshot.h", + "src/snapshot/natives.h", + "src/snapshot/serialize.cc", + "src/snapshot/serialize.h", + "src/snapshot/snapshot-common.cc", + "src/snapshot/snapshot-source-sink.cc", + "src/snapshot/snapshot-source-sink.h", + "src/snapshot/snapshot.h", "src/string-builder.cc", "src/string-builder.h", "src/string-search.cc", "src/string-search.h", "src/string-stream.cc", "src/string-stream.h", + "src/strings-storage.cc", + "src/strings-storage.h", "src/strtod.cc", "src/strtod.h", "src/token.cc", @@ -1356,11 +1394,11 @@ source_set("v8_libbase") { if (is_linux) { sources += [ "src/base/platform/platform-linux.cc" ] - libs = [ "rt" ] + libs = [ "dl", "rt" ] } else if (is_android) { defines += [ "CAN_USE_VFP_INSTRUCTIONS" ] - if (build_os == "mac") { + if (host_os == "mac") { if (current_toolchain == host_toolchain) { sources += [ "src/base/platform/platform-macos.cc" ] } else { @@ -1425,12 +1463,12 @@ source_set("v8_libplatform") { # Executables # -if (current_toolchain == host_toolchain) { +if (current_toolchain == snapshot_toolchain) { executable("mksnapshot") { visibility = [ ":*" ] # Only targets in this file can depend on this. sources = [ - "src/mksnapshot.cc", + "src/snapshot/mksnapshot.cc", ] configs -= [ "//build/config/compiler:chromium_code" ] diff --git a/deps/v8/ChangeLog b/deps/v8/ChangeLog index 0f835dc8c43f90..69ecd92ba61c8e 100644 --- a/deps/v8/ChangeLog +++ b/deps/v8/ChangeLog @@ -1,3 +1,449 @@ +2015-03-30: Version 4.3.61 + + Performance and stability improvements on all platforms. + + +2015-03-28: Version 4.3.60 + + Reland^2 "Filter invalid slots out from the SlotsBuffer after marking." + (Chromium issues 454297, 470801). + + This fixes missing incremental write barrier issue when double fields + unboxing is enabled (Chromium issue 469146). + + Performance and stability improvements on all platforms. + + +2015-03-27: Version 4.3.59 + + Use a slot that is located on a heap page when removing invalid entries + from the SlotsBuffer (Chromium issue 470801). + + Performance and stability improvements on all platforms. + + +2015-03-26: Version 4.3.58 + + Return timestamp of the last recorded interval to the caller of + HeapProfiler::GetHeapStats (Chromium issue 467222). + + Performance and stability improvements on all platforms. + + +2015-03-26: Version 4.3.57 + + Reland [V8] Removed SourceLocationRestrict (Chromium issue 468781). + + Performance and stability improvements on all platforms. + + +2015-03-25: Version 4.3.56 + + Remove v8::Isolate::ClearInterrupt. + + Performance and stability improvements on all platforms. + + +2015-03-25: Version 4.3.55 + + Performance and stability improvements on all platforms. + + +2015-03-24: Version 4.3.54 + + Do not assign positions to parser-generated desugarings (Chromium issue + 468661). + + Performance and stability improvements on all platforms. + + +2015-03-24: Version 4.3.53 + + Filter invalid slots out from the SlotsBuffer after marking (Chromium + issue 454297). + + Fix OOM bug 3976 (issue 3976). + + Performance and stability improvements on all platforms. + + +2015-03-24: Version 4.3.52 + + Remove calls to IdleNotification(). + + Save heap object tracking data in heap snapshot (Chromium issue 467222). + + Performance and stability improvements on all platforms. + + +2015-03-24: Version 4.3.51 + + [V8] Removed SourceLocationRestrict (Chromium issue 468781). + + [turbofan] Fix control reducer bug with walking non-control edges during + ConnectNTL phase (Chromium issue 469605). + + Performance and stability improvements on all platforms. + + +2015-03-23: Version 4.3.50 + + Performance and stability improvements on all platforms. + + +2015-03-23: Version 4.3.49 + + Ensure we don't overflow in BCE (Chromium issue 469148). + + [turbofan] Fix lowering of Math.max for integral inputs (Chromium issue + 468162). + + Use libdl to get symbols for backtraces. + + Performance and stability improvements on all platforms. + + +2015-03-19: Version 4.3.48 + + Clarify what APIs return Maybe and MaybeLocal values (issue 3929). + + Introduce explicit constant for per Context debug data set by embedder + (Chromium issue 466631). + + Adjust key behaviour for weak collections (issues 3970, 3971, Chromium + issue 460083). + + Turn on overapproximation of the weak closure (issue 3862). + + Performance and stability improvements on all platforms. + + +2015-03-18: Version 4.3.47 + + Performance and stability improvements on all platforms. + + +2015-03-17: Version 4.3.46 + + Performance and stability improvements on all platforms. + + +2015-03-17: Version 4.3.45 + + Performance and stability improvements on all platforms. + + +2015-03-17: Version 4.3.44 + + Performance and stability improvements on all platforms. + + +2015-03-16: Version 4.3.43 + + Bugfix in hydrogen GVN (Chromium issue 467481). + + Remove obsolete TakeHeapSnapshot method from API (Chromium issue + 465651). + + Beautify syntax error for unterminated argument list (Chromium issue + 339474). + + Performance and stability improvements on all platforms. + + +2015-03-16: Version 4.3.42 + + Performance and stability improvements on all platforms. + + +2015-03-15: Version 4.3.41 + + Performance and stability improvements on all platforms. + + +2015-03-14: Version 4.3.40 + + Performance and stability improvements on all platforms. + + +2015-03-14: Version 4.3.39 + + Performance and stability improvements on all platforms. + + +2015-03-14: Version 4.3.38 + + Remove --harmony-scoping flag. + + Performance and stability improvements on all platforms. + + +2015-03-13: Version 4.3.37 + + Implement TDZ in StoreIC for top-level lexicals (issue 3941). + + Turn on job-based optimizing compiler (issue 3608). + + Performance and stability improvements on all platforms. + + +2015-03-13: Version 4.3.36 + + Performance and stability improvements on all platforms. + + +2015-03-12: Version 4.3.35 + + Add Cast() for Int32 and Uint32 (Chromium issue 462402). + + Incorrect handling of HTransitionElementsKind in hydrogen check + elimination phase fixed (Chromium issue 460917). + + Performance and stability improvements on all platforms. + + +2015-03-12: Version 4.3.34 + + Performance and stability improvements on all platforms. + + +2015-03-12: Version 4.3.33 + + Fix the toolchain used to build the snapshots in GN (Chromium issues + 395249, 465456). + + Performance and stability improvements on all platforms. + + +2015-03-11: Version 4.3.32 + + Reland of Remove slots that point to unboxed doubles from the + StoreBuffer/SlotsBuffer (Chromium issues 454297, 465273). + + Performance and stability improvements on all platforms. + + +2015-03-11: Version 4.3.31 + + Performance and stability improvements on all platforms. + + +2015-03-11: Version 4.3.30 + + Remove uid and title from HeapSnapshot (Chromium issue 465651). + + Remove deprecated CpuProfiler methods. + + [turbofan] Fix --turbo-osr for OSRing into inner loop inside for-in + (Chromium issue 462775). + + Performance and stability improvements on all platforms. + + +2015-03-10: Version 4.3.29 + + Performance and stability improvements on all platforms. + + +2015-03-10: Version 4.3.28 + + Performance and stability improvements on all platforms. + + +2015-03-10: Version 4.3.27 + + Performance and stability improvements on all platforms. + + +2015-03-07: Version 4.3.26 + + Remove slots that point to unboxed doubles from the + StoreBuffer/SlotsBuffer (Chromium issue 454297). + + Performance and stability improvements on all platforms. + + +2015-03-06: Version 4.3.25 + + Performance and stability improvements on all platforms. + + +2015-03-06: Version 4.3.24 + + convert more things to maybe (issue 3929). + + Performance and stability improvements on all platforms. + + +2015-03-05: Version 4.3.23 + + [V8] Use Function.name for stack frames in v8::StackTrace (Chromium + issue 17356). + + Allow passing sourceMapUrl when compiling scripts (Chromium issue + 462572). + + convert compile functions to use maybe (issue 3929). + + Performance and stability improvements on all platforms. + + +2015-03-05: Version 4.3.22 + + give UniquePersistent full move semantics (issue 3669). + + Performance and stability improvements on all platforms. + + +2015-03-05: Version 4.3.21 + + Performance and stability improvements on all platforms. + + +2015-03-04: Version 4.3.20 + + convert remaining object functions to maybes (issue 3929). + + Performance and stability improvements on all platforms. + + +2015-03-04: Version 4.3.19 + + ARM assembler: fix undefined behaviour in fits_shifter (Chromium issues + 444089, 463436). + + Implement subclassing Arrays (issue 3930). + + [es6] Fix for-const loops (issue 3983). + + Performance and stability improvements on all platforms. + + +2015-03-04: Version 4.3.18 + + Implement subclassing Arrays (issue 3930). + + Performance and stability improvements on all platforms. + + +2015-03-04: Version 4.3.17 + + Implement subclassing Arrays (issue 3930). + + convert more object functions to return maybes (issue 3929). + + Performance and stability improvements on all platforms. + + +2015-03-03: Version 4.3.16 + + check for null context on execution entry (issue 3929). + + convert object::* to return maybe values (issue 3929). + + Removed funky Maybe constructor and made fields private (issue 3929). + + Polish Maybe API a bit, removing useless creativity and fixing some + signatures (issue 3929). + + Performance and stability improvements on all platforms. + + +2015-03-02: Version 4.3.15 + + Performance and stability improvements on all platforms. + + +2015-03-02: Version 4.3.14 + + Performance and stability improvements on all platforms. + + +2015-02-28: Version 4.3.13 + + Disallow subclassing Arrays (issue 3930). + + Performance and stability improvements on all platforms. + + +2015-02-28: Version 4.3.12 + + Performance and stability improvements on all platforms. + + +2015-02-27: Version 4.3.11 + + Disallow subclassing Arrays (issue 3930). + + convert Value::*Value() function to return Maybe results (issue 3929). + + Performance and stability improvements on all platforms. + + +2015-02-27: Version 4.3.10 + + Convert v8::Value::To* to use MaybeLocal (issue 3929). + + Performance and stability improvements on all platforms. + + +2015-02-26: Version 4.3.9 + + Add public version macros (issue 3075). + + Performance and stability improvements on all platforms. + + +2015-02-26: Version 4.3.8 + + Performance and stability improvements on all platforms. + + +2015-02-25: Version 4.3.7 + + Performance and stability improvements on all platforms. + + +2015-02-25: Version 4.3.6 + + Performance and stability improvements on all platforms. + + +2015-02-25: Version 4.3.5 + + Turn on job based recompilation (issue 3608). + + Performance and stability improvements on all platforms. + + +2015-02-24: Version 4.3.4 + + Reland "Correctly propagate terminate exception in TryCall." (issue + 3892). + + Performance and stability improvements on all platforms. + + +2015-02-24: Version 4.3.3 + + Performance and stability improvements on all platforms. + + +2015-02-24: Version 4.3.2 + + Update GN build files with the cpu_arch -> current_cpu change. + + Performance and stability improvements on all platforms. + + +2015-02-23: Version 4.3.1 + + Limit size of first page based on serialized data (Chromium issue + 453111). + + Performance and stability improvements on all platforms. + + 2015-02-19: Version 4.2.77 Make generator constructors configurable (issue 3902). diff --git a/deps/v8/DEPS b/deps/v8/DEPS index b829d05dabb9ad..42606acfcfbbf0 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -8,17 +8,17 @@ vars = { deps = { "v8/build/gyp": - Var("git_url") + "/external/gyp.git" + "@" + "34640080d08ab2a37665512e52142947def3056d", + Var("git_url") + "/external/gyp.git" + "@" + "d174d75bf69c682cb62af9187879e01513b35e52", "v8/third_party/icu": - Var("git_url") + "/chromium/deps/icu.git" + "@" + "4e3266f32c62d30a3f9e2232a753c60129d1e670", + Var("git_url") + "/chromium/deps/icu.git" + "@" + "7c81740601355556e630da515b74d889ba2f8d08", "v8/buildtools": - Var("git_url") + "/chromium/buildtools.git" + "@" + "5c5e924788fe40f7d6e0a3841ac572de2475e689", + Var("git_url") + "/chromium/buildtools.git" + "@" + "3b302fef93f7cc58d9b8168466905237484b2772", "v8/testing/gtest": Var("git_url") + "/external/googletest.git" + "@" + "be1868139ffe0ccd0e8e3b37292b84c821d9c8ad", "v8/testing/gmock": Var("git_url") + "/external/googlemock.git" + "@" + "29763965ab52f24565299976b936d1265cb6a271", # from svn revision 501 "v8/tools/clang": - Var("git_url") + "/chromium/src/tools/clang.git" + "@" + "f6daa55d03995e82201a3278203e7c0421a59546", + Var("git_url") + "/chromium/src/tools/clang.git" + "@" + "ea2f0a2d96ffc6f5a51c034db704ccc1a6543156", } deps_os = { @@ -46,6 +46,17 @@ skip_child_includes = [ ] hooks = [ + { + # This clobbers when necessary (based on get_landmines.py). It must be the + # first hook so that other things that get/generate into the output + # directory will not subsequently be clobbered. + 'name': 'landmines', + 'pattern': '.', + 'action': [ + 'python', + 'v8/build/landmines.py', + ], + }, # Pull clang-format binaries using checked-in hashes. { "name": "clang_format_win", diff --git a/deps/v8/Makefile b/deps/v8/Makefile index 5468d913341e31..055a57d286c9ce 100644 --- a/deps/v8/Makefile +++ b/deps/v8/Makefile @@ -234,7 +234,8 @@ ARCHES = ia32 x64 x32 arm arm64 mips mipsel mips64el x87 ppc ppc64 DEFAULT_ARCHES = ia32 x64 arm MODES = release debug optdebug DEFAULT_MODES = release debug -ANDROID_ARCHES = android_ia32 android_arm android_arm64 android_mipsel android_x87 +ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \ + android_mipsel android_x87 NACL_ARCHES = nacl_ia32 nacl_x64 # List of files that trigger Makefile regeneration: diff --git a/deps/v8/Makefile.android b/deps/v8/Makefile.android index 2a3640382b4f5f..f89fd21fda004e 100644 --- a/deps/v8/Makefile.android +++ b/deps/v8/Makefile.android @@ -26,7 +26,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Those definitions should be consistent with the main Makefile -ANDROID_ARCHES = android_ia32 android_arm android_arm64 android_mipsel android_x87 +ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \ + android_mipsel android_x87 MODES = release debug # Generates all combinations of ANDROID ARCHES and MODES, @@ -66,6 +67,11 @@ else ifeq ($(ARCH), android_ia32) TOOLCHAIN_ARCH = x86 TOOLCHAIN_PREFIX = i686-linux-android TOOLCHAIN_VER = 4.8 +else ifeq ($(ARCH), android_x64) + DEFINES = target_arch=x64 v8_target_arch=x64 android_target_arch=x86_64 android_target_platform=21 + TOOLCHAIN_ARCH = x86_64 + TOOLCHAIN_PREFIX = x86_64-linux-android + TOOLCHAIN_VER = 4.9 else ifeq ($(ARCH), android_x87) DEFINES = target_arch=x87 v8_target_arch=x87 android_target_arch=x86 android_target_platform=14 TOOLCHAIN_ARCH = x86 diff --git a/deps/v8/PRESUBMIT.py b/deps/v8/PRESUBMIT.py index fd0601f17bbfd8..5b3d58d3ba50d8 100644 --- a/deps/v8/PRESUBMIT.py +++ b/deps/v8/PRESUBMIT.py @@ -244,6 +244,7 @@ def GetPreferredTryMasters(project, change): return { 'tryserver.v8': { 'v8_linux_rel': set(['defaulttests']), + 'v8_linux_dbg': set(['defaulttests']), 'v8_linux_nodcheck_rel': set(['defaulttests']), 'v8_linux_gcc_compile_rel': set(['defaulttests']), 'v8_linux64_rel': set(['defaulttests']), diff --git a/deps/v8/README.md b/deps/v8/README.md index bc1685affa99dc..5cd4b5811a4b47 100644 --- a/deps/v8/README.md +++ b/deps/v8/README.md @@ -18,13 +18,13 @@ Getting the Code Checkout [depot tools](http://www.chromium.org/developers/how-tos/install-depot-tools), and run -> `fetch v8` + fetch v8 This will checkout V8 into the directory `v8` and fetch all of its dependencies. To stay up to date, run -> `git pull origin` -> `gclient sync` + git pull origin + gclient sync For fetching all branches, add the following into your remote configuration in `.git/config`: diff --git a/deps/v8/build/android.gypi b/deps/v8/build/android.gypi index 5d3b25a74636ca..533250e7f56f96 100644 --- a/deps/v8/build/android.gypi +++ b/deps/v8/build/android.gypi @@ -43,7 +43,13 @@ 'android_stlport': '<(android_toolchain)/sources/cxx-stl/stlport/', }, 'android_include': '<(android_sysroot)/usr/include', - 'android_lib': '<(android_sysroot)/usr/lib', + 'conditions': [ + ['target_arch=="x64"', { + 'android_lib': '<(android_sysroot)/usr/lib64', + }, { + 'android_lib': '<(android_sysroot)/usr/lib', + }], + ], 'android_stlport_include': '<(android_stlport)/stlport', 'android_stlport_libs': '<(android_stlport)/libs', }, { @@ -52,7 +58,13 @@ 'android_stlport': '<(android_ndk_root)/sources/cxx-stl/stlport/', }, 'android_include': '<(android_sysroot)/usr/include', - 'android_lib': '<(android_sysroot)/usr/lib', + 'conditions': [ + ['target_arch=="x64"', { + 'android_lib': '<(android_sysroot)/usr/lib64', + }, { + 'android_lib': '<(android_sysroot)/usr/lib', + }], + ], 'android_stlport_include': '<(android_stlport)/stlport', 'android_stlport_libs': '<(android_stlport)/libs', }], @@ -227,7 +239,7 @@ 'target_conditions': [ ['_type=="executable"', { 'conditions': [ - ['target_arch=="arm64"', { + ['target_arch=="arm64" or target_arch=="x64"', { 'ldflags': [ '-Wl,-dynamic-linker,/system/bin/linker64', ], diff --git a/deps/v8/build/detect_v8_host_arch.py b/deps/v8/build/detect_v8_host_arch.py index 3460a9a404f0ce..89e8286e1fdb45 100644 --- a/deps/v8/build/detect_v8_host_arch.py +++ b/deps/v8/build/detect_v8_host_arch.py @@ -41,6 +41,7 @@ def DoMain(_): """Hook to be called from gyp without starting a separate python interpreter.""" host_arch = platform.machine() + host_system = platform.system(); # Convert machine type to format recognized by gyp. if re.match(r'i.86', host_arch) or host_arch == 'i86pc': @@ -56,6 +57,13 @@ def DoMain(_): elif host_arch.startswith('mips'): host_arch = 'mipsel' + # Under AIX the value returned by platform.machine is not + # the best indicator of the host architecture + # AIX 6.1 which is the lowest level supported only provides + # a 64 bit kernel + if host_system == 'AIX': + host_arch = 'ppc64' + # platform.machine is based on running kernel. It's possible to use 64-bit # kernel with 32-bit userland, e.g. to give linker slightly more memory. # Distinguish between different userland bitness by querying diff --git a/deps/v8/build/features.gypi b/deps/v8/build/features.gypi index 2eadca338438dc..5c60273a61bc6f 100644 --- a/deps/v8/build/features.gypi +++ b/deps/v8/build/features.gypi @@ -102,7 +102,7 @@ 'DebugBaseCommon': { 'abstract': 1, 'variables': { - 'v8_enable_handle_zapping%': 1, + 'v8_enable_handle_zapping%': 0, }, 'conditions': [ ['v8_enable_handle_zapping==1', { @@ -112,7 +112,7 @@ }, # Debug 'Release': { 'variables': { - 'v8_enable_handle_zapping%': 0, + 'v8_enable_handle_zapping%': 1, }, 'conditions': [ ['v8_enable_handle_zapping==1', { diff --git a/deps/v8/build/get_landmines.py b/deps/v8/build/get_landmines.py index 66a86cbb5082ad..f61c04de44361e 100755 --- a/deps/v8/build/get_landmines.py +++ b/deps/v8/build/get_landmines.py @@ -20,6 +20,7 @@ def main(): print 'Activating MSVS 2013.' print 'Revert activation of MSVS 2013.' print 'Activating MSVS 2013 again.' + print 'Clobber after ICU roll.' return 0 diff --git a/deps/v8/build/gyp_environment.py b/deps/v8/build/gyp_environment.py new file mode 100644 index 00000000000000..f1cee6ef8e00f6 --- /dev/null +++ b/deps/v8/build/gyp_environment.py @@ -0,0 +1,52 @@ +# Copyright 2015 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Sets up various automatic gyp environment variables. These are used by +gyp_v8 and landmines.py which run at different stages of runhooks. To +make sure settings are consistent between them, all setup should happen here. +""" + +import os +import sys + +SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) +V8_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir)) + + +def apply_gyp_environment(file_path=None): + """ + Reads in a *.gyp_env file and applies the valid keys to os.environ. + """ + if not file_path or not os.path.exists(file_path): + return + file_contents = open(file_path).read() + try: + file_data = eval(file_contents, {'__builtins__': None}, None) + except SyntaxError, e: + e.filename = os.path.abspath(file_path) + raise + supported_vars = ( 'V8_GYP_FILE', + 'V8_GYP_SYNTAX_CHECK', + 'GYP_DEFINES', + 'GYP_GENERATOR_FLAGS', + 'GYP_GENERATOR_OUTPUT', ) + for var in supported_vars: + val = file_data.get(var) + if val: + if var in os.environ: + print 'INFO: Environment value for "%s" overrides value in %s.' % ( + var, os.path.abspath(file_path) + ) + else: + os.environ[var] = val + + +def set_environment(): + """Sets defaults for GYP_* variables.""" + + if 'SKIP_V8_GYP_ENV' not in os.environ: + # Update the environment based on v8.gyp_env + gyp_env_path = os.path.join(os.path.dirname(V8_ROOT), 'v8.gyp_env') + apply_gyp_environment(gyp_env_path) diff --git a/deps/v8/build/gyp_v8 b/deps/v8/build/gyp_v8 index 14467eccaad29f..1e8a5c806ecca6 100755 --- a/deps/v8/build/gyp_v8 +++ b/deps/v8/build/gyp_v8 @@ -31,6 +31,7 @@ # is invoked by V8 beyond what can be done in the gclient hooks. import glob +import gyp_environment import os import platform import shlex @@ -48,34 +49,6 @@ sys.path.insert( 1, os.path.abspath(os.path.join(v8_root, 'tools', 'generate_shim_headers'))) -def apply_gyp_environment(file_path=None): - """ - Reads in a *.gyp_env file and applies the valid keys to os.environ. - """ - if not file_path or not os.path.exists(file_path): - return - file_contents = open(file_path).read() - try: - file_data = eval(file_contents, {'__builtins__': None}, None) - except SyntaxError, e: - e.filename = os.path.abspath(file_path) - raise - supported_vars = ( 'V8_GYP_FILE', - 'V8_GYP_SYNTAX_CHECK', - 'GYP_DEFINES', - 'GYP_GENERATOR_FLAGS', - 'GYP_GENERATOR_OUTPUT', ) - for var in supported_vars: - val = file_data.get(var) - if val: - if var in os.environ: - print 'INFO: Environment value for "%s" overrides value in %s.' % ( - var, os.path.abspath(file_path) - ) - else: - os.environ[var] = val - - def additional_include_files(args=[]): """ Returns a list of additional (.gypi) files to include, without @@ -109,13 +82,6 @@ def additional_include_files(args=[]): def run_gyp(args): rc = gyp.main(args) - # Check for landmines (reasons to clobber the build). This must be run here, - # rather than a separate runhooks step so that any environment modifications - # from above are picked up. - print 'Running build/landmines.py...' - subprocess.check_call( - [sys.executable, os.path.join(script_dir, 'landmines.py')]) - if rc != 0: print 'Error running GYP' sys.exit(rc) @@ -124,10 +90,7 @@ def run_gyp(args): if __name__ == '__main__': args = sys.argv[1:] - if 'SKIP_V8_GYP_ENV' not in os.environ: - # Update the environment based on v8.gyp_env - gyp_env_path = os.path.join(os.path.dirname(v8_root), 'v8.gyp_env') - apply_gyp_environment(gyp_env_path) + gyp_environment.set_environment() # This could give false positives since it doesn't actually do real option # parsing. Oh well. diff --git a/deps/v8/build/landmine_utils.py b/deps/v8/build/landmine_utils.py index e8b7c98d5fc6a3..cb3499132a3c2f 100644 --- a/deps/v8/build/landmine_utils.py +++ b/deps/v8/build/landmine_utils.py @@ -47,10 +47,19 @@ def gyp_defines(): return dict(arg.split('=', 1) for arg in shlex.split(os.environ.get('GYP_DEFINES', ''))) + +@memoize() +def gyp_generator_flags(): + """Parses and returns GYP_GENERATOR_FLAGS env var as a dictionary.""" + return dict(arg.split('=', 1) + for arg in shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))) + + @memoize() def gyp_msvs_version(): return os.environ.get('GYP_MSVS_VERSION', '') + @memoize() def distributor(): """ diff --git a/deps/v8/build/landmines.py b/deps/v8/build/landmines.py index bd1fb28f719c62..97c63901c1a904 100755 --- a/deps/v8/build/landmines.py +++ b/deps/v8/build/landmines.py @@ -4,10 +4,9 @@ # found in the LICENSE file. """ -This script runs every build as a hook. If it detects that the build should -be clobbered, it will touch the file /.landmine_triggered. The -various build scripts will then check for the presence of this file and clobber -accordingly. The script will also emit the reasons for the clobber to stdout. +This script runs every build as the first hook (See DEPS). If it detects that +the build should be clobbered, it will delete the contents of the build +directory. A landmine is tripped when a builder checks out a different revision, and the diff between the new landmines and the old ones is non-null. At this point, the @@ -15,9 +14,13 @@ """ import difflib +import errno +import gyp_environment import logging import optparse import os +import re +import shutil import sys import subprocess import time @@ -28,46 +31,109 @@ SRC_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -def get_target_build_dir(build_tool, target): +def get_build_dir(build_tool, is_iphone=False): """ Returns output directory absolute path dependent on build and targets. Examples: - r'c:\b\build\slave\win\build\src\out\Release' - '/mnt/data/b/build/slave/linux/build/src/out/Debug' - '/b/build/slave/ios_rel_device/build/src/xcodebuild/Release-iphoneos' + r'c:\b\build\slave\win\build\src\out' + '/mnt/data/b/build/slave/linux/build/src/out' + '/b/build/slave/ios_rel_device/build/src/xcodebuild' Keep this function in sync with tools/build/scripts/slave/compile.py """ ret = None if build_tool == 'xcode': - ret = os.path.join(SRC_DIR, 'xcodebuild', target) + ret = os.path.join(SRC_DIR, 'xcodebuild') elif build_tool in ['make', 'ninja', 'ninja-ios']: # TODO: Remove ninja-ios. - ret = os.path.join(SRC_DIR, 'out', target) + if 'CHROMIUM_OUT_DIR' in os.environ: + output_dir = os.environ.get('CHROMIUM_OUT_DIR').strip() + if not output_dir: + raise Error('CHROMIUM_OUT_DIR environment variable is set but blank!') + else: + output_dir = landmine_utils.gyp_generator_flags().get('output_dir', 'out') + ret = os.path.join(SRC_DIR, output_dir) elif build_tool in ['msvs', 'vs', 'ib']: - ret = os.path.join(SRC_DIR, 'build', target) + ret = os.path.join(SRC_DIR, 'build') else: raise NotImplementedError('Unexpected GYP_GENERATORS (%s)' % build_tool) return os.path.abspath(ret) -def set_up_landmines(target, new_landmines): - """Does the work of setting, planting, and triggering landmines.""" - out_dir = get_target_build_dir(landmine_utils.builder(), target) - - landmines_path = os.path.join(out_dir, '.landmines') - if not os.path.exists(out_dir): +def extract_gn_build_commands(build_ninja_file): + """Extracts from a build.ninja the commands to run GN. + + The commands to run GN are the gn rule and build.ninja build step at the + top of the build.ninja file. We want to keep these when deleting GN builds + since we want to preserve the command-line flags to GN. + + On error, returns the empty string.""" + result = "" + with open(build_ninja_file, 'r') as f: + # Read until the second blank line. The first thing GN writes to the file + # is the "rule gn" and the second is the section for "build build.ninja", + # separated by blank lines. + num_blank_lines = 0 + while num_blank_lines < 2: + line = f.readline() + if len(line) == 0: + return '' # Unexpected EOF. + result += line + if line[0] == '\n': + num_blank_lines = num_blank_lines + 1 + return result + +def delete_build_dir(build_dir): + # GN writes a build.ninja.d file. Note that not all GN builds have args.gn. + build_ninja_d_file = os.path.join(build_dir, 'build.ninja.d') + if not os.path.exists(build_ninja_d_file): + shutil.rmtree(build_dir) return - if not os.path.exists(landmines_path): - print "Landmines tracker didn't exists." - - # FIXME(machenbach): Clobber deletes the .landmines tracker. Difficult - # to know if we are right after a clobber or if it is first-time landmines - # deployment. Also, a landmine-triggered clobber right after a clobber is - # not possible. Different clobber methods for msvs, xcode and make all - # have different blacklists of files that are not deleted. + # GN builds aren't automatically regenerated when you sync. To avoid + # messing with the GN workflow, erase everything but the args file, and + # write a dummy build.ninja file that will automatically rerun GN the next + # time Ninja is run. + build_ninja_file = os.path.join(build_dir, 'build.ninja') + build_commands = extract_gn_build_commands(build_ninja_file) + + try: + gn_args_file = os.path.join(build_dir, 'args.gn') + with open(gn_args_file, 'r') as f: + args_contents = f.read() + except IOError: + args_contents = '' + + shutil.rmtree(build_dir) + + # Put back the args file (if any). + os.mkdir(build_dir) + if args_contents != '': + with open(gn_args_file, 'w') as f: + f.write(args_contents) + + # Write the build.ninja file sufficiently to regenerate itself. + with open(os.path.join(build_dir, 'build.ninja'), 'w') as f: + if build_commands != '': + f.write(build_commands) + else: + # Couldn't parse the build.ninja file, write a default thing. + f.write('''rule gn +command = gn -q gen //out/%s/ +description = Regenerating ninja files + +build build.ninja: gn +generator = 1 +depfile = build.ninja.d +''' % (os.path.split(build_dir)[1])) + + # Write a .d file for the build which references a nonexistant file. This + # will make Ninja always mark the build as dirty. + with open(build_ninja_d_file, 'w') as f: + f.write('build.ninja: nonexistant_file.gn\n') + + +def needs_clobber(landmines_path, new_landmines): if os.path.exists(landmines_path): - triggered = os.path.join(out_dir, '.landmines_triggered') with open(landmines_path, 'r') as f: old_landmines = f.readlines() if old_landmines != new_landmines: @@ -75,14 +141,54 @@ def set_up_landmines(target, new_landmines): diff = difflib.unified_diff(old_landmines, new_landmines, fromfile='old_landmines', tofile='new_landmines', fromfiledate=old_date, tofiledate=time.ctime(), n=0) + sys.stdout.write('Clobbering due to:\n') + sys.stdout.writelines(diff) + return True + else: + sys.stdout.write('Clobbering due to missing landmines file.\n') + return True + return False - with open(triggered, 'w') as f: - f.writelines(diff) - print "Setting landmine: %s" % triggered - elif os.path.exists(triggered): - # Remove false triggered landmines. - os.remove(triggered) - print "Removing landmine: %s" % triggered + +def clobber_if_necessary(new_landmines): + """Does the work of setting, planting, and triggering landmines.""" + out_dir = get_build_dir(landmine_utils.builder()) + landmines_path = os.path.normpath(os.path.join(out_dir, '..', '.landmines')) + try: + os.makedirs(out_dir) + except OSError as e: + if e.errno == errno.EEXIST: + pass + + if needs_clobber(landmines_path, new_landmines): + # Clobber contents of build directory but not directory itself: some + # checkouts have the build directory mounted. + for f in os.listdir(out_dir): + path = os.path.join(out_dir, f) + if os.path.basename(out_dir) == 'build': + # Only delete build directories and files for MSVS builds as the folder + # shares some checked out files and directories. + if (os.path.isdir(path) and + re.search(r'(?:[Rr]elease)|(?:[Dd]ebug)', f)): + delete_build_dir(path) + elif (os.path.isfile(path) and + (path.endswith('.sln') or + path.endswith('.vcxproj') or + path.endswith('.vcxproj.user'))): + os.unlink(path) + else: + if os.path.isfile(path): + os.unlink(path) + elif os.path.isdir(path): + delete_build_dir(path) + if os.path.basename(out_dir) == 'xcodebuild': + # Xcodebuild puts an additional project file structure into build, + # while the output folder is xcodebuild. + project_dir = os.path.join(SRC_DIR, 'build', 'all.xcodeproj') + if os.path.exists(project_dir) and os.path.isdir(project_dir): + delete_build_dir(project_dir) + + # Save current set of landmines for next time. with open(landmines_path, 'w') as f: f.writelines(new_landmines) @@ -123,14 +229,14 @@ def main(): if landmine_utils.builder() in ('dump_dependency_json', 'eclipse'): return 0 + gyp_environment.set_environment() + landmines = [] for s in landmine_scripts: proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) output, _ = proc.communicate() landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) - - for target in ('Debug', 'Release'): - set_up_landmines(target, landmines) + clobber_if_necessary(landmines) return 0 diff --git a/deps/v8/build/standalone.gypi b/deps/v8/build/standalone.gypi index 56cebbe1f3fd27..d95cb7a0a25304 100644 --- a/deps/v8/build/standalone.gypi +++ b/deps/v8/build/standalone.gypi @@ -146,11 +146,17 @@ }, { 'v8_enable_gdbjit%': 0, }], - ['(OS=="linux" or OS=="mac") and (target_arch=="ia32" or target_arch=="x64")', { + ['(OS=="linux" or OS=="mac") and (target_arch=="ia32" or target_arch=="x64") and \ + (v8_target_arch!="x87")', { 'clang%': 1, }, { 'clang%': 0, }], + ['host_arch!="ppc" and host_arch!="ppc64" and host_arch!="ppc64le"', { + 'host_clang%': '1', + }, { + 'host_clang%': '0', + }], ], # Default ARM variable settings. 'arm_version%': 'default', @@ -175,16 +181,11 @@ 'default_configuration': 'Debug', 'configurations': { 'DebugBaseCommon': { - 'cflags': [ '-g', '-O0' ], 'conditions': [ - ['(v8_target_arch=="ia32" or v8_target_arch=="x87") and \ - OS=="linux"', { - 'defines': [ - '_GLIBCXX_DEBUG' - ], - }], - [ 'OS=="aix"', { - 'cflags': [ '-gxcoff' ], + ['OS=="aix"', { + 'cflags': [ '-g', '-Og', '-gxcoff' ], + }, { + 'cflags': [ '-g', '-O0' ], }], ], }, @@ -198,6 +199,19 @@ # Xcode insists on this empty entry. }, }, + 'conditions':[ + ['(clang==1 or host_clang==1) and OS!="win"', { + # This is here so that all files get recompiled after a clang roll and + # when turning clang on or off. + # (defines are passed via the command line, and build systems rebuild + # things when their commandline changes). Nothing should ever read this + # define. + 'defines': ['CR_CLANG_REVISION= Call(v8::Handle fun, - Handle data = Handle()); + static V8_DEPRECATE_SOON( + "Use maybe version", + Local Call(v8::Handle fun, + Handle data = Handle())); + // TODO(dcarney): data arg should be a MaybeLocal + static MaybeLocal Call(Local context, + v8::Handle fun, + Handle data = Handle()); /** * Returns a mirror object for the given object. */ - static Local GetMirror(v8::Handle obj); + static V8_DEPRECATE_SOON("Use maybe version", + Local GetMirror(v8::Handle obj)); + static MaybeLocal GetMirror(Local context, + v8::Handle obj); /** * Makes V8 process all pending debug messages. diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index d0215205f5fa97..f9439c2e629445 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -168,21 +168,12 @@ class V8_EXPORT CpuProfiler { */ void StartProfiling(Handle title, bool record_samples = false); - /** Deprecated. Use StartProfiling instead. */ - V8_DEPRECATED("Use StartProfiling", - void StartCpuProfiling(Handle title, - bool record_samples = false)); - /** * Stops collecting CPU profile with a given title and returns it. * If the title given is empty, finishes the last profile started. */ CpuProfile* StopProfiling(Handle title); - /** Deprecated. Use StopProfiling instead. */ - V8_DEPRECATED("Use StopProfiling", - const CpuProfile* StopCpuProfiling(Handle title)); - /** * Tells the profiler whether the embedder is idle. */ @@ -271,10 +262,6 @@ class V8_EXPORT HeapGraphNode { */ SnapshotObjectId GetId() const; - /** Returns node's own size, in bytes. */ - V8_DEPRECATED("Use GetShallowSize instead", - int GetSelfSize() const); - /** Returns node's own size, in bytes. */ size_t GetShallowSize() const; @@ -326,12 +313,6 @@ class V8_EXPORT HeapSnapshot { kJSON = 0 // See format description near 'Serialize' method. }; - /** Returns heap snapshot UID (assigned by the profiler.) */ - unsigned GetUid() const; - - /** Returns heap snapshot title. */ - Handle GetTitle() const; - /** Returns the root node of the heap graph. */ const HeapGraphNode* GetRoot() const; @@ -380,7 +361,8 @@ class V8_EXPORT HeapSnapshot { * Nodes reference strings, other nodes, and edges by their indexes * in corresponding arrays. */ - void Serialize(OutputStream* stream, SerializationFormat format) const; + void Serialize(OutputStream* stream, + SerializationFormat format = kJSON) const; }; @@ -465,10 +447,9 @@ class V8_EXPORT HeapProfiler { }; /** - * Takes a heap snapshot and returns it. Title may be an empty string. + * Takes a heap snapshot and returns it. */ const HeapSnapshot* TakeHeapSnapshot( - Handle title, ActivityControl* control = NULL, ObjectNameResolver* global_object_name_resolver = NULL); @@ -490,17 +471,19 @@ class V8_EXPORT HeapProfiler { * reports updates for all previous time intervals via the OutputStream * object. Updates on each time interval are provided as a stream of the * HeapStatsUpdate structure instances. - * The return value of the function is the last seen heap object Id. + * If |timestamp_us| is supplied, timestamp of the new entry will be written + * into it. The return value of the function is the last seen heap object Id. * * StartTrackingHeapObjects must be called before the first call to this * method. */ - SnapshotObjectId GetHeapStats(OutputStream* stream); + SnapshotObjectId GetHeapStats(OutputStream* stream, + int64_t* timestamp_us = NULL); /** * Stops tracking of heap objects population statistics, cleans up all * collected data. StartHeapObjectsTracking must be called again prior to - * calling PushHeapObjectsStats next time. + * calling GetHeapStats next time. */ void StopTrackingHeapObjects(); diff --git a/deps/v8/include/v8-util.h b/deps/v8/include/v8-util.h index ca36b6c58bcf0c..b01d527754b5ce 100644 --- a/deps/v8/include/v8-util.h +++ b/deps/v8/include/v8-util.h @@ -12,7 +12,7 @@ /** * Support for Persistent containers. * - * C++11 embedders can use STL containers with UniquePersistent values, + * C++11 embedders can use STL containers with Global values, * but pre-C++11 does not support the required move semantic and hence * may want these container classes. */ @@ -22,7 +22,10 @@ typedef uintptr_t PersistentContainerValue; static const uintptr_t kPersistentContainerNotFound = 0; enum PersistentContainerCallbackType { kNotWeak, - kWeak + // These correspond to v8::WeakCallbackType + kWeakWithParameter, + kWeakWithInternalFields, + kWeak = kWeakWithParameter // For backwards compatibility. Deprecate. }; @@ -101,12 +104,12 @@ class DefaultPersistentValueMapTraits : public StdMapTraits { return K(); } static void DisposeCallbackData(WeakCallbackDataType* data) { } - static void Dispose(Isolate* isolate, UniquePersistent value, K key) { } + static void Dispose(Isolate* isolate, Global value, K key) {} }; template -class DefaultPhantomPersistentValueMapTraits : public StdMapTraits { +class DefaultGlobalMapTraits : public StdMapTraits { private: template struct RemovePointer; @@ -114,25 +117,26 @@ class DefaultPhantomPersistentValueMapTraits : public StdMapTraits { public: // Weak callback & friends: static const PersistentContainerCallbackType kCallbackType = kNotWeak; - typedef PersistentValueMap< - K, V, DefaultPhantomPersistentValueMapTraits > MapType; - typedef void PhantomCallbackDataType; + typedef PersistentValueMap > MapType; + typedef void WeakCallbackInfoType; - static PhantomCallbackDataType* PhantomCallbackParameter(MapType* map, - const K& key, - Local value) { - return NULL; + static WeakCallbackInfoType* WeakCallbackParameter(MapType* map, const K& key, + Local value) { + return nullptr; } - static MapType* MapFromPhantomCallbackData( - const PhantomCallbackData& data) { - return NULL; + static MapType* MapFromWeakCallbackInfo( + const WeakCallbackInfo& data) { + return nullptr; } - static K KeyFromPhantomCallbackData( - const PhantomCallbackData& data) { + static K KeyFromWeakCallbackInfo( + const WeakCallbackInfo& data) { return K(); } - static void DisposeCallbackData(PhantomCallbackDataType* data) {} - static void Dispose(Isolate* isolate, UniquePersistent value, K key) {} + static void DisposeCallbackData(WeakCallbackInfoType* data) {} + static void Dispose(Isolate* isolate, Global value, K key) {} + static void DisposeWeak(Isolate* isolate, + const WeakCallbackInfo& data, + K key) {} private: template @@ -143,8 +147,8 @@ class DefaultPhantomPersistentValueMapTraits : public StdMapTraits { /** - * A map wrapper that allows using UniquePersistent as a mapped value. - * C++11 embedders don't need this class, as they can use UniquePersistent + * A map wrapper that allows using Global as a mapped value. + * C++11 embedders don't need this class, as they can use Global * directly in std containers. * * The map relies on a backing map, whose type and accessors are described @@ -203,7 +207,7 @@ class PersistentValueMapBase { /** * Return value for key and remove it from the map. */ - UniquePersistent Remove(const K& key) { + Global Remove(const K& key) { return Release(Traits::Remove(&impl_, key)).Pass(); } @@ -255,7 +259,7 @@ class PersistentValueMapBase { private: friend class PersistentValueMapBase; friend class PersistentValueMap; - friend class PhantomPersistentValueMap; + friend class GlobalValueMap; explicit PersistentValueReference(PersistentContainerValue value) : value_(value) { } @@ -293,24 +297,23 @@ class PersistentValueMapBase { return reinterpret_cast(v); } - static PersistentContainerValue ClearAndLeak( - UniquePersistent* persistent) { + static PersistentContainerValue ClearAndLeak(Global* persistent) { V* v = persistent->val_; persistent->val_ = 0; return reinterpret_cast(v); } - static PersistentContainerValue Leak(UniquePersistent* persistent) { + static PersistentContainerValue Leak(Global* persistent) { return reinterpret_cast(persistent->val_); } /** - * Return a container value as UniquePersistent and make sure the weak + * Return a container value as Global and make sure the weak * callback is properly disposed of. All remove functionality should go * through this. */ - static UniquePersistent Release(PersistentContainerValue v) { - UniquePersistent p; + static Global Release(PersistentContainerValue v) { + Global p; p.val_ = FromVal(v); if (Traits::kCallbackType != kNotWeak && p.IsWeak()) { Traits::DisposeCallbackData( @@ -319,6 +322,12 @@ class PersistentValueMapBase { return p.Pass(); } + void RemoveWeak(const K& key) { + Global p; + p.val_ = FromVal(Traits::Remove(&impl_, key)); + p.Reset(); + } + private: PersistentValueMapBase(PersistentValueMapBase&); void operator=(PersistentValueMapBase&); @@ -351,17 +360,17 @@ class PersistentValueMap : public PersistentValueMapBase { /** * Put value into map. Depending on Traits::kIsWeak, the value will be held * by the map strongly or weakly. - * Returns old value as UniquePersistent. + * Returns old value as Global. */ - UniquePersistent Set(const K& key, Local value) { - UniquePersistent persistent(this->isolate(), value); + Global Set(const K& key, Local value) { + Global persistent(this->isolate(), value); return SetUnique(key, &persistent); } /** * Put value into map, like Set(const K&, Local). */ - UniquePersistent Set(const K& key, UniquePersistent value) { + Global Set(const K& key, Global value) { return SetUnique(key, &value); } @@ -369,7 +378,7 @@ class PersistentValueMap : public PersistentValueMapBase { * Put the value into the map, and set the 'weak' callback when demanded * by the Traits class. */ - UniquePersistent SetUnique(const K& key, UniquePersistent* persistent) { + Global SetUnique(const K& key, Global* persistent) { if (Traits::kCallbackType != kNotWeak) { Local value(Local::New(this->isolate(), *persistent)); persistent->template SetWeak( @@ -384,8 +393,8 @@ class PersistentValueMap : public PersistentValueMapBase { * Put a value into the map and update the reference. * Restrictions of GetReference apply here as well. */ - UniquePersistent Set(const K& key, UniquePersistent value, - PersistentValueReference* reference) { + Global Set(const K& key, Global value, + PersistentValueReference* reference) { *reference = this->Leak(&value); return SetUnique(key, &value); } @@ -406,9 +415,9 @@ class PersistentValueMap : public PersistentValueMapBase { template -class PhantomPersistentValueMap : public PersistentValueMapBase { +class GlobalValueMap : public PersistentValueMapBase { public: - explicit PhantomPersistentValueMap(Isolate* isolate) + explicit GlobalValueMap(Isolate* isolate) : PersistentValueMapBase(isolate) {} typedef @@ -418,17 +427,17 @@ class PhantomPersistentValueMap : public PersistentValueMapBase { /** * Put value into map. Depending on Traits::kIsWeak, the value will be held * by the map strongly or weakly. - * Returns old value as UniquePersistent. + * Returns old value as Global. */ - UniquePersistent Set(const K& key, Local value) { - UniquePersistent persistent(this->isolate(), value); + Global Set(const K& key, Local value) { + Global persistent(this->isolate(), value); return SetUnique(key, &persistent); } /** * Put value into map, like Set(const K&, Local). */ - UniquePersistent Set(const K& key, UniquePersistent value) { + Global Set(const K& key, Global value) { return SetUnique(key, &value); } @@ -436,11 +445,16 @@ class PhantomPersistentValueMap : public PersistentValueMapBase { * Put the value into the map, and set the 'weak' callback when demanded * by the Traits class. */ - UniquePersistent SetUnique(const K& key, UniquePersistent* persistent) { + Global SetUnique(const K& key, Global* persistent) { if (Traits::kCallbackType != kNotWeak) { + WeakCallbackType callback_type = + Traits::kCallbackType == kWeakWithInternalFields + ? WeakCallbackType::kInternalFields + : WeakCallbackType::kParameter; Local value(Local::New(this->isolate(), *persistent)); - persistent->template SetPhantom( - Traits::WeakCallbackParameter(this, key, value), WeakCallback, 0, 1); + persistent->template SetWeak( + Traits::WeakCallbackParameter(this, key, value), WeakCallback, + callback_type); } PersistentContainerValue old_value = Traits::Set(this->impl(), key, this->ClearAndLeak(persistent)); @@ -451,33 +465,32 @@ class PhantomPersistentValueMap : public PersistentValueMapBase { * Put a value into the map and update the reference. * Restrictions of GetReference apply here as well. */ - UniquePersistent Set(const K& key, UniquePersistent value, - PersistentValueReference* reference) { + Global Set(const K& key, Global value, + PersistentValueReference* reference) { *reference = this->Leak(&value); return SetUnique(key, &value); } private: static void WeakCallback( - const PhantomCallbackData& data) { + const WeakCallbackInfo& data) { if (Traits::kCallbackType != kNotWeak) { - PhantomPersistentValueMap* persistentValueMap = - Traits::MapFromPhantomCallbackData(data); - K key = Traits::KeyFromPhantomCallbackData(data); - Traits::Dispose(data.GetIsolate(), persistentValueMap->Remove(key).Pass(), - key); - Traits::DisposeCallbackData(data.GetParameter()); + GlobalValueMap* persistentValueMap = + Traits::MapFromWeakCallbackInfo(data); + K key = Traits::KeyFromWeakCallbackInfo(data); + persistentValueMap->RemoveWeak(key); + Traits::DisposeWeak(data.GetIsolate(), data, key); } } }; /** - * A map that uses UniquePersistent as value and std::map as the backing + * A map that uses Global as value and std::map as the backing * implementation. Persistents are held non-weak. * * C++11 embedders don't need this class, as they can use - * UniquePersistent directly in std containers. + * Global directly in std containers. */ template > @@ -514,8 +527,8 @@ class DefaultPersistentValueVectorTraits { /** - * A vector wrapper that safely stores UniquePersistent values. - * C++11 embedders don't need this class, as they can use UniquePersistent + * A vector wrapper that safely stores Global values. + * C++11 embedders don't need this class, as they can use Global * directly in std containers. * * This class relies on a backing vector implementation, whose type and methods @@ -536,14 +549,14 @@ class PersistentValueVector { * Append a value to the vector. */ void Append(Local value) { - UniquePersistent persistent(isolate_, value); + Global persistent(isolate_, value); Traits::Append(&impl_, ClearAndLeak(&persistent)); } /** * Append a persistent's value to the vector. */ - void Append(UniquePersistent persistent) { + void Append(Global persistent) { Traits::Append(&impl_, ClearAndLeak(&persistent)); } @@ -574,7 +587,7 @@ class PersistentValueVector { void Clear() { size_t length = Traits::Size(&impl_); for (size_t i = 0; i < length; i++) { - UniquePersistent p; + Global p; p.val_ = FromVal(Traits::Get(&impl_, i)); } Traits::Clear(&impl_); @@ -589,8 +602,7 @@ class PersistentValueVector { } private: - static PersistentContainerValue ClearAndLeak( - UniquePersistent* persistent) { + static PersistentContainerValue ClearAndLeak(Global* persistent) { V* v = persistent->val_; persistent->val_ = 0; return reinterpret_cast(v); @@ -606,4 +618,4 @@ class PersistentValueVector { } // namespace v8 -#endif // V8_UTIL_H_ +#endif // V8_UTIL_H diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index f10bf50780a9cb..9cdb1259216c19 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -9,9 +9,9 @@ // NOTE these macros are used by some of the tool scripts and the build // system so their names cannot be changed without changing the scripts. #define V8_MAJOR_VERSION 4 -#define V8_MINOR_VERSION 2 -#define V8_BUILD_NUMBER 77 -#define V8_PATCH_LEVEL 20 +#define V8_MINOR_VERSION 3 +#define V8_BUILD_NUMBER 61 +#define V8_PATCH_LEVEL 21 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index e325fd6d752e73..d3543f282fd19e 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -81,6 +81,8 @@ class ImplementationUtilities; class Int32; class Integer; class Isolate; +template +class Maybe; class Name; class Number; class NumberObject; @@ -93,6 +95,7 @@ class Promise; class RawOperationDescriptor; class Script; class Signature; +class StartupData; class StackFrame; class StackTrace; class String; @@ -105,17 +108,20 @@ class Utils; class Value; template class Handle; template class Local; +template +class MaybeLocal; template class Eternal; template class NonCopyablePersistentTraits; template class PersistentBase; template > class Persistent; -template class UniquePersistent; +template +class Global; template class PersistentValueMap; template class PersistentValueMapBase; template -class PhantomPersistentValueMap; +class GlobalValueMap; template class PersistentValueVector; template class WeakCallbackObject; class FunctionTemplate; @@ -141,20 +147,6 @@ template class CustomArguments; class PropertyCallbackArguments; class FunctionCallbackArguments; class GlobalHandles; - -template -class CallbackData { - public: - V8_INLINE v8::Isolate* GetIsolate() const { return isolate_; } - - explicit CallbackData(v8::Isolate* isolate, T* parameter) - : isolate_(isolate), parameter_(parameter) {} - V8_INLINE T* GetParameter() const { return parameter_; } - - private: - v8::Isolate* isolate_; - T* parameter_; -}; } @@ -321,6 +313,8 @@ template class Handle { template friend class PersistentBase; template friend class Handle; template friend class Local; + template + friend class MaybeLocal; template friend class FunctionCallbackInfo; template friend class PropertyCallbackInfo; template friend class internal::CustomArguments; @@ -398,6 +392,8 @@ template class Local : public Handle { template friend class Persistent; template friend class Handle; template friend class Local; + template + friend class MaybeLocal; template friend class FunctionCallbackInfo; template friend class PropertyCallbackInfo; friend class String; @@ -415,6 +411,47 @@ template class Local : public Handle { }; +/** + * A MaybeLocal<> is a wrapper around Local<> that enforces a check whether + * the Local<> is empty before it can be used. + * + * If an API method returns a MaybeLocal<>, the API method can potentially fail + * either because an exception is thrown, or because an exception is pending, + * e.g. because a previous API call threw an exception that hasn't been caught + * yet, or because a TerminateExecution exception was thrown. In that case, an + * empty MaybeLocal is returned. + */ +template +class MaybeLocal { + public: + V8_INLINE MaybeLocal() : val_(nullptr) {} + template + V8_INLINE MaybeLocal(Local that) + : val_(reinterpret_cast(*that)) { + TYPE_CHECK(T, S); + } + + V8_INLINE bool IsEmpty() const { return val_ == nullptr; } + + template + V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local* out) const { + out->val_ = IsEmpty() ? nullptr : this->val_; + return !IsEmpty(); + } + + // Will crash when checks are enabled if the MaybeLocal<> is empty. + V8_INLINE Local ToLocalChecked(); + + template + V8_INLINE Local FromMaybe(Local default_value) const { + return IsEmpty() ? default_value : Local(val_); + } + + private: + T* val_; +}; + + // Eternal handles are set-once handles that live for the life of the isolate. template class Eternal { public: @@ -434,42 +471,79 @@ template class Eternal { }; +static const int kInternalFieldsInWeakCallback = 2; + + template -class PhantomCallbackData : public internal::CallbackData { +class WeakCallbackInfo { public: - typedef void (*Callback)(const PhantomCallbackData& data); + typedef void (*Callback)(const WeakCallbackInfo& data); + + WeakCallbackInfo(Isolate* isolate, T* parameter, + void* internal_fields[kInternalFieldsInWeakCallback], + Callback* callback) + : isolate_(isolate), parameter_(parameter), callback_(callback) { + for (int i = 0; i < kInternalFieldsInWeakCallback; ++i) { + internal_fields_[i] = internal_fields[i]; + } + } + + V8_INLINE Isolate* GetIsolate() const { return isolate_; } + V8_INLINE T* GetParameter() const { return parameter_; } + V8_INLINE void* GetInternalField(int index) const; - V8_INLINE void* GetInternalField1() const { return internal_field1_; } - V8_INLINE void* GetInternalField2() const { return internal_field2_; } + V8_INLINE V8_DEPRECATE_SOON("use indexed version", + void* GetInternalField1()) const { + return internal_fields_[0]; + } + V8_INLINE V8_DEPRECATE_SOON("use indexed version", + void* GetInternalField2()) const { + return internal_fields_[1]; + } - PhantomCallbackData(Isolate* isolate, T* parameter, void* internal_field1, - void* internal_field2) - : internal::CallbackData(isolate, parameter), - internal_field1_(internal_field1), - internal_field2_(internal_field2) {} + bool IsFirstPass() const { return callback_ != nullptr; } + + // When first called, the embedder MUST Reset() the Global which triggered the + // callback. The Global itself is unusable for anything else. No v8 other api + // calls may be called in the first callback. Should additional work be + // required, the embedder must set a second pass callback, which will be + // called after all the initial callbacks are processed. + // Calling SetSecondPassCallback on the second pass will immediately crash. + void SetSecondPassCallback(Callback callback) const { *callback_ = callback; } private: - void* internal_field1_; - void* internal_field2_; + Isolate* isolate_; + T* parameter_; + Callback* callback_; + void* internal_fields_[kInternalFieldsInWeakCallback]; }; template -class WeakCallbackData : public internal::CallbackData

{ +class WeakCallbackData { public: typedef void (*Callback)(const WeakCallbackData& data); + WeakCallbackData(Isolate* isolate, P* parameter, Local handle) + : isolate_(isolate), parameter_(parameter), handle_(handle) {} + + V8_INLINE Isolate* GetIsolate() const { return isolate_; } + V8_INLINE P* GetParameter() const { return parameter_; } V8_INLINE Local GetValue() const { return handle_; } private: - friend class internal::GlobalHandles; - WeakCallbackData(Isolate* isolate, P* parameter, Local handle) - : internal::CallbackData

(isolate, parameter), handle_(handle) {} + Isolate* isolate_; + P* parameter_; Local handle_; }; -static const int kNoInternalFieldIndex = -1; +// TODO(dcarney): delete this with WeakCallbackData +template +using PhantomCallbackData = WeakCallbackInfo; + + +enum class WeakCallbackType { kParameter, kInternalFields }; /** @@ -542,15 +616,17 @@ template class PersistentBase { * As always, GC-based finalization should *not* be relied upon for any * critical form of resource management! */ - template - V8_INLINE void SetWeak( - P* parameter, - typename WeakCallbackData::Callback callback); + template + V8_INLINE V8_DEPRECATE_SOON( + "use WeakCallbackInfo version", + void SetWeak(P* parameter, + typename WeakCallbackData::Callback callback)); - template - V8_INLINE void SetWeak( - P* parameter, - typename WeakCallbackData::Callback callback); + template + V8_INLINE V8_DEPRECATE_SOON( + "use WeakCallbackInfo version", + void SetWeak(P* parameter, + typename WeakCallbackData::Callback callback)); // Phantom persistents work like weak persistents, except that the pointer to // the object being collected is not available in the finalization callback. @@ -559,10 +635,17 @@ template class PersistentBase { // specify a parameter for the callback or the location of two internal // fields in the dying object. template - V8_INLINE void SetPhantom(P* parameter, - typename PhantomCallbackData

::Callback callback, - int internal_field_index1 = kNoInternalFieldIndex, - int internal_field_index2 = kNoInternalFieldIndex); + V8_INLINE V8_DEPRECATE_SOON( + "use SetWeak", + void SetPhantom(P* parameter, + typename WeakCallbackInfo

::Callback callback, + int internal_field_index1 = -1, + int internal_field_index2 = -1)); + + template + V8_INLINE void SetWeak(P* parameter, + typename WeakCallbackInfo

::Callback callback, + WeakCallbackType type); template V8_INLINE P* ClearWeak(); @@ -614,7 +697,8 @@ template class PersistentBase { template friend class Handle; template friend class Local; template friend class Persistent; - template friend class UniquePersistent; + template + friend class Global; template friend class PersistentBase; template friend class ReturnValue; template @@ -623,8 +707,8 @@ template class PersistentBase { friend class Object; explicit V8_INLINE PersistentBase(T* val) : val_(val) {} - PersistentBase(PersistentBase& other); // NOLINT - void operator=(PersistentBase&); + PersistentBase(PersistentBase& other) = delete; // NOLINT + void operator=(PersistentBase&) = delete; V8_INLINE static T* New(Isolate* isolate, T* that); T* val_; @@ -770,72 +854,74 @@ template class Persistent : public PersistentBase { * * Note: Persistent class hierarchy is subject to future changes. */ -template -class UniquePersistent : public PersistentBase { - struct RValue { - V8_INLINE explicit RValue(UniquePersistent* obj) : object(obj) {} - UniquePersistent* object; - }; - +template +class Global : public PersistentBase { public: /** - * A UniquePersistent with no storage cell. + * A Global with no storage cell. */ - V8_INLINE UniquePersistent() : PersistentBase(0) { } + V8_INLINE Global() : PersistentBase(nullptr) {} /** - * Construct a UniquePersistent from a Handle. + * Construct a Global from a Handle. * When the Handle is non-empty, a new storage cell is created * pointing to the same object, and no flags are set. */ template - V8_INLINE UniquePersistent(Isolate* isolate, Handle that) + V8_INLINE Global(Isolate* isolate, Handle that) : PersistentBase(PersistentBase::New(isolate, *that)) { TYPE_CHECK(T, S); } /** - * Construct a UniquePersistent from a PersistentBase. + * Construct a Global from a PersistentBase. * When the Persistent is non-empty, a new storage cell is created * pointing to the same object, and no flags are set. */ template - V8_INLINE UniquePersistent(Isolate* isolate, const PersistentBase& that) - : PersistentBase(PersistentBase::New(isolate, that.val_)) { + V8_INLINE Global(Isolate* isolate, const PersistentBase& that) + : PersistentBase(PersistentBase::New(isolate, that.val_)) { TYPE_CHECK(T, S); } /** * Move constructor. */ - V8_INLINE UniquePersistent(RValue rvalue) - : PersistentBase(rvalue.object->val_) { - rvalue.object->val_ = 0; + V8_INLINE Global(Global&& other) : PersistentBase(other.val_) { + other.val_ = nullptr; } - V8_INLINE ~UniquePersistent() { this->Reset(); } + V8_INLINE ~Global() { this->Reset(); } /** * Move via assignment. */ - template - V8_INLINE UniquePersistent& operator=(UniquePersistent rhs) { + template + V8_INLINE Global& operator=(Global&& rhs) { TYPE_CHECK(T, S); - this->Reset(); - this->val_ = rhs.val_; - rhs.val_ = 0; + if (this != &rhs) { + this->Reset(); + this->val_ = rhs.val_; + rhs.val_ = nullptr; + } return *this; } - /** - * Cast operator for moves. - */ - V8_INLINE operator RValue() { return RValue(this); } /** * Pass allows returning uniques from functions, etc. */ - UniquePersistent Pass() { return UniquePersistent(RValue(this)); } + Global Pass() { return static_cast(*this); } + + /* + * For compatibility with Chromium's base::Bind (base::Passed). + */ + typedef void MoveOnlyTypeForCPP03; private: - UniquePersistent(UniquePersistent&); - void operator=(UniquePersistent&); + Global(Global&) = delete; + void operator=(Global&) = delete; }; +// UniquePersistent is an alias for Global for historical reason. +template +using UniquePersistent = Global; + + /** * A stack-allocated class that governs a number of local handles. * After a handle scope has been created, all local handles will be @@ -951,28 +1037,6 @@ class V8_EXPORT SealHandleScope { }; -/** - * A simple Maybe type, representing an object which may or may not have a - * value. - */ -template -struct Maybe { - Maybe() : has_value(false) {} - explicit Maybe(T t) : has_value(true), value(t) {} - Maybe(bool has, T t) : has_value(has), value(t) {} - - bool has_value; - T value; -}; - - -// Convenience wrapper. -template -inline Maybe maybe(T t) { - return Maybe(t); -} - - // --- Special objects --- @@ -996,13 +1060,15 @@ class ScriptOrigin { Handle resource_column_offset = Handle(), Handle resource_is_shared_cross_origin = Handle(), Handle script_id = Handle(), - Handle resource_is_embedder_debug_script = Handle()) + Handle resource_is_embedder_debug_script = Handle(), + Handle source_map_url = Handle()) : resource_name_(resource_name), resource_line_offset_(resource_line_offset), resource_column_offset_(resource_column_offset), resource_is_embedder_debug_script_(resource_is_embedder_debug_script), resource_is_shared_cross_origin_(resource_is_shared_cross_origin), - script_id_(script_id) {} + script_id_(script_id), + source_map_url_(source_map_url) {} V8_INLINE Handle ResourceName() const; V8_INLINE Handle ResourceLineOffset() const; V8_INLINE Handle ResourceColumnOffset() const; @@ -1012,6 +1078,7 @@ class ScriptOrigin { V8_INLINE Handle ResourceIsEmbedderDebugScript() const; V8_INLINE Handle ResourceIsSharedCrossOrigin() const; V8_INLINE Handle ScriptID() const; + V8_INLINE Handle SourceMapUrl() const; private: Handle resource_name_; @@ -1020,6 +1087,7 @@ class ScriptOrigin { Handle resource_is_embedder_debug_script_; Handle resource_is_shared_cross_origin_; Handle script_id_; + Handle source_map_url_; }; @@ -1064,19 +1132,25 @@ class V8_EXPORT Script { /** * A shorthand for ScriptCompiler::Compile(). */ - static Local