diff --git a/[refs] b/[refs] index fcc5f44ea8f5..5673c01feb48 100644 --- a/[refs] +++ b/[refs] @@ -911,7 +911,7 @@ refs/tags/2.3.0-flutter-1.5.4-hotfix.1: a1668566e563aef64025d0af88a099cbbe847b7e refs/tags/2.3.1: 929b013ddc83a013b49a98fc28b6b503a972bddd refs/tags/2.3.1-dev.0.0: 1d1742efd39cd4762b844b510acf8c2f1fa6604e refs/tags/2.3.2-dev.0.0: c567183bac8a895014d79cd3bf1d8908d45547d6 -refs/heads/beta: 71f1a615f4dd95d632eea6b291d8fd3446d57e4e +refs/heads/beta: c7ac27bf504cca030881208eb0b056a5a7ff93c2 refs/heads/sjindel.mep: b113b36c157cf54b257e82550e9bbde16f05ad8d refs/tags/2.3.2: f7ab96133aa79301daf812ef40b33c99d8ad1495 refs/tags/2.3.2-dev.0.1: ef57e27c9798b54a54e9a1f74b1bd1f9be7290b1 diff --git a/branches/beta/runtime/vm/compiler/aot/precompiler.cc b/branches/beta/runtime/vm/compiler/aot/precompiler.cc index d34a282f28cc..23c38fa1c169 100644 --- a/branches/beta/runtime/vm/compiler/aot/precompiler.cc +++ b/branches/beta/runtime/vm/compiler/aot/precompiler.cc @@ -2285,7 +2285,12 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { pass_state.reorder_blocks = FlowGraph::ShouldReorderBlocks(function, optimized()); - if (optimized()) { + if (function.ForceOptimize()) { + ASSERT(optimized()); + TIMELINE_DURATION(thread(), CompilerVerbose, "OptimizationPasses"); + flow_graph = CompilerPass::RunForceOptimizedPipeline(CompilerPass::kAOT, + &pass_state); + } else if (optimized()) { TIMELINE_DURATION(thread(), CompilerVerbose, "OptimizationPasses"); pass_state.inline_id_to_function.Add(&function); diff --git a/branches/beta/runtime/vm/compiler/compiler_pass.cc b/branches/beta/runtime/vm/compiler/compiler_pass.cc index aec1843d3ead..110498d6fc68 100644 --- a/branches/beta/runtime/vm/compiler/compiler_pass.cc +++ b/branches/beta/runtime/vm/compiler/compiler_pass.cc @@ -236,42 +236,43 @@ void CompilerPass::RunInliningPipeline(PipelineMode mode, INVOKE_PASS(TryOptimizePatterns); } -FlowGraph* CompilerPass::RunPipeline(PipelineMode mode, - CompilerPassState* pass_state) { - if (mode == kForced) { - INVOKE_PASS(ComputeSSA); - if (FLAG_early_round_trip_serialization) { - INVOKE_PASS(RoundTripSerialization); - } - INVOKE_PASS(TypePropagation); - INVOKE_PASS(ApplyClassIds); - INVOKE_PASS(Canonicalize); - INVOKE_PASS(BranchSimplify); - INVOKE_PASS(IfConvert); - INVOKE_PASS(ConstantPropagation); - INVOKE_PASS(TypePropagation); - INVOKE_PASS(WidenSmiToInt32); - INVOKE_PASS(SelectRepresentations); - INVOKE_PASS(TypePropagation); - INVOKE_PASS(TryCatchOptimization); - INVOKE_PASS(EliminateEnvironments); - INVOKE_PASS(EliminateDeadPhis); - INVOKE_PASS(Canonicalize); - INVOKE_PASS(WriteBarrierElimination); - INVOKE_PASS(FinalizeGraph); +FlowGraph* CompilerPass::RunForceOptimizedPipeline( + PipelineMode mode, + CompilerPassState* pass_state) { + INVOKE_PASS(ComputeSSA); + if (FLAG_early_round_trip_serialization) { + INVOKE_PASS(RoundTripSerialization); + } + INVOKE_PASS(TypePropagation); + INVOKE_PASS(Canonicalize); + INVOKE_PASS(BranchSimplify); + INVOKE_PASS(IfConvert); + INVOKE_PASS(ConstantPropagation); + INVOKE_PASS(TypePropagation); + INVOKE_PASS(WidenSmiToInt32); + INVOKE_PASS(SelectRepresentations); + INVOKE_PASS(TypePropagation); + INVOKE_PASS(TryCatchOptimization); + INVOKE_PASS(EliminateEnvironments); + INVOKE_PASS(EliminateDeadPhis); + INVOKE_PASS(Canonicalize); + INVOKE_PASS(WriteBarrierElimination); + INVOKE_PASS(FinalizeGraph); #if defined(DART_PRECOMPILER) - if (mode == kAOT) { - INVOKE_PASS(SerializeGraph); - } + if (mode == kAOT) { + INVOKE_PASS(SerializeGraph); + } #endif - if (FLAG_late_round_trip_serialization) { - INVOKE_PASS(RoundTripSerialization); - } - INVOKE_PASS(AllocateRegisters); - INVOKE_PASS(ReorderBlocks); - return pass_state->flow_graph; + if (FLAG_late_round_trip_serialization) { + INVOKE_PASS(RoundTripSerialization); } + INVOKE_PASS(AllocateRegisters); + INVOKE_PASS(ReorderBlocks); + return pass_state->flow_graph; +} +FlowGraph* CompilerPass::RunPipeline(PipelineMode mode, + CompilerPassState* pass_state) { INVOKE_PASS(ComputeSSA); if (FLAG_early_round_trip_serialization) { INVOKE_PASS(RoundTripSerialization); diff --git a/branches/beta/runtime/vm/compiler/compiler_pass.h b/branches/beta/runtime/vm/compiler/compiler_pass.h index c3ee7674b152..2d9b6d0ae34b 100644 --- a/branches/beta/runtime/vm/compiler/compiler_pass.h +++ b/branches/beta/runtime/vm/compiler/compiler_pass.h @@ -141,11 +141,7 @@ class CompilerPass { static void ParseFilters(const char* filter); - enum PipelineMode { - kJIT, // Includes speculative and inter-procedural optimizations. - kAOT, // Includes inter-procedural optimizations. - kForced // Does not include speculative or inter-procedural optimizations. - }; + enum PipelineMode { kJIT, kAOT }; static void RunGraphIntrinsicPipeline(CompilerPassState* state); @@ -165,6 +161,13 @@ class CompilerPass { CompilerPassState* state, std::initializer_list passes); + // Pipeline which is used for "force-optimized" functions. + // + // Must not include speculative or inter-procedural optimizations. + DART_WARN_UNUSED_RESULT + static FlowGraph* RunForceOptimizedPipeline(PipelineMode mode, + CompilerPassState* state); + protected: // This function executes the pass. If it returns true then // we will run Canonicalize on the graph and execute the pass diff --git a/branches/beta/runtime/vm/compiler/jit/compiler.cc b/branches/beta/runtime/vm/compiler/jit/compiler.cc index 6602e58d5a9e..d8be990fce22 100644 --- a/branches/beta/runtime/vm/compiler/jit/compiler.cc +++ b/branches/beta/runtime/vm/compiler/jit/compiler.cc @@ -616,7 +616,12 @@ RawCode* CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { CompilerPassState pass_state(thread(), flow_graph, &speculative_policy); pass_state.reorder_blocks = reorder_blocks; - if (optimized()) { + if (function.ForceOptimize()) { + ASSERT(optimized()); + TIMELINE_DURATION(thread(), CompilerVerbose, "OptimizationPasses"); + flow_graph = CompilerPass::RunForceOptimizedPipeline(CompilerPass::kJIT, + &pass_state); + } else if (optimized()) { TIMELINE_DURATION(thread(), CompilerVerbose, "OptimizationPasses"); pass_state.inline_id_to_function.Add(&function);