| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 | 58 |
| 59 void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) { | 59 void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) { |
| 60 event.generic.order = ++last_code_event_id_; | 60 event.generic.order = ++last_code_event_id_; |
| 61 events_buffer_.Enqueue(event); | 61 events_buffer_.Enqueue(event); |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 void ProfilerEventsProcessor::AddCurrentStack(Isolate* isolate) { | 65 void ProfilerEventsProcessor::AddCurrentStack(Isolate* isolate) { |
| 66 TickSampleEventRecord record(last_code_event_id_); | 66 TickSampleEventRecord record(last_code_event_id_); |
| 67 TickSample* sample = &record.sample; | 67 RegisterState regs; |
| 68 sample->state = isolate->current_vm_state(); | 68 StackFrameIterator it(isolate); |
| 69 sample->pc = reinterpret_cast<Address>(sample); // Not NULL. | 69 if (!it.done()) { |
| 70 for (StackTraceFrameIterator it(isolate); | 70 StackFrame* frame = it.frame(); |
| 71 !it.done() && sample->frames_count < TickSample::kMaxFramesCount; | 71 regs.sp = frame->sp(); |
| 72 it.Advance()) { | 72 regs.fp = frame->fp(); |
| 73 sample->stack[sample->frames_count++] = it.frame()->pc(); | 73 regs.pc = frame->pc(); |
| 74 } | 74 } |
| 75 record.sample.Init(isolate, regs); |
| 75 ticks_from_vm_buffer_.Enqueue(record); | 76 ticks_from_vm_buffer_.Enqueue(record); |
| 76 } | 77 } |
| 77 | 78 |
| 78 | 79 |
| 79 void ProfilerEventsProcessor::StopSynchronously() { | 80 void ProfilerEventsProcessor::StopSynchronously() { |
| 80 if (!running_) return; | 81 if (!running_) return; |
| 81 running_ = false; | 82 running_ = false; |
| 82 Join(); | 83 Join(); |
| 83 } | 84 } |
| 84 | 85 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 rec->size = code->ExecutableSize(); | 254 rec->size = code->ExecutableSize(); |
| 254 rec->shared = shared->address(); | 255 rec->shared = shared->address(); |
| 255 processor_->Enqueue(evt_rec); | 256 processor_->Enqueue(evt_rec); |
| 256 } | 257 } |
| 257 | 258 |
| 258 | 259 |
| 259 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, | 260 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 260 Code* code, | 261 Code* code, |
| 261 SharedFunctionInfo* shared, | 262 SharedFunctionInfo* shared, |
| 262 CompilationInfo* info, | 263 CompilationInfo* info, |
| 263 Name* source, int line) { | 264 Name* source, int line, int column) { |
| 264 if (FilterOutCodeCreateEvent(tag)) return; | 265 if (FilterOutCodeCreateEvent(tag)) return; |
| 265 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); | 266 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
| 266 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; | 267 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
| 267 rec->start = code->address(); | 268 rec->start = code->address(); |
| 268 rec->entry = profiles_->NewCodeEntry( | 269 rec->entry = profiles_->NewCodeEntry( |
| 269 tag, | 270 tag, |
| 270 profiles_->GetFunctionName(shared->DebugName()), | 271 profiles_->GetFunctionName(shared->DebugName()), |
| 271 CodeEntry::kEmptyNamePrefix, | 272 CodeEntry::kEmptyNamePrefix, |
| 272 profiles_->GetName(source), | 273 profiles_->GetName(source), |
| 273 line); | 274 line, |
| 275 column); |
| 274 if (info) { | 276 if (info) { |
| 275 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); | 277 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); |
| 276 } | 278 } |
| 277 ASSERT(Script::cast(shared->script())); | 279 ASSERT(Script::cast(shared->script())); |
| 278 Script* script = Script::cast(shared->script()); | 280 Script* script = Script::cast(shared->script()); |
| 279 rec->entry->set_script_id(script->id()->value()); | 281 rec->entry->set_script_id(script->id()->value()); |
| 280 rec->size = code->ExecutableSize(); | 282 rec->size = code->ExecutableSize(); |
| 281 rec->shared = shared->address(); | 283 rec->shared = shared->address(); |
| 282 rec->entry->set_bailout_reason( | 284 rec->entry->set_bailout_reason( |
| 283 GetBailoutReason(shared->DisableOptimizationReason())); | 285 GetBailoutReason(shared->DisableOptimizationReason())); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 513 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
| 512 Builtins::Name id = static_cast<Builtins::Name>(i); | 514 Builtins::Name id = static_cast<Builtins::Name>(i); |
| 513 rec->start = builtins->builtin(id)->address(); | 515 rec->start = builtins->builtin(id)->address(); |
| 514 rec->builtin_id = id; | 516 rec->builtin_id = id; |
| 515 processor_->Enqueue(evt_rec); | 517 processor_->Enqueue(evt_rec); |
| 516 } | 518 } |
| 517 } | 519 } |
| 518 | 520 |
| 519 | 521 |
| 520 } } // namespace v8::internal | 522 } } // namespace v8::internal |
| OLD | NEW |