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

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

Issue 585643002: Annotate Heap::FindAllocationMemento for MemorySanitizer. (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@bleeding_edge
Patch Set: Created 6 years, 3 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 | src/msan.h » ('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 8863777e8f557eb3c3023210f7ba311337169d46..e658224aca11190003676d9bbd2df945e1c88508 100644
--- a/src/heap/heap-inl.h
+++ b/src/heap/heap-inl.h
@@ -15,6 +15,7 @@
#include "src/heap-profiler.h"
#include "src/isolate.h"
#include "src/list-inl.h"
+#include "src/msan.h"
#include "src/objects.h"
namespace v8 {
@@ -495,7 +496,7 @@ void Heap::ScavengePointer(HeapObject** p) { ScavengeObject(p, *p); }
AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) {
// Check if there is potentially a memento behind the object. If
- // the last word of the momento is on another page we return
+ // 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();
@@ -505,7 +506,12 @@ AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) {
}
HeapObject* candidate = HeapObject::FromAddress(memento_address);
- if (candidate->map() != allocation_memento_map()) return NULL;
+ Map* candidate_map = candidate->map();
+ // This fast check may peek at an uninitialized word. However, the slow check
+ // below (memento_address == top) ensures that this is safe. Mark the word as
+ // initialized to silence MemorySanitizer warnings.
+ MSAN_MEMORY_IS_INITIALIZED(&candidate_map, sizeof(candidate_map));
+ if (candidate_map != allocation_memento_map()) return NULL;
// Either the object is the last object in the new space, or there is another
// object of at least word size (the header map word) following it, so
« no previous file with comments | « no previous file | src/msan.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698