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 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 case IrOpcode::kFloat64Atan: { |
| 387 Float64Matcher m(node->InputAt(0)); |
| 388 if (m.HasValue()) return ReplaceFloat64(base::ieee754::atan(m.Value())); |
| 389 break; |
| 390 } |
| 391 case IrOpcode::kFloat64Atan2: { |
| 392 Float64BinopMatcher m(node); |
| 393 if (m.right().IsNaN()) { |
| 394 return Replace(m.right().node()); |
| 395 } |
| 396 if (m.left().IsNaN()) { |
| 397 return Replace(m.left().node()); |
| 398 } |
| 399 if (m.IsFoldable()) { |
| 400 return ReplaceFloat64( |
| 401 base::ieee754::atan2(m.left().Value(), m.right().Value())); |
| 402 } |
| 403 break; |
| 404 } |
386 case IrOpcode::kFloat64Log: { | 405 case IrOpcode::kFloat64Log: { |
387 Float64Matcher m(node->InputAt(0)); | 406 Float64Matcher m(node->InputAt(0)); |
388 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log(m.Value())); | 407 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log(m.Value())); |
389 break; | 408 break; |
390 } | 409 } |
391 case IrOpcode::kFloat64Log1p: { | 410 case IrOpcode::kFloat64Log1p: { |
392 Float64Matcher m(node->InputAt(0)); | 411 Float64Matcher m(node->InputAt(0)); |
393 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log1p(m.Value())); | 412 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log1p(m.Value())); |
394 break; | 413 break; |
395 } | 414 } |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1102 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
1084 return jsgraph()->machine(); | 1103 return jsgraph()->machine(); |
1085 } | 1104 } |
1086 | 1105 |
1087 | 1106 |
1088 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1107 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
1089 | 1108 |
1090 } // namespace compiler | 1109 } // namespace compiler |
1091 } // namespace internal | 1110 } // namespace internal |
1092 } // namespace v8 | 1111 } // namespace v8 |
OLD | NEW |