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/compiler/generic-node-inl.h" | 8 #include "src/compiler/generic-node-inl.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); | 420 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); |
421 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); | 421 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); |
422 break; | 422 break; |
423 } | 423 } |
424 case IrOpcode::kTruncateInt64ToInt32: { | 424 case IrOpcode::kTruncateInt64ToInt32: { |
425 Int64Matcher m(node->InputAt(0)); | 425 Int64Matcher m(node->InputAt(0)); |
426 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); | 426 if (m.HasValue()) return ReplaceInt32(static_cast<int32_t>(m.Value())); |
427 if (m.IsChangeInt32ToInt64()) return Replace(m.node()->InputAt(0)); | 427 if (m.IsChangeInt32ToInt64()) return Replace(m.node()->InputAt(0)); |
428 break; | 428 break; |
429 } | 429 } |
430 // TODO(turbofan): strength-reduce and fold floating point operations. | |
431 default: | 430 default: |
432 break; | 431 break; |
433 } | 432 } |
434 return NoChange(); | 433 return NoChange(); |
435 } | 434 } |
436 | 435 |
437 | 436 |
438 Reduction MachineOperatorReducer::ReduceProjection(size_t index, Node* node) { | 437 Reduction MachineOperatorReducer::ReduceProjection(size_t index, Node* node) { |
439 switch (node->opcode()) { | 438 switch (node->opcode()) { |
440 case IrOpcode::kInt32AddWithOverflow: { | 439 case IrOpcode::kInt32AddWithOverflow: { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 MachineOperatorBuilder* MachineOperatorReducer::machine() const { | 479 MachineOperatorBuilder* MachineOperatorReducer::machine() const { |
481 return jsgraph()->machine(); | 480 return jsgraph()->machine(); |
482 } | 481 } |
483 | 482 |
484 | 483 |
485 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } | 484 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } |
486 | 485 |
487 } // namespace compiler | 486 } // namespace compiler |
488 } // namespace internal | 487 } // namespace internal |
489 } // namespace v8 | 488 } // namespace v8 |
OLD | NEW |