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-operator-reducer.h" | 5 #include "src/compiler/simplified-operator-reducer.h" |
6 | 6 |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 m.node()->InputAt(0)); | 93 m.node()->InputAt(0)); |
94 } | 94 } |
95 if (m.IsChangeUint32ToTagged()) return Replace(m.node()->InputAt(0)); | 95 if (m.IsChangeUint32ToTagged()) return Replace(m.node()->InputAt(0)); |
96 break; | 96 break; |
97 } | 97 } |
98 case IrOpcode::kChangeUint32ToTagged: { | 98 case IrOpcode::kChangeUint32ToTagged: { |
99 Uint32Matcher m(node->InputAt(0)); | 99 Uint32Matcher m(node->InputAt(0)); |
100 if (m.HasValue()) return ReplaceNumber(FastUI2D(m.Value())); | 100 if (m.HasValue()) return ReplaceNumber(FastUI2D(m.Value())); |
101 break; | 101 break; |
102 } | 102 } |
| 103 case IrOpcode::kStoreField: { |
| 104 // TODO(turbofan): Poor man's store elimination, remove this once we have |
| 105 // a fully featured store elimination in place. |
| 106 Node* const effect = node->InputAt(2); |
| 107 if (effect->op()->Equals(node->op()) && effect->OwnedBy(node) && |
| 108 effect->InputAt(0) == node->InputAt(0)) { |
| 109 // The {effect} is a store to the same field in the same object, and |
| 110 // {node} is the only effect observer, so we can kill {effect} and |
| 111 // instead make {node} depend on the incoming effect to {effect}. |
| 112 node->ReplaceInput(2, effect->InputAt(2)); |
| 113 effect->Kill(); |
| 114 return Changed(node); |
| 115 } |
| 116 break; |
| 117 } |
103 default: | 118 default: |
104 break; | 119 break; |
105 } | 120 } |
106 return NoChange(); | 121 return NoChange(); |
107 } | 122 } |
108 | 123 |
109 | 124 |
110 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op, | 125 Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op, |
111 Node* a) { | 126 Node* a) { |
112 DCHECK_EQ(node->InputCount(), OperatorProperties::GetTotalInputCount(op)); | 127 DCHECK_EQ(node->InputCount(), OperatorProperties::GetTotalInputCount(op)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 160 } |
146 | 161 |
147 | 162 |
148 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { | 163 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { |
149 return jsgraph()->machine(); | 164 return jsgraph()->machine(); |
150 } | 165 } |
151 | 166 |
152 } // namespace compiler | 167 } // namespace compiler |
153 } // namespace internal | 168 } // namespace internal |
154 } // namespace v8 | 169 } // namespace v8 |
OLD | NEW |