Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index bc7550ed9a63e3a8ff55a6ed815ea4b93d8b9f79..2a3439f306466c6850a98f49cb64b8ff3c1224f9 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -648,7 +648,10 @@ void Heap::ClearJSFunctionResultCaches() { |
// Clear the caches: |
int length = caches->length(); |
for (int i = 0; i < length; i++) { |
- JSFunctionResultCache::cast(caches->get(i))->Clear(); |
+ Object* cache = caches->get(i); |
+ if (!cache->IsUndefined()) { |
+ JSFunctionResultCache::cast(cache)->Clear(); |
+ } |
} |
// Get the next context: |
context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); |
@@ -665,7 +668,11 @@ void Heap::ClearNormalizedMapCaches() { |
Object* context = global_contexts_list_; |
while (!context->IsUndefined()) { |
- Context::cast(context)->normalized_map_cache()->Clear(); |
+ int index = Context::NORMALIZED_MAP_CACHE_INDEX; |
Vyacheslav Egorov (Chromium)
2011/12/13 12:26:20
I don't think we need separate variable just for i
ulan
2011/12/13 13:02:58
Done.
|
+ Object* cache = Context::cast(context)->get(index); |
+ if (!cache->IsUndefined()) { |
Vyacheslav Egorov (Chromium)
2011/12/13 12:26:20
please comment why we need to guard against partia
ulan
2011/12/13 13:02:58
Done.
|
+ NormalizedMapCache::cast(cache)->Clear(); |
+ } |
context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); |
} |
} |