update v8 patches

This commit is contained in:
Jeremy Apthorp 2019-01-08 16:53:35 -08:00
parent 02e41b41b2
commit 95ed3238be
15 changed files with 68 additions and 593 deletions

View file

@ -10,7 +10,4 @@ expose_mksnapshot.patch
build-torque-with-x64-toolchain-on-arm.patch build-torque-with-x64-toolchain-on-arm.patch
do_not_run_arm_arm64_mksnapshot_binaries.patch do_not_run_arm_arm64_mksnapshot_binaries.patch
deps_provide_more_v8_backwards_compatibility.patch deps_provide_more_v8_backwards_compatibility.patch
0001-deps-cherry-pick-0483e9a-from-upstream-V8.patch deps_cherry-pick_88f8fe1_from_upstream_v8.patch
0002-deps-cherry-pick-b87d408-from-upstream-V8.patch
0003-deps-cherry-pick-073073b-from-upstream-V8.patch
0004-deps-cherry-pick-88f8fe1-from-upstream-V8.patch

View file

@ -1,112 +0,0 @@
From 0e090768de1844c493013d5e99bd903928aff2ab Mon Sep 17 00:00:00 2001
From: Joyee Cheung <joyeec9h3@gmail.com>
Date: Tue, 6 Nov 2018 18:05:48 +0800
Subject: [PATCH 1/4] deps: cherry-pick 0483e9a from upstream V8
Original commit message:
[api] Allow embedder to construct an Array from Local<Value>*
Currently to obtain a v8::Array out of a C array or a std::vector,
one needs to loop through the elements and call array->Set() multiple
times, and these calls go into v8::Object::Set() which can be slow.
This patch adds a new Array::New overload that converts a
Local<Value>* with known size into a Local<Array>.
Change-Id: I0a768f0e18eec51e78d58be455482ec6425ca188
Reviewed-on: https://chromium-review.googlesource.com/c/1317049
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Cr-Commit-Position: refs/heads/master@{#57261}
Refs: https://github.com/v8/v8/commit/0483e9a9abe77a73632fd85b9c0cd608efa9aa0d
PR-URL: https://github.com/nodejs/node/pull/24125
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
---
include/v8.h | 6 ++++++
src/api.cc | 17 +++++++++++++++++
test/cctest/test-api.cc | 16 ++++++++++++++++
3 files changed, 39 insertions(+)
diff --git a/include/v8.h b/include/v8.h
index a4bbe1b0c4..9b7be9fb93 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3680,6 +3680,12 @@ class V8_EXPORT Array : public Object {
*/
static Local<Array> New(Isolate* isolate, int length = 0);
+ /**
+ * Creates a JavaScript array out of a Local<Value> array in C++
+ * with a known length.
+ */
+ static Local<Array> New(Isolate* isolate, Local<Value>* elements,
+ size_t length);
V8_INLINE static Array* Cast(Value* obj);
private:
Array();
diff --git a/src/api.cc b/src/api.cc
index 3f62a23d43..4e233d96dc 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6911,6 +6911,23 @@ Local<v8::Array> v8::Array::New(Isolate* isolate, int length) {
return Utils::ToLocal(obj);
}
+Local<v8::Array> v8::Array::New(Isolate* isolate, Local<Value>* elements,
+ size_t length) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ i::Factory* factory = i_isolate->factory();
+ LOG_API(i_isolate, Array, New);
+ ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
+ int len = static_cast<int>(length);
+
+ i::Handle<i::FixedArray> result = factory->NewFixedArray(len);
+ for (int i = 0; i < len; i++) {
+ i::Handle<i::Object> element = Utils::OpenHandle(*elements[i]);
+ result->set(i, *element);
+ }
+
+ return Utils::ToLocal(
+ factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, len));
+}
uint32_t v8::Array::Length() const {
i::Handle<i::JSArray> obj = Utils::OpenHandle(this);
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 9eb73fab7e..0d92508d24 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -5225,6 +5225,22 @@ THREADED_TEST(Array) {
CHECK_EQ(27u, array->Length());
array = v8::Array::New(context->GetIsolate(), -27);
CHECK_EQ(0u, array->Length());
+
+ std::vector<Local<Value>> vector = {v8_num(1), v8_num(2), v8_num(3)};
+ array = v8::Array::New(context->GetIsolate(), vector.data(), vector.size());
+ CHECK_EQ(vector.size(), array->Length());
+ CHECK_EQ(1, arr->Get(context.local(), 0)
+ .ToLocalChecked()
+ ->Int32Value(context.local())
+ .FromJust());
+ CHECK_EQ(2, arr->Get(context.local(), 1)
+ .ToLocalChecked()
+ ->Int32Value(context.local())
+ .FromJust());
+ CHECK_EQ(3, arr->Get(context.local(), 2)
+ .ToLocalChecked()
+ ->Int32Value(context.local())
+ .FromJust());
}
--
2.14.3 (Apple Git-98)

View file

@ -1,136 +0,0 @@
From e36e9dde38caf3517890da2265e6dd9f127abe72 Mon Sep 17 00:00:00 2001
From: Peter Marshall <petermarshall@chromium.org>
Date: Fri, 9 Nov 2018 13:06:07 +0100
Subject: [PATCH 2/4] deps: cherry-pick b87d408 from upstream V8
Original commit message:
[heap-profiler] Fix a use-after-free when snapshots are deleted
If a caller starts the sampling heap profiler and takes a snapshot,
and then deletes the snapshot before the sampling has completed, a
use-after-free will occur on the StringsStorage pointer.
The same issue applies for StartTrackingHeapObjects which shares the
same StringsStorage object.
Bug: v8:8373
Change-Id: I5d69d60d3f9465f9dd3b3bef107c204e0fda0643
Reviewed-on: https://chromium-review.googlesource.com/c/1301477
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Alexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57114}
PR-URL: https://github.com/nodejs/node/pull/24272
Refs:
https://github.com/v8/v8/commit/b87d408f65b9ab49a4d199e850d2358995deaeb2
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
---
src/profiler/heap-profiler.cc | 9 ++++++++-
src/profiler/heap-profiler.h | 2 ++
test/cctest/test-heap-profiler.cc | 42 +++++++++++++++++++++++++++++++++++++++
3 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/src/profiler/heap-profiler.cc b/src/profiler/heap-profiler.cc
index 0978e76cff..58a8f3851f 100644
--- a/src/profiler/heap-profiler.cc
+++ b/src/profiler/heap-profiler.cc
@@ -23,9 +23,14 @@ HeapProfiler::~HeapProfiler() = default;
void HeapProfiler::DeleteAllSnapshots() {
snapshots_.clear();
- names_.reset(new StringsStorage());
+ MaybeClearStringsStorage();
}
+void HeapProfiler::MaybeClearStringsStorage() {
+ if (snapshots_.empty() && !sampling_heap_profiler_ && !allocation_tracker_) {
+ names_.reset(new StringsStorage());
+ }
+}
void HeapProfiler::RemoveSnapshot(HeapSnapshot* snapshot) {
snapshots_.erase(
@@ -126,6 +131,7 @@ bool HeapProfiler::StartSamplingHeapProfiler(
void HeapProfiler::StopSamplingHeapProfiler() {
sampling_heap_profiler_.reset();
+ MaybeClearStringsStorage();
}
@@ -159,6 +165,7 @@ void HeapProfiler::StopHeapObjectsTracking() {
ids_->StopHeapObjectsTracking();
if (allocation_tracker_) {
allocation_tracker_.reset();
+ MaybeClearStringsStorage();
heap()->RemoveHeapObjectAllocationTracker(this);
}
}
diff --git a/src/profiler/heap-profiler.h b/src/profiler/heap-profiler.h
index acbdc6aa7a..1e3527765e 100644
--- a/src/profiler/heap-profiler.h
+++ b/src/profiler/heap-profiler.h
@@ -92,6 +92,8 @@ class HeapProfiler : public HeapObjectAllocationTracker {
v8::PersistentValueVector<v8::Object>* objects);
private:
+ void MaybeClearStringsStorage();
+
Heap* heap() const;
// Mapping from HeapObject addresses to objects' uids.
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index 257ef1c723..f3c545fd83 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -3875,3 +3875,45 @@ TEST(WeakReference) {
const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
CHECK(ValidateSnapshot(snapshot));
}
+
+TEST(Bug8373_1) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+
+ heap_profiler->StartSamplingHeapProfiler(100);
+
+ heap_profiler->TakeHeapSnapshot();
+ // Causes the StringsStorage to be deleted.
+ heap_profiler->DeleteAllHeapSnapshots();
+
+ // Triggers an allocation sample that tries to use the StringsStorage.
+ for (int i = 0; i < 2 * 1024; ++i) {
+ CompileRun(
+ "new Array(64);"
+ "new Uint8Array(16);");
+ }
+
+ heap_profiler->StopSamplingHeapProfiler();
+}
+
+TEST(Bug8373_2) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+
+ heap_profiler->StartTrackingHeapObjects(true);
+
+ heap_profiler->TakeHeapSnapshot();
+ // Causes the StringsStorage to be deleted.
+ heap_profiler->DeleteAllHeapSnapshots();
+
+ // Triggers an allocations that try to use the StringsStorage.
+ for (int i = 0; i < 2 * 1024; ++i) {
+ CompileRun(
+ "new Array(64);"
+ "new Uint8Array(16);");
+ }
+
+ heap_profiler->StopTrackingHeapObjects();
+}
--
2.14.3 (Apple Git-98)

View file

@ -1,180 +0,0 @@
From d08800799f487c2ab02cf567dca2e4ecfb589b63 Mon Sep 17 00:00:00 2001
From: Yang Guo <yangguo@chromium.org>
Date: Tue, 20 Nov 2018 09:16:23 +0100
Subject: [PATCH 3/4] deps: cherry-pick 073073b from upstream V8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Original commit message:
[profiler] introduce API to enable detailed source positions
This allows Node.js to enable detailed source positions for optimized code
early on, without having to pass a flag string.
R=petermarshall@chromium.org
Change-Id: Ie74ea41f600cf6e31acbe802116df4976ccf1c75
Reviewed-on: https://chromium-review.googlesource.com/c/1319757
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57380}
Refs: https://github.com/v8/v8/commit/073073b4f12b683fc0406cd15b3cb284633fe18e
PR-URL: https://github.com/nodejs/node/pull/24515
Refs: https://github.com/nodejs/node/pull/24274
Refs: https://github.com/nodejs/node/pull/24394
Refs: https://github.com/nodejs/node/issues/24393
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Peter Marshall <petermarshall@chromium.org>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
---
include/v8-profiler.h | 6 +++++
src/api.cc | 5 ++++
src/isolate.cc | 3 ++-
src/isolate.h | 3 ++-
test/cctest/test-cpu-profiler.cc | 56 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/include/v8-profiler.h b/include/v8-profiler.h
index c034518def..f30688582d 100644
--- a/include/v8-profiler.h
+++ b/include/v8-profiler.h
@@ -341,6 +341,12 @@ class V8_EXPORT CpuProfiler {
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
void SetIdle(bool is_idle));
+ /**
+ * Generate more detailed source positions to code objects. This results in
+ * better results when mapping profiling samples to script source.
+ */
+ static void UseDetailedSourcePositionsForProfiling(Isolate* isolate);
+
private:
CpuProfiler();
~CpuProfiler();
diff --git a/src/api.cc b/src/api.cc
index 4e233d96dc..161538638b 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -10112,6 +10112,11 @@ void CpuProfiler::SetIdle(bool is_idle) {
isolate->SetIdle(is_idle);
}
+void CpuProfiler::UseDetailedSourcePositionsForProfiling(Isolate* isolate) {
+ reinterpret_cast<i::Isolate*>(isolate)
+ ->set_detailed_source_positions_for_profiling(true);
+}
+
uintptr_t CodeEvent::GetCodeStartAddress() {
return reinterpret_cast<i::CodeEvent*>(this)->code_start_address;
}
diff --git a/src/isolate.cc b/src/isolate.cc
index 94033f446b..e6a9e95a2f 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -3461,7 +3461,8 @@ bool Isolate::use_optimizer() {
}
bool Isolate::NeedsDetailedOptimizedCodeLineInfo() const {
- return NeedsSourcePositionsForProfiling() || FLAG_detailed_line_info;
+ return NeedsSourcePositionsForProfiling() ||
+ detailed_source_positions_for_profiling();
}
bool Isolate::NeedsSourcePositionsForProfiling() const {
diff --git a/src/isolate.h b/src/isolate.h
index ad124586cc..c25f143cf8 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -540,7 +540,8 @@ typedef std::vector<HeapObject*> DebugObjectCache;
V(int, last_console_context_id, 0) \
V(v8_inspector::V8Inspector*, inspector, nullptr) \
V(bool, next_v8_call_is_safe_for_termination, false) \
- V(bool, only_terminate_in_safe_scope, false)
+ V(bool, only_terminate_in_safe_scope, false) \
+ V(bool, detailed_source_positions_for_profiling, FLAG_detailed_line_info)
#define THREAD_LOCAL_TOP_ACCESSOR(type, name) \
inline void set_##name(type v) { thread_local_top_.name##_ = v; } \
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc
index 75af3f6d98..e08bec375e 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -40,6 +40,7 @@
#include "src/objects-inl.h"
#include "src/profiler/cpu-profiler-inl.h"
#include "src/profiler/profiler-listener.h"
+#include "src/source-position-table.h"
#include "src/utils.h"
#include "test/cctest/cctest.h"
#include "test/cctest/profiler-extension.h"
@@ -2544,6 +2545,61 @@ TEST(MultipleProfilers) {
profiler2->StopProfiling("2");
}
+int GetSourcePositionEntryCount(i::Isolate* isolate, const char* source) {
+ i::Handle<i::JSFunction> function = i::Handle<i::JSFunction>::cast(
+ v8::Utils::OpenHandle(*CompileRun(source)));
+ if (function->IsInterpreted()) return -1;
+ i::Handle<i::Code> code(function->code(), isolate);
+ i::SourcePositionTableIterator iterator(
+ ByteArray::cast(code->source_position_table()));
+ int count = 0;
+ while (!iterator.done()) {
+ count++;
+ iterator.Advance();
+ }
+ return count;
+}
+
+UNINITIALIZED_TEST(DetailedSourcePositionAPI) {
+ i::FLAG_detailed_line_info = false;
+ i::FLAG_allow_natives_syntax = true;
+ v8::Isolate::CreateParams create_params;
+ create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+ v8::Isolate* isolate = v8::Isolate::New(create_params);
+
+ const char* source =
+ "function fib(i) {"
+ " if (i <= 1) return 1; "
+ " return fib(i - 1) +"
+ " fib(i - 2);"
+ "}"
+ "fib(5);"
+ "%OptimizeFunctionOnNextCall(fib);"
+ "fib(5);"
+ "fib";
+ {
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(context);
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+
+ CHECK(!i_isolate->NeedsDetailedOptimizedCodeLineInfo());
+
+ int non_detailed_positions = GetSourcePositionEntryCount(i_isolate, source);
+
+ v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate);
+ CHECK(i_isolate->NeedsDetailedOptimizedCodeLineInfo());
+
+ int detailed_positions = GetSourcePositionEntryCount(i_isolate, source);
+
+ CHECK((non_detailed_positions == -1 && detailed_positions == -1) ||
+ non_detailed_positions < detailed_positions);
+ }
+
+ isolate->Dispose();
+}
+
} // namespace test_cpu_profiler
} // namespace internal
} // namespace v8
--
2.14.3 (Apple Git-98)

