Index: src/runtime-profiler.cc |
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc |
index c6e2b465892b4d6e7c0242ec86bc1c9cdf9a6a44..2724230c4b4dc313175a6b3d10afe7bdd7234a4e 100644 |
--- a/src/runtime-profiler.cc |
+++ b/src/runtime-profiler.cc |
@@ -217,7 +217,10 @@ int RuntimeProfiler::LookupSample(JSFunction* function) { |
for (int i = 0; i < kSamplerWindowSize; i++) { |
Object* sample = sampler_window_[i]; |
if (sample != NULL) { |
- if (function == sample) { |
+ bool fits = FLAG_lookup_sample_by_shared |
+ ? (function->shared() == JSFunction::cast(sample)->shared()) |
+ : (function == JSFunction::cast(sample)); |
+ if (fits) { |
weight += sampler_window_weight_[i]; |
} |
} |