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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 void RuntimeProfiler::OptimizeNow() { | 199 void RuntimeProfiler::OptimizeNow() { |
200 HandleScope scope(isolate_); | 200 HandleScope scope(isolate_); |
201 | 201 |
202 // Run through the JavaScript frames and collect them. If we already | 202 // Run through the JavaScript frames and collect them. If we already |
203 // have a sample of the function, we mark it for optimizations | 203 // have a sample of the function, we mark it for optimizations |
204 // (eagerly or lazily). | 204 // (eagerly or lazily). |
205 JSFunction* samples[kSamplerFrameCount]; | 205 JSFunction* samples[kSamplerFrameCount]; |
206 int sample_count = 0; | 206 int sample_count = 0; |
207 int frame_count = 0; | 207 int frame_count = 0; |
| 208 int frame_count_limit = FLAG_watch_ic_patching ? FLAG_frame_count |
| 209 : kSamplerFrameCount; |
208 for (JavaScriptFrameIterator it(isolate_); | 210 for (JavaScriptFrameIterator it(isolate_); |
209 frame_count++ < kSamplerFrameCount && !it.done(); | 211 frame_count++ < frame_count_limit && !it.done(); |
210 it.Advance()) { | 212 it.Advance()) { |
211 JavaScriptFrame* frame = it.frame(); | 213 JavaScriptFrame* frame = it.frame(); |
212 JSFunction* function = JSFunction::cast(frame->function()); | 214 JSFunction* function = JSFunction::cast(frame->function()); |
213 | 215 |
214 if (!FLAG_watch_ic_patching) { | 216 if (!FLAG_watch_ic_patching) { |
215 // Adjust threshold each time we have processed | 217 // Adjust threshold each time we have processed |
216 // a certain number of ticks. | 218 // a certain number of ticks. |
217 if (sampler_ticks_until_threshold_adjustment_ > 0) { | 219 if (sampler_ticks_until_threshold_adjustment_ > 0) { |
218 sampler_ticks_until_threshold_adjustment_--; | 220 sampler_ticks_until_threshold_adjustment_--; |
219 if (sampler_ticks_until_threshold_adjustment_ <= 0) { | 221 if (sampler_ticks_until_threshold_adjustment_ <= 0) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 425 |
424 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { | 426 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { |
425 if (!RuntimeProfiler::IsSomeIsolateInJS()) { | 427 if (!RuntimeProfiler::IsSomeIsolateInJS()) { |
426 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); | 428 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); |
427 } | 429 } |
428 return false; | 430 return false; |
429 } | 431 } |
430 | 432 |
431 | 433 |
432 } } // namespace v8::internal | 434 } } // namespace v8::internal |
OLD | NEW |