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

Unified Diff: src/heap/heap-inl.h

Issue 2179033005: [heap] Don't consider mementos on pages below age mark (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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-631050.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap-inl.h
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h
index a12c6d031c389310a6be506245cb929b4efec413..f746bcb299eedc702312c5b41cc881a7293295da 100644
--- a/src/heap/heap-inl.h
+++ b/src/heap/heap-inl.h
@@ -479,13 +479,12 @@ void Heap::CopyBlock(Address dst, Address src, int byte_size) {
template <Heap::FindMementoMode mode>
AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) {
- // Check if there is potentially a memento behind the object. If
- // the last word of the memento is on another page we return
- // immediately.
Address object_address = object->address();
Address memento_address = object_address + object->Size();
Address last_memento_word_address = memento_address + kPointerSize;
- if (!Page::OnSamePage(object_address, last_memento_word_address)) {
+ Page* object_page = Page::FromAddress(object_address);
+ // If the memento would be on another page, bail out immediately.
+ if ((object_page != Page::FromAddress(last_memento_word_address))) {
Hannes Payer (out of office) 2016/07/27 08:34:34 Can you leave the original check unchanged?
Michael Lippautz 2016/07/27 11:12:07 Done.
return nullptr;
}
HeapObject* candidate = HeapObject::FromAddress(memento_address);
@@ -497,6 +496,13 @@ AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) {
if (candidate_map != allocation_memento_map()) {
return nullptr;
}
+
+ // If the memento is below the age mark, which can happen when mementos
+ // survived because a page got moved within new space, bail out.
+ if (object_page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK)) {
+ return nullptr;
+ }
+
AllocationMemento* memento_candidate = AllocationMemento::cast(candidate);
// Depending on what the memento is used for, we might need to perform
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-631050.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698