| Index: src/runtime/runtime-test.cc
|
| diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
|
| index 36d359712e541066ca24dd8c81cece0be4121909..356c6c771720c27116f0784f1412e2b92a91d543 100644
|
| --- a/src/runtime/runtime-test.cc
|
| +++ b/src/runtime/runtime-test.cc
|
| @@ -140,6 +140,46 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
|
| return isolate->heap()->undefined_value();
|
| }
|
|
|
| +RUNTIME_FUNCTION(Runtime_InterpretFunctionOnNextCall) {
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 1);
|
| + CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
|
| + if (!function_object->IsJSFunction()) {
|
| + return isolate->heap()->undefined_value();
|
| + }
|
| + Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
|
| +
|
| + // Do not tier down if we are already on optimized code. Replacing optimized
|
| + // code without actual deoptimization can lead to funny bugs.
|
| + if (function->code()->kind() != Code::OPTIMIZED_FUNCTION &&
|
| + function->shared()->HasBytecodeArray()) {
|
| + function->ReplaceCode(*isolate->builtins()->InterpreterEntryTrampoline());
|
| + }
|
| + return isolate->heap()->undefined_value();
|
| +}
|
| +
|
| +RUNTIME_FUNCTION(Runtime_BaselineFunctionOnNextCall) {
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 1);
|
| + CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
|
| + if (!function_object->IsJSFunction()) {
|
| + return isolate->heap()->undefined_value();
|
| + }
|
| + Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
|
| +
|
| + // Do not tier down if we are already on optimized code. Replacing optimized
|
| + // code without actual deoptimization can lead to funny bugs.
|
| + if (function->code()->kind() != Code::OPTIMIZED_FUNCTION &&
|
| + function->code()->kind() != Code::FUNCTION) {
|
| + if (function->shared()->HasBaselineCode()) {
|
| + function->ReplaceCode(function->shared()->code());
|
| + } else {
|
| + function->MarkForBaseline();
|
| + }
|
| + }
|
| +
|
| + return isolate->heap()->undefined_value();
|
| +}
|
|
|
| RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
|
| HandleScope scope(isolate);
|
|
|