Commit 5c1c023b authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[runtime] Fix stack frame iteration in test methods.

R=bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/2188713002
Cr-Commit-Position: refs/heads/master@{#38164}
parent 7d54e913
...@@ -37,6 +37,7 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { ...@@ -37,6 +37,7 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
} }
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
// If the function is not optimized, just return.
if (!function->IsOptimized()) return isolate->heap()->undefined_value(); if (!function->IsOptimized()) return isolate->heap()->undefined_value();
// TODO(turbofan): Deoptimization is not supported yet. // TODO(turbofan): Deoptimization is not supported yet.
...@@ -57,17 +58,12 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { ...@@ -57,17 +58,12 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) {
Handle<JSFunction> function; Handle<JSFunction> function;
// If the argument is 'undefined', deoptimize the topmost // Find the JavaScript function on the top of the stack.
// function.
JavaScriptFrameIterator it(isolate); JavaScriptFrameIterator it(isolate);
while (!it.done()) { if (!it.done()) function = Handle<JSFunction>(it.frame()->function());
if (it.frame()->is_java_script()) {
function = Handle<JSFunction>(it.frame()->function());
break;
}
}
if (function.is_null()) return isolate->heap()->undefined_value(); 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(); if (!function->IsOptimized()) return isolate->heap()->undefined_value();
// TODO(turbofan): Deoptimization is not supported yet. // TODO(turbofan): Deoptimization is not supported yet.
...@@ -155,12 +151,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) { ...@@ -155,12 +151,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
if (args.length() == 0) { if (args.length() == 0) {
// Find the JavaScript function on the top of the stack. // Find the JavaScript function on the top of the stack.
JavaScriptFrameIterator it(isolate); JavaScriptFrameIterator it(isolate);
while (!it.done()) { if (!it.done()) function = Handle<JSFunction>(it.frame()->function());
if (it.frame()->is_java_script()) {
function = Handle<JSFunction>(it.frame()->function());
break;
}
}
if (function.is_null()) return isolate->heap()->undefined_value(); if (function.is_null()) return isolate->heap()->undefined_value();
} else { } else {
// Function was passed as an argument. // Function was passed as an argument.
...@@ -168,13 +159,6 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) { ...@@ -168,13 +159,6 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
function = arg; 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 is interpreted but OSR hasn't been enabled, just return.
if (function->shared()->HasBytecodeArray() && !FLAG_ignition_osr) { if (function->shared()->HasBytecodeArray() && !FLAG_ignition_osr) {
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment