Chromium Code Reviews| Index: test/cctest/test-heap-profiler.cc |
| diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc |
| index 87119b8571394118af54f9e48b6124faad2ca70d..e2ff9b2412fed342fd40a7f13f690cc6442238e9 100644 |
| --- a/test/cctest/test-heap-profiler.cc |
| +++ b/test/cctest/test-heap-profiler.cc |
| @@ -2872,7 +2872,6 @@ static const v8::AllocationProfile::Node* FindAllocationProfileNode( |
| return node; |
| } |
| - |
| TEST(SamplingHeapProfiler) { |
| v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| LocalContext env; |
| @@ -2895,6 +2894,11 @@ TEST(SamplingHeapProfiler) { |
| "}\n" |
| "foo();"; |
| + const char* gced = |
|
ofrobots
2016/03/30 22:35:35
Use a more descriptive name or, better, inline the
mattloring
2016/03/30 23:55:09
Done.
|
| + "for (var i = 0; i < 1024; i++) {\n" |
| + " eval(\"new Array(100)\");\n" |
| + "}\n"; |
| + |
| // Sample should be empty if requested before sampling has started. |
| { |
| v8::AllocationProfile* profile = heap_profiler->GetAllocationProfile(); |
| @@ -2985,6 +2989,20 @@ TEST(SamplingHeapProfiler) { |
| heap_profiler->StopSamplingHeapProfiler(); |
| } |
| + |
| + // A test case with scripts unloaded before profile gathered |
| + { |
| + heap_profiler->StartSamplingHeapProfiler(64); |
| + CompileRun(gced); |
| + |
| + CcTest::heap()->CollectAllGarbage(); |
| + |
| + v8::base::SmartPointer<v8::AllocationProfile> profile( |
| + heap_profiler->GetAllocationProfile()); |
| + CHECK(!profile.is_empty()); |
| + |
| + heap_profiler->StopSamplingHeapProfiler(); |
| + } |
| } |