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 26 matching lines...) Expand all Loading... |
37 template <class S> MaybeHandle(MaybeHandle<S> maybe_handle) { | 37 template <class S> MaybeHandle(MaybeHandle<S> maybe_handle) { |
38 #ifdef DEBUG | 38 #ifdef DEBUG |
39 T* a = NULL; | 39 T* a = NULL; |
40 S* b = NULL; | 40 S* b = NULL; |
41 a = b; // Fake assignment to enforce type checks. | 41 a = b; // Fake assignment to enforce type checks. |
42 USE(a); | 42 USE(a); |
43 #endif | 43 #endif |
44 location_ = reinterpret_cast<T**>(maybe_handle.location_); | 44 location_ = reinterpret_cast<T**>(maybe_handle.location_); |
45 } | 45 } |
46 | 46 |
47 INLINE(void Assert() const) { ASSERT(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> INLINE(bool ToHandle(Handle<S>* out)) { |
57 if (location_ == NULL) { | 57 if (location_ == NULL) { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 void Initialize() { | 289 void Initialize() { |
290 next = limit = NULL; | 290 next = limit = NULL; |
291 level = 0; | 291 level = 0; |
292 } | 292 } |
293 }; | 293 }; |
294 | 294 |
295 } } // namespace v8::internal | 295 } } // namespace v8::internal |
296 | 296 |
297 #endif // V8_HANDLES_H_ | 297 #endif // V8_HANDLES_H_ |
OLD | NEW |