OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ZONE_INL_H_ | 5 #ifndef V8_ZONE_INL_H_ |
6 #define V8_ZONE_INL_H_ | 6 #define V8_ZONE_INL_H_ |
7 | 7 |
8 #include "src/zone.h" | 8 #include "src/zone.h" |
9 | 9 |
10 #ifdef V8_USE_ADDRESS_SANITIZER | 10 #ifdef V8_USE_ADDRESS_SANITIZER |
(...skipping 13 matching lines...) Expand all Loading... |
24 static const int kASanRedzoneBytes = 24; // Must be a multiple of 8. | 24 static const int kASanRedzoneBytes = 24; // Must be a multiple of 8. |
25 | 25 |
26 | 26 |
27 bool Zone::excess_allocation() { | 27 bool Zone::excess_allocation() { |
28 return segment_bytes_allocated_ > kExcessLimit; | 28 return segment_bytes_allocated_ > kExcessLimit; |
29 } | 29 } |
30 | 30 |
31 | 31 |
32 void Zone::adjust_segment_bytes_allocated(int delta) { | 32 void Zone::adjust_segment_bytes_allocated(int delta) { |
33 segment_bytes_allocated_ += delta; | 33 segment_bytes_allocated_ += delta; |
34 isolate_->counters()->zone_segment_bytes()->Set(segment_bytes_allocated_); | |
35 } | 34 } |
36 | 35 |
37 | 36 |
38 template <typename Config> | 37 template <typename Config> |
39 ZoneSplayTree<Config>::~ZoneSplayTree() { | 38 ZoneSplayTree<Config>::~ZoneSplayTree() { |
40 // Reset the root to avoid unneeded iteration over all tree nodes | 39 // Reset the root to avoid unneeded iteration over all tree nodes |
41 // in the destructor. For a zone-allocated tree, nodes will be | 40 // in the destructor. For a zone-allocated tree, nodes will be |
42 // freed by the Zone. | 41 // freed by the Zone. |
43 SplayTree<Config, ZoneAllocationPolicy>::ResetRoot(); | 42 SplayTree<Config, ZoneAllocationPolicy>::ResetRoot(); |
44 } | 43 } |
(...skipping 17 matching lines...) Expand all Loading... |
62 | 61 |
63 template <typename T> | 62 template <typename T> |
64 void* ZoneSplayTree<T>::operator new(size_t size, Zone* zone) { | 63 void* ZoneSplayTree<T>::operator new(size_t size, Zone* zone) { |
65 return zone->New(static_cast<int>(size)); | 64 return zone->New(static_cast<int>(size)); |
66 } | 65 } |
67 | 66 |
68 | 67 |
69 } } // namespace v8::internal | 68 } } // namespace v8::internal |
70 | 69 |
71 #endif // V8_ZONE_INL_H_ | 70 #endif // V8_ZONE_INL_H_ |
OLD | NEW |