Chromium Code Reviews

Unified Diff: src/heap/mark-compact.cc

Issue 2019343002: [heap] Simulate aborting compaction during --stress-compaction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | src/heap/spaces.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine