| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_ZONE_INL_H_ | 28 #ifndef V8_ZONE_INL_H_ |
| 29 #define V8_ZONE_INL_H_ | 29 #define V8_ZONE_INL_H_ |
| 30 | 30 |
| 31 #include "zone.h" | 31 #include "zone.h" |
| 32 | 32 |
| 33 #ifdef ADDRESS_SANITIZER | 33 #ifdef V8_USE_ADDRESS_SANITIZER |
| 34 #include <sanitizer/asan_interface.h> | 34 #include <sanitizer/asan_interface.h> |
| 35 #else | 35 #else |
| 36 #define ASAN_UNPOISON_MEMORY_REGION(start, size) ((void) 0) | 36 #define ASAN_UNPOISON_MEMORY_REGION(start, size) ((void) 0) |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 #include "counters.h" | 39 #include "counters.h" |
| 40 #include "isolate.h" | 40 #include "isolate.h" |
| 41 #include "utils.h" | 41 #include "utils.h" |
| 42 #include "v8-counters.h" | 42 #include "v8-counters.h" |
| 43 | 43 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 57 if (kPointerSize == 4 && kAlignment == 4) { | 57 if (kPointerSize == 4 && kAlignment == 4) { |
| 58 position_ += ((~size) & 4) & (reinterpret_cast<intptr_t>(position_) & 4); | 58 position_ += ((~size) & 4) & (reinterpret_cast<intptr_t>(position_) & 4); |
| 59 } else { | 59 } else { |
| 60 ASSERT(kAlignment >= kPointerSize); | 60 ASSERT(kAlignment >= kPointerSize); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Check if the requested size is available without expanding. | 63 // Check if the requested size is available without expanding. |
| 64 Address result = position_; | 64 Address result = position_; |
| 65 | 65 |
| 66 int size_with_redzone = | 66 int size_with_redzone = |
| 67 #ifdef ADDRESS_SANITIZER | 67 #ifdef V8_USE_ADDRESS_SANITIZER |
| 68 size + kASanRedzoneBytes; | 68 size + kASanRedzoneBytes; |
| 69 #else | 69 #else |
| 70 size; | 70 size; |
| 71 #endif | 71 #endif |
| 72 | 72 |
| 73 if (size_with_redzone > limit_ - position_) { | 73 if (size_with_redzone > limit_ - position_) { |
| 74 result = NewExpand(size_with_redzone); | 74 result = NewExpand(size_with_redzone); |
| 75 } else { | 75 } else { |
| 76 position_ += size_with_redzone; | 76 position_ += size_with_redzone; |
| 77 } | 77 } |
| 78 | 78 |
| 79 #ifdef ADDRESS_SANITIZER | 79 #ifdef V8_USE_ADDRESS_SANITIZER |
| 80 Address redzone_position = result + size; | 80 Address redzone_position = result + size; |
| 81 ASSERT(redzone_position + kASanRedzoneBytes == position_); | 81 ASSERT(redzone_position + kASanRedzoneBytes == position_); |
| 82 ASAN_POISON_MEMORY_REGION(redzone_position, kASanRedzoneBytes); | 82 ASAN_POISON_MEMORY_REGION(redzone_position, kASanRedzoneBytes); |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 // Check that the result has the proper alignment and return it. | 85 // Check that the result has the proper alignment and return it. |
| 86 ASSERT(IsAddressAligned(result, kAlignment, 0)); | 86 ASSERT(IsAddressAligned(result, kAlignment, 0)); |
| 87 allocation_size_ += size; | 87 allocation_size_ += size; |
| 88 return reinterpret_cast<void*>(result); | 88 return reinterpret_cast<void*>(result); |
| 89 } | 89 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 template <typename T> | 135 template <typename T> |
| 136 void* ZoneSplayTree<T>::operator new(size_t size, Zone* zone) { | 136 void* ZoneSplayTree<T>::operator new(size_t size, Zone* zone) { |
| 137 return zone->New(static_cast<int>(size)); | 137 return zone->New(static_cast<int>(size)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 } } // namespace v8::internal | 141 } } // namespace v8::internal |
| 142 | 142 |
| 143 #endif // V8_ZONE_INL_H_ | 143 #endif // V8_ZONE_INL_H_ |
| OLD | NEW |