| 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/profile-generator.h" | 5 #include "src/profiler/profile-generator.h" |
| 6 | 6 |
| 7 #include "src/ast/scopeinfo.h" | 7 #include "src/ast/scopeinfo.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/global-handles.h" | 10 #include "src/global-handles.h" |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 // Don't use PC when in external callback code, as it can point | 597 // Don't use PC when in external callback code, as it can point |
| 598 // inside callback's code, and we will erroneously report | 598 // inside callback's code, and we will erroneously report |
| 599 // that a callback calls itself. | 599 // that a callback calls itself. |
| 600 *entry++ = code_map_.FindEntry(sample.external_callback); | 600 *entry++ = code_map_.FindEntry(sample.external_callback); |
| 601 } else { | 601 } else { |
| 602 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc); | 602 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc); |
| 603 // If there is no pc_entry we're likely in native code. | 603 // If there is no pc_entry we're likely in native code. |
| 604 // Find out, if top of stack was pointing inside a JS function | 604 // Find out, if top of stack was pointing inside a JS function |
| 605 // meaning that we have encountered a frameless invocation. | 605 // meaning that we have encountered a frameless invocation. |
| 606 if (!pc_entry && (sample.top_frame_type == StackFrame::JAVA_SCRIPT || | 606 if (!pc_entry && (sample.top_frame_type == StackFrame::JAVA_SCRIPT || |
| 607 sample.top_frame_type == StackFrame::INTERPRETED || |
| 607 sample.top_frame_type == StackFrame::OPTIMIZED)) { | 608 sample.top_frame_type == StackFrame::OPTIMIZED)) { |
| 608 pc_entry = code_map_.FindEntry(sample.tos); | 609 pc_entry = code_map_.FindEntry(sample.tos); |
| 609 } | 610 } |
| 610 // If pc is in the function code before it set up stack frame or after the | 611 // If pc is in the function code before it set up stack frame or after the |
| 611 // frame was destroyed SafeStackFrameIterator incorrectly thinks that | 612 // frame was destroyed SafeStackFrameIterator incorrectly thinks that |
| 612 // ebp contains return address of the current function and skips caller's | 613 // ebp contains return address of the current function and skips caller's |
| 613 // frame. Check for this case and just skip such samples. | 614 // frame. Check for this case and just skip such samples. |
| 614 if (pc_entry) { | 615 if (pc_entry) { |
| 615 int pc_offset = | 616 int pc_offset = |
| 616 static_cast<int>(sample.pc - pc_entry->instruction_start()); | 617 static_cast<int>(sample.pc - pc_entry->instruction_start()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 case EXTERNAL: | 690 case EXTERNAL: |
| 690 return program_entry_; | 691 return program_entry_; |
| 691 case IDLE: | 692 case IDLE: |
| 692 return idle_entry_; | 693 return idle_entry_; |
| 693 default: return NULL; | 694 default: return NULL; |
| 694 } | 695 } |
| 695 } | 696 } |
| 696 | 697 |
| 697 } // namespace internal | 698 } // namespace internal |
| 698 } // namespace v8 | 699 } // namespace v8 |
| OLD | NEW |