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

Side by Side Diff: src/zone-inl.h

Issue 885813002: Minor refactoring for Zone class and friends. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « src/zone.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
27 bool Zone::excess_allocation() {
28 return segment_bytes_allocated_ > kExcessLimit;
29 }
30
31
32 void Zone::adjust_segment_bytes_allocated(int delta) {
33 segment_bytes_allocated_ += delta;
34 }
35
36
37 template <typename Config>
38 ZoneSplayTree<Config>::~ZoneSplayTree() {
39 // Reset the root to avoid unneeded iteration over all tree nodes
40 // in the destructor. For a zone-allocated tree, nodes will be
41 // freed by the Zone.
42 SplayTree<Config, ZoneAllocationPolicy>::ResetRoot();
43 }
44
45
46 void* ZoneObject::operator new(size_t size, Zone* zone) {
47 return zone->New(static_cast<int>(size));
48 }
49
50 inline void* ZoneAllocationPolicy::New(size_t size) {
51 DCHECK(zone_);
52 return zone_->New(static_cast<int>(size));
53 }
54
55
56 template <typename T>
57 void* ZoneList<T>::operator new(size_t size, Zone* zone) {
58 return zone->New(static_cast<int>(size));
59 }
60
61
62 template <typename T>
63 void* ZoneSplayTree<T>::operator new(size_t size, Zone* zone) {
64 return zone->New(static_cast<int>(size));
65 }
66
67
68 } } // namespace v8::internal
69
70 #endif // V8_ZONE_INL_H_
OLDNEW
« no previous file with comments | « src/zone.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698