Index: src/debug.cc |
diff --git a/src/debug.cc b/src/debug.cc |
index a994eb008511c44574ade6986d6463ea53f1c70e..9a9d737ed638d37b33c55bb6449f784226b97e68 100644 |
--- a/src/debug.cc |
+++ b/src/debug.cc |
@@ -2048,6 +2048,7 @@ void Debug::PrepareForBreakPoints() { |
Heap* heap = isolate_->heap(); |
heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
"preparing for breakpoints"); |
+ HeapIterator iterator(heap); |
// Ensure no GC in this scope as we are going to use gc_metadata |
// field in the Code object to mark active functions. |
@@ -2067,7 +2068,6 @@ void Debug::PrepareForBreakPoints() { |
// Scan the heap for all non-optimized functions which have no |
// debug break slots and are not active or inlined into an active |
// function and mark them for lazy compilation. |
- HeapIterator iterator(heap); |
HeapObject* obj = NULL; |
while (((obj = iterator.next()) != NULL)) { |
if (obj->IsJSFunction()) { |
@@ -2192,9 +2192,7 @@ Object* Debug::FindSharedFunctionInfoInScript(Handle<Script> script, |
Handle<SharedFunctionInfo> target; |
Heap* heap = isolate_->heap(); |
while (!done) { |
- { // Extra scope for iterator and no-allocation. |
- heap->EnsureHeapIsIterable(); |
- DisallowHeapAllocation no_alloc_during_heap_iteration; |
+ { // Extra scope for iterator. |
HeapIterator iterator(heap); |
for (HeapObject* obj = iterator.next(); |
obj != NULL; obj = iterator.next()) { |
@@ -2524,8 +2522,6 @@ void Debug::CreateScriptCache() { |
// scripts which are no longer referenced. The second also sweeps precisely, |
// which saves us doing yet another GC to make the heap iterable. |
heap->CollectAllGarbage(Heap::kNoGCFlags, "Debug::CreateScriptCache"); |
- heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
- "Debug::CreateScriptCache"); |
ASSERT(script_cache_ == NULL); |
script_cache_ = new ScriptCache(isolate_); |
@@ -2533,7 +2529,6 @@ void Debug::CreateScriptCache() { |
// Scan heap for Script objects. |
int count = 0; |
HeapIterator iterator(heap); |
- DisallowHeapAllocation no_allocation; |
for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
if (obj->IsScript() && Script::cast(obj)->HasValidSource()) { |