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/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 Float64Matcher m(node->InputAt(0)); | 576 Float64Matcher m(node->InputAt(0)); |
577 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); | 577 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); |
578 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); | 578 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); |
579 break; | 579 break; |
580 } | 580 } |
581 case IrOpcode::kFloat64InsertLowWord32: | 581 case IrOpcode::kFloat64InsertLowWord32: |
582 return ReduceFloat64InsertLowWord32(node); | 582 return ReduceFloat64InsertLowWord32(node); |
583 case IrOpcode::kFloat64InsertHighWord32: | 583 case IrOpcode::kFloat64InsertHighWord32: |
584 return ReduceFloat64InsertHighWord32(node); | 584 return ReduceFloat64InsertHighWord32(node); |
585 case IrOpcode::kStore: | 585 case IrOpcode::kStore: |
| 586 case IrOpcode::kUnalignedStore: |
586 case IrOpcode::kCheckedStore: | 587 case IrOpcode::kCheckedStore: |
587 return ReduceStore(node); | 588 return ReduceStore(node); |
588 case IrOpcode::kFloat64Equal: | 589 case IrOpcode::kFloat64Equal: |
589 case IrOpcode::kFloat64LessThan: | 590 case IrOpcode::kFloat64LessThan: |
590 case IrOpcode::kFloat64LessThanOrEqual: | 591 case IrOpcode::kFloat64LessThanOrEqual: |
591 return ReduceFloat64Compare(node); | 592 return ReduceFloat64Compare(node); |
592 default: | 593 default: |
593 break; | 594 break; |
594 } | 595 } |
595 return NoChange(); | 596 return NoChange(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 } | 791 } |
791 | 792 |
792 | 793 |
793 Reduction MachineOperatorReducer::ReduceStore(Node* node) { | 794 Reduction MachineOperatorReducer::ReduceStore(Node* node) { |
794 NodeMatcher nm(node); | 795 NodeMatcher nm(node); |
795 MachineRepresentation rep; | 796 MachineRepresentation rep; |
796 int value_input; | 797 int value_input; |
797 if (nm.IsCheckedStore()) { | 798 if (nm.IsCheckedStore()) { |
798 rep = CheckedStoreRepresentationOf(node->op()); | 799 rep = CheckedStoreRepresentationOf(node->op()); |
799 value_input = 3; | 800 value_input = 3; |
| 801 } else if (nm.IsStore()) { |
| 802 rep = StoreRepresentationOf(node->op()).representation(); |
| 803 value_input = 2; |
800 } else { | 804 } else { |
801 rep = StoreRepresentationOf(node->op()).representation(); | 805 DCHECK(nm.IsUnalignedStore()); |
| 806 rep = UnalignedStoreRepresentationOf(node->op()); |
802 value_input = 2; | 807 value_input = 2; |
803 } | 808 } |
804 | 809 |
805 Node* const value = node->InputAt(value_input); | 810 Node* const value = node->InputAt(value_input); |
806 | 811 |
807 switch (value->opcode()) { | 812 switch (value->opcode()) { |
808 case IrOpcode::kWord32And: { | 813 case IrOpcode::kWord32And: { |
809 Uint32BinopMatcher m(value); | 814 Uint32BinopMatcher m(value); |
810 if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 && | 815 if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 && |
811 (m.right().Value() & 0xff) == 0xff) || | 816 (m.right().Value() & 0xff) == 0xff) || |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1247 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
1243 return jsgraph()->machine(); | 1248 return jsgraph()->machine(); |
1244 } | 1249 } |
1245 | 1250 |
1246 | 1251 |
1247 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1252 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
1248 | 1253 |
1249 } // namespace compiler | 1254 } // namespace compiler |
1250 } // namespace internal | 1255 } // namespace internal |
1251 } // namespace v8 | 1256 } // namespace v8 |
OLD | NEW |