| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } else { | 415 } else { |
| 416 deopt_target = insert_before = use->instruction(); | 416 deopt_target = insert_before = use->instruction(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 InsertConversion(from_rep, to_rep, use, insert_before, deopt_target); | 419 InsertConversion(from_rep, to_rep, use, insert_before, deopt_target); |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 | 422 |
| 423 | 423 |
| 424 void FlowGraphOptimizer::SelectRepresentations() { | 424 void FlowGraphOptimizer::SelectRepresentations() { |
| 425 // Convervatively unbox all phis that were proven to be of type Double. | 425 // Convervatively unbox all phis that were proven to be of Double, |
| 426 // Float32x4, or Uint32x4. |
| 426 for (intptr_t i = 0; i < block_order_.length(); ++i) { | 427 for (intptr_t i = 0; i < block_order_.length(); ++i) { |
| 427 JoinEntryInstr* join_entry = block_order_[i]->AsJoinEntry(); | 428 JoinEntryInstr* join_entry = block_order_[i]->AsJoinEntry(); |
| 428 if (join_entry != NULL) { | 429 if (join_entry != NULL) { |
| 429 for (PhiIterator it(join_entry); !it.Done(); it.Advance()) { | 430 for (PhiIterator it(join_entry); !it.Done(); it.Advance()) { |
| 430 PhiInstr* phi = it.Current(); | 431 PhiInstr* phi = it.Current(); |
| 431 ASSERT(phi != NULL); | 432 ASSERT(phi != NULL); |
| 432 if (phi->Type()->ToCid() == kDoubleCid) { | 433 if (phi->Type()->ToCid() == kDoubleCid) { |
| 433 phi->set_representation(kUnboxedDouble); | 434 phi->set_representation(kUnboxedDouble); |
| 435 } else if (phi->Type()->ToCid() == kFloat32x4Cid) { |
| 436 phi->set_representation(kUnboxedFloat32x4); |
| 437 } else if (phi->Type()->ToCid() == kUint32x4Cid) { |
| 438 phi->set_representation(kUnboxedUint32x4); |
| 434 } | 439 } |
| 435 } | 440 } |
| 436 } | 441 } |
| 437 } | 442 } |
| 438 | 443 |
| 439 // Process all instructions and insert conversions where needed. | 444 // Process all instructions and insert conversions where needed. |
| 440 GraphEntryInstr* graph_entry = block_order_[0]->AsGraphEntry(); | 445 GraphEntryInstr* graph_entry = block_order_[0]->AsGraphEntry(); |
| 441 | 446 |
| 442 // Visit incoming parameters and constants. | 447 // Visit incoming parameters and constants. |
| 443 for (intptr_t i = 0; i < graph_entry->initial_definitions()->length(); i++) { | 448 for (intptr_t i = 0; i < graph_entry->initial_definitions()->length(); i++) { |
| (...skipping 6047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6491 | 6496 |
| 6492 // Insert materializations at environment uses. | 6497 // Insert materializations at environment uses. |
| 6493 const Class& cls = Class::Handle(alloc->constructor().Owner()); | 6498 const Class& cls = Class::Handle(alloc->constructor().Owner()); |
| 6494 for (intptr_t i = 0; i < exits.length(); i++) { | 6499 for (intptr_t i = 0; i < exits.length(); i++) { |
| 6495 CreateMaterializationAt(exits[i], alloc, cls, *fields); | 6500 CreateMaterializationAt(exits[i], alloc, cls, *fields); |
| 6496 } | 6501 } |
| 6497 } | 6502 } |
| 6498 | 6503 |
| 6499 | 6504 |
| 6500 } // namespace dart | 6505 } // namespace dart |
| OLD | NEW |