Index: src/runtime/runtime-test.cc |
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc |
index 2d331c9e83ee094cdaa91d9cd9c3225c5eba0906..df3d343c3d24b34da100a2aec88562d96db57ed1 100644 |
--- a/src/runtime/runtime-test.cc |
+++ b/src/runtime/runtime-test.cc |
@@ -177,6 +177,12 @@ RUNTIME_FUNCTION(Runtime_BaselineFunctionOnNextCall) { |
} |
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
+ // If function isn't compiled, compile it now. |
+ if (!function->shared()->is_compiled() && |
+ !Compiler::Compile(function, Compiler::CLEAR_EXCEPTION)) { |
+ return isolate->heap()->undefined_value(); |
+ } |
+ |
// 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 && |