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

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

Issue 2661133003: Merged: [Turbofan] don't optimize from bytecode > 250K in size. (Closed)
Patch Set: Created 3 years, 10 months 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 static const int kOSRCodeSizeAllowancePerTickIgnition = 50 static const int kOSRCodeSizeAllowancePerTickIgnition =
51 2 * interpreter::Interpreter::kCodeSizeMultiplier; 51 2 * interpreter::Interpreter::kCodeSizeMultiplier;
52 52
53 // Maximum size in bytes of generated code for a function to be optimized 53 // Maximum size in bytes of generated code for a function to be optimized
54 // the very first time it is seen on the stack. 54 // the very first time it is seen on the stack.
55 static const int kMaxSizeEarlyOpt = 55 static const int kMaxSizeEarlyOpt =
56 5 * FullCodeGenerator::kCodeSizeMultiplier; 56 5 * FullCodeGenerator::kCodeSizeMultiplier;
57 static const int kMaxSizeEarlyOptIgnition = 57 static const int kMaxSizeEarlyOptIgnition =
58 5 * interpreter::Interpreter::kCodeSizeMultiplier; 58 5 * interpreter::Interpreter::kCodeSizeMultiplier;
59 59
60 // Certain functions are simply too big to be worth optimizing.
61 // We aren't using the code size multiplier here because there is no
62 // "kMaxSizeOpt" with which we would need to normalize. This constant is
63 // only for optimization decisions coming into TurboFan from Ignition.
64 static const int kMaxSizeOptIgnition = 250 * 1024;
65
60 #define OPTIMIZATION_REASON_LIST(V) \ 66 #define OPTIMIZATION_REASON_LIST(V) \
61 V(DoNotOptimize, "do not optimize") \ 67 V(DoNotOptimize, "do not optimize") \
62 V(HotAndStable, "hot and stable") \ 68 V(HotAndStable, "hot and stable") \
63 V(HotEnoughForBaseline, "hot enough for baseline") \ 69 V(HotEnoughForBaseline, "hot enough for baseline") \
64 V(HotWithoutMuchTypeInfo, "not much type info but very hot") \ 70 V(HotWithoutMuchTypeInfo, "not much type info but very hot") \
65 V(SmallFunction, "small function") 71 V(SmallFunction, "small function")
66 72
67 enum class OptimizationReason : uint8_t { 73 enum class OptimizationReason : uint8_t {
68 #define OPTIMIZATION_REASON_CONSTANTS(Constant, message) k##Constant, 74 #define OPTIMIZATION_REASON_CONSTANTS(Constant, message) k##Constant,
69 OPTIMIZATION_REASON_LIST(OPTIMIZATION_REASON_CONSTANTS) 75 OPTIMIZATION_REASON_LIST(OPTIMIZATION_REASON_CONSTANTS)
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 return true; 393 return true;
388 } 394 }
389 return false; 395 return false;
390 } 396 }
391 397
392 OptimizationReason RuntimeProfiler::ShouldOptimizeIgnition( 398 OptimizationReason RuntimeProfiler::ShouldOptimizeIgnition(
393 JSFunction* function, JavaScriptFrame* frame) { 399 JSFunction* function, JavaScriptFrame* frame) {
394 SharedFunctionInfo* shared = function->shared(); 400 SharedFunctionInfo* shared = function->shared();
395 int ticks = shared->profiler_ticks(); 401 int ticks = shared->profiler_ticks();
396 402
403 if (shared->bytecode_array()->Size() > kMaxSizeOptIgnition) {
404 return OptimizationReason::kDoNotOptimize;
405 }
406
397 if (ticks >= kProfilerTicksBeforeOptimization) { 407 if (ticks >= kProfilerTicksBeforeOptimization) {
398 int typeinfo, generic, total, type_percentage, generic_percentage; 408 int typeinfo, generic, total, type_percentage, generic_percentage;
399 GetICCounts(function, &typeinfo, &generic, &total, &type_percentage, 409 GetICCounts(function, &typeinfo, &generic, &total, &type_percentage,
400 &generic_percentage); 410 &generic_percentage);
401 if (type_percentage >= FLAG_type_info_threshold && 411 if (type_percentage >= FLAG_type_info_threshold &&
402 generic_percentage <= FLAG_generic_ic_threshold) { 412 generic_percentage <= FLAG_generic_ic_threshold) {
403 // If this particular function hasn't had any ICs patched for enough 413 // If this particular function hasn't had any ICs patched for enough
404 // ticks, optimize it now. 414 // ticks, optimize it now.
405 return OptimizationReason::kHotAndStable; 415 return OptimizationReason::kHotAndStable;
406 } else if (ticks >= kTicksWhenNotEnoughTypeInfo) { 416 } else if (ticks >= kTicksWhenNotEnoughTypeInfo) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 if (ticks < Smi::kMaxValue) { 482 if (ticks < Smi::kMaxValue) {
473 shared_function_info->set_profiler_ticks(ticks + 1); 483 shared_function_info->set_profiler_ticks(ticks + 1);
474 } 484 }
475 } 485 }
476 } 486 }
477 any_ic_changed_ = false; 487 any_ic_changed_ = false;
478 } 488 }
479 489
480 } // namespace internal 490 } // namespace internal
481 } // namespace v8 491 } // 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