| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 Float64Matcher m(node->InputAt(0)); | 431 Float64Matcher m(node->InputAt(0)); |
| 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 case IrOpcode::kUnalignedStore: |
| 441 return ReduceStore(node); | 442 return ReduceStore(node); |
| 442 case IrOpcode::kFloat64Equal: | 443 case IrOpcode::kFloat64Equal: |
| 443 case IrOpcode::kFloat64LessThan: | 444 case IrOpcode::kFloat64LessThan: |
| 444 case IrOpcode::kFloat64LessThanOrEqual: | 445 case IrOpcode::kFloat64LessThanOrEqual: |
| 445 return ReduceFloat64Compare(node); | 446 return ReduceFloat64Compare(node); |
| 446 default: | 447 default: |
| 447 break; | 448 break; |
| 448 } | 449 } |
| 449 return NoChange(); | 450 return NoChange(); |
| 450 } | 451 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 phi, | 671 phi, |
| 671 common()->Phi(MachineRepresentation::kWord32, value_input_count)); | 672 common()->Phi(MachineRepresentation::kWord32, value_input_count)); |
| 672 return Replace(phi); | 673 return Replace(phi); |
| 673 } | 674 } |
| 674 } | 675 } |
| 675 return NoChange(); | 676 return NoChange(); |
| 676 } | 677 } |
| 677 | 678 |
| 678 | 679 |
| 679 Reduction MachineOperatorReducer::ReduceStore(Node* node) { | 680 Reduction MachineOperatorReducer::ReduceStore(Node* node) { |
| 680 MachineRepresentation const rep = | 681 MachineRepresentation rep; |
| 681 StoreRepresentationOf(node->op()).representation(); | |
| 682 Node* const value = node->InputAt(2); | 682 Node* const value = node->InputAt(2); |
| 683 |
| 684 switch (node->opcode()) { |
| 685 case IrOpcode::kStore: |
| 686 rep = StoreRepresentationOf(node->op()).representation(); |
| 687 break; |
| 688 case IrOpcode::kUnalignedStore: |
| 689 rep = UnalignedStoreRepresentationOf(node->op()); |
| 690 break; |
| 691 default: |
| 692 UNREACHABLE(); |
| 693 break; |
| 694 } |
| 695 |
| 683 switch (value->opcode()) { | 696 switch (value->opcode()) { |
| 684 case IrOpcode::kWord32And: { | 697 case IrOpcode::kWord32And: { |
| 685 Uint32BinopMatcher m(value); | 698 Uint32BinopMatcher m(value); |
| 686 if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 && | 699 if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 && |
| 687 (m.right().Value() & 0xff) == 0xff) || | 700 (m.right().Value() & 0xff) == 0xff) || |
| 688 (rep == MachineRepresentation::kWord16 && | 701 (rep == MachineRepresentation::kWord16 && |
| 689 (m.right().Value() & 0xffff) == 0xffff))) { | 702 (m.right().Value() & 0xffff) == 0xffff))) { |
| 690 node->ReplaceInput(2, m.left().node()); | 703 node->ReplaceInput(2, m.left().node()); |
| 691 return Changed(node); | 704 return Changed(node); |
| 692 } | 705 } |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1095 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
| 1083 return jsgraph()->machine(); | 1096 return jsgraph()->machine(); |
| 1084 } | 1097 } |
| 1085 | 1098 |
| 1086 | 1099 |
| 1087 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1100 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
| 1088 | 1101 |
| 1089 } // namespace compiler | 1102 } // namespace compiler |
| 1090 } // namespace internal | 1103 } // namespace internal |
| 1091 } // namespace v8 | 1104 } // namespace v8 |
| OLD | NEW |