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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 Float64Matcher m(node->InputAt(0)); | 561 Float64Matcher m(node->InputAt(0)); |
562 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); | 562 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); |
563 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); | 563 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); |
564 break; | 564 break; |
565 } | 565 } |
566 case IrOpcode::kFloat64InsertLowWord32: | 566 case IrOpcode::kFloat64InsertLowWord32: |
567 return ReduceFloat64InsertLowWord32(node); | 567 return ReduceFloat64InsertLowWord32(node); |
568 case IrOpcode::kFloat64InsertHighWord32: | 568 case IrOpcode::kFloat64InsertHighWord32: |
569 return ReduceFloat64InsertHighWord32(node); | 569 return ReduceFloat64InsertHighWord32(node); |
570 case IrOpcode::kStore: | 570 case IrOpcode::kStore: |
| 571 case IrOpcode::kUnalignedStore: |
571 case IrOpcode::kCheckedStore: | 572 case IrOpcode::kCheckedStore: |
572 return ReduceStore(node); | 573 return ReduceStore(node); |
573 case IrOpcode::kFloat64Equal: | 574 case IrOpcode::kFloat64Equal: |
574 case IrOpcode::kFloat64LessThan: | 575 case IrOpcode::kFloat64LessThan: |
575 case IrOpcode::kFloat64LessThanOrEqual: | 576 case IrOpcode::kFloat64LessThanOrEqual: |
576 return ReduceFloat64Compare(node); | 577 return ReduceFloat64Compare(node); |
577 default: | 578 default: |
578 break; | 579 break; |
579 } | 580 } |
580 return NoChange(); | 581 return NoChange(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 } | 776 } |
776 | 777 |
777 | 778 |
778 Reduction MachineOperatorReducer::ReduceStore(Node* node) { | 779 Reduction MachineOperatorReducer::ReduceStore(Node* node) { |
779 NodeMatcher nm(node); | 780 NodeMatcher nm(node); |
780 MachineRepresentation rep; | 781 MachineRepresentation rep; |
781 int value_input; | 782 int value_input; |
782 if (nm.IsCheckedStore()) { | 783 if (nm.IsCheckedStore()) { |
783 rep = CheckedStoreRepresentationOf(node->op()); | 784 rep = CheckedStoreRepresentationOf(node->op()); |
784 value_input = 3; | 785 value_input = 3; |
| 786 } else if (nm.IsStore()) { |
| 787 rep = StoreRepresentationOf(node->op()).representation(); |
| 788 value_input = 2; |
785 } else { | 789 } else { |
786 rep = StoreRepresentationOf(node->op()).representation(); | 790 DCHECK(nm.IsUnalignedStore()); |
| 791 rep = UnalignedStoreRepresentationOf(node->op()); |
787 value_input = 2; | 792 value_input = 2; |
788 } | 793 } |
789 | 794 |
790 Node* const value = node->InputAt(value_input); | 795 Node* const value = node->InputAt(value_input); |
791 | 796 |
792 switch (value->opcode()) { | 797 switch (value->opcode()) { |
793 case IrOpcode::kWord32And: { | 798 case IrOpcode::kWord32And: { |
794 Uint32BinopMatcher m(value); | 799 Uint32BinopMatcher m(value); |
795 if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 && | 800 if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 && |
796 (m.right().Value() & 0xff) == 0xff) || | 801 (m.right().Value() & 0xff) == 0xff) || |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1215 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
1211 return jsgraph()->machine(); | 1216 return jsgraph()->machine(); |
1212 } | 1217 } |
1213 | 1218 |
1214 | 1219 |
1215 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1220 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
1216 | 1221 |
1217 } // namespace compiler | 1222 } // namespace compiler |
1218 } // namespace internal | 1223 } // namespace internal |
1219 } // namespace v8 | 1224 } // namespace v8 |
OLD | NEW |