feat: Upgrade to Chromium 71.0.3578.98 (#15966)

This commit is contained in:
Robo 2019-01-12 06:30:43 +05:30 committed by Jeremy Apthorp
parent 92ddfd0d4c
commit 52fe92d02e
204 changed files with 2291 additions and 1760 deletions

View file

@ -1,5 +1,4 @@
deps_backport_detailed_line_info_for_cpu_profiler.patch
deps_cherry-pick_2363cdf_from_upstream_v8.patch
add_realloc.patch
build_gn.patch
array_buffer.patch
@ -10,5 +9,8 @@ disable-warning-win.patch
expose_mksnapshot.patch
build-torque-with-x64-toolchain-on-arm.patch
do_not_run_arm_arm64_mksnapshot_binaries.patch
deps_revert_9136dd8088a9_from_upstream_v8.patch
deps_provide_more_v8_backwards_compatibility.patch
0001-deps-cherry-pick-0483e9a-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

@ -0,0 +1,112 @@
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

@ -0,0 +1,136 @@
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

@ -0,0 +1,180 @@
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

@ -0,0 +1,352 @@
From 3d6d9749c273d8bbd19508a9f294cfedf44d01e2 Mon Sep 17 00:00:00 2001
From: Yang Guo <yangguo@chromium.org>
Date: Tue, 20 Nov 2018 08:59:38 +0100
Subject: [PATCH 4/4] deps: cherry-pick 88f8fe1 from upstream V8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Original commit message:
Fix collection iterator preview with deleted entries
We used to assume that we know the remaining entries returned by the
iterator based on the current index. However, that is not accurate,
since entries skipped by the current index could be deleted.
In the new approach, we allocate conservatively and shrink the result.
R=neis@chromium.org
Bug: v8:8433
Change-Id: I38a3004dc3af292daabb454bb76f38d65ef437e8
Reviewed-on: https://chromium-review.googlesource.com/c/1325966
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57360}
Refs: https://github.com/v8/v8/commit/88f8fe19a863c6392bd296faf86c06eff2a41bc1
PR-URL: https://github.com/nodejs/node/pull/24514
Refs: https://github.com/nodejs/node/issues/24053
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
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
index 0d92508d24..9bf7870f75 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -28852,3 +28852,217 @@ TEST(TestGetEmbeddedCodeRange) {
CHECK_EQ(0, builtins_range.length_in_bytes);
}
}
+
+TEST(PreviewSetIteratorEntriesWithDeleted) {
+ LocalContext env;
+ v8::HandleScope handle_scope(env->GetIsolate());
+ v8::Local<v8::Context> context = env.local();
+
+ {
+ // Create set, delete entry, create iterator, preview.
+ v8::Local<v8::Object> iterator =
+ CompileRun("var set = new Set([1,2,3]); set.delete(1); set.keys()")
+ ->ToObject(context)
+ .ToLocalChecked();
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(2, entries->Length());
+ CHECK_EQ(2, entries->Get(context, 0)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ CHECK_EQ(3, entries->Get(context, 1)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ }
+ {
+ // Create set, create iterator, delete entry, preview.
+ v8::Local<v8::Object> iterator =
+ CompileRun("var set = new Set([1,2,3]); set.keys()")
+ ->ToObject(context)
+ .ToLocalChecked();
+ CompileRun("set.delete(1);");
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(2, entries->Length());
+ CHECK_EQ(2, entries->Get(context, 0)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ CHECK_EQ(3, entries->Get(context, 1)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ }
+ {
+ // Create set, create iterator, delete entry, iterate, preview.
+ v8::Local<v8::Object> iterator =
+ CompileRun("var set = new Set([1,2,3]); var it = set.keys(); it")
+ ->ToObject(context)
+ .ToLocalChecked();
+ CompileRun("set.delete(1); it.next();");
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(1, entries->Length());
+ CHECK_EQ(3, entries->Get(context, 0)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ }
+ {
+ // Create set, create iterator, delete entry, iterate until empty, preview.
+ v8::Local<v8::Object> iterator =
+ CompileRun("var set = new Set([1,2,3]); var it = set.keys(); it")
+ ->ToObject(context)
+ .ToLocalChecked();
+ CompileRun("set.delete(1); it.next(); it.next();");
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(0, entries->Length());
+ }
+ {
+ // Create set, create iterator, delete entry, iterate, trigger rehash,
+ // preview.
+ v8::Local<v8::Object> iterator =
+ CompileRun("var set = new Set([1,2,3]); var it = set.keys(); it")
+ ->ToObject(context)
+ .ToLocalChecked();
+ CompileRun("set.delete(1); it.next();");
+ CompileRun("for (var i = 4; i < 20; i++) set.add(i);");
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(17, entries->Length());
+ for (uint32_t i = 0; i < 17; i++) {
+ CHECK_EQ(i + 3, entries->Get(context, i)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ }
+ }
+}
+
+TEST(PreviewMapIteratorEntriesWithDeleted) {
+ LocalContext env;
+ v8::HandleScope handle_scope(env->GetIsolate());
+ v8::Local<v8::Context> context = env.local();
+
+ {
+ // Create map, delete entry, create iterator, preview.
+ v8::Local<v8::Object> iterator = CompileRun(
+ "var map = new Map();"
+ "var key = {}; map.set(key, 1);"
+ "map.set({}, 2); map.set({}, 3);"
+ "map.delete(key);"
+ "map.values()")
+ ->ToObject(context)
+ .ToLocalChecked();
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(2, entries->Length());
+ CHECK_EQ(2, entries->Get(context, 0)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ CHECK_EQ(3, entries->Get(context, 1)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ }
+ {
+ // Create map, create iterator, delete entry, preview.
+ v8::Local<v8::Object> iterator = CompileRun(
+ "var map = new Map();"
+ "var key = {}; map.set(key, 1);"
+ "map.set({}, 2); map.set({}, 3);"
+ "map.values()")
+ ->ToObject(context)
+ .ToLocalChecked();
+ CompileRun("map.delete(key);");
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(2, entries->Length());
+ CHECK_EQ(2, entries->Get(context, 0)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ CHECK_EQ(3, entries->Get(context, 1)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ }
+ {
+ // Create map, create iterator, delete entry, iterate, preview.
+ v8::Local<v8::Object> iterator = CompileRun(
+ "var map = new Map();"
+ "var key = {}; map.set(key, 1);"
+ "map.set({}, 2); map.set({}, 3);"
+ "var it = map.values(); it")
+ ->ToObject(context)
+ .ToLocalChecked();
+ CompileRun("map.delete(key); it.next();");
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(1, entries->Length());
+ CHECK_EQ(3, entries->Get(context, 0)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ }
+ {
+ // Create map, create iterator, delete entry, iterate until empty, preview.
+ v8::Local<v8::Object> iterator = CompileRun(
+ "var map = new Map();"
+ "var key = {}; map.set(key, 1);"
+ "map.set({}, 2); map.set({}, 3);"
+ "var it = map.values(); it")
+ ->ToObject(context)
+ .ToLocalChecked();
+ CompileRun("map.delete(key); it.next(); it.next();");
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(0, entries->Length());
+ }
+ {
+ // Create map, create iterator, delete entry, iterate, trigger rehash,
+ // preview.
+ v8::Local<v8::Object> iterator = CompileRun(
+ "var map = new Map();"
+ "var key = {}; map.set(key, 1);"
+ "map.set({}, 2); map.set({}, 3);"
+ "var it = map.values(); it")
+ ->ToObject(context)
+ .ToLocalChecked();
+ CompileRun("map.delete(key); it.next();");
+ CompileRun("for (var i = 4; i < 20; i++) map.set({}, i);");
+ bool is_key;
+ v8::Local<v8::Array> entries =
+ iterator->PreviewEntries(&is_key).ToLocalChecked();
+ CHECK(!is_key);
+ CHECK_EQ(17, entries->Length());
+ for (uint32_t i = 0; i < 17; i++) {
+ CHECK_EQ(i + 3, entries->Get(context, i)
+ .ToLocalChecked()
+ ->Int32Value(context)
+ .FromJust());
+ }
+ }
+}
--
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.
diff --git a/include/v8.h b/include/v8.h
index a83305560c2ea33d4a6247d76655e83c7a14b0ca..fa3a4dd82c0deeaddba0a84e8bf2841e04bc8483 100644
index a4bbe1b0c43d665a6b6c4e6c46205c32eac9548b..b2301cd8d07c1ef57e77cedab920a43f0b498597 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -4604,6 +4604,13 @@ class V8_EXPORT ArrayBuffer : public Object {
@@ -4486,6 +4486,13 @@ class V8_EXPORT ArrayBuffer : public Object {
*/
virtual void* AllocateUninitialized(size_t length) = 0;
@ -30,10 +30,10 @@ index a83305560c2ea33d4a6247d76655e83c7a14b0ca..fa3a4dd82c0deeaddba0a84e8bf2841e
* Free the memory block of size |length|, pointed to by |data|.
* That memory is guaranteed to be previously allocated by |Allocate|.
diff --git a/src/api.cc b/src/api.cc
index 4eb31a447c3d2dbce8ddaffb777b799ec28c2f8c..809bbe52178a3f8cbcf0b6eb81fba0910c1fb0e6 100644
index 3f62a23d43c1c82c273e379e78fd0a4292cf4a20..2863b73e0677b666040766fef638abbc6fc95b8c 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -508,6 +508,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
@@ -488,6 +488,10 @@ void V8::SetSnapshotDataBlob(StartupData* 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
index fa3a4dd82c0deeaddba0a84e8bf2841e04bc8483..3070f4aa50eed8722805feaf8d9b9db0d68fbbbf 100644
index b2301cd8d07c1ef57e77cedab920a43f0b498597..6934a9c3838641446fa96a8ab48abed4cfc1841c 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -7737,6 +7737,9 @@ class V8_EXPORT Isolate {
@@ -7653,6 +7653,9 @@ class V8_EXPORT Isolate {
*/
void SetIdle(bool is_idle);
@ -19,10 +19,10 @@ index fa3a4dd82c0deeaddba0a84e8bf2841e04bc8483..3070f4aa50eed8722805feaf8d9b9db0
bool InContext();
diff --git a/src/api.cc b/src/api.cc
index 809bbe52178a3f8cbcf0b6eb81fba0910c1fb0e6..c1f863d148243d3988a70959fd91a37788137393 100644
index 2863b73e0677b666040766fef638abbc6fc95b8c..8d83474bcd0ed257b8f387d7996085c605326236 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -8107,6 +8107,13 @@ void Isolate::SetIdle(bool is_idle) {
@@ -7984,6 +7984,13 @@ void Isolate::SetIdle(bool is_idle) {
isolate->SetIdle(is_idle);
}

View file

@ -1,28 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aleksei Kuzmin <alkuzmin@microsoft.com>
Date: Mon, 22 Oct 2018 10:47:13 -0700
From: deepak1556 <hop2deep@gmail.com>
Date: Fri, 4 Jan 2019 15:50:24 +0530
Subject: build-torque-with-x64-toolchain-on-arm.patch
torque binary has to be run during the build.
diff --git a/BUILD.gn b/BUILD.gn
index c1b08958b500da1910a8067198cdec7650534f20..78e672e18eff27a3777bd0c0adc94e88a6eb126a 100644
index d40848056235b9a8307533c8b1e238aecf18207d..d8db6363b8560b5c4a1595437e59edf1c6ec3974 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -914,7 +914,8 @@ action("run_torque") {
# is the target toolchain and, hence, can't be used.
v8_torque_toolchain = v8_snapshot_toolchain
if (host_cpu == "x64" &&
- (v8_current_cpu == "mips" || v8_current_cpu == "mips64")) {
+ (v8_current_cpu == "mips" || v8_current_cpu == "mips64" ||
+ v8_current_cpu == "arm" || v8_current_cpu == "arm64")) {
v8_torque_toolchain = "//build/toolchain/linux:clang_x64"
}
@@ -3256,7 +3257,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
@@ -170,7 +170,8 @@ declare_args() {
v8_generator_toolchain = v8_snapshot_toolchain
if (host_cpu == "x64" &&
- (v8_current_cpu == "mips" || v8_current_cpu == "mips64")) {
+ (v8_current_cpu == "mips" || v8_current_cpu == "mips64" ||
+ v8_current_cpu == "arm" || v8_current_cpu == "arm64")) {
v8_generator_toolchain = "//build/toolchain/linux:clang_x64"
}
@@ -3340,7 +3341,7 @@ if (v8_monolithic) {
# Executables
#
-if (current_toolchain == v8_generator_toolchain) {
+if (current_toolchain == current_toolchain) {
v8_executable("bytecode_builtins_list_generator") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
@@ -3384,7 +3385,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
}
}
-if (current_toolchain == v8_snapshot_toolchain) {
+if (current_toolchain == current_toolchain) {
v8_executable("torque") {

View file

@ -5,10 +5,10 @@ Subject: build_gn.patch
diff --git a/BUILD.gn b/BUILD.gn
index c6a58776cd6a81cf5653b94a8db1a04dd7e54045..ac74cdec115b6cc54d05817f063153628cf5e9fe 100644
index 83f1fdb0bf75dd5f7efa490cd5bd1221e31748ed..5489b943f1d8bb8ffc02cabf4e0a15788c7d4e48 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -221,7 +221,7 @@ config("internal_config") {
@@ -226,7 +226,7 @@ config("internal_config") {
defines = []
@ -17,7 +17,7 @@ index c6a58776cd6a81cf5653b94a8db1a04dd7e54045..ac74cdec115b6cc54d05817f06315362
defines += [ "BUILDING_V8_SHARED" ]
}
}
@@ -3245,6 +3245,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
@@ -3363,6 +3363,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
configs = [ ":internal_config" ]

View file

@ -5,10 +5,10 @@ Subject: dcheck.patch
diff --git a/src/api.cc b/src/api.cc
index c1f863d148243d3988a70959fd91a37788137393..8dca7ec88e59c775da5cf7e30721d064f349c634 100644
index 8d83474bcd0ed257b8f387d7996085c605326236..9be405b6c4822da81e48daf96169450be3e4356f 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -8649,7 +8649,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
@@ -8540,7 +8540,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
void Isolate::RunMicrotasks() {
@ -18,10 +18,10 @@ index c1f863d148243d3988a70959fd91a37788137393..8dca7ec88e59c775da5cf7e30721d064
}
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 2ec30635be2b75fe1e308068b6e16b9568472ead..7058396f3009fec5635a01961368ab14c287d882 100644
index b509d211425fc755f8cecd4727c050d47d7f87f7..36e5023a77b46305b70196cf3c25a8c625dae96b 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -5035,9 +5035,9 @@ void Heap::TearDown() {
@@ -4696,9 +4696,9 @@ void Heap::TearDown() {
void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback,
GCType gc_type, void* data) {
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>
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 69ec7472bba0f9a04b32c1ce135083cc82456b0a..4f8b5780c832d2faf27340cffe32b298e3b0b04d 100644
index 170a777c724e9daca0aee44b63455ade724426e9..5a7664474f15fa9a466c536d2ac554e8f485b32d 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -1267,7 +1267,7 @@ DEFINE_BOOL(log_function_events, false,
@@ -1266,7 +1266,7 @@ DEFINE_BOOL(log_function_events, false,
DEFINE_BOOL(prof, false,
"Log statistical profiling information (implies --log-code).")

View file

@ -1,74 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ali Ijaz Sheikh <ofrobots@google.com>
Date: Tue, 11 Sep 2018 15:40:28 -0700
Subject: deps: cherry-pick 2363cdf from upstream V8
Original commit message:
[tracing] do not add traces when disabled
https://github.com/nodejs/node/issues/21038
Change-Id: Ic4c9f403b5e54a97d3170b2311dd5aab8c8357c8
Reviewed-on: https://chromium-review.googlesource.com/1217726
Commit-Queue: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55809}
Refs: https://github.com/v8/v8/commit/2363cdfefeb643285cbe8593b7c17d80e5d06cd9
PR-URL: https://github.com/nodejs/node/pull/22812
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
diff --git a/src/libplatform/tracing/tracing-controller.cc b/src/libplatform/tracing/tracing-controller.cc
index daaebc291a5a3f566fcd65cfcced0f5c3725fe08..aa8789fa07c167ecce97dd787782ce684d3a7c38 100644
--- a/src/libplatform/tracing/tracing-controller.cc
+++ b/src/libplatform/tracing/tracing-controller.cc
@@ -77,13 +77,15 @@ uint64_t TracingController::AddTraceEvent(
const uint64_t* arg_values,
std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables,
unsigned int flags) {
- uint64_t handle;
- TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
- if (trace_object) {
- trace_object->Initialize(
- phase, category_enabled_flag, name, scope, id, bind_id, num_args,
- arg_names, arg_types, arg_values, arg_convertables, flags,
- CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds());
+ uint64_t handle = 0;
+ if (mode_ != DISABLED) {
+ TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
+ if (trace_object) {
+ trace_object->Initialize(
+ phase, category_enabled_flag, name, scope, id, bind_id, num_args,
+ arg_names, arg_types, arg_values, arg_convertables, flags,
+ CurrentTimestampMicroseconds(), CurrentCpuTimestampMicroseconds());
+ }
}
return handle;
}
@@ -95,13 +97,15 @@ uint64_t TracingController::AddTraceEventWithTimestamp(
const uint64_t* arg_values,
std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables,
unsigned int flags, int64_t timestamp) {
- uint64_t handle;
- TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
- if (trace_object) {
- trace_object->Initialize(phase, category_enabled_flag, name, scope, id,
- bind_id, num_args, arg_names, arg_types,
- arg_values, arg_convertables, flags, timestamp,
- CurrentCpuTimestampMicroseconds());
+ uint64_t handle = 0;
+ if (mode_ != DISABLED) {
+ TraceObject* trace_object = trace_buffer_->AddTraceEvent(&handle);
+ if (trace_object) {
+ trace_object->Initialize(phase, category_enabled_flag, name, scope, id,
+ bind_id, num_args, arg_names, arg_types,
+ arg_values, arg_convertables, flags, timestamp,
+ CurrentCpuTimestampMicroseconds());
+ }
}
return handle;
}

View file

@ -22,10 +22,10 @@ Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
diff --git a/include/v8.h b/include/v8.h
index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbbadb1e3210 100644
index 6934a9c3838641446fa96a8ab48abed4cfc1841c..2ab60e2ceebf0648ff5b58f5d9909e0bf000585f 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1123,6 +1123,10 @@ class V8_EXPORT PrimitiveArray {
@@ -999,6 +999,10 @@ class V8_EXPORT PrimitiveArray {
public:
static Local<PrimitiveArray> New(Isolate* isolate, int length);
int Length() const;
@ -36,7 +36,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
void Set(Isolate* isolate, int index, Local<Primitive> item);
Local<Primitive> Get(Isolate* isolate, int index);
};
@@ -1829,6 +1833,8 @@ class V8_EXPORT StackTrace {
@@ -1710,6 +1714,8 @@ class V8_EXPORT StackTrace {
/**
* Returns a StackFrame at a particular index.
*/
@ -45,7 +45,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
/**
@@ -2537,6 +2543,13 @@ class V8_EXPORT Value : public Data {
@@ -2423,6 +2429,13 @@ class V8_EXPORT Value : public Data {
V8_DEPRECATE_SOON("Use maybe version",
Local<Int32> ToInt32(Isolate* isolate) const);
@ -59,7 +59,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
/**
* Attempts to convert a string to an array index.
* Returns an empty handle if the conversion fails.
@@ -2552,7 +2565,14 @@ class V8_EXPORT Value : public Data {
@@ -2442,7 +2455,14 @@ class V8_EXPORT Value : public Data {
Local<Context> context) const;
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
@ -74,7 +74,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
Local<Value> that) const;
bool StrictEquals(Local<Value> that) const;
@@ -2659,6 +2679,8 @@ class V8_EXPORT String : public Name {
@@ -2549,6 +2569,8 @@ class V8_EXPORT String : public Name {
* Returns the number of bytes in the UTF-8 encoded
* representation of this string.
*/
@ -83,7 +83,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
int Utf8Length(Isolate* isolate) const;
/**
@@ -2715,12 +2737,23 @@ class V8_EXPORT String : public Name {
@@ -2605,12 +2627,23 @@ class V8_EXPORT String : public Name {
// 16-bit character codes.
int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
int options = NO_OPTIONS) const;
@ -99,15 +99,15 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
+ const);
// UTF-8 encoded characters.
int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
int* nchars_ref = NULL, int options = NO_OPTIONS) const;
int* nchars_ref = nullptr, int options = NO_OPTIONS) const;
+ V8_DEPRECATED("Use Isolate* version",
+ int WriteUtf8(char* buffer, int length = -1,
+ int* nchars_ref = NULL,
+ int* nchars_ref = nullptr,
+ int options = NO_OPTIONS) const);
/**
* A zero length string.
@@ -2884,6 +2917,9 @@ class V8_EXPORT String : public Name {
@@ -2812,6 +2845,9 @@ class V8_EXPORT String : public Name {
*/
static Local<String> Concat(Isolate* isolate, Local<String> left,
Local<String> right);
@ -117,7 +117,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
/**
* Creates a new external string using the data defined in the given
@@ -2952,6 +2988,8 @@ class V8_EXPORT String : public Name {
@@ -2880,6 +2916,8 @@ class V8_EXPORT String : public Name {
*/
class V8_EXPORT Utf8Value {
public:
@ -126,7 +126,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
~Utf8Value();
char* operator*() { return str_; }
@@ -2975,6 +3013,7 @@ class V8_EXPORT String : public Name {
@@ -2903,6 +2941,7 @@ class V8_EXPORT String : public Name {
*/
class V8_EXPORT Value {
public:
@ -134,7 +134,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
Value(Isolate* isolate, Local<v8::Value> obj);
~Value();
uint16_t* operator*() { return str_; }
@@ -5224,6 +5263,8 @@ class V8_EXPORT BooleanObject : public Object {
@@ -5140,6 +5179,8 @@ class V8_EXPORT BooleanObject : public Object {
class V8_EXPORT StringObject : public Object {
public:
static Local<Value> New(Isolate* isolate, Local<String> value);
@ -143,7 +143,7 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
Local<String> ValueOf() const;
@@ -10226,6 +10267,30 @@ template <class T> Value* Value::Cast(T* value) {
@@ -9999,6 +10040,30 @@ template <class T> Value* Value::Cast(T* value) {
}
@ -175,10 +175,10 @@ index 784e1830edeebaf2b15eaad4230f318f91acad5f..cc2fefc56a4eeaeab48f2042d6c8dbba
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
diff --git a/src/api.cc b/src/api.cc
index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ededb6a30a 100644
index 9be405b6c4822da81e48daf96169450be3e4356f..f34a63cb528ea619896957009922b0a0ee576616 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2161,6 +2161,10 @@ int PrimitiveArray::Length() const {
@@ -2162,6 +2162,10 @@ int PrimitiveArray::Length() const {
return array->length();
}
@ -189,7 +189,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
void PrimitiveArray::Set(Isolate* v8_isolate, int index,
Local<Primitive> item) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@@ -2174,6 +2178,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
@@ -2175,6 +2179,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
array->set(index, *i_item);
}
@ -200,7 +200,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
@@ -2904,6 +2912,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
@@ -2909,6 +2917,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
// --- S t a c k T r a c e ---
@ -211,7 +211,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
uint32_t index) const {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@@ -3880,6 +3892,36 @@ void v8::RegExp::CheckCast(v8::Value* that) {
@@ -3888,6 +3900,36 @@ void v8::RegExp::CheckCast(v8::Value* that) {
}
@ -248,7 +248,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
Maybe<bool> Value::BooleanValue(Local<Context> context) const {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
return Just(Utils::OpenHandle(this)->BooleanValue(isolate));
@@ -3968,6 +4010,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
@@ -3976,6 +4018,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
}
@ -261,7 +261,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const {
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
auto self = Utils::OpenHandle(this);
@@ -5299,6 +5347,10 @@ bool String::ContainsOnlyOneByte() const {
@@ -5312,6 +5360,10 @@ bool String::ContainsOnlyOneByte() const {
return helper.Check(*str);
}
@ -272,7 +272,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
int String::Utf8Length(Isolate* isolate) const {
i::Handle<i::String> str = Utils::OpenHandle(this);
str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
@@ -5522,6 +5574,14 @@ static bool RecursivelySerializeToUtf8(i::String* current,
@@ -5535,6 +5587,14 @@ static bool RecursivelySerializeToUtf8(i::String* current,
return true;
}
@ -287,7 +287,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
int* nchars_ref, int options) const {
i::Handle<i::String> str = Utils::OpenHandle(this);
@@ -5589,6 +5649,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
@@ -5602,6 +5662,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
}
@ -306,7 +306,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
int length, int options) const {
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
@@ -6536,6 +6608,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
@@ -6549,6 +6621,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
return result;
}
@ -318,7 +318,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
Local<String> right) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@@ -6762,6 +6839,11 @@ bool v8::BooleanObject::ValueOf() const {
@@ -6774,6 +6851,11 @@ bool v8::BooleanObject::ValueOf() const {
}
@ -330,7 +330,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
Local<String> value) {
i::Handle<i::String> string = Utils::OpenHandle(*value);
@@ -8904,6 +8986,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8Isolate) {
@@ -8915,6 +8997,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8Isolate) {
return isolate->IsRunningMicrotasks();
}
@ -340,7 +340,7 @@ index 7a53cc1370cf30c858fd87156e2eb75d4b57a60b..bc544f1c7c7f9f8e3bac9804697848ed
String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
: str_(nullptr), length_(0) {
if (obj.IsEmpty()) return;
@@ -8923,6 +9008,9 @@ String::Utf8Value::~Utf8Value() {
@@ -8934,6 +9019,9 @@ String::Utf8Value::~Utf8Value() {
i::DeleteArray(str_);
}

View file

@ -1,409 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Anna Henningsen <anna@addaleax.net>
Date: Thu, 4 Oct 2018 14:38:59 -0700
Subject: deps: revert 9136dd8088a9 from upstream V8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reverting this enables us to provide slower, but longer-lasting
replacements for the deprecated APIs.
Original commit message:
Put back deleted V8_DEPRECATE_SOON methods
This partially reverts
https://chromium-review.googlesource.com/c/v8/v8/+/1177861,
which deleted many V8_DEPRECATE_SOON methods rather than moving them to
V8_DEPRECATED first. This puts them back and marks them V8_DEPRECATED.
Note V8_DEPRECATED that were deleted in the same CL stay deleted.
NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true
Bug: v8:7786, v8:8240
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I00330036d957f98dab403465b25e30d8382aac22
Reviewed-on: https://chromium-review.googlesource.com/1251422
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Michael Hablich <hablich@chromium.org>
Cr-Commit-Position: refs/branch-heads/7.0@{#49}
Cr-Branched-From: 6e2adae6f7f8e891cfd01f3280482b20590427a6-refs/heads/7.0.276@{#1}
Cr-Branched-From: bc08a8624cbbea7a2d30071472bc73ad9544eadf-refs/heads/master@{#55424}
Refs: https://github.com/v8/v8/commit/9136dd8088a95484b059a0301b25235510fc2882
Refs: https://github.com/nodejs/node/issues/23122
PR-URL: https://github.com/nodejs/node/pull/23158
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
diff --git a/include/v8.h b/include/v8.h
index 3070f4aa50eed8722805feaf8d9b9db0d68fbbbf..784e1830edeebaf2b15eaad4230f318f91acad5f 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1125,10 +1125,6 @@ class V8_EXPORT PrimitiveArray {
int Length() const;
void Set(Isolate* isolate, int index, Local<Primitive> item);
Local<Primitive> Get(Isolate* isolate, int index);
-
- V8_DEPRECATED("Use Isolate version",
- void Set(int index, Local<Primitive> item));
- V8_DEPRECATED("Use Isolate version", Local<Primitive> Get(int index));
};
/**
@@ -1833,8 +1829,6 @@ class V8_EXPORT StackTrace {
/**
* Returns a StackFrame at a particular index.
*/
- V8_DEPRECATED("Use Isolate version",
- Local<StackFrame> GetFrame(uint32_t index) const);
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
/**
@@ -2543,11 +2537,6 @@ class V8_EXPORT Value : public Data {
V8_DEPRECATE_SOON("Use maybe version",
Local<Int32> ToInt32(Isolate* isolate) const);
- inline V8_DEPRECATED("Use maybe version", Local<Boolean> ToBoolean() const);
- inline V8_DEPRECATED("Use maybe version", Local<String> ToString() const);
- inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
- inline V8_DEPRECATED("Use maybe version", Local<Integer> ToInteger() const);
-
/**
* Attempts to convert a string to an array index.
* Returns an empty handle if the conversion fails.
@@ -2563,14 +2552,7 @@ class V8_EXPORT Value : public Data {
Local<Context> context) const;
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
- V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
- V8_DEPRECATED("Use maybe version", double NumberValue() const);
- V8_DEPRECATED("Use maybe version", int64_t IntegerValue() const);
- V8_DEPRECATED("Use maybe version", uint32_t Uint32Value() const);
- V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
-
/** JS == */
- V8_DEPRECATED("Use maybe version", bool Equals(Local<Value> that) const);
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
Local<Value> that) const;
bool StrictEquals(Local<Value> that) const;
@@ -2677,8 +2659,6 @@ class V8_EXPORT String : public Name {
* Returns the number of bytes in the UTF-8 encoded
* representation of this string.
*/
- V8_DEPRECATED("Use Isolate version instead", int Utf8Length() const);
-
int Utf8Length(Isolate* isolate) const;
/**
@@ -2735,23 +2715,12 @@ class V8_EXPORT String : public Name {
// 16-bit character codes.
int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
int options = NO_OPTIONS) const;
- V8_DEPRECATED("Use Isolate* version",
- int Write(uint16_t* buffer, int start = 0, int length = -1,
- int options = NO_OPTIONS) const);
// One byte characters.
int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0,
int length = -1, int options = NO_OPTIONS) const;
- V8_DEPRECATED("Use Isolate* version",
- int WriteOneByte(uint8_t* buffer, int start = 0,
- int length = -1, int options = NO_OPTIONS)
- const);
// UTF-8 encoded characters.
int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
int* nchars_ref = NULL, int options = NO_OPTIONS) const;
- V8_DEPRECATED("Use Isolate* version",
- int WriteUtf8(char* buffer, int length = -1,
- int* nchars_ref = NULL, int options = NO_OPTIONS)
- const);
/**
* A zero length string.
@@ -2915,9 +2884,6 @@ class V8_EXPORT String : public Name {
*/
static Local<String> Concat(Isolate* isolate, Local<String> left,
Local<String> right);
- static V8_DEPRECATED("Use Isolate* version",
- Local<String> Concat(Local<String> left,
- Local<String> right));
/**
* Creates a new external string using the data defined in the given
@@ -5258,8 +5224,6 @@ class V8_EXPORT BooleanObject : public Object {
class V8_EXPORT StringObject : public Object {
public:
static Local<Value> New(Isolate* isolate, Local<String> value);
- static V8_DEPRECATED("Use Isolate* version",
- Local<Value> New(Local<String> value));
Local<String> ValueOf() const;
@@ -10261,25 +10225,6 @@ template <class T> Value* Value::Cast(T* value) {
return static_cast<Value*>(value);
}
-Local<Boolean> Value::ToBoolean() const {
- return ToBoolean(Isolate::GetCurrent()->GetCurrentContext())
- .FromMaybe(Local<Boolean>());
-}
-
-Local<String> Value::ToString() const {
- return ToString(Isolate::GetCurrent()->GetCurrentContext())
- .FromMaybe(Local<String>());
-}
-
-Local<Object> Value::ToObject() const {
- return ToObject(Isolate::GetCurrent()->GetCurrentContext())
- .FromMaybe(Local<Object>());
-}
-
-Local<Integer> Value::ToInteger() const {
- return ToInteger(Isolate::GetCurrent()->GetCurrentContext())
- .FromMaybe(Local<Integer>());
-}
Boolean* Boolean::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
diff --git a/src/api.cc b/src/api.cc
index 8dca7ec88e59c775da5cf7e30721d064f349c634..7a53cc1370cf30c858fd87156e2eb75d4b57a60b 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -219,28 +219,6 @@ Local<Context> ContextFromNeverReadOnlySpaceObject(
return reinterpret_cast<v8::Isolate*>(obj->GetIsolate())->GetCurrentContext();
}
-// TODO(delphick): Remove this completely when the deprecated functions that use
-// it are removed.
-// DO NOT USE THIS IN NEW CODE!
-i::Isolate* UnsafeIsolateFromHeapObject(i::Handle<i::HeapObject> obj) {
- // Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to
- // temporarily allow isolate access from read-only space objects.
- i::MemoryChunk* chunk = i::MemoryChunk::FromHeapObject(*obj);
- return chunk->heap()->isolate();
-}
-
-// TODO(delphick): Remove this completely when the deprecated functions that use
-// it are removed.
-// DO NOT USE THIS IN NEW CODE!
-Local<Context> UnsafeContextFromHeapObject(i::Handle<i::Object> obj) {
- // Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to
- // temporarily allow isolate access from read-only space objects.
- i::MemoryChunk* chunk =
- i::MemoryChunk::FromHeapObject(i::HeapObject::cast(*obj));
- return reinterpret_cast<Isolate*>(chunk->heap()->isolate())
- ->GetCurrentContext();
-}
-
class InternalEscapableScope : public v8::EscapableHandleScope {
public:
explicit inline InternalEscapableScope(i::Isolate* isolate)
@@ -2196,12 +2174,6 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
array->set(index, *i_item);
}
-void PrimitiveArray::Set(int index, Local<Primitive> item) {
- i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
- i::Isolate* isolate = UnsafeIsolateFromHeapObject(array);
- Set(reinterpret_cast<Isolate*>(isolate), index, item);
-}
-
Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
@@ -2214,12 +2186,6 @@ Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
return ToApiHandle<Primitive>(i_item);
}
-Local<Primitive> PrimitiveArray::Get(int index) {
- i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
- i::Isolate* isolate = UnsafeIsolateFromHeapObject(array);
- return Get(reinterpret_cast<Isolate*>(isolate), index);
-}
-
Module::Status Module::GetStatus() const {
i::Handle<i::Module> self = Utils::OpenHandle(this);
switch (self->status()) {
@@ -2948,11 +2914,6 @@ Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
return scope.Escape(Utils::StackFrameToLocal(info));
}
-Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
- i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
- return GetFrame(reinterpret_cast<Isolate*>(isolate), index);
-}
-
int StackTrace::GetFrameCount() const {
return Utils::OpenHandle(this)->length();
}
@@ -3924,14 +3885,6 @@ Maybe<bool> Value::BooleanValue(Local<Context> context) const {
return Just(Utils::OpenHandle(this)->BooleanValue(isolate));
}
-bool Value::BooleanValue() const {
- auto obj = Utils::OpenHandle(this);
- if (obj->IsSmi()) return *obj != i::Smi::kZero;
- DCHECK(obj->IsHeapObject());
- i::Isolate* isolate =
- UnsafeIsolateFromHeapObject(i::Handle<i::HeapObject>::cast(obj));
- return obj->BooleanValue(isolate);
-}
Maybe<double> Value::NumberValue(Local<Context> context) const {
auto obj = Utils::OpenHandle(this);
@@ -3945,12 +3898,6 @@ Maybe<double> Value::NumberValue(Local<Context> context) const {
return Just(num->Number());
}
-double Value::NumberValue() const {
- auto obj = Utils::OpenHandle(this);
- if (obj->IsNumber()) return obj->Number();
- return NumberValue(UnsafeContextFromHeapObject(obj))
- .FromMaybe(std::numeric_limits<double>::quiet_NaN());
-}
Maybe<int64_t> Value::IntegerValue(Local<Context> context) const {
auto obj = Utils::OpenHandle(this);
@@ -3966,17 +3913,6 @@ Maybe<int64_t> Value::IntegerValue(Local<Context> context) const {
return Just(NumberToInt64(*num));
}
-int64_t Value::IntegerValue() const {
- auto obj = Utils::OpenHandle(this);
- if (obj->IsNumber()) {
- if (obj->IsSmi()) {
- return i::Smi::ToInt(*obj);
- } else {
- return static_cast<int64_t>(obj->Number());
- }
- }
- return IntegerValue(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
-}
Maybe<int32_t> Value::Int32Value(Local<Context> context) const {
auto obj = Utils::OpenHandle(this);
@@ -3991,11 +3927,6 @@ Maybe<int32_t> Value::Int32Value(Local<Context> context) const {
: static_cast<int32_t>(num->Number()));
}
-int32_t Value::Int32Value() const {
- auto obj = Utils::OpenHandle(this);
- if (obj->IsNumber()) return NumberToInt32(*obj);
- return Int32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
-}
Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const {
auto obj = Utils::OpenHandle(this);
@@ -4010,11 +3941,6 @@ Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const {
: static_cast<uint32_t>(num->Number()));
}
-uint32_t Value::Uint32Value() const {
- auto obj = Utils::OpenHandle(this);
- if (obj->IsNumber()) return NumberToUint32(*obj);
- return Uint32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
-}
MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
auto self = Utils::OpenHandle(this);
@@ -4049,19 +3975,6 @@ Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const {
return i::Object::Equals(isolate, self, other);
}
-bool Value::Equals(Local<Value> that) const {
- auto self = Utils::OpenHandle(this);
- auto other = Utils::OpenHandle(*that);
- if (self->IsSmi() && other->IsSmi()) {
- return self->Number() == other->Number();
- }
- if (self->IsJSObject() && other->IsJSObject()) {
- return *self == *other;
- }
- auto heap_object = self->IsSmi() ? other : self;
- auto context = UnsafeContextFromHeapObject(heap_object);
- return Equals(context, that).FromMaybe(false);
-}
bool Value::StrictEquals(Local<Value> that) const {
auto self = Utils::OpenHandle(this);
@@ -5386,11 +5299,6 @@ bool String::ContainsOnlyOneByte() const {
return helper.Check(*str);
}
-int String::Utf8Length() const {
- i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
- return Utf8Length(reinterpret_cast<Isolate*>(isolate));
-}
-
int String::Utf8Length(Isolate* isolate) const {
i::Handle<i::String> str = Utils::OpenHandle(this);
str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
@@ -5659,14 +5567,6 @@ int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
return writer.CompleteWrite(write_null, nchars_ref);
}
-int String::WriteUtf8(char* buffer, int capacity, int* nchars_ref,
- int options) const {
- i::Handle<i::String> str = Utils::OpenHandle(this);
- i::Isolate* isolate = UnsafeIsolateFromHeapObject(str);
- return WriteUtf8(reinterpret_cast<Isolate*>(isolate), buffer, capacity,
- nchars_ref, options);
-}
-
template <typename CharType>
static inline int WriteHelper(i::Isolate* isolate, const String* string,
CharType* buffer, int start, int length,
@@ -5688,11 +5588,6 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
return end - start;
}
-int String::WriteOneByte(uint8_t* buffer, int start, int length,
- int options) const {
- i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
- return WriteHelper(isolate, this, buffer, start, length, options);
-}
int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
int length, int options) const {
@@ -5700,10 +5595,6 @@ int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
start, length, options);
}
-int String::Write(uint16_t* buffer, int start, int length, int options) const {
- i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
- return WriteHelper(isolate, this, buffer, start, length, options);
-}
int String::Write(Isolate* isolate, uint16_t* buffer, int start, int length,
int options) const {
@@ -6662,12 +6553,6 @@ Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
return Utils::ToLocal(result);
}
-Local<String> v8::String::Concat(Local<String> left, Local<String> right) {
- i::Handle<i::String> left_string = Utils::OpenHandle(*left);
- i::Isolate* isolate = UnsafeIsolateFromHeapObject(left_string);
- return Concat(reinterpret_cast<Isolate*>(isolate), left, right);
-}
-
MaybeLocal<String> v8::String::NewExternalTwoByte(
Isolate* isolate, v8::String::ExternalStringResource* resource) {
CHECK(resource && resource->data());
@@ -6876,11 +6761,6 @@ bool v8::BooleanObject::ValueOf() const {
return jsvalue->value()->IsTrue(isolate);
}
-Local<v8::Value> v8::StringObject::New(Local<String> value) {
- i::Handle<i::String> string = Utils::OpenHandle(*value);
- i::Isolate* isolate = UnsafeIsolateFromHeapObject(string);
- return New(reinterpret_cast<Isolate*>(isolate), value);
-}
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
Local<String> value) {

View file

@ -4,16 +4,16 @@ Date: Mon, 19 Nov 2018 18:33:56 -0500
Subject: Do not run arm/arm64 mksnapshot binaries
For arm and arm64 target_arches, Chromium builds mksnapshot as an x64 binary and
as part of that build mksnapshot is executed to produce snapshot_blob.bin.
Chromium does not build native arm and arm64 binaries of mksnapshot, but
Electron does, so this patch makes sure that the build doesn't try to run
as part of that build mksnapshot is executed to produce snapshot_blob.bin.
Chromium does not build native arm and arm64 binaries of mksnapshot, but
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.
diff --git a/BUILD.gn b/BUILD.gn
index b1194e4b828e66d8d09fac57481efe313031f3ac..c256945650c24324c28a2e17fb299a1d0c2dcd19 100644
index 1f9dd022ac804e58263f527af5a47768c882de40..d40848056235b9a8307533c8b1e238aecf18207d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1247,9 +1247,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) {
@@ -1286,9 +1286,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) {
]
public_deps = [
":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
diff --git a/include/v8-platform.h b/include/v8-platform.h
index cfeb13b65829f9e0bad2518b8c4b03a645b6223c..2b38e24e233b5ba7061fd4a3d5e49063b0165f11 100644
index d983c30249591bd05b760dbae6a1afb413c7d021..183d77e55619970644868747fab26d250f790c3c 100644
--- a/include/v8-platform.h
+++ b/include/v8-platform.h
@@ -11,6 +11,7 @@
@ -17,7 +17,7 @@ index cfeb13b65829f9e0bad2518b8c4b03a645b6223c..2b38e24e233b5ba7061fd4a3d5e49063
#include "v8config.h" // NOLINT(build/include)
namespace v8 {
@@ -387,7 +388,7 @@ class Platform {
@@ -394,7 +395,7 @@ class Platform {
* since epoch. Useful for implementing |CurrentClockTimeMillis| if
* nothing special needed.
*/

View file

@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch
Needed in order to build mksnapshot on arm.
diff --git a/BUILD.gn b/BUILD.gn
index ac74cdec115b6cc54d05817f063153628cf5e9fe..c1b08958b500da1910a8067198cdec7650534f20 100644
index 5489b943f1d8bb8ffc02cabf4e0a15788c7d4e48..1f9dd022ac804e58263f527af5a47768c882de40 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -3237,8 +3237,6 @@ if (v8_monolithic) {
@@ -3355,8 +3355,6 @@ if (current_toolchain == v8_generator_toolchain) {
if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
v8_executable("mksnapshot") {

View file

@ -5,10 +5,10 @@ Subject: ostreams.patch
diff --git a/src/ostreams.h b/src/ostreams.h
index c6b64a1cd95b92ed37abe56d71dd6132c4ff9db4..236a73d01800f58a4f37c8abdd8df346d8fcf2c5 100644
index 189f5384b99438f3dad1d77a0836ceb45f6ed938..83a5930d4bd690dde01749bcd88acb11d75aa0cb 100644
--- a/src/ostreams.h
+++ b/src/ostreams.h
@@ -32,7 +32,7 @@ class OFStreamBase : public std::streambuf {
@@ -32,7 +32,7 @@ class V8_EXPORT_PRIVATE OFStreamBase : public std::streambuf {
};
// An output stream writing to a file.
@ -16,4 +16,4 @@ index c6b64a1cd95b92ed37abe56d71dd6132c4ff9db4..236a73d01800f58a4f37c8abdd8df346
+class V8_EXPORT_PRIVATE OFStream : public NON_EXPORTED_BASE(std::ostream) {
public:
explicit OFStream(FILE* f);
virtual ~OFStream();
~OFStream() override = default;