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/profiler/cpu-profiler.h" | 5 #include "src/profiler/cpu-profiler.h" |
6 | 6 |
7 #include "src/debug/debug.h" | 7 #include "src/debug/debug.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
10 #include "src/locked-queue-inl.h" | 10 #include "src/locked-queue-inl.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 int position = static_cast<int>(it.rinfo()->data()); | 280 int position = static_cast<int>(it.rinfo()->data()); |
281 if (position >= 0) { | 281 if (position >= 0) { |
282 int pc_offset = | 282 int pc_offset = |
283 static_cast<int>(it.rinfo()->pc() - code->address()); | 283 static_cast<int>(it.rinfo()->pc() - code->address()); |
284 int line_number = script->GetLineNumber(position) + 1; | 284 int line_number = script->GetLineNumber(position) + 1; |
285 line_table->SetPosition(pc_offset, line_number); | 285 line_table->SetPosition(pc_offset, line_number); |
286 } | 286 } |
287 } | 287 } |
288 } | 288 } |
289 } else { | 289 } else { |
290 DCHECK(abstract_code->IsBytecodeArray()); | 290 BytecodeArray* bytecode = abstract_code->GetBytecodeArray(); |
291 // TODO(rmcilroy): source position tracking for bytecode arrays. | 291 line_table = new JITLineInfoTable(); |
| 292 interpreter::SourcePositionTableIterator it( |
| 293 bytecode->source_position_table()); |
| 294 for (; !it.done(); it.Advance()) { |
| 295 int line_number = script->GetLineNumber(it.source_position()) + 1; |
| 296 int pc_offset = it.bytecode_offset() + BytecodeArray::kHeaderSize; |
| 297 line_table->SetPosition(pc_offset, line_number); |
| 298 } |
292 } | 299 } |
293 } | 300 } |
294 rec->entry = profiles_->NewCodeEntry( | 301 rec->entry = profiles_->NewCodeEntry( |
295 tag, profiles_->GetFunctionName(shared->DebugName()), | 302 tag, profiles_->GetFunctionName(shared->DebugName()), |
296 CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line, | 303 CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line, |
297 column, line_table, abstract_code->instruction_start()); | 304 column, line_table, abstract_code->instruction_start()); |
298 RecordInliningInfo(rec->entry, abstract_code); | 305 RecordInliningInfo(rec->entry, abstract_code); |
299 if (info) { | 306 if (info) { |
300 rec->entry->set_inlined_function_infos(info->inlined_function_infos()); | 307 rec->entry->set_inlined_function_infos(info->inlined_function_infos()); |
301 } | 308 } |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 Builtins::Name id = static_cast<Builtins::Name>(i); | 578 Builtins::Name id = static_cast<Builtins::Name>(i); |
572 rec->start = builtins->builtin(id)->address(); | 579 rec->start = builtins->builtin(id)->address(); |
573 rec->builtin_id = id; | 580 rec->builtin_id = id; |
574 processor_->Enqueue(evt_rec); | 581 processor_->Enqueue(evt_rec); |
575 } | 582 } |
576 } | 583 } |
577 | 584 |
578 | 585 |
579 } // namespace internal | 586 } // namespace internal |
580 } // namespace v8 | 587 } // namespace v8 |
OLD | NEW |