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/codegen.h" | 10 #include "src/codegen.h" |
10 #include "src/compiler/diamond.h" | 11 #include "src/compiler/diamond.h" |
11 #include "src/compiler/graph.h" | 12 #include "src/compiler/graph.h" |
12 #include "src/compiler/js-graph.h" | 13 #include "src/compiler/js-graph.h" |
13 #include "src/compiler/node-matchers.h" | 14 #include "src/compiler/node-matchers.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 namespace compiler { | 18 namespace compiler { |
18 | 19 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 if (m.left().IsNaN()) { // NaN % x => NaN | 378 if (m.left().IsNaN()) { // NaN % x => NaN |
378 return Replace(m.left().node()); | 379 return Replace(m.left().node()); |
379 } | 380 } |
380 if (m.IsFoldable()) { // K % K => K | 381 if (m.IsFoldable()) { // K % K => K |
381 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value())); | 382 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value())); |
382 } | 383 } |
383 break; | 384 break; |
384 } | 385 } |
385 case IrOpcode::kFloat64Log: { | 386 case IrOpcode::kFloat64Log: { |
386 Float64Matcher m(node->InputAt(0)); | 387 Float64Matcher m(node->InputAt(0)); |
387 if (m.HasValue()) return ReplaceFloat64(std::log(m.Value())); | 388 if (m.HasValue()) return ReplaceFloat64(base::ieee754::log(m.Value())); |
388 break; | 389 break; |
389 } | 390 } |
390 case IrOpcode::kChangeFloat32ToFloat64: { | 391 case IrOpcode::kChangeFloat32ToFloat64: { |
391 Float32Matcher m(node->InputAt(0)); | 392 Float32Matcher m(node->InputAt(0)); |
392 if (m.HasValue()) return ReplaceFloat64(m.Value()); | 393 if (m.HasValue()) return ReplaceFloat64(m.Value()); |
393 break; | 394 break; |
394 } | 395 } |
395 case IrOpcode::kChangeFloat64ToInt32: { | 396 case IrOpcode::kChangeFloat64ToInt32: { |
396 Float64Matcher m(node->InputAt(0)); | 397 Float64Matcher m(node->InputAt(0)); |
397 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); | 398 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 1078 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
1078 return jsgraph()->machine(); | 1079 return jsgraph()->machine(); |
1079 } | 1080 } |
1080 | 1081 |
1081 | 1082 |
1082 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 1083 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
1083 | 1084 |
1084 } // namespace compiler | 1085 } // namespace compiler |
1085 } // namespace internal | 1086 } // namespace internal |
1086 } // namespace v8 | 1087 } // namespace v8 |
OLD | NEW |