Chromium Code Reviews| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 | 250 |
| 251 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, | 251 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 252 Code* code, | 252 Code* code, |
| 253 SharedFunctionInfo* shared, | 253 SharedFunctionInfo* shared, |
| 254 CompilationInfo* info, | 254 CompilationInfo* info, |
| 255 Name* source, int line, int column) { | 255 Name* source, int line, int column) { |
| 256 if (FilterOutCodeCreateEvent(tag)) return; | 256 if (FilterOutCodeCreateEvent(tag)) return; |
| 257 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); | 257 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
| 258 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; | 258 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
| 259 rec->start = code->address(); | 259 rec->start = code->address(); |
| 260 ASSERT(Script::cast(shared->script())); | |
|
alph
2014/08/11 12:18:15
nit: DCHECK here and everywhere else.
Also cast d
Denis Pravdin
2014/08/11 13:11:50
DCHECK is undefined. Do you suggest to use the CHE
alph
2014/08/11 13:41:04
Rebaseline to the latest version. They've been int
| |
| 261 Script* script = Script::cast(shared->script()); | |
| 262 | |
| 263 // Get line info from the relocation information. | |
| 264 JITLineInfoTable* line_table = new JITLineInfoTable(); | |
| 265 Handle<Script> script_handle(Script::cast(shared->script())); | |
|
alph
2014/08/11 12:18:15
nit: you can use the 'script' pointer calculated a
Denis Pravdin
2014/08/11 13:11:49
Acknowledged.
| |
| 266 for (RelocIterator it(code); !it.done(); it.next()) { | |
| 267 RelocInfo::Mode mode = it.rinfo()->rmode(); | |
| 268 if (RelocInfo::IsPosition(mode)) { | |
| 269 int position = static_cast<int>(it.rinfo()->data()); | |
| 270 if (position >= 0) { | |
| 271 int pc_offset = static_cast<int>(it.rinfo()->pc() - code->address()); | |
| 272 int line_number = script->GetLineNumber(position) + 1; | |
| 273 line_table->SetPosition(pc_offset, line_number); | |
| 274 } | |
| 275 } | |
| 276 } | |
| 277 | |
| 260 rec->entry = profiles_->NewCodeEntry( | 278 rec->entry = profiles_->NewCodeEntry( |
| 261 tag, | 279 tag, |
| 262 profiles_->GetFunctionName(shared->DebugName()), | 280 profiles_->GetFunctionName(shared->DebugName()), |
| 263 CodeEntry::kEmptyNamePrefix, | 281 CodeEntry::kEmptyNamePrefix, |
| 264 profiles_->GetName(source), | 282 profiles_->GetName(source), |
| 265 line, | 283 line, |
| 266 column); | 284 column, |
| 285 line_table); | |
| 267 if (info) { | 286 if (info) { |
| 268 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); | 287 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); |
| 269 } | 288 } |
| 270 ASSERT(Script::cast(shared->script())); | |
| 271 Script* script = Script::cast(shared->script()); | |
| 272 rec->entry->set_script_id(script->id()->value()); | 289 rec->entry->set_script_id(script->id()->value()); |
| 273 rec->size = code->ExecutableSize(); | 290 rec->size = code->ExecutableSize(); |
| 274 rec->shared = shared->address(); | 291 rec->shared = shared->address(); |
| 275 rec->entry->set_bailout_reason( | 292 rec->entry->set_bailout_reason( |
| 276 GetBailoutReason(shared->DisableOptimizationReason())); | 293 GetBailoutReason(shared->DisableOptimizationReason())); |
| 277 processor_->Enqueue(evt_rec); | 294 processor_->Enqueue(evt_rec); |
| 278 } | 295 } |
| 279 | 296 |
| 280 | 297 |
| 281 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, | 298 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 520 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
| 504 Builtins::Name id = static_cast<Builtins::Name>(i); | 521 Builtins::Name id = static_cast<Builtins::Name>(i); |
| 505 rec->start = builtins->builtin(id)->address(); | 522 rec->start = builtins->builtin(id)->address(); |
| 506 rec->builtin_id = id; | 523 rec->builtin_id = id; |
| 507 processor_->Enqueue(evt_rec); | 524 processor_->Enqueue(evt_rec); |
| 508 } | 525 } |
| 509 } | 526 } |
| 510 | 527 |
| 511 | 528 |
| 512 } } // namespace v8::internal | 529 } } // namespace v8::internal |
| OLD | NEW |