Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 1b461847c1178569e2c73bd9e78f4df698c95ca5..2b321adf13ef63c0a26a4a6ebdaf14f80e0950c0 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -851,6 +851,9 @@ void Heap::MarkCompactPrologue(bool is_compacting) { |
CompletelyClearInstanceofCache(); |
if (is_compacting) FlushNumberStringCache(); |
+ if (FLAG_cleanup_code_caches_at_gc) { |
+ polymorphic_code_cache()->set_cache(undefined_value()); |
+ } |
ClearNormalizedMapCaches(); |
} |
@@ -1634,6 +1637,11 @@ MaybeObject* Heap::AllocateCodeCache() { |
} |
+MaybeObject* Heap::AllocatePolymorphicCodeCache() { |
+ return AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE); |
+} |
+ |
+ |
const Heap::StringTypeTable Heap::string_type_table[] = { |
#define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ |
{type, size, k##camel_name##MapRootIndex}, |
@@ -2141,6 +2149,11 @@ bool Heap::CreateInitialObjects() { |
} |
set_non_monomorphic_cache(NumberDictionary::cast(obj)); |
+ { MaybeObject* maybe_obj = AllocatePolymorphicCodeCache(); |
+ if (!maybe_obj->ToObject(&obj)) return false; |
+ } |
+ set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj)); |
+ |
set_instanceof_cache_function(Smi::FromInt(0)); |
set_instanceof_cache_map(Smi::FromInt(0)); |
set_instanceof_cache_answer(Smi::FromInt(0)); |