| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); | 426 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); |
| 427 if (m.IsChangeInt32ToInt64()) return Replace(m.node()->InputAt(0)); | 427 if (m.IsChangeInt32ToInt64()) return Replace(m.node()->InputAt(0)); |
| 428 break; | 428 break; |
| 429 } | 429 } |
| 430 case IrOpcode::kTruncateFloat64ToFloat32: { | 430 case IrOpcode::kTruncateFloat64ToFloat32: { |
| 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::kFloat64InsertWord32: |
| 437 return ReduceFloat64InsertWord32(node); |
| 436 case IrOpcode::kStore: | 438 case IrOpcode::kStore: |
| 437 return ReduceStore(node); | 439 return ReduceStore(node); |
| 438 default: | 440 default: |
| 439 break; | 441 break; |
| 440 } | 442 } |
| 441 return NoChange(); | 443 return NoChange(); |
| 442 } | 444 } |
| 443 | 445 |
| 444 | 446 |
| 445 Reduction MachineOperatorReducer::ReduceInt32Add(Node* node) { | 447 Reduction MachineOperatorReducer::ReduceInt32Add(Node* node) { |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 if (!msub.left().Is(32) || msub.right().node() != y) return NoChange(); | 970 if (!msub.left().Is(32) || msub.right().node() != y) return NoChange(); |
| 969 } | 971 } |
| 970 | 972 |
| 971 node->set_op(machine()->Word32Ror()); | 973 node->set_op(machine()->Word32Ror()); |
| 972 node->ReplaceInput(0, mshl.left().node()); | 974 node->ReplaceInput(0, mshl.left().node()); |
| 973 node->ReplaceInput(1, mshr.right().node()); | 975 node->ReplaceInput(1, mshr.right().node()); |
| 974 return Changed(node); | 976 return Changed(node); |
| 975 } | 977 } |
| 976 | 978 |
| 977 | 979 |
| 980 Reduction MachineOperatorReducer::ReduceFloat64InsertWord32(Node* node) { |
| 981 DCHECK_EQ(IrOpcode::kFloat64InsertWord32, node->opcode()); |
| 982 Float64Matcher mlhs(node->InputAt(0)); |
| 983 Uint32Matcher mrhs(node->InputAt(1)); |
| 984 if (mlhs.HasValue() && mrhs.HasValue()) { |
| 985 return ReplaceFloat64(bit_cast<double>( |
| 986 base::bits::InsertElement64(bit_cast<uint64_t>(mlhs.Value()), |
| 987 mrhs.Value(), OpParameter<int>(node)))); |
| 988 } |
| 989 return NoChange(); |
| 990 } |
| 991 |
| 992 |
| 978 CommonOperatorBuilder* MachineOperatorReducer::common() const { | 993 CommonOperatorBuilder* MachineOperatorReducer::common() const { |
| 979 return jsgraph()->common(); | 994 return jsgraph()->common(); |
| 980 } | 995 } |
| 981 | 996 |
| 982 | 997 |
| 983 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 998 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
| 984 return jsgraph()->machine(); | 999 return jsgraph()->machine(); |
| 985 } | 1000 } |
| 986 | 1001 |
| 987 | 1002 |
| 988 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1003 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
| 989 | 1004 |
| 990 } // namespace compiler | 1005 } // namespace compiler |
| 991 } // namespace internal | 1006 } // namespace internal |
| 992 } // namespace v8 | 1007 } // namespace v8 |
| OLD | NEW |