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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 total_code_generated_ > 0 && | 249 total_code_generated_ > 0 && |
250 total_code_generated_ < 2000) { | 250 total_code_generated_ < 2000) { |
251 // If no code was generated and no IC was patched since the last tick, | 251 // If no code was generated and no IC was patched since the last tick, |
252 // but a little code has already been generated since last Reset(), | 252 // but a little code has already been generated since last Reset(), |
253 // then type info might already be stable and we can optimize now. | 253 // then type info might already be stable and we can optimize now. |
254 Optimize(function, "stable on startup"); | 254 Optimize(function, "stable on startup"); |
255 } else { | 255 } else { |
256 function->shared()->set_profiler_ticks(ticks + 1); | 256 function->shared()->set_profiler_ticks(ticks + 1); |
257 } | 257 } |
258 } else { // !FLAG_counting_profiler | 258 } else { // !FLAG_counting_profiler |
259 // Only record top-level code on top of the execution stack and | |
Jakob Kummerow
2012/02/14 10:08:26
It seems this entire addition is independent of th
fschneider
2012/02/14 13:03:11
Done.
Good point. It should work with both profil
| |
260 // avoid optimizing excessively large scripts since top-level code | |
261 // will be executed only once. | |
262 const int kMaxToplevelSourceSize = 10 * 1024; | |
263 if (function->shared()->is_toplevel() | |
264 && (frame_count > 1 | |
265 || function->shared()->SourceSize() > kMaxToplevelSourceSize)) { | |
266 continue; | |
267 } | |
268 | |
259 samples[sample_count++] = function; | 269 samples[sample_count++] = function; |
260 | 270 |
261 int function_size = function->shared()->SourceSize(); | 271 int function_size = function->shared()->SourceSize(); |
262 int threshold_size_factor = (function_size > kSizeLimit) | 272 int threshold_size_factor = (function_size > kSizeLimit) |
263 ? sampler_threshold_size_factor_ | 273 ? sampler_threshold_size_factor_ |
264 : 1; | 274 : 1; |
265 | 275 |
266 int threshold = sampler_threshold_ * threshold_size_factor; | 276 int threshold = sampler_threshold_ * threshold_size_factor; |
267 | 277 |
268 if (LookupSample(function) >= threshold) { | 278 if (LookupSample(function) >= threshold) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 | 415 |
406 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { | 416 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { |
407 if (!RuntimeProfiler::IsSomeIsolateInJS()) { | 417 if (!RuntimeProfiler::IsSomeIsolateInJS()) { |
408 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); | 418 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); |
409 } | 419 } |
410 return false; | 420 return false; |
411 } | 421 } |
412 | 422 |
413 | 423 |
414 } } // namespace v8::internal | 424 } } // namespace v8::internal |
OLD | NEW |