Chromium Code Reviews| Index: src/heap/heap.cc |
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
| index 9c57ea3bdb2a0ad16d97d0595c954aa37d20a097..6591deadebd814ce129d3f8c7d36c64f50b81c46 100644 |
| --- a/src/heap/heap.cc |
| +++ b/src/heap/heap.cc |
| @@ -1237,6 +1237,14 @@ void Heap::MarkCompactPrologue() { |
| } |
| ClearNormalizedMapCaches(); |
| + |
| + if (mark_compact_collector_.reduce_memory_footprint()) { |
| + embedded_map_cache_ = undefined_value(); |
| + } else { |
| + if (embedded_map_cache_->IsEmbeddedMapCache()) { |
| + EmbeddedMapCache::cast(embedded_map_cache_)->Age(); |
| + } |
| + } |
|
Hannes Payer (out of office)
2014/11/17 17:34:33
Factor that code out into a function to keep the p
|
| } |
| @@ -4909,6 +4917,11 @@ void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) { |
| } |
| +void Heap::IterateEmbeddedMapCache(ObjectVisitor* visitor) { |
| + visitor->VisitPointer(&embedded_map_cache_); |
| +} |
| + |
| + |
| // TODO(1236194): Since the heap size is configurable on the command line |
| // and through the API, we should gracefully handle the case that the heap |
| // size is not big enough to fit all the initial objects. |
| @@ -5279,6 +5292,7 @@ bool Heap::CreateHeapObjects() { |
| set_array_buffers_list(undefined_value()); |
| set_allocation_sites_list(undefined_value()); |
| weak_object_to_code_table_ = undefined_value(); |
| + embedded_map_cache_ = undefined_value(); |
| return true; |
| } |
| @@ -5489,6 +5503,19 @@ void Heap::EnsureWeakObjectToCodeTable() { |
| } |
| +void Heap::CacheEmbeddedMap(Handle<Map> map) { |
| + HandleScope scope(isolate()); |
| + if (!embedded_map_cache_->IsHashTable()) { |
| + embedded_map_cache_ = |
| + *EmbeddedMapCache::New(isolate(), 512, USE_DEFAULT_MINIMUM_CAPACITY, |
| + TENURED); |
| + } |
| + Handle<EmbeddedMapCache> cache(EmbeddedMapCache::cast(embedded_map_cache_), |
| + isolate()); |
| + embedded_map_cache_ = *EmbeddedMapCache::Put(cache, map); |
| +} |
| + |
| + |
| void Heap::FatalProcessOutOfMemory(const char* location, bool take_snapshot) { |
| v8::internal::V8::FatalProcessOutOfMemory(location, take_snapshot); |
| } |