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 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 } | 1411 } |
1412 | 1412 |
1413 // Skip the weak next code link in a code object, which is visited in | 1413 // Skip the weak next code link in a code object, which is visited in |
1414 // ProcessTopOptimizedFrame. | 1414 // ProcessTopOptimizedFrame. |
1415 void VisitNextCodeLink(Object** p) override {} | 1415 void VisitNextCodeLink(Object** p) override {} |
1416 | 1416 |
1417 private: | 1417 private: |
1418 void MarkObjectByPointer(Object** p) { | 1418 void MarkObjectByPointer(Object** p) { |
1419 if (!(*p)->IsHeapObject()) return; | 1419 if (!(*p)->IsHeapObject()) return; |
1420 | 1420 |
1421 // Replace flat cons strings in place. | |
1422 HeapObject* object = HeapObject::cast(*p); | 1421 HeapObject* object = HeapObject::cast(*p); |
| 1422 |
| 1423 // We cannot avoid stale handles to left-trimmed objects, but can only make |
| 1424 // sure all handles still needed are updated. Filter out any stale pointers |
| 1425 // and clear the slot to allow post processing of handles (needed because |
| 1426 // the sweeper might actually free the underlying page). |
| 1427 if (object->IsFiller()) { |
| 1428 #ifdef DEBUG |
| 1429 // We need to find a FixedArrayBase map after walking the fillers. |
| 1430 Heap* heap = collector_->heap(); |
| 1431 HeapObject* current = object; |
| 1432 while (current->IsFiller()) { |
| 1433 Address next = reinterpret_cast<Address>(current); |
| 1434 if (current->map() == heap->one_pointer_filler_map()) { |
| 1435 next += kPointerSize; |
| 1436 } else if (current->map() == heap->two_pointer_filler_map()) { |
| 1437 next += 2 * kPointerSize; |
| 1438 } else { |
| 1439 next += current->Size(); |
| 1440 } |
| 1441 current = reinterpret_cast<HeapObject*>(next); |
| 1442 } |
| 1443 DCHECK(current->IsFixedArrayBase()); |
| 1444 #endif // DEBUG |
| 1445 *p = nullptr; |
| 1446 return; |
| 1447 } |
| 1448 |
1423 MarkBit mark_bit = Marking::MarkBitFrom(object); | 1449 MarkBit mark_bit = Marking::MarkBitFrom(object); |
1424 if (Marking::IsBlackOrGrey(mark_bit)) return; | 1450 if (Marking::IsBlackOrGrey(mark_bit)) return; |
1425 | 1451 |
1426 Map* map = object->map(); | 1452 Map* map = object->map(); |
1427 // Mark the object. | 1453 // Mark the object. |
1428 collector_->SetMark(object, mark_bit); | 1454 collector_->SetMark(object, mark_bit); |
1429 | 1455 |
1430 // Mark the map pointer and body, and push them on the marking stack. | 1456 // Mark the map pointer and body, and push them on the marking stack. |
1431 MarkBit map_mark = Marking::MarkBitFrom(map); | 1457 MarkBit map_mark = Marking::MarkBitFrom(map); |
1432 collector_->MarkObject(map, map_mark); | 1458 collector_->MarkObject(map, map_mark); |
(...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4000 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4026 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4001 if (Marking::IsBlack(mark_bit)) { | 4027 if (Marking::IsBlack(mark_bit)) { |
4002 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 4028 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
4003 RecordRelocSlot(host, &rinfo, target); | 4029 RecordRelocSlot(host, &rinfo, target); |
4004 } | 4030 } |
4005 } | 4031 } |
4006 } | 4032 } |
4007 | 4033 |
4008 } // namespace internal | 4034 } // namespace internal |
4009 } // namespace v8 | 4035 } // namespace v8 |
OLD | NEW |