OLD | NEW |
---|---|
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 | |
9 #include "vm/assert.h" | |
8 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
9 #include "vm/code_generator.h" | 11 #include "vm/code_generator.h" |
10 #include "vm/code_patcher.h" | 12 #include "vm/code_patcher.h" |
11 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
12 #include "vm/debugger.h" | 14 #include "vm/debugger.h" |
13 #include "vm/deopt_instructions.h" | 15 #include "vm/deopt_instructions.h" |
14 #include "vm/disassembler.h" | 16 #include "vm/disassembler.h" |
15 #include "vm/exceptions.h" | 17 #include "vm/exceptions.h" |
16 #include "vm/flags.h" | 18 #include "vm/flags.h" |
17 #include "vm/flow_graph.h" | 19 #include "vm/flow_graph.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
41 DEFINE_FLAG(bool, common_subexpression_elimination, true, | 43 DEFINE_FLAG(bool, common_subexpression_elimination, true, |
42 "Do common subexpression elimination."); | 44 "Do common subexpression elimination."); |
43 DEFINE_FLAG(bool, loop_invariant_code_motion, true, | 45 DEFINE_FLAG(bool, loop_invariant_code_motion, true, |
44 "Do loop invariant code motion."); | 46 "Do loop invariant code motion."); |
45 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation."); | 47 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation."); |
46 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, | 48 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, |
47 "How many times we allow deoptimization before we disallow" | 49 "How many times we allow deoptimization before we disallow" |
48 " certain optimizations"); | 50 " certain optimizations"); |
49 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 51 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
50 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); | 52 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); |
53 DEFINE_FLAG(bool, slow_asserts, false, "Enable slow assertions"); | |
siva
2012/10/01 23:35:40
Ditto comment regarding slow_asserts.
| |
51 DECLARE_FLAG(bool, print_flow_graph); | 54 DECLARE_FLAG(bool, print_flow_graph); |
52 | 55 |
53 | 56 |
54 // Compile a function. Should call only if the function has not been compiled. | 57 // Compile a function. Should call only if the function has not been compiled. |
55 // Arg0: function object. | 58 // Arg0: function object. |
56 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | 59 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { |
57 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count()); | 60 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count()); |
58 const Function& function = Function::CheckedHandle(arguments.At(0)); | 61 const Function& function = Function::CheckedHandle(arguments.At(0)); |
59 ASSERT(!function.HasCode()); | 62 ASSERT(!function.HasCode()); |
60 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 63 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 FlowGraphOptimizer optimizer(flow_graph); | 177 FlowGraphOptimizer optimizer(flow_graph); |
175 optimizer.ApplyICData(); | 178 optimizer.ApplyICData(); |
176 | 179 |
177 // Compute the use lists. | 180 // Compute the use lists. |
178 flow_graph->ComputeUseLists(); | 181 flow_graph->ComputeUseLists(); |
179 | 182 |
180 // Inlining (mutates the flow graph) | 183 // Inlining (mutates the flow graph) |
181 if (FLAG_use_inlining) { | 184 if (FLAG_use_inlining) { |
182 FlowGraphInliner inliner(flow_graph); | 185 FlowGraphInliner inliner(flow_graph); |
183 inliner.Inline(); | 186 inliner.Inline(); |
184 // Verify that the use lists are still valid. | 187 // Use lists are maintained and validated by the inliner. |
185 DEBUG_ASSERT(flow_graph->ValidateUseLists()); | |
186 } | 188 } |
187 | 189 |
188 // Propagate types and eliminate more type tests. | 190 // Propagate types and eliminate more type tests. |
189 if (FLAG_propagate_types) { | 191 if (FLAG_propagate_types) { |
190 FlowGraphTypePropagator propagator(flow_graph); | 192 FlowGraphTypePropagator propagator(flow_graph); |
191 propagator.PropagateTypes(); | 193 propagator.PropagateTypes(); |
192 } | 194 } |
193 | 195 |
194 // Verify that the use lists are still valid. | 196 // Verify that the use lists are still valid. |
195 DEBUG_ASSERT(flow_graph->ValidateUseLists()); | 197 DEBUG_ASSERT(flow_graph->ValidateUseLists()); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
592 result = isolate->object_store()->sticky_error(); | 594 result = isolate->object_store()->sticky_error(); |
593 isolate->object_store()->clear_sticky_error(); | 595 isolate->object_store()->clear_sticky_error(); |
594 isolate->set_long_jump_base(base); | 596 isolate->set_long_jump_base(base); |
595 return result.raw(); | 597 return result.raw(); |
596 } | 598 } |
597 UNREACHABLE(); | 599 UNREACHABLE(); |
598 return Object::null(); | 600 return Object::null(); |
599 } | 601 } |
600 | 602 |
601 } // namespace dart | 603 } // namespace dart |
OLD | NEW |