| 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_CRANKSHAFT_UNIQUE_H_ | 5 #ifndef V8_CRANKSHAFT_UNIQUE_H_ |
| 6 #define V8_CRANKSHAFT_UNIQUE_H_ | 6 #define V8_CRANKSHAFT_UNIQUE_H_ |
| 7 | 7 |
| 8 #include <ostream> // NOLINT(readability/streams) | 8 #include <ostream> // NOLINT(readability/streams) |
| 9 | 9 |
| 10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 friend class UniqueSet<T>; // Uses internal details for speed. | 135 friend class UniqueSet<T>; // Uses internal details for speed. |
| 136 template <class U> | 136 template <class U> |
| 137 friend class Unique; // For comparing raw_address values. | 137 friend class Unique; // For comparing raw_address values. |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 template <typename T> | 140 template <typename T> |
| 141 inline std::ostream& operator<<(std::ostream& os, Unique<T> uniq) { | 141 inline std::ostream& operator<<(std::ostream& os, Unique<T> uniq) { |
| 142 return os << Brief(*uniq.handle()); | 142 return os << Brief(*uniq.handle()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 | |
| 146 template <typename T> | 145 template <typename T> |
| 147 class UniqueSet final : public ZoneObject { | 146 class UniqueSet final : public ZoneObject { |
| 148 public: | 147 public: |
| 149 // Constructor. A new set will be empty. | 148 // Constructor. A new set will be empty. |
| 150 UniqueSet() : size_(0), capacity_(0), array_(NULL) { } | 149 UniqueSet() : size_(0), capacity_(0), array_(NULL) { } |
| 151 | 150 |
| 152 // Capacity constructor. A new set will be empty. | 151 // Capacity constructor. A new set will be empty. |
| 153 UniqueSet(int capacity, Zone* zone) | 152 UniqueSet(int capacity, Zone* zone) |
| 154 : size_(0), capacity_(capacity), | 153 : size_(0), capacity_(capacity), |
| 155 array_(zone->NewArray<Unique<T> >(capacity)) { | 154 array_(zone->NewArray<Unique<T> >(capacity)) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 capacity_ = new_capacity; | 352 capacity_ = new_capacity; |
| 354 array_ = new_array; | 353 array_ = new_array; |
| 355 } | 354 } |
| 356 } | 355 } |
| 357 }; | 356 }; |
| 358 | 357 |
| 359 } // namespace internal | 358 } // namespace internal |
| 360 } // namespace v8 | 359 } // namespace v8 |
| 361 | 360 |
| 362 #endif // V8_CRANKSHAFT_UNIQUE_H_ | 361 #endif // V8_CRANKSHAFT_UNIQUE_H_ |
| OLD | NEW |