Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index f808d1060cf4a4b7c00b5a6b47685742bcd76e6b..bc2681bc87717e406d5d54beaadfe244e5d04c23 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -12446,29 +12446,30 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugReferencedBy) { |
// Get the number of referencing objects. |
int count; |
- HeapIterator heap_iterator; |
+ Heap* heap = isolate->heap(); |
+ HeapIterator heap_iterator(heap); |
count = DebugReferencedBy(&heap_iterator, |
target, instance_filter, max_references, |
NULL, 0, arguments_function); |
// Allocate an array to hold the result. |
Object* object; |
- { MaybeObject* maybe_object = isolate->heap()->AllocateFixedArray(count); |
+ { MaybeObject* maybe_object = heap->AllocateFixedArray(count); |
if (!maybe_object->ToObject(&object)) return maybe_object; |
} |
FixedArray* instances = FixedArray::cast(object); |
// Fill the referencing objects. |
// AllocateFixedArray above does not make the heap non-iterable. |
- ASSERT(HEAP->IsHeapIterable()); |
- HeapIterator heap_iterator2; |
+ ASSERT(heap->IsHeapIterable()); |
+ HeapIterator heap_iterator2(heap); |
count = DebugReferencedBy(&heap_iterator2, |
target, instance_filter, max_references, |
instances, count, arguments_function); |
// Return result as JS array. |
Object* result; |
- MaybeObject* maybe_result = isolate->heap()->AllocateJSObject( |
+ MaybeObject* maybe_result = heap->AllocateJSObject( |
isolate->context()->native_context()->array_function()); |
if (!maybe_result->ToObject(&result)) return maybe_result; |
return JSArray::cast(result)->SetContent(instances); |
@@ -12514,8 +12515,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugConstructedBy) { |
ASSERT(args.length() == 2); |
// First perform a full GC in order to avoid dead objects. |
- isolate->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
- "%DebugConstructedBy"); |
+ Heap* heap = isolate->heap(); |
+ heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, "%DebugConstructedBy"); |
// Check parameters. |
CONVERT_ARG_CHECKED(JSFunction, constructor, 0); |
@@ -12524,7 +12525,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugConstructedBy) { |
// Get the number of referencing objects. |
int count; |
- HeapIterator heap_iterator; |
+ HeapIterator heap_iterator(heap); |
count = DebugConstructedBy(&heap_iterator, |
constructor, |
max_references, |
@@ -12533,14 +12534,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugConstructedBy) { |
// Allocate an array to hold the result. |
Object* object; |
- { MaybeObject* maybe_object = isolate->heap()->AllocateFixedArray(count); |
+ { MaybeObject* maybe_object = heap->AllocateFixedArray(count); |
if (!maybe_object->ToObject(&object)) return maybe_object; |
} |
FixedArray* instances = FixedArray::cast(object); |
ASSERT(HEAP->IsHeapIterable()); |
// Fill the referencing objects. |
- HeapIterator heap_iterator2; |
+ HeapIterator heap_iterator2(heap); |
count = DebugConstructedBy(&heap_iterator2, |
constructor, |
max_references, |
@@ -12550,7 +12551,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugConstructedBy) { |
// Return result as JS array. |
Object* result; |
{ MaybeObject* maybe_result = isolate->heap()->AllocateJSObject( |
- isolate->context()->native_context()->array_function()); |
+ isolate->context()->native_context()->array_function()); |
if (!maybe_result->ToObject(&result)) return maybe_result; |
} |
return JSArray::cast(result)->SetContent(instances); |
@@ -12677,19 +12678,20 @@ RUNTIME_FUNCTION(MaybeObject*, |
Handle<FixedArray> array; |
array = isolate->factory()->NewFixedArray(kBufferSize); |
int number; |
+ Heap* heap = isolate->heap(); |
{ |
- isolate->heap()->EnsureHeapIsIterable(); |
+ heap->EnsureHeapIsIterable(); |
AssertNoAllocation no_allocations; |
- HeapIterator heap_iterator; |
+ HeapIterator heap_iterator(heap); |
Script* scr = *script; |
FixedArray* arr = *array; |
number = FindSharedFunctionInfosForScript(&heap_iterator, scr, arr); |
} |
if (number > kBufferSize) { |
array = isolate->factory()->NewFixedArray(number); |
- isolate->heap()->EnsureHeapIsIterable(); |
+ heap->EnsureHeapIsIterable(); |
AssertNoAllocation no_allocations; |
- HeapIterator heap_iterator; |
+ HeapIterator heap_iterator(heap); |
Script* scr = *script; |
FixedArray* arr = *array; |
FindSharedFunctionInfosForScript(&heap_iterator, scr, arr); |
@@ -13026,9 +13028,10 @@ static Handle<Object> Runtime_GetScriptFromScriptName( |
// Scan the heap for Script objects to find the script with the requested |
// script data. |
Handle<Script> script; |
- script_name->GetHeap()->EnsureHeapIsIterable(); |
+ Heap* heap = script_name->GetHeap(); |
+ heap->EnsureHeapIsIterable(); |
AssertNoAllocation no_allocation_during_heap_iteration; |
- HeapIterator iterator; |
+ HeapIterator iterator(heap); |
HeapObject* obj = NULL; |
while (script.is_null() && ((obj = iterator.next()) != NULL)) { |
// If a script is found check if it has the script data requested. |