deps: cherry-pick 9eb96bb from upstream V8
Original commit message:
[api] Avoid needlessly calling descriptor interceptors
Reland part of https://chromium-review.googlesource.com/c/v8/v8/+/816515.
Change-Id: I72ad85ffd162fc0563fc25cdf35189e894f9dc82
Reviewed-on: https://chromium-review.googlesource.com/1138808
Commit-Queue: Timothy Gu <timothygu@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54492}
PR-URL: https://github.com/nodejs/node/pull/22390
Fixes: https://github.com/nodejs/node/issues/17480
Fixes: https://github.com/nodejs/node/issues/17481
Refs: 9eb96bb431
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
fa543c00cd
commit
2f9dabd0d8
@ -29,7 +29,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.16',
|
||||
'v8_embedder_string': '-node.17',
|
||||
|
||||
# Enable disassembler for `--print-code` v8 options
|
||||
'v8_enable_disassembler': 1,
|
||||
|
14
deps/v8/src/objects.cc
vendored
14
deps/v8/src/objects.cc
vendored
@ -7662,13 +7662,17 @@ namespace {
|
||||
|
||||
Maybe<bool> GetPropertyDescriptorWithInterceptor(LookupIterator* it,
|
||||
PropertyDescriptor* desc) {
|
||||
bool has_access = true;
|
||||
if (it->state() == LookupIterator::ACCESS_CHECK) {
|
||||
has_access = it->HasAccess() || JSObject::AllCanRead(it);
|
||||
it->Next();
|
||||
if (it->HasAccess()) {
|
||||
it->Next();
|
||||
} else if (!JSObject::AllCanRead(it) ||
|
||||
it->state() != LookupIterator::INTERCEPTOR) {
|
||||
it->Restart();
|
||||
return Just(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (has_access && it->state() == LookupIterator::INTERCEPTOR) {
|
||||
if (it->state() == LookupIterator::INTERCEPTOR) {
|
||||
Isolate* isolate = it->isolate();
|
||||
Handle<InterceptorInfo> interceptor = it->GetInterceptor();
|
||||
if (!interceptor->descriptor()->IsUndefined(isolate)) {
|
||||
@ -7700,9 +7704,9 @@ Maybe<bool> GetPropertyDescriptorWithInterceptor(LookupIterator* it,
|
||||
|
||||
return Just(true);
|
||||
}
|
||||
it->Next();
|
||||
}
|
||||
}
|
||||
it->Restart();
|
||||
return Just(false);
|
||||
}
|
||||
} // namespace
|
||||
|
12
deps/v8/test/cctest/test-api-interceptors.cc
vendored
12
deps/v8/test/cctest/test-api-interceptors.cc
vendored
@ -4768,7 +4768,7 @@ TEST(NamedAllCanReadInterceptor) {
|
||||
ExpectInt32("checked.whatever", 17);
|
||||
CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')")
|
||||
->IsUndefined());
|
||||
CHECK_EQ(6, access_check_data.count);
|
||||
CHECK_EQ(5, access_check_data.count);
|
||||
|
||||
access_check_data.result = false;
|
||||
ExpectInt32("checked.whatever", intercept_data_0.value);
|
||||
@ -4777,7 +4777,7 @@ TEST(NamedAllCanReadInterceptor) {
|
||||
CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')");
|
||||
CHECK(try_catch.HasCaught());
|
||||
}
|
||||
CHECK_EQ(9, access_check_data.count);
|
||||
CHECK_EQ(8, access_check_data.count);
|
||||
|
||||
intercept_data_1.should_intercept = true;
|
||||
ExpectInt32("checked.whatever", intercept_data_1.value);
|
||||
@ -4786,7 +4786,7 @@ TEST(NamedAllCanReadInterceptor) {
|
||||
CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')");
|
||||
CHECK(try_catch.HasCaught());
|
||||
}
|
||||
CHECK_EQ(12, access_check_data.count);
|
||||
CHECK_EQ(11, access_check_data.count);
|
||||
g_access_check_data = nullptr;
|
||||
}
|
||||
|
||||
@ -4855,7 +4855,7 @@ TEST(IndexedAllCanReadInterceptor) {
|
||||
ExpectInt32("checked[15]", 17);
|
||||
CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, '15')")
|
||||
->IsUndefined());
|
||||
CHECK_EQ(6, access_check_data.count);
|
||||
CHECK_EQ(5, access_check_data.count);
|
||||
|
||||
access_check_data.result = false;
|
||||
ExpectInt32("checked[15]", intercept_data_0.value);
|
||||
@ -4864,7 +4864,7 @@ TEST(IndexedAllCanReadInterceptor) {
|
||||
CompileRun("Object.getOwnPropertyDescriptor(checked, '15')");
|
||||
CHECK(try_catch.HasCaught());
|
||||
}
|
||||
CHECK_EQ(9, access_check_data.count);
|
||||
CHECK_EQ(8, access_check_data.count);
|
||||
|
||||
intercept_data_1.should_intercept = true;
|
||||
ExpectInt32("checked[15]", intercept_data_1.value);
|
||||
@ -4873,7 +4873,7 @@ TEST(IndexedAllCanReadInterceptor) {
|
||||
CompileRun("Object.getOwnPropertyDescriptor(checked, '15')");
|
||||
CHECK(try_catch.HasCaught());
|
||||
}
|
||||
CHECK_EQ(12, access_check_data.count);
|
||||
CHECK_EQ(11, access_check_data.count);
|
||||
|
||||
g_access_check_data = nullptr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user