Revision: 5961
Author: [email protected]
Date: Fri Dec 10 04:00:26 2010
Log: Fix a bug that caused the runtime profiler to sample huge amounts of
stack frames in programs with recursively called optimized functions.
Review URL: http://codereview.chromium.org/5786001
http://code.google.com/p/v8/source/detail?r=5961
Modified:
/branches/bleeding_edge/src/runtime-profiler.cc
=======================================
--- /branches/bleeding_edge/src/runtime-profiler.cc Thu Dec 9 05:12:23 2010
+++ /branches/bleeding_edge/src/runtime-profiler.cc Fri Dec 10 04:00:26 2010
@@ -272,9 +272,10 @@
// have a sample of the function, we mark it for optimizations
// (eagerly or lazily).
JSFunction* samples[kSamplerFrameCount];
- int count = 0;
+ int sample_count = 0;
+ int frame_count = 0;
for (JavaScriptFrameIterator it;
- count < kSamplerFrameCount && !it.done();
+ frame_count++ < kSamplerFrameCount && !it.done();
it.Advance()) {
JavaScriptFrame* frame = it.frame();
JSFunction* function = JSFunction::cast(frame->function());
@@ -304,7 +305,7 @@
// Do not record non-optimizable functions.
if (!IsOptimizable(function)) continue;
- samples[count++] = function;
+ samples[sample_count++] = function;
int function_size = function->shared()->SourceSize();
int threshold_size_factor = (function_size > kSizeLimit)
@@ -335,7 +336,7 @@
// Add the collected functions as samples. It's important not to do
// this as part of collecting them because this will interfere with
// the sample lookup in case of recursive functions.
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < sample_count; i++) {
AddSample(samples[i], kSamplerFrameWeight[i]);
}
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev