| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/cpu-profiler-inl.h" | 7 #include "src/cpu-profiler-inl.h" |
| 8 | 8 |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 249 |
| 250 | 250 |
| 251 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, | 251 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, |
| 252 SharedFunctionInfo* shared, | 252 SharedFunctionInfo* shared, |
| 253 CompilationInfo* info, Name* script_name, | 253 CompilationInfo* info, Name* script_name, |
| 254 int line, int column) { | 254 int line, int column) { |
| 255 if (FilterOutCodeCreateEvent(tag)) return; | 255 if (FilterOutCodeCreateEvent(tag)) return; |
| 256 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); | 256 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
| 257 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; | 257 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
| 258 rec->start = code->address(); | 258 rec->start = code->address(); |
| 259 Script* script = NULL; |
| 260 JITLineInfoTable* line_table = NULL; |
| 261 if (shared->script()->IsScript()) { |
| 262 DCHECK(Script::cast(shared->script())); |
| 263 script = Script::cast(shared->script()); |
| 264 line_table = new JITLineInfoTable(); |
| 265 for (RelocIterator it(code); !it.done(); it.next()) { |
| 266 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 267 if (RelocInfo::IsPosition(mode)) { |
| 268 int position = static_cast<int>(it.rinfo()->data()); |
| 269 if (position >= 0) { |
| 270 int pc_offset = static_cast<int>(it.rinfo()->pc() - code->address()); |
| 271 int line_number = script->GetLineNumber(position) + 1; |
| 272 line_table->SetPosition(pc_offset, line_number); |
| 273 } |
| 274 } |
| 275 } |
| 276 } |
| 259 rec->entry = profiles_->NewCodeEntry( | 277 rec->entry = profiles_->NewCodeEntry( |
| 260 tag, profiles_->GetFunctionName(shared->DebugName()), | 278 tag, profiles_->GetFunctionName(shared->DebugName()), |
| 261 CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line, | 279 CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line, |
| 262 column); | 280 column, line_table); |
| 263 if (info) { | 281 if (info) { |
| 264 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); | 282 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); |
| 265 } | 283 } |
| 266 DCHECK(Script::cast(shared->script())); | 284 if (script) { |
| 267 Script* script = Script::cast(shared->script()); | 285 rec->entry->set_script_id(script->id()->value()); |
| 268 rec->entry->set_script_id(script->id()->value()); | 286 } |
| 287 rec->entry->set_bailout_reason( |
| 288 GetBailoutReason(shared->DisableOptimizationReason())); |
| 269 rec->size = code->ExecutableSize(); | 289 rec->size = code->ExecutableSize(); |
| 270 rec->shared = shared->address(); | 290 rec->shared = shared->address(); |
| 271 rec->entry->set_bailout_reason( | |
| 272 GetBailoutReason(shared->DisableOptimizationReason())); | |
| 273 processor_->Enqueue(evt_rec); | 291 processor_->Enqueue(evt_rec); |
| 274 } | 292 } |
| 275 | 293 |
| 276 | 294 |
| 277 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, | 295 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 278 Code* code, | 296 Code* code, |
| 279 int args_count) { | 297 int args_count) { |
| 280 if (FilterOutCodeCreateEvent(tag)) return; | 298 if (FilterOutCodeCreateEvent(tag)) return; |
| 281 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); | 299 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
| 282 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; | 300 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 517 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
| 500 Builtins::Name id = static_cast<Builtins::Name>(i); | 518 Builtins::Name id = static_cast<Builtins::Name>(i); |
| 501 rec->start = builtins->builtin(id)->address(); | 519 rec->start = builtins->builtin(id)->address(); |
| 502 rec->builtin_id = id; | 520 rec->builtin_id = id; |
| 503 processor_->Enqueue(evt_rec); | 521 processor_->Enqueue(evt_rec); |
| 504 } | 522 } |
| 505 } | 523 } |
| 506 | 524 |
| 507 | 525 |
| 508 } } // namespace v8::internal | 526 } } // namespace v8::internal |
| OLD | NEW |