| 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/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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 452 |
| 453 | 453 |
| 454 bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call, | 454 bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call, |
| 455 Token::Kind op_kind) { | 455 Token::Kind op_kind) { |
| 456 intptr_t operands_type = kIllegalCid; | 456 intptr_t operands_type = kIllegalCid; |
| 457 ASSERT(call->HasICData()); | 457 ASSERT(call->HasICData()); |
| 458 const ICData& ic_data = *call->ic_data(); | 458 const ICData& ic_data = *call->ic_data(); |
| 459 switch (op_kind) { | 459 switch (op_kind) { |
| 460 case Token::kADD: | 460 case Token::kADD: |
| 461 case Token::kSUB: | 461 case Token::kSUB: |
| 462 if (HasOnlyTwoSmi(ic_data)) { |
| 463 operands_type = kSmiCid; |
| 464 } else if (HasTwoMintOrSmi(ic_data) && |
| 465 FlowGraphCompiler::SupportsUnboxedMints()) { |
| 466 operands_type = kMintCid; |
| 467 } else if (ShouldSpecializeForDouble(ic_data)) { |
| 468 operands_type = kDoubleCid; |
| 469 } else { |
| 470 return false; |
| 471 } |
| 472 break; |
| 462 case Token::kMUL: | 473 case Token::kMUL: |
| 463 if (HasOnlyTwoSmi(ic_data)) { | 474 if (HasOnlyTwoSmi(ic_data)) { |
| 464 operands_type = kSmiCid; | 475 operands_type = kSmiCid; |
| 465 } else if (ShouldSpecializeForDouble(ic_data)) { | 476 } else if (ShouldSpecializeForDouble(ic_data)) { |
| 466 operands_type = kDoubleCid; | 477 operands_type = kDoubleCid; |
| 467 } else { | 478 } else { |
| 468 return false; | 479 return false; |
| 469 } | 480 } |
| 470 break; | 481 break; |
| 471 case Token::kDIV: | 482 case Token::kDIV: |
| (...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3150 | 3161 |
| 3151 if (FLAG_trace_constant_propagation) { | 3162 if (FLAG_trace_constant_propagation) { |
| 3152 OS::Print("\n==== After constant propagation ====\n"); | 3163 OS::Print("\n==== After constant propagation ====\n"); |
| 3153 FlowGraphPrinter printer(*graph_); | 3164 FlowGraphPrinter printer(*graph_); |
| 3154 printer.PrintBlocks(); | 3165 printer.PrintBlocks(); |
| 3155 } | 3166 } |
| 3156 } | 3167 } |
| 3157 | 3168 |
| 3158 | 3169 |
| 3159 } // namespace dart | 3170 } // namespace dart |
| OLD | NEW |