OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/effect-control-linearizer.h" | 5 #include "src/compiler/effect-control-linearizer.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 // ignore new effect chains started with ValueEffect.) | 321 // ignore new effect chains started with ValueEffect.) |
322 if (node->op()->EffectOutputCount() > 0) { | 322 if (node->op()->EffectOutputCount() > 0) { |
323 DCHECK_EQ(1, node->op()->EffectOutputCount()); | 323 DCHECK_EQ(1, node->op()->EffectOutputCount()); |
324 *effect = node; | 324 *effect = node; |
325 } | 325 } |
326 } else { | 326 } else { |
327 // New effect chain is only started with a Start or ValueEffect node. | 327 // New effect chain is only started with a Start or ValueEffect node. |
328 DCHECK(node->op()->EffectOutputCount() == 0 || | 328 DCHECK(node->op()->EffectOutputCount() == 0 || |
329 node->opcode() == IrOpcode::kStart); | 329 node->opcode() == IrOpcode::kStart); |
330 } | 330 } |
331 // Rewire control inputs of control nodes, and update the current control | 331 |
332 // input. | 332 // Rewire control inputs. |
| 333 for (int i = 0; i < node->op()->ControlInputCount(); i++) { |
| 334 NodeProperties::ReplaceControlInput(node, *control, i); |
| 335 } |
| 336 // Update the current control and wire IfSuccess right after calls. |
333 if (node->op()->ControlOutputCount() > 0) { | 337 if (node->op()->ControlOutputCount() > 0) { |
334 DCHECK_EQ(1, node->op()->ControlInputCount()); | |
335 NodeProperties::ReplaceControlInput(node, *control); | |
336 *control = node; | 338 *control = node; |
337 | |
338 if (node->opcode() == IrOpcode::kCall) { | 339 if (node->opcode() == IrOpcode::kCall) { |
339 // Schedule the call's IfSuccess node (if there is no exception use). | 340 // Schedule the call's IfSuccess node (if there is no exception use). |
340 TryScheduleCallIfSuccess(node, control); | 341 TryScheduleCallIfSuccess(node, control); |
341 } | 342 } |
342 } | 343 } |
343 } | 344 } |
344 | 345 |
345 bool EffectControlLinearizer::TryWireInStateEffect(Node* node, Node** effect, | 346 bool EffectControlLinearizer::TryWireInStateEffect(Node* node, Node** effect, |
346 Node** control) { | 347 Node** control) { |
347 ValueEffectControl state(nullptr, nullptr, nullptr); | 348 ValueEffectControl state(nullptr, nullptr, nullptr); |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 return jsgraph()->Int32Constant(Smi::kMaxValue); | 962 return jsgraph()->Int32Constant(Smi::kMaxValue); |
962 } | 963 } |
963 | 964 |
964 Node* EffectControlLinearizer::SmiShiftBitsConstant() { | 965 Node* EffectControlLinearizer::SmiShiftBitsConstant() { |
965 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); | 966 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); |
966 } | 967 } |
967 | 968 |
968 } // namespace compiler | 969 } // namespace compiler |
969 } // namespace internal | 970 } // namespace internal |
970 } // namespace v8 | 971 } // namespace v8 |
OLD | NEW |