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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 Heap::Heap() | 72 Heap::Heap() |
73 : external_memory_(0), | 73 : external_memory_(0), |
74 external_memory_limit_(kExternalAllocationLimit), | 74 external_memory_limit_(kExternalAllocationLimit), |
75 external_memory_at_last_mark_compact_(0), | 75 external_memory_at_last_mark_compact_(0), |
76 isolate_(nullptr), | 76 isolate_(nullptr), |
77 code_range_size_(0), | 77 code_range_size_(0), |
78 // semispace_size_ should be a power of 2 and old_generation_size_ should | 78 // semispace_size_ should be a power of 2 and old_generation_size_ should |
79 // be a multiple of Page::kPageSize. | 79 // be a multiple of Page::kPageSize. |
80 max_semi_space_size_(8 * (kPointerSize / 4) * MB), | 80 max_semi_space_size_(8 * (kPointerSize / 4) * MB), |
81 initial_semispace_size_(Page::kPageSize), | 81 initial_semispace_size_(MB), |
82 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), | 82 max_old_generation_size_(700ul * (kPointerSize / 4) * MB), |
83 initial_old_generation_size_(max_old_generation_size_ / | 83 initial_old_generation_size_(max_old_generation_size_ / |
84 kInitalOldGenerationLimitFactor), | 84 kInitalOldGenerationLimitFactor), |
85 old_generation_size_configured_(false), | 85 old_generation_size_configured_(false), |
86 max_executable_size_(256ul * (kPointerSize / 4) * MB), | 86 max_executable_size_(256ul * (kPointerSize / 4) * MB), |
87 // Variables set based on semispace_size_ and old_generation_size_ in | 87 // Variables set based on semispace_size_ and old_generation_size_ in |
88 // ConfigureHeap. | 88 // ConfigureHeap. |
89 // Will be 4 * reserved_semispace_size_ to ensure that young | 89 // Will be 4 * reserved_semispace_size_ to ensure that young |
90 // generation can be aligned to its size. | 90 // generation can be aligned to its size. |
91 maximum_committed_(0), | 91 maximum_committed_(0), |
(...skipping 5336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5428 roots_[kRealStackLimitRootIndex] = Smi::FromInt(0); | 5428 roots_[kRealStackLimitRootIndex] = Smi::FromInt(0); |
5429 } | 5429 } |
5430 | 5430 |
5431 void Heap::PrintAlloctionsHash() { | 5431 void Heap::PrintAlloctionsHash() { |
5432 uint32_t hash = StringHasher::GetHashCore(raw_allocations_hash_); | 5432 uint32_t hash = StringHasher::GetHashCore(raw_allocations_hash_); |
5433 PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count(), hash); | 5433 PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count(), hash); |
5434 } | 5434 } |
5435 | 5435 |
5436 | 5436 |
5437 void Heap::NotifyDeserializationComplete() { | 5437 void Heap::NotifyDeserializationComplete() { |
5438 deserialization_complete_ = true; | 5438 DCHECK_EQ(0, gc_count()); |
5439 #ifdef DEBUG | |
5440 // All pages right after bootstrapping must be marked as never-evacuate. | |
5441 PagedSpaces spaces(this); | 5439 PagedSpaces spaces(this); |
5442 for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { | 5440 for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { |
| 5441 if (isolate()->snapshot_available()) s->ShrinkImmortalImmovablePages(); |
| 5442 #ifdef DEBUG |
| 5443 // All pages right after bootstrapping must be marked as never-evacuate. |
5443 for (Page* p : *s) { | 5444 for (Page* p : *s) { |
5444 CHECK(p->NeverEvacuate()); | 5445 CHECK(p->NeverEvacuate()); |
5445 } | 5446 } |
| 5447 #endif // DEBUG |
5446 } | 5448 } |
5447 #endif // DEBUG | 5449 |
| 5450 deserialization_complete_ = true; |
5448 } | 5451 } |
5449 | 5452 |
5450 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { | 5453 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { |
5451 mark_compact_collector()->SetEmbedderHeapTracer(tracer); | 5454 mark_compact_collector()->SetEmbedderHeapTracer(tracer); |
5452 } | 5455 } |
5453 | 5456 |
5454 bool Heap::UsingEmbedderHeapTracer() { | 5457 bool Heap::UsingEmbedderHeapTracer() { |
5455 return mark_compact_collector()->UsingEmbedderHeapTracer(); | 5458 return mark_compact_collector()->UsingEmbedderHeapTracer(); |
5456 } | 5459 } |
5457 | 5460 |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6500 } | 6503 } |
6501 | 6504 |
6502 | 6505 |
6503 // static | 6506 // static |
6504 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6507 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6505 return StaticVisitorBase::GetVisitorId(map); | 6508 return StaticVisitorBase::GetVisitorId(map); |
6506 } | 6509 } |
6507 | 6510 |
6508 } // namespace internal | 6511 } // namespace internal |
6509 } // namespace v8 | 6512 } // namespace v8 |
OLD | NEW |