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/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 total_gc_time_ms_(0.0), | 130 total_gc_time_ms_(0.0), |
131 max_alive_after_gc_(0), | 131 max_alive_after_gc_(0), |
132 min_in_mutator_(kMaxInt), | 132 min_in_mutator_(kMaxInt), |
133 marking_time_(0.0), | 133 marking_time_(0.0), |
134 sweeping_time_(0.0), | 134 sweeping_time_(0.0), |
135 last_idle_notification_time_(0.0), | 135 last_idle_notification_time_(0.0), |
136 last_gc_time_(0.0), | 136 last_gc_time_(0.0), |
137 scavenge_collector_(nullptr), | 137 scavenge_collector_(nullptr), |
138 mark_compact_collector_(nullptr), | 138 mark_compact_collector_(nullptr), |
139 memory_allocator_(nullptr), | 139 memory_allocator_(nullptr), |
140 store_buffer_(this), | 140 store_buffer_(nullptr), |
141 incremental_marking_(nullptr), | 141 incremental_marking_(nullptr), |
142 gc_idle_time_handler_(nullptr), | 142 gc_idle_time_handler_(nullptr), |
143 memory_reducer_(nullptr), | 143 memory_reducer_(nullptr), |
144 live_object_stats_(nullptr), | 144 live_object_stats_(nullptr), |
145 dead_object_stats_(nullptr), | 145 dead_object_stats_(nullptr), |
146 scavenge_job_(nullptr), | 146 scavenge_job_(nullptr), |
147 idle_scavenge_observer_(nullptr), | 147 idle_scavenge_observer_(nullptr), |
148 full_codegen_bytes_generated_(0), | 148 full_codegen_bytes_generated_(0), |
149 crankshaft_codegen_bytes_generated_(0), | 149 crankshaft_codegen_bytes_generated_(0), |
150 new_space_allocation_counter_(0), | 150 new_space_allocation_counter_(0), |
(...skipping 5107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5258 } | 5258 } |
5259 | 5259 |
5260 base::CallOnce(&initialize_gc_once, &InitializeGCOnce); | 5260 base::CallOnce(&initialize_gc_once, &InitializeGCOnce); |
5261 | 5261 |
5262 // Set up memory allocator. | 5262 // Set up memory allocator. |
5263 memory_allocator_ = new MemoryAllocator(isolate_); | 5263 memory_allocator_ = new MemoryAllocator(isolate_); |
5264 if (!memory_allocator_->SetUp(MaxReserved(), MaxExecutableSize(), | 5264 if (!memory_allocator_->SetUp(MaxReserved(), MaxExecutableSize(), |
5265 code_range_size_)) | 5265 code_range_size_)) |
5266 return false; | 5266 return false; |
5267 | 5267 |
| 5268 // Initialize store buffer. |
| 5269 store_buffer_ = new StoreBuffer(this); |
| 5270 |
5268 // Initialize incremental marking. | 5271 // Initialize incremental marking. |
5269 incremental_marking_ = new IncrementalMarking(this); | 5272 incremental_marking_ = new IncrementalMarking(this); |
5270 | 5273 |
5271 // Set up new space. | 5274 // Set up new space. |
5272 if (!new_space_.SetUp(initial_semispace_size_, max_semi_space_size_)) { | 5275 if (!new_space_.SetUp(initial_semispace_size_, max_semi_space_size_)) { |
5273 return false; | 5276 return false; |
5274 } | 5277 } |
5275 new_space_top_after_last_gc_ = new_space()->top(); | 5278 new_space_top_after_last_gc_ = new_space()->top(); |
5276 | 5279 |
5277 // Initialize old space. | 5280 // Initialize old space. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5531 | 5534 |
5532 memory_allocator()->TearDown(); | 5535 memory_allocator()->TearDown(); |
5533 | 5536 |
5534 StrongRootsList* next = NULL; | 5537 StrongRootsList* next = NULL; |
5535 for (StrongRootsList* list = strong_roots_list_; list; list = next) { | 5538 for (StrongRootsList* list = strong_roots_list_; list; list = next) { |
5536 next = list->next; | 5539 next = list->next; |
5537 delete list; | 5540 delete list; |
5538 } | 5541 } |
5539 strong_roots_list_ = NULL; | 5542 strong_roots_list_ = NULL; |
5540 | 5543 |
| 5544 delete store_buffer_; |
| 5545 store_buffer_ = nullptr; |
| 5546 |
5541 delete memory_allocator_; | 5547 delete memory_allocator_; |
5542 memory_allocator_ = nullptr; | 5548 memory_allocator_ = nullptr; |
5543 } | 5549 } |
5544 | 5550 |
5545 | 5551 |
5546 void Heap::AddGCPrologueCallback(v8::Isolate::GCCallback callback, | 5552 void Heap::AddGCPrologueCallback(v8::Isolate::GCCallback callback, |
5547 GCType gc_type, bool pass_isolate) { | 5553 GCType gc_type, bool pass_isolate) { |
5548 DCHECK(callback != NULL); | 5554 DCHECK(callback != NULL); |
5549 GCCallbackPair pair(callback, gc_type, pass_isolate); | 5555 GCCallbackPair pair(callback, gc_type, pass_isolate); |
5550 DCHECK(!gc_prologue_callbacks_.Contains(pair)); | 5556 DCHECK(!gc_prologue_callbacks_.Contains(pair)); |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6435 } | 6441 } |
6436 | 6442 |
6437 | 6443 |
6438 // static | 6444 // static |
6439 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6445 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6440 return StaticVisitorBase::GetVisitorId(map); | 6446 return StaticVisitorBase::GetVisitorId(map); |
6441 } | 6447 } |
6442 | 6448 |
6443 } // namespace internal | 6449 } // namespace internal |
6444 } // namespace v8 | 6450 } // namespace v8 |
OLD | NEW |