Chromium Code Reviews| 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 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1634 EvacuateVisitorBase(Heap* heap, CompactionSpaceCollection* compaction_spaces) | 1634 EvacuateVisitorBase(Heap* heap, CompactionSpaceCollection* compaction_spaces) |
| 1635 : heap_(heap), | 1635 : heap_(heap), |
| 1636 compaction_spaces_(compaction_spaces), | 1636 compaction_spaces_(compaction_spaces), |
| 1637 profiling_( | 1637 profiling_( |
| 1638 heap->isolate()->cpu_profiler()->is_profiling() || | 1638 heap->isolate()->cpu_profiler()->is_profiling() || |
| 1639 heap->isolate()->logger()->is_logging_code_events() || | 1639 heap->isolate()->logger()->is_logging_code_events() || |
| 1640 heap->isolate()->heap_profiler()->is_tracking_object_moves()) {} | 1640 heap->isolate()->heap_profiler()->is_tracking_object_moves()) {} |
| 1641 | 1641 |
| 1642 inline bool TryEvacuateObject(PagedSpace* target_space, HeapObject* object, | 1642 inline bool TryEvacuateObject(PagedSpace* target_space, HeapObject* object, |
| 1643 HeapObject** target_object) { | 1643 HeapObject** target_object) { |
| 1644 #ifdef VERIFY_HEAP | |
|
Hannes Payer (out of office)
2016/05/31 14:01:04
Can we move that code into a SimulateCompactionAbo
Michael Lippautz
2016/05/31 14:08:58
Done.
| |
| 1645 if (FLAG_stress_compaction) { | |
| 1646 // Simulate aborting compaction. | |
| 1647 const uintptr_t mask = static_cast<uintptr_t>(FLAG_random_seed) & | |
| 1648 Page::kPageAlignmentMask & ~kPointerAlignmentMask; | |
| 1649 if ((reinterpret_cast<uintptr_t>(object->address()) & | |
| 1650 Page::kPageAlignmentMask) == mask) { | |
| 1651 Page* page = Page::FromAddress(object->address()); | |
| 1652 if (page->IsFlagSet(Page::COMPACTION_WAS_ABORTED_FOR_TESTING)) { | |
| 1653 page->ClearFlag(Page::COMPACTION_WAS_ABORTED_FOR_TESTING); | |
| 1654 } else { | |
| 1655 page->SetFlag(Page::COMPACTION_WAS_ABORTED_FOR_TESTING); | |
| 1656 return false; | |
| 1657 } | |
| 1658 } | |
| 1659 } | |
| 1660 #endif // VERIFY_HEAP | |
| 1644 int size = object->Size(); | 1661 int size = object->Size(); |
| 1645 AllocationAlignment alignment = object->RequiredAlignment(); | 1662 AllocationAlignment alignment = object->RequiredAlignment(); |
| 1646 AllocationResult allocation = target_space->AllocateRaw(size, alignment); | 1663 AllocationResult allocation = target_space->AllocateRaw(size, alignment); |
| 1647 if (allocation.To(target_object)) { | 1664 if (allocation.To(target_object)) { |
| 1648 MigrateObject(*target_object, object, size, target_space->identity()); | 1665 MigrateObject(*target_object, object, size, target_space->identity()); |
| 1649 return true; | 1666 return true; |
| 1650 } | 1667 } |
| 1651 return false; | 1668 return false; |
| 1652 } | 1669 } |
| 1653 | 1670 |
| (...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3941 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3958 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 3942 if (Marking::IsBlack(mark_bit)) { | 3959 if (Marking::IsBlack(mark_bit)) { |
| 3943 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3960 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
| 3944 RecordRelocSlot(host, &rinfo, target); | 3961 RecordRelocSlot(host, &rinfo, target); |
| 3945 } | 3962 } |
| 3946 } | 3963 } |
| 3947 } | 3964 } |
| 3948 | 3965 |
| 3949 } // namespace internal | 3966 } // namespace internal |
| 3950 } // namespace v8 | 3967 } // namespace v8 |
| OLD | NEW |