Index: test/cctest/test-api.cc |
=================================================================== |
--- test/cctest/test-api.cc (revision 3683) |
+++ test/cctest/test-api.cc (working copy) |
@@ -6236,8 +6236,16 @@ |
} |
-static int GetSurvivingGlobalObjectsCount() { |
+static int GetGlobalObjectsCount() { |
int count = 0; |
+ v8::internal::HeapIterator it; |
+ for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) |
+ if (object->IsJSGlobalObject()) count++; |
+ return count; |
+} |
+ |
+ |
+static int GetSurvivingGlobalObjectsCount() { |
// We need to collect all garbage twice to be sure that everything |
// has been collected. This is because inline caches are cleared in |
// the first garbage collection but some of the maps have already |
@@ -6245,13 +6253,7 @@ |
// collected until the second garbage collection. |
v8::internal::Heap::CollectAllGarbage(false); |
v8::internal::Heap::CollectAllGarbage(false); |
- v8::internal::HeapIterator it; |
- while (it.has_next()) { |
- v8::internal::HeapObject* object = it.next(); |
- if (object->IsJSGlobalObject()) { |
- count++; |
- } |
- } |
+ int count = GetGlobalObjectsCount(); |
#ifdef DEBUG |
if (count > 0) v8::internal::Heap::TracePathToGlobal(); |
#endif |
@@ -8621,17 +8623,6 @@ |
} |
-static int GetGlobalObjectsCount() { |
- int count = 0; |
- v8::internal::HeapIterator it; |
- while (it.has_next()) { |
- v8::internal::HeapObject* object = it.next(); |
- if (object->IsJSGlobalObject()) count++; |
- } |
- return count; |
-} |
- |
- |
TEST(Regress528) { |
v8::V8::Initialize(); |