Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index f01c3d120af1fe6bd00647712ab0e4622b4bb761..fc8c23416a87d406a786fb72357aae69743d3a7b 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) { |
@@ -353,7 +360,7 @@ void IC::UpdateState(Handle<Object> receiver, Handle<Object> name) { |
// again. |
if (TryRemoveInvalidPrototypeDependentStub( |
receiver, Handle<String>::cast(name))) { |
Toon Verwaest
2014/03/31 15:15:54
&& TryMarkMono...
mvstanton
2014/04/01 14:14:18
Done.
|
- return MarkMonomorphicPrototypeFailure(); |
+ if (TryMarkMonomorphicPrototypeFailure(name)) return; |
} |
// The builtins object is special. It only changes when JavaScript |
@@ -1184,8 +1191,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; |
} |