| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 ASSERT(!IsControl()); | 232 ASSERT(!IsControl()); |
| 233 ASSERT(!IsThrow()); | 233 ASSERT(!IsThrow()); |
| 234 ASSERT(!IsReturn()); | 234 ASSERT(!IsReturn()); |
| 235 ASSERT(!IsReThrow()); | 235 ASSERT(!IsReThrow()); |
| 236 ASSERT(!IsGoto()); | 236 ASSERT(!IsGoto()); |
| 237 ASSERT(previous() != NULL); | 237 ASSERT(previous() != NULL); |
| 238 Instruction* prev_instr = previous(); | 238 Instruction* prev_instr = previous(); |
| 239 Instruction* next_instr = next(); | 239 Instruction* next_instr = next(); |
| 240 ASSERT(next_instr != NULL); | 240 ASSERT(next_instr != NULL); |
| 241 ASSERT(!next_instr->IsBlockEntry()); | 241 ASSERT(!next_instr->IsBlockEntry()); |
| 242 prev_instr->set_next(next_instr); | 242 prev_instr->LinkTo(next_instr); |
| 243 next_instr->set_previous(prev_instr); | |
| 244 // Reset successor and previous instruction to indicate | 243 // Reset successor and previous instruction to indicate |
| 245 // that the instruction is removed from the graph. | 244 // that the instruction is removed from the graph. |
| 246 set_previous(NULL); | 245 set_previous(NULL); |
| 247 set_next(NULL); | 246 set_next(NULL); |
| 248 return return_previous ? prev_instr : next_instr; | 247 return return_previous ? prev_instr : next_instr; |
| 249 } | 248 } |
| 250 | 249 |
| 251 | 250 |
| 252 void Instruction::InsertBefore(Instruction* next) { | 251 void Instruction::InsertBefore(Instruction* next) { |
| 253 ASSERT(previous_ == NULL); | 252 ASSERT(previous_ == NULL); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 if ((iterator != NULL) && (this == iterator->Current())) { | 581 if ((iterator != NULL) && (this == iterator->Current())) { |
| 583 iterator->ReplaceCurrentWith(other); | 582 iterator->ReplaceCurrentWith(other); |
| 584 } else { | 583 } else { |
| 585 ReplaceUsesWith(other); | 584 ReplaceUsesWith(other); |
| 586 ASSERT(other->env() == NULL); | 585 ASSERT(other->env() == NULL); |
| 587 other->set_env(env()); | 586 other->set_env(env()); |
| 588 set_env(NULL); | 587 set_env(NULL); |
| 589 ASSERT(!other->HasSSATemp()); | 588 ASSERT(!other->HasSSATemp()); |
| 590 if (HasSSATemp()) other->set_ssa_temp_index(ssa_temp_index()); | 589 if (HasSSATemp()) other->set_ssa_temp_index(ssa_temp_index()); |
| 591 | 590 |
| 592 other->set_previous(previous()); | 591 previous()->LinkTo(other); |
| 593 previous()->set_next(other); | 592 other->LinkTo(next()); |
| 593 |
| 594 set_previous(NULL); | 594 set_previous(NULL); |
| 595 | |
| 596 other->set_next(next()); | |
| 597 next()->set_previous(other); | |
| 598 set_next(NULL); | 595 set_next(NULL); |
| 599 } | 596 } |
| 600 } | 597 } |
| 601 | 598 |
| 602 | 599 |
| 603 bool Definition::SetPropagatedCid(intptr_t cid) { | 600 bool Definition::SetPropagatedCid(intptr_t cid) { |
| 604 if (cid == kIllegalCid) { | 601 if (cid == kIllegalCid) { |
| 605 return false; | 602 return false; |
| 606 } | 603 } |
| 607 if (propagated_cid_ == kIllegalCid) { | 604 if (propagated_cid_ == kIllegalCid) { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 } | 870 } |
| 874 | 871 |
| 875 | 872 |
| 876 BlockEntryInstr* GotoInstr::SuccessorAt(intptr_t index) const { | 873 BlockEntryInstr* GotoInstr::SuccessorAt(intptr_t index) const { |
| 877 ASSERT(index == 0); | 874 ASSERT(index == 0); |
| 878 return successor(); | 875 return successor(); |
| 879 } | 876 } |
| 880 | 877 |
| 881 | 878 |
| 882 void Instruction::Goto(JoinEntryInstr* entry) { | 879 void Instruction::Goto(JoinEntryInstr* entry) { |
| 883 set_next(new GotoInstr(entry)); | 880 LinkTo(new GotoInstr(entry)); |
| 884 } | 881 } |
| 885 | 882 |
| 886 | 883 |
| 887 RawAbstractType* Value::CompileType() const { | 884 RawAbstractType* Value::CompileType() const { |
| 888 if (definition()->HasPropagatedType()) { | 885 if (definition()->HasPropagatedType()) { |
| 889 return definition()->PropagatedType(); | 886 return definition()->PropagatedType(); |
| 890 } | 887 } |
| 891 // The compile type may be requested when building the flow graph, i.e. before | 888 // The compile type may be requested when building the flow graph, i.e. before |
| 892 // type propagation has occurred. To avoid repeatedly computing the compile | 889 // type propagation has occurred. To avoid repeatedly computing the compile |
| 893 // type of the definition, we store it as initial propagated type. | 890 // type of the definition, we store it as initial propagated type. |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2066 new_max = new_max.Clamp(); | 2063 new_max = new_max.Clamp(); |
| 2067 } | 2064 } |
| 2068 | 2065 |
| 2069 return Range::Update(&range_, new_min, new_max); | 2066 return Range::Update(&range_, new_min, new_max); |
| 2070 } | 2067 } |
| 2071 | 2068 |
| 2072 | 2069 |
| 2073 #undef __ | 2070 #undef __ |
| 2074 | 2071 |
| 2075 } // namespace dart | 2072 } // namespace dart |
| OLD | NEW |