OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 void ProfileGenerator::RecordTickSample(const TickSample& sample) { | 806 void ProfileGenerator::RecordTickSample(const TickSample& sample) { |
807 // Allocate space for stack frames + pc + function + vm-state. | 807 // Allocate space for stack frames + pc + function + vm-state. |
808 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); | 808 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); |
809 // As actual number of decoded code entries may vary, initialize | 809 // As actual number of decoded code entries may vary, initialize |
810 // entries vector with NULL values. | 810 // entries vector with NULL values. |
811 CodeEntry** entry = entries.start(); | 811 CodeEntry** entry = entries.start(); |
812 memset(entry, 0, entries.length() * sizeof(*entry)); | 812 memset(entry, 0, entries.length() * sizeof(*entry)); |
813 if (sample.pc != NULL) { | 813 if (sample.pc != NULL) { |
814 *entry++ = code_map_.FindEntry(sample.pc); | 814 *entry++ = code_map_.FindEntry(sample.pc); |
815 | 815 |
816 if (sample.tos != NULL) { | 816 if (sample.has_external_callback) { |
| 817 // Don't use PC when in external callback code, as it can point |
| 818 // inside callback's code, and we will erroneously report |
| 819 // that a callback calls itself. |
| 820 *(entries.start()) = NULL; |
| 821 *entry++ = code_map_.FindEntry(sample.external_callback); |
| 822 } else if (sample.tos != NULL) { |
| 823 // Find out, if top of stack was pointing inside a JS function |
| 824 // meaning that we have encountered a frameless invocation. |
817 *entry = code_map_.FindEntry(sample.tos); | 825 *entry = code_map_.FindEntry(sample.tos); |
818 if (*entry != NULL && !(*entry)->is_js_function()) { | 826 if (*entry != NULL && !(*entry)->is_js_function()) { |
819 *entry = NULL; | 827 *entry = NULL; |
820 } | 828 } |
821 entry++; | 829 entry++; |
822 } | 830 } |
823 | 831 |
824 for (const Address *stack_pos = sample.stack, | 832 for (const Address *stack_pos = sample.stack, |
825 *stack_end = stack_pos + sample.frames_count; | 833 *stack_end = stack_pos + sample.frames_count; |
826 stack_pos != stack_end; | 834 stack_pos != stack_end; |
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 | 3196 |
3189 | 3197 |
3190 String* GetConstructorNameForHeapProfile(JSObject* object) { | 3198 String* GetConstructorNameForHeapProfile(JSObject* object) { |
3191 if (object->IsJSFunction()) return HEAP->closure_symbol(); | 3199 if (object->IsJSFunction()) return HEAP->closure_symbol(); |
3192 return object->constructor_name(); | 3200 return object->constructor_name(); |
3193 } | 3201 } |
3194 | 3202 |
3195 } } // namespace v8::internal | 3203 } } // namespace v8::internal |
3196 | 3204 |
3197 #endif // ENABLE_LOGGING_AND_PROFILING | 3205 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |