chore: update patches/common/v8
This commit is contained in:
parent
3f75724a31
commit
e517139e3c
13 changed files with 55 additions and 1034 deletions
|
@ -3,10 +3,8 @@ add_realloc.patch
|
||||||
build_gn.patch
|
build_gn.patch
|
||||||
array_buffer.patch
|
array_buffer.patch
|
||||||
export_platform.patch
|
export_platform.patch
|
||||||
dcheck.patch
|
|
||||||
expose_mksnapshot.patch
|
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
|
||||||
reland_don_t_use_v8_initializers_code_in_v8_base.patch
|
|
||||||
deps_provide_more_v8_backwards_compatibility.patch
|
deps_provide_more_v8_backwards_compatibility.patch
|
||||||
deps_cherry-pick_88f8fe1_from_upstream_v8.patch
|
dcheck.patch
|
||||||
|
|
|
@ -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 03677d7af202d665c704dd771603322321b508cc..83b9d3d0d1f981edc444452b500df9fa5b89a056 100644
|
index dd81ef81e3c0df11f5cac7a4c934b0a04e9de003..4b8fb04bc8210c0273157009b3560983b1322b18 100644
|
||||||
--- a/include/v8.h
|
--- a/include/v8.h
|
||||||
+++ b/include/v8.h
|
+++ b/include/v8.h
|
||||||
@@ -4526,6 +4526,13 @@ class V8_EXPORT ArrayBuffer : public Object {
|
@@ -4604,6 +4604,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 03677d7af202d665c704dd771603322321b508cc..83b9d3d0d1f981edc444452b500df9fa
|
||||||
* 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 1d993044db4a969209a90c1b1f9e88d82531a538..9ddef27b9f7004fb50290f0dd91d2994d9771466 100644
|
index 634ad37115faa1795a20155ed0faf51421eb1543..56be5e2e007c0ea84653a5487abef49cc206efc3 100644
|
||||||
--- a/src/api.cc
|
--- a/src/api.cc
|
||||||
+++ b/src/api.cc
|
+++ b/src/api.cc
|
||||||
@@ -507,6 +507,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
|
@@ -512,6 +512,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
|
||||||
i::V8::SetSnapshotBlob(snapshot_blob);
|
i::V8::SetSnapshotBlob(snapshot_blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 83b9d3d0d1f981edc444452b500df9fa5b89a056..6ebadc3b85b0f954305bc3a9187b996aa248a347 100644
|
index 4b8fb04bc8210c0273157009b3560983b1322b18..f10a7950de2166804f779346bce580cfb2e7c3ec 100644
|
||||||
--- a/include/v8.h
|
--- a/include/v8.h
|
||||||
+++ b/include/v8.h
|
+++ b/include/v8.h
|
||||||
@@ -7661,6 +7661,9 @@ class V8_EXPORT Isolate {
|
@@ -7701,6 +7701,9 @@ class V8_EXPORT Isolate {
|
||||||
*/
|
*/
|
||||||
void SetIdle(bool is_idle);
|
void SetIdle(bool is_idle);
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@ index 83b9d3d0d1f981edc444452b500df9fa5b89a056..6ebadc3b85b0f954305bc3a9187b996a
|
||||||
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 9ddef27b9f7004fb50290f0dd91d2994d9771466..b4a0f5bb5e484ea80dbfc234e207b44413f2d22f 100644
|
index 56be5e2e007c0ea84653a5487abef49cc206efc3..dd22b2a30b632fb9507eb2e2b95837dd9b8810db 100644
|
||||||
--- a/src/api.cc
|
--- a/src/api.cc
|
||||||
+++ b/src/api.cc
|
+++ b/src/api.cc
|
||||||
@@ -8072,6 +8072,13 @@ void Isolate::SetIdle(bool is_idle) {
|
@@ -7966,6 +7966,13 @@ void Isolate::SetIdle(bool is_idle) {
|
||||||
isolate->SetIdle(is_idle);
|
isolate->SetIdle(is_idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ 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 b47a698a2f41f221290861c938c15a38e34d7b00..c564baea42f22d727990752be8b4ed086ef273f2 100644
|
index 2f8a6c932efb66c5e273b9e9d2dc5887db8c6265..698b6c827f7f3cd7dc6871156daf8467bc7ff605 100644
|
||||||
--- a/BUILD.gn
|
--- a/BUILD.gn
|
||||||
+++ b/BUILD.gn
|
+++ b/BUILD.gn
|
||||||
@@ -190,7 +190,8 @@ declare_args() {
|
@@ -184,7 +184,8 @@ declare_args() {
|
||||||
|
|
||||||
v8_generator_toolchain = v8_snapshot_toolchain
|
v8_generator_toolchain = v8_snapshot_toolchain
|
||||||
if (host_cpu == "x64" &&
|
if (host_cpu == "x64" &&
|
||||||
|
@ -19,7 +19,7 @@ index b47a698a2f41f221290861c938c15a38e34d7b00..c564baea42f22d727990752be8b4ed08
|
||||||
v8_generator_toolchain = "//build/toolchain/linux:clang_x64"
|
v8_generator_toolchain = "//build/toolchain/linux:clang_x64"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3446,7 +3447,7 @@ if (v8_monolithic) {
|
@@ -3354,7 +3355,7 @@ if (v8_monolithic) {
|
||||||
# Executables
|
# Executables
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ index b47a698a2f41f221290861c938c15a38e34d7b00..c564baea42f22d727990752be8b4ed08
|
||||||
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.
|
||||||
|
|
||||||
@@ -3492,7 +3493,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
|
@@ -3404,7 +3405,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ Subject: build_gn.patch
|
||||||
|
|
||||||
|
|
||||||
diff --git a/BUILD.gn b/BUILD.gn
|
diff --git a/BUILD.gn b/BUILD.gn
|
||||||
index 3c039428271d6598fc4ad7137334176d80b92631..9fe1e8d67a25955fea69be89e0bcc27cf5d8529d 100644
|
index bdbb29c66b2fa82e8a942421a8bdfce3d94d6e8f..fb3cfe848e97e0952829e39db5b56571e993d6a2 100644
|
||||||
--- a/BUILD.gn
|
--- a/BUILD.gn
|
||||||
+++ b/BUILD.gn
|
+++ b/BUILD.gn
|
||||||
@@ -242,7 +242,7 @@ config("internal_config") {
|
@@ -236,7 +236,7 @@ config("internal_config") {
|
||||||
|
|
||||||
configs = [ "//build/config/compiler:wexit_time_destructors" ]
|
configs = [ "//build/config/compiler:wexit_time_destructors" ]
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ index 3c039428271d6598fc4ad7137334176d80b92631..9fe1e8d67a25955fea69be89e0bcc27c
|
||||||
defines = [ "BUILDING_V8_SHARED" ]
|
defines = [ "BUILDING_V8_SHARED" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3481,6 +3481,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
|
@@ -3389,6 +3389,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
|
||||||
|
|
||||||
configs = [ ":internal_config" ]
|
configs = [ ":internal_config" ]
|
||||||
|
|
||||||
|
|
|
@ -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 b4a0f5bb5e484ea80dbfc234e207b44413f2d22f..f36e504161fed27392ef66ffc0ec87898958bf2d 100644
|
index b23105badb1ce643b0d3dcf6716776c53af4dfec..1df0e8a1dd8b7d490c215fb0a65b7a89aefdc231 100644
|
||||||
--- a/src/api.cc
|
--- a/src/api.cc
|
||||||
+++ b/src/api.cc
|
+++ b/src/api.cc
|
||||||
@@ -8637,7 +8637,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
|
@@ -8613,7 +8613,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
|
||||||
|
|
||||||
|
|
||||||
void Isolate::RunMicrotasks() {
|
void Isolate::RunMicrotasks() {
|
||||||
|
@ -18,10 +18,10 @@ index b4a0f5bb5e484ea80dbfc234e207b44413f2d22f..f36e504161fed27392ef66ffc0ec8789
|
||||||
}
|
}
|
||||||
|
|
||||||
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 98a3ec8cbcf63f1446569d6458d1f4f4bdda2ca0..316b0e123af68ea0c7a50730ba04470a42918974 100644
|
index ed1bb91037677a25a8b22a7096a100f7f1cd4d1b..2ca299a96a66c000b4ff2061f283c31f906846b7 100644
|
||||||
--- a/src/heap/heap.cc
|
--- a/src/heap/heap.cc
|
||||||
+++ b/src/heap/heap.cc
|
+++ b/src/heap/heap.cc
|
||||||
@@ -4723,9 +4723,9 @@ void Heap::TearDown() {
|
@@ -4710,9 +4710,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);
|
||||||
|
|
|
@ -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 add6d1f4114118b199425ff6b835a286ade5e1ce..38f25aef81c026cd80d663d75250ce16034e3eb3 100644
|
index e0d486feb1da25db98faa4222f014d79d9bc37e2..26798147f40e35f3496ceebd225f2de0fd105296 100644
|
||||||
--- a/src/flag-definitions.h
|
--- a/src/flag-definitions.h
|
||||||
+++ b/src/flag-definitions.h
|
+++ b/src/flag-definitions.h
|
||||||
@@ -1270,7 +1270,7 @@ DEFINE_BOOL(log_function_events, false,
|
@@ -1276,7 +1276,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).")
|
||||||
|
|
||||||
|
|
|
@ -1,258 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Yang Guo <yangguo@chromium.org>
|
|
||||||
Date: Tue, 20 Nov 2018 08:59:38 +0100
|
|
||||||
Subject: 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>
|
|
||||||
|
|
||||||
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
|
||||||
index b49202d6127083e1d642f39ec149ce2261061ea7..dd56f7cd985db38820c94fd41b2f7f24a01e1811 100644
|
|
||||||
--- a/test/cctest/test-api.cc
|
|
||||||
+++ b/test/cctest/test-api.cc
|
|
||||||
@@ -29364,3 +29364,217 @@ TEST(PreviewMapIteratorEntriesWithDeleted) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+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());
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
|
@ -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 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720a93d08b2 100644
|
index f10a7950de2166804f779346bce580cfb2e7c3ec..44c2e648baa708d7f30105504795e4ba5402e3b3 100644
|
||||||
--- a/include/v8.h
|
--- a/include/v8.h
|
||||||
+++ b/include/v8.h
|
+++ b/include/v8.h
|
||||||
@@ -998,6 +998,10 @@ class V8_EXPORT PrimitiveArray {
|
@@ -994,6 +994,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 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
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);
|
||||||
};
|
};
|
||||||
@@ -1705,6 +1709,8 @@ class V8_EXPORT StackTrace {
|
@@ -1697,6 +1701,8 @@ class V8_EXPORT StackTrace {
|
||||||
/**
|
/**
|
||||||
* Returns a StackFrame at a particular index.
|
* Returns a StackFrame at a particular index.
|
||||||
*/
|
*/
|
||||||
|
@ -45,7 +45,7 @@ index 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
|
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2428,6 +2434,13 @@ class V8_EXPORT Value : public Data {
|
@@ -2405,6 +2411,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 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
@@ -2447,7 +2460,14 @@ class V8_EXPORT Value : public Data {
|
@@ -2424,7 +2437,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 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
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;
|
||||||
@@ -2554,6 +2574,8 @@ class V8_EXPORT String : public Name {
|
@@ -2531,6 +2551,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 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
int Utf8Length(Isolate* isolate) const;
|
int Utf8Length(Isolate* isolate) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2610,12 +2632,23 @@ class V8_EXPORT String : public Name {
|
@@ -2587,12 +2609,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 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A zero length string.
|
* A zero length string.
|
||||||
@@ -2807,6 +2840,9 @@ class V8_EXPORT String : public Name {
|
@@ -2784,6 +2817,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 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new external string using the data defined in the given
|
* Creates a new external string using the data defined in the given
|
||||||
@@ -2875,6 +2911,8 @@ class V8_EXPORT String : public Name {
|
@@ -2852,6 +2888,8 @@ class V8_EXPORT String : public Name {
|
||||||
*/
|
*/
|
||||||
class V8_EXPORT Utf8Value {
|
class V8_EXPORT Utf8Value {
|
||||||
public:
|
public:
|
||||||
|
@ -126,7 +126,7 @@ index 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
|
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
|
||||||
~Utf8Value();
|
~Utf8Value();
|
||||||
char* operator*() { return str_; }
|
char* operator*() { return str_; }
|
||||||
@@ -2898,6 +2936,7 @@ class V8_EXPORT String : public Name {
|
@@ -2875,6 +2913,7 @@ class V8_EXPORT String : public Name {
|
||||||
*/
|
*/
|
||||||
class V8_EXPORT Value {
|
class V8_EXPORT Value {
|
||||||
public:
|
public:
|
||||||
|
@ -134,7 +134,7 @@ index 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
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_; }
|
||||||
@@ -5180,6 +5219,8 @@ class V8_EXPORT BooleanObject : public Object {
|
@@ -5265,6 +5304,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 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
|
|
||||||
Local<String> ValueOf() const;
|
Local<String> ValueOf() const;
|
||||||
|
|
||||||
@@ -10045,6 +10086,30 @@ template <class T> Value* Value::Cast(T* value) {
|
@@ -10103,6 +10144,30 @@ template <class T> Value* Value::Cast(T* value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,10 +175,10 @@ index 6ebadc3b85b0f954305bc3a9187b996aa248a347..955ea03cddf77ae5bbd91ea74b851720
|
||||||
#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 f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7d892d0cc 100644
|
index dd22b2a30b632fb9507eb2e2b95837dd9b8810db..b23105badb1ce643b0d3dcf6716776c53af4dfec 100644
|
||||||
--- a/src/api.cc
|
--- a/src/api.cc
|
||||||
+++ b/src/api.cc
|
+++ b/src/api.cc
|
||||||
@@ -2167,6 +2167,10 @@ int PrimitiveArray::Length() const {
|
@@ -2181,6 +2181,10 @@ int PrimitiveArray::Length() const {
|
||||||
return array->length();
|
return array->length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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);
|
||||||
@@ -2180,6 +2184,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
|
@@ -2194,6 +2198,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
|
||||||
array->set(index, *i_item);
|
array->set(index, *i_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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);
|
||||||
@@ -2901,6 +2909,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
|
@@ -2899,6 +2907,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 f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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);
|
||||||
@@ -3880,6 +3892,36 @@ void v8::RegExp::CheckCast(v8::Value* that) {
|
@@ -3858,6 +3870,36 @@ void v8::RegExp::CheckCast(v8::Value* that) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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));
|
||||||
@@ -3968,6 +4010,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
|
@@ -3946,6 +3988,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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);
|
||||||
@@ -5302,6 +5350,10 @@ bool String::ContainsOnlyOneByte() const {
|
@@ -5269,6 +5317,10 @@ bool String::ContainsOnlyOneByte() const {
|
||||||
return helper.Check(*str);
|
return helper.Check(*str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,9 +272,9 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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);
|
||||||
@@ -5525,6 +5577,14 @@ static bool RecursivelySerializeToUtf8(i::String current,
|
@@ -5421,6 +5473,14 @@ static int WriteUtf8Impl(i::Vector<const Char> string, char* write_start,
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
+
|
+
|
||||||
+int String::WriteUtf8(char* buffer, int capacity,
|
+int String::WriteUtf8(char* buffer, int capacity,
|
||||||
|
@ -287,7 +287,7 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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);
|
||||||
@@ -5592,6 +5652,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
|
@@ -5461,6 +5521,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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,
|
||||||
@@ -6553,6 +6625,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
|
@@ -6430,6 +6502,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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);
|
||||||
@@ -6841,6 +6918,11 @@ bool v8::BooleanObject::ValueOf() const {
|
@@ -6713,6 +6790,11 @@ bool v8::BooleanObject::ValueOf() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -330,8 +330,8 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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);
|
||||||
@@ -9024,6 +9106,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8Isolate) {
|
@@ -8919,6 +9001,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8Isolate) {
|
||||||
return isolate->IsRunningMicrotasks();
|
return isolate->default_microtask_queue()->IsRunningMicrotasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
+String::Utf8Value::Utf8Value(v8::Local<v8::Value> obj)
|
+String::Utf8Value::Utf8Value(v8::Local<v8::Value> obj)
|
||||||
|
@ -340,7 +340,7 @@ index f36e504161fed27392ef66ffc0ec87898958bf2d..0f2e56c05736d15bc637feb9fb53bdc7
|
||||||
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;
|
||||||
@@ -9043,6 +9128,9 @@ String::Utf8Value::~Utf8Value() {
|
@@ -8938,6 +9023,9 @@ String::Utf8Value::~Utf8Value() {
|
||||||
i::DeleteArray(str_);
|
i::DeleteArray(str_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 c564baea42f22d727990752be8b4ed086ef273f2..e3c8390c299e4c12e4ddba8402ccdb050e7bb6f1 100644
|
index 698b6c827f7f3cd7dc6871156daf8467bc7ff605..022c55b3fe32bbde57e97f08ab2c374cc1ea047a 100644
|
||||||
--- a/BUILD.gn
|
--- a/BUILD.gn
|
||||||
+++ b/BUILD.gn
|
+++ b/BUILD.gn
|
||||||
@@ -1349,9 +1349,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) {
|
@@ -1240,9 +1240,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) {
|
||||||
]
|
]
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":natives_blob",
|
":natives_blob",
|
||||||
|
|
|
@ -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 b9b0363a426de898c7db29a341f7179c45706f0a..48fba7921fd17eec79c569ab3c9173f084743218 100644
|
index fc008979f69210d5e627ea735146f66c36703f43..4c097f2f06d766854c92fdbe487166e034d838b1 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 b9b0363a426de898c7db29a341f7179c45706f0a..48fba7921fd17eec79c569ab3c9173f0
|
||||||
#include "v8config.h" // NOLINT(build/include)
|
#include "v8config.h" // NOLINT(build/include)
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
@@ -421,7 +422,7 @@ class Platform {
|
@@ -430,7 +431,7 @@ class Platform {
|
||||||
* since epoch. Useful for implementing |CurrentClockTimeMillis| if
|
* since epoch. Useful for implementing |CurrentClockTimeMillis| if
|
||||||
* nothing special needed.
|
* nothing special needed.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,10 +6,10 @@ 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 9fe1e8d67a25955fea69be89e0bcc27cf5d8529d..b47a698a2f41f221290861c938c15a38e34d7b00 100644
|
index fb3cfe848e97e0952829e39db5b56571e993d6a2..2f8a6c932efb66c5e273b9e9d2dc5887db8c6265 100644
|
||||||
--- a/BUILD.gn
|
--- a/BUILD.gn
|
||||||
+++ b/BUILD.gn
|
+++ b/BUILD.gn
|
||||||
@@ -3471,8 +3471,6 @@ if (current_toolchain == v8_generator_toolchain) {
|
@@ -3379,8 +3379,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") {
|
||||||
|
|
|
@ -1,719 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Alexander Timokhin <atimoxin@yandex-team.ru>
|
|
||||||
Date: Thu, 13 Dec 2018 12:46:59 +0300
|
|
||||||
Subject: Reland "Don't use |v8_initializers| code in |v8_base|"
|
|
||||||
|
|
||||||
This is a reland of 2e36e9ea1ef3e332bc9b2d620c6d6ceb054f58a6
|
|
||||||
|
|
||||||
Was reverted because of v8_presubmit.py issue in
|
|
||||||
https://chromium-review.googlesource.com/c/v8/v8/+/1374292
|
|
||||||
|
|
||||||
Original change's description:
|
|
||||||
> Don't use |v8_initializers| code in |v8_base|
|
|
||||||
>
|
|
||||||
> Removing |CodeStubAssembler| from |v8_base| source list (see
|
|
||||||
> https://chromium-review.googlesource.com/c/v8/v8/+/1346329) leads to
|
|
||||||
> linkage problems with some build configurations because it was explicitly
|
|
||||||
> and implicitly included in |v8_base| code.
|
|
||||||
>
|
|
||||||
> This CL decouple this code and fixes problems.
|
|
||||||
>
|
|
||||||
> Bug: v8:7777
|
|
||||||
> Change-Id: I58de5c62914bc77645ed6cc9114409890bc13189
|
|
||||||
> Reviewed-on: https://chromium-review.googlesource.com/c/1372067
|
|
||||||
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
|
|
||||||
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
|
|
||||||
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
|
|
||||||
> Commit-Queue: Jakob Gruber <jgruber@chromium.org>
|
|
||||||
> Cr-Commit-Position: refs/heads/master@{#58200}
|
|
||||||
|
|
||||||
Bug: v8:7777
|
|
||||||
Change-Id: Iaa00e73c7dbd8c413fbf15a17709aa12eda9a706
|
|
||||||
Reviewed-on: https://chromium-review.googlesource.com/c/1375654
|
|
||||||
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
|
|
||||||
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
|
|
||||||
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
|
|
||||||
Cr-Commit-Position: refs/heads/master@{#58209}
|
|
||||||
|
|
||||||
diff --git a/BUILD.gn b/BUILD.gn
|
|
||||||
index e3c8390c299e4c12e4ddba8402ccdb050e7bb6f1..06c9a98f6888eff6c0794e0b83682e04abdbf1d7 100644
|
|
||||||
--- a/BUILD.gn
|
|
||||||
+++ b/BUILD.gn
|
|
||||||
@@ -1722,6 +1722,7 @@ v8_source_set("v8_base") {
|
|
||||||
"src/builtins/builtins-number.cc",
|
|
||||||
"src/builtins/builtins-object.cc",
|
|
||||||
"src/builtins/builtins-promise.cc",
|
|
||||||
+ "src/builtins/builtins-promise.h",
|
|
||||||
"src/builtins/builtins-reflect.cc",
|
|
||||||
"src/builtins/builtins-regexp.cc",
|
|
||||||
"src/builtins/builtins-sharedarraybuffer.cc",
|
|
||||||
diff --git a/src/builtins/builtins-date.cc b/src/builtins/builtins-date.cc
|
|
||||||
index b2e054d6a2efe039c3eb622467adfdff72f582f1..8635eefd21cba5065f9c60e266575f983449dd0f 100644
|
|
||||||
--- a/src/builtins/builtins-date.cc
|
|
||||||
+++ b/src/builtins/builtins-date.cc
|
|
||||||
@@ -5,7 +5,6 @@
|
|
||||||
#include "src/builtins/builtins-utils-inl.h"
|
|
||||||
#include "src/builtins/builtins.h"
|
|
||||||
#include "src/code-factory.h"
|
|
||||||
-#include "src/code-stub-assembler.h"
|
|
||||||
#include "src/conversions.h"
|
|
||||||
#include "src/counters.h"
|
|
||||||
#include "src/date.h"
|
|
||||||
diff --git a/src/builtins/builtins-object.cc b/src/builtins/builtins-object.cc
|
|
||||||
index 5ab929a7a19edbf270f0dff518323003c3103baf..2b55abbc127c527ebd423e48fed23d51613a8302 100644
|
|
||||||
--- a/src/builtins/builtins-object.cc
|
|
||||||
+++ b/src/builtins/builtins-object.cc
|
|
||||||
@@ -5,7 +5,6 @@
|
|
||||||
#include "src/builtins/builtins-utils-inl.h"
|
|
||||||
#include "src/builtins/builtins.h"
|
|
||||||
#include "src/code-factory.h"
|
|
||||||
-#include "src/code-stub-assembler.h"
|
|
||||||
#include "src/counters.h"
|
|
||||||
#include "src/keys.h"
|
|
||||||
#include "src/lookup.h"
|
|
||||||
diff --git a/src/builtins/builtins-promise-gen.cc b/src/builtins/builtins-promise-gen.cc
|
|
||||||
index 22f643e36df8addfcf65c98cc5004e514307f9d3..051b9d8bf82df0713df05c73e2c6677da74bd7ed 100644
|
|
||||||
--- a/src/builtins/builtins-promise-gen.cc
|
|
||||||
+++ b/src/builtins/builtins-promise-gen.cc
|
|
||||||
@@ -6,6 +6,7 @@
|
|
||||||
|
|
||||||
#include "src/builtins/builtins-constructor-gen.h"
|
|
||||||
#include "src/builtins/builtins-iterator-gen.h"
|
|
||||||
+#include "src/builtins/builtins-promise.h"
|
|
||||||
#include "src/builtins/builtins-utils-gen.h"
|
|
||||||
#include "src/builtins/builtins.h"
|
|
||||||
#include "src/code-factory.h"
|
|
||||||
@@ -210,14 +211,17 @@ Node* PromiseBuiltinsAssembler::CreatePromiseAllResolveElementContext(
|
|
||||||
TNode<JSArray> values_array = AllocateJSArray(
|
|
||||||
PACKED_ELEMENTS, array_map, IntPtrConstant(0), SmiConstant(0));
|
|
||||||
|
|
||||||
- Node* const context =
|
|
||||||
- CreatePromiseContext(native_context, kPromiseAllResolveElementLength);
|
|
||||||
+ Node* const context = CreatePromiseContext(
|
|
||||||
+ native_context, PromiseBuiltins::kPromiseAllResolveElementLength);
|
|
||||||
StoreContextElementNoWriteBarrier(
|
|
||||||
- context, kPromiseAllResolveElementRemainingSlot, SmiConstant(1));
|
|
||||||
+ context, PromiseBuiltins::kPromiseAllResolveElementRemainingSlot,
|
|
||||||
+ SmiConstant(1));
|
|
||||||
StoreContextElementNoWriteBarrier(
|
|
||||||
- context, kPromiseAllResolveElementCapabilitySlot, promise_capability);
|
|
||||||
+ context, PromiseBuiltins::kPromiseAllResolveElementCapabilitySlot,
|
|
||||||
+ promise_capability);
|
|
||||||
StoreContextElementNoWriteBarrier(
|
|
||||||
- context, kPromiseAllResolveElementValuesArraySlot, values_array);
|
|
||||||
+ context, PromiseBuiltins::kPromiseAllResolveElementValuesArraySlot,
|
|
||||||
+ values_array);
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
@@ -245,20 +249,22 @@ Node* PromiseBuiltinsAssembler::CreatePromiseAllResolveElementFunction(
|
|
||||||
|
|
||||||
Node* PromiseBuiltinsAssembler::CreatePromiseResolvingFunctionsContext(
|
|
||||||
Node* promise, Node* debug_event, Node* native_context) {
|
|
||||||
- Node* const context =
|
|
||||||
- CreatePromiseContext(native_context, kPromiseContextLength);
|
|
||||||
- StoreContextElementNoWriteBarrier(context, kPromiseSlot, promise);
|
|
||||||
- StoreContextElementNoWriteBarrier(context, kAlreadyResolvedSlot,
|
|
||||||
- FalseConstant());
|
|
||||||
- StoreContextElementNoWriteBarrier(context, kDebugEventSlot, debug_event);
|
|
||||||
+ Node* const context = CreatePromiseContext(
|
|
||||||
+ native_context, PromiseBuiltins::kPromiseContextLength);
|
|
||||||
+ StoreContextElementNoWriteBarrier(context, PromiseBuiltins::kPromiseSlot,
|
|
||||||
+ promise);
|
|
||||||
+ StoreContextElementNoWriteBarrier(
|
|
||||||
+ context, PromiseBuiltins::kAlreadyResolvedSlot, FalseConstant());
|
|
||||||
+ StoreContextElementNoWriteBarrier(context, PromiseBuiltins::kDebugEventSlot,
|
|
||||||
+ debug_event);
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
Node* PromiseBuiltinsAssembler::CreatePromiseGetCapabilitiesExecutorContext(
|
|
||||||
Node* promise_capability, Node* native_context) {
|
|
||||||
- int kContextLength = kCapabilitiesContextLength;
|
|
||||||
+ int kContextLength = PromiseBuiltins::kCapabilitiesContextLength;
|
|
||||||
Node* context = CreatePromiseContext(native_context, kContextLength);
|
|
||||||
- StoreContextElementNoWriteBarrier(context, kCapabilitySlot,
|
|
||||||
+ StoreContextElementNoWriteBarrier(context, PromiseBuiltins::kCapabilitySlot,
|
|
||||||
promise_capability);
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
@@ -750,22 +756,24 @@ TF_BUILTIN(PromiseCapabilityDefaultReject, PromiseBuiltinsAssembler) {
|
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
|
||||||
|
|
||||||
// 2. Let promise be F.[[Promise]].
|
|
||||||
- Node* const promise = LoadContextElement(context, kPromiseSlot);
|
|
||||||
+ Node* const promise =
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kPromiseSlot);
|
|
||||||
|
|
||||||
// 3. Let alreadyResolved be F.[[AlreadyResolved]].
|
|
||||||
Label if_already_resolved(this, Label::kDeferred);
|
|
||||||
Node* const already_resolved =
|
|
||||||
- LoadContextElement(context, kAlreadyResolvedSlot);
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kAlreadyResolvedSlot);
|
|
||||||
|
|
||||||
// 4. If alreadyResolved.[[Value]] is true, return undefined.
|
|
||||||
GotoIf(IsTrue(already_resolved), &if_already_resolved);
|
|
||||||
|
|
||||||
// 5. Set alreadyResolved.[[Value]] to true.
|
|
||||||
- StoreContextElementNoWriteBarrier(context, kAlreadyResolvedSlot,
|
|
||||||
- TrueConstant());
|
|
||||||
+ StoreContextElementNoWriteBarrier(
|
|
||||||
+ context, PromiseBuiltins::kAlreadyResolvedSlot, TrueConstant());
|
|
||||||
|
|
||||||
// 6. Return RejectPromise(promise, reason).
|
|
||||||
- Node* const debug_event = LoadContextElement(context, kDebugEventSlot);
|
|
||||||
+ Node* const debug_event =
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kDebugEventSlot);
|
|
||||||
Return(CallBuiltin(Builtins::kRejectPromise, context, promise, reason,
|
|
||||||
debug_event));
|
|
||||||
|
|
||||||
@@ -782,19 +790,20 @@ TF_BUILTIN(PromiseCapabilityDefaultResolve, PromiseBuiltinsAssembler) {
|
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
|
||||||
|
|
||||||
// 2. Let promise be F.[[Promise]].
|
|
||||||
- Node* const promise = LoadContextElement(context, kPromiseSlot);
|
|
||||||
+ Node* const promise =
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kPromiseSlot);
|
|
||||||
|
|
||||||
// 3. Let alreadyResolved be F.[[AlreadyResolved]].
|
|
||||||
Label if_already_resolved(this, Label::kDeferred);
|
|
||||||
Node* const already_resolved =
|
|
||||||
- LoadContextElement(context, kAlreadyResolvedSlot);
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kAlreadyResolvedSlot);
|
|
||||||
|
|
||||||
// 4. If alreadyResolved.[[Value]] is true, return undefined.
|
|
||||||
GotoIf(IsTrue(already_resolved), &if_already_resolved);
|
|
||||||
|
|
||||||
// 5. Set alreadyResolved.[[Value]] to true.
|
|
||||||
- StoreContextElementNoWriteBarrier(context, kAlreadyResolvedSlot,
|
|
||||||
- TrueConstant());
|
|
||||||
+ StoreContextElementNoWriteBarrier(
|
|
||||||
+ context, PromiseBuiltins::kAlreadyResolvedSlot, TrueConstant());
|
|
||||||
|
|
||||||
// The rest of the logic (and the catch prediction) is
|
|
||||||
// encapsulated in the dedicated ResolvePromise builtin.
|
|
||||||
@@ -1396,7 +1405,8 @@ TF_BUILTIN(PromiseGetCapabilitiesExecutor, PromiseBuiltinsAssembler) {
|
|
||||||
Node* const reject = Parameter(Descriptor::kReject);
|
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
|
||||||
|
|
||||||
- Node* const capability = LoadContextElement(context, kCapabilitySlot);
|
|
||||||
+ Node* const capability =
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kCapabilitySlot);
|
|
||||||
|
|
||||||
Label if_alreadyinvoked(this, Label::kDeferred);
|
|
||||||
GotoIfNot(IsUndefined(
|
|
||||||
@@ -1464,12 +1474,12 @@ TF_BUILTIN(PromiseReject, PromiseBuiltinsAssembler) {
|
|
||||||
|
|
||||||
std::pair<Node*, Node*> PromiseBuiltinsAssembler::CreatePromiseFinallyFunctions(
|
|
||||||
Node* on_finally, Node* constructor, Node* native_context) {
|
|
||||||
- Node* const promise_context =
|
|
||||||
- CreatePromiseContext(native_context, kPromiseFinallyContextLength);
|
|
||||||
- StoreContextElementNoWriteBarrier(promise_context, kOnFinallySlot,
|
|
||||||
- on_finally);
|
|
||||||
- StoreContextElementNoWriteBarrier(promise_context, kConstructorSlot,
|
|
||||||
- constructor);
|
|
||||||
+ Node* const promise_context = CreatePromiseContext(
|
|
||||||
+ native_context, PromiseBuiltins::kPromiseFinallyContextLength);
|
|
||||||
+ StoreContextElementNoWriteBarrier(
|
|
||||||
+ promise_context, PromiseBuiltins::kOnFinallySlot, on_finally);
|
|
||||||
+ StoreContextElementNoWriteBarrier(
|
|
||||||
+ promise_context, PromiseBuiltins::kConstructorSlot, constructor);
|
|
||||||
Node* const map = LoadContextElement(
|
|
||||||
native_context, Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX);
|
|
||||||
Node* const then_finally_info = LoadContextElement(
|
|
||||||
@@ -1486,15 +1496,16 @@ std::pair<Node*, Node*> PromiseBuiltinsAssembler::CreatePromiseFinallyFunctions(
|
|
||||||
TF_BUILTIN(PromiseValueThunkFinally, PromiseBuiltinsAssembler) {
|
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
|
||||||
|
|
||||||
- Node* const value = LoadContextElement(context, kValueSlot);
|
|
||||||
+ Node* const value = LoadContextElement(context, PromiseBuiltins::kValueSlot);
|
|
||||||
Return(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Node* PromiseBuiltinsAssembler::CreateValueThunkFunction(Node* value,
|
|
||||||
Node* native_context) {
|
|
||||||
Node* const value_thunk_context = CreatePromiseContext(
|
|
||||||
- native_context, kPromiseValueThunkOrReasonContextLength);
|
|
||||||
- StoreContextElementNoWriteBarrier(value_thunk_context, kValueSlot, value);
|
|
||||||
+ native_context, PromiseBuiltins::kPromiseValueThunkOrReasonContextLength);
|
|
||||||
+ StoreContextElementNoWriteBarrier(value_thunk_context,
|
|
||||||
+ PromiseBuiltins::kValueSlot, value);
|
|
||||||
Node* const map = LoadContextElement(
|
|
||||||
native_context, Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX);
|
|
||||||
Node* const value_thunk_info = LoadContextElement(
|
|
||||||
@@ -1511,7 +1522,8 @@ TF_BUILTIN(PromiseThenFinally, PromiseBuiltinsAssembler) {
|
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
|
||||||
|
|
||||||
// 1. Let onFinally be F.[[OnFinally]].
|
|
||||||
- Node* const on_finally = LoadContextElement(context, kOnFinallySlot);
|
|
||||||
+ Node* const on_finally =
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kOnFinallySlot);
|
|
||||||
|
|
||||||
// 2. Assert: IsCallable(onFinally) is true.
|
|
||||||
CSA_ASSERT(this, IsCallable(on_finally));
|
|
||||||
@@ -1522,7 +1534,8 @@ TF_BUILTIN(PromiseThenFinally, PromiseBuiltinsAssembler) {
|
|
||||||
context, on_finally, UndefinedConstant());
|
|
||||||
|
|
||||||
// 4. Let C be F.[[Constructor]].
|
|
||||||
- Node* const constructor = LoadContextElement(context, kConstructorSlot);
|
|
||||||
+ Node* const constructor =
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kConstructorSlot);
|
|
||||||
|
|
||||||
// 5. Assert: IsConstructor(C) is true.
|
|
||||||
CSA_ASSERT(this, IsConstructor(constructor));
|
|
||||||
@@ -1542,7 +1555,7 @@ TF_BUILTIN(PromiseThenFinally, PromiseBuiltinsAssembler) {
|
|
||||||
TF_BUILTIN(PromiseThrowerFinally, PromiseBuiltinsAssembler) {
|
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
|
||||||
|
|
||||||
- Node* const reason = LoadContextElement(context, kValueSlot);
|
|
||||||
+ Node* const reason = LoadContextElement(context, PromiseBuiltins::kValueSlot);
|
|
||||||
CallRuntime(Runtime::kThrow, context, reason);
|
|
||||||
Unreachable();
|
|
||||||
}
|
|
||||||
@@ -1550,8 +1563,9 @@ TF_BUILTIN(PromiseThrowerFinally, PromiseBuiltinsAssembler) {
|
|
||||||
Node* PromiseBuiltinsAssembler::CreateThrowerFunction(Node* reason,
|
|
||||||
Node* native_context) {
|
|
||||||
Node* const thrower_context = CreatePromiseContext(
|
|
||||||
- native_context, kPromiseValueThunkOrReasonContextLength);
|
|
||||||
- StoreContextElementNoWriteBarrier(thrower_context, kValueSlot, reason);
|
|
||||||
+ native_context, PromiseBuiltins::kPromiseValueThunkOrReasonContextLength);
|
|
||||||
+ StoreContextElementNoWriteBarrier(thrower_context,
|
|
||||||
+ PromiseBuiltins::kValueSlot, reason);
|
|
||||||
Node* const map = LoadContextElement(
|
|
||||||
native_context, Context::STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX);
|
|
||||||
Node* const thrower_info = LoadContextElement(
|
|
||||||
@@ -1568,7 +1582,8 @@ TF_BUILTIN(PromiseCatchFinally, PromiseBuiltinsAssembler) {
|
|
||||||
Node* const context = Parameter(Descriptor::kContext);
|
|
||||||
|
|
||||||
// 1. Let onFinally be F.[[OnFinally]].
|
|
||||||
- Node* const on_finally = LoadContextElement(context, kOnFinallySlot);
|
|
||||||
+ Node* const on_finally =
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kOnFinallySlot);
|
|
||||||
|
|
||||||
// 2. Assert: IsCallable(onFinally) is true.
|
|
||||||
CSA_ASSERT(this, IsCallable(on_finally));
|
|
||||||
@@ -1579,7 +1594,8 @@ TF_BUILTIN(PromiseCatchFinally, PromiseBuiltinsAssembler) {
|
|
||||||
context, on_finally, UndefinedConstant());
|
|
||||||
|
|
||||||
// 4. Let C be F.[[Constructor]].
|
|
||||||
- Node* const constructor = LoadContextElement(context, kConstructorSlot);
|
|
||||||
+ Node* const constructor =
|
|
||||||
+ LoadContextElement(context, PromiseBuiltins::kConstructorSlot);
|
|
||||||
|
|
||||||
// 5. Assert: IsConstructor(C) is true.
|
|
||||||
CSA_ASSERT(this, IsConstructor(constructor));
|
|
||||||
@@ -1908,9 +1924,11 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll(
|
|
||||||
// Set remainingElementsCount.[[Value]] to
|
|
||||||
// remainingElementsCount.[[Value]] + 1.
|
|
||||||
TNode<Smi> const remaining_elements_count = CAST(LoadContextElement(
|
|
||||||
- resolve_element_context, kPromiseAllResolveElementRemainingSlot));
|
|
||||||
+ resolve_element_context,
|
|
||||||
+ PromiseBuiltins::kPromiseAllResolveElementRemainingSlot));
|
|
||||||
StoreContextElementNoWriteBarrier(
|
|
||||||
- resolve_element_context, kPromiseAllResolveElementRemainingSlot,
|
|
||||||
+ resolve_element_context,
|
|
||||||
+ PromiseBuiltins::kPromiseAllResolveElementRemainingSlot,
|
|
||||||
SmiAdd(remaining_elements_count, SmiConstant(1)));
|
|
||||||
|
|
||||||
// Let resolveElement be CreateBuiltinFunction(steps,
|
|
||||||
@@ -2027,11 +2045,13 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll(
|
|
||||||
// Set remainingElementsCount.[[Value]] to
|
|
||||||
// remainingElementsCount.[[Value]] - 1.
|
|
||||||
TNode<Smi> remaining_elements_count = CAST(LoadContextElement(
|
|
||||||
- resolve_element_context, kPromiseAllResolveElementRemainingSlot));
|
|
||||||
+ resolve_element_context,
|
|
||||||
+ PromiseBuiltins::kPromiseAllResolveElementRemainingSlot));
|
|
||||||
remaining_elements_count = SmiSub(remaining_elements_count, SmiConstant(1));
|
|
||||||
- StoreContextElementNoWriteBarrier(resolve_element_context,
|
|
||||||
- kPromiseAllResolveElementRemainingSlot,
|
|
||||||
- remaining_elements_count);
|
|
||||||
+ StoreContextElementNoWriteBarrier(
|
|
||||||
+ resolve_element_context,
|
|
||||||
+ PromiseBuiltins::kPromiseAllResolveElementRemainingSlot,
|
|
||||||
+ remaining_elements_count);
|
|
||||||
GotoIf(SmiEqual(remaining_elements_count, SmiConstant(0)),
|
|
||||||
&resolve_promise);
|
|
||||||
|
|
||||||
@@ -2040,7 +2060,8 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll(
|
|
||||||
// fancy Thenable that calls the resolve callback immediately, so we need
|
|
||||||
// to handle that correctly here.
|
|
||||||
Node* const values_array = LoadContextElement(
|
|
||||||
- resolve_element_context, kPromiseAllResolveElementValuesArraySlot);
|
|
||||||
+ resolve_element_context,
|
|
||||||
+ PromiseBuiltins::kPromiseAllResolveElementValuesArraySlot);
|
|
||||||
Node* const old_elements = LoadElements(values_array);
|
|
||||||
TNode<Smi> const old_capacity = LoadFixedArrayBaseLength(old_elements);
|
|
||||||
TNode<Smi> const new_capacity = var_index.value();
|
|
||||||
@@ -2063,7 +2084,8 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll(
|
|
||||||
Node* const resolve =
|
|
||||||
LoadObjectField(capability, PromiseCapability::kResolveOffset);
|
|
||||||
Node* const values_array = LoadContextElement(
|
|
||||||
- resolve_element_context, kPromiseAllResolveElementValuesArraySlot);
|
|
||||||
+ resolve_element_context,
|
|
||||||
+ PromiseBuiltins::kPromiseAllResolveElementValuesArraySlot);
|
|
||||||
Node* const resolve_call = CallJS(
|
|
||||||
CodeFactory::Call(isolate(), ConvertReceiverMode::kNullOrUndefined),
|
|
||||||
native_context, resolve, UndefinedConstant(), values_array);
|
|
||||||
@@ -2146,9 +2168,10 @@ TF_BUILTIN(PromiseAllResolveElementClosure, PromiseBuiltinsAssembler) {
|
|
||||||
// first time, in which case we make it point to the native context here
|
|
||||||
// to mark this resolve element closure as done.
|
|
||||||
GotoIf(IsNativeContext(context), &already_called);
|
|
||||||
- CSA_ASSERT(this,
|
|
||||||
- SmiEqual(LoadObjectField<Smi>(context, Context::kLengthOffset),
|
|
||||||
- SmiConstant(kPromiseAllResolveElementLength)));
|
|
||||||
+ CSA_ASSERT(
|
|
||||||
+ this,
|
|
||||||
+ SmiEqual(LoadObjectField<Smi>(context, Context::kLengthOffset),
|
|
||||||
+ SmiConstant(PromiseBuiltins::kPromiseAllResolveElementLength)));
|
|
||||||
TNode<Context> native_context = LoadNativeContext(context);
|
|
||||||
StoreObjectField(function, JSFunction::kContextOffset, native_context);
|
|
||||||
|
|
||||||
@@ -2161,8 +2184,8 @@ TF_BUILTIN(PromiseAllResolveElementClosure, PromiseBuiltinsAssembler) {
|
|
||||||
TNode<IntPtrT> index = IntPtrSub(identity_hash, IntPtrConstant(1));
|
|
||||||
|
|
||||||
// Check if we need to grow the [[ValuesArray]] to store {value} at {index}.
|
|
||||||
- TNode<JSArray> values_array = CAST(
|
|
||||||
- LoadContextElement(context, kPromiseAllResolveElementValuesArraySlot));
|
|
||||||
+ TNode<JSArray> values_array = CAST(LoadContextElement(
|
|
||||||
+ context, PromiseBuiltins::kPromiseAllResolveElementValuesArraySlot));
|
|
||||||
TNode<FixedArray> elements = CAST(LoadElements(values_array));
|
|
||||||
TNode<IntPtrT> values_length =
|
|
||||||
LoadAndUntagObjectField(values_array, JSArray::kLengthOffset);
|
|
||||||
@@ -2221,17 +2244,18 @@ TF_BUILTIN(PromiseAllResolveElementClosure, PromiseBuiltinsAssembler) {
|
|
||||||
}
|
|
||||||
|
|
||||||
BIND(&done);
|
|
||||||
- TNode<Smi> remaining_elements_count =
|
|
||||||
- CAST(LoadContextElement(context, kPromiseAllResolveElementRemainingSlot));
|
|
||||||
+ TNode<Smi> remaining_elements_count = CAST(LoadContextElement(
|
|
||||||
+ context, PromiseBuiltins::kPromiseAllResolveElementRemainingSlot));
|
|
||||||
remaining_elements_count = SmiSub(remaining_elements_count, SmiConstant(1));
|
|
||||||
- StoreContextElement(context, kPromiseAllResolveElementRemainingSlot,
|
|
||||||
+ StoreContextElement(context,
|
|
||||||
+ PromiseBuiltins::kPromiseAllResolveElementRemainingSlot,
|
|
||||||
remaining_elements_count);
|
|
||||||
GotoIf(SmiEqual(remaining_elements_count, SmiConstant(0)), &resolve_promise);
|
|
||||||
Return(UndefinedConstant());
|
|
||||||
|
|
||||||
BIND(&resolve_promise);
|
|
||||||
- TNode<PromiseCapability> capability = CAST(
|
|
||||||
- LoadContextElement(context, kPromiseAllResolveElementCapabilitySlot));
|
|
||||||
+ TNode<PromiseCapability> capability = CAST(LoadContextElement(
|
|
||||||
+ context, PromiseBuiltins::kPromiseAllResolveElementCapabilitySlot));
|
|
||||||
TNode<Object> resolve =
|
|
||||||
LoadObjectField(capability, PromiseCapability::kResolveOffset);
|
|
||||||
CallJS(CodeFactory::Call(isolate(), ConvertReceiverMode::kNullOrUndefined),
|
|
||||||
diff --git a/src/builtins/builtins-promise-gen.h b/src/builtins/builtins-promise-gen.h
|
|
||||||
index 435f1adc87b2393c0c7a4142bb946f50940d256e..8edc2331a51ad08f19b9e470a5e76a4d78cd69f5 100644
|
|
||||||
--- a/src/builtins/builtins-promise-gen.h
|
|
||||||
+++ b/src/builtins/builtins-promise-gen.h
|
|
||||||
@@ -6,7 +6,6 @@
|
|
||||||
#define V8_BUILTINS_BUILTINS_PROMISE_GEN_H_
|
|
||||||
|
|
||||||
#include "src/code-stub-assembler.h"
|
|
||||||
-#include "src/contexts.h"
|
|
||||||
#include "src/objects/promise.h"
|
|
||||||
#include "torque-generated/builtins-base-from-dsl-gen.h"
|
|
||||||
#include "torque-generated/builtins-iterator-from-dsl-gen.h"
|
|
||||||
@@ -18,59 +17,6 @@ typedef compiler::CodeAssemblerState CodeAssemblerState;
|
|
||||||
|
|
||||||
class PromiseBuiltinsAssembler : public CodeStubAssembler {
|
|
||||||
public:
|
|
||||||
- enum PromiseResolvingFunctionContextSlot {
|
|
||||||
- // The promise which resolve/reject callbacks fulfill.
|
|
||||||
- kPromiseSlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
-
|
|
||||||
- // Whether the callback was already invoked.
|
|
||||||
- kAlreadyResolvedSlot,
|
|
||||||
-
|
|
||||||
- // Whether to trigger a debug event or not. Used in catch
|
|
||||||
- // prediction.
|
|
||||||
- kDebugEventSlot,
|
|
||||||
- kPromiseContextLength,
|
|
||||||
- };
|
|
||||||
-
|
|
||||||
- // TODO(bmeurer): Move this to a proper context map in contexts.h?
|
|
||||||
- // Similar to the AwaitContext that we introduced for await closures.
|
|
||||||
- enum PromiseAllResolveElementContextSlots {
|
|
||||||
- // Remaining elements count
|
|
||||||
- kPromiseAllResolveElementRemainingSlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
-
|
|
||||||
- // Promise capability from Promise.all
|
|
||||||
- kPromiseAllResolveElementCapabilitySlot,
|
|
||||||
-
|
|
||||||
- // Values array from Promise.all
|
|
||||||
- kPromiseAllResolveElementValuesArraySlot,
|
|
||||||
-
|
|
||||||
- kPromiseAllResolveElementLength
|
|
||||||
- };
|
|
||||||
-
|
|
||||||
- enum FunctionContextSlot {
|
|
||||||
- kCapabilitySlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
-
|
|
||||||
- kCapabilitiesContextLength,
|
|
||||||
- };
|
|
||||||
-
|
|
||||||
- // This is used by the Promise.prototype.finally builtin to store
|
|
||||||
- // onFinally callback and the Promise constructor.
|
|
||||||
- // TODO(gsathya): For native promises we can create a variant of
|
|
||||||
- // this without extra space for the constructor to save memory.
|
|
||||||
- enum PromiseFinallyContextSlot {
|
|
||||||
- kOnFinallySlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
- kConstructorSlot,
|
|
||||||
-
|
|
||||||
- kPromiseFinallyContextLength,
|
|
||||||
- };
|
|
||||||
-
|
|
||||||
- // This is used by the ThenFinally and CatchFinally builtins to
|
|
||||||
- // store the value to return or reason to throw.
|
|
||||||
- enum PromiseValueThunkOrReasonContextSlot {
|
|
||||||
- kValueSlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
-
|
|
||||||
- kPromiseValueThunkOrReasonContextLength,
|
|
||||||
- };
|
|
||||||
-
|
|
||||||
explicit PromiseBuiltinsAssembler(compiler::CodeAssemblerState* state)
|
|
||||||
: CodeStubAssembler(state) {}
|
|
||||||
// These allocate and initialize a promise with pending state and
|
|
||||||
diff --git a/src/builtins/builtins-promise.cc b/src/builtins/builtins-promise.cc
|
|
||||||
index 88d54b26d0295e25ffb57f154dcfeb353e46d04f..0f18d8fb459b9d256648870706118a751012b01a 100644
|
|
||||||
--- a/src/builtins/builtins-promise.cc
|
|
||||||
+++ b/src/builtins/builtins-promise.cc
|
|
||||||
@@ -2,6 +2,8 @@
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
+#include "src/builtins/builtins-promise.h"
|
|
||||||
+
|
|
||||||
#include "src/builtins/builtins-utils-inl.h"
|
|
||||||
#include "src/builtins/builtins.h"
|
|
||||||
#include "src/counters.h"
|
|
||||||
diff --git a/src/builtins/builtins-promise.h b/src/builtins/builtins-promise.h
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..66545feafed2099992a0fa57aada74298e634994
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/builtins/builtins-promise.h
|
|
||||||
@@ -0,0 +1,75 @@
|
|
||||||
+// Copyright 2018 the V8 project authors. All rights reserved.
|
|
||||||
+// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
+// found in the LICENSE file.
|
|
||||||
+
|
|
||||||
+#ifndef V8_BUILTINS_BUILTINS_PROMISE_H_
|
|
||||||
+#define V8_BUILTINS_BUILTINS_PROMISE_H_
|
|
||||||
+
|
|
||||||
+#include "src/contexts.h"
|
|
||||||
+
|
|
||||||
+namespace v8 {
|
|
||||||
+namespace internal {
|
|
||||||
+
|
|
||||||
+class PromiseBuiltins {
|
|
||||||
+ public:
|
|
||||||
+ enum PromiseResolvingFunctionContextSlot {
|
|
||||||
+ // The promise which resolve/reject callbacks fulfill.
|
|
||||||
+ kPromiseSlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
+
|
|
||||||
+ // Whether the callback was already invoked.
|
|
||||||
+ kAlreadyResolvedSlot,
|
|
||||||
+
|
|
||||||
+ // Whether to trigger a debug event or not. Used in catch
|
|
||||||
+ // prediction.
|
|
||||||
+ kDebugEventSlot,
|
|
||||||
+ kPromiseContextLength,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ // TODO(bmeurer): Move this to a proper context map in contexts.h?
|
|
||||||
+ // Similar to the AwaitContext that we introduced for await closures.
|
|
||||||
+ enum PromiseAllResolveElementContextSlots {
|
|
||||||
+ // Remaining elements count
|
|
||||||
+ kPromiseAllResolveElementRemainingSlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
+
|
|
||||||
+ // Promise capability from Promise.all
|
|
||||||
+ kPromiseAllResolveElementCapabilitySlot,
|
|
||||||
+
|
|
||||||
+ // Values array from Promise.all
|
|
||||||
+ kPromiseAllResolveElementValuesArraySlot,
|
|
||||||
+
|
|
||||||
+ kPromiseAllResolveElementLength
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ enum FunctionContextSlot {
|
|
||||||
+ kCapabilitySlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
+
|
|
||||||
+ kCapabilitiesContextLength,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ // This is used by the Promise.prototype.finally builtin to store
|
|
||||||
+ // onFinally callback and the Promise constructor.
|
|
||||||
+ // TODO(gsathya): For native promises we can create a variant of
|
|
||||||
+ // this without extra space for the constructor to save memory.
|
|
||||||
+ enum PromiseFinallyContextSlot {
|
|
||||||
+ kOnFinallySlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
+ kConstructorSlot,
|
|
||||||
+
|
|
||||||
+ kPromiseFinallyContextLength,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ // This is used by the ThenFinally and CatchFinally builtins to
|
|
||||||
+ // store the value to return or reason to throw.
|
|
||||||
+ enum PromiseValueThunkOrReasonContextSlot {
|
|
||||||
+ kValueSlot = Context::MIN_CONTEXT_SLOTS,
|
|
||||||
+
|
|
||||||
+ kPromiseValueThunkOrReasonContextLength,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ private:
|
|
||||||
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseBuiltins);
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+} // namespace internal
|
|
||||||
+} // namespace v8
|
|
||||||
+
|
|
||||||
+#endif // V8_BUILTINS_BUILTINS_PROMISE_H_
|
|
||||||
diff --git a/src/compiler/js-call-reducer.cc b/src/compiler/js-call-reducer.cc
|
|
||||||
index 131b50b53e67d9cdb47e20ed570875cda84c0ba7..d5985d2cdc5a50a2f38012cef5291f6b6dde0154 100644
|
|
||||||
--- a/src/compiler/js-call-reducer.cc
|
|
||||||
+++ b/src/compiler/js-call-reducer.cc
|
|
||||||
@@ -5,7 +5,7 @@
|
|
||||||
#include "src/compiler/js-call-reducer.h"
|
|
||||||
|
|
||||||
#include "src/api-inl.h"
|
|
||||||
-#include "src/builtins/builtins-promise-gen.h"
|
|
||||||
+#include "src/builtins/builtins-promise.h"
|
|
||||||
#include "src/builtins/builtins-utils.h"
|
|
||||||
#include "src/code-factory.h"
|
|
||||||
#include "src/code-stubs.h"
|
|
||||||
@@ -5607,21 +5607,20 @@ Reduction JSCallReducer::ReducePromiseConstructor(Node* node) {
|
|
||||||
Node* promise_context = effect = graph()->NewNode(
|
|
||||||
javascript()->CreateFunctionContext(
|
|
||||||
handle(native_context().object()->scope_info(), isolate()),
|
|
||||||
- PromiseBuiltinsAssembler::kPromiseContextLength -
|
|
||||||
- Context::MIN_CONTEXT_SLOTS,
|
|
||||||
+ PromiseBuiltins::kPromiseContextLength - Context::MIN_CONTEXT_SLOTS,
|
|
||||||
FUNCTION_SCOPE),
|
|
||||||
context, effect, control);
|
|
||||||
- effect =
|
|
||||||
- graph()->NewNode(simplified()->StoreField(AccessBuilder::ForContextSlot(
|
|
||||||
- PromiseBuiltinsAssembler::kPromiseSlot)),
|
|
||||||
- promise_context, promise, effect, control);
|
|
||||||
effect = graph()->NewNode(
|
|
||||||
- simplified()->StoreField(AccessBuilder::ForContextSlot(
|
|
||||||
- PromiseBuiltinsAssembler::kAlreadyResolvedSlot)),
|
|
||||||
+ simplified()->StoreField(
|
|
||||||
+ AccessBuilder::ForContextSlot(PromiseBuiltins::kPromiseSlot)),
|
|
||||||
+ promise_context, promise, effect, control);
|
|
||||||
+ effect = graph()->NewNode(
|
|
||||||
+ simplified()->StoreField(
|
|
||||||
+ AccessBuilder::ForContextSlot(PromiseBuiltins::kAlreadyResolvedSlot)),
|
|
||||||
promise_context, jsgraph()->FalseConstant(), effect, control);
|
|
||||||
effect = graph()->NewNode(
|
|
||||||
- simplified()->StoreField(AccessBuilder::ForContextSlot(
|
|
||||||
- PromiseBuiltinsAssembler::kDebugEventSlot)),
|
|
||||||
+ simplified()->StoreField(
|
|
||||||
+ AccessBuilder::ForContextSlot(PromiseBuiltins::kDebugEventSlot)),
|
|
||||||
promise_context, jsgraph()->TrueConstant(), effect, control);
|
|
||||||
|
|
||||||
// Allocate the closure for the resolve case.
|
|
||||||
@@ -5927,18 +5926,18 @@ Reduction JSCallReducer::ReducePromisePrototypeFinally(Node* node) {
|
|
||||||
context = etrue = graph()->NewNode(
|
|
||||||
javascript()->CreateFunctionContext(
|
|
||||||
handle(native_context().object()->scope_info(), isolate()),
|
|
||||||
- PromiseBuiltinsAssembler::kPromiseFinallyContextLength -
|
|
||||||
+ PromiseBuiltins::kPromiseFinallyContextLength -
|
|
||||||
Context::MIN_CONTEXT_SLOTS,
|
|
||||||
FUNCTION_SCOPE),
|
|
||||||
context, etrue, if_true);
|
|
||||||
- etrue =
|
|
||||||
- graph()->NewNode(simplified()->StoreField(AccessBuilder::ForContextSlot(
|
|
||||||
- PromiseBuiltinsAssembler::kOnFinallySlot)),
|
|
||||||
- context, on_finally, etrue, if_true);
|
|
||||||
- etrue =
|
|
||||||
- graph()->NewNode(simplified()->StoreField(AccessBuilder::ForContextSlot(
|
|
||||||
- PromiseBuiltinsAssembler::kConstructorSlot)),
|
|
||||||
- context, constructor, etrue, if_true);
|
|
||||||
+ etrue = graph()->NewNode(
|
|
||||||
+ simplified()->StoreField(
|
|
||||||
+ AccessBuilder::ForContextSlot(PromiseBuiltins::kOnFinallySlot)),
|
|
||||||
+ context, on_finally, etrue, if_true);
|
|
||||||
+ etrue = graph()->NewNode(
|
|
||||||
+ simplified()->StoreField(
|
|
||||||
+ AccessBuilder::ForContextSlot(PromiseBuiltins::kConstructorSlot)),
|
|
||||||
+ context, constructor, etrue, if_true);
|
|
||||||
|
|
||||||
// Allocate the closure for the reject case.
|
|
||||||
SharedFunctionInfoRef catch_finally =
|
|
||||||
diff --git a/src/isolate.cc b/src/isolate.cc
|
|
||||||
index a3e93d0da3dd8054a04ea15edc2c7511972f7136..44dc67d22452e4153d44edc81f26c13eb96d2920 100644
|
|
||||||
--- a/src/isolate.cc
|
|
||||||
+++ b/src/isolate.cc
|
|
||||||
@@ -22,7 +22,7 @@
|
|
||||||
#include "src/base/sys-info.h"
|
|
||||||
#include "src/base/utils/random-number-generator.h"
|
|
||||||
#include "src/bootstrapper.h"
|
|
||||||
-#include "src/builtins/builtins-promise-gen.h"
|
|
||||||
+#include "src/builtins/builtins-promise.h"
|
|
||||||
#include "src/builtins/constants-table-builder.h"
|
|
||||||
#include "src/cancelable-task.h"
|
|
||||||
#include "src/code-stubs.h"
|
|
||||||
@@ -774,7 +774,7 @@ void CaptureAsyncStackTrace(Isolate* isolate, Handle<JSPromise> promise,
|
|
||||||
// find the promise capability that's being resolved when all
|
|
||||||
// the concurrent promises resolve.
|
|
||||||
int const index =
|
|
||||||
- PromiseBuiltinsAssembler::kPromiseAllResolveElementCapabilitySlot;
|
|
||||||
+ PromiseBuiltins::kPromiseAllResolveElementCapabilitySlot;
|
|
||||||
Handle<PromiseCapability> capability(
|
|
||||||
PromiseCapability::cast(context->get(index)), isolate);
|
|
||||||
if (!capability->promise()->IsJSPromise()) return;
|
|
||||||
diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc
|
|
||||||
index 6db2eed1458bd0f07ae6774401e53a3f2d23b7ce..ab90d1a357fd141441cf1a89323a5dc7f332a882 100644
|
|
||||||
--- a/test/cctest/test-code-stub-assembler.cc
|
|
||||||
+++ b/test/cctest/test-code-stub-assembler.cc
|
|
||||||
@@ -7,6 +7,7 @@
|
|
||||||
#include "src/api-inl.h"
|
|
||||||
#include "src/base/utils/random-number-generator.h"
|
|
||||||
#include "src/builtins/builtins-promise-gen.h"
|
|
||||||
+#include "src/builtins/builtins-promise.h"
|
|
||||||
#include "src/builtins/builtins-string-gen.h"
|
|
||||||
#include "src/char-predicates.h"
|
|
||||||
#include "src/code-factory.h"
|
|
||||||
@@ -2360,9 +2361,9 @@ TEST(CreatePromiseResolvingFunctionsContext) {
|
|
||||||
CHECK_EQ(isolate->native_context()->scope_info(), context_js->scope_info());
|
|
||||||
CHECK_EQ(ReadOnlyRoots(isolate).the_hole_value(), context_js->extension());
|
|
||||||
CHECK_EQ(*isolate->native_context(), context_js->native_context());
|
|
||||||
- CHECK(context_js->get(PromiseBuiltinsAssembler::kPromiseSlot)->IsJSPromise());
|
|
||||||
+ CHECK(context_js->get(PromiseBuiltins::kPromiseSlot)->IsJSPromise());
|
|
||||||
CHECK_EQ(ReadOnlyRoots(isolate).false_value(),
|
|
||||||
- context_js->get(PromiseBuiltinsAssembler::kDebugEventSlot));
|
|
||||||
+ context_js->get(PromiseBuiltins::kDebugEventSlot));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(CreatePromiseResolvingFunctions) {
|
|
||||||
@@ -2520,13 +2521,12 @@ TEST(CreatePromiseGetCapabilitiesExecutorContext) {
|
|
||||||
ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
|
|
||||||
CHECK(result_obj->IsContext());
|
|
||||||
Handle<Context> context_js = Handle<Context>::cast(result_obj);
|
|
||||||
- CHECK_EQ(PromiseBuiltinsAssembler::kCapabilitiesContextLength,
|
|
||||||
- context_js->length());
|
|
||||||
+ CHECK_EQ(PromiseBuiltins::kCapabilitiesContextLength, context_js->length());
|
|
||||||
CHECK_EQ(isolate->native_context()->scope_info(), context_js->scope_info());
|
|
||||||
CHECK_EQ(ReadOnlyRoots(isolate).the_hole_value(), context_js->extension());
|
|
||||||
CHECK_EQ(*isolate->native_context(), context_js->native_context());
|
|
||||||
- CHECK(context_js->get(PromiseBuiltinsAssembler::kCapabilitySlot)
|
|
||||||
- ->IsPromiseCapability());
|
|
||||||
+ CHECK(
|
|
||||||
+ context_js->get(PromiseBuiltins::kCapabilitySlot)->IsPromiseCapability());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(NewPromiseCapability) {
|
|
||||||
@@ -2573,10 +2573,8 @@ TEST(NewPromiseCapability) {
|
|
||||||
CHECK_EQ(isolate->native_context()->scope_info(), context->scope_info());
|
|
||||||
CHECK_EQ(ReadOnlyRoots(isolate).the_hole_value(), context->extension());
|
|
||||||
CHECK_EQ(*isolate->native_context(), context->native_context());
|
|
||||||
- CHECK_EQ(PromiseBuiltinsAssembler::kPromiseContextLength,
|
|
||||||
- context->length());
|
|
||||||
- CHECK_EQ(context->get(PromiseBuiltinsAssembler::kPromiseSlot),
|
|
||||||
- result->promise());
|
|
||||||
+ CHECK_EQ(PromiseBuiltins::kPromiseContextLength, context->length());
|
|
||||||
+ CHECK_EQ(context->get(PromiseBuiltins::kPromiseSlot), result->promise());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue