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 4252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4263 } | 4263 } |
4264 // We potentially deserialized wrappers which require registering with the | 4264 // We potentially deserialized wrappers which require registering with the |
4265 // embedder as the marker will not find them. | 4265 // embedder as the marker will not find them. |
4266 local_embedder_heap_tracer()->RegisterWrappersWithRemoteTracer(); | 4266 local_embedder_heap_tracer()->RegisterWrappersWithRemoteTracer(); |
4267 } | 4267 } |
4268 } | 4268 } |
4269 | 4269 |
4270 void Heap::NotifyObjectLayoutChange(HeapObject* object, | 4270 void Heap::NotifyObjectLayoutChange(HeapObject* object, |
4271 const DisallowHeapAllocation&) { | 4271 const DisallowHeapAllocation&) { |
4272 if (FLAG_incremental_marking && incremental_marking()->IsMarking()) { | 4272 if (FLAG_incremental_marking && incremental_marking()->IsMarking()) { |
4273 incremental_marking()->MarkGrey(object); | 4273 incremental_marking()->WhiteToGreyAndPush(object); |
4274 } | 4274 } |
4275 #ifdef VERIFY_HEAP | 4275 #ifdef VERIFY_HEAP |
4276 DCHECK(pending_layout_change_object_ == nullptr); | 4276 DCHECK(pending_layout_change_object_ == nullptr); |
4277 pending_layout_change_object_ = object; | 4277 pending_layout_change_object_ = object; |
4278 #endif | 4278 #endif |
4279 } | 4279 } |
4280 | 4280 |
4281 #ifdef VERIFY_HEAP | 4281 #ifdef VERIFY_HEAP |
4282 void Heap::VerifyObjectLayoutChange(HeapObject* object, Map* new_map) { | 4282 void Heap::VerifyObjectLayoutChange(HeapObject* object, Map* new_map) { |
4283 if (pending_layout_change_object_ == nullptr) { | 4283 if (pending_layout_change_object_ == nullptr) { |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4827 slot_address += kPointerSize; | 4827 slot_address += kPointerSize; |
4828 } | 4828 } |
4829 } | 4829 } |
4830 | 4830 |
4831 inline void VisitCodeEntry(JSFunction* host, | 4831 inline void VisitCodeEntry(JSFunction* host, |
4832 Address code_entry_slot) override { | 4832 Address code_entry_slot) override { |
4833 // Black allocation requires us to process objects referenced by | 4833 // Black allocation requires us to process objects referenced by |
4834 // promoted objects. | 4834 // promoted objects. |
4835 if (heap_->incremental_marking()->black_allocation()) { | 4835 if (heap_->incremental_marking()->black_allocation()) { |
4836 Code* code = Code::cast(Code::GetObjectFromEntryAddress(code_entry_slot)); | 4836 Code* code = Code::cast(Code::GetObjectFromEntryAddress(code_entry_slot)); |
4837 heap_->incremental_marking()->MarkGrey(code); | 4837 heap_->incremental_marking()->WhiteToGreyAndPush(code); |
4838 } | 4838 } |
4839 } | 4839 } |
4840 | 4840 |
4841 private: | 4841 private: |
4842 Heap* heap_; | 4842 Heap* heap_; |
4843 bool record_slots_; | 4843 bool record_slots_; |
4844 }; | 4844 }; |
4845 | 4845 |
4846 void Heap::IterateAndScavengePromotedObject(HeapObject* target, int size) { | 4846 void Heap::IterateAndScavengePromotedObject(HeapObject* target, int size) { |
4847 // We are not collecting slots on new space objects during mutation | 4847 // We are not collecting slots on new space objects during mutation |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5621 } | 5621 } |
5622 } | 5622 } |
5623 | 5623 |
5624 void Heap::RegisterExternallyReferencedObject(Object** object) { | 5624 void Heap::RegisterExternallyReferencedObject(Object** object) { |
5625 // The embedder is not aware of whether numbers are materialized as heap | 5625 // The embedder is not aware of whether numbers are materialized as heap |
5626 // objects are just passed around as Smis. | 5626 // objects are just passed around as Smis. |
5627 if (!(*object)->IsHeapObject()) return; | 5627 if (!(*object)->IsHeapObject()) return; |
5628 HeapObject* heap_object = HeapObject::cast(*object); | 5628 HeapObject* heap_object = HeapObject::cast(*object); |
5629 DCHECK(Contains(heap_object)); | 5629 DCHECK(Contains(heap_object)); |
5630 if (FLAG_incremental_marking_wrappers && incremental_marking()->IsMarking()) { | 5630 if (FLAG_incremental_marking_wrappers && incremental_marking()->IsMarking()) { |
5631 incremental_marking()->MarkGrey(heap_object); | 5631 incremental_marking()->WhiteToGreyAndPush(heap_object); |
5632 } else { | 5632 } else { |
5633 DCHECK(mark_compact_collector()->in_use()); | 5633 DCHECK(mark_compact_collector()->in_use()); |
5634 mark_compact_collector()->MarkObject(heap_object); | 5634 mark_compact_collector()->MarkObject(heap_object); |
5635 } | 5635 } |
5636 } | 5636 } |
5637 | 5637 |
5638 void Heap::TearDown() { | 5638 void Heap::TearDown() { |
5639 #ifdef VERIFY_HEAP | 5639 #ifdef VERIFY_HEAP |
5640 if (FLAG_verify_heap) { | 5640 if (FLAG_verify_heap) { |
5641 Verify(); | 5641 Verify(); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6389 case LO_SPACE: | 6389 case LO_SPACE: |
6390 return "LO_SPACE"; | 6390 return "LO_SPACE"; |
6391 default: | 6391 default: |
6392 UNREACHABLE(); | 6392 UNREACHABLE(); |
6393 } | 6393 } |
6394 return NULL; | 6394 return NULL; |
6395 } | 6395 } |
6396 | 6396 |
6397 } // namespace internal | 6397 } // namespace internal |
6398 } // namespace v8 | 6398 } // namespace v8 |
OLD | NEW |