Index: src/ic.cc |
=================================================================== |
--- src/ic.cc (revision 4852) |
+++ src/ic.cc (working copy) |
@@ -387,6 +387,7 @@ |
return *delegate; |
} |
+ |
void CallICBase::ReceiverToObject(Handle<Object> object) { |
HandleScope scope; |
Handle<Object> receiver(object); |
@@ -588,6 +589,9 @@ |
state == MONOMORPHIC || |
state == MONOMORPHIC_PROTOTYPE_FAILURE) { |
set_target(Code::cast(code)); |
+ } else if (state == MEGAMORPHIC) { |
+ // Update the stub cache. |
+ StubCache::Set(*name, GetCodeCacheMapForObject(*object), Code::cast(code)); |
} |
#ifdef DEBUG |
@@ -664,7 +668,6 @@ |
Code* target = NULL; |
target = Builtins::builtin(Builtins::LoadIC_StringLength); |
set_target(target); |
- StubCache::Set(*name, map, target); |
return Smi::FromInt(String::cast(*object)->length()); |
} |
@@ -679,7 +682,6 @@ |
Code* target = Builtins::builtin(Builtins::LoadIC_ArrayLength); |
set_target(target); |
- StubCache::Set(*name, map, target); |
return JSArray::cast(*object)->length(); |
} |
@@ -691,7 +693,6 @@ |
#endif |
Code* target = Builtins::builtin(Builtins::LoadIC_FunctionPrototype); |
set_target(target); |
- StubCache::Set(*name, HeapObject::cast(*object)->map(), target); |
return Accessors::FunctionGetPrototype(*object, 0); |
} |
} |
@@ -847,6 +848,9 @@ |
set_target(Code::cast(code)); |
} else if (state == MONOMORPHIC) { |
set_target(megamorphic_stub()); |
+ } else if (state == MEGAMORPHIC) { |
+ // Update the stub cache. |
+ StubCache::Set(*name, GetCodeCacheMapForObject(*object), Code::cast(code)); |
} |
#ifdef DEBUG |
@@ -1110,7 +1114,6 @@ |
return *value; |
} |
- |
// Use specialized code for setting the length of arrays. |
if (receiver->IsJSArray() |
&& name->Equals(Heap::length_symbol()) |
@@ -1120,7 +1123,6 @@ |
#endif |
Code* target = Builtins::builtin(Builtins::StoreIC_ArrayLength); |
set_target(target); |
- StubCache::Set(*name, HeapObject::cast(*object)->map(), target); |
return receiver->SetProperty(*name, *value, NONE); |
} |
@@ -1208,8 +1210,11 @@ |
if (state == UNINITIALIZED || state == MONOMORPHIC_PROTOTYPE_FAILURE) { |
set_target(Code::cast(code)); |
} else if (state == MONOMORPHIC) { |
- // Only move to mega morphic if the target changes. |
+ // Only move to megamorphic if the target changes. |
if (target() != Code::cast(code)) set_target(megamorphic_stub()); |
+ } else if (state == MEGAMORPHIC) { |
+ // Update the stub cache. |
+ StubCache::Set(*name, receiver->map(), Code::cast(code)); |
} |
#ifdef DEBUG |