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/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/ast/context-slot-cache.h" | 10 #include "src/ast/context-slot-cache.h" |
(...skipping 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4257 addr += obj->Size(); | 4257 addr += obj->Size(); |
4258 } | 4258 } |
4259 } | 4259 } |
4260 } | 4260 } |
4261 } | 4261 } |
4262 } | 4262 } |
4263 | 4263 |
4264 void Heap::NotifyObjectLayoutChange(HeapObject* object, | 4264 void Heap::NotifyObjectLayoutChange(HeapObject* object, |
4265 const DisallowHeapAllocation&) { | 4265 const DisallowHeapAllocation&) { |
4266 if (FLAG_incremental_marking && incremental_marking()->IsMarking()) { | 4266 if (FLAG_incremental_marking && incremental_marking()->IsMarking()) { |
4267 incremental_marking()->MarkGrey(object); | 4267 incremental_marking()->WhiteToGreyAndPush(object); |
4268 } | 4268 } |
4269 #ifdef VERIFY_HEAP | 4269 #ifdef VERIFY_HEAP |
4270 DCHECK(pending_layout_change_object_ == nullptr); | 4270 DCHECK(pending_layout_change_object_ == nullptr); |
4271 pending_layout_change_object_ = object; | 4271 pending_layout_change_object_ = object; |
4272 #endif | 4272 #endif |
4273 } | 4273 } |
4274 | 4274 |
4275 #ifdef VERIFY_HEAP | 4275 #ifdef VERIFY_HEAP |
4276 void Heap::VerifyObjectLayoutChange(HeapObject* object, Map* new_map) { | 4276 void Heap::VerifyObjectLayoutChange(HeapObject* object, Map* new_map) { |
4277 if (pending_layout_change_object_ == nullptr) { | 4277 if (pending_layout_change_object_ == nullptr) { |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4821 slot_address += kPointerSize; | 4821 slot_address += kPointerSize; |
4822 } | 4822 } |
4823 } | 4823 } |
4824 | 4824 |
4825 inline void VisitCodeEntry(JSFunction* host, | 4825 inline void VisitCodeEntry(JSFunction* host, |
4826 Address code_entry_slot) override { | 4826 Address code_entry_slot) override { |
4827 // Black allocation requires us to process objects referenced by | 4827 // Black allocation requires us to process objects referenced by |
4828 // promoted objects. | 4828 // promoted objects. |
4829 if (heap_->incremental_marking()->black_allocation()) { | 4829 if (heap_->incremental_marking()->black_allocation()) { |
4830 Code* code = Code::cast(Code::GetObjectFromEntryAddress(code_entry_slot)); | 4830 Code* code = Code::cast(Code::GetObjectFromEntryAddress(code_entry_slot)); |
4831 heap_->incremental_marking()->MarkGrey(code); | 4831 heap_->incremental_marking()->WhiteToGreyAndPush(code); |
4832 } | 4832 } |
4833 } | 4833 } |
4834 | 4834 |
4835 private: | 4835 private: |
4836 Heap* heap_; | 4836 Heap* heap_; |
4837 bool record_slots_; | 4837 bool record_slots_; |
4838 }; | 4838 }; |
4839 | 4839 |
4840 void Heap::IterateAndScavengePromotedObject(HeapObject* target, int size) { | 4840 void Heap::IterateAndScavengePromotedObject(HeapObject* target, int size) { |
4841 // We are not collecting slots on new space objects during mutation | 4841 // We are not collecting slots on new space objects during mutation |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5615 } | 5615 } |
5616 } | 5616 } |
5617 | 5617 |
5618 void Heap::RegisterExternallyReferencedObject(Object** object) { | 5618 void Heap::RegisterExternallyReferencedObject(Object** object) { |
5619 // The embedder is not aware of whether numbers are materialized as heap | 5619 // The embedder is not aware of whether numbers are materialized as heap |
5620 // objects are just passed around as Smis. | 5620 // objects are just passed around as Smis. |
5621 if (!(*object)->IsHeapObject()) return; | 5621 if (!(*object)->IsHeapObject()) return; |
5622 HeapObject* heap_object = HeapObject::cast(*object); | 5622 HeapObject* heap_object = HeapObject::cast(*object); |
5623 DCHECK(Contains(heap_object)); | 5623 DCHECK(Contains(heap_object)); |
5624 if (FLAG_incremental_marking_wrappers && incremental_marking()->IsMarking()) { | 5624 if (FLAG_incremental_marking_wrappers && incremental_marking()->IsMarking()) { |
5625 incremental_marking()->MarkGrey(heap_object); | 5625 incremental_marking()->WhiteToGreyAndPush(heap_object); |
5626 } else { | 5626 } else { |
5627 DCHECK(mark_compact_collector()->in_use()); | 5627 DCHECK(mark_compact_collector()->in_use()); |
5628 mark_compact_collector()->MarkObject(heap_object); | 5628 mark_compact_collector()->MarkObject(heap_object); |
5629 } | 5629 } |
5630 } | 5630 } |
5631 | 5631 |
5632 void Heap::TearDown() { | 5632 void Heap::TearDown() { |
5633 #ifdef VERIFY_HEAP | 5633 #ifdef VERIFY_HEAP |
5634 if (FLAG_verify_heap) { | 5634 if (FLAG_verify_heap) { |
5635 Verify(); | 5635 Verify(); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6383 case LO_SPACE: | 6383 case LO_SPACE: |
6384 return "LO_SPACE"; | 6384 return "LO_SPACE"; |
6385 default: | 6385 default: |
6386 UNREACHABLE(); | 6386 UNREACHABLE(); |
6387 } | 6387 } |
6388 return NULL; | 6388 return NULL; |
6389 } | 6389 } |
6390 | 6390 |
6391 } // namespace internal | 6391 } // namespace internal |
6392 } // namespace v8 | 6392 } // namespace v8 |
OLD | NEW |