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 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 } | 1430 } |
1431 | 1431 |
1432 void VisitPointers(Object** start, Object** end) override { | 1432 void VisitPointers(Object** start, Object** end) override { |
1433 // Visit all HeapObject pointers in [start, end). | 1433 // Visit all HeapObject pointers in [start, end). |
1434 MarkCompactCollector* collector = heap_->mark_compact_collector(); | 1434 MarkCompactCollector* collector = heap_->mark_compact_collector(); |
1435 for (Object** p = start; p < end; p++) { | 1435 for (Object** p = start; p < end; p++) { |
1436 Object* o = *p; | 1436 Object* o = *p; |
1437 if (o->IsHeapObject()) { | 1437 if (o->IsHeapObject()) { |
1438 if (Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(o)))) { | 1438 if (Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(o)))) { |
1439 if (finalize_external_strings) { | 1439 if (finalize_external_strings) { |
1440 if (o->IsExternalString()) { | 1440 DCHECK(o->IsExternalString()); |
1441 heap_->FinalizeExternalString(String::cast(*p)); | 1441 heap_->FinalizeExternalString(String::cast(*p)); |
1442 } else { | |
1443 // The original external string may have been internalized. | |
1444 DCHECK(o->IsThinString()); | |
1445 } | |
1446 } else { | 1442 } else { |
1447 pointers_removed_++; | 1443 pointers_removed_++; |
1448 } | 1444 } |
1449 // Set the entry to the_hole_value (as deleted). | 1445 // Set the entry to the_hole_value (as deleted). |
1450 *p = heap_->the_hole_value(); | 1446 *p = heap_->the_hole_value(); |
1451 } else if (record_slots) { | 1447 } else if (record_slots) { |
1452 // StringTable contains only old space strings. | 1448 // StringTable contains only old space strings. |
1453 DCHECK(!heap_->InNewSpace(o)); | 1449 DCHECK(!heap_->InNewSpace(o)); |
1454 collector->RecordSlot(table_, p, o); | 1450 collector->RecordSlot(table_, p, o); |
1455 } | 1451 } |
(...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4086 // The target is always in old space, we don't have to record the slot in | 4082 // The target is always in old space, we don't have to record the slot in |
4087 // the old-to-new remembered set. | 4083 // the old-to-new remembered set. |
4088 DCHECK(!heap()->InNewSpace(target)); | 4084 DCHECK(!heap()->InNewSpace(target)); |
4089 RecordRelocSlot(host, &rinfo, target); | 4085 RecordRelocSlot(host, &rinfo, target); |
4090 } | 4086 } |
4091 } | 4087 } |
4092 } | 4088 } |
4093 | 4089 |
4094 } // namespace internal | 4090 } // namespace internal |
4095 } // namespace v8 | 4091 } // namespace v8 |
OLD | NEW |