| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 case IrOpcode::kFloat64Cbrt: { | 394 case IrOpcode::kFloat64Cbrt: { |
| 395 Float64Matcher m(node->InputAt(0)); | 395 Float64Matcher m(node->InputAt(0)); |
| 396 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cbrt(m.Value())); | 396 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cbrt(m.Value())); |
| 397 break; | 397 break; |
| 398 } | 398 } |
| 399 case IrOpcode::kFloat64Cos: { | 399 case IrOpcode::kFloat64Cos: { |
| 400 Float64Matcher m(node->InputAt(0)); | 400 Float64Matcher m(node->InputAt(0)); |
| 401 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cos(m.Value())); | 401 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cos(m.Value())); |
| 402 break; | 402 break; |
| 403 } | 403 } |
| 404 case IrOpcode::kFloat64Cosh: { |
| 405 Float64Matcher m(node->InputAt(0)); |
| 406 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cosh(m.Value())); |
| 407 break; |
| 408 } |
| 404 case IrOpcode::kFloat64Exp: { | 409 case IrOpcode::kFloat64Exp: { |
| 405 Float64Matcher m(node->InputAt(0)); | 410 Float64Matcher m(node->InputAt(0)); |
| 406 if (m.HasValue()) return ReplaceFloat64(base::ieee754::exp(m.Value())); | 411 if (m.HasValue()) return ReplaceFloat64(base::ieee754::exp(m.Value())); |
| 407 break; | 412 break; |
| 408 } | 413 } |
| 409 case IrOpcode::kFloat64Expm1: { | 414 case IrOpcode::kFloat64Expm1: { |
| 410 Float64Matcher m(node->InputAt(0)); | 415 Float64Matcher m(node->InputAt(0)); |
| 411 if (m.HasValue()) return ReplaceFloat64(base::ieee754::expm1(m.Value())); | 416 if (m.HasValue()) return ReplaceFloat64(base::ieee754::expm1(m.Value())); |
| 412 break; | 417 break; |
| 413 } | 418 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 // x ** 0.5 => if x <= -Infinity then Infinity else sqrt(0.0 + x) | 460 // x ** 0.5 => if x <= -Infinity then Infinity else sqrt(0.0 + x) |
| 456 return Replace(Float64PowHalf(m.left().node())); | 461 return Replace(Float64PowHalf(m.left().node())); |
| 457 } | 462 } |
| 458 break; | 463 break; |
| 459 } | 464 } |
| 460 case IrOpcode::kFloat64Sin: { | 465 case IrOpcode::kFloat64Sin: { |
| 461 Float64Matcher m(node->InputAt(0)); | 466 Float64Matcher m(node->InputAt(0)); |
| 462 if (m.HasValue()) return ReplaceFloat64(base::ieee754::sin(m.Value())); | 467 if (m.HasValue()) return ReplaceFloat64(base::ieee754::sin(m.Value())); |
| 463 break; | 468 break; |
| 464 } | 469 } |
| 470 case IrOpcode::kFloat64Sinh: { |
| 471 Float64Matcher m(node->InputAt(0)); |
| 472 if (m.HasValue()) return ReplaceFloat64(base::ieee754::sinh(m.Value())); |
| 473 break; |
| 474 } |
| 465 case IrOpcode::kFloat64Tan: { | 475 case IrOpcode::kFloat64Tan: { |
| 466 Float64Matcher m(node->InputAt(0)); | 476 Float64Matcher m(node->InputAt(0)); |
| 467 if (m.HasValue()) return ReplaceFloat64(base::ieee754::tan(m.Value())); | 477 if (m.HasValue()) return ReplaceFloat64(base::ieee754::tan(m.Value())); |
| 468 break; | 478 break; |
| 469 } | 479 } |
| 480 case IrOpcode::kFloat64Tanh: { |
| 481 Float64Matcher m(node->InputAt(0)); |
| 482 if (m.HasValue()) return ReplaceFloat64(base::ieee754::tanh(m.Value())); |
| 483 break; |
| 484 } |
| 470 case IrOpcode::kChangeFloat32ToFloat64: { | 485 case IrOpcode::kChangeFloat32ToFloat64: { |
| 471 Float32Matcher m(node->InputAt(0)); | 486 Float32Matcher m(node->InputAt(0)); |
| 472 if (m.HasValue()) return ReplaceFloat64(m.Value()); | 487 if (m.HasValue()) return ReplaceFloat64(m.Value()); |
| 473 break; | 488 break; |
| 474 } | 489 } |
| 475 case IrOpcode::kChangeFloat64ToInt32: { | 490 case IrOpcode::kChangeFloat64ToInt32: { |
| 476 Float64Matcher m(node->InputAt(0)); | 491 Float64Matcher m(node->InputAt(0)); |
| 477 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); | 492 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); |
| 478 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); | 493 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); |
| 479 break; | 494 break; |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1190 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
| 1176 return jsgraph()->machine(); | 1191 return jsgraph()->machine(); |
| 1177 } | 1192 } |
| 1178 | 1193 |
| 1179 | 1194 |
| 1180 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1195 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
| 1181 | 1196 |
| 1182 } // namespace compiler | 1197 } // namespace compiler |
| 1183 } // namespace internal | 1198 } // namespace internal |
| 1184 } // namespace v8 | 1199 } // namespace v8 |
| OLD | NEW |