Commit bf10f659 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[turbofan] Better recognize AstGraphBuilder'ed code.

This makes the runtime rely on the {HasBytecodeArray} predicate to
determine whether code generated by TurboFan was build without any
deoptimization support, as opposed to {asm_function}.

R=rmcilroy@chromium.org
BUG=v8:6589

Change-Id: Id124bed47a5fa02d31ff8fd3eee561b2df6c9226
Reviewed-on: https://chromium-review.googlesource.com/571786Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46694}
parent 182caaf4
......@@ -27,9 +27,9 @@ FrameInspector::FrameInspector(StandardFrame* frame, int inlined_frame_index,
// Calculate the deoptimized frame.
if (is_optimized_) {
DCHECK(js_frame != nullptr);
// TODO(turbofan): Revisit once we support deoptimization.
// TODO(turbofan): Deoptimization from AstGraphBuilder is not supported.
if (js_frame->LookupCode()->is_turbofanned() &&
js_frame->function()->shared()->asm_function()) {
!js_frame->function()->shared()->HasBytecodeArray()) {
is_optimized_ = false;
return;
}
......@@ -73,10 +73,10 @@ Handle<Object> FrameInspector::GetParameter(int index) {
}
Handle<Object> FrameInspector::GetExpression(int index) {
// TODO(turbofan): Revisit once we support deoptimization.
// TODO(turbofan): Deoptimization from AstGraphBuilder is not supported.
if (frame_->is_java_script() &&
javascript_frame()->LookupCode()->is_turbofanned() &&
javascript_frame()->function()->shared()->asm_function()) {
!javascript_frame()->function()->shared()->HasBytecodeArray()) {
return isolate_->factory()->undefined_value();
}
return is_optimized_ ? deoptimized_frame_->GetExpression(index)
......
......@@ -290,16 +290,17 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) {
int deopt_index = safepoint.deoptimization_index();
// Turbofan deopt is checked when we are patching addresses on stack.
bool turbofanned =
code->is_turbofanned() && function->shared()->asm_function();
bool safe_to_deopt =
deopt_index != Safepoint::kNoDeoptimizationIndex || turbofanned;
bool builtin = code->kind() == Code::BUILTIN;
CHECK(topmost_optimized_code == NULL || safe_to_deopt || turbofanned ||
builtin);
bool is_non_deoptimizing_asm_code =
code->is_turbofanned() && !function->shared()->HasBytecodeArray();
bool safe_if_deopt_triggered =
deopt_index != Safepoint::kNoDeoptimizationIndex ||
is_non_deoptimizing_asm_code;
bool is_builtin_code = code->kind() == Code::BUILTIN;
CHECK(topmost_optimized_code == NULL || safe_if_deopt_triggered ||
is_non_deoptimizing_asm_code || is_builtin_code);
if (topmost_optimized_code == NULL) {
topmost_optimized_code = code;
safe_to_deopt_topmost_optimized_code = safe_to_deopt;
safe_to_deopt_topmost_optimized_code = safe_if_deopt_triggered;
}
}
}
......
......@@ -1164,8 +1164,8 @@ int JavaScriptBuiltinContinuationFrame::ComputeParametersCount() const {
namespace {
bool CannotDeoptFromAsmCode(Code* code, JSFunction* function) {
return code->is_turbofanned() && function->shared()->asm_function();
bool IsNonDeoptimizingAsmCode(Code* code, JSFunction* function) {
return code->is_turbofanned() && !function->shared()->HasBytecodeArray();
}
} // namespace
......@@ -1182,7 +1182,7 @@ FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary(
is_constructor_(is_constructor) {
DCHECK(abstract_code->IsBytecodeArray() ||
Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION ||
CannotDeoptFromAsmCode(Code::cast(abstract_code), function) ||
IsNonDeoptimizingAsmCode(Code::cast(abstract_code), function) ||
mode == kApproximateSummary);
}
......@@ -1366,7 +1366,7 @@ void OptimizedFrame::Summarize(List<FrameSummary>* frames,
// TODO(turbofan): Revisit once we support deoptimization across the board.
Code* code = LookupCode();
if (code->kind() == Code::BUILTIN ||
CannotDeoptFromAsmCode(code, function())) {
IsNonDeoptimizingAsmCode(code, function())) {
return JavaScriptFrame::Summarize(frames);
}
......@@ -1529,7 +1529,7 @@ void OptimizedFrame::GetFunctions(List<SharedFunctionInfo*>* functions) const {
// TODO(turbofan): Revisit once we support deoptimization across the board.
Code* code = LookupCode();
if (code->kind() == Code::BUILTIN ||
CannotDeoptFromAsmCode(code, function())) {
IsNonDeoptimizingAsmCode(code, function())) {
return JavaScriptFrame::GetFunctions(functions);
}
......
......@@ -126,9 +126,9 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
// If the function is not optimized, just return.
if (!function->IsOptimized()) return isolate->heap()->undefined_value();
// TODO(turbofan): Deoptimization is not supported yet.
// TODO(turbofan): Deoptimization from AstGraphBuilder is not supported.
if (function->code()->is_turbofanned() &&
function->shared()->asm_function()) {
!function->shared()->HasBytecodeArray()) {
return isolate->heap()->undefined_value();
}
......@@ -152,9 +152,9 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) {
// If the function is not optimized, just return.
if (!function->IsOptimized()) return isolate->heap()->undefined_value();
// TODO(turbofan): Deoptimization is not supported yet.
// TODO(turbofan): Deoptimization from AstGraphBuilder is not supported.
if (function->code()->is_turbofanned() &&
function->shared()->asm_function()) {
!function->shared()->HasBytecodeArray()) {
return isolate->heap()->undefined_value();
}
......
......@@ -70,11 +70,6 @@
'*': [SKIP],
}], # variant == wasm_traps
##############################################################################
['variant == fullcode', {
'debug/es6/debug-blockscopes': [SKIP],
}], # variant == fullcodegen
##############################################################################
['arch == arm and not simulator_run', {
# Too slow on chromebooks.
......
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --opt --no-always-opt
// Flags: --allow-natives-syntax --opt --no-always-opt --no-stress-fullcodegen
// Verifies that the KeyedStoreIC correctly handles out-of-bounds stores
// to an array that grow it by a single element. Test functions are
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --opt --no-always-opt
// Flags: --allow-natives-syntax --opt --no-always-opt --no-stress-fullcodegen
function foo(i, deopt = false) {
if (i == 0) {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --opt --no-always-opt
// Flags: --allow-natives-syntax --opt --no-always-opt --no-stress-fullcodegen
function foo(i, deopt = false) {
if (i == 0) {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --opt --no-always-opt
// Flags: --allow-natives-syntax --opt --no-always-opt --no-stress-fullcodegen
function foo() {}
......
......@@ -597,16 +597,6 @@
##############################################################################
['variant == fullcode', {
'es6/array-iterator-turbo': [SKIP],
# TODO(6589) Crashing when changing tests to actually use full-codegen.
'regress/regress-4388': [SKIP],
'regress/regress-5404': [SKIP],
'regress/regress-v8-5697': [SKIP],
'regress/regress-crbug-489293': [SKIP],
'array-store-and-grow': [SKIP],
'es6/block-let-crankshaft': [SKIP],
'es6/block-let-crankshaft-sloppy': [SKIP],
'object-seal': [SKIP],
}], # variant == nocranshaft
##############################################################################
......
......@@ -28,7 +28,7 @@
// Tests the Object.seal and Object.isSealed methods - ES 19.1.2.17 and
// ES 19.1.2.13
// Flags: --allow-natives-syntax --opt --noalways-opt
// Flags: --allow-natives-syntax --opt --noalways-opt --no-stress-fullcodegen
// Test that we return obj if non-object is passed as argument
var non_objects = new Array(undefined, null, 1, -1, 0, 42.43, Symbol("test"));
......
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