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/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 } | 712 } |
713 | 713 |
714 | 714 |
715 void SimplifiedLowering::LowerAllNodes() { | 715 void SimplifiedLowering::LowerAllNodes() { |
716 SimplifiedOperatorBuilder simplified(graph()->zone()); | 716 SimplifiedOperatorBuilder simplified(graph()->zone()); |
717 RepresentationChanger changer(jsgraph(), &simplified, machine(), | 717 RepresentationChanger changer(jsgraph(), &simplified, machine(), |
718 graph()->zone()->isolate()); | 718 graph()->zone()->isolate()); |
719 RepresentationSelector selector(jsgraph(), zone(), &changer); | 719 RepresentationSelector selector(jsgraph(), zone(), &changer); |
720 selector.Run(this); | 720 selector.Run(this); |
721 | 721 |
722 LoweringBuilder::LowerAllNodes(); | 722 GraphReducer graph_reducer(graph()); |
| 723 graph_reducer.AddReducer(this); |
| 724 graph_reducer.ReduceGraph(); |
723 } | 725 } |
724 | 726 |
725 | 727 |
726 Node* SimplifiedLowering::Untag(Node* node) { | 728 Node* SimplifiedLowering::Untag(Node* node) { |
727 // TODO(titzer): factor this out to a TaggingScheme abstraction. | 729 // TODO(titzer): factor this out to a TaggingScheme abstraction. |
728 Node* shift_amount = jsgraph()->Int32Constant(kSmiTagSize + kSmiShiftSize); | 730 Node* shift_amount = jsgraph()->Int32Constant(kSmiTagSize + kSmiShiftSize); |
729 return graph()->NewNode(machine()->WordSar(), node, shift_amount); | 731 return graph()->NewNode(machine()->WordSar(), node, shift_amount); |
730 } | 732 } |
731 | 733 |
732 | 734 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 | 969 |
968 void SimplifiedLowering::DoStoreElement(Node* node) { | 970 void SimplifiedLowering::DoStoreElement(Node* node) { |
969 const ElementAccess& access = ElementAccessOf(node->op()); | 971 const ElementAccess& access = ElementAccessOf(node->op()); |
970 WriteBarrierKind kind = ComputeWriteBarrierKind( | 972 WriteBarrierKind kind = ComputeWriteBarrierKind( |
971 access.base_is_tagged, access.representation, access.type); | 973 access.base_is_tagged, access.representation, access.type); |
972 node->set_op(machine_.Store(access.representation, kind)); | 974 node->set_op(machine_.Store(access.representation, kind)); |
973 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); | 975 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
974 } | 976 } |
975 | 977 |
976 | 978 |
977 void SimplifiedLowering::Lower(Node* node) {} | 979 Reduction SimplifiedLowering::Reduce(Node* node) { return NoChange(); } |
978 | 980 |
979 | 981 |
980 void SimplifiedLowering::LowerChange(Node* node, Node* effect, Node* control) { | 982 void SimplifiedLowering::LowerChange(Node* node, Node* effect, Node* control) { |
981 switch (node->opcode()) { | 983 switch (node->opcode()) { |
982 case IrOpcode::kChangeTaggedToInt32: | 984 case IrOpcode::kChangeTaggedToInt32: |
983 DoChangeTaggedToUI32(node, effect, control, true); | 985 DoChangeTaggedToUI32(node, effect, control, true); |
984 break; | 986 break; |
985 case IrOpcode::kChangeTaggedToUint32: | 987 case IrOpcode::kChangeTaggedToUint32: |
986 DoChangeTaggedToUI32(node, effect, control, false); | 988 DoChangeTaggedToUI32(node, effect, control, false); |
987 break; | 989 break; |
(...skipping 17 matching lines...) Expand all Loading... |
1005 break; | 1007 break; |
1006 default: | 1008 default: |
1007 UNREACHABLE(); | 1009 UNREACHABLE(); |
1008 break; | 1010 break; |
1009 } | 1011 } |
1010 } | 1012 } |
1011 | 1013 |
1012 } // namespace compiler | 1014 } // namespace compiler |
1013 } // namespace internal | 1015 } // namespace internal |
1014 } // namespace v8 | 1016 } // namespace v8 |
OLD | NEW |