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

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

Issue 1846723002: Gracefully handle unloaded scripts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
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();
+ }
}
« src/profiler/sampling-heap-profiler.cc ('K') | « src/profiler/sampling-heap-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698