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

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

Issue 11014013: Added slow_assert macro and flag for slow development assertions in the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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
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 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 29 matching lines...) Expand all
40 DEFINE_FLAG(bool, common_subexpression_elimination, true, 40 DEFINE_FLAG(bool, common_subexpression_elimination, true,
41 "Do common subexpression elimination."); 41 "Do common subexpression elimination.");
42 DEFINE_FLAG(bool, loop_invariant_code_motion, true, 42 DEFINE_FLAG(bool, loop_invariant_code_motion, true,
43 "Do loop invariant code motion."); 43 "Do loop invariant code motion.");
44 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation."); 44 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation.");
45 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, 45 DEFINE_FLAG(int, deoptimization_counter_threshold, 5,
46 "How many times we allow deoptimization before we disallow" 46 "How many times we allow deoptimization before we disallow"
47 " certain optimizations"); 47 " certain optimizations");
48 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); 48 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining");
49 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); 49 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis");
50 DEFINE_FLAG(bool, slow_assert, false, "Enable slow assertions");
50 DECLARE_FLAG(bool, print_flow_graph); 51 DECLARE_FLAG(bool, print_flow_graph);
51 52
52 53
53 // Compile a function. Should call only if the function has not been compiled. 54 // Compile a function. Should call only if the function has not been compiled.
54 // Arg0: function object. 55 // Arg0: function object.
55 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { 56 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
56 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count()); 57 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count());
57 const Function& function = Function::CheckedHandle(arguments.At(0)); 58 const Function& function = Function::CheckedHandle(arguments.At(0));
58 ASSERT(!function.HasCode()); 59 ASSERT(!function.HasCode());
59 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 60 const Error& error = Error::Handle(Compiler::CompileFunction(function));
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 FlowGraphOptimizer optimizer(flow_graph); 174 FlowGraphOptimizer optimizer(flow_graph);
174 optimizer.ApplyICData(); 175 optimizer.ApplyICData();
175 176
176 // Compute the use lists. 177 // Compute the use lists.
177 flow_graph->ComputeUseLists(); 178 flow_graph->ComputeUseLists();
178 179
179 // Inlining (mutates the flow graph) 180 // Inlining (mutates the flow graph)
180 if (FLAG_use_inlining) { 181 if (FLAG_use_inlining) {
181 FlowGraphInliner inliner(flow_graph); 182 FlowGraphInliner inliner(flow_graph);
182 inliner.Inline(); 183 inliner.Inline();
183 // Verify that the use lists are still valid.
184 DEBUG_ASSERT(flow_graph->ValidateUseLists());
185 } 184 }
186 185
187 // Propagate types and eliminate more type tests. 186 // Propagate types and eliminate more type tests.
188 if (FLAG_propagate_types) { 187 if (FLAG_propagate_types) {
189 FlowGraphTypePropagator propagator(flow_graph); 188 FlowGraphTypePropagator propagator(flow_graph);
190 propagator.PropagateTypes(); 189 propagator.PropagateTypes();
191 } 190 }
192 191
193 // Verify that the use lists are still valid. 192 // Verify that the use lists are still valid.
194 DEBUG_ASSERT(flow_graph->ValidateUseLists()); 193 SLOW_ASSERT(flow_graph->ValidateUseLists());
195 194
196 // Propagate sminess from CheckSmi to phis. 195 // Propagate sminess from CheckSmi to phis.
197 optimizer.PropagateSminess(); 196 optimizer.PropagateSminess();
198 197
199 // Do optimizations that depend on the propagated type information. 198 // Do optimizations that depend on the propagated type information.
200 optimizer.OptimizeComputations(); 199 optimizer.OptimizeComputations();
201 200
202 // Unbox doubles. 201 // Unbox doubles.
203 flow_graph->ComputeUseLists(); 202 flow_graph->ComputeUseLists();
204 optimizer.SelectRepresentations(); 203 optimizer.SelectRepresentations();
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 result = isolate->object_store()->sticky_error(); 583 result = isolate->object_store()->sticky_error();
585 isolate->object_store()->clear_sticky_error(); 584 isolate->object_store()->clear_sticky_error();
586 isolate->set_long_jump_base(base); 585 isolate->set_long_jump_base(base);
587 return result.raw(); 586 return result.raw();
588 } 587 }
589 UNREACHABLE(); 588 UNREACHABLE();
590 return Object::null(); 589 return Object::null();
591 } 590 }
592 591
593 } // namespace dart 592 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698