Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: src/runtime-profiler.cc

Issue 2450233002: Check if the frame is optimized before marking a function for optimization. (Closed)
Patch Set: removed check for FLAG_ignition_OSR from MaybeOSRIgnition. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 int ticks = shared_code->profiler_ticks(); 259 int ticks = shared_code->profiler_ticks();
260 if (ticks >= kProfilerTicksBeforeReenablingOptimization) { 260 if (ticks >= kProfilerTicksBeforeReenablingOptimization) {
261 shared_code->set_profiler_ticks(0); 261 shared_code->set_profiler_ticks(0);
262 shared->TryReenableOptimization(); 262 shared->TryReenableOptimization();
263 } else { 263 } else {
264 shared_code->set_profiler_ticks(ticks + 1); 264 shared_code->set_profiler_ticks(ticks + 1);
265 } 265 }
266 } 266 }
267 return; 267 return;
268 } 268 }
269 if (function->IsOptimized()) return; 269 if (frame->is_optimized()) return;
270 270
271 int ticks = shared_code->profiler_ticks(); 271 int ticks = shared_code->profiler_ticks();
272 272
273 if (ticks >= kProfilerTicksBeforeOptimization) { 273 if (ticks >= kProfilerTicksBeforeOptimization) {
274 int typeinfo, generic, total, type_percentage, generic_percentage; 274 int typeinfo, generic, total, type_percentage, generic_percentage;
275 GetICCounts(function, &typeinfo, &generic, &total, &type_percentage, 275 GetICCounts(function, &typeinfo, &generic, &total, &type_percentage,
276 &generic_percentage); 276 &generic_percentage);
277 if (type_percentage >= FLAG_type_info_threshold && 277 if (type_percentage >= FLAG_type_info_threshold &&
278 generic_percentage <= FLAG_generic_ic_threshold) { 278 generic_percentage <= FLAG_generic_ic_threshold) {
279 // If this particular function hasn't had any ICs patched for enough 279 // If this particular function hasn't had any ICs patched for enough
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // If optimization was disabled due to many deoptimizations, 353 // If optimization was disabled due to many deoptimizations,
354 // then check if the function is hot and try to reenable optimization. 354 // then check if the function is hot and try to reenable optimization.
355 if (ticks >= kProfilerTicksBeforeReenablingOptimization) { 355 if (ticks >= kProfilerTicksBeforeReenablingOptimization) {
356 shared->set_profiler_ticks(0); 356 shared->set_profiler_ticks(0);
357 shared->TryReenableOptimization(); 357 shared->TryReenableOptimization();
358 } 358 }
359 } 359 }
360 return; 360 return;
361 } 361 }
362 362
363 if (function->IsOptimized()) return; 363 if (frame->is_optimized()) return;
364 364
365 OptimizationReason reason = ShouldOptimizeIgnition(function, frame); 365 OptimizationReason reason = ShouldOptimizeIgnition(function, frame);
366 366
367 if (reason != OptimizationReason::kDoNotOptimize) { 367 if (reason != OptimizationReason::kDoNotOptimize) {
368 Optimize(function, reason); 368 Optimize(function, reason);
369 } 369 }
370 } 370 }
371 371
372 bool RuntimeProfiler::MaybeOSRIgnition(JSFunction* function, 372 bool RuntimeProfiler::MaybeOSRIgnition(JSFunction* function,
373 JavaScriptFrame* frame) { 373 JavaScriptFrame* frame) {
374 if (!FLAG_ignition_osr) return false;
375
376 SharedFunctionInfo* shared = function->shared(); 374 SharedFunctionInfo* shared = function->shared();
377 int ticks = shared->profiler_ticks(); 375 int ticks = shared->profiler_ticks();
378 376
379 // TODO(rmcilroy): Also ensure we only OSR top-level code if it is smaller 377 // TODO(rmcilroy): Also ensure we only OSR top-level code if it is smaller
380 // than kMaxToplevelSourceSize. 378 // than kMaxToplevelSourceSize.
381 379
382 bool osr_before_baselined = function->IsMarkedForBaseline() && 380 bool osr_before_baselined = function->IsMarkedForBaseline() &&
383 ShouldOptimizeIgnition(function, frame) != 381 ShouldOptimizeIgnition(function, frame) !=
384 OptimizationReason::kDoNotOptimize; 382 OptimizationReason::kDoNotOptimize;
385 if (!frame->is_optimized() && 383 if (!frame->is_optimized() &&
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 } else { 477 } else {
480 DCHECK_EQ(next_tier, Compiler::OPTIMIZED); 478 DCHECK_EQ(next_tier, Compiler::OPTIMIZED);
481 MaybeOptimizeFullCodegen(function, frame, frame_count); 479 MaybeOptimizeFullCodegen(function, frame, frame_count);
482 } 480 }
483 } 481 }
484 any_ic_changed_ = false; 482 any_ic_changed_ = false;
485 } 483 }
486 484
487 } // namespace internal 485 } // namespace internal
488 } // namespace v8 486 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698