| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 } | 389 } |
| 390 if (m.left().IsNaN()) { | 390 if (m.left().IsNaN()) { |
| 391 return Replace(m.left().node()); | 391 return Replace(m.left().node()); |
| 392 } | 392 } |
| 393 if (m.IsFoldable()) { | 393 if (m.IsFoldable()) { |
| 394 return ReplaceFloat64( | 394 return ReplaceFloat64( |
| 395 base::ieee754::atan2(m.left().Value(), m.right().Value())); | 395 base::ieee754::atan2(m.left().Value(), m.right().Value())); |
| 396 } | 396 } |
| 397 break; | 397 break; |
| 398 } | 398 } |
| 399 case IrOpcode::kFloat64Atanh: { |
| 400 Float64Matcher m(node->InputAt(0)); |
| 401 if (m.HasValue()) return ReplaceFloat64(base::ieee754::atanh(m.Value())); |
| 402 break; |
| 403 } |
| 399 case IrOpcode::kFloat64Exp: { | 404 case IrOpcode::kFloat64Exp: { |
| 400 Float64Matcher m(node->InputAt(0)); | 405 Float64Matcher m(node->InputAt(0)); |
| 401 if (m.HasValue()) return ReplaceFloat64(base::ieee754::exp(m.Value())); | 406 if (m.HasValue()) return ReplaceFloat64(base::ieee754::exp(m.Value())); |
| 402 break; | 407 break; |
| 403 } | 408 } |
| 409 case IrOpcode::kFloat64Expm1: { |
| 410 Float64Matcher m(node->InputAt(0)); |
| 411 if (m.HasValue()) return ReplaceFloat64(base::ieee754::expm1(m.Value())); |
| 412 break; |
| 413 } |
| 404 case IrOpcode::kFloat64Log: { | 414 case IrOpcode::kFloat64Log: { |
| 405 Float64Matcher m(node->InputAt(0)); | 415 Float64Matcher m(node->InputAt(0)); |
| 406 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log(m.Value())); | 416 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log(m.Value())); |
| 407 break; | 417 break; |
| 408 } | 418 } |
| 409 case IrOpcode::kFloat64Log1p: { | 419 case IrOpcode::kFloat64Log1p: { |
| 410 Float64Matcher m(node->InputAt(0)); | 420 Float64Matcher m(node->InputAt(0)); |
| 411 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log1p(m.Value())); | 421 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log1p(m.Value())); |
| 412 break; | 422 break; |
| 413 } | 423 } |
| 414 case IrOpcode::kFloat64Log2: { | 424 case IrOpcode::kFloat64Log2: { |
| 415 Float64Matcher m(node->InputAt(0)); | 425 Float64Matcher m(node->InputAt(0)); |
| 416 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log2(m.Value())); | 426 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log2(m.Value())); |
| 417 break; | 427 break; |
| 418 } | 428 } |
| 419 case IrOpcode::kFloat64Log10: { | 429 case IrOpcode::kFloat64Log10: { |
| 420 Float64Matcher m(node->InputAt(0)); | 430 Float64Matcher m(node->InputAt(0)); |
| 421 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log10(m.Value())); | 431 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log10(m.Value())); |
| 422 break; | 432 break; |
| 423 } | 433 } |
| 434 case IrOpcode::kFloat64Cbrt: { |
| 435 Float64Matcher m(node->InputAt(0)); |
| 436 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cbrt(m.Value())); |
| 437 break; |
| 438 } |
| 424 case IrOpcode::kChangeFloat32ToFloat64: { | 439 case IrOpcode::kChangeFloat32ToFloat64: { |
| 425 Float32Matcher m(node->InputAt(0)); | 440 Float32Matcher m(node->InputAt(0)); |
| 426 if (m.HasValue()) return ReplaceFloat64(m.Value()); | 441 if (m.HasValue()) return ReplaceFloat64(m.Value()); |
| 427 break; | 442 break; |
| 428 } | 443 } |
| 429 case IrOpcode::kChangeFloat64ToInt32: { | 444 case IrOpcode::kChangeFloat64ToInt32: { |
| 430 Float64Matcher m(node->InputAt(0)); | 445 Float64Matcher m(node->InputAt(0)); |
| 431 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); | 446 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); |
| 432 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); | 447 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); |
| 433 break; | 448 break; |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1145 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
| 1131 return jsgraph()->machine(); | 1146 return jsgraph()->machine(); |
| 1132 } | 1147 } |
| 1133 | 1148 |
| 1134 | 1149 |
| 1135 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1150 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
| 1136 | 1151 |
| 1137 } // namespace compiler | 1152 } // namespace compiler |
| 1138 } // namespace internal | 1153 } // namespace internal |
| 1139 } // namespace v8 | 1154 } // namespace v8 |
| OLD | NEW |