| Index: src/runtime/runtime-test.cc
|
| diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
|
| index 89e1f2a69662fee8051345cdcc86e6047990c145..7bf74cca57a8eaf983c8d079d97a9610e2e1a04e 100644
|
| --- a/src/runtime/runtime-test.cc
|
| +++ b/src/runtime/runtime-test.cc
|
| @@ -30,6 +30,36 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
|
| }
|
|
|
|
|
| +RUNTIME_FUNCTION(Runtime_DeoptimizeNow) {
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 0);
|
| +
|
| + Handle<JSFunction> function;
|
| +
|
| + // If the argument is 'undefined', deoptimize the topmost
|
| + // function.
|
| + JavaScriptFrameIterator it(isolate);
|
| + while (!it.done()) {
|
| + if (it.frame()->is_java_script()) {
|
| + function = Handle<JSFunction>(it.frame()->function());
|
| + break;
|
| + }
|
| + }
|
| + if (function.is_null()) return isolate->heap()->undefined_value();
|
| +
|
| + if (!function->IsOptimized()) return isolate->heap()->undefined_value();
|
| +
|
| + // TODO(turbofan): Deoptimization is not supported yet.
|
| + if (function->code()->is_turbofanned() && !FLAG_turbo_deoptimization) {
|
| + return isolate->heap()->undefined_value();
|
| + }
|
| +
|
| + Deoptimizer::DeoptimizeFunction(*function);
|
| +
|
| + return isolate->heap()->undefined_value();
|
| +}
|
| +
|
| +
|
| RUNTIME_FUNCTION(Runtime_RunningInSimulator) {
|
| SealHandleScope shs(isolate);
|
| DCHECK(args.length() == 0);
|
|
|