Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 #if defined(ADDRESS_SANITIZER) |
|
zerny-chromium
2014/09/09 06:01:28
I'd prefer to avoid the code duplication by defini
Mads Ager (chromium)
2014/09/09 08:22:14
Done.
| |
| 1509 // acquireLoad/releaseStore don't have the NO_SANITIZE_ADDRESS flag. | 1510 unsigned size = asanAcquireLoad(&m_size); |
| 1510 ASAN_UNPOISON_MEMORY_REGION(this, sizeof(this)); | 1511 asanReleaseStore(&m_size, size | markBitMask); |
| 1512 #else | |
| 1511 unsigned size = acquireLoad(&m_size); | 1513 unsigned size = acquireLoad(&m_size); |
| 1512 releaseStore(&m_size, size | markBitMask); | 1514 releaseStore(&m_size, size | markBitMask); |
| 1513 ASAN_POISON_MEMORY_REGION(this, sizeof(this)); | 1515 #endif |
| 1514 } | 1516 } |
| 1515 | 1517 |
| 1516 Address FinalizedHeapObjectHeader::payload() | 1518 Address FinalizedHeapObjectHeader::payload() |
| 1517 { | 1519 { |
| 1518 return reinterpret_cast<Address>(this) + finalizedHeaderSize; | 1520 return reinterpret_cast<Address>(this) + finalizedHeaderSize; |
| 1519 } | 1521 } |
| 1520 | 1522 |
| 1521 size_t FinalizedHeapObjectHeader::payloadSize() | 1523 size_t FinalizedHeapObjectHeader::payloadSize() |
| 1522 { | 1524 { |
| 1523 return size() - finalizedHeaderSize; | 1525 return size() - finalizedHeaderSize; |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2571 }; | 2573 }; |
| 2572 | 2574 |
| 2573 template<typename T> | 2575 template<typename T> |
| 2574 struct IfWeakMember<WeakMember<T> > { | 2576 struct IfWeakMember<WeakMember<T> > { |
| 2575 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit or->isAlive(t.get()); } | 2577 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit or->isAlive(t.get()); } |
| 2576 }; | 2578 }; |
| 2577 | 2579 |
| 2578 } | 2580 } |
| 2579 | 2581 |
| 2580 #endif // Heap_h | 2582 #endif // Heap_h |
| OLD | NEW |