| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 V8_INLINE bool ToHandle(Handle<S>* out) const { | 219 V8_INLINE bool ToHandle(Handle<S>* out) const { |
| 220 if (location_ == nullptr) { | 220 if (location_ == nullptr) { |
| 221 *out = Handle<T>::null(); | 221 *out = Handle<T>::null(); |
| 222 return false; | 222 return false; |
| 223 } else { | 223 } else { |
| 224 *out = Handle<T>(location_); | 224 *out = Handle<T>(location_); |
| 225 return true; | 225 return true; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 // Returns the raw address where this handle is stored. This should only be |
| 230 // used for hashing handles; do not ever try to dereference it. |
| 231 V8_INLINE Address address() const { return bit_cast<Address>(location_); } |
| 232 |
| 229 bool is_null() const { return location_ == nullptr; } | 233 bool is_null() const { return location_ == nullptr; } |
| 230 | 234 |
| 231 protected: | 235 protected: |
| 232 T** location_ = nullptr; | 236 T** location_ = nullptr; |
| 233 | 237 |
| 234 // MaybeHandles of different classes are allowed to access each | 238 // MaybeHandles of different classes are allowed to access each |
| 235 // other's location_. | 239 // other's location_. |
| 236 template <typename> | 240 template <typename> |
| 237 friend class MaybeHandle; | 241 friend class MaybeHandle; |
| 238 }; | 242 }; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 next = limit = NULL; | 407 next = limit = NULL; |
| 404 sealed_level = level = 0; | 408 sealed_level = level = 0; |
| 405 canonical_scope = NULL; | 409 canonical_scope = NULL; |
| 406 } | 410 } |
| 407 }; | 411 }; |
| 408 | 412 |
| 409 } // namespace internal | 413 } // namespace internal |
| 410 } // namespace v8 | 414 } // namespace v8 |
| 411 | 415 |
| 412 #endif // V8_HANDLES_H_ | 416 #endif // V8_HANDLES_H_ |
| OLD | NEW |