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/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/diamond.h" | 8 #include "src/compiler/diamond.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 d.Phi(type, graph()->NewNode(op, LoadHeapNumberValue(value, d.if_true)), | 192 d.Phi(type, graph()->NewNode(op, LoadHeapNumberValue(value, d.if_true)), |
193 ChangeSmiToInt32(value))); | 193 ChangeSmiToInt32(value))); |
194 } | 194 } |
195 | 195 |
196 | 196 |
197 namespace { | 197 namespace { |
198 | 198 |
199 bool CanCover(Node* value, IrOpcode::Value opcode) { | 199 bool CanCover(Node* value, IrOpcode::Value opcode) { |
200 if (value->opcode() != opcode) return false; | 200 if (value->opcode() != opcode) return false; |
201 bool first = true; | 201 bool first = true; |
202 for (auto i = value->uses().begin(); i != value->uses().end(); ++i) { | 202 for (Edge const edge : value->use_edges()) { |
203 if (NodeProperties::IsEffectEdge(i.edge())) continue; | 203 if (NodeProperties::IsEffectEdge(edge)) continue; |
204 DCHECK(NodeProperties::IsValueEdge(i.edge())); | 204 DCHECK(NodeProperties::IsValueEdge(edge)); |
205 if (!first) return false; | 205 if (!first) return false; |
206 first = false; | 206 first = false; |
207 } | 207 } |
208 return true; | 208 return true; |
209 } | 209 } |
210 | 210 |
211 } // namespace | 211 } // namespace |
212 | 212 |
213 | 213 |
214 Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) { | 214 Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) { |
(...skipping 14 matching lines...) Expand all Loading... |
229 Node* number = | 229 Node* number = |
230 graph()->NewNode(value->op(), object, context, effect, d1.if_true); | 230 graph()->NewNode(value->op(), object, context, effect, d1.if_true); |
231 Diamond d2(graph(), common(), TestNotSmi(number)); | 231 Diamond d2(graph(), common(), TestNotSmi(number)); |
232 d2.Nest(d1, true); | 232 d2.Nest(d1, true); |
233 Node* phi2 = d2.Phi(kMachFloat64, LoadHeapNumberValue(number, d2.if_true), | 233 Node* phi2 = d2.Phi(kMachFloat64, LoadHeapNumberValue(number, d2.if_true), |
234 ChangeSmiToFloat64(number)); | 234 ChangeSmiToFloat64(number)); |
235 | 235 |
236 Node* phi1 = d1.Phi(kMachFloat64, phi2, ChangeSmiToFloat64(object)); | 236 Node* phi1 = d1.Phi(kMachFloat64, phi2, ChangeSmiToFloat64(object)); |
237 Node* ephi1 = d1.EffectPhi(number, effect); | 237 Node* ephi1 = d1.EffectPhi(number, effect); |
238 | 238 |
239 for (auto i = value->uses().begin(); i != value->uses().end();) { | 239 for (Edge edge : value->use_edges()) { |
240 if (NodeProperties::IsEffectEdge(i.edge())) { | 240 if (NodeProperties::IsEffectEdge(edge)) { |
241 i.UpdateToAndIncrement(ephi1); | 241 edge.UpdateTo(ephi1); |
242 } else { | |
243 ++i; | |
244 } | 242 } |
245 } | 243 } |
246 return Replace(phi1); | 244 return Replace(phi1); |
247 } | 245 } |
248 | 246 |
249 Diamond d(graph(), common(), TestNotSmi(value), BranchHint::kFalse); | 247 Diamond d(graph(), common(), TestNotSmi(value), BranchHint::kFalse); |
250 d.Chain(control); | 248 d.Chain(control); |
251 Node* load = LoadHeapNumberValue(value, d.if_true); | 249 Node* load = LoadHeapNumberValue(value, d.if_true); |
252 Node* number = ChangeSmiToFloat64(value); | 250 Node* number = ChangeSmiToFloat64(value); |
253 return Replace(d.Phi(kMachFloat64, load, number)); | 251 return Replace(d.Phi(kMachFloat64, load, number)); |
(...skipping 22 matching lines...) Expand all Loading... |
276 } | 274 } |
277 | 275 |
278 | 276 |
279 MachineOperatorBuilder* ChangeLowering::machine() const { | 277 MachineOperatorBuilder* ChangeLowering::machine() const { |
280 return jsgraph()->machine(); | 278 return jsgraph()->machine(); |
281 } | 279 } |
282 | 280 |
283 } // namespace compiler | 281 } // namespace compiler |
284 } // namespace internal | 282 } // namespace internal |
285 } // namespace v8 | 283 } // namespace v8 |
OLD | NEW |