| 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_(MB), | 80 initial_semispace_size_(Page::kPageSize), |
| 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 5307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5398 } | 5398 } |
| 5399 | 5399 |
| 5400 void Heap::PrintAlloctionsHash() { | 5400 void Heap::PrintAlloctionsHash() { |
| 5401 uint32_t hash = StringHasher::GetHashCore(raw_allocations_hash_); | 5401 uint32_t hash = StringHasher::GetHashCore(raw_allocations_hash_); |
| 5402 PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count(), hash); | 5402 PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count(), hash); |
| 5403 } | 5403 } |
| 5404 | 5404 |
| 5405 | 5405 |
| 5406 void Heap::NotifyDeserializationComplete() { | 5406 void Heap::NotifyDeserializationComplete() { |
| 5407 deserialization_complete_ = true; | 5407 deserialization_complete_ = true; |
| 5408 | 5408 #ifdef DEBUG |
| 5409 // All pages right after bootstrapping must be marked as never-evacuate. |
| 5409 PagedSpaces spaces(this); | 5410 PagedSpaces spaces(this); |
| 5410 for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { | 5411 for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { |
| 5411 if (isolate()->snapshot_available()) s->ShrinkPagesToHighWaterMark(); | |
| 5412 #ifdef DEBUG | |
| 5413 // All pages right after bootstrapping must be marked as never-evacuate. | |
| 5414 for (Page* p : *s) { | 5412 for (Page* p : *s) { |
| 5415 CHECK(p->NeverEvacuate()); | 5413 CHECK(p->NeverEvacuate()); |
| 5416 } | 5414 } |
| 5415 } |
| 5417 #endif // DEBUG | 5416 #endif // DEBUG |
| 5418 } | |
| 5419 } | 5417 } |
| 5420 | 5418 |
| 5421 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { | 5419 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { |
| 5422 mark_compact_collector()->SetEmbedderHeapTracer(tracer); | 5420 mark_compact_collector()->SetEmbedderHeapTracer(tracer); |
| 5423 } | 5421 } |
| 5424 | 5422 |
| 5425 bool Heap::UsingEmbedderHeapTracer() { | 5423 bool Heap::UsingEmbedderHeapTracer() { |
| 5426 return mark_compact_collector()->UsingEmbedderHeapTracer(); | 5424 return mark_compact_collector()->UsingEmbedderHeapTracer(); |
| 5427 } | 5425 } |
| 5428 | 5426 |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6463 } | 6461 } |
| 6464 | 6462 |
| 6465 | 6463 |
| 6466 // static | 6464 // static |
| 6467 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6465 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6468 return StaticVisitorBase::GetVisitorId(map); | 6466 return StaticVisitorBase::GetVisitorId(map); |
| 6469 } | 6467 } |
| 6470 | 6468 |
| 6471 } // namespace internal | 6469 } // namespace internal |
| 6472 } // namespace v8 | 6470 } // namespace v8 |
| OLD | NEW |