| Index: src/runtime-profiler.cc
|
| diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc
|
| index 04aa02edb3c8d8723a992ccf82e9eb5422bc146b..b0d121df708f1ca58977abe740415ee817f86fdf 100644
|
| --- a/src/runtime-profiler.cc
|
| +++ b/src/runtime-profiler.cc
|
| @@ -261,13 +261,14 @@ void RuntimeProfiler::OptimizeNow() {
|
| }
|
| }
|
|
|
| - if (function->IsMarkedForLazyRecompilation() &&
|
| - function->shared()->code()->kind() == Code::FUNCTION) {
|
| - Code* unoptimized = function->shared()->code();
|
| - int nesting = unoptimized->allow_osr_at_loop_nesting_level();
|
| + Code* shared_code = function->shared()->code();
|
| + if (shared_code->kind() != Code::FUNCTION) continue;
|
| +
|
| + if (function->IsMarkedForLazyRecompilation()) {
|
| + int nesting = shared_code->allow_osr_at_loop_nesting_level();
|
| if (nesting == 0) AttemptOnStackReplacement(function);
|
| int new_nesting = Min(nesting + 1, Code::kMaxLoopNestingMarker);
|
| - unoptimized->set_allow_osr_at_loop_nesting_level(new_nesting);
|
| + shared_code->set_allow_osr_at_loop_nesting_level(new_nesting);
|
| }
|
|
|
| // Do not record non-optimizable functions.
|
| @@ -285,7 +286,7 @@ void RuntimeProfiler::OptimizeNow() {
|
| }
|
|
|
| if (FLAG_watch_ic_patching) {
|
| - int ticks = function->shared()->profiler_ticks();
|
| + int ticks = shared_code->profiler_ticks();
|
|
|
| if (ticks >= kProfilerTicksBeforeOptimization) {
|
| int typeinfo, total, percentage;
|
| @@ -299,7 +300,7 @@ void RuntimeProfiler::OptimizeNow() {
|
| // seen a huge number of ticks, optimize it as it is.
|
| Optimize(function, "not much type info but very hot");
|
| } else {
|
| - function->shared()->set_profiler_ticks(ticks + 1);
|
| + shared_code->set_profiler_ticks(ticks + 1);
|
| if (FLAG_trace_opt_verbose) {
|
| PrintF("[not yet optimizing ");
|
| function->PrintName();
|
| @@ -308,7 +309,7 @@ void RuntimeProfiler::OptimizeNow() {
|
| }
|
| }
|
| } else if (!any_ic_changed_ &&
|
| - function->shared()->code()->instruction_size() < kMaxSizeEarlyOpt) {
|
| + shared_code->instruction_size() < kMaxSizeEarlyOpt) {
|
| // If no IC was patched since the last tick and this function is very
|
| // small, optimistically optimize it now.
|
| Optimize(function, "small function");
|
| @@ -321,7 +322,7 @@ void RuntimeProfiler::OptimizeNow() {
|
| // then type info might already be stable and we can optimize now.
|
| Optimize(function, "stable on startup");
|
| } else {
|
| - function->shared()->set_profiler_ticks(ticks + 1);
|
| + shared_code->set_profiler_ticks(ticks + 1);
|
| }
|
| } else { // !FLAG_watch_ic_patching
|
| samples[sample_count++] = function;
|
|
|