Chromium Code Reviews| Index: test/cctest/test-heap.cc |
| diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc |
| index cb08fb4c04ee7841593c525589c918e7d5c8df25..d8c89aec1b4b242a9702c3a018681bdb9b2569bc 100644 |
| --- a/test/cctest/test-heap.cc |
| +++ b/test/cctest/test-heap.cc |
| @@ -3203,6 +3203,31 @@ TEST(ReleaseOverReservedPages) { |
| CHECK_EQ(1, old_space->CountTotalPages()); |
| } |
| +static int forced_gc_counter = 0; |
| + |
| +void MockUseCounterCallback(v8::Isolate* isolate, |
| + v8::Isolate::UseCounterFeature feature) { |
| + isolate->GetCallingContext(); |
| + if (feature == v8::Isolate::kForcedGC) { |
| + forced_gc_counter++; |
| + } |
| +} |
| + |
| + |
| +TEST(CountForcedGC) { |
| + i::FLAG_expose_gc = true; |
| + CcTest::InitializeVM(); |
| + Isolate* isolate = CcTest::i_isolate(); |
| + v8::HandleScope scope(CcTest::isolate()); |
| + |
| + isolate->SetUseCounterCallback(MockUseCounterCallback); |
| + |
| + forced_gc_counter = 0; |
| + const char* source = "gc();"; |
| + CompileRun(source); |
| + CHECK_GT(forced_gc_counter, 0); |
|
Jakob Kummerow
2015/05/11 08:27:37
Why so conservative? Can this ever be != 1, and st
Erik Corry
2015/05/11 09:56:12
An emergency out-of-memory GC is also implemented
|
| +} |
| + |
| TEST(Regress2237) { |
| i::FLAG_stress_compaction = false; |