::SetWeak(
P* parameter, typename WeakCallbackInfo::Callback callback,
WeakCallbackType type) {
typedef typename WeakCallbackInfo::Callback Callback;
+#if (__GNUC__ >= 8) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-function-type"
+#endif
V8::MakeWeak(reinterpret_cast(this->val_), parameter,
reinterpret_cast(callback), type);
+#if (__GNUC__ >= 8) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
}
template
diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h
index 9825232d6a10ac..bbd1d6ce978e6c 100644
--- a/deps/v8/include/v8config.h
+++ b/deps/v8/include/v8config.h
@@ -433,6 +433,16 @@
#define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
#endif
+// Helper macro to define no_sanitize attributes only with clang.
+#if defined(__clang__) && defined(__has_attribute)
+#if __has_attribute(no_sanitize)
+#define V8_CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
+#endif
+#endif
+#if !defined(V8_CLANG_NO_SANITIZE)
+#define V8_CLANG_NO_SANITIZE(what)
+#endif
+
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error Inconsistent build configuration: To build the V8 shared library \
set BUILDING_V8_SHARED, to include its headers for linking against the \
diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl
index d4abcf89eb15e9..e68a7e6b3ce5ff 100644
--- a/deps/v8/infra/mb/mb_config.pyl
+++ b/deps/v8/infra/mb/mb_config.pyl
@@ -211,13 +211,12 @@
'v8_linux_dbg_ng': 'debug_x86_trybot',
'v8_linux_noi18n_compile_dbg': 'debug_x86_no_i18n',
'v8_linux_noi18n_rel_ng': 'release_x86_no_i18n_trybot',
- 'v8_linux_gc_stress_dbg': 'debug_x86_trybot',
+ 'v8_linux_gc_stress_dbg_ng': 'debug_x86_trybot',
'v8_linux_gcc_compile_rel': 'release_x86_gcc_minimal_symbols',
- 'v8_linux_gcc_rel': 'release_x86_gcc_minimal_symbols',
+ 'v8_linux_gcc_rel_ng': 'release_x86_gcc_minimal_symbols',
'v8_linux_shared_compile_rel': 'release_x86_shared_verify_heap',
'v8_linux64_arm64_pointer_compression_rel_ng':
'release_simulate_arm64_pointer_compression',
- 'v8_linux64_compile_rel_xg': 'release_x64_test_features_trybot',
'v8_linux64_dbg_ng': 'debug_x64_trybot',
'v8_linux64_gc_stress_custom_snapshot_dbg_ng': 'debug_x64_trybot_custom',
'v8_linux64_gcc_compile_dbg': 'debug_x64_gcc',
@@ -231,39 +230,37 @@
'v8_linux64_verify_csa_rel_ng': 'release_x64_verify_csa',
'v8_linux64_asan_rel_ng': 'release_x64_asan_minimal_symbols',
'v8_linux64_cfi_rel_ng': 'release_x64_cfi',
- 'v8_linux64_msan_rel': 'release_simulate_arm64_msan_minimal_symbols',
- 'v8_linux64_sanitizer_coverage_rel':
- 'release_x64_asan_minimal_symbols_coverage',
- 'v8_linux64_tsan_rel': 'release_x64_tsan_minimal_symbols',
+ 'v8_linux64_msan_rel_ng': 'release_simulate_arm64_msan_minimal_symbols',
+ 'v8_linux64_tsan_rel_ng': 'release_x64_tsan_minimal_symbols',
'v8_linux64_tsan_isolates_rel_ng':
'release_x64_tsan_minimal_symbols',
'v8_linux64_ubsan_rel_ng': 'release_x64_ubsan_minimal_symbols',
'v8_odroid_arm_rel_ng': 'release_arm',
'v8_linux_torque_compare': 'torque_compare',
# TODO(machenbach): Remove after switching to x64 on infra side.
- 'v8_win_dbg': 'debug_x86_trybot',
+ 'v8_win_dbg_ng': 'debug_x86_trybot',
'v8_win_compile_dbg': 'debug_x86_trybot',
'v8_win_rel_ng': 'release_x86_trybot',
'v8_win64_asan_rel_ng': 'release_x64_asan_no_lsan',
'v8_win64_msvc_compile_rel': 'release_x64_msvc',
- 'v8_win64_dbg': 'debug_x64_minimal_symbols',
+ 'v8_win64_dbg_ng': 'debug_x64_minimal_symbols',
'v8_win64_msvc_rel_ng': 'release_x64_msvc',
'v8_win64_rel_ng': 'release_x64_trybot',
- 'v8_mac64_gc_stress_dbg': 'debug_x64_trybot',
+ 'v8_mac64_gc_stress_dbg_ng': 'debug_x64_trybot',
'v8_mac64_rel_ng': 'release_x64_trybot',
'v8_mac64_dbg': 'debug_x64',
'v8_mac64_dbg_ng': 'debug_x64',
'v8_mac64_compile_full_dbg_ng': 'full_debug_x64',
- 'v8_mac64_asan_rel': 'release_x64_asan_no_lsan',
+ 'v8_mac64_asan_rel_ng': 'release_x64_asan_no_lsan',
'v8_linux_arm_rel_ng': 'release_simulate_arm_trybot',
'v8_linux_arm_lite_rel_ng': 'release_simulate_arm_lite_trybot',
- 'v8_linux_arm_dbg': 'debug_simulate_arm',
+ 'v8_linux_arm_dbg_ng': 'debug_simulate_arm',
'v8_linux_arm_armv8a_rel': 'release_simulate_arm_trybot',
'v8_linux_arm_armv8a_dbg': 'debug_simulate_arm',
'v8_linux_arm64_rel_ng': 'release_simulate_arm64_trybot',
'v8_linux_arm64_cfi_rel_ng' : 'release_simulate_arm64_cfi',
- 'v8_linux_arm64_dbg': 'debug_simulate_arm64',
- 'v8_linux_arm64_gc_stress_dbg': 'debug_simulate_arm64',
+ 'v8_linux_arm64_dbg_ng': 'debug_simulate_arm64',
+ 'v8_linux_arm64_gc_stress_dbg_ng': 'debug_simulate_arm64',
'v8_linux_mipsel_compile_rel': 'release_simulate_mipsel',
'v8_linux_mips64el_compile_rel': 'release_simulate_mips64el',
},
@@ -431,8 +428,6 @@
'release_bot', 'x64', 'asan', 'lsan'],
'release_x64_asan_minimal_symbols': [
'release_bot', 'x64', 'asan', 'lsan', 'minimal_symbols'],
- 'release_x64_asan_minimal_symbols_coverage': [
- 'release_bot', 'x64', 'asan', 'bb', 'coverage', 'lsan', 'minimal_symbols'],
'release_x64_asan_no_lsan': [
'release_bot', 'x64', 'asan'],
'release_x64_asan_no_lsan_verify_heap': [
@@ -593,10 +588,6 @@
'gn_args': 'is_asan=true',
},
- 'bb': {
- 'gn_args': 'sanitizer_coverage_flags="bb,trace-pc-guard"',
- },
-
'cfi': {
'mixins': ['v8_enable_test_features'],
'gn_args': ('is_cfi=true use_cfi_cast=true use_cfi_icall=true '
@@ -662,7 +653,7 @@
},
'ios_simulator': {
- 'gn_args': 'target_cpu="x64" target_os="ios"',
+ 'gn_args': 'target_cpu="x64" target_os="ios" ios_use_goma_rbe=true',
},
'lsan': {
diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl
index 72f739487ccec3..773ef614c9197c 100644
--- a/deps/v8/infra/testing/builders.pyl
+++ b/deps/v8/infra/testing/builders.pyl
@@ -83,7 +83,7 @@
{'name': 'v8testing', 'variant': 'extra', 'shards': 2},
],
},
- 'v8_linux_gc_stress_dbg': {
+ 'v8_linux_gc_stress_dbg_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-16.04',
},
@@ -92,7 +92,7 @@
{'name': 'd8testing', 'test_args': ['--gc-stress'], 'shards': 5},
],
},
- 'v8_linux_gcc_rel': {
+ 'v8_linux_gcc_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-16.04',
},
@@ -214,7 +214,7 @@
},
##############################################################################
# Linux32 with arm simulators
- 'v8_linux_arm_dbg': {
+ 'v8_linux_arm_dbg_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-16.04',
},
@@ -321,7 +321,7 @@
{'name': 'mjsunit', 'variant': 'stress_snapshot'},
],
},
- 'v8_linux64_msan_rel': {
+ 'v8_linux64_msan_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-16.04',
},
@@ -391,27 +391,7 @@
{'name': 'v8testing', 'variant': 'stress_instruction_scheduling'},
],
},
- # TODO(machenbach): Experimental builder with incomplete configs. Should be
- # similar to v8_linux64_rel_ng_triggered after testing.
- 'v8_linux64_rel_xg': {
- 'swarming_dimensions' : {
- 'cpu': 'x86-64-avx2',
- 'os': 'Ubuntu-16.04',
- },
- 'tests': [
- {'name': 'v8initializers'},
- {'name': 'v8testing', 'shards': 2},
- ],
- },
- 'v8_linux64_sanitizer_coverage_rel': {
- 'swarming_dimensions' : {
- 'os': 'Ubuntu-16.04',
- },
- 'tests': [
- {'name': 'v8testing', 'shards': 3},
- ],
- },
- 'v8_linux64_tsan_rel': {
+ 'v8_linux64_tsan_rel_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-16.04',
},
@@ -450,7 +430,7 @@
},
##############################################################################
# Linux64 with arm64 simulators
- 'v8_linux_arm64_dbg': {
+ 'v8_linux_arm64_dbg_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-16.04',
},
@@ -463,7 +443,7 @@
{'name': 'v8testing', 'variant': 'trusted', 'shards': 5},
],
},
- 'v8_linux_arm64_gc_stress_dbg': {
+ 'v8_linux_arm64_gc_stress_dbg_ng_triggered': {
'swarming_dimensions' : {
'os': 'Ubuntu-16.04',
},
@@ -521,7 +501,7 @@
},
##############################################################################
# Win32
- 'v8_win_dbg': {
+ 'v8_win_dbg_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64',
'os': 'Windows-7-SP1',
@@ -552,7 +532,7 @@
{'name': 'v8testing', 'shards': 5},
],
},
- 'v8_win64_dbg': {
+ 'v8_win64_dbg_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64',
'os': 'Windows-10-15063',
@@ -589,7 +569,7 @@
},
##############################################################################
# Mac64
- 'v8_mac64_asan_rel': {
+ 'v8_mac64_asan_rel_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64',
'os': 'Mac-10.13',
@@ -610,7 +590,7 @@
{'name': 'v8testing', 'variant': 'extra', 'shards': 2},
],
},
- 'v8_mac64_gc_stress_dbg': {
+ 'v8_mac64_gc_stress_dbg_ng_triggered': {
'swarming_dimensions' : {
'cpu': 'x86-64',
'os': 'Mac-10.13',
diff --git a/deps/v8/samples/cppgc/cppgc-for-v8-embedders.cc b/deps/v8/samples/cppgc/cppgc-for-v8-embedders.cc
new file mode 100644
index 00000000000000..8aaa9cd39ce654
--- /dev/null
+++ b/deps/v8/samples/cppgc/cppgc-for-v8-embedders.cc
@@ -0,0 +1,106 @@
+// Copyright 2020 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.
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+/**
+ * This sample program shows how to set up a stand-alone cppgc heap as an
+ * embedder of V8. Most importantly, this example shows how to reuse V8's
+ * platform for cppgc.
+ */
+
+/**
+ * Platform used by cppgc. Can just redirect to v8::Platform for most calls.
+ * Exception: GetForegroundTaskRunner(), see below.
+ *
+ * This example uses V8's default platform implementation to drive the cppgc
+ * platform.
+ */
+class Platform final : public cppgc::Platform {
+ public:
+ Platform() : v8_platform_(v8::platform::NewDefaultPlatform()) {}
+
+ cppgc::PageAllocator* GetPageAllocator() final {
+ return v8_platform_->GetPageAllocator();
+ }
+
+ double MonotonicallyIncreasingTime() final {
+ return v8_platform_->MonotonicallyIncreasingTime();
+ }
+
+ std::shared_ptr GetForegroundTaskRunner() final {
+ // V8's default platform creates a new task runner when passed the
+ // v8::Isolate pointer the first time. For non-default platforms this will
+ // require getting the appropriate task runner.
+ return v8_platform_->GetForegroundTaskRunner(nullptr);
+ }
+
+ std::unique_ptr PostJob(
+ cppgc::TaskPriority priority,
+ std::unique_ptr job_task) final {
+ return v8_platform_->PostJob(priority, std::move(job_task));
+ }
+
+ private:
+ std::unique_ptr v8_platform_;
+};
+
+/**
+ * Simple string rope to illustrate allocation and garbage collection below. The
+ * rope keeps the next parts alive via regular managed reference.
+ */
+class Rope final : public cppgc::GarbageCollected {
+ public:
+ explicit Rope(std::string part, Rope* next = nullptr)
+ : part_(part), next_(next) {}
+
+ void Trace(cppgc::Visitor* visitor) const { visitor->Trace(next_); }
+
+ private:
+ std::string part_;
+ cppgc::Member next_;
+
+ friend std::ostream& operator<<(std::ostream& os, const Rope& rope);
+};
+
+std::ostream& operator<<(std::ostream& os, const Rope& rope) {
+ os << rope.part_;
+ if (rope.next_) {
+ os << *rope.next_;
+ }
+ return os;
+}
+
+int main(int argc, char* argv[]) {
+ // Create a platform that is used by cppgc::Heap for execution and backend
+ // allocation.
+ auto cppgc_platform = std::make_shared();
+ // Initialize the process. This must happen before any cppgc::Heap::Create()
+ // calls.
+ cppgc::InitializeProcess(cppgc_platform->GetPageAllocator());
+ // Create a managed heap.
+ std::unique_ptr heap = cppgc::Heap::Create(cppgc_platform);
+ // Allocate a string rope on the managed heap.
+ auto* greeting = cppgc::MakeGarbageCollected(
+ heap->GetAllocationHandle(), "Hello ",
+ cppgc::MakeGarbageCollected(heap->GetAllocationHandle(), "World!"));
+ // Manually trigger garbage collection. The object greeting is held alive
+ // through conservative stack scanning.
+ heap->ForceGarbageCollectionSlow("V8 embedders example", "Testing");
+ std::cout << *greeting << std::endl;
+ // Gracefully shutdown the process.
+ cppgc::ShutdownProcess();
+ return 0;
+}
diff --git a/deps/v8/samples/shell.cc b/deps/v8/samples/shell.cc
index aed050ceccd283..70450296c76389 100644
--- a/deps/v8/samples/shell.cc
+++ b/deps/v8/samples/shell.cc
@@ -108,21 +108,15 @@ v8::Local CreateShellContext(v8::Isolate* isolate) {
// Create a template for the global object.
v8::Local global = v8::ObjectTemplate::New(isolate);
// Bind the global 'print' function to the C++ Print callback.
- global->Set(v8::String::NewFromUtf8Literal(isolate, "print"),
- v8::FunctionTemplate::New(isolate, Print));
+ global->Set(isolate, "print", v8::FunctionTemplate::New(isolate, Print));
// Bind the global 'read' function to the C++ Read callback.
- global->Set(v8::String::NewFromUtf8Literal(isolate, "read"),
- v8::FunctionTemplate::New(isolate, Read));
+ global->Set(isolate, "read", v8::FunctionTemplate::New(isolate, Read));
// Bind the global 'load' function to the C++ Load callback.
- global->Set(v8::String::NewFromUtf8Literal(isolate, "load"),
- v8::FunctionTemplate::New(isolate, Load));
+ global->Set(isolate, "load", v8::FunctionTemplate::New(isolate, Load));
// Bind the 'quit' function
- global->Set(v8::String::NewFromUtf8Literal(isolate, "quit"),
- v8::FunctionTemplate::New(isolate, Quit));
+ global->Set(isolate, "quit", v8::FunctionTemplate::New(isolate, Quit));
// Bind the 'version' function
- global->Set(v8::String::NewFromUtf8Literal(isolate, "version"),
- v8::FunctionTemplate::New(isolate, Version));
-
+ global->Set(isolate, "version", v8::FunctionTemplate::New(isolate, Version));
return v8::Context::New(isolate, NULL, global);
}
diff --git a/deps/v8/src/api/api-natives.cc b/deps/v8/src/api/api-natives.cc
index 410c37ce98d754..e21dbd0eeedbb3 100644
--- a/deps/v8/src/api/api-natives.cc
+++ b/deps/v8/src/api/api-natives.cc
@@ -371,7 +371,7 @@ MaybeHandle InstantiateObject(Isolate* isolate,
Handle new_target,
bool is_prototype) {
Handle constructor;
- int serial_number = Smi::ToInt(info->serial_number());
+ int serial_number = info->serial_number();
if (!new_target.is_null()) {
if (IsSimpleInstantiation(isolate, *info, *new_target)) {
constructor = Handle::cast(new_target);
@@ -462,7 +462,7 @@ MaybeHandle