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

Unified Diff: src/zone.cc

Issue 208743004: ASan support for the Zone (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix indentation Created 6 years, 9 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
Index: src/zone.cc
diff --git a/src/zone.cc b/src/zone.cc
index 417f895e5ae29536cf29c4f7eb42344c57d55277..6e0c11d4596d19450c313f1598e5c03232c7e618 100644
--- a/src/zone.cc
+++ b/src/zone.cc
@@ -104,9 +104,13 @@ void Zone::DeleteAll() {
} else {
int size = current->size();
#ifdef DEBUG
+#ifdef ADDRESS_SANITIZER
+ // Un-poison first so the zapping doesn't trigger ASan complaints.
+ ASAN_UNPOISON_MEMORY_REGION(current, size);
+#endif // ADDRESS_SANITIZER
// Zap the entire current segment (including the header).
memset(current, kZapDeadByte, size);
-#endif
+#endif // DEBUG
DeleteSegment(current, size);
}
current = next;
@@ -120,6 +124,10 @@ void Zone::DeleteAll() {
Address start = keep->start();
position_ = RoundUp(start, kAlignment);
limit_ = keep->end();
+#ifdef ADDRESS_SANITIZER
+ // Un-poison so we can re-use the segment later.
+ ASAN_UNPOISON_MEMORY_REGION(start, keep->capacity());
+#endif
#ifdef DEBUG
// Zap the contents of the kept segment (but not the header).
memset(start, kZapDeadByte, keep->capacity());
@@ -143,9 +151,13 @@ void Zone::DeleteKeptSegment() {
if (segment_head_ != NULL) {
int size = segment_head_->size();
#ifdef DEBUG
+#ifdef ADDRESS_SANITIZER
+ // Un-poison first so the zapping doesn't trigger ASan complaints.
+ ASAN_UNPOISON_MEMORY_REGION(segment_head_, size);
+#endif // ADDRESS_SANITIZER
// Zap the entire kept segment (including the header).
memset(segment_head_, kZapDeadByte, size);
-#endif
+#endif // DEBUG
DeleteSegment(segment_head_, size);
segment_head_ = NULL;
}

Powered by Google App Engine
This is Rietveld 408576698