Skip to content

Commit

Permalink
deps: V8: cherry-pick 367b0c1e7a32
Browse files Browse the repository at this point in the history
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 <victorgomes@chromium.org>
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Auto-Submit: Victor Gomes <victorgomes@chromium.org>
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#68636}

Refs: v8/v8@367b0c1

PR-URL: #42637
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
legendecas authored and juanarbol committed May 1, 2022
1 parent 3d3d7ed commit b52a268
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -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 #####

Expand Down
3 changes: 1 addition & 2 deletions deps/v8/src/codegen/code-stub-assembler.cc
Expand Up @@ -13088,8 +13088,7 @@ void CodeStubAssembler::InitializeSyntheticFunctionContext(
SmiConstant(slots));

TNode<Context> context = CAST(context_heap_object);
const TNode<Object> empty_scope_info =
LoadContextElement(native_context, Context::SCOPE_INFO_INDEX);
const TNode<Object> empty_scope_info = LoadRoot(RootIndex::kEmptyScopeInfo);
StoreContextElementNoWriteBarrier(context, Context::SCOPE_INFO_INDEX,
empty_scope_info);
StoreContextElementNoWriteBarrier(context, Context::PREVIOUS_INDEX,
Expand Down
7 changes: 4 additions & 3 deletions deps/v8/test/cctest/test-code-stub-assembler.cc
Expand Up @@ -2566,7 +2566,7 @@ TEST(CreatePromiseResolvingFunctionsContext) {
ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
CHECK(result->IsContext());
Handle<Context> context_js = Handle<Context>::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(),
Expand Down Expand Up @@ -2724,7 +2724,7 @@ TEST(CreatePromiseGetCapabilitiesExecutorContext) {
CHECK(result_obj->IsContext());
Handle<Context> context_js = Handle<Context>::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());
Expand Down Expand Up @@ -2773,7 +2773,8 @@ TEST(NewPromiseCapability) {

for (auto&& callback : callbacks) {
Handle<Context> 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());
Expand Down

0 comments on commit b52a268

Please sign in to comment.