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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 if (HasOnlyTwoSmis(ic_data)) { | 515 if (HasOnlyTwoSmis(ic_data)) { |
516 operands_type = kSmiCid; | 516 operands_type = kSmiCid; |
517 } else if (HasTwoMintOrSmi(ic_data) && | 517 } else if (HasTwoMintOrSmi(ic_data) && |
518 FlowGraphCompiler::SupportsUnboxedMints()) { | 518 FlowGraphCompiler::SupportsUnboxedMints()) { |
519 operands_type = kMintCid; | 519 operands_type = kMintCid; |
520 } else { | 520 } else { |
521 return false; | 521 return false; |
522 } | 522 } |
523 break; | 523 break; |
524 case Token::kSHR: | 524 case Token::kSHR: |
| 525 case Token::kSHL: |
525 if (HasOnlyTwoSmis(ic_data)) { | 526 if (HasOnlyTwoSmis(ic_data)) { |
526 operands_type = kSmiCid; | 527 operands_type = kSmiCid; |
527 } else if (HasTwoMintOrSmi(ic_data) && | 528 } else if (FlowGraphCompiler::SupportsUnboxedMints() && |
528 FlowGraphCompiler::SupportsUnboxedMints()) { | 529 HasTwoMintOrSmi(ic_data) && |
| 530 HasOnlyOneSmi(ICData::Handle( |
| 531 ic_data.AsUnaryClassChecksForArgNr(1)))) { |
| 532 // Check for smi/mint << smi or smi/mint >> smi. |
529 operands_type = kMintCid; | 533 operands_type = kMintCid; |
530 } else { | 534 } else { |
531 return false; | 535 return false; |
532 } | 536 } |
533 break; | 537 break; |
534 case Token::kTRUNCDIV: | 538 case Token::kTRUNCDIV: |
535 case Token::kSHL: | |
536 if (HasOnlyTwoSmis(ic_data)) { | 539 if (HasOnlyTwoSmis(ic_data)) { |
537 operands_type = kSmiCid; | 540 operands_type = kSmiCid; |
538 } else { | 541 } else { |
539 return false; | 542 return false; |
540 } | 543 } |
541 break; | 544 break; |
542 default: | 545 default: |
543 UNREACHABLE(); | 546 UNREACHABLE(); |
544 }; | 547 }; |
545 | 548 |
(...skipping 11 matching lines...) Expand all Loading... |
557 call->env(), | 560 call->env(), |
558 Definition::kEffect); | 561 Definition::kEffect); |
559 | 562 |
560 BinaryDoubleOpInstr* double_bin_op = | 563 BinaryDoubleOpInstr* double_bin_op = |
561 new BinaryDoubleOpInstr(op_kind, left->Copy(), right->Copy(), call); | 564 new BinaryDoubleOpInstr(op_kind, left->Copy(), right->Copy(), call); |
562 call->ReplaceWith(double_bin_op, current_iterator()); | 565 call->ReplaceWith(double_bin_op, current_iterator()); |
563 RemovePushArguments(call); | 566 RemovePushArguments(call); |
564 } else if (operands_type == kMintCid) { | 567 } else if (operands_type == kMintCid) { |
565 Value* left = call->ArgumentAt(0)->value(); | 568 Value* left = call->ArgumentAt(0)->value(); |
566 Value* right = call->ArgumentAt(1)->value(); | 569 Value* right = call->ArgumentAt(1)->value(); |
567 if (op_kind == Token::kSHR) { | 570 if ((op_kind == Token::kSHR) || (op_kind == Token::kSHL)) { |
568 ShiftMintOpInstr* shift_op = | 571 ShiftMintOpInstr* shift_op = |
569 new ShiftMintOpInstr(op_kind, left, right, call); | 572 new ShiftMintOpInstr(op_kind, left, right, call); |
570 call->ReplaceWith(shift_op, current_iterator()); | 573 call->ReplaceWith(shift_op, current_iterator()); |
571 } else { | 574 } else { |
572 BinaryMintOpInstr* bin_op = | 575 BinaryMintOpInstr* bin_op = |
573 new BinaryMintOpInstr(op_kind, left, right, call); | 576 new BinaryMintOpInstr(op_kind, left, right, call); |
574 call->ReplaceWith(bin_op, current_iterator()); | 577 call->ReplaceWith(bin_op, current_iterator()); |
575 } | 578 } |
576 RemovePushArguments(call); | 579 RemovePushArguments(call); |
577 } else if (op_kind == Token::kMOD) { | 580 } else if (op_kind == Token::kMOD) { |
(...skipping 2671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3249 | 3252 |
3250 if (FLAG_trace_constant_propagation) { | 3253 if (FLAG_trace_constant_propagation) { |
3251 OS::Print("\n==== After constant propagation ====\n"); | 3254 OS::Print("\n==== After constant propagation ====\n"); |
3252 FlowGraphPrinter printer(*graph_); | 3255 FlowGraphPrinter printer(*graph_); |
3253 printer.PrintBlocks(); | 3256 printer.PrintBlocks(); |
3254 } | 3257 } |
3255 } | 3258 } |
3256 | 3259 |
3257 | 3260 |
3258 } // namespace dart | 3261 } // namespace dart |
OLD | NEW |