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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 // TODO(titzer): this is a hack to migrate to Unique<T> incrementally. | 123 // TODO(titzer): this is a hack to migrate to Unique<T> incrementally. |
124 static Unique<T> CreateUninitialized(Handle<T> handle) { | 124 static Unique<T> CreateUninitialized(Handle<T> handle) { |
125 return Unique<T>(NULL, handle); | 125 return Unique<T>(NULL, handle); |
126 } | 126 } |
127 | 127 |
128 static Unique<T> CreateImmovable(Handle<T> handle) { | 128 static Unique<T> CreateImmovable(Handle<T> handle) { |
129 return Unique<T>(reinterpret_cast<Address>(*handle), handle); | 129 return Unique<T>(reinterpret_cast<Address>(*handle), handle); |
130 } | 130 } |
131 | 131 |
132 T* GetRawAddress() const { | |
133 DCHECK(IsInitialized()); | |
134 return reinterpret_cast<T*>(raw_address_); | |
135 } | |
136 | |
137 friend class UniqueSet<T>; // Uses internal details for speed. | 132 friend class UniqueSet<T>; // Uses internal details for speed. |
138 template <class U> | 133 template <class U> |
139 friend class Unique; // For comparing raw_address values. | 134 friend class Unique; // For comparing raw_address values. |
140 | 135 |
141 protected: | 136 protected: |
142 Address raw_address_; | 137 Address raw_address_; |
143 Handle<T> handle_; | 138 Handle<T> handle_; |
144 | 139 |
145 friend class SideEffectsTracker; | 140 friend class SideEffectsTracker; |
146 }; | 141 }; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 355 } |
361 capacity_ = new_capacity; | 356 capacity_ = new_capacity; |
362 array_ = new_array; | 357 array_ = new_array; |
363 } | 358 } |
364 } | 359 } |
365 }; | 360 }; |
366 | 361 |
367 } } // namespace v8::internal | 362 } } // namespace v8::internal |
368 | 363 |
369 #endif // V8_HYDROGEN_UNIQUE_H_ | 364 #endif // V8_HYDROGEN_UNIQUE_H_ |
OLD | NEW |