Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Unified Diff: src/handles-inl.h

Issue 23578022: Make handle dereference check more precise. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles-inl.h
diff --git a/src/handles-inl.h b/src/handles-inl.h
index 4f4490b75bfa97d2c0aa0d0e03b3833f3a19c8fb..5b879d8f088e2491669095c628586299f8781f20 100644
--- a/src/handles-inl.h
+++ b/src/handles-inl.h
@@ -32,6 +32,7 @@
#include "api.h"
#include "apiutils.h"
#include "handles.h"
+#include "heap.h"
#include "isolate.h"
namespace v8 {
@@ -85,11 +86,13 @@ 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();
+ Heap* heap = heap_object->GetHeap();
Object** handle = reinterpret_cast<Object**>(location_);
- Object** roots_array_start = isolate->heap()->roots_array_start();
+ Object** roots_array_start = heap->roots_array_start();
if (roots_array_start <= handle &&
- handle < roots_array_start + Heap::kStrongRootListLength) {
+ handle < roots_array_start + Heap::kStrongRootListLength &&
+ heap->RootCanBeTreatedAsConstant(
+ static_cast<Heap::RootListIndex>(handle - roots_array_start))) {
return true;
}
if (!AllowHandleDereference::IsAllowed()) return false;
@@ -98,7 +101,7 @@ bool Handle<T>::IsDereferenceAllowed(DereferenceCheckMode mode) const {
// 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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698