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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 raw_address_ = NULL; | 42 raw_address_ = NULL; |
43 } else { | 43 } else { |
44 // This is a best-effort check to prevent comparing Unique<T>'s created | 44 // This is a best-effort check to prevent comparing Unique<T>'s created |
45 // in different GC eras; we require heap allocation to be disallowed at | 45 // in different GC eras; we require heap allocation to be disallowed at |
46 // creation time. | 46 // creation time. |
47 // NOTE: we currently consider maps to be non-movable, so no special | 47 // NOTE: we currently consider maps to be non-movable, so no special |
48 // assurance is required for creating a Unique<Map>. | 48 // assurance is required for creating a Unique<Map>. |
49 // TODO(titzer): other immortable immovable objects are also fine. | 49 // TODO(titzer): other immortable immovable objects are also fine. |
50 DCHECK(!AllowHeapAllocation::IsAllowed() || handle->IsMap()); | 50 DCHECK(!AllowHeapAllocation::IsAllowed() || handle->IsMap()); |
51 raw_address_ = reinterpret_cast<Address>(*handle); | 51 raw_address_ = reinterpret_cast<Address>(*handle); |
52 DCHECK_NE(raw_address_, NULL); // Non-null should imply non-zero address. | 52 DCHECK_NOT_NULL(raw_address_); // Non-null should imply non-zero address. |
53 } | 53 } |
54 handle_ = handle; | 54 handle_ = handle; |
55 } | 55 } |
56 | 56 |
57 // TODO(titzer): this is a hack to migrate to Unique<T> incrementally. | 57 // TODO(titzer): this is a hack to migrate to Unique<T> incrementally. |
58 Unique(Address raw_address, Handle<T> handle) | 58 Unique(Address raw_address, Handle<T> handle) |
59 : raw_address_(raw_address), handle_(handle) { } | 59 : raw_address_(raw_address), handle_(handle) { } |
60 | 60 |
61 // Constructor for handling automatic up casting. | 61 // Constructor for handling automatic up casting. |
62 // Eg. Unique<JSFunction> can be passed when Unique<Object> is expected. | 62 // Eg. Unique<JSFunction> can be passed when Unique<Object> is expected. |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 350 } |
351 capacity_ = new_capacity; | 351 capacity_ = new_capacity; |
352 array_ = new_array; | 352 array_ = new_array; |
353 } | 353 } |
354 } | 354 } |
355 }; | 355 }; |
356 | 356 |
357 } } // namespace v8::internal | 357 } } // namespace v8::internal |
358 | 358 |
359 #endif // V8_HYDROGEN_UNIQUE_H_ | 359 #endif // V8_HYDROGEN_UNIQUE_H_ |
OLD | NEW |