Skip to content

Commit 93f189f

Browse files
verwaestCommit Bot
authored andcommitted
[ic] Fix non-GlobalIC store to interceptor on the global object
We possibly need to load the global object from the global proxy as the holder of the named interceptor. Change-Id: I0f9f2e448630608ae853588f6751b55574a9efd9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1930903 Commit-Queue: Igor Sheludko <[email protected]> Reviewed-by: Igor Sheludko <[email protected]> Cr-Commit-Position: refs/heads/master@{#65119}
1 parent d8cb3b3 commit 93f189f

2 files changed

Lines changed: 11 additions & 28 deletions

File tree

src/ic/accessor-assembler.cc

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,7 @@ void AccessorAssembler::HandleStoreICHandlerCase(
10941094
{
10951095
Comment("store_interceptor");
10961096
TailCallRuntime(Runtime::kStorePropertyWithInterceptor, p->context(),
1097-
p->value(), p->slot(), p->vector(), p->receiver(),
1098-
p->name());
1097+
p->value(), p->receiver(), p->name());
10991098
}
11001099

11011100
BIND(&if_slow);
@@ -1558,8 +1557,7 @@ void AccessorAssembler::HandleStoreICProtoHandler(
15581557

15591558
{
15601559
Label if_add_normal(this), if_store_global_proxy(this), if_api_setter(this),
1561-
if_accessor(this), if_native_data_property(this), if_slow(this),
1562-
if_interceptor(this);
1560+
if_accessor(this), if_native_data_property(this), if_slow(this);
15631561

15641562
CSA_ASSERT(this, TaggedIsSmi(smi_handler));
15651563
TNode<Int32T> handler_word = SmiToInt32(CAST(smi_handler));
@@ -1589,9 +1587,6 @@ void AccessorAssembler::HandleStoreICProtoHandler(
15891587
GotoIf(Word32Equal(handler_kind, Int32Constant(StoreHandler::kApiSetter)),
15901588
&if_api_setter);
15911589

1592-
GotoIf(Word32Equal(handler_kind, Int32Constant(StoreHandler::kInterceptor)),
1593-
&if_interceptor);
1594-
15951590
GotoIf(
15961591
Word32Equal(handler_kind,
15971592
Int32Constant(StoreHandler::kApiSetterHolderIsPrototype)),
@@ -1616,14 +1611,6 @@ void AccessorAssembler::HandleStoreICProtoHandler(
16161611
}
16171612
}
16181613

1619-
BIND(&if_interceptor);
1620-
{
1621-
Comment("store_interceptor");
1622-
TailCallRuntime(Runtime::kStorePropertyWithInterceptor, p->context(),
1623-
p->value(), p->slot(), p->vector(), p->receiver(),
1624-
p->name());
1625-
}
1626-
16271614
BIND(&if_add_normal);
16281615
{
16291616
// This is a case of "transitioning store" to a dictionary mode object

src/ic/ic.cc

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,8 +1363,7 @@ bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
13631363
case LookupIterator::INTERCEPTOR: {
13641364
Handle<JSObject> holder = it->GetHolder<JSObject>();
13651365
InterceptorInfo info = holder->GetNamedInterceptor();
1366-
if ((it->HolderIsReceiverOrHiddenPrototype() &&
1367-
!info.non_masking()) ||
1366+
if (it->HolderIsReceiverOrHiddenPrototype() ||
13681367
!info.getter().IsUndefined(isolate()) ||
13691368
!info.query().IsUndefined(isolate())) {
13701369
return true;
@@ -2757,23 +2756,20 @@ RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptor) {
27572756

27582757
RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) {
27592758
HandleScope scope(isolate);
2760-
DCHECK_EQ(5, args.length());
2759+
DCHECK_EQ(3, args.length());
27612760
// Runtime functions don't follow the IC's calling convention.
27622761
Handle<Object> value = args.at(0);
2763-
Handle<Smi> slot = args.at<Smi>(1);
2764-
Handle<FeedbackVector> vector = args.at<FeedbackVector>(2);
2765-
Handle<JSObject> receiver = args.at<JSObject>(3);
2766-
Handle<Name> name = args.at<Name>(4);
2767-
FeedbackSlot vector_slot = FeedbackVector::ToSlot(slot->value());
2762+
Handle<JSObject> receiver = args.at<JSObject>(1);
2763+
Handle<Name> name = args.at<Name>(2);
27682764

27692765
// TODO(ishell): Cache interceptor_holder in the store handler like we do
27702766
// for LoadHandler::kInterceptor case.
27712767
Handle<JSObject> interceptor_holder = receiver;
2772-
if (receiver->IsJSGlobalProxy()) {
2773-
FeedbackSlotKind kind = vector->GetKind(vector_slot);
2774-
if (IsStoreGlobalICKind(kind)) {
2775-
interceptor_holder = Handle<JSObject>::cast(isolate->global_object());
2776-
}
2768+
if (receiver->IsJSGlobalProxy() &&
2769+
(!receiver->HasNamedInterceptor() ||
2770+
receiver->GetNamedInterceptor().non_masking())) {
2771+
interceptor_holder =
2772+
handle(JSObject::cast(receiver->map().prototype()), isolate);
27772773
}
27782774
DCHECK(interceptor_holder->HasNamedInterceptor());
27792775
Handle<InterceptorInfo> interceptor(interceptor_holder->GetNamedInterceptor(),

0 commit comments

Comments
 (0)