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

Side by Side Diff: Source/platform/heap/Heap.h

Issue 556443003: Oilpan: Fix ASan instrumentation around heap object headers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/heap/Heap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 size_t HeapObjectHeader::payloadSize() 1490 size_t HeapObjectHeader::payloadSize()
1491 { 1491 {
1492 return size() - objectHeaderSize; 1492 return size() - objectHeaderSize;
1493 } 1493 }
1494 1494
1495 Address HeapObjectHeader::payloadEnd() 1495 Address HeapObjectHeader::payloadEnd()
1496 { 1496 {
1497 return reinterpret_cast<Address>(this) + size(); 1497 return reinterpret_cast<Address>(this) + size();
1498 } 1498 }
1499 1499
1500 NO_SANITIZE_ADDRESS
1500 void HeapObjectHeader::mark() 1501 void HeapObjectHeader::mark()
1501 { 1502 {
1502 checkHeader(); 1503 checkHeader();
1503 // The use of atomic ops guarantees that the reads and writes are 1504 // The use of atomic ops guarantees that the reads and writes are
1504 // atomic and that no memory operation reorderings take place. 1505 // atomic and that no memory operation reorderings take place.
1505 // Multiple threads can still read the old value and all store the 1506 // Multiple threads can still read the old value and all store the
1506 // new value. However, the new value will be the same for all of 1507 // new value. However, the new value will be the same for all of
1507 // the threads and the end result is therefore consistent. 1508 // the threads and the end result is therefore consistent.
1508 // We need to unpoison/poison the header on ASAN since 1509 unsigned size = asanUnsafeAcquireLoad(&m_size);
1509 // acquireLoad/releaseStore don't have the NO_SANITIZE_ADDRESS flag. 1510 asanUnsafeReleaseStore(&m_size, size | markBitMask);
1510 ASAN_UNPOISON_MEMORY_REGION(this, sizeof(this));
1511 unsigned size = acquireLoad(&m_size);
1512 releaseStore(&m_size, size | markBitMask);
1513 ASAN_POISON_MEMORY_REGION(this, sizeof(this));
1514 } 1511 }
1515 1512
1516 Address FinalizedHeapObjectHeader::payload() 1513 Address FinalizedHeapObjectHeader::payload()
1517 { 1514 {
1518 return reinterpret_cast<Address>(this) + finalizedHeaderSize; 1515 return reinterpret_cast<Address>(this) + finalizedHeaderSize;
1519 } 1516 }
1520 1517
1521 size_t FinalizedHeapObjectHeader::payloadSize() 1518 size_t FinalizedHeapObjectHeader::payloadSize()
1522 { 1519 {
1523 return size() - finalizedHeaderSize; 1520 return size() - finalizedHeaderSize;
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 }; 2568 };
2572 2569
2573 template<typename T> 2570 template<typename T>
2574 struct IfWeakMember<WeakMember<T> > { 2571 struct IfWeakMember<WeakMember<T> > {
2575 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit or->isAlive(t.get()); } 2572 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit or->isAlive(t.get()); }
2576 }; 2573 };
2577 2574
2578 } 2575 }
2579 2576
2580 #endif // Heap_h 2577 #endif // Heap_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/Heap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698