Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index f01c3d120af1fe6bd00647712ab0e4622b4bb761..99b4900ed8b4fb48c4c64435eaaa4f3c4df44060 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -248,12 +248,7 @@ static void LookupForRead(Handle<Object> object, |
bool IC::TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, |
Handle<String> name) { |
- if (target()->is_keyed_stub()) { |
- // Determine whether the failure is due to a name failure. |
- if (!name->IsName()) return false; |
- Name* stub_name = target()->FindFirstName(); |
- if (*name != stub_name) return false; |
- } |
+ if (!IsNameCompatibleWithMonomorphicPrototypeFailure(name)) return false; |
InlineCacheHolderFlag cache_holder = |
Code::ExtractCacheHolderFromFlags(target()->flags()); |
@@ -336,6 +331,18 @@ void IC::TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name) { |
} |
+bool IC::IsNameCompatibleWithMonomorphicPrototypeFailure(Handle<Object> name) { |
+ if (target()->is_keyed_stub()) { |
+ // Determine whether the failure is due to a name failure. |
+ if (!name->IsName()) return false; |
+ Name* stub_name = target()->FindFirstName(); |
+ if (*name != stub_name) return false; |
+ } |
+ |
+ return true; |
+} |
+ |
+ |
void IC::UpdateState(Handle<Object> receiver, Handle<Object> name) { |
if (!name->IsString()) return; |
if (state() != MONOMORPHIC) { |
@@ -352,8 +359,9 @@ void IC::UpdateState(Handle<Object> receiver, Handle<Object> name) { |
// because of changes in the prototype chain to avoid hitting it |
// again. |
if (TryRemoveInvalidPrototypeDependentStub( |
- receiver, Handle<String>::cast(name))) { |
- return MarkMonomorphicPrototypeFailure(); |
+ receiver, Handle<String>::cast(name)) && |
+ TryMarkMonomorphicPrototypeFailure(name)) { |
+ return; |
} |
// The builtins object is special. It only changes when JavaScript |
@@ -1184,8 +1192,9 @@ static bool LookupForWrite(Handle<JSObject> receiver, |
// entirely by the migration above. |
receiver->map()->LookupTransition(*holder, *name, lookup); |
if (!lookup->IsTransition()) return false; |
- ic->MarkMonomorphicPrototypeFailure(); |
+ return ic->TryMarkMonomorphicPrototypeFailure(name); |
} |
+ |
return true; |
} |