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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 return Changed(node); | 641 return Changed(node); |
642 } | 642 } |
643 return NoChange(); | 643 return NoChange(); |
644 } | 644 } |
645 | 645 |
646 | 646 |
647 Reduction MachineOperatorReducer::ReduceTruncateFloat64ToInt32(Node* node) { | 647 Reduction MachineOperatorReducer::ReduceTruncateFloat64ToInt32(Node* node) { |
648 Float64Matcher m(node->InputAt(0)); | 648 Float64Matcher m(node->InputAt(0)); |
649 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); | 649 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); |
650 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); | 650 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); |
| 651 if (m.IsRoundInt64ToFloat64()) return Replace(m.node()->InputAt(0)); |
651 if (m.IsPhi()) { | 652 if (m.IsPhi()) { |
652 Node* const phi = m.node(); | 653 Node* const phi = m.node(); |
653 DCHECK_EQ(kRepFloat64, RepresentationOf(OpParameter<MachineType>(phi))); | 654 DCHECK_EQ(kRepFloat64, RepresentationOf(OpParameter<MachineType>(phi))); |
654 if (phi->OwnedBy(node)) { | 655 if (phi->OwnedBy(node)) { |
655 // TruncateFloat64ToInt32[mode](Phi[Float64](x1,...,xn)) | 656 // TruncateFloat64ToInt32[mode](Phi[Float64](x1,...,xn)) |
656 // => Phi[Int32](TruncateFloat64ToInt32[mode](x1), | 657 // => Phi[Int32](TruncateFloat64ToInt32[mode](x1), |
657 // ..., | 658 // ..., |
658 // TruncateFloat64ToInt32[mode](xn)) | 659 // TruncateFloat64ToInt32[mode](xn)) |
659 const int value_input_count = phi->InputCount() - 1; | 660 const int value_input_count = phi->InputCount() - 1; |
660 for (int i = 0; i < value_input_count; ++i) { | 661 for (int i = 0; i < value_input_count; ++i) { |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1077 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
1077 return jsgraph()->machine(); | 1078 return jsgraph()->machine(); |
1078 } | 1079 } |
1079 | 1080 |
1080 | 1081 |
1081 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1082 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
1082 | 1083 |
1083 } // namespace compiler | 1084 } // namespace compiler |
1084 } // namespace internal | 1085 } // namespace internal |
1085 } // namespace v8 | 1086 } // namespace v8 |
OLD | NEW |