| Index: src/runtime-profiler.cc
|
| diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc
|
| index 9b7dd34ccd1d61c6fdd6075cdd4de61c24c4ffd1..c4b79b11b5ef8d2537cf96b8b6626b110699269c 100644
|
| --- a/src/runtime-profiler.cc
|
| +++ b/src/runtime-profiler.cc
|
| @@ -80,17 +80,11 @@ STATIC_ASSERT(kProfilerTicksBeforeOptimization < 256);
|
| STATIC_ASSERT(kProfilerTicksBeforeReenablingOptimization < 256);
|
| STATIC_ASSERT(kTicksWhenNotEnoughTypeInfo < 256);
|
|
|
| -// Maximum size in bytes of generate code for a function to allow OSR.
|
| -static const int kOSRCodeSizeAllowanceBase =
|
| - 100 * FullCodeGenerator::kCodeSizeMultiplier;
|
| -
|
| -static const int kOSRCodeSizeAllowancePerTick =
|
| - 3 * FullCodeGenerator::kCodeSizeMultiplier;
|
|
|
| // Maximum size in bytes of generated code for a function to be optimized
|
| // the very first time it is seen on the stack.
|
| static const int kMaxSizeEarlyOpt =
|
| - 5 * FullCodeGenerator::kCodeSizeMultiplier;
|
| + 5 * FullCodeGenerator::kBackEdgeDistanceUnit;
|
|
|
|
|
| RuntimeProfiler::RuntimeProfiler(Isolate* isolate)
|
| @@ -106,13 +100,14 @@ RuntimeProfiler::RuntimeProfiler(Isolate* isolate)
|
| }
|
|
|
|
|
| -static void GetICCounts(Code* shared_code,
|
| +static void GetICCounts(JSFunction* function,
|
| int* ic_with_type_info_count,
|
| int* ic_total_count,
|
| int* percentage) {
|
| *ic_total_count = 0;
|
| *ic_with_type_info_count = 0;
|
| - Object* raw_info = shared_code->type_feedback_info();
|
| + Object* raw_info =
|
| + function->shared()->code()->type_feedback_info();
|
| if (raw_info->IsTypeFeedbackInfo()) {
|
| TypeFeedbackInfo* info = TypeFeedbackInfo::cast(raw_info);
|
| *ic_with_type_info_count = info->ic_with_type_info_count();
|
| @@ -133,7 +128,7 @@ void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) {
|
| PrintF(" for recompilation, reason: %s", reason);
|
| if (FLAG_type_info_threshold > 0) {
|
| int typeinfo, total, percentage;
|
| - GetICCounts(function->shared()->code(), &typeinfo, &total, &percentage);
|
| + GetICCounts(function, &typeinfo, &total, &percentage);
|
| PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage);
|
| }
|
| PrintF("]\n");
|
| @@ -279,20 +274,12 @@ void RuntimeProfiler::OptimizeNow() {
|
| (function->IsMarkedForLazyRecompilation() ||
|
| function->IsMarkedForParallelRecompilation() ||
|
| function->IsOptimized())) {
|
| - int ticks = shared_code->profiler_ticks();
|
| - int allowance = kOSRCodeSizeAllowanceBase +
|
| - ticks * kOSRCodeSizeAllowancePerTick;
|
| - if (shared_code->CodeSize() > allowance) {
|
| - if (ticks < 255) shared_code->set_profiler_ticks(ticks + 1);
|
| - } else {
|
| - int nesting = shared_code->allow_osr_at_loop_nesting_level();
|
| - if (nesting < Code::kMaxLoopNestingMarker) {
|
| - int new_nesting = nesting + 1;
|
| - shared_code->set_allow_osr_at_loop_nesting_level(new_nesting);
|
| - AttemptOnStackReplacement(function);
|
| - }
|
| + int nesting = shared_code->allow_osr_at_loop_nesting_level();
|
| + if (nesting < Code::kMaxLoopNestingMarker) {
|
| + int new_nesting = nesting + 1;
|
| + shared_code->set_allow_osr_at_loop_nesting_level(new_nesting);
|
| + AttemptOnStackReplacement(function);
|
| }
|
| - continue;
|
| }
|
|
|
| // Only record top-level code on top of the execution stack and
|
| @@ -326,7 +313,7 @@ void RuntimeProfiler::OptimizeNow() {
|
|
|
| if (ticks >= kProfilerTicksBeforeOptimization) {
|
| int typeinfo, total, percentage;
|
| - GetICCounts(shared_code, &typeinfo, &total, &percentage);
|
| + GetICCounts(function, &typeinfo, &total, &percentage);
|
| if (percentage >= FLAG_type_info_threshold) {
|
| // If this particular function hasn't had any ICs patched for enough
|
| // ticks, optimize it now.
|
|
|