Chromium Code Reviews| Index: runtime/vm/flow_graph.cc |
| diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc |
| index ce8960ccf46fa375e7c2eab3ef7119640b25f0aa..3a4cfe8ae5c955a391ccc1eff3094d38af94f6be 100644 |
| --- a/runtime/vm/flow_graph.cc |
| +++ b/runtime/vm/flow_graph.cc |
| @@ -4,7 +4,6 @@ |
| #include "vm/flow_graph.h" |
| -#include "vm/assert.h" |
| #include "vm/bit_vector.h" |
| #include "vm/flow_graph_builder.h" |
| #include "vm/intermediate_language.h" |
| @@ -14,6 +13,7 @@ |
| namespace dart { |
| DECLARE_FLAG(bool, trace_optimization); |
| +DECLARE_FLAG(bool, verify_compiler); |
| FlowGraph::FlowGraph(const FlowGraphBuilder& builder, |
| GraphEntryInstr* graph_entry, |
| @@ -125,14 +125,16 @@ static void ValidateUseListsInInstruction(Instruction* instr) { |
| for (intptr_t i = 0; i < instr->InputCount(); ++i) { |
| Value* use = instr->InputAt(i); |
| ASSERT(use->use_index() == i); |
| - SLOW_ASSERT(1 == MembershipCount(use, use->definition()->input_use_list())); |
| + ASSERT(!FLAG_verify_compiler || |
| + (1 == MembershipCount(use, use->definition()->input_use_list()))); |
|
srdjan
2012/10/09 16:28:52
Would it make sense to do verification in release
zerny-google
2012/10/10 07:44:54
We could, but currently all of the verification co
|
| } |
| if (instr->env() != NULL) { |
| intptr_t use_index = 0; |
| for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) { |
| Value* use = it.CurrentValue(); |
| ASSERT(use->use_index() == use_index++); |
| - SLOW_ASSERT(1 == MembershipCount(use, use->definition()->env_use_list())); |
| + ASSERT(!FLAG_verify_compiler || |
| + (1 == MembershipCount(use, use->definition()->env_use_list()))); |
| } |
| } |
| Definition* defn = instr->AsDefinition(); |
| @@ -195,7 +197,8 @@ static void RecordInputUses(Instruction* instr) { |
| ASSERT(use->instruction() == NULL); |
| ASSERT(use->use_index() == -1); |
| ASSERT(use->next_use() == NULL); |
| - SLOW_ASSERT(0 == MembershipCount(use, use->definition()->input_use_list())); |
| + DEBUG_ASSERT(!FLAG_verify_compiler || |
|
srdjan
2012/10/09 16:28:52
Why DEBUG_ASSERT instead of ASSERT? All identifier
zerny-google
2012/10/10 07:44:54
No, the verification code (including MembershipCou
|
| + (0 == MembershipCount(use, use->definition()->input_use_list()))); |
| use->set_instruction(instr); |
| use->set_use_index(i); |
| use->AddToInputUseList(); |
| @@ -212,7 +215,8 @@ static void RecordEnvUses(Instruction* instr) { |
| ASSERT(use->instruction() == NULL); |
| ASSERT(use->use_index() == -1); |
| ASSERT(use->next_use() == NULL); |
| - SLOW_ASSERT(0 == MembershipCount(use, use->definition()->env_use_list())); |
| + DEBUG_ASSERT(!FLAG_verify_compiler || |
| + (0 == MembershipCount(use, use->definition()->env_use_list()))); |
| use->set_instruction(instr); |
| use->set_use_index(use_index++); |
| use->AddToEnvUseList(); |
| @@ -255,8 +259,8 @@ static void ComputeUseListsRecursive(BlockEntryInstr* block) { |
| ASSERT(use->instruction() == NULL); |
| ASSERT(use->use_index() == -1); |
| ASSERT(use->next_use() == NULL); |
| - SLOW_ASSERT(0 == MembershipCount(use, |
| - use->definition()->input_use_list())); |
| + DEBUG_ASSERT(!FLAG_verify_compiler || |
| + (0 == MembershipCount(use, use->definition()->input_use_list()))); |
| use->set_instruction(phi); |
| use->set_use_index(pred_index); |
| use->AddToInputUseList(); |
| @@ -273,7 +277,7 @@ void FlowGraph::ComputeUseLists() { |
| ClearUseLists((*graph_entry_->initial_definitions())[i]); |
| } |
| ComputeUseListsRecursive(graph_entry_); |
| - SLOW_ASSERT(ValidateUseLists()); |
| + DEBUG_ASSERT(!FLAG_verify_compiler || ValidateUseLists()); |
| } |