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/profile-generator.h" | 5 #include "src/profile-generator.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 if (sample.pc != NULL) { | 596 if (sample.pc != NULL) { |
597 if (sample.has_external_callback && sample.state == EXTERNAL && | 597 if (sample.has_external_callback && sample.state == EXTERNAL && |
598 sample.top_frame_type == StackFrame::EXIT) { | 598 sample.top_frame_type == StackFrame::EXIT) { |
599 // Don't use PC when in external callback code, as it can point | 599 // Don't use PC when in external callback code, as it can point |
600 // inside callback's code, and we will erroneously report | 600 // inside callback's code, and we will erroneously report |
601 // that a callback calls itself. | 601 // that a callback calls itself. |
602 *entry++ = code_map_.FindEntry(sample.external_callback); | 602 *entry++ = code_map_.FindEntry(sample.external_callback); |
603 } else { | 603 } else { |
604 Address start; | 604 Address start; |
605 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); | 605 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); |
| 606 // If there is no pc_entry we're likely in native code. |
| 607 // Find out, if top of stack was pointing inside a JS function |
| 608 // meaning that we have encountered a frameless invocation. |
| 609 if (!pc_entry && (sample.top_frame_type == StackFrame::JAVA_SCRIPT || |
| 610 sample.top_frame_type == StackFrame::OPTIMIZED)) { |
| 611 pc_entry = code_map_.FindEntry(sample.tos); |
| 612 } |
606 // If pc is in the function code before it set up stack frame or after the | 613 // If pc is in the function code before it set up stack frame or after the |
607 // frame was destroyed SafeStackFrameIterator incorrectly thinks that | 614 // frame was destroyed SafeStackFrameIterator incorrectly thinks that |
608 // ebp contains return address of the current function and skips caller's | 615 // ebp contains return address of the current function and skips caller's |
609 // frame. Check for this case and just skip such samples. | 616 // frame. Check for this case and just skip such samples. |
610 if (pc_entry) { | 617 if (pc_entry) { |
611 List<OffsetRange>* ranges = pc_entry->no_frame_ranges(); | 618 List<OffsetRange>* ranges = pc_entry->no_frame_ranges(); |
612 int pc_offset = | 619 int pc_offset = |
613 static_cast<int>(sample.pc - pc_entry->instruction_start()); | 620 static_cast<int>(sample.pc - pc_entry->instruction_start()); |
614 if (ranges) { | 621 if (ranges) { |
615 for (int i = 0; i < ranges->length(); i++) { | 622 for (int i = 0; i < ranges->length(); i++) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 case EXTERNAL: | 701 case EXTERNAL: |
695 return program_entry_; | 702 return program_entry_; |
696 case IDLE: | 703 case IDLE: |
697 return idle_entry_; | 704 return idle_entry_; |
698 default: return NULL; | 705 default: return NULL; |
699 } | 706 } |
700 } | 707 } |
701 | 708 |
702 } // namespace internal | 709 } // namespace internal |
703 } // namespace v8 | 710 } // namespace v8 |
OLD | NEW |