Index: src/runtime/runtime-test.cc |
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc |
index 4149b7891c41618cec845e83de5c331686b5d97b..2232b190599a2b1a3025ea72bb44ef23596130ce 100644 |
--- a/src/runtime/runtime-test.cc |
+++ b/src/runtime/runtime-test.cc |
@@ -37,6 +37,7 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { |
} |
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
+ // If the function is not optimized, just return. |
if (!function->IsOptimized()) return isolate->heap()->undefined_value(); |
// TODO(turbofan): Deoptimization is not supported yet. |
@@ -57,17 +58,12 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { |
Handle<JSFunction> function; |
- // If the argument is 'undefined', deoptimize the topmost |
- // function. |
+ // Find the JavaScript function on the top of the stack. |
JavaScriptFrameIterator it(isolate); |
- while (!it.done()) { |
- if (it.frame()->is_java_script()) { |
- function = Handle<JSFunction>(it.frame()->function()); |
- break; |
- } |
- } |
+ if (!it.done()) function = Handle<JSFunction>(it.frame()->function()); |
if (function.is_null()) return isolate->heap()->undefined_value(); |
+ // If the function is not optimized, just return. |
if (!function->IsOptimized()) return isolate->heap()->undefined_value(); |
// TODO(turbofan): Deoptimization is not supported yet. |
@@ -155,12 +151,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) { |
if (args.length() == 0) { |
// Find the JavaScript function on the top of the stack. |
JavaScriptFrameIterator it(isolate); |
- while (!it.done()) { |
- if (it.frame()->is_java_script()) { |
- function = Handle<JSFunction>(it.frame()->function()); |
- break; |
- } |
- } |
+ if (!it.done()) function = Handle<JSFunction>(it.frame()->function()); |
if (function.is_null()) return isolate->heap()->undefined_value(); |
} else { |
// Function was passed as an argument. |
@@ -168,13 +159,6 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) { |
function = arg; |
} |
- // The following condition was lifted from the DCHECK inside |
- // JSFunction::MarkForOptimization(). |
- if (!(function->shared()->allows_lazy_compilation() || |
- !function->shared()->optimization_disabled())) { |
- return isolate->heap()->undefined_value(); |
- } |
- |
// If function is interpreted but OSR hasn't been enabled, just return. |
if (function->shared()->HasBytecodeArray() && !FLAG_ignition_osr) { |
return isolate->heap()->undefined_value(); |