OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_HANDLES_H_ | 5 #ifndef V8_HANDLES_H_ |
6 #define V8_HANDLES_H_ | 6 #define V8_HANDLES_H_ |
7 | 7 |
8 #include "include/v8.h" | 8 #include "include/v8.h" |
9 #include "src/base/functional.h" | 9 #include "src/base/functional.h" |
10 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 V8_INLINE explicit Handle(T** location = nullptr) | 90 V8_INLINE explicit Handle(T** location = nullptr) |
91 : HandleBase(reinterpret_cast<Object**>(location)) { | 91 : HandleBase(reinterpret_cast<Object**>(location)) { |
92 Object* a = nullptr; | 92 Object* a = nullptr; |
93 T* b = nullptr; | 93 T* b = nullptr; |
94 a = b; // Fake assignment to enforce type checks. | 94 a = b; // Fake assignment to enforce type checks. |
95 USE(a); | 95 USE(a); |
96 } | 96 } |
97 V8_INLINE explicit Handle(T* object) : Handle(object, object->GetIsolate()) {} | 97 V8_INLINE explicit Handle(T* object) : Handle(object, object->GetIsolate()) {} |
98 V8_INLINE Handle(T* object, Isolate* isolate) : HandleBase(object, isolate) {} | 98 V8_INLINE Handle(T* object, Isolate* isolate) : HandleBase(object, isolate) {} |
99 | 99 |
100 // XXX Can we be sure that the below is only used when T != S? | |
101 template <typename S> | |
102 V8_INLINE Handle(S* object, Isolate* isolate) | |
adamk
2016/08/25 16:19:43
What is this for?
neis
2016/08/26 09:52:07
I added it to save some typing but I removed it no
| |
103 : HandleBase(T::cast(object), isolate) {} | |
104 | |
100 // Allocate a new handle for the object, do not canonicalize. | 105 // Allocate a new handle for the object, do not canonicalize. |
101 V8_INLINE static Handle<T> New(T* object, Isolate* isolate); | 106 V8_INLINE static Handle<T> New(T* object, Isolate* isolate); |
102 | 107 |
103 // Constructor for handling automatic up casting. | 108 // Constructor for handling automatic up casting. |
104 // Ex. Handle<JSFunction> can be passed when Handle<Object> is expected. | 109 // Ex. Handle<JSFunction> can be passed when Handle<Object> is expected. |
105 template <typename S> | 110 template <typename S> |
106 V8_INLINE Handle(Handle<S> handle) | 111 V8_INLINE Handle(Handle<S> handle) |
107 : HandleBase(handle) { | 112 : HandleBase(handle) { |
108 T* a = nullptr; | 113 T* a = nullptr; |
109 S* b = nullptr; | 114 S* b = nullptr; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 next = limit = NULL; | 412 next = limit = NULL; |
408 sealed_level = level = 0; | 413 sealed_level = level = 0; |
409 canonical_scope = NULL; | 414 canonical_scope = NULL; |
410 } | 415 } |
411 }; | 416 }; |
412 | 417 |
413 } // namespace internal | 418 } // namespace internal |
414 } // namespace v8 | 419 } // namespace v8 |
415 | 420 |
416 #endif // V8_HANDLES_H_ | 421 #endif // V8_HANDLES_H_ |
OLD | NEW |