| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index 11155420c1f49531e916d36f9029bd1c16c96a17..098bf27735aa74d39b4661603d2c06f8e607b5f9 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -8590,10 +8590,22 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RunningInSimulator) {
|
|
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) {
|
| HandleScope scope(isolate);
|
| - ASSERT(args.length() == 1);
|
| + ASSERT(args.length() == 1 || args.length() == 2);
|
| CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
| +
|
| if (!function->IsOptimizable()) return isolate->heap()->undefined_value();
|
| function->MarkForLazyRecompilation();
|
| +
|
| + Code* unoptimized = function->shared()->code();
|
| + if (args.length() == 2 &&
|
| + unoptimized->kind() == Code::FUNCTION) {
|
| + CONVERT_ARG_HANDLE_CHECKED(String, type, 1);
|
| + CHECK(type->IsEqualTo(CStrVector("osr")));
|
| + isolate->runtime_profiler()->AttemptOnStackReplacement(*function);
|
| + unoptimized->set_allow_osr_at_loop_nesting_level(
|
| + Code::kMaxLoopNestingMarker);
|
| + }
|
| +
|
| return isolate->heap()->undefined_value();
|
| }
|
|
|
|
|