OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_HYDROGEN_UNIQUE_H_ | 5 #ifndef V8_HYDROGEN_UNIQUE_H_ |
6 #define V8_HYDROGEN_UNIQUE_H_ | 6 #define V8_HYDROGEN_UNIQUE_H_ |
7 | 7 |
8 #include <ostream> // NOLINT(readability/streams) | 8 #include <ostream> // NOLINT(readability/streams) |
9 | 9 |
10 #include "src/base/functional.h" | 10 #include "src/base/functional.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 friend class SideEffectsTracker; | 140 friend class SideEffectsTracker; |
141 }; | 141 }; |
142 | 142 |
143 template <typename T> | 143 template <typename T> |
144 inline std::ostream& operator<<(std::ostream& os, Unique<T> uniq) { | 144 inline std::ostream& operator<<(std::ostream& os, Unique<T> uniq) { |
145 return os << Brief(*uniq.handle()); | 145 return os << Brief(*uniq.handle()); |
146 } | 146 } |
147 | 147 |
148 | 148 |
149 template <typename T> | 149 template <typename T> |
150 class UniqueSet FINAL : public ZoneObject { | 150 class UniqueSet final : public ZoneObject { |
151 public: | 151 public: |
152 // Constructor. A new set will be empty. | 152 // Constructor. A new set will be empty. |
153 UniqueSet() : size_(0), capacity_(0), array_(NULL) { } | 153 UniqueSet() : size_(0), capacity_(0), array_(NULL) { } |
154 | 154 |
155 // Capacity constructor. A new set will be empty. | 155 // Capacity constructor. A new set will be empty. |
156 UniqueSet(int capacity, Zone* zone) | 156 UniqueSet(int capacity, Zone* zone) |
157 : size_(0), capacity_(capacity), | 157 : size_(0), capacity_(capacity), |
158 array_(zone->NewArray<Unique<T> >(capacity)) { | 158 array_(zone->NewArray<Unique<T> >(capacity)) { |
159 DCHECK(capacity <= kMaxCapacity); | 159 DCHECK(capacity <= kMaxCapacity); |
160 } | 160 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 355 } |
356 capacity_ = new_capacity; | 356 capacity_ = new_capacity; |
357 array_ = new_array; | 357 array_ = new_array; |
358 } | 358 } |
359 } | 359 } |
360 }; | 360 }; |
361 | 361 |
362 } } // namespace v8::internal | 362 } } // namespace v8::internal |
363 | 363 |
364 #endif // V8_HYDROGEN_UNIQUE_H_ | 364 #endif // V8_HYDROGEN_UNIQUE_H_ |
OLD | NEW |