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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 V8_INLINE bool ToHandle(Handle<S>* out) const { | 215 V8_INLINE bool ToHandle(Handle<S>* out) const { |
216 if (location_ == nullptr) { | 216 if (location_ == nullptr) { |
217 *out = Handle<T>::null(); | 217 *out = Handle<T>::null(); |
218 return false; | 218 return false; |
219 } else { | 219 } else { |
220 *out = Handle<T>(location_); | 220 *out = Handle<T>(location_); |
221 return true; | 221 return true; |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 // Returns the address to where the raw pointer is stored. | |
226 V8_INLINE T** location() const { return location_; } | |
Michael Starzinger
2015/11/20 12:06:47
Nah, I worked so hard to get rid of this accessor.
Benedikt Meurer
2015/11/20 12:28:53
Done.
| |
227 | |
225 bool is_null() const { return location_ == nullptr; } | 228 bool is_null() const { return location_ == nullptr; } |
226 | 229 |
227 protected: | 230 protected: |
228 T** location_ = nullptr; | 231 T** location_ = nullptr; |
229 | 232 |
230 // MaybeHandles of different classes are allowed to access each | 233 // MaybeHandles of different classes are allowed to access each |
231 // other's location_. | 234 // other's location_. |
232 template <typename> | 235 template <typename> |
233 friend class MaybeHandle; | 236 friend class MaybeHandle; |
234 }; | 237 }; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 next = limit = NULL; | 402 next = limit = NULL; |
400 sealed_level = level = 0; | 403 sealed_level = level = 0; |
401 canonical_scope = NULL; | 404 canonical_scope = NULL; |
402 } | 405 } |
403 }; | 406 }; |
404 | 407 |
405 } // namespace internal | 408 } // namespace internal |
406 } // namespace v8 | 409 } // namespace v8 |
407 | 410 |
408 #endif // V8_HANDLES_H_ | 411 #endif // V8_HANDLES_H_ |
OLD | NEW |