Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index f0c5edc53b1e8947646ddac4420a27a65d8149e9..7ff15ec69ee059c572f9c2b6507c1d012078df91 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -8632,7 +8632,14 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { |
HandleScope scope(isolate); |
RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
- |
+ // The following two assertions are lifted from the DCHECKs inside |
+ // JSFunction::MarkForOptimization(). |
+ RUNTIME_ASSERT(!function->shared()->is_generator()); |
+ RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() || |
+ (function->code()->kind() == Code::FUNCTION && |
+ function->code()->optimizable())); |
+ |
+ // If the function is optimized, just return. |
if (function->IsOptimized()) return isolate->heap()->undefined_value(); |
function->MarkForOptimization(); |