From 4a7698fcddf16f062238c12f8155ee8d51ae8863 Mon Sep 17 00:00:00 2001 From: Michael Starzinger Date: Fri, 17 Nov 2017 12:34:58 +0100 Subject: [PATCH] [runtime] Remove support for missing deoptimization. This removes support for optimized frame which lack deoptimization information. All optimized JavaScript frames now imply that the underlying bytecode is available too. R=rmcilroy@chromium.org BUG=v8:6409 Change-Id: Ie73c0a376002466884388f1da9e1ec2741884596 Reviewed-on: https://chromium-review.googlesource.com/612162 Commit-Queue: Michael Starzinger Reviewed-by: Yang Guo Reviewed-by: Ross McIlroy Cr-Commit-Position: refs/heads/master@{#49442} --- src/debug/debug-frames.cc | 13 ------------- src/deoptimizer.cc | 7 ++----- src/frames.cc | 17 +++-------------- src/runtime/runtime-test.cc | 12 ------------ 4 files changed, 5 insertions(+), 44 deletions(-) diff --git a/src/debug/debug-frames.cc b/src/debug/debug-frames.cc index 805fcc7c7a..7cacb3ffba 100644 --- a/src/debug/debug-frames.cc +++ b/src/debug/debug-frames.cc @@ -39,13 +39,6 @@ FrameInspector::FrameInspector(StandardFrame* frame, int inlined_frame_index, // Calculate the deoptimized frame. if (is_optimized_) { DCHECK_NOT_NULL(js_frame); - // TODO(turbofan): Deoptimization from AstGraphBuilder is not supported. - if (js_frame->LookupCode()->is_turbofanned() && - !js_frame->function()->shared()->HasBytecodeArray()) { - is_optimized_ = false; - return; - } - deoptimized_frame_.reset(Deoptimizer::DebuggerInspectableFrame( js_frame, inlined_frame_index, isolate)); } else if (frame_->is_wasm_interpreter_entry()) { @@ -75,12 +68,6 @@ Handle FrameInspector::GetParameter(int index) { } Handle FrameInspector::GetExpression(int index) { - // TODO(turbofan): Deoptimization from AstGraphBuilder is not supported. - if (frame_->is_java_script() && - javascript_frame()->LookupCode()->is_turbofanned() && - !javascript_frame()->function()->shared()->HasBytecodeArray()) { - return isolate_->factory()->undefined_value(); - } return is_optimized_ ? deoptimized_frame_->GetExpression(index) : handle(frame_->GetExpression(index), isolate_); } diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc index 17a259222f..1ccc43ac68 100644 --- a/src/deoptimizer.cc +++ b/src/deoptimizer.cc @@ -198,14 +198,11 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) { int deopt_index = safepoint.deoptimization_index(); // Turbofan deopt is checked when we are patching addresses on stack. - 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; + deopt_index != Safepoint::kNoDeoptimizationIndex; bool is_builtin_code = code->kind() == Code::BUILTIN; DCHECK(topmost_optimized_code == nullptr || safe_if_deopt_triggered || - is_non_deoptimizing_asm_code || is_builtin_code); + is_builtin_code); if (topmost_optimized_code == nullptr) { topmost_optimized_code = code; safe_to_deopt_topmost_optimized_code = safe_if_deopt_triggered; diff --git a/src/frames.cc b/src/frames.cc index f0b81f5945..2ffc50a4f0 100644 --- a/src/frames.cc +++ b/src/frames.cc @@ -1132,14 +1132,6 @@ int JavaScriptBuiltinContinuationFrame::ComputeParametersCount() const { return Smi::ToInt(argc_object); } -namespace { - -bool IsNonDeoptimizingAsmCode(Code* code, JSFunction* function) { - return code->is_turbofanned() && !function->shared()->HasBytecodeArray(); -} - -} // namespace - FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary( Isolate* isolate, Object* receiver, JSFunction* function, AbstractCode* abstract_code, int code_offset, bool is_constructor) @@ -1150,8 +1142,7 @@ FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary( code_offset_(code_offset), is_constructor_(is_constructor) { DCHECK(abstract_code->IsBytecodeArray() || - Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION || - IsNonDeoptimizingAsmCode(Code::cast(abstract_code), function)); + Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION); } bool FrameSummary::JavaScriptFrameSummary::is_subject_to_debugging() const { @@ -1327,8 +1318,7 @@ void OptimizedFrame::Summarize(std::vector* frames) const { // Delegate to JS frame in absence of turbofan deoptimization. // TODO(turbofan): Revisit once we support deoptimization across the board. Code* code = LookupCode(); - if (code->kind() == Code::BUILTIN || - IsNonDeoptimizingAsmCode(code, function())) { + if (code->kind() == Code::BUILTIN) { return JavaScriptFrame::Summarize(frames); } @@ -1466,8 +1456,7 @@ void OptimizedFrame::GetFunctions( // Delegate to JS frame in absence of turbofan deoptimization. // TODO(turbofan): Revisit once we support deoptimization across the board. Code* code = LookupCode(); - if (code->kind() == Code::BUILTIN || - IsNonDeoptimizingAsmCode(code, function())) { + if (code->kind() == Code::BUILTIN) { return JavaScriptFrame::GetFunctions(functions); } diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc index 6dac58eb26..0ed9bdaa26 100644 --- a/src/runtime/runtime-test.cc +++ b/src/runtime/runtime-test.cc @@ -127,12 +127,6 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { // If the function is not optimized, just return. if (!function->IsOptimized()) return isolate->heap()->undefined_value(); - // TODO(turbofan): Deoptimization from AstGraphBuilder is not supported. - if (function->code()->is_turbofanned() && - !function->shared()->HasBytecodeArray()) { - return isolate->heap()->undefined_value(); - } - Deoptimizer::DeoptimizeFunction(*function); return isolate->heap()->undefined_value(); @@ -153,12 +147,6 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { // If the function is not optimized, just return. if (!function->IsOptimized()) return isolate->heap()->undefined_value(); - // TODO(turbofan): Deoptimization from AstGraphBuilder is not supported. - if (function->code()->is_turbofanned() && - !function->shared()->HasBytecodeArray()) { - return isolate->heap()->undefined_value(); - } - Deoptimizer::DeoptimizeFunction(*function); return isolate->heap()->undefined_value();