OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 | 648 |
649 | 649 |
650 void ProfileGenerator::RecordTickSample(const TickSample& sample) { | 650 void ProfileGenerator::RecordTickSample(const TickSample& sample) { |
651 // Allocate space for stack frames + pc + function + vm-state. | 651 // Allocate space for stack frames + pc + function + vm-state. |
652 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); | 652 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); |
653 // As actual number of decoded code entries may vary, initialize | 653 // As actual number of decoded code entries may vary, initialize |
654 // entries vector with NULL values. | 654 // entries vector with NULL values. |
655 CodeEntry** entry = entries.start(); | 655 CodeEntry** entry = entries.start(); |
656 memset(entry, 0, entries.length() * sizeof(*entry)); | 656 memset(entry, 0, entries.length() * sizeof(*entry)); |
657 if (sample.pc != NULL) { | 657 if (sample.pc != NULL) { |
658 if (sample.has_external_callback) { | 658 if (sample.has_external_callback && sample.state == EXTERNAL && |
| 659 sample.top_frame_type == StackFrame::EXIT) { |
659 // Don't use PC when in external callback code, as it can point | 660 // Don't use PC when in external callback code, as it can point |
660 // inside callback's code, and we will erroneously report | 661 // inside callback's code, and we will erroneously report |
661 // that a callback calls itself. | 662 // that a callback calls itself. |
662 *entry++ = code_map_.FindEntry(sample.external_callback); | 663 *entry++ = code_map_.FindEntry(sample.external_callback); |
663 } else { | 664 } else { |
664 Address start; | 665 Address start; |
665 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); | 666 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); |
666 // If pc is in the function code before it set up stack frame or after the | 667 // If pc is in the function code before it set up stack frame or after the |
667 // frame was destroyed SafeStackFrameIterator incorrectly thinks that | 668 // frame was destroyed SafeStackFrameIterator incorrectly thinks that |
668 // ebp contains return address of the current function and skips caller's | 669 // ebp contains return address of the current function and skips caller's |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 if (no_symbolized_entries) { | 717 if (no_symbolized_entries) { |
717 *entry++ = EntryForVMState(sample.state); | 718 *entry++ = EntryForVMState(sample.state); |
718 } | 719 } |
719 } | 720 } |
720 | 721 |
721 profiles_->AddPathToCurrentProfiles(entries); | 722 profiles_->AddPathToCurrentProfiles(entries); |
722 } | 723 } |
723 | 724 |
724 | 725 |
725 } } // namespace v8::internal | 726 } } // namespace v8::internal |
OLD | NEW |