Index: src/ic/ic.cc |
diff --git a/src/ic/ic.cc b/src/ic/ic.cc |
index 13ba016cb6f094d0f1ba1e8d1753ab860273e753..66ce93526c5b648160a552320b4112aa5cca5a4f 100644 |
--- a/src/ic/ic.cc |
+++ b/src/ic/ic.cc |
@@ -929,7 +929,14 @@ Handle<Code> IC::ComputeHandler(LookupIterator* lookup, Handle<Object> value) { |
code = CompileHandler(lookup, value, flag); |
DCHECK(code->is_handler()); |
- if (code->type() != Code::NORMAL) { |
+ // TODO(mvstanton): we'd only like to cache code on the map when it's custom |
+ // code compiled for this map, otherwise it's already cached in the global |
+ // code |
+ // cache. We are also guarding against installing code with flags that don't |
+ // match the desired CacheHolderFlag computed above, which would lead to |
+ // invalid lookups later. |
+ if (code->type() != Code::NORMAL && |
+ Code::ExtractCacheHolderFromFlags(code->flags()) == flag) { |
Map::UpdateCodeCache(stub_holder_map, lookup->name(), code); |
} |