From ec04c37edf658d74b7470c64854c6ea733a65858 Mon Sep 17 00:00:00 2001 From: legendecas Date: Thu, 7 Apr 2022 16:55:35 +0800 Subject: [PATCH] deps: V8: cherry-pick 367b0c1e7a32 Original commit message: [runtime] Change default scope info for SyntheticFunctionContexts This changes the default scope info for SyntheticFunctionContexts to the EmptyScopeInfo which does not contain an extension slot. The bug happened because, previously, the native context scope info was used as dummy. Change-Id: I4d6bf6918c11c79201d16bde99ed76800ad6f6c5 Bug: v8:10629 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2277806 Commit-Queue: Victor Gomes Commit-Queue: Leszek Swirski Auto-Submit: Victor Gomes Reviewed-by: Leszek Swirski Cr-Commit-Position: refs/heads/master@{#68636} Refs: https://github.com/v8/v8/commit/367b0c1e7a323deafeab56736b01bc7e14fc1998 --- common.gypi | 2 +- deps/v8/src/codegen/code-stub-assembler.cc | 3 +-- deps/v8/test/cctest/test-code-stub-assembler.cc | 7 ++++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common.gypi b/common.gypi index f3a4aad62abef6..0f01e7eca1273f 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.85', + 'v8_embedder_string': '-node.86', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/codegen/code-stub-assembler.cc b/deps/v8/src/codegen/code-stub-assembler.cc index 843d1e39ac984f..89e6c960c1b324 100644 --- a/deps/v8/src/codegen/code-stub-assembler.cc +++ b/deps/v8/src/codegen/code-stub-assembler.cc @@ -13088,8 +13088,7 @@ void CodeStubAssembler::InitializeSyntheticFunctionContext( SmiConstant(slots)); TNode context = CAST(context_heap_object); - const TNode empty_scope_info = - LoadContextElement(native_context, Context::SCOPE_INFO_INDEX); + const TNode empty_scope_info = LoadRoot(RootIndex::kEmptyScopeInfo); StoreContextElementNoWriteBarrier(context, Context::SCOPE_INFO_INDEX, empty_scope_info); StoreContextElementNoWriteBarrier(context, Context::PREVIOUS_INDEX, diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc index f9b92207a0c248..30d3e0f00e4e03 100644 --- a/deps/v8/test/cctest/test-code-stub-assembler.cc +++ b/deps/v8/test/cctest/test-code-stub-assembler.cc @@ -2566,7 +2566,7 @@ TEST(CreatePromiseResolvingFunctionsContext) { ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); CHECK(result->IsContext()); Handle context_js = Handle::cast(result); - CHECK_EQ(isolate->native_context()->scope_info(), context_js->scope_info()); + CHECK_EQ(isolate->root(RootIndex::kEmptyScopeInfo), context_js->scope_info()); CHECK_EQ(*isolate->native_context(), context_js->native_context()); CHECK(context_js->get(PromiseBuiltins::kPromiseSlot).IsJSPromise()); CHECK_EQ(ReadOnlyRoots(isolate).false_value(), @@ -2724,7 +2724,7 @@ TEST(CreatePromiseGetCapabilitiesExecutorContext) { CHECK(result_obj->IsContext()); Handle context_js = Handle::cast(result_obj); CHECK_EQ(PromiseBuiltins::kCapabilitiesContextLength, context_js->length()); - CHECK_EQ(isolate->native_context()->scope_info(), context_js->scope_info()); + CHECK_EQ(isolate->root(RootIndex::kEmptyScopeInfo), context_js->scope_info()); CHECK_EQ(*isolate->native_context(), context_js->native_context()); CHECK( context_js->get(PromiseBuiltins::kCapabilitySlot).IsPromiseCapability()); @@ -2773,7 +2773,8 @@ TEST(NewPromiseCapability) { for (auto&& callback : callbacks) { Handle context(Context::cast(callback->context()), isolate); - CHECK_EQ(isolate->native_context()->scope_info(), context->scope_info()); + CHECK_EQ(isolate->root(RootIndex::kEmptyScopeInfo), + context->scope_info()); CHECK_EQ(*isolate->native_context(), context->native_context()); CHECK_EQ(PromiseBuiltins::kPromiseContextLength, context->length()); CHECK_EQ(context->get(PromiseBuiltins::kPromiseSlot), result->promise());