From 44350b3d49c47f91a7b9582c4974b710cff60515 Mon Sep 17 00:00:00 2001 From: titzer Date: Mon, 27 Apr 2015 07:24:49 -0700 Subject: [PATCH] Remove kOsrCompileFailed bailout. R=mstarzinger@chromium.org BUG= Review URL: https://codereview.chromium.org/1105133002 Cr-Commit-Position: refs/heads/master@{#28083} --- src/bailout-reason.h | 1 - src/compiler.cc | 9 +++++---- src/compiler/osr.cc | 6 ++---- src/compiler/osr.h | 3 +-- src/compiler/pipeline.cc | 11 +---------- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/bailout-reason.h b/src/bailout-reason.h index 09c889f..2e02808 100644 --- a/src/bailout-reason.h +++ b/src/bailout-reason.h @@ -323,7 +323,6 @@ namespace internal { "Wrong address or value passed to RecordWrite") \ V(kShouldNotDirectlyEnterOsrFunction, \ "Should not directly enter OSR-compiled function") \ - V(kOsrCompileFailed, "OSR compilation failed") \ V(kYield, "Yield") diff --git a/src/compiler.cc b/src/compiler.cc index a803d32..f44f092 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -357,7 +357,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { return AbortOptimization(kHydrogenFilter); } - // Crankshaft requires a version of fullcode with deoptimization support. + // Optimization requires a version of fullcode with deoptimization support. // Recompile the unoptimized version of the code if the current version // doesn't have deoptimization support already. // Otherwise, if we are gathering compilation time and space statistics @@ -378,9 +378,10 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { DCHECK(info()->shared_info()->has_deoptimization_support()); - // Check the whitelist for TurboFan. - if ((FLAG_turbo_asm && info()->shared_info()->asm_function()) || - info()->closure()->PassesFilter(FLAG_turbo_filter)) { + // Check the enabling conditions for TurboFan. + if (((FLAG_turbo_asm && info()->shared_info()->asm_function()) || + info()->closure()->PassesFilter(FLAG_turbo_filter)) && + (FLAG_turbo_osr || !info()->is_osr())) { if (FLAG_trace_opt) { OFStream os(stdout); os << "[compiling method " << Brief(*info()->closure()) diff --git a/src/compiler/osr.cc b/src/compiler/osr.cc index 2ab5d73..a603ce9 100644 --- a/src/compiler/osr.cc +++ b/src/compiler/osr.cc @@ -285,7 +285,7 @@ static void TransferOsrValueTypesFromLoopPhis(Zone* zone, Node* osr_loop_entry, } -bool OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, +void OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, Zone* tmp_zone) { Graph* graph = jsgraph->graph(); Node* osr_normal_entry = nullptr; @@ -303,7 +303,7 @@ bool OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, if (osr_loop_entry == nullptr) { // No OSR entry found, do nothing. CHECK(osr_normal_entry); - return true; + return; } for (Node* use : osr_loop_entry->uses()) { @@ -345,8 +345,6 @@ bool OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, // Run the normal control reduction, which naturally trims away the dead // parts of the graph. ControlReducer::ReduceGraph(tmp_zone, jsgraph, common); - - return true; } diff --git a/src/compiler/osr.h b/src/compiler/osr.h index 549bb5f..89773f0 100644 --- a/src/compiler/osr.h +++ b/src/compiler/osr.h @@ -99,8 +99,7 @@ class OsrHelper { // Deconstructs the artificial {OsrNormalEntry} and rewrites the graph so // that only the path corresponding to {OsrLoopEntry} remains. - // Return {false} if the OSR deconstruction failed somehow. - bool Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, + void Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common, Zone* tmp_zone); // Prepares the frame w.r.t. OSR. diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc index cb616fb..f6a5c05 100644 --- a/src/compiler/pipeline.cc +++ b/src/compiler/pipeline.cc @@ -524,9 +524,7 @@ struct OsrDeconstructionPhase { SourcePositionTable::Scope pos(data->source_positions(), SourcePosition::Unknown()); OsrHelper osr_helper(data->info()); - bool success = - osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); - if (!success) data->info()->RetryOptimization(kOsrCompileFailed); + osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); } }; @@ -919,12 +917,6 @@ void Pipeline::RunPrintAndVerify(const char* phase, bool untyped) { Handle Pipeline::GenerateCode() { - if (info()->is_osr() && !FLAG_turbo_osr) { - // TODO(turbofan): remove this flag and always handle OSR - info()->RetryOptimization(kOsrCompileFailed); - return Handle::null(); - } - // TODO(mstarzinger): This is just a temporary hack to make TurboFan work, // the correct solution is to restore the context register after invoking // builtins from full-codegen. @@ -1046,7 +1038,6 @@ Handle Pipeline::GenerateCode() { if (info()->is_osr()) { Run(); - if (info()->bailout_reason() != kNoReason) return Handle::null(); RunPrintAndVerify("OSR deconstruction"); } -- 2.7.4