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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 remembered_unmapped_pages_index_(0), | 109 remembered_unmapped_pages_index_(0), |
110 #ifdef DEBUG | 110 #ifdef DEBUG |
111 allocation_timeout_(0), | 111 allocation_timeout_(0), |
112 #endif // DEBUG | 112 #endif // DEBUG |
113 old_generation_allocation_limit_(initial_old_generation_size_), | 113 old_generation_allocation_limit_(initial_old_generation_size_), |
114 old_gen_exhausted_(false), | 114 old_gen_exhausted_(false), |
115 optimize_for_memory_usage_(false), | 115 optimize_for_memory_usage_(false), |
116 inline_allocation_disabled_(false), | 116 inline_allocation_disabled_(false), |
117 total_regexp_code_generated_(0), | 117 total_regexp_code_generated_(0), |
118 tracer_(nullptr), | 118 tracer_(nullptr), |
119 embedder_heap_tracer_(nullptr), | |
119 high_survival_rate_period_length_(0), | 120 high_survival_rate_period_length_(0), |
120 promoted_objects_size_(0), | 121 promoted_objects_size_(0), |
121 promotion_ratio_(0), | 122 promotion_ratio_(0), |
122 semi_space_copied_object_size_(0), | 123 semi_space_copied_object_size_(0), |
123 previous_semi_space_copied_object_size_(0), | 124 previous_semi_space_copied_object_size_(0), |
124 semi_space_copied_rate_(0), | 125 semi_space_copied_rate_(0), |
125 nodes_died_in_new_space_(0), | 126 nodes_died_in_new_space_(0), |
126 nodes_copied_in_new_space_(0), | 127 nodes_copied_in_new_space_(0), |
127 nodes_promoted_(0), | 128 nodes_promoted_(0), |
128 maximum_size_scavenges_(0), | 129 maximum_size_scavenges_(0), |
(...skipping 5284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5413 #ifdef DEBUG | 5414 #ifdef DEBUG |
5414 // All pages right after bootstrapping must be marked as never-evacuate. | 5415 // All pages right after bootstrapping must be marked as never-evacuate. |
5415 PagedSpaces spaces(this); | 5416 PagedSpaces spaces(this); |
5416 for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { | 5417 for (PagedSpace* s = spaces.next(); s != NULL; s = spaces.next()) { |
5417 PageIterator it(s); | 5418 PageIterator it(s); |
5418 while (it.has_next()) CHECK(it.next()->NeverEvacuate()); | 5419 while (it.has_next()) CHECK(it.next()->NeverEvacuate()); |
5419 } | 5420 } |
5420 #endif // DEBUG | 5421 #endif // DEBUG |
5421 } | 5422 } |
5422 | 5423 |
5424 void Heap::AddObjectToMarkingDeque(Object** object) { | |
5425 DCHECK(mark_compact_collector()->in_use()); | |
Hannes Payer (out of office)
2016/03/31 11:13:22
Add a DCHECK that checks if the object is on our h
Marcel Hlopko
2016/03/31 11:59:00
Done
| |
5426 HeapObject* heap_object = HeapObject::cast(*object); | |
5427 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); | |
5428 mark_compact_collector()->MarkObject(heap_object, mark_bit); | |
5429 } | |
5423 | 5430 |
5424 void Heap::TearDown() { | 5431 void Heap::TearDown() { |
5425 #ifdef VERIFY_HEAP | 5432 #ifdef VERIFY_HEAP |
5426 if (FLAG_verify_heap) { | 5433 if (FLAG_verify_heap) { |
5427 Verify(); | 5434 Verify(); |
5428 } | 5435 } |
5429 #endif | 5436 #endif |
5430 | 5437 |
5431 UpdateMaximumCommitted(); | 5438 UpdateMaximumCommitted(); |
5432 | 5439 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5578 DCHECK(callback != NULL); | 5585 DCHECK(callback != NULL); |
5579 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { | 5586 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { |
5580 if (gc_epilogue_callbacks_[i].callback == callback) { | 5587 if (gc_epilogue_callbacks_[i].callback == callback) { |
5581 gc_epilogue_callbacks_.Remove(i); | 5588 gc_epilogue_callbacks_.Remove(i); |
5582 return; | 5589 return; |
5583 } | 5590 } |
5584 } | 5591 } |
5585 UNREACHABLE(); | 5592 UNREACHABLE(); |
5586 } | 5593 } |
5587 | 5594 |
5595 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { | |
5596 DCHECK_NOT_NULL(tracer); | |
5597 CHECK_NULL(embedder_heap_tracer_); | |
5598 embedder_heap_tracer_ = tracer; | |
5599 } | |
5588 | 5600 |
5589 // TODO(ishell): Find a better place for this. | 5601 // TODO(ishell): Find a better place for this. |
5590 void Heap::AddWeakObjectToCodeDependency(Handle<HeapObject> obj, | 5602 void Heap::AddWeakObjectToCodeDependency(Handle<HeapObject> obj, |
5591 Handle<DependentCode> dep) { | 5603 Handle<DependentCode> dep) { |
5592 DCHECK(!InNewSpace(*obj)); | 5604 DCHECK(!InNewSpace(*obj)); |
5593 DCHECK(!InNewSpace(*dep)); | 5605 DCHECK(!InNewSpace(*dep)); |
5594 Handle<WeakHashTable> table(weak_object_to_code_table(), isolate()); | 5606 Handle<WeakHashTable> table(weak_object_to_code_table(), isolate()); |
5595 table = WeakHashTable::Put(table, obj, dep); | 5607 table = WeakHashTable::Put(table, obj, dep); |
5596 if (*table != weak_object_to_code_table()) | 5608 if (*table != weak_object_to_code_table()) |
5597 set_weak_object_to_code_table(*table); | 5609 set_weak_object_to_code_table(*table); |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6473 } | 6485 } |
6474 | 6486 |
6475 | 6487 |
6476 // static | 6488 // static |
6477 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6489 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6478 return StaticVisitorBase::GetVisitorId(map); | 6490 return StaticVisitorBase::GetVisitorId(map); |
6479 } | 6491 } |
6480 | 6492 |
6481 } // namespace internal | 6493 } // namespace internal |
6482 } // namespace v8 | 6494 } // namespace v8 |
OLD | NEW |