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