Index: test/cctest/test-profile-generator.cc |
diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc |
index ea477de661b788e48a6ffa91251f6bd0b496de1d..b36220284f29279c909c7498b2afa267ca267d30 100644 |
--- a/test/cctest/test-profile-generator.cc |
+++ b/test/cctest/test-profile-generator.cc |
@@ -775,4 +775,21 @@ TEST(RecordStackTraceAtStartProfiling) { |
CHECK_EQ(0, current->children()->length()); |
} |
+ |
+TEST(Issue51919) { |
+ CpuProfilesCollection collection; |
+ i::EmbeddedVector<char*, |
+ CpuProfilesCollection::kMaxSimultaneousProfiles> titles; |
+ for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) { |
+ i::Vector<char> title = i::Vector<char>::New(16); |
+ i::OS::SNPrintF(title, "%d", i); |
+ CHECK(collection.StartProfiling(title.start(), i + 1)); // UID must be > 0. |
+ titles[i] = title.start(); |
+ } |
+ CHECK(!collection.StartProfiling( |
+ "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1)); |
+ for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) |
+ i::DeleteArray(titles[i]); |
+} |
+ |
#endif // ENABLE_LOGGING_AND_PROFILING |