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 eeb722c7fb5e405544be8c363dc21fa3bb6c5827..914c1f987dbdb3edc77953d6699052523b8d022b 100644 |
| --- a/test/cctest/test-heap-profiler.cc |
| +++ b/test/cctest/test-heap-profiler.cc |
| @@ -3040,3 +3040,26 @@ TEST(SamplingHeapProfilerApiAllocation) { |
| heap_profiler->StopSamplingHeapProfiler(); |
| } |
| + |
| +TEST(SamplingHeapProfilerLeftTrimming) { |
| + v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| + LocalContext env; |
| + v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); |
| + |
| + // Suppress randomness to avoid flakiness in tests. |
| + v8::internal::FLAG_sampling_heap_profiler_suppress_randomness = true; |
| + |
| + heap_profiler->StartSamplingHeapProfiler(64); |
| + |
| + CompileRun( |
| + "for (var j = 0; j < 30000; ++j) {\n" |
| + " var a = [];\n" |
| + " for (var i = 0; i < 5; ++i)\n" |
| + " a[i] = i;\n" |
| + " for (var i = 0; i < 3; ++i)\n" |
| + " a.shift();\n" |
| + "}\n"); |
| + // Should not crash. |
|
Hannes Payer (out of office)
2016/04/13 13:32:29
Don't you need to call GC to crash? Why does it cr
|
| + |
| + heap_profiler->StopSamplingHeapProfiler(); |
| +} |