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

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
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/disassembler.h" 15 #include "vm/disassembler.h"
14 #include "vm/exceptions.h" 16 #include "vm/exceptions.h"
15 #include "vm/flags.h" 17 #include "vm/flags.h"
16 #include "vm/flow_graph.h" 18 #include "vm/flow_graph.h"
17 #include "vm/flow_graph_allocator.h" 19 #include "vm/flow_graph_allocator.h"
(...skipping 22 matching lines...) Expand all
40 DEFINE_FLAG(bool, common_subexpression_elimination, true, 42 DEFINE_FLAG(bool, common_subexpression_elimination, true,
41 "Do common subexpression elimination."); 43 "Do common subexpression elimination.");
42 DEFINE_FLAG(bool, loop_invariant_code_motion, true, 44 DEFINE_FLAG(bool, loop_invariant_code_motion, true,
43 "Do loop invariant code motion."); 45 "Do loop invariant code motion.");
44 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation."); 46 DEFINE_FLAG(bool, propagate_types, true, "Do static type propagation.");
45 DEFINE_FLAG(int, deoptimization_counter_threshold, 5, 47 DEFINE_FLAG(int, deoptimization_counter_threshold, 5,
46 "How many times we allow deoptimization before we disallow" 48 "How many times we allow deoptimization before we disallow"
47 " certain optimizations"); 49 " certain optimizations");
48 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); 50 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining");
49 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); 51 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis");
52 DEFINE_FLAG(bool, slow_assert, false, "Enable slow assertions");
Kevin Millikin (Google) 2012/10/01 11:38:26 Let's spell it "slow_asserts".
zerny-google 2012/10/01 11:50:36 Done.
50 DECLARE_FLAG(bool, print_flow_graph); 53 DECLARE_FLAG(bool, print_flow_graph);
51 54
52 55
53 // Compile a function. Should call only if the function has not been compiled. 56 // Compile a function. Should call only if the function has not been compiled.
54 // Arg0: function object. 57 // Arg0: function object.
55 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { 58 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
56 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count()); 59 ASSERT(arguments.Count() == kCompileFunctionRuntimeEntry.argument_count());
57 const Function& function = Function::CheckedHandle(arguments.At(0)); 60 const Function& function = Function::CheckedHandle(arguments.At(0));
58 ASSERT(!function.HasCode()); 61 ASSERT(!function.HasCode());
59 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 62 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); 176 FlowGraphOptimizer optimizer(flow_graph);
174 optimizer.ApplyICData(); 177 optimizer.ApplyICData();
175 178
176 // Compute the use lists. 179 // Compute the use lists.
177 flow_graph->ComputeUseLists(); 180 flow_graph->ComputeUseLists();
178 181
179 // Inlining (mutates the flow graph) 182 // Inlining (mutates the flow graph)
180 if (FLAG_use_inlining) { 183 if (FLAG_use_inlining) {
181 FlowGraphInliner inliner(flow_graph); 184 FlowGraphInliner inliner(flow_graph);
182 inliner.Inline(); 185 inliner.Inline();
183 // Verify that the use lists are still valid.
184 DEBUG_ASSERT(flow_graph->ValidateUseLists());
185 } 186 }
186 187
187 // Propagate types and eliminate more type tests. 188 // Propagate types and eliminate more type tests.
188 if (FLAG_propagate_types) { 189 if (FLAG_propagate_types) {
189 FlowGraphTypePropagator propagator(flow_graph); 190 FlowGraphTypePropagator propagator(flow_graph);
190 propagator.PropagateTypes(); 191 propagator.PropagateTypes();
191 } 192 }
192 193
193 // Verify that the use lists are still valid. 194 // Verify that the use lists are still valid.
194 DEBUG_ASSERT(flow_graph->ValidateUseLists()); 195 SLOW_ASSERT(flow_graph->ValidateUseLists());
195 196
196 // Propagate sminess from CheckSmi to phis. 197 // Propagate sminess from CheckSmi to phis.
197 optimizer.PropagateSminess(); 198 optimizer.PropagateSminess();
198 199
199 // Do optimizations that depend on the propagated type information. 200 // Do optimizations that depend on the propagated type information.
200 optimizer.OptimizeComputations(); 201 optimizer.OptimizeComputations();
201 202
202 // Unbox doubles. 203 // Unbox doubles.
203 flow_graph->ComputeUseLists(); 204 flow_graph->ComputeUseLists();
204 optimizer.SelectRepresentations(); 205 optimizer.SelectRepresentations();
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 result = isolate->object_store()->sticky_error(); 585 result = isolate->object_store()->sticky_error();
585 isolate->object_store()->clear_sticky_error(); 586 isolate->object_store()->clear_sticky_error();
586 isolate->set_long_jump_base(base); 587 isolate->set_long_jump_base(base);
587 return result.raw(); 588 return result.raw();
588 } 589 }
589 UNREACHABLE(); 590 UNREACHABLE();
590 return Object::null(); 591 return Object::null();
591 } 592 }
592 593
593 } // namespace dart 594 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/platform/assert.h ('k') | runtime/vm/flow_graph.cc » ('j') | runtime/vm/flow_graph.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698