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 "src/handles.h" | 8 #include "src/handles.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/string-stream.h" | 10 #include "src/string-stream.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 // TODO(titzer): this is a hack to migrate to Unique<T> incrementally. | 168 // TODO(titzer): this is a hack to migrate to Unique<T> incrementally. |
169 static PrintableUnique<T> CreateUninitialized(Zone* zone, Handle<T> handle) { | 169 static PrintableUnique<T> CreateUninitialized(Zone* zone, Handle<T> handle) { |
170 return PrintableUnique<T>(zone, reinterpret_cast<Address>(NULL), handle); | 170 return PrintableUnique<T>(zone, reinterpret_cast<Address>(NULL), handle); |
171 } | 171 } |
172 | 172 |
173 static PrintableUnique<T> CreateImmovable(Zone* zone, Handle<T> handle) { | 173 static PrintableUnique<T> CreateImmovable(Zone* zone, Handle<T> handle) { |
174 return PrintableUnique<T>(zone, reinterpret_cast<Address>(*handle), handle); | 174 return PrintableUnique<T>(zone, reinterpret_cast<Address>(*handle), handle); |
175 } | 175 } |
176 | 176 |
177 const char* string() { return string_; } | 177 const char* string() const { return string_; } |
178 | 178 |
179 private: | 179 private: |
180 const char* string_; | 180 const char* string_; |
181 | 181 |
182 void InitializeString(Zone* zone) { | 182 void InitializeString(Zone* zone) { |
183 // The stringified version of the parameter must be calculated when the | 183 // The stringified version of the parameter must be calculated when the |
184 // Operator is constructed to avoid accessing the heap. | 184 // Operator is constructed to avoid accessing the heap. |
185 HeapStringAllocator temp_allocator; | 185 HeapStringAllocator temp_allocator; |
186 StringStream stream(&temp_allocator); | 186 StringStream stream(&temp_allocator); |
187 this->handle_->ShortPrint(&stream); | 187 this->handle_->ShortPrint(&stream); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 404 } |
405 capacity_ = new_capacity; | 405 capacity_ = new_capacity; |
406 array_ = new_array; | 406 array_ = new_array; |
407 } | 407 } |
408 } | 408 } |
409 }; | 409 }; |
410 | 410 |
411 } } // namespace v8::internal | 411 } } // namespace v8::internal |
412 | 412 |
413 #endif // V8_HYDROGEN_UNIQUE_H_ | 413 #endif // V8_HYDROGEN_UNIQUE_H_ |
OLD | NEW |