Index: test/cctest/test-api.cc |
=================================================================== |
--- test/cctest/test-api.cc (revision 1003) |
+++ test/cctest/test-api.cc (working copy) |
@@ -5094,7 +5094,13 @@ |
static int GetSurvivingGlobalObjectsCount() { |
int count = 0; |
+ // 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 |
+ // been marked at that point. Therefore some of the maps are not |
+ // collected until the second garbage collection. |
v8::internal::Heap::CollectAllGarbage(); |
+ v8::internal::Heap::CollectAllGarbage(); |
v8::internal::HeapIterator it; |
while (it.has_next()) { |
v8::internal::HeapObject* object = it.next(); |
@@ -5114,10 +5120,6 @@ |
v8::V8::Initialize(); |
- // TODO(121): when running "cctest test-api", the initial count is 2, |
- // after second GC, the counter drops to 1. Needs to figure out why |
- // one GC is not enough to collect all garbage. |
- GetSurvivingGlobalObjectsCount(); |
int count = GetSurvivingGlobalObjectsCount(); |
for (int i = 0; i < 5; i++) { |