OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 Heap::Heap() | 71 Heap::Heap() |
72 : external_memory_(0), | 72 : external_memory_(0), |
73 external_memory_limit_(kExternalAllocationLimit), | 73 external_memory_limit_(kExternalAllocationLimit), |
74 external_memory_at_last_mark_compact_(0), | 74 external_memory_at_last_mark_compact_(0), |
75 isolate_(nullptr), | 75 isolate_(nullptr), |
76 code_range_size_(0), | 76 code_range_size_(0), |
77 // semispace_size_ should be a power of 2 and old_generation_size_ should | 77 // semispace_size_ should be a power of 2 and old_generation_size_ should |
78 // be a multiple of Page::kPageSize. | 78 // be a multiple of Page::kPageSize. |
79 max_semi_space_size_(8 * (kPointerSize / 4) * MB), | 79 max_semi_space_size_(8 * (kPointerSize / 4) * MB), |
80 initial_semispace_size_(Page::kPageSize), | 80 initial_semispace_size_(MB), |
81 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), | 81 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), |
82 initial_old_generation_size_(max_old_generation_size_ / | 82 initial_old_generation_size_(max_old_generation_size_ / |
83 kInitalOldGenerationLimitFactor), | 83 kInitalOldGenerationLimitFactor), |
84 old_generation_size_configured_(false), | 84 old_generation_size_configured_(false), |
85 max_executable_size_(256ul * (kPointerSize / 4) * MB), | 85 max_executable_size_(256ul * (kPointerSize / 4) * MB), |
86 // Variables set based on semispace_size_ and old_generation_size_ in | 86 // Variables set based on semispace_size_ and old_generation_size_ in |
87 // ConfigureHeap. | 87 // ConfigureHeap. |
88 // Will be 4 * reserved_semispace_size_ to ensure that young | 88 // Will be 4 * reserved_semispace_size_ to ensure that young |
89 // generation can be aligned to its size. | 89 // generation can be aligned to its size. |
90 maximum_committed_(0), | 90 maximum_committed_(0), |
(...skipping 5330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5421 roots_[kRealStackLimitRootIndex] = Smi::FromInt(0); | 5421 roots_[kRealStackLimitRootIndex] = Smi::FromInt(0); |
5422 } | 5422 } |
5423 | 5423 |
5424 void Heap::PrintAlloctionsHash() { | 5424 void Heap::PrintAlloctionsHash() { |
5425 uint32_t hash = StringHasher::GetHashCore(raw_allocations_hash_); | 5425 uint32_t hash = StringHasher::GetHashCore(raw_allocations_hash_); |
5426 PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count(), hash); | 5426 PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count(), hash); |
5427 } | 5427 } |
5428 | 5428 |
5429 | 5429 |
5430 void Heap::NotifyDeserializationComplete() { | 5430 void Heap::NotifyDeserializationComplete() { |
5431 deserialization_complete_ = true; | 5431 DCHECK_EQ(0, gc_count()); |
5432 #ifdef DEBUG | |
5433 // All pages right after bootstrapping must be marked as never-evacuate. | |
5434 PagedSpaces spaces(this); | 5432 PagedSpaces spaces(this); |
5435 for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { | 5433 for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { |
| 5434 if (isolate()->snapshot_available()) s->ShrinkImmortalImmovablePages(); |
| 5435 #ifdef DEBUG |
| 5436 // All pages right after bootstrapping must be marked as never-evacuate. |
5436 for (Page* p : *s) { | 5437 for (Page* p : *s) { |
5437 CHECK(p->NeverEvacuate()); | 5438 CHECK(p->NeverEvacuate()); |
5438 } | 5439 } |
| 5440 #endif // DEBUG |
5439 } | 5441 } |
5440 #endif // DEBUG | 5442 |
| 5443 deserialization_complete_ = true; |
5441 } | 5444 } |
5442 | 5445 |
5443 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { | 5446 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { |
5444 mark_compact_collector()->SetEmbedderHeapTracer(tracer); | 5447 mark_compact_collector()->SetEmbedderHeapTracer(tracer); |
5445 } | 5448 } |
5446 | 5449 |
5447 bool Heap::UsingEmbedderHeapTracer() { | 5450 bool Heap::UsingEmbedderHeapTracer() { |
5448 return mark_compact_collector()->UsingEmbedderHeapTracer(); | 5451 return mark_compact_collector()->UsingEmbedderHeapTracer(); |
5449 } | 5452 } |
5450 | 5453 |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6485 } | 6488 } |
6486 | 6489 |
6487 | 6490 |
6488 // static | 6491 // static |
6489 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6492 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6490 return StaticVisitorBase::GetVisitorId(map); | 6493 return StaticVisitorBase::GetVisitorId(map); |
6491 } | 6494 } |
6492 | 6495 |
6493 } // namespace internal | 6496 } // namespace internal |
6494 } // namespace v8 | 6497 } // namespace v8 |
OLD | NEW |