| 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_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 for (intptr_t i = 0; i < var_count; i++) { | 403 for (intptr_t i = 0; i < var_count; i++) { |
| 404 phis_->Add(NULL); | 404 phis_->Add(NULL); |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 ASSERT((*phis_)[var_index] == NULL); | 407 ASSERT((*phis_)[var_index] == NULL); |
| 408 (*phis_)[var_index] = new PhiInstr(PredecessorCount()); | 408 (*phis_)[var_index] = new PhiInstr(PredecessorCount()); |
| 409 phi_count_++; | 409 phi_count_++; |
| 410 } | 410 } |
| 411 | 411 |
| 412 | 412 |
| 413 void JoinEntryInstr::RemoveDeadPhis() { |
| 414 if (phis_ == NULL) return; |
| 415 |
| 416 for (intptr_t i = 0; i < phis_->length(); i++) { |
| 417 PhiInstr* phi = (*phis_)[i]; |
| 418 if ((phi != NULL) && !phi->is_alive()) { |
| 419 (*phis_)[i] = NULL; |
| 420 phi_count_--; |
| 421 } |
| 422 } |
| 423 |
| 424 // Check if we removed all phis. |
| 425 if (phi_count_ == 0) phis_ = NULL; |
| 426 } |
| 427 |
| 428 |
| 413 intptr_t Instruction::SuccessorCount() const { | 429 intptr_t Instruction::SuccessorCount() const { |
| 414 return 0; | 430 return 0; |
| 415 } | 431 } |
| 416 | 432 |
| 417 | 433 |
| 418 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { | 434 BlockEntryInstr* Instruction::SuccessorAt(intptr_t index) const { |
| 419 // Called only if index is in range. Only control-transfer instructions | 435 // Called only if index is in range. Only control-transfer instructions |
| 420 // can have non-zero successor counts and they override this function. | 436 // can have non-zero successor counts and they override this function. |
| 421 UNREACHABLE(); | 437 UNREACHABLE(); |
| 422 return NULL; | 438 return NULL; |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 if (compiler->is_ssa()) { | 1178 if (compiler->is_ssa()) { |
| 1163 ASSERT(locs()->in(0).IsRegister()); | 1179 ASSERT(locs()->in(0).IsRegister()); |
| 1164 __ PushRegister(locs()->in(0).reg()); | 1180 __ PushRegister(locs()->in(0).reg()); |
| 1165 } | 1181 } |
| 1166 } | 1182 } |
| 1167 | 1183 |
| 1168 | 1184 |
| 1169 #undef __ | 1185 #undef __ |
| 1170 | 1186 |
| 1171 } // namespace dart | 1187 } // namespace dart |
| OLD | NEW |