Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

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

Issue 2078403002: [heap] Filter out stale left-trimmed handles (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-620553.js » ('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 5f1c6de4a8f6fe98f91358f67b8e414fb2e91b5d..3d8a8b567769d3cbf5d452be0f9d5e40cc4d7371 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -1418,8 +1418,34 @@ class RootMarkingVisitor : public ObjectVisitor {
void MarkObjectByPointer(Object** p) {
if (!(*p)->IsHeapObject()) return;
- // Replace flat cons strings in place.
HeapObject* object = HeapObject::cast(*p);
+
+ // We cannot avoid stale handles to left-trimmed objects and only make sure
jochen (gone - plz use gerrit) 2016/06/20 09:53:27 nit: s/and only/, but can only/
Michael Lippautz 2016/06/20 10:39:51 Done.
+ // all handles still needed are updated. Filter out any stale pointers and
+ // clear the slot to allow post processing of handles (needed because the
+ // sweeper might actually free the underlying page).
+ if (object->IsFiller()) {
+#ifdef DEBUG
+ // We need to find a FixedArrayBase map after walking the fillers.
+ Heap* heap = collector_->heap();
+ HeapObject* current = object;
+ while (current->IsFiller()) {
+ Address next = reinterpret_cast<Address>(current);
+ if (current->map() == heap->one_pointer_filler_map()) {
+ next += kPointerSize;
+ } else if (current->map() == heap->two_pointer_filler_map()) {
+ next += 2 * kPointerSize;
+ } else {
+ next += current->Size();
+ }
+ current = reinterpret_cast<HeapObject*>(next);
+ }
+ DCHECK(current->IsFixedArrayBase());
+#endif // DEBUG
+ *p = nullptr;
+ return;
+ }
+
MarkBit mark_bit = Marking::MarkBitFrom(object);
if (Marking::IsBlackOrGrey(mark_bit)) return;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-620553.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698