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 5653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5664 js_object->GetEmbedderField(0) != undefined_value() && | 5664 js_object->GetEmbedderField(0) != undefined_value() && |
5665 js_object->GetEmbedderField(1) != undefined_value()) { | 5665 js_object->GetEmbedderField(1) != undefined_value()) { |
5666 DCHECK(reinterpret_cast<intptr_t>(js_object->GetEmbedderField(0)) % 2 == 0); | 5666 DCHECK(reinterpret_cast<intptr_t>(js_object->GetEmbedderField(0)) % 2 == 0); |
5667 local_embedder_heap_tracer()->AddWrapperToTrace(std::pair<void*, void*>( | 5667 local_embedder_heap_tracer()->AddWrapperToTrace(std::pair<void*, void*>( |
5668 reinterpret_cast<void*>(js_object->GetEmbedderField(0)), | 5668 reinterpret_cast<void*>(js_object->GetEmbedderField(0)), |
5669 reinterpret_cast<void*>(js_object->GetEmbedderField(1)))); | 5669 reinterpret_cast<void*>(js_object->GetEmbedderField(1)))); |
5670 } | 5670 } |
5671 } | 5671 } |
5672 | 5672 |
5673 void Heap::RegisterExternallyReferencedObject(Object** object) { | 5673 void Heap::RegisterExternallyReferencedObject(Object** object) { |
5674 // The embedder is not aware of whether numbers are materialized as heap | |
5675 // objects are just passed around as Smis. | |
5676 if (!(*object)->IsHeapObject()) return; | |
Hannes Payer (out of office)
2017/04/27 14:46:18
Do you still want to keep the nullptr check? Or ca
Michael Lippautz
2017/04/27 14:47:50
If it is a heap object it cannot be null, as this
| |
5674 HeapObject* heap_object = HeapObject::cast(*object); | 5677 HeapObject* heap_object = HeapObject::cast(*object); |
5675 if (heap_object == nullptr) { | |
5676 // We might encounter non-empty handles that point to nullptr. | |
5677 return; | |
5678 } | |
5679 DCHECK(Contains(heap_object)); | 5678 DCHECK(Contains(heap_object)); |
5680 if (FLAG_incremental_marking_wrappers && incremental_marking()->IsMarking()) { | 5679 if (FLAG_incremental_marking_wrappers && incremental_marking()->IsMarking()) { |
5681 IncrementalMarking::MarkGrey(this, heap_object); | 5680 IncrementalMarking::MarkGrey(this, heap_object); |
5682 } else { | 5681 } else { |
5683 DCHECK(mark_compact_collector()->in_use()); | 5682 DCHECK(mark_compact_collector()->in_use()); |
5684 mark_compact_collector()->MarkObject(heap_object); | 5683 mark_compact_collector()->MarkObject(heap_object); |
5685 } | 5684 } |
5686 } | 5685 } |
5687 | 5686 |
5688 void Heap::TearDown() { | 5687 void Heap::TearDown() { |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6439 case LO_SPACE: | 6438 case LO_SPACE: |
6440 return "LO_SPACE"; | 6439 return "LO_SPACE"; |
6441 default: | 6440 default: |
6442 UNREACHABLE(); | 6441 UNREACHABLE(); |
6443 } | 6442 } |
6444 return NULL; | 6443 return NULL; |
6445 } | 6444 } |
6446 | 6445 |
6447 } // namespace internal | 6446 } // namespace internal |
6448 } // namespace v8 | 6447 } // namespace v8 |
OLD | NEW |