Index: src/profile-generator.cc |
diff --git a/src/profile-generator.cc b/src/profile-generator.cc |
index 78b35e253401912d538862144323d00996ea161f..f836583d9ba9b3daf2a084b17fd65b5ca0bfa22a 100644 |
--- a/src/profile-generator.cc |
+++ b/src/profile-generator.cc |
@@ -813,7 +813,15 @@ void ProfileGenerator::RecordTickSample(const TickSample& sample) { |
if (sample.pc != NULL) { |
*entry++ = code_map_.FindEntry(sample.pc); |
- if (sample.tos != NULL) { |
+ if (sample.has_external_callback) { |
+ // Don't use PC when in external callback code, as it can point |
+ // inside callback's code, and we will erroneously report |
+ // that a callback calls itself. |
+ *(entries.start()) = NULL; |
+ *entry++ = code_map_.FindEntry(sample.external_callback); |
+ } else if (sample.tos != NULL) { |
+ // Find out, if top of stack was pointing inside a JS function |
+ // meaning that we have encountered a frameless invocation. |
*entry = code_map_.FindEntry(sample.tos); |
if (*entry != NULL && !(*entry)->is_js_function()) { |
*entry = NULL; |