OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/profiler-listener.h" | 5 #include "src/profiler/profiler-listener.h" |
6 | 6 |
7 #include "src/deoptimizer.h" | 7 #include "src/deoptimizer.h" |
8 #include "src/profiler/cpu-profiler.h" | 8 #include "src/profiler/cpu-profiler.h" |
9 #include "src/profiler/profile-generator-inl.h" | 9 #include "src/profiler/profile-generator-inl.h" |
10 #include "src/source-position-table.h" | 10 #include "src/source-position-table.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 if (opcode != Translation::JS_FRAME && | 276 if (opcode != Translation::JS_FRAME && |
277 opcode != Translation::INTERPRETED_FRAME) { | 277 opcode != Translation::INTERPRETED_FRAME) { |
278 it.Skip(Translation::NumberOfOperandsFor(opcode)); | 278 it.Skip(Translation::NumberOfOperandsFor(opcode)); |
279 continue; | 279 continue; |
280 } | 280 } |
281 BailoutId ast_id = BailoutId(it.Next()); | 281 BailoutId ast_id = BailoutId(it.Next()); |
282 int shared_info_id = it.Next(); | 282 int shared_info_id = it.Next(); |
283 it.Next(); // Skip height | 283 it.Next(); // Skip height |
284 SharedFunctionInfo* shared = SharedFunctionInfo::cast( | 284 SharedFunctionInfo* shared = SharedFunctionInfo::cast( |
285 deopt_input_data->LiteralArray()->get(shared_info_id)); | 285 deopt_input_data->LiteralArray()->get(shared_info_id)); |
286 int source_position = Deoptimizer::ComputeSourcePosition(shared, ast_id); | 286 int source_position; |
| 287 if (opcode == Translation::INTERPRETED_FRAME) { |
| 288 source_position = |
| 289 Deoptimizer::ComputeSourcePositionFromBytecodeArray(shared, ast_id); |
| 290 } else { |
| 291 DCHECK(opcode == Translation::JS_FRAME); |
| 292 source_position = |
| 293 Deoptimizer::ComputeSourcePositionFromBaselineCode(shared, ast_id); |
| 294 } |
287 int script_id = v8::UnboundScript::kNoScriptId; | 295 int script_id = v8::UnboundScript::kNoScriptId; |
288 if (shared->script()->IsScript()) { | 296 if (shared->script()->IsScript()) { |
289 Script* script = Script::cast(shared->script()); | 297 Script* script = Script::cast(shared->script()); |
290 script_id = script->id(); | 298 script_id = script->id(); |
291 } | 299 } |
292 CodeEntry::DeoptInlinedFrame frame = {source_position, script_id}; | 300 CodeEntry::DeoptInlinedFrame frame = {source_position, script_id}; |
293 inlined_frames.push_back(frame); | 301 inlined_frames.push_back(frame); |
294 } | 302 } |
295 if (!inlined_frames.empty() && !entry->HasDeoptInlinedFramesFor(deopt_id)) { | 303 if (!inlined_frames.empty() && !entry->HasDeoptInlinedFramesFor(deopt_id)) { |
296 entry->AddDeoptInlinedFrames(deopt_id, inlined_frames); | 304 entry->AddDeoptInlinedFrames(deopt_id, inlined_frames); |
(...skipping 21 matching lines...) Expand all Loading... |
318 } | 326 } |
319 | 327 |
320 void ProfilerListener::RemoveObserver(CodeEventObserver* observer) { | 328 void ProfilerListener::RemoveObserver(CodeEventObserver* observer) { |
321 auto it = std::find(observers_.begin(), observers_.end(), observer); | 329 auto it = std::find(observers_.begin(), observers_.end(), observer); |
322 if (it == observers_.end()) return; | 330 if (it == observers_.end()) return; |
323 observers_.erase(it); | 331 observers_.erase(it); |
324 } | 332 } |
325 | 333 |
326 } // namespace internal | 334 } // namespace internal |
327 } // namespace v8 | 335 } // namespace v8 |
OLD | NEW |