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