Merge V8 at branches/3.2 r8200: Initial merge by Git
Change-Id: I5c434306e98132997e9c5f6024b6ce200b255edf
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc
index 749ac15..17611ac 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -238,6 +238,49 @@
}
+// http://code.google.com/p/v8/issues/detail?id=1398
+// Long stacks (exceeding max frames limit) must not be erased.
+TEST(Issue1398) {
+ TestSetup test_setup;
+ CpuProfilesCollection profiles;
+ profiles.StartProfiling("", 1);
+ ProfileGenerator generator(&profiles);
+ ProfilerEventsProcessor processor(i::Isolate::Current(), &generator);
+ processor.Start();
+ while (!processor.running()) {
+ i::Thread::YieldCPU();
+ }
+
+ processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
+ "bbb",
+ ToAddress(0x1200),
+ 0x80);
+
+ i::TickSample* sample = processor.TickSampleEvent();
+ sample->pc = ToAddress(0x1200);
+ sample->tos = 0;
+ sample->frames_count = i::TickSample::kMaxFramesCount;
+ for (int i = 0; i < sample->frames_count; ++i) {
+ sample->stack[i] = ToAddress(0x1200);
+ }
+
+ processor.Stop();
+ processor.Join();
+ CpuProfile* profile =
+ profiles.StopProfiling(TokenEnumerator::kNoSecurityToken, "", 1);
+ CHECK_NE(NULL, profile);
+
+ int actual_depth = 0;
+ const ProfileNode* node = profile->top_down()->root();
+ while (node->children()->length() > 0) {
+ node = node->children()->last();
+ ++actual_depth;
+ }
+
+ CHECK_EQ(1 + i::TickSample::kMaxFramesCount, actual_depth); // +1 for PC.
+}
+
+
TEST(DeleteAllCpuProfiles) {
InitializeVM();
TestSetup test_setup;