Index: src/debug.cc |
=================================================================== |
--- src/debug.cc (revision 7216) |
+++ src/debug.cc (working copy) |
@@ -1875,9 +1875,10 @@ |
// Perform two GCs to get rid of all unreferenced scripts. The first GC gets |
// rid of all the cached script wrappers and the second gets rid of the |
- // scripts which are no longer referenced. |
- Heap::CollectAllGarbage(false); |
- Heap::CollectAllGarbage(false); |
+ // 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); |
+ Heap::CollectAllGarbage(Heap::kMakeHeapIterableMask); |
ASSERT(script_cache_ == NULL); |
script_cache_ = new ScriptCache(); |
@@ -1885,7 +1886,7 @@ |
// Scan heap for Script objects. |
int count = 0; |
HeapIterator iterator; |
- for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
+ for (HeapObject* obj = iterator.Next(); obj != NULL; obj = iterator.Next()) { |
if (obj->IsScript() && Script::cast(obj)->HasValidSource()) { |
script_cache_->Add(Handle<Script>(Script::cast(obj))); |
count++; |
@@ -1925,7 +1926,7 @@ |
// Perform GC to get unreferenced scripts evicted from the cache before |
// returning the content. |
- Heap::CollectAllGarbage(false); |
+ Heap::CollectAllGarbage(Heap::kNoGCFlags); |
// Get the scripts from the cache. |
return script_cache_->GetScripts(); |