Index: src/heap/mark-compact.cc |
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
index 7a4e2f2d03af344b27294e13720bf99cd0664d68..1f47176a506fd4e73af40c8908ff270ddb0c4c89 100644 |
--- a/src/heap/mark-compact.cc |
+++ b/src/heap/mark-compact.cc |
@@ -1641,6 +1641,23 @@ class MarkCompactCollector::EvacuateVisitorBase |
inline bool TryEvacuateObject(PagedSpace* target_space, HeapObject* object, |
HeapObject** target_object) { |
+#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.
|
+ if (FLAG_stress_compaction) { |
+ // Simulate aborting compaction. |
+ const uintptr_t mask = static_cast<uintptr_t>(FLAG_random_seed) & |
+ Page::kPageAlignmentMask & ~kPointerAlignmentMask; |
+ if ((reinterpret_cast<uintptr_t>(object->address()) & |
+ Page::kPageAlignmentMask) == mask) { |
+ Page* page = Page::FromAddress(object->address()); |
+ if (page->IsFlagSet(Page::COMPACTION_WAS_ABORTED_FOR_TESTING)) { |
+ page->ClearFlag(Page::COMPACTION_WAS_ABORTED_FOR_TESTING); |
+ } else { |
+ page->SetFlag(Page::COMPACTION_WAS_ABORTED_FOR_TESTING); |
+ return false; |
+ } |
+ } |
+ } |
+#endif // VERIFY_HEAP |
int size = object->Size(); |
AllocationAlignment alignment = object->RequiredAlignment(); |
AllocationResult allocation = target_space->AllocateRaw(size, alignment); |