V8 Project
zone-inl.h
Go to the documentation of this file.
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
3 // found in the LICENSE file.
4 
5 #ifndef V8_ZONE_INL_H_
6 #define V8_ZONE_INL_H_
7 
8 #include "src/zone.h"
9 
10 #ifdef V8_USE_ADDRESS_SANITIZER
11  #include <sanitizer/asan_interface.h>
12 #else
13  #define ASAN_UNPOISON_MEMORY_REGION(start, size) ((void) 0)
14 #endif
15 
16 #include "src/counters.h"
17 #include "src/isolate.h"
18 #include "src/utils.h"
19 
20 namespace v8 {
21 namespace internal {
22 
23 
24 static const int kASanRedzoneBytes = 24; // Must be a multiple of 8.
25 
26 
29 }
30 
31 
33  segment_bytes_allocated_ += delta;
34  isolate_->counters()->zone_segment_bytes()->Set(segment_bytes_allocated_);
35 }
36 
37 
38 template <typename Config>
40  // Reset the root to avoid unneeded iteration over all tree nodes
41  // in the destructor. For a zone-allocated tree, nodes will be
42  // freed by the Zone.
44 }
45 
46 
47 void* ZoneObject::operator new(size_t size, Zone* zone) {
48  return zone->New(static_cast<int>(size));
49 }
50 
51 inline void* ZoneAllocationPolicy::New(size_t size) {
52  DCHECK(zone_);
53  return zone_->New(static_cast<int>(size));
54 }
55 
56 
57 template <typename T>
58 void* ZoneList<T>::operator new(size_t size, Zone* zone) {
59  return zone->New(static_cast<int>(size));
60 }
61 
62 
63 template <typename T>
64 void* ZoneSplayTree<T>::operator new(size_t size, Zone* zone) {
65  return zone->New(static_cast<int>(size));
66 }
67 
68 
69 } } // namespace v8::internal
70 
71 #endif // V8_ZONE_INL_H_
Counters * counters()
Definition: isolate.h:857
Isolate * isolate_
Definition: zone.h:123
bool excess_allocation()
Definition: zone-inl.h:27
void adjust_segment_bytes_allocated(int delta)
Definition: zone-inl.h:32
int segment_bytes_allocated_
Definition: zone.h:101
static const int kExcessLimit
Definition: zone.h:93
void * New(int size)
Definition: zone.cc:65
enable harmony numeric enable harmony object literal extensions Optimize object size
#define DCHECK(condition)
Definition: logging.h:205
static const int kASanRedzoneBytes
Definition: zone-inl.h:24
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20