| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 return Replace(m.left().node()); | 383 return Replace(m.left().node()); |
| 384 } | 384 } |
| 385 if (m.IsFoldable()) { // K / K => K | 385 if (m.IsFoldable()) { // K / K => K |
| 386 return ReplaceFloat64(m.left().Value() / m.right().Value()); | 386 return ReplaceFloat64(m.left().Value() / m.right().Value()); |
| 387 } | 387 } |
| 388 break; | 388 break; |
| 389 } | 389 } |
| 390 case IrOpcode::kFloat64Mod: { | 390 case IrOpcode::kFloat64Mod: { |
| 391 Float64BinopMatcher m(node); | 391 Float64BinopMatcher m(node); |
| 392 if (m.right().Is(0)) { // x % 0 => NaN | 392 if (m.right().Is(0)) { // x % 0 => NaN |
| 393 return ReplaceFloat64(base::OS::nan_value()); | 393 return ReplaceFloat64(std::numeric_limits<double>::quiet_NaN()); |
| 394 } | 394 } |
| 395 if (m.right().IsNaN()) { // x % NaN => NaN | 395 if (m.right().IsNaN()) { // x % NaN => NaN |
| 396 return Replace(m.right().node()); | 396 return Replace(m.right().node()); |
| 397 } | 397 } |
| 398 if (m.left().IsNaN()) { // NaN % x => NaN | 398 if (m.left().IsNaN()) { // NaN % x => NaN |
| 399 return Replace(m.left().node()); | 399 return Replace(m.left().node()); |
| 400 } | 400 } |
| 401 if (m.IsFoldable()) { // K % K => K | 401 if (m.IsFoldable()) { // K % K => K |
| 402 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value())); | 402 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value())); |
| 403 } | 403 } |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 942 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
| 943 return jsgraph()->machine(); | 943 return jsgraph()->machine(); |
| 944 } | 944 } |
| 945 | 945 |
| 946 | 946 |
| 947 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 947 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
| 948 | 948 |
| 949 } // namespace compiler | 949 } // namespace compiler |
| 950 } // namespace internal | 950 } // namespace internal |
| 951 } // namespace v8 | 951 } // namespace v8 |
| OLD | NEW |