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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 | 46 |
47 template<typename T> | 47 template<typename T> |
48 Handle<T>::Handle(T* obj, Isolate* isolate) { | 48 Handle<T>::Handle(T* obj, Isolate* isolate) { |
49 ASSERT(!obj->IsFailure()); | 49 ASSERT(!obj->IsFailure()); |
50 location_ = HandleScope::CreateHandle(isolate, obj); | 50 location_ = HandleScope::CreateHandle(isolate, obj); |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 template <typename T> | 54 template <typename T> |
55 inline bool Handle<T>::is_identical_to(const Handle<T> other) const { | 55 inline bool Handle<T>::is_identical_to(const Handle<T> o) const { |
56 ASSERT(location_ == NULL || !(*location_)->IsFailure()); | 56 ASSERT(location_ == NULL || !(*location_)->IsFailure()); |
57 if (location_ == other.location_) return true; | |
58 if (location_ == NULL || other.location_ == NULL) return false; | |
59 // Dereferencing deferred handles to check object equality is safe. | 57 // Dereferencing deferred handles to check object equality is safe. |
60 SLOW_ASSERT(IsDereferenceAllowed(NO_DEFERRED_CHECK) && | 58 SLOW_ASSERT( |
61 other.IsDereferenceAllowed(NO_DEFERRED_CHECK)); | 59 (location_ == NULL || IsDereferenceAllowed(NO_DEFERRED_CHECK)) && |
62 return *location_ == *other.location_; | 60 (o.location_ == NULL || o.IsDereferenceAllowed(NO_DEFERRED_CHECK))); |
| 61 if (location_ == o.location_) return true; |
| 62 if (location_ == NULL || o.location_ == NULL) return false; |
| 63 return *location_ == *o.location_; |
63 } | 64 } |
64 | 65 |
65 | 66 |
66 template <typename T> | 67 template <typename T> |
67 inline T* Handle<T>::operator*() const { | 68 inline T* Handle<T>::operator*() const { |
68 ASSERT(location_ != NULL && !(*location_)->IsFailure()); | 69 ASSERT(location_ != NULL && !(*location_)->IsFailure()); |
69 SLOW_ASSERT(IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); | 70 SLOW_ASSERT(IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); |
70 return *BitCast<T**>(location_); | 71 return *BitCast<T**>(location_); |
71 } | 72 } |
72 | 73 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 current->level = level_; | 202 current->level = level_; |
202 ASSERT_EQ(current->next, current->limit); | 203 ASSERT_EQ(current->next, current->limit); |
203 current->limit = limit_; | 204 current->limit = limit_; |
204 } | 205 } |
205 | 206 |
206 #endif | 207 #endif |
207 | 208 |
208 } } // namespace v8::internal | 209 } } // namespace v8::internal |
209 | 210 |
210 #endif // V8_HANDLES_INL_H_ | 211 #endif // V8_HANDLES_INL_H_ |
OLD | NEW |