OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 | 5 |
6 #ifndef V8_HANDLES_INL_H_ | 6 #ifndef V8_HANDLES_INL_H_ |
7 #define V8_HANDLES_INL_H_ | 7 #define V8_HANDLES_INL_H_ |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/handles.h" | 10 #include "src/handles.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 (o.location_ == NULL || o.IsDereferenceAllowed(NO_DEFERRED_CHECK))); | 34 (o.location_ == NULL || o.IsDereferenceAllowed(NO_DEFERRED_CHECK))); |
35 if (location_ == o.location_) return true; | 35 if (location_ == o.location_) return true; |
36 if (location_ == NULL || o.location_ == NULL) return false; | 36 if (location_ == NULL || o.location_ == NULL) return false; |
37 return *location_ == *o.location_; | 37 return *location_ == *o.location_; |
38 } | 38 } |
39 | 39 |
40 | 40 |
41 template <typename T> | 41 template <typename T> |
42 inline T* Handle<T>::operator*() const { | 42 inline T* Handle<T>::operator*() const { |
43 SLOW_DCHECK(IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); | 43 SLOW_DCHECK(IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); |
44 return *BitCast<T**>(location_); | 44 return *bit_cast<T**>(location_); |
45 } | 45 } |
46 | 46 |
47 template <typename T> | 47 template <typename T> |
48 inline T** Handle<T>::location() const { | 48 inline T** Handle<T>::location() const { |
49 SLOW_DCHECK(location_ == NULL || | 49 SLOW_DCHECK(location_ == NULL || |
50 IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); | 50 IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); |
51 return location_; | 51 return location_; |
52 } | 52 } |
53 | 53 |
54 #ifdef DEBUG | 54 #ifdef DEBUG |
55 template <typename T> | 55 template <typename T> |
56 bool Handle<T>::IsDereferenceAllowed(DereferenceCheckMode mode) const { | 56 bool Handle<T>::IsDereferenceAllowed(DereferenceCheckMode mode) const { |
57 DCHECK(location_ != NULL); | 57 DCHECK(location_ != NULL); |
58 Object* object = *BitCast<T**>(location_); | 58 Object* object = *bit_cast<T**>(location_); |
59 if (object->IsSmi()) return true; | 59 if (object->IsSmi()) return true; |
60 HeapObject* heap_object = HeapObject::cast(object); | 60 HeapObject* heap_object = HeapObject::cast(object); |
61 Heap* heap = heap_object->GetHeap(); | 61 Heap* heap = heap_object->GetHeap(); |
62 Object** handle = reinterpret_cast<Object**>(location_); | 62 Object** handle = reinterpret_cast<Object**>(location_); |
63 Object** roots_array_start = heap->roots_array_start(); | 63 Object** roots_array_start = heap->roots_array_start(); |
64 if (roots_array_start <= handle && | 64 if (roots_array_start <= handle && |
65 handle < roots_array_start + Heap::kStrongRootListLength && | 65 handle < roots_array_start + Heap::kStrongRootListLength && |
66 heap->RootCanBeTreatedAsConstant( | 66 heap->RootCanBeTreatedAsConstant( |
67 static_cast<Heap::RootListIndex>(handle - roots_array_start))) { | 67 static_cast<Heap::RootListIndex>(handle - roots_array_start))) { |
68 return true; | 68 return true; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 current->level = level_; | 174 current->level = level_; |
175 DCHECK_EQ(current->next, current->limit); | 175 DCHECK_EQ(current->next, current->limit); |
176 current->limit = limit_; | 176 current->limit = limit_; |
177 } | 177 } |
178 | 178 |
179 #endif | 179 #endif |
180 | 180 |
181 } } // namespace v8::internal | 181 } } // namespace v8::internal |
182 | 182 |
183 #endif // V8_HANDLES_INL_H_ | 183 #endif // V8_HANDLES_INL_H_ |
OLD | NEW |