| 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/compiler/generic-node-inl.h" | 8 #include "src/compiler/generic-node-inl.h" |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 return Replace(m.right().node()); | 376 return Replace(m.right().node()); |
| 377 } | 377 } |
| 378 if (m.left().IsNaN()) { // NaN % x => NaN | 378 if (m.left().IsNaN()) { // NaN % x => NaN |
| 379 return Replace(m.left().node()); | 379 return Replace(m.left().node()); |
| 380 } | 380 } |
| 381 if (m.IsFoldable()) { // K % K => K | 381 if (m.IsFoldable()) { // K % K => K |
| 382 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value())); | 382 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value())); |
| 383 } | 383 } |
| 384 break; | 384 break; |
| 385 } | 385 } |
| 386 // TODO(turbofan): Reduce float64/float32 changes and truncation. |
| 386 case IrOpcode::kChangeFloat64ToInt32: { | 387 case IrOpcode::kChangeFloat64ToInt32: { |
| 387 Float64Matcher m(node->InputAt(0)); | 388 Float64Matcher m(node->InputAt(0)); |
| 388 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); | 389 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); |
| 389 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); | 390 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); |
| 390 break; | 391 break; |
| 391 } | 392 } |
| 392 case IrOpcode::kChangeFloat64ToUint32: { | 393 case IrOpcode::kChangeFloat64ToUint32: { |
| 393 Float64Matcher m(node->InputAt(0)); | 394 Float64Matcher m(node->InputAt(0)); |
| 394 if (m.HasValue()) return ReplaceInt32(FastD2UI(m.Value())); | 395 if (m.HasValue()) return ReplaceInt32(FastD2UI(m.Value())); |
| 395 if (m.IsChangeUint32ToFloat64()) return Replace(m.node()->InputAt(0)); | 396 if (m.IsChangeUint32ToFloat64()) return Replace(m.node()->InputAt(0)); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 481 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
| 481 return jsgraph()->machine(); | 482 return jsgraph()->machine(); |
| 482 } | 483 } |
| 483 | 484 |
| 484 | 485 |
| 485 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 486 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
| 486 | 487 |
| 487 } // namespace compiler | 488 } // namespace compiler |
| 488 } // namespace internal | 489 } // namespace internal |
| 489 } // namespace v8 | 490 } // namespace v8 |
| OLD | NEW |