Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: test/cctest/test-heap-profiler.cc

Issue 1918453002: Version 5.0.71.35 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.0
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/profiler/heap-profiler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2632593ec68282fbd88595a826e43372ad178fc7 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -3010,3 +3010,28 @@ 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 < 500; ++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");
+
+ CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
+ // Should not crash.
+
+ heap_profiler->StopSamplingHeapProfiler();
+}
« no previous file with comments | « src/profiler/heap-profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698