OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/runtime-profiler.h" | 5 #include "src/runtime-profiler.h" |
6 | 6 |
7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 UNREACHABLE(); | 209 UNREACHABLE(); |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 void RuntimeProfiler::MaybeOptimizeFullCodegen(JSFunction* function, | 213 void RuntimeProfiler::MaybeOptimizeFullCodegen(JSFunction* function, |
214 JavaScriptFrame* frame, | 214 JavaScriptFrame* frame, |
215 int frame_count) { | 215 int frame_count) { |
216 SharedFunctionInfo* shared = function->shared(); | 216 SharedFunctionInfo* shared = function->shared(); |
217 Code* shared_code = shared->code(); | 217 Code* shared_code = shared->code(); |
218 if (shared_code->kind() != Code::FUNCTION) return; | 218 if (shared_code->kind() != Code::FUNCTION) return; |
219 if (function->IsInOptimizationQueue()) return; | 219 if (function->IsInOptimizationQueue()) { |
| 220 if (FLAG_trace_opt_verbose) { |
| 221 PrintF("[function "); |
| 222 function->PrintName(); |
| 223 PrintF(" is already in optimization queue]\n"); |
| 224 } |
| 225 return; |
| 226 } |
220 | 227 |
221 if (FLAG_always_osr) { | 228 if (FLAG_always_osr) { |
222 AttemptOnStackReplacement(frame, AbstractCode::kMaxLoopNestingMarker); | 229 AttemptOnStackReplacement(frame, AbstractCode::kMaxLoopNestingMarker); |
223 // Fall through and do a normal optimized compile as well. | 230 // Fall through and do a normal optimized compile as well. |
224 } else if (!frame->is_optimized() && | 231 } else if (!frame->is_optimized() && |
225 (function->IsMarkedForOptimization() || | 232 (function->IsMarkedForOptimization() || |
226 function->IsMarkedForConcurrentOptimization() || | 233 function->IsMarkedForConcurrentOptimization() || |
227 function->IsOptimized())) { | 234 function->IsOptimized())) { |
228 // Attempt OSR if we are still running unoptimized code even though the | 235 // Attempt OSR if we are still running unoptimized code even though the |
229 // the function has long been marked or even already been optimized. | 236 // the function has long been marked or even already been optimized. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } else { | 308 } else { |
302 shared_code->set_profiler_ticks(ticks + 1); | 309 shared_code->set_profiler_ticks(ticks + 1); |
303 } | 310 } |
304 } else { | 311 } else { |
305 shared_code->set_profiler_ticks(ticks + 1); | 312 shared_code->set_profiler_ticks(ticks + 1); |
306 } | 313 } |
307 } | 314 } |
308 | 315 |
309 void RuntimeProfiler::MaybeBaselineIgnition(JSFunction* function, | 316 void RuntimeProfiler::MaybeBaselineIgnition(JSFunction* function, |
310 JavaScriptFrame* frame) { | 317 JavaScriptFrame* frame) { |
311 if (function->IsInOptimizationQueue()) return; | 318 if (function->IsInOptimizationQueue()) { |
| 319 if (FLAG_trace_opt_verbose) { |
| 320 PrintF("[function "); |
| 321 function->PrintName(); |
| 322 PrintF(" is already in optimization queue]\n"); |
| 323 } |
| 324 return; |
| 325 } |
312 | 326 |
313 if (FLAG_always_osr) { | 327 if (FLAG_always_osr) { |
314 AttemptOnStackReplacement(frame, AbstractCode::kMaxLoopNestingMarker); | 328 AttemptOnStackReplacement(frame, AbstractCode::kMaxLoopNestingMarker); |
315 // Fall through and do a normal baseline compile as well. | 329 // Fall through and do a normal baseline compile as well. |
316 } else if (MaybeOSRIgnition(function, frame)) { | 330 } else if (MaybeOSRIgnition(function, frame)) { |
317 return; | 331 return; |
318 } | 332 } |
319 | 333 |
320 SharedFunctionInfo* shared = function->shared(); | 334 SharedFunctionInfo* shared = function->shared(); |
321 int ticks = shared->profiler_ticks(); | 335 int ticks = shared->profiler_ticks(); |
322 | 336 |
323 if (shared->optimization_disabled() && | 337 if (shared->optimization_disabled() && |
324 shared->disable_optimization_reason() == kOptimizationDisabledForTest) { | 338 shared->disable_optimization_reason() == kOptimizationDisabledForTest) { |
325 // Don't baseline functions which have been marked by NeverOptimizeFunction | 339 // Don't baseline functions which have been marked by NeverOptimizeFunction |
326 // in a test. | 340 // in a test. |
327 return; | 341 return; |
328 } | 342 } |
329 | 343 |
330 if (ticks >= kProfilerTicksBeforeBaseline) { | 344 if (ticks >= kProfilerTicksBeforeBaseline) { |
331 Baseline(function, OptimizationReason::kHotEnoughForBaseline); | 345 Baseline(function, OptimizationReason::kHotEnoughForBaseline); |
332 } | 346 } |
333 } | 347 } |
334 | 348 |
335 void RuntimeProfiler::MaybeOptimizeIgnition(JSFunction* function, | 349 void RuntimeProfiler::MaybeOptimizeIgnition(JSFunction* function, |
336 JavaScriptFrame* frame) { | 350 JavaScriptFrame* frame) { |
337 if (function->IsInOptimizationQueue()) return; | 351 if (function->IsInOptimizationQueue()) { |
| 352 if (FLAG_trace_opt_verbose) { |
| 353 PrintF("[function "); |
| 354 function->PrintName(); |
| 355 PrintF(" is already in optimization queue]\n"); |
| 356 } |
| 357 return; |
| 358 } |
338 | 359 |
339 if (FLAG_always_osr) { | 360 if (FLAG_always_osr) { |
340 AttemptOnStackReplacement(frame, AbstractCode::kMaxLoopNestingMarker); | 361 AttemptOnStackReplacement(frame, AbstractCode::kMaxLoopNestingMarker); |
341 // Fall through and do a normal optimized compile as well. | 362 // Fall through and do a normal optimized compile as well. |
342 } else if (MaybeOSRIgnition(function, frame)) { | 363 } else if (MaybeOSRIgnition(function, frame)) { |
343 return; | 364 return; |
344 } | 365 } |
345 | 366 |
346 SharedFunctionInfo* shared = function->shared(); | 367 SharedFunctionInfo* shared = function->shared(); |
347 int ticks = shared->profiler_ticks(); | 368 int ticks = shared->profiler_ticks(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 if (ticks < Smi::kMaxValue) { | 501 if (ticks < Smi::kMaxValue) { |
481 shared_function_info->set_profiler_ticks(ticks + 1); | 502 shared_function_info->set_profiler_ticks(ticks + 1); |
482 } | 503 } |
483 } | 504 } |
484 } | 505 } |
485 any_ic_changed_ = false; | 506 any_ic_changed_ = false; |
486 } | 507 } |
487 | 508 |
488 } // namespace internal | 509 } // namespace internal |
489 } // namespace v8 | 510 } // namespace v8 |
OLD | NEW |