| Index: test/cctest/test-deoptimization.cc
|
| diff --git a/test/cctest/test-deoptimization.cc b/test/cctest/test-deoptimization.cc
|
| index dbbb3edb097d4fc7fc202b93c51611993778e926..05728a58b7e8ec022718085aea8facd358018883 100644
|
| --- a/test/cctest/test-deoptimization.cc
|
| +++ b/test/cctest/test-deoptimization.cc
|
| @@ -695,3 +695,27 @@ TEST(DeoptimizeLoadICStoreICNested) {
|
| CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
|
| CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value());
|
| }
|
| +
|
| +
|
| +TEST(ReoptimizeInstantly) {
|
| + i::FLAG_allow_natives_syntax = true;
|
| + i::FLAG_concurrent_recompilation = false;
|
| + if (!CcTest::i_isolate()->use_crankshaft()) return;
|
| + LocalContext env;
|
| + v8::HandleScope scope(env->GetIsolate());
|
| +
|
| + CompileRun(
|
| + "function f(x) {"
|
| + " return x;"
|
| + "};"
|
| + "f(0); f(0); f(0);"
|
| + "%OptimizeFunctionOnNextCall(f);"
|
| + "f(0);");
|
| + Handle<JSFunction> function = GetJSFunction(env->Global(), "f");
|
| + CHECK(function->IsOptimized());
|
| + function->code()->set_marked_for_instant_optimization(true);
|
| + CompileRun("%DeoptimizeFunction(f);");
|
| + CHECK(!function->IsOptimized());
|
| + CompileRun("f(0);");
|
| + CHECK(function->IsOptimized());
|
| +}
|
|
|