Chromium Code Reviews| Index: test/cctest/test-cpu-profiler.cc |
| diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc |
| index 43fb074f68c3db0ccdf13fb60d30f05db7388e9d..760dc37e3535f3452c5dd64dc26baadbfbfb8781 100644 |
| --- a/test/cctest/test-cpu-profiler.cc |
| +++ b/test/cctest/test-cpu-profiler.cc |
| @@ -48,10 +48,10 @@ using i::Vector; |
| TEST(StartStop) { |
| CpuProfilesCollection profiles; |
| ProfileGenerator generator(&profiles); |
| - ProfilerEventsProcessor processor(&generator); |
| - processor.Start(); |
| - processor.StopSynchronously(); |
| - processor.Join(); |
| + ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(&generator); |
| + processor->Start(); |
| + processor->StopSynchronously(); |
| + delete processor; |
|
Jakob Kummerow
2013/08/23 10:25:39
You could use SmartPointer<ProfilerEventsProcessor
|
| } |
| @@ -140,9 +140,9 @@ TEST(CodeEvents) { |
| CpuProfilesCollection* profiles = new CpuProfilesCollection; |
| profiles->StartProfiling("", 1, false); |
| ProfileGenerator generator(profiles); |
| - ProfilerEventsProcessor processor(&generator); |
| - processor.Start(); |
| - CpuProfiler profiler(isolate, profiles, &generator, &processor); |
| + ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(&generator); |
| + processor->Start(); |
| + CpuProfiler profiler(isolate, profiles, &generator, processor); |
| // Enqueue code creation events. |
| const char* aaa_str = "aaa"; |
| @@ -157,10 +157,9 @@ TEST(CodeEvents) { |
| profiler.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); |
| // Enqueue a tick event to enable code events processing. |
| - EnqueueTickSampleEvent(&processor, aaa_code->address()); |
| + EnqueueTickSampleEvent(processor, aaa_code->address()); |
| - processor.StopSynchronously(); |
| - processor.Join(); |
| + processor->StopSynchronously(); |
| // Check the state of profile generator. |
| CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address()); |
| @@ -180,6 +179,8 @@ TEST(CodeEvents) { |
| CodeEntry* comment2 = generator.code_map()->FindEntry(moved_code->address()); |
| CHECK_NE(NULL, comment2); |
| CHECK_EQ("comment2", comment2->name()); |
| + |
| + delete processor; |
| } |
| @@ -202,27 +203,26 @@ TEST(TickEvents) { |
| CpuProfilesCollection* profiles = new CpuProfilesCollection; |
| profiles->StartProfiling("", 1, false); |
| ProfileGenerator generator(profiles); |
| - ProfilerEventsProcessor processor(&generator); |
| - processor.Start(); |
| - CpuProfiler profiler(isolate, profiles, &generator, &processor); |
| + ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(&generator); |
| + processor->Start(); |
| + CpuProfiler profiler(isolate, profiles, &generator, processor); |
| profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); |
| profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); |
| profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); |
| - EnqueueTickSampleEvent(&processor, frame1_code->instruction_start()); |
| + EnqueueTickSampleEvent(processor, frame1_code->instruction_start()); |
| EnqueueTickSampleEvent( |
| - &processor, |
| + processor, |
| frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, |
| frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); |
| EnqueueTickSampleEvent( |
| - &processor, |
| + processor, |
| frame3_code->instruction_end() - 1, |
| frame2_code->instruction_end() - 1, |
| frame1_code->instruction_end() - 1); |
| - processor.StopSynchronously(); |
| - processor.Join(); |
| + processor->StopSynchronously(); |
| CpuProfile* profile = profiles->StopProfiling(""); |
| CHECK_NE(NULL, profile); |
| @@ -242,6 +242,8 @@ TEST(TickEvents) { |
| const i::List<ProfileNode*>* top_down_ddd_children = |
| top_down_stub_children->last()->children(); |
| CHECK_EQ(0, top_down_ddd_children->length()); |
| + |
| + delete processor; |
| } |
| @@ -271,23 +273,22 @@ TEST(Issue1398) { |
| CpuProfilesCollection* profiles = new CpuProfilesCollection; |
| profiles->StartProfiling("", 1, false); |
| ProfileGenerator generator(profiles); |
| - ProfilerEventsProcessor processor(&generator); |
| - processor.Start(); |
| - CpuProfiler profiler(isolate, profiles, &generator, &processor); |
| + ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(&generator); |
| + processor->Start(); |
| + CpuProfiler profiler(isolate, profiles, &generator, processor); |
| profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); |
| - i::TickSample* sample = processor.StartTickSample(); |
| + i::TickSample* sample = processor->StartTickSample(); |
| sample->pc = code->address(); |
| sample->tos = 0; |
| sample->frames_count = i::TickSample::kMaxFramesCount; |
| for (int i = 0; i < sample->frames_count; ++i) { |
| sample->stack[i] = code->address(); |
| } |
| - processor.FinishTickSample(); |
| + processor->FinishTickSample(); |
| - processor.StopSynchronously(); |
| - processor.Join(); |
| + processor->StopSynchronously(); |
| CpuProfile* profile = profiles->StopProfiling(""); |
| CHECK_NE(NULL, profile); |
| @@ -299,6 +300,7 @@ TEST(Issue1398) { |
| } |
| CHECK_EQ(1 + i::TickSample::kMaxFramesCount, actual_depth); // +1 for PC. |
| + delete processor; |
| } |