Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 1b461847c1178569e2c73bd9e78f4df698c95ca5..3b97f73120975d0c2c5fe1371ad33a5ce408056e 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,17 @@ MaybeObject* Heap::AllocateCodeCache() { |
} |
+MaybeObject* Heap::AllocatePolymorphicCodeCache() { |
+ Object* result; |
+ { MaybeObject* maybe_result = AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE); |
+ if (!maybe_result->ToObject(&result)) return maybe_result; |
+ } |
+ PolymorphicCodeCache* code_cache = PolymorphicCodeCache::cast(result); |
+ code_cache->set_cache(undefined_value()); |
Mads Ager (chromium)
2011/06/01 08:45:53
You actually don't need this. Structs have all fie
Jakob Kummerow
2011/06/01 10:15:27
Nice! Done.
|
+ return code_cache; |
+} |
+ |
+ |
const Heap::StringTypeTable Heap::string_type_table[] = { |
#define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ |
{type, size, k##camel_name##MapRootIndex}, |
@@ -2141,6 +2155,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)); |