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

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

Issue 2452403003: Changed statement ZoneList to a ZoneChunkList
Patch Set: Created 4 years, 1 month 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/zone.h ('k') | src/zone/zone-containers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_ZONE_ALLOCATOR_H_ 5 #ifndef V8_ZONE_ZONE_ALLOCATOR_H_
6 #define V8_ZONE_ZONE_ALLOCATOR_H_ 6 #define V8_ZONE_ZONE_ALLOCATOR_H_
7 #include <limits> 7 #include <limits>
8 #include <new>
8 9
9 #include "src/zone/zone.h" 10 #include "src/zone/zone.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 template <typename T> 15 template <typename T>
15 class zone_allocator { 16 class zone_allocator {
16 public: 17 public:
17 typedef T* pointer; 18 typedef T* pointer;
(...skipping 25 matching lines...) Expand all
43 return static_cast<pointer>( 44 return static_cast<pointer>(
44 zone_->NewArray<value_type>(static_cast<int>(n))); 45 zone_->NewArray<value_type>(static_cast<int>(n)));
45 } 46 }
46 void deallocate(pointer p, size_type) { /* noop for Zones */ 47 void deallocate(pointer p, size_type) { /* noop for Zones */
47 } 48 }
48 49
49 size_type max_size() const throw() { 50 size_type max_size() const throw() {
50 return std::numeric_limits<int>::max() / sizeof(value_type); 51 return std::numeric_limits<int>::max() / sizeof(value_type);
51 } 52 }
52 void construct(pointer p, const T& val) { 53 void construct(pointer p, const T& val) {
53 new (static_cast<void*>(p)) T(val); 54 ::new (static_cast<void*>(p)) T(val);
54 } 55 }
55 void destroy(pointer p) { p->~T(); } 56 void destroy(pointer p) { p->~T(); }
56 57
57 bool operator==(zone_allocator const& other) const { 58 bool operator==(zone_allocator const& other) const {
58 return zone_ == other.zone_; 59 return zone_ == other.zone_;
59 } 60 }
60 bool operator!=(zone_allocator const& other) const { 61 bool operator!=(zone_allocator const& other) const {
61 return zone_ != other.zone_; 62 return zone_ != other.zone_;
62 } 63 }
63 64
64 Zone* zone() { return zone_; } 65 Zone* zone() { return zone_; }
65 66
66 private: 67 private:
67 Zone* zone_; 68 Zone* zone_;
68 }; 69 };
69 70
70 typedef zone_allocator<bool> ZoneBoolAllocator; 71 typedef zone_allocator<bool> ZoneBoolAllocator;
71 typedef zone_allocator<int> ZoneIntAllocator; 72 typedef zone_allocator<int> ZoneIntAllocator;
72 } // namespace internal 73 } // namespace internal
73 } // namespace v8 74 } // namespace v8
74 75
75 #endif // V8_ZONE_ZONE_ALLOCATOR_H_ 76 #endif // V8_ZONE_ZONE_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « src/zone/zone.h ('k') | src/zone/zone-containers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698