Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: runtime/vm/compiler.cc

Issue 12221139: Revert "Remove SminessPropagator and FlowGraphTypePropagator and all associated infrastructure and … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
11 #include "vm/code_patcher.h" 11 #include "vm/code_patcher.h"
12 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.h"
13 #include "vm/debugger.h" 13 #include "vm/debugger.h"
14 #include "vm/deopt_instructions.h" 14 #include "vm/deopt_instructions.h"
15 #include "vm/disassembler.h" 15 #include "vm/disassembler.h"
16 #include "vm/exceptions.h" 16 #include "vm/exceptions.h"
17 #include "vm/flags.h" 17 #include "vm/flags.h"
18 #include "vm/flow_graph.h" 18 #include "vm/flow_graph.h"
19 #include "vm/flow_graph_allocator.h" 19 #include "vm/flow_graph_allocator.h"
20 #include "vm/flow_graph_builder.h" 20 #include "vm/flow_graph_builder.h"
21 #include "vm/flow_graph_compiler.h" 21 #include "vm/flow_graph_compiler.h"
22 #include "vm/flow_graph_inliner.h" 22 #include "vm/flow_graph_inliner.h"
23 #include "vm/flow_graph_optimizer.h" 23 #include "vm/flow_graph_optimizer.h"
24 #include "vm/flow_graph_type_propagator.h"
25 #include "vm/il_printer.h" 24 #include "vm/il_printer.h"
26 #include "vm/longjump.h" 25 #include "vm/longjump.h"
27 #include "vm/object.h" 26 #include "vm/object.h"
28 #include "vm/object_store.h" 27 #include "vm/object_store.h"
29 #include "vm/os.h" 28 #include "vm/os.h"
30 #include "vm/parser.h" 29 #include "vm/parser.h"
31 #include "vm/scanner.h" 30 #include "vm/scanner.h"
32 #include "vm/symbols.h" 31 #include "vm/symbols.h"
33 #include "vm/timer.h" 32 #include "vm/timer.h"
34 33
(...skipping 12 matching lines...) Expand all
47 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation."); 46 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation.");
48 DEFINE_FLAG(int, deoptimization_counter_threshold, 16, 47 DEFINE_FLAG(int, deoptimization_counter_threshold, 16,
49 "How many times we allow deoptimization before we disallow optimization."); 48 "How many times we allow deoptimization before we disallow optimization.");
50 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); 49 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining");
51 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); 50 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis");
52 DEFINE_FLAG(bool, verify_compiler, false, 51 DEFINE_FLAG(bool, verify_compiler, false,
53 "Enable compiler verification assertions"); 52 "Enable compiler verification assertions");
54 DECLARE_FLAG(bool, print_flow_graph); 53 DECLARE_FLAG(bool, print_flow_graph);
55 DECLARE_FLAG(bool, print_flow_graph_optimized); 54 DECLARE_FLAG(bool, print_flow_graph_optimized);
56 DECLARE_FLAG(bool, trace_failed_optimization_attempts); 55 DECLARE_FLAG(bool, trace_failed_optimization_attempts);
57 DECLARE_FLAG(bool, trace_type_propagation); 56
58 57
59 // Compile a function. Should call only if the function has not been compiled. 58 // Compile a function. Should call only if the function has not been compiled.
60 // Arg0: function object. 59 // Arg0: function object.
61 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { 60 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
62 ASSERT(arguments.ArgCount() == kCompileFunctionRuntimeEntry.argument_count()); 61 ASSERT(arguments.ArgCount() == kCompileFunctionRuntimeEntry.argument_count());
63 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); 62 const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
64 ASSERT(!function.HasCode()); 63 ASSERT(!function.HasCode());
65 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 64 const Error& error = Error::Handle(Compiler::CompileFunction(function));
66 if (!error.IsNull()) { 65 if (!error.IsNull()) {
67 Exceptions::PropagateError(error); 66 Exceptions::PropagateError(error);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 183
185 // Inlining (mutates the flow graph) 184 // Inlining (mutates the flow graph)
186 if (FLAG_use_inlining) { 185 if (FLAG_use_inlining) {
187 TimerScope timer(FLAG_compiler_stats, 186 TimerScope timer(FLAG_compiler_stats,
188 &CompilerStats::graphinliner_timer); 187 &CompilerStats::graphinliner_timer);
189 FlowGraphInliner inliner(flow_graph); 188 FlowGraphInliner inliner(flow_graph);
190 inliner.Inline(); 189 inliner.Inline();
191 // Use lists are maintained and validated by the inliner. 190 // Use lists are maintained and validated by the inliner.
192 } 191 }
193 192
194 if (FLAG_trace_type_propagation) {
195 OS::Print("Before type propagation:\n");
196 FlowGraphPrinter printer(*flow_graph);
197 printer.PrintBlocks();
198 }
199
200 // Propagate types and eliminate more type tests. 193 // Propagate types and eliminate more type tests.
201 if (FLAG_propagate_types) { 194 if (FLAG_propagate_types) {
202 FlowGraphTypePropagator propagator(flow_graph); 195 FlowGraphTypePropagator propagator(flow_graph);
203 propagator.Propagate(); 196 propagator.PropagateTypes();
204 } 197 }
205 198
206 if (FLAG_trace_type_propagation) { 199 // Propagate sminess from CheckSmi to phis.
207 OS::Print("After type propagation:\n");
208 FlowGraphPrinter printer(*flow_graph);
209 printer.PrintBlocks();
210 }
211
212 flow_graph->ComputeUseLists(); 200 flow_graph->ComputeUseLists();
201 optimizer.PropagateSminess();
213 202
214 // Use propagated class-ids to optimize further. 203 // Use propagated class-ids to optimize further.
215 optimizer.ApplyClassIds(); 204 optimizer.ApplyClassIds();
216 205
217 // Recompute use lists after applying class ids. 206 // Recompute use lists after applying class ids.
218 flow_graph->ComputeUseLists(); 207 flow_graph->ComputeUseLists();
219 208
220 // Do optimizations that depend on the propagated type information. 209 // Do optimizations that depend on the propagated type information.
221 optimizer.Canonicalize(); 210 optimizer.Canonicalize();
222 211
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 Object::Handle(isolate->object_store()->sticky_error()); 639 Object::Handle(isolate->object_store()->sticky_error());
651 isolate->object_store()->clear_sticky_error(); 640 isolate->object_store()->clear_sticky_error();
652 isolate->set_long_jump_base(base); 641 isolate->set_long_jump_base(base);
653 return result.raw(); 642 return result.raw();
654 } 643 }
655 UNREACHABLE(); 644 UNREACHABLE();
656 return Object::null(); 645 return Object::null();
657 } 646 }
658 647
659 } // namespace dart 648 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698