Index: src/runtime/runtime-test.cc |
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc |
index 199c423971195f571103b52cfb7813eebcdb36ae..b7201f4c1a337247fa415fa21b3790210a96dfb8 100644 |
--- a/src/runtime/runtime-test.cc |
+++ b/src/runtime/runtime-test.cc |
@@ -127,6 +127,12 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { |
return isolate->heap()->undefined_value(); |
} |
+ // If function isn't compiled, compile it now. |
+ if (!function->shared()->is_compiled() && |
+ !Compiler::Compile(function, Compiler::CLEAR_EXCEPTION)) { |
+ return isolate->heap()->undefined_value(); |
+ } |
+ |
// If the function is already optimized, just return. |
if (function->IsOptimized()) return isolate->heap()->undefined_value(); |