View file

@ -12,10 +12,10 @@ when we override ReallocateBufferMemory, so we therefore need to implement
Realloc on the v8 side. Realloc on the v8 side.
diff --git a/include/v8.h b/include/v8.h diff --git a/include/v8.h b/include/v8.h
index a4bbe1b0c43d665a6b6c4e6c46205c32eac9548b..b2301cd8d07c1ef57e77cedab920a43f0b498597 100644 index 03677d7af202d665c704dd771603322321b508cc..83b9d3d0d1f981edc444452b500df9fa5b89a056 100644
--- a/include/v8.h --- a/include/v8.h
+++ b/include/v8.h +++ b/include/v8.h
@@ -4486,6 +4486,13 @@ class V8_EXPORT ArrayBuffer : public Object { @@ -4526,6 +4526,13 @@ class V8_EXPORT ArrayBuffer : public Object {
*/ */
virtual void* AllocateUninitialized(size_t length) = 0; virtual void* AllocateUninitialized(size_t length) = 0;
@ -30,10 +30,10 @@ index a4bbe1b0c43d665a6b6c4e6c46205c32eac9548b..b2301cd8d07c1ef57e77cedab920a43f
* Free the memory block of size |length|, pointed to by |data|. * Free the memory block of size |length|, pointed to by |data|.
* That memory is guaranteed to be previously allocated by |Allocate|. * That memory is guaranteed to be previously allocated by |Allocate|.
diff --git a/src/api.cc b/src/api.cc diff --git a/src/api.cc b/src/api.cc
index 3f62a23d43c1c82c273e379e78fd0a4292cf4a20..2863b73e0677b666040766fef638abbc6fc95b8c 100644 index 1d993044db4a969209a90c1b1f9e88d82531a538..9ddef27b9f7004fb50290f0dd91d2994d9771466 100644
--- a/src/api.cc --- a/src/api.cc
+++ b/src/api.cc +++ b/src/api.cc
@@ -488,6 +488,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { @@ -507,6 +507,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
i::V8::SetSnapshotBlob(snapshot_blob); i::V8::SetSnapshotBlob(snapshot_blob);
} }

View file

@ -5,10 +5,10 @@ Subject: array_buffer.patch
diff --git a/include/v8.h b/include/v8.h diff --git a/include/v8.h b/include/v8.h
index b2301cd8d07c1ef57e77cedab920a43f0b498597..6934a9c3838641446fa96a8ab48abed4cfc1841c 100644 index 83b9d3d0d1f981edc444452b500df9fa5b89a056..6ebadc3b85b0f954305bc3a9187b996aa248a347 100644
--- a/include/v8.h --- a/include/v8.h
+++ b/include/v8.h +++ b/include/v8.h
@@ -7653,6 +7653,9 @@ class V8_EXPORT Isolate { @@ -7661,6 +7661,9 @@ class V8_EXPORT Isolate {
*/ */
void SetIdle(bool is_idle); void SetIdle(bool is_idle);
@ -19,10 +19,10 @@ index b2301cd8d07c1ef57e77cedab920a43f0b498597..6934a9c3838641446fa96a8ab48abed4
bool InContext(); bool InContext();
diff --git a/src/api.cc b/src/api.cc diff --git a/src/api.cc b/src/api.cc
index 2863b73e0677b666040766fef638abbc6fc95b8c..8d83474bcd0ed257b8f387d7996085c605326236 100644 index 9ddef27b9f7004fb50290f0dd91d2994d9771466..b4a0f5bb5e484ea80dbfc234e207b44413f2d22f 100644
--- a/src/api.cc --- a/src/api.cc
+++ b/src/api.cc +++ b/src/api.cc
@@ -7984,6 +7984,13 @@ void Isolate::SetIdle(bool is_idle) { @@ -8072,6 +8072,13 @@ void Isolate::SetIdle(bool is_idle) {
isolate->SetIdle(is_idle); isolate->SetIdle(is_idle);
} }
@ -35,4 +35,4 @@ index 2863b73e0677b666040766fef638abbc6fc95b8c..8d83474bcd0ed257b8f387d7996085c6
+ +
bool Isolate::InContext() { bool Isolate::InContext() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
return isolate->context() != nullptr; return !isolate->context().is_null();

View file

@ -6,11 +6,11 @@ Subject: build-torque-with-x64-toolchain-on-arm.patch
torque binary has to be run during the build. torque binary has to be run during the build.
diff --git a/BUILD.gn b/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn
index d40848056235b9a8307533c8b1e238aecf18207d..d8db6363b8560b5c4a1595437e59edf1c6ec3974 100644 index b47a698a2f41f221290861c938c15a38e34d7b00..c564baea42f22d727990752be8b4ed086ef273f2 100644
--- a/BUILD.gn --- a/BUILD.gn
+++ b/BUILD.gn +++ b/BUILD.gn
@@ -170,7 +170,8 @@ declare_args() { @@ -190,7 +190,8 @@ declare_args() {
v8_generator_toolchain = v8_snapshot_toolchain v8_generator_toolchain = v8_snapshot_toolchain
if (host_cpu == "x64" && if (host_cpu == "x64" &&
- (v8_current_cpu == "mips" || v8_current_cpu == "mips64")) { - (v8_current_cpu == "mips" || v8_current_cpu == "mips64")) {
@ -18,20 +18,20 @@ index d40848056235b9a8307533c8b1e238aecf18207d..d8db6363b8560b5c4a1595437e59edf1
+ v8_current_cpu == "arm" || v8_current_cpu == "arm64")) { + v8_current_cpu == "arm" || v8_current_cpu == "arm64")) {
v8_generator_toolchain = "//build/toolchain/linux:clang_x64" v8_generator_toolchain = "//build/toolchain/linux:clang_x64"
} }
@@ -3340,7 +3341,7 @@ if (v8_monolithic) { @@ -3446,7 +3447,7 @@ if (v8_monolithic) {
# Executables # Executables
# #
-if (current_toolchain == v8_generator_toolchain) { -if (current_toolchain == v8_generator_toolchain) {
+if (current_toolchain == current_toolchain) { +if (current_toolchain == current_toolchain) {
v8_executable("bytecode_builtins_list_generator") { v8_executable("bytecode_builtins_list_generator") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
@@ -3384,7 +3385,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { @@ -3492,7 +3493,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
} }
} }
-if (current_toolchain == v8_snapshot_toolchain) { -if (current_toolchain == v8_snapshot_toolchain) {
+if (current_toolchain == current_toolchain) { +if (current_toolchain == current_toolchain) {
v8_executable("torque") { v8_executable("torque") {

View file

@ -5,19 +5,19 @@ Subject: build_gn.patch
diff --git a/BUILD.gn b/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn
index 83f1fdb0bf75dd5f7efa490cd5bd1221e31748ed..5489b943f1d8bb8ffc02cabf4e0a15788c7d4e48 100644 index 3c039428271d6598fc4ad7137334176d80b92631..9fe1e8d67a25955fea69be89e0bcc27cf5d8529d 100644
--- a/BUILD.gn --- a/BUILD.gn
+++ b/BUILD.gn +++ b/BUILD.gn
@@ -226,7 +226,7 @@ config("internal_config") { @@ -242,7 +242,7 @@ config("internal_config") {
defines = [] configs = [ "//build/config/compiler:wexit_time_destructors" ]
- if (is_component_build) { - if (is_component_build) {
+ if (is_component_build || is_electron_build) { + if (is_component_build || is_electron_build) {
defines += [ "BUILDING_V8_SHARED" ] defines = [ "BUILDING_V8_SHARED" ]
} }
} }
@@ -3363,6 +3363,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { @@ -3481,6 +3481,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
configs = [ ":internal_config" ] configs = [ ":internal_config" ]

View file

@ -5,10 +5,10 @@ Subject: dcheck.patch
diff --git a/src/api.cc b/src/api.cc diff --git a/src/api.cc b/src/api.cc
index 8d83474bcd0ed257b8f387d7996085c605326236..9be405b6c4822da81e48daf96169450be3e4356f 100644 index b4a0f5bb5e484ea80dbfc234e207b44413f2d22f..f36e504161fed27392ef66ffc0ec87898958bf2d 100644
--- a/src/api.cc --- a/src/api.cc
+++ b/src/api.cc +++ b/src/api.cc
@@ -8540,7 +8540,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { @@ -8637,7 +8637,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
void Isolate::RunMicrotasks() { void Isolate::RunMicrotasks() {
@ -18,10 +18,10 @@ index 8d83474bcd0ed257b8f387d7996085c605326236..9be405b6c4822da81e48daf96169450b
} }
diff --git a/src/heap/heap.cc b/src/heap/heap.cc diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index b509d211425fc755f8cecd4727c050d47d7f87f7..36e5023a77b46305b70196cf3c25a8c625dae96b 100644 index 98a3ec8cbcf63f1446569d6458d1f4f4bdda2ca0..316b0e123af68ea0c7a50730ba04470a42918974 100644
--- a/src/heap/heap.cc --- a/src/heap/heap.cc
+++ b/src/heap/heap.cc +++ b/src/heap/heap.cc
@@ -4696,9 +4696,9 @@ void Heap::TearDown() { @@ -4723,9 +4723,9 @@ void Heap::TearDown() {
void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback,
GCType gc_type, void* data) { GCType gc_type, void* data) {
DCHECK_NOT_NULL(callback); DCHECK_NOT_NULL(callback);

View file

@ -20,10 +20,10 @@ Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
diff --git a/src/flag-definitions.h b/src/flag-definitions.h diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 170a777c724e9daca0aee44b63455ade724426e9..5a7664474f15fa9a466c536d2ac554e8f485b32d 100644 index add6d1f4114118b199425ff6b835a286ade5e1ce..38f25aef81c026cd80d663d75250ce16034e3eb3 100644
--- a/src/flag-definitions.h --- a/src/flag-definitions.h
+++ b/src/flag-definitions.h +++ b/src/flag-definitions.h
@@ -1266,7 +1266,7 @@ DEFINE_BOOL(log_function_events, false, @@ -1270,7 +1270,7 @@ DEFINE_BOOL(log_function_events, false,
DEFINE_BOOL(prof, false, DEFINE_BOOL(prof, false,
"Log statistical profiling information (implies --log-code).") "Log statistical profiling information (implies --log-code).")

View file

@ -1,7 +1,7 @@
From 3d6d9749c273d8bbd19508a9f294cfedf44d01e2 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Yang Guo <yangguo@chromium.org> From: Yang Guo <yangguo@chromium.org>
Date: Tue, 20 Nov 2018 08:59:38 +0100 Date: Tue, 20 Nov 2018 08:59:38 +0100
Subject: [PATCH 4/4] deps: cherry-pick 88f8fe1 from upstream V8 Subject: deps: cherry-pick 88f8fe1 from upstream V8
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
@ -33,104 +33,13 @@ Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
---
src/api.cc | 52 ++++++------
test/cctest/test-api.cc | 214 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 241 insertions(+), 25 deletions(-)
diff --git a/src/api.cc b/src/api.cc
index 161538638b..64676f06c1 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -7033,30 +7033,30 @@ i::Handle<i::JSArray> MapAsArray(i::Isolate* isolate, i::Object* table_obj,
i::Factory* factory = isolate->factory();
i::Handle<i::OrderedHashMap> table(i::OrderedHashMap::cast(table_obj),
isolate);
- if (offset >= table->NumberOfElements()) return factory->NewJSArray(0);
- int length = (table->NumberOfElements() - offset) *
- (kind == MapAsArrayKind::kEntries ? 2 : 1);
- i::Handle<i::FixedArray> result = factory->NewFixedArray(length);
+ const bool collect_keys =
+ kind == MapAsArrayKind::kEntries || kind == MapAsArrayKind::kKeys;
+ const bool collect_values =
+ kind == MapAsArrayKind::kEntries || kind == MapAsArrayKind::kValues;
+ int capacity = table->UsedCapacity();
+ int max_length =
+ (capacity - offset) * ((collect_keys && collect_values) ? 2 : 1);
+ i::Handle<i::FixedArray> result = factory->NewFixedArray(max_length);
int result_index = 0;
{
i::DisallowHeapAllocation no_gc;
- int capacity = table->UsedCapacity();
i::Oddball* the_hole = i::ReadOnlyRoots(isolate).the_hole_value();
- for (int i = 0; i < capacity; ++i) {
+ for (int i = offset; i < capacity; ++i) {
i::Object* key = table->KeyAt(i);
if (key == the_hole) continue;
- if (offset-- > 0) continue;
- if (kind == MapAsArrayKind::kEntries || kind == MapAsArrayKind::kKeys) {
- result->set(result_index++, key);
- }
- if (kind == MapAsArrayKind::kEntries || kind == MapAsArrayKind::kValues) {
- result->set(result_index++, table->ValueAt(i));
- }
+ if (collect_keys) result->set(result_index++, key);
+ if (collect_values) result->set(result_index++, table->ValueAt(i));
}
}
- DCHECK_EQ(result_index, result->length());
- DCHECK_EQ(result_index, length);
- return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, length);
+ DCHECK_GE(max_length, result_index);
+ if (result_index == 0) return factory->NewJSArray(0);
+ result->Shrink(isolate, result_index);
+ return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS,
+ result_index);
}
} // namespace
@@ -7141,24 +7141,26 @@ i::Handle<i::JSArray> SetAsArray(i::Isolate* isolate, i::Object* table_obj,
i::Factory* factory = isolate->factory();
i::Handle<i::OrderedHashSet> table(i::OrderedHashSet::cast(table_obj),
isolate);
- int length = table->NumberOfElements() - offset;
- if (length <= 0) return factory->NewJSArray(0);
- i::Handle<i::FixedArray> result = factory->NewFixedArray(length);
+ // Elements skipped by |offset| may already be deleted.
+ int capacity = table->UsedCapacity();
+ int max_length = capacity - offset;
+ if (max_length == 0) return factory->NewJSArray(0);
+ i::Handle<i::FixedArray> result = factory->NewFixedArray(max_length);
int result_index = 0;
{
i::DisallowHeapAllocation no_gc;
- int capacity = table->UsedCapacity();
i::Oddball* the_hole = i::ReadOnlyRoots(isolate).the_hole_value();
- for (int i = 0; i < capacity; ++i) {
+ for (int i = offset; i < capacity; ++i) {
i::Object* key = table->KeyAt(i);
if (key == the_hole) continue;
- if (offset-- > 0) continue;
result->set(result_index++, key);
}
}
- DCHECK_EQ(result_index, result->length());
- DCHECK_EQ(result_index, length);
- return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS, length);
+ DCHECK_GE(max_length, result_index);
+ if (result_index == 0) return factory->NewJSArray(0);
+ result->Shrink(isolate, result_index);
+ return factory->NewJSArrayWithElements(result, i::PACKED_ELEMENTS,
+ result_index);
}
} // namespace
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 0d92508d24..9bf7870f75 100644 index b49202d6127083e1d642f39ec149ce2261061ea7..dd56f7cd985db38820c94fd41b2f7f24a01e1811 100644
--- a/test/cctest/test-api.cc --- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc
@@ -28852,3 +28852,217 @@ TEST(TestGetEmbeddedCodeRange) { @@ -29364,3 +29364,217 @@ TEST(PreviewMapIteratorEntriesWithDeleted) {
CHECK_EQ(0, builtins_range.length_in_bytes); }
} }
} }
+ +
@ -347,6 +256,3 @@ index 0d92508d24..9bf7870f75 100644
+ } + }
+ } + }
+} +}
--
2.14.3 (Apple Git-98)

View file

@ -22,10 +22,10 @@ Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
diff --git a/include/v8.h b/include/v8.h diff --git a/include/v8.h b/include/v8.h
index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0bf000585f 100644 index 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720a93d08b2 100644
--- a/include/v8.h --- a/include/v8.h
+++ b/include/v8.h +++ b/include/v8.h
@@ -999,6 +999,10 @@ class V8_EXPORT PrimitiveArray { @@ -998,6 +998,10 @@ class V8_EXPORT PrimitiveArray {
public: public:
static Local<PrimitiveArray> New(Isolate* isolate, int length); static Local<PrimitiveArray> New(Isolate* isolate, int length);
int Length() const; int Length() const;
@ -36,7 +36,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
void Set(Isolate* isolate, int index, Local<Primitive> item); void Set(Isolate* isolate, int index, Local<Primitive> item);
Local<Primitive> Get(Isolate* isolate, int index); Local<Primitive> Get(Isolate* isolate, int index);
}; };
@@ -1710,6 +1714,8 @@ class V8_EXPORT StackTrace { @@ -1705,6 +1709,8 @@ class V8_EXPORT StackTrace {
/** /**
* Returns a StackFrame at a particular index. * Returns a StackFrame at a particular index.
*/ */
@ -45,7 +45,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const; Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
/** /**
@@ -2423,6 +2429,13 @@ class V8_EXPORT Value : public Data { @@ -2428,6 +2434,13 @@ class V8_EXPORT Value : public Data {
V8_DEPRECATE_SOON("Use maybe version", V8_DEPRECATE_SOON("Use maybe version",
Local<Int32> ToInt32(Isolate* isolate) const); Local<Int32> ToInt32(Isolate* isolate) const);
@ -59,7 +59,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
/** /**
* Attempts to convert a string to an array index. * Attempts to convert a string to an array index.
* Returns an empty handle if the conversion fails. * Returns an empty handle if the conversion fails.
@@ -2442,7 +2455,14 @@ class V8_EXPORT Value : public Data { @@ -2447,7 +2460,14 @@ class V8_EXPORT Value : public Data {
Local<Context> context) const; Local<Context> context) const;
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const; V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
@ -74,7 +74,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context, V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
Local<Value> that) const; Local<Value> that) const;
bool StrictEquals(Local<Value> that) const; bool StrictEquals(Local<Value> that) const;
@@ -2549,6 +2569,8 @@ class V8_EXPORT String : public Name { @@ -2554,6 +2574,8 @@ class V8_EXPORT String : public Name {
* Returns the number of bytes in the UTF-8 encoded * Returns the number of bytes in the UTF-8 encoded
* representation of this string. * representation of this string.
*/ */
@ -83,7 +83,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
int Utf8Length(Isolate* isolate) const; int Utf8Length(Isolate* isolate) const;
/** /**
@@ -2605,12 +2627,23 @@ class V8_EXPORT String : public Name { @@ -2610,12 +2632,23 @@ class V8_EXPORT String : public Name {
// 16-bit character codes. // 16-bit character codes.
int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1, int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
int options = NO_OPTIONS) const; int options = NO_OPTIONS) const;
@ -107,7 +107,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
/** /**
* A zero length string. * A zero length string.
@@ -2812,6 +2845,9 @@ class V8_EXPORT String : public Name { @@ -2807,6 +2840,9 @@ class V8_EXPORT String : public Name {
*/ */
static Local<String> Concat(Isolate* isolate, Local<String> left, static Local<String> Concat(Isolate* isolate, Local<String> left,
Local<String> right); Local<String> right);
@ -117,7 +117,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
/** /**
* Creates a new external string using the data defined in the given * Creates a new external string using the data defined in the given
@@ -2880,6 +2916,8 @@ class V8_EXPORT String : public Name { @@ -2875,6 +2911,8 @@ class V8_EXPORT String : public Name {
*/ */
class V8_EXPORT Utf8Value { class V8_EXPORT Utf8Value {
public: public:
@ -126,7 +126,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
Utf8Value(Isolate* isolate, Local<v8::Value> obj); Utf8Value(Isolate* isolate, Local<v8::Value> obj);
~Utf8Value(); ~Utf8Value();
char* operator*() { return str_; } char* operator*() { return str_; }
@@ -2903,6 +2941,7 @@ class V8_EXPORT String : public Name { @@ -2898,6 +2936,7 @@ class V8_EXPORT String : public Name {
*/ */
class V8_EXPORT Value { class V8_EXPORT Value {
public: public:
@ -134,7 +134,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
Value(Isolate* isolate, Local<v8::Value> obj); Value(Isolate* isolate, Local<v8::Value> obj);
~Value(); ~Value();
uint16_t* operator*() { return str_; } uint16_t* operator*() { return str_; }
@@ -5140,6 +5179,8 @@ class V8_EXPORT BooleanObject : public Object { @@ -5180,6 +5219,8 @@ class V8_EXPORT BooleanObject : public Object {
class V8_EXPORT StringObject : public Object { class V8_EXPORT StringObject : public Object {
public: public:
static Local<Value> New(Isolate* isolate, Local<String> value); static Local<Value> New(Isolate* isolate, Local<String> value);
@ -143,7 +143,7 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
Local<String> ValueOf() const; Local<String> ValueOf() const;
@@ -9999,6 +10040,30 @@ template <class T> Value* Value::Cast(T* value) { @@ -10045,6 +10086,30 @@ template <class T> Value* Value::Cast(T* value) {
} }
@ -175,10 +175,10 @@ index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0b
#ifdef V8_ENABLE_CHECKS #ifdef V8_ENABLE_CHECKS
CheckCast(value); CheckCast(value);
diff --git a/src/api.cc b/src/api.cc diff --git a/src/api.cc b/src/api.cc
index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0ee576616 100644 index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7d892d0cc 100644
--- a/src/api.cc --- a/src/api.cc
+++ b/src/api.cc +++ b/src/api.cc
@@ -2162,6 +2162,10 @@ int PrimitiveArray::Length() const { @@ -2167,6 +2167,10 @@ int PrimitiveArray::Length() const {
return array->length(); return array->length();
} }
@ -189,7 +189,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
void PrimitiveArray::Set(Isolate* v8_isolate, int index, void PrimitiveArray::Set(Isolate* v8_isolate, int index,
Local<Primitive> item) { Local<Primitive> item) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@@ -2175,6 +2179,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index, @@ -2180,6 +2184,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
array->set(index, *i_item); array->set(index, *i_item);
} }
@ -200,7 +200,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) { Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
i::Handle<i::FixedArray> array = Utils::OpenHandle(this); i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
@@ -2909,6 +2917,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { @@ -2901,6 +2909,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
// --- S t a c k T r a c e --- // --- S t a c k T r a c e ---
@ -211,7 +211,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate, Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
uint32_t index) const { uint32_t index) const {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@@ -3888,6 +3900,36 @@ void v8::RegExp::CheckCast(v8::Value* that) { @@ -3880,6 +3892,36 @@ void v8::RegExp::CheckCast(v8::Value* that) {
} }
@ -248,7 +248,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
Maybe<bool> Value::BooleanValue(Local<Context> context) const { Maybe<bool> Value::BooleanValue(Local<Context> context) const {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate()); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
return Just(Utils::OpenHandle(this)->BooleanValue(isolate)); return Just(Utils::OpenHandle(this)->BooleanValue(isolate));
@@ -3976,6 +4018,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const { @@ -3968,6 +4010,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
} }
@ -261,7 +261,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const { Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const {
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate(); i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
auto self = Utils::OpenHandle(this); auto self = Utils::OpenHandle(this);
@@ -5312,6 +5360,10 @@ bool String::ContainsOnlyOneByte() const { @@ -5302,6 +5350,10 @@ bool String::ContainsOnlyOneByte() const {
return helper.Check(*str); return helper.Check(*str);
} }
@ -272,7 +272,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
int String::Utf8Length(Isolate* isolate) const { int String::Utf8Length(Isolate* isolate) const {
i::Handle<i::String> str = Utils::OpenHandle(this); i::Handle<i::String> str = Utils::OpenHandle(this);
str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str); str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
@@ -5535,6 +5587,14 @@ static bool RecursivelySerializeToUtf8(i::String* current, @@ -5525,6 +5577,14 @@ static bool RecursivelySerializeToUtf8(i::String current,
return true; return true;
} }
@ -287,7 +287,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity, int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
int* nchars_ref, int options) const { int* nchars_ref, int options) const {
i::Handle<i::String> str = Utils::OpenHandle(this); i::Handle<i::String> str = Utils::OpenHandle(this);
@@ -5602,6 +5662,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string, @@ -5592,6 +5652,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
} }
@ -306,7 +306,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start, int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
int length, int options) const { int length, int options) const {
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer, return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
@@ -6549,6 +6621,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate, @@ -6553,6 +6625,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
return result; return result;
} }
@ -318,7 +318,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left, Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
Local<String> right) { Local<String> right) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@@ -6774,6 +6851,11 @@ bool v8::BooleanObject::ValueOf() const { @@ -6841,6 +6918,11 @@ bool v8::BooleanObject::ValueOf() const {
} }
@ -330,7 +330,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate, Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
Local<String> value) { Local<String> value) {
i::Handle<i::String> string = Utils::OpenHandle(*value); i::Handle<i::String> string = Utils::OpenHandle(*value);
@@ -8915,6 +8997,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8Isolate) { @@ -9024,6 +9106,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8Isolate) {
return isolate->IsRunningMicrotasks(); return isolate->IsRunningMicrotasks();
} }
@ -340,7 +340,7 @@ index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0
String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj) String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
: str_(nullptr), length_(0) { : str_(nullptr), length_(0) {
if (obj.IsEmpty()) return; if (obj.IsEmpty()) return;
@@ -8934,6 +9019,9 @@ String::Utf8Value::~Utf8Value() { @@ -9043,6 +9128,9 @@ String::Utf8Value::~Utf8Value() {
i::DeleteArray(str_); i::DeleteArray(str_);
} }

View file

@ -10,10 +10,10 @@ Electron does, so this patch makes sure that the build doesn't try to run
the mksnapshot binary if it was built for arm or arm64. the mksnapshot binary if it was built for arm or arm64.
diff --git a/BUILD.gn b/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn
index 1f9dd022ac804e58263f527af5a47768c882de40..d40848056235b9a8307533c8b1e238aecf18207d 100644 index c564baea42f22d727990752be8b4ed086ef273f2..e3c8390c299e4c12e4ddba8402ccdb050e7bb6f1 100644
--- a/BUILD.gn --- a/BUILD.gn
+++ b/BUILD.gn +++ b/BUILD.gn
@@ -1286,9 +1286,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) { @@ -1349,9 +1349,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) {
] ]
public_deps = [ public_deps = [
":natives_blob", ":natives_blob",

View file

@ -6,7 +6,7 @@ Subject: export_platform.patch
v8::Platform::SystemClockTimeMillis must be exported so that node::NodePlatform can call it v8::Platform::SystemClockTimeMillis must be exported so that node::NodePlatform can call it
diff --git a/include/v8-platform.h b/include/v8-platform.h diff --git a/include/v8-platform.h b/include/v8-platform.h
index d983c30249591bd05b760dbae6a1afb413c7d021..183d77e55619970644868747fab26d250f790c3c 100644 index b9b0363a426de898c7db29a341f7179c45706f0a..48fba7921fd17eec79c569ab3c9173f084743218 100644
--- a/include/v8-platform.h --- a/include/v8-platform.h
+++ b/include/v8-platform.h +++ b/include/v8-platform.h
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
@ -17,7 +17,7 @@ index d983c30249591bd05b760dbae6a1afb413c7d021..183d77e55619970644868747fab26d25
#include "v8config.h" // NOLINT(build/include) #include "v8config.h" // NOLINT(build/include)
namespace v8 { namespace v8 {
@@ -394,7 +395,7 @@ class Platform { @@ -421,7 +422,7 @@ class Platform {
* since epoch. Useful for implementing |CurrentClockTimeMillis| if * since epoch. Useful for implementing |CurrentClockTimeMillis| if
* nothing special needed. * nothing special needed.
*/ */

View file

@ -6,15 +6,15 @@ Subject: expose_mksnapshot.patch
Needed in order to build mksnapshot on arm. Needed in order to build mksnapshot on arm.
diff --git a/BUILD.gn b/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn
index 5489b943f1d8bb8ffc02cabf4e0a15788c7d4e48..1f9dd022ac804e58263f527af5a47768c882de40 100644 index 9fe1e8d67a25955fea69be89e0bcc27cf5d8529d..b47a698a2f41f221290861c938c15a38e34d7b00 100644
--- a/BUILD.gn --- a/BUILD.gn
+++ b/BUILD.gn +++ b/BUILD.gn
@@ -3355,8 +3355,6 @@ if (current_toolchain == v8_generator_toolchain) { @@ -3471,8 +3471,6 @@ if (current_toolchain == v8_generator_toolchain) {
if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) { if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
v8_executable("mksnapshot") { v8_executable("mksnapshot") {
- visibility = [ ":*" ] # Only targets in this file can depend on this. - visibility = [ ":*" ] # Only targets in this file can depend on this.
- -
sources = [ sources = [
"src/snapshot/mksnapshot.cc", "src/snapshot/embedded-file-writer.cc",
] "src/snapshot/embedded-file-writer.h",