Commit 140ebd97 authored by yurys@chromium.org's avatar yurys@chromium.org

Fix crashes of some CPU profiler tests on Windows after r16284

All the tests that started crashing create ProfilerEventsProcessor on the stack. After r16284 SamplingCircularQueue buffer is allocated as a field of the queue instead of separate heap object. This increased self size of ProfilerEventsProcessor by about 1Mb. Windows malloc fails to allocate such an object on the stack and crashes.

BUG=
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/23093022

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16287 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 971df386
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "cpu-profiler-inl.h" #include "cpu-profiler-inl.h"
#include "cctest.h" #include "cctest.h"
#include "platform.h" #include "platform.h"
#include "smart-pointers.h"
#include "utils.h" #include "utils.h"
#include "../include/v8-profiler.h" #include "../include/v8-profiler.h"
using i::CodeEntry; using i::CodeEntry;
...@@ -42,16 +43,17 @@ using i::ProfileGenerator; ...@@ -42,16 +43,17 @@ using i::ProfileGenerator;
using i::ProfileNode; using i::ProfileNode;
using i::ProfilerEventsProcessor; using i::ProfilerEventsProcessor;
using i::ScopedVector; using i::ScopedVector;
using i::SmartPointer;
using i::Vector; using i::Vector;
TEST(StartStop) { TEST(StartStop) {
CpuProfilesCollection profiles; CpuProfilesCollection profiles;
ProfileGenerator generator(&profiles); ProfileGenerator generator(&profiles);
ProfilerEventsProcessor processor(&generator); SmartPointer<ProfilerEventsProcessor> processor(
processor.Start(); new ProfilerEventsProcessor(&generator));
processor.StopSynchronously(); processor->Start();
processor.Join(); processor->StopSynchronously();
} }
...@@ -140,9 +142,10 @@ TEST(CodeEvents) { ...@@ -140,9 +142,10 @@ TEST(CodeEvents) {
CpuProfilesCollection* profiles = new CpuProfilesCollection; CpuProfilesCollection* profiles = new CpuProfilesCollection;
profiles->StartProfiling("", 1, false); profiles->StartProfiling("", 1, false);
ProfileGenerator generator(profiles); ProfileGenerator generator(profiles);
ProfilerEventsProcessor processor(&generator); SmartPointer<ProfilerEventsProcessor> processor(
processor.Start(); new ProfilerEventsProcessor(&generator));
CpuProfiler profiler(isolate, profiles, &generator, &processor); processor->Start();
CpuProfiler profiler(isolate, profiles, &generator, *processor);
// Enqueue code creation events. // Enqueue code creation events.
const char* aaa_str = "aaa"; const char* aaa_str = "aaa";
...@@ -157,10 +160,9 @@ TEST(CodeEvents) { ...@@ -157,10 +160,9 @@ TEST(CodeEvents) {
profiler.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); profiler.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4);
// Enqueue a tick event to enable code events processing. // Enqueue a tick event to enable code events processing.
EnqueueTickSampleEvent(&processor, aaa_code->address()); EnqueueTickSampleEvent(*processor, aaa_code->address());
processor.StopSynchronously(); processor->StopSynchronously();
processor.Join();
// Check the state of profile generator. // Check the state of profile generator.
CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address()); CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address());
...@@ -202,27 +204,27 @@ TEST(TickEvents) { ...@@ -202,27 +204,27 @@ TEST(TickEvents) {
CpuProfilesCollection* profiles = new CpuProfilesCollection; CpuProfilesCollection* profiles = new CpuProfilesCollection;
profiles->StartProfiling("", 1, false); profiles->StartProfiling("", 1, false);
ProfileGenerator generator(profiles); ProfileGenerator generator(profiles);
ProfilerEventsProcessor processor(&generator); SmartPointer<ProfilerEventsProcessor> processor(
processor.Start(); new ProfilerEventsProcessor(&generator));
CpuProfiler profiler(isolate, profiles, &generator, &processor); processor->Start();
CpuProfiler profiler(isolate, profiles, &generator, *processor);
profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb"); profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb");
profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5); profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5);
profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd"); profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd");
EnqueueTickSampleEvent(&processor, frame1_code->instruction_start()); EnqueueTickSampleEvent(*processor, frame1_code->instruction_start());
EnqueueTickSampleEvent( EnqueueTickSampleEvent(
&processor, *processor,
frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2, frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2,
frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2); frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2);
EnqueueTickSampleEvent( EnqueueTickSampleEvent(
&processor, *processor,
frame3_code->instruction_end() - 1, frame3_code->instruction_end() - 1,
frame2_code->instruction_end() - 1, frame2_code->instruction_end() - 1,
frame1_code->instruction_end() - 1); frame1_code->instruction_end() - 1);
processor.StopSynchronously(); processor->StopSynchronously();
processor.Join();
CpuProfile* profile = profiles->StopProfiling(""); CpuProfile* profile = profiles->StopProfiling("");
CHECK_NE(NULL, profile); CHECK_NE(NULL, profile);
...@@ -271,23 +273,23 @@ TEST(Issue1398) { ...@@ -271,23 +273,23 @@ TEST(Issue1398) {
CpuProfilesCollection* profiles = new CpuProfilesCollection; CpuProfilesCollection* profiles = new CpuProfilesCollection;
profiles->StartProfiling("", 1, false); profiles->StartProfiling("", 1, false);
ProfileGenerator generator(profiles); ProfileGenerator generator(profiles);
ProfilerEventsProcessor processor(&generator); SmartPointer<ProfilerEventsProcessor> processor(
processor.Start(); new ProfilerEventsProcessor(&generator));
CpuProfiler profiler(isolate, profiles, &generator, &processor); processor->Start();
CpuProfiler profiler(isolate, profiles, &generator, *processor);
profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb"); profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb");
i::TickSample* sample = processor.StartTickSample(); i::TickSample* sample = processor->StartTickSample();
sample->pc = code->address(); sample->pc = code->address();
sample->tos = 0; sample->tos = 0;
sample->frames_count = i::TickSample::kMaxFramesCount; sample->frames_count = i::TickSample::kMaxFramesCount;
for (int i = 0; i < sample->frames_count; ++i) { for (int i = 0; i < sample->frames_count; ++i) {
sample->stack[i] = code->address(); sample->stack[i] = code->address();
} }
processor.FinishTickSample(); processor->FinishTickSample();
processor.StopSynchronously(); processor->StopSynchronously();
processor.Join();
CpuProfile* profile = profiles->StopProfiling(""); CpuProfile* profile = profiles->StopProfiling("");
CHECK_NE(NULL, profile); CHECK_NE(NULL, profile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment