Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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> other) 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(IsDereferenceAllowed(NO_DEFERRED_CHECK) && |
| 61 other.IsDereferenceAllowed(NO_DEFERRED_CHECK)); | 59 other.IsDereferenceAllowed(NO_DEFERRED_CHECK)); |
| 60 if (location_ == other.location_) return true; | |
| 61 if (location_ == NULL || other.location_ == NULL) return false; | |
|
Hannes Payer (out of office)
2014/03/27 17:16:20
I guess you moved that code to have the asserts in
Yang
2014/03/28 08:27:40
Yes. This is to tighten the assertion.
| |
| 62 return *location_ == *other.location_; | 62 return *location_ == *other.location_; |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 template <typename T> | 66 template <typename T> |
| 67 inline T* Handle<T>::operator*() const { | 67 inline T* Handle<T>::operator*() const { |
| 68 ASSERT(location_ != NULL && !(*location_)->IsFailure()); | 68 ASSERT(location_ != NULL && !(*location_)->IsFailure()); |
| 69 SLOW_ASSERT(IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); | 69 SLOW_ASSERT(IsDereferenceAllowed(INCLUDE_DEFERRED_CHECK)); |
| 70 return *BitCast<T**>(location_); | 70 return *BitCast<T**>(location_); |
| 71 } | 71 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 current->level = level_; | 201 current->level = level_; |
| 202 ASSERT_EQ(current->next, current->limit); | 202 ASSERT_EQ(current->next, current->limit); |
| 203 current->limit = limit_; | 203 current->limit = limit_; |
| 204 } | 204 } |
| 205 | 205 |
| 206 #endif | 206 #endif |
| 207 | 207 |
| 208 } } // namespace v8::internal | 208 } } // namespace v8::internal |
| 209 | 209 |
| 210 #endif // V8_HANDLES_INL_H_ | 210 #endif // V8_HANDLES_INL_H_ |
| OLD | NEW |