| 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 "src/objects.h" | 8 #include "src/objects.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 INLINE(void Assert() const) { DCHECK(location_ != NULL); } | 47 INLINE(void Assert() const) { DCHECK(location_ != NULL); } |
| 48 INLINE(void Check() const) { CHECK(location_ != NULL); } | 48 INLINE(void Check() const) { CHECK(location_ != NULL); } |
| 49 | 49 |
| 50 INLINE(Handle<T> ToHandleChecked()) const { | 50 INLINE(Handle<T> ToHandleChecked()) const { |
| 51 Check(); | 51 Check(); |
| 52 return Handle<T>(location_); | 52 return Handle<T>(location_); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Convert to a Handle with a type that can be upcasted to. | 55 // Convert to a Handle with a type that can be upcasted to. |
| 56 template <class S> INLINE(bool ToHandle(Handle<S>* out)) { | 56 template <class S> |
| 57 V8_INLINE bool ToHandle(Handle<S>* out) const { |
| 57 if (location_ == NULL) { | 58 if (location_ == NULL) { |
| 58 *out = Handle<T>::null(); | 59 *out = Handle<T>::null(); |
| 59 return false; | 60 return false; |
| 60 } else { | 61 } else { |
| 61 *out = Handle<T>(location_); | 62 *out = Handle<T>(location_); |
| 62 return true; | 63 return true; |
| 63 } | 64 } |
| 64 } | 65 } |
| 65 | 66 |
| 66 bool is_null() const { return location_ == NULL; } | 67 bool is_null() const { return location_ == NULL; } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 289 |
| 289 void Initialize() { | 290 void Initialize() { |
| 290 next = limit = NULL; | 291 next = limit = NULL; |
| 291 level = 0; | 292 level = 0; |
| 292 } | 293 } |
| 293 }; | 294 }; |
| 294 | 295 |
| 295 } } // namespace v8::internal | 296 } } // namespace v8::internal |
| 296 | 297 |
| 297 #endif // V8_HANDLES_H_ | 298 #endif // V8_HANDLES_H_ |
| OLD | NEW |