Index: src/ic/ic.cc |
diff --git a/src/ic/ic.cc b/src/ic/ic.cc |
index e8b2dbf9c98796d02a0e768466c4ab643d68d3dd..60e03b770eba8c2cf429be92eea9ef5c1ba20f8f 100644 |
--- a/src/ic/ic.cc |
+++ b/src/ic/ic.cc |
@@ -1676,6 +1676,19 @@ void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value, |
} |
+static Handle<Code> PropertyCellStoreHandler( |
+ Isolate* isolate, Handle<JSObject> receiver, Handle<GlobalObject> holder, |
+ Handle<Name> name, Handle<PropertyCell> cell, Handle<Object> value) { |
+ auto union_type = PropertyCell::UpdatedType(cell, value); |
+ StoreGlobalStub stub(isolate, union_type->IsConstant(), |
+ receiver->IsJSGlobalProxy()); |
+ auto code = stub.GetCodeCopyFromTemplate(holder, cell); |
+ // TODO(verwaest): Move caching of these NORMAL stubs outside as well. |
+ HeapObject::UpdateMapCodeCache(receiver, name, code); |
+ return code; |
+} |
+ |
+ |
Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup, |
Handle<Object> value, |
CacheHolderFlag cache_holder) { |
@@ -1688,6 +1701,13 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup, |
switch (lookup->state()) { |
case LookupIterator::TRANSITION: { |
+ auto store_target = lookup->GetStoreTarget(); |
+ if (store_target->IsGlobalObject()) { |
+ auto cell = lookup->GetTransitionPropertyCell(); |
+ return PropertyCellStoreHandler( |
+ isolate(), store_target, Handle<GlobalObject>::cast(store_target), |
+ lookup->name(), cell, value); |
+ } |
Handle<Map> transition = lookup->transition_map(); |
// Currently not handled by CompileStoreTransition. |
if (!holder->HasFastProperties()) { |
@@ -1754,17 +1774,12 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup, |
case LookupIterator::DATA: { |
if (lookup->is_dictionary_holder()) { |
if (holder->IsGlobalObject()) { |
- Handle<PropertyCell> cell = lookup->GetPropertyCell(); |
- Handle<HeapType> union_type = PropertyCell::UpdatedType(cell, value); |
DCHECK(holder.is_identical_to(receiver) || |
receiver->map()->prototype() == *holder); |
- StoreGlobalStub stub(isolate(), union_type->IsConstant(), |
- receiver->IsJSGlobalProxy()); |
- Handle<Code> code = stub.GetCodeCopyFromTemplate( |
- Handle<GlobalObject>::cast(holder), cell); |
- // TODO(verwaest): Move caching of these NORMAL stubs outside as well. |
- HeapObject::UpdateMapCodeCache(receiver, lookup->name(), code); |
- return code; |
+ auto cell = lookup->GetPropertyCell(); |
+ return PropertyCellStoreHandler(isolate(), receiver, |
+ Handle<GlobalObject>::cast(holder), |
+ lookup->name(), cell, value); |
} |
DCHECK(holder.is_identical_to(receiver)); |
return isolate()->builtins()->StoreIC_Normal(); |