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

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

Issue 2488703002: [Interpreter] Switch back to optimizing after 2 ticks for Ignition code. (Closed)
Patch Set: 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"
11 #include "src/compilation-cache.h" 11 #include "src/compilation-cache.h"
12 #include "src/compiler.h" 12 #include "src/compiler.h"
13 #include "src/execution.h" 13 #include "src/execution.h"
14 #include "src/frames-inl.h" 14 #include "src/frames-inl.h"
15 #include "src/full-codegen/full-codegen.h" 15 #include "src/full-codegen/full-codegen.h"
16 #include "src/global-handles.h" 16 #include "src/global-handles.h"
17 #include "src/interpreter/interpreter.h" 17 #include "src/interpreter/interpreter.h"
18 18
19 namespace v8 { 19 namespace v8 {
20 namespace internal { 20 namespace internal {
21 21
22 22
23 // Number of times a function has to be seen on the stack before it is 23 // Number of times a function has to be seen on the stack before it is
24 // compiled for baseline. 24 // compiled for baseline.
25 static const int kProfilerTicksBeforeBaseline = 1; 25 static const int kProfilerTicksBeforeBaseline = 1;
26 // Number of times a function has to be seen on the stack before it is 26 // Number of times a function has to be seen on the stack before it is
27 // optimized. 27 // optimized.
28 static const int kProfilerTicksBeforeOptimization = 2; 28 static const int kProfilerTicksBeforeOptimization = 2;
29 // Number of times a interpreted function has to be seen on the stack before
30 // it is optimized (with Turbofan, ignition is only optimized with Turbofan).
31 static const int kProfilerTicksBeforeOptimizingInterpretedFunction = 4;
32 // If the function optimization was disabled due to high deoptimization count, 29 // If the function optimization was disabled due to high deoptimization count,
33 // but the function is hot and has been seen on the stack this number of times, 30 // but the function is hot and has been seen on the stack this number of times,
34 // then we try to reenable optimization for this function. 31 // then we try to reenable optimization for this function.
35 static const int kProfilerTicksBeforeReenablingOptimization = 250; 32 static const int kProfilerTicksBeforeReenablingOptimization = 250;
36 // If a function does not have enough type info (according to 33 // If a function does not have enough type info (according to
37 // FLAG_type_info_threshold), but has seen a huge number of ticks, 34 // FLAG_type_info_threshold), but has seen a huge number of ticks,
38 // optimize it as it is. 35 // optimize it as it is.
39 static const int kTicksWhenNotEnoughTypeInfo = 100; 36 static const int kTicksWhenNotEnoughTypeInfo = 100;
40 // We only have one byte to store the number of ticks. 37 // We only have one byte to store the number of ticks.
41 STATIC_ASSERT(kProfilerTicksBeforeOptimization < 256); 38 STATIC_ASSERT(kProfilerTicksBeforeOptimization < 256);
42 STATIC_ASSERT(kProfilerTicksBeforeOptimizingInterpretedFunction < 256);
43 STATIC_ASSERT(kProfilerTicksBeforeReenablingOptimization < 256); 39 STATIC_ASSERT(kProfilerTicksBeforeReenablingOptimization < 256);
44 STATIC_ASSERT(kTicksWhenNotEnoughTypeInfo < 256); 40 STATIC_ASSERT(kTicksWhenNotEnoughTypeInfo < 256);
45 41
46 // Maximum size in bytes of generate code for a function to allow OSR. 42 // Maximum size in bytes of generate code for a function to allow OSR.
47 static const int kOSRCodeSizeAllowanceBase = 43 static const int kOSRCodeSizeAllowanceBase =
48 100 * FullCodeGenerator::kCodeSizeMultiplier; 44 100 * FullCodeGenerator::kCodeSizeMultiplier;
49 static const int kOSRCodeSizeAllowanceBaseIgnition = 45 static const int kOSRCodeSizeAllowanceBaseIgnition =
50 10 * interpreter::Interpreter::kCodeSizeMultiplier; 46 10 * interpreter::Interpreter::kCodeSizeMultiplier;
51 47
52 static const int kOSRCodeSizeAllowancePerTick = 48 static const int kOSRCodeSizeAllowancePerTick =
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return true; 392 return true;
397 } 393 }
398 return false; 394 return false;
399 } 395 }
400 396
401 OptimizationReason RuntimeProfiler::ShouldOptimizeIgnition( 397 OptimizationReason RuntimeProfiler::ShouldOptimizeIgnition(
402 JSFunction* function, JavaScriptFrame* frame) { 398 JSFunction* function, JavaScriptFrame* frame) {
403 SharedFunctionInfo* shared = function->shared(); 399 SharedFunctionInfo* shared = function->shared();
404 int ticks = shared->profiler_ticks(); 400 int ticks = shared->profiler_ticks();
405 401
406 if (ticks >= kProfilerTicksBeforeOptimizingInterpretedFunction) { 402 if (ticks >= kProfilerTicksBeforeOptimization) {
407 int typeinfo, generic, total, type_percentage, generic_percentage; 403 int typeinfo, generic, total, type_percentage, generic_percentage;
408 GetICCounts(function, &typeinfo, &generic, &total, &type_percentage, 404 GetICCounts(function, &typeinfo, &generic, &total, &type_percentage,
409 &generic_percentage); 405 &generic_percentage);
410 if (type_percentage >= FLAG_type_info_threshold && 406 if (type_percentage >= FLAG_type_info_threshold &&
411 generic_percentage <= FLAG_generic_ic_threshold) { 407 generic_percentage <= FLAG_generic_ic_threshold) {
412 // If this particular function hasn't had any ICs patched for enough 408 // If this particular function hasn't had any ICs patched for enough
413 // ticks, optimize it now. 409 // ticks, optimize it now.
414 return OptimizationReason::kHotAndStable; 410 return OptimizationReason::kHotAndStable;
415 } else if (ticks >= kTicksWhenNotEnoughTypeInfo) { 411 } else if (ticks >= kTicksWhenNotEnoughTypeInfo) {
416 return OptimizationReason::kHotWithoutMuchTypeInfo; 412 return OptimizationReason::kHotWithoutMuchTypeInfo;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } else { 474 } else {
479 DCHECK_EQ(next_tier, Compiler::OPTIMIZED); 475 DCHECK_EQ(next_tier, Compiler::OPTIMIZED);
480 MaybeOptimizeFullCodegen(function, frame, frame_count); 476 MaybeOptimizeFullCodegen(function, frame, frame_count);
481 } 477 }
482 } 478 }
483 any_ic_changed_ = false; 479 any_ic_changed_ = false;
484 } 480 }
485 481
486 } // namespace internal 482 } // namespace internal
487 } // namespace v8 483 } // 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