OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/machine-operator-reducer.h" | 5 #include "src/compiler/machine-operator-reducer.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/compiler/diamond.h" | 10 #include "src/compiler/diamond.h" |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 if (m.HasValue()) return ReplaceFloat32(DoubleToFloat32(m.Value())); | 432 if (m.HasValue()) return ReplaceFloat32(DoubleToFloat32(m.Value())); |
433 if (m.IsChangeFloat32ToFloat64()) return Replace(m.node()->InputAt(0)); | 433 if (m.IsChangeFloat32ToFloat64()) return Replace(m.node()->InputAt(0)); |
434 break; | 434 break; |
435 } | 435 } |
436 case IrOpcode::kFloat64InsertLowWord32: | 436 case IrOpcode::kFloat64InsertLowWord32: |
437 return ReduceFloat64InsertLowWord32(node); | 437 return ReduceFloat64InsertLowWord32(node); |
438 case IrOpcode::kFloat64InsertHighWord32: | 438 case IrOpcode::kFloat64InsertHighWord32: |
439 return ReduceFloat64InsertHighWord32(node); | 439 return ReduceFloat64InsertHighWord32(node); |
440 case IrOpcode::kStore: | 440 case IrOpcode::kStore: |
441 return ReduceStore(node); | 441 return ReduceStore(node); |
442 case IrOpcode::kUnalignedStore: | |
443 return ReduceUnalignedStore(node); | |
442 case IrOpcode::kFloat64Equal: | 444 case IrOpcode::kFloat64Equal: |
443 case IrOpcode::kFloat64LessThan: | 445 case IrOpcode::kFloat64LessThan: |
444 case IrOpcode::kFloat64LessThanOrEqual: | 446 case IrOpcode::kFloat64LessThanOrEqual: |
445 return ReduceFloat64Compare(node); | 447 return ReduceFloat64Compare(node); |
446 default: | 448 default: |
447 break; | 449 break; |
448 } | 450 } |
449 return NoChange(); | 451 return NoChange(); |
450 } | 452 } |
451 | 453 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
705 } | 707 } |
706 } | 708 } |
707 break; | 709 break; |
708 } | 710 } |
709 default: | 711 default: |
710 break; | 712 break; |
711 } | 713 } |
712 return NoChange(); | 714 return NoChange(); |
713 } | 715 } |
714 | 716 |
717 Reduction MachineOperatorReducer::ReduceUnalignedStore(Node* node) { | |
titzer
2016/03/22 15:00:20
This looks like an exact duplicate of the above me
titzer
2016/03/29 08:42:48
New patchset got lost here?
| |
718 MachineRepresentation const rep = UnalignedStoreRepresentationOf(node->op()); | |
719 Node* const value = node->InputAt(2); | |
720 switch (value->opcode()) { | |
721 case IrOpcode::kWord32And: { | |
722 Uint32BinopMatcher m(value); | |
723 if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 && | |
724 (m.right().Value() & 0xff) == 0xff) || | |
725 (rep == MachineRepresentation::kWord16 && | |
726 (m.right().Value() & 0xffff) == 0xffff))) { | |
727 node->ReplaceInput(2, m.left().node()); | |
728 return Changed(node); | |
729 } | |
730 break; | |
731 } | |
732 case IrOpcode::kWord32Sar: { | |
733 Int32BinopMatcher m(value); | |
734 if (m.left().IsWord32Shl() && ((rep == MachineRepresentation::kWord8 && | |
735 m.right().IsInRange(1, 24)) || | |
736 (rep == MachineRepresentation::kWord16 && | |
737 m.right().IsInRange(1, 16)))) { | |
738 Int32BinopMatcher mleft(m.left().node()); | |
739 if (mleft.right().Is(m.right().Value())) { | |
740 node->ReplaceInput(2, mleft.left().node()); | |
741 return Changed(node); | |
742 } | |
743 } | |
744 break; | |
745 } | |
746 default: | |
747 break; | |
748 } | |
749 return NoChange(); | |
750 } | |
751 | |
715 | 752 |
716 Reduction MachineOperatorReducer::ReduceProjection(size_t index, Node* node) { | 753 Reduction MachineOperatorReducer::ReduceProjection(size_t index, Node* node) { |
717 switch (node->opcode()) { | 754 switch (node->opcode()) { |
718 case IrOpcode::kInt32AddWithOverflow: { | 755 case IrOpcode::kInt32AddWithOverflow: { |
719 DCHECK(index == 0 || index == 1); | 756 DCHECK(index == 0 || index == 1); |
720 Int32BinopMatcher m(node); | 757 Int32BinopMatcher m(node); |
721 if (m.IsFoldable()) { | 758 if (m.IsFoldable()) { |
722 int32_t val; | 759 int32_t val; |
723 bool ovf = base::bits::SignedAddOverflow32(m.left().Value(), | 760 bool ovf = base::bits::SignedAddOverflow32(m.left().Value(), |
724 m.right().Value(), &val); | 761 m.right().Value(), &val); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1082 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1119 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
1083 return jsgraph()->machine(); | 1120 return jsgraph()->machine(); |
1084 } | 1121 } |
1085 | 1122 |
1086 | 1123 |
1087 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1124 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
1088 | 1125 |
1089 } // namespace compiler | 1126 } // namespace compiler |
1090 } // namespace internal | 1127 } // namespace internal |
1091 } // namespace v8 | 1128 } // namespace v8 |
OLD | NEW |