| 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/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2216 js_object->GetInternalField(0) && | 2216 js_object->GetInternalField(0) && |
| 2217 js_object->GetInternalField(0) != heap_->undefined_value() && | 2217 js_object->GetInternalField(0) != heap_->undefined_value() && |
| 2218 js_object->GetInternalField(1) != heap_->undefined_value()) { | 2218 js_object->GetInternalField(1) != heap_->undefined_value()) { |
| 2219 DCHECK(reinterpret_cast<intptr_t>(js_object->GetInternalField(0)) % 2 == 0); | 2219 DCHECK(reinterpret_cast<intptr_t>(js_object->GetInternalField(0)) % 2 == 0); |
| 2220 wrappers_to_trace_.push_back(std::pair<void*, void*>( | 2220 wrappers_to_trace_.push_back(std::pair<void*, void*>( |
| 2221 reinterpret_cast<void*>(js_object->GetInternalField(0)), | 2221 reinterpret_cast<void*>(js_object->GetInternalField(0)), |
| 2222 reinterpret_cast<void*>(js_object->GetInternalField(1)))); | 2222 reinterpret_cast<void*>(js_object->GetInternalField(1)))); |
| 2223 } | 2223 } |
| 2224 } | 2224 } |
| 2225 | 2225 |
| 2226 void MarkCompactCollector::RegisterExternallyReferencedObject(Object** object) { | |
| 2227 DCHECK(in_use()); | |
| 2228 HeapObject* heap_object = HeapObject::cast(*object); | |
| 2229 DCHECK(heap_->Contains(heap_object)); | |
| 2230 MarkBit mark_bit = ObjectMarking::MarkBitFrom(heap_object); | |
| 2231 MarkObject(heap_object, mark_bit); | |
| 2232 } | |
| 2233 | |
| 2234 class MarkCompactCollector::ObjectStatsVisitor | 2226 class MarkCompactCollector::ObjectStatsVisitor |
| 2235 : public MarkCompactCollector::HeapObjectVisitor { | 2227 : public MarkCompactCollector::HeapObjectVisitor { |
| 2236 public: | 2228 public: |
| 2237 ObjectStatsVisitor(Heap* heap, ObjectStats* live_stats, | 2229 ObjectStatsVisitor(Heap* heap, ObjectStats* live_stats, |
| 2238 ObjectStats* dead_stats) | 2230 ObjectStats* dead_stats) |
| 2239 : live_collector_(heap, live_stats), dead_collector_(heap, dead_stats) { | 2231 : live_collector_(heap, live_stats), dead_collector_(heap, dead_stats) { |
| 2240 DCHECK_NOT_NULL(live_stats); | 2232 DCHECK_NOT_NULL(live_stats); |
| 2241 DCHECK_NOT_NULL(dead_stats); | 2233 DCHECK_NOT_NULL(dead_stats); |
| 2242 // Global objects are roots and thus recorded as live. | 2234 // Global objects are roots and thus recorded as live. |
| 2243 live_collector_.CollectGlobalStatistics(); | 2235 live_collector_.CollectGlobalStatistics(); |
| (...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4037 // The target is always in old space, we don't have to record the slot in | 4029 // The target is always in old space, we don't have to record the slot in |
| 4038 // the old-to-new remembered set. | 4030 // the old-to-new remembered set. |
| 4039 DCHECK(!heap()->InNewSpace(target)); | 4031 DCHECK(!heap()->InNewSpace(target)); |
| 4040 RecordRelocSlot(host, &rinfo, target); | 4032 RecordRelocSlot(host, &rinfo, target); |
| 4041 } | 4033 } |
| 4042 } | 4034 } |
| 4043 } | 4035 } |
| 4044 | 4036 |
| 4045 } // namespace internal | 4037 } // namespace internal |
| 4046 } // namespace v8 | 4038 } // namespace v8 |
| OLD | NEW |