| 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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 memset(entry, 0, entries.length() * sizeof(*entry)); | 893 memset(entry, 0, entries.length() * sizeof(*entry)); |
| 894 if (sample.pc != NULL) { | 894 if (sample.pc != NULL) { |
| 895 *entry++ = code_map_.FindEntry(sample.pc); | 895 *entry++ = code_map_.FindEntry(sample.pc); |
| 896 | 896 |
| 897 if (sample.has_external_callback) { | 897 if (sample.has_external_callback) { |
| 898 // Don't use PC when in external callback code, as it can point | 898 // Don't use PC when in external callback code, as it can point |
| 899 // inside callback's code, and we will erroneously report | 899 // inside callback's code, and we will erroneously report |
| 900 // that a callback calls itself. | 900 // that a callback calls itself. |
| 901 *(entries.start()) = NULL; | 901 *(entries.start()) = NULL; |
| 902 *entry++ = code_map_.FindEntry(sample.external_callback); | 902 *entry++ = code_map_.FindEntry(sample.external_callback); |
| 903 } else if (sample.tos != NULL) { | |
| 904 // Find out, if top of stack was pointing inside a JS function | |
| 905 // meaning that we have encountered a frameless invocation. | |
| 906 *entry = code_map_.FindEntry(sample.tos); | |
| 907 if (*entry != NULL && !(*entry)->is_js_function()) { | |
| 908 *entry = NULL; | |
| 909 } | |
| 910 entry++; | |
| 911 } | 903 } |
| 912 | 904 |
| 913 for (const Address* stack_pos = sample.stack, | 905 for (const Address* stack_pos = sample.stack, |
| 914 *stack_end = stack_pos + sample.frames_count; | 906 *stack_end = stack_pos + sample.frames_count; |
| 915 stack_pos != stack_end; | 907 stack_pos != stack_end; |
| 916 ++stack_pos) { | 908 ++stack_pos) { |
| 917 *entry++ = code_map_.FindEntry(*stack_pos); | 909 *entry++ = code_map_.FindEntry(*stack_pos); |
| 918 } | 910 } |
| 919 } | 911 } |
| 920 | 912 |
| 921 if (FLAG_prof_browser_mode) { | 913 if (FLAG_prof_browser_mode) { |
| 922 bool no_symbolized_entries = true; | 914 bool no_symbolized_entries = true; |
| 923 for (CodeEntry** e = entries.start(); e != entry; ++e) { | 915 for (CodeEntry** e = entries.start(); e != entry; ++e) { |
| 924 if (*e != NULL) { | 916 if (*e != NULL) { |
| 925 no_symbolized_entries = false; | 917 no_symbolized_entries = false; |
| 926 break; | 918 break; |
| 927 } | 919 } |
| 928 } | 920 } |
| 929 // If no frames were symbolized, put the VM state entry in. | 921 // If no frames were symbolized, put the VM state entry in. |
| 930 if (no_symbolized_entries) { | 922 if (no_symbolized_entries) { |
| 931 *entry++ = EntryForVMState(sample.state); | 923 *entry++ = EntryForVMState(sample.state); |
| 932 } | 924 } |
| 933 } | 925 } |
| 934 | 926 |
| 935 profiles_->AddPathToCurrentProfiles(entries); | 927 profiles_->AddPathToCurrentProfiles(entries); |
| 936 } | 928 } |
| 937 | 929 |
| 938 | 930 |
| 939 } } // namespace v8::internal | 931 } } // namespace v8::internal |
| OLD | NEW |