Index: src/handles-inl.h |
diff --git a/src/handles-inl.h b/src/handles-inl.h |
index 4f4490b75bfa97d2c0aa0d0e03b3833f3a19c8fb..20a5e22a9c1befb12c46879dc36cc854fd51d25d 100644 |
--- a/src/handles-inl.h |
+++ b/src/handles-inl.h |
@@ -85,24 +85,20 @@ bool Handle<T>::IsDereferenceAllowed(DereferenceCheckMode mode) const { |
Object* object = *BitCast<T**>(location_); |
if (object->IsSmi()) return true; |
HeapObject* heap_object = HeapObject::cast(object); |
- Isolate* isolate = heap_object->GetIsolate(); |
- Object** handle = reinterpret_cast<Object**>(location_); |
- Object** roots_array_start = isolate->heap()->roots_array_start(); |
- if (roots_array_start <= handle && |
- handle < roots_array_start + Heap::kStrongRootListLength) { |
- return true; |
- } |
+ Heap* heap = heap_object->GetHeap(); |
+ Object** handle = reinterpret_cast<Object**>(location_);; |
+ if (heap->IsInRootsArray(handle)) return true; |
if (!AllowHandleDereference::IsAllowed()) return false; |
if (mode == INCLUDE_DEFERRED_CHECK && |
!AllowDeferredHandleDereference::IsAllowed()) { |
// Accessing maps and internalized strings is safe. |
if (heap_object->IsMap()) return true; |
if (heap_object->IsInternalizedString()) return true; |
- return !isolate->IsDeferredHandle(handle); |
+ return !heap->isolate()->IsDeferredHandle(handle); |
} |
return true; |
} |
-#endif |
+#endif // DEBUG |