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 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 } | 1439 } |
1440 | 1440 |
1441 void VisitPointers(Object** start, Object** end) override { | 1441 void VisitPointers(Object** start, Object** end) override { |
1442 // Visit all HeapObject pointers in [start, end). | 1442 // Visit all HeapObject pointers in [start, end). |
1443 MarkCompactCollector* collector = heap_->mark_compact_collector(); | 1443 MarkCompactCollector* collector = heap_->mark_compact_collector(); |
1444 for (Object** p = start; p < end; p++) { | 1444 for (Object** p = start; p < end; p++) { |
1445 Object* o = *p; | 1445 Object* o = *p; |
1446 if (o->IsHeapObject()) { | 1446 if (o->IsHeapObject()) { |
1447 if (Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(o)))) { | 1447 if (Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(o)))) { |
1448 if (finalize_external_strings) { | 1448 if (finalize_external_strings) { |
1449 DCHECK(o->IsExternalString()); | 1449 if (o->IsExternalString()) { |
1450 heap_->FinalizeExternalString(String::cast(*p)); | 1450 heap_->FinalizeExternalString(String::cast(*p)); |
| 1451 } else { |
| 1452 // The original external string may have been internalized. |
| 1453 DCHECK(o->IsThinString()); |
| 1454 } |
1451 } else { | 1455 } else { |
1452 pointers_removed_++; | 1456 pointers_removed_++; |
1453 } | 1457 } |
1454 // Set the entry to the_hole_value (as deleted). | 1458 // Set the entry to the_hole_value (as deleted). |
1455 *p = heap_->the_hole_value(); | 1459 *p = heap_->the_hole_value(); |
1456 } else if (record_slots) { | 1460 } else if (record_slots) { |
1457 // StringTable contains only old space strings. | 1461 // StringTable contains only old space strings. |
1458 DCHECK(!heap_->InNewSpace(o)); | 1462 DCHECK(!heap_->InNewSpace(o)); |
1459 collector->RecordSlot(table_, p, o); | 1463 collector->RecordSlot(table_, p, o); |
1460 } | 1464 } |
(...skipping 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4088 // The target is always in old space, we don't have to record the slot in | 4092 // The target is always in old space, we don't have to record the slot in |
4089 // the old-to-new remembered set. | 4093 // the old-to-new remembered set. |
4090 DCHECK(!heap()->InNewSpace(target)); | 4094 DCHECK(!heap()->InNewSpace(target)); |
4091 RecordRelocSlot(host, &rinfo, target); | 4095 RecordRelocSlot(host, &rinfo, target); |
4092 } | 4096 } |
4093 } | 4097 } |
4094 } | 4098 } |
4095 | 4099 |
4096 } // namespace internal | 4100 } // namespace internal |
4097 } // namespace v8 | 4101 } // namespace v8 |
OLD | NEW |