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/js-intrinsic-lowering.h" | 5 #include "src/compiler/js-intrinsic-lowering.h" |
6 | 6 |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 76 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
77 NodeProperties::ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect, | 77 NodeProperties::ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect, |
78 if_false); | 78 if_false); |
79 | 79 |
80 // True branch: deopt. | 80 // True branch: deopt. |
81 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 81 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
82 Node* deopt = | 82 Node* deopt = |
83 graph()->NewNode(common()->Deoptimize(), frame_state, effect, if_true); | 83 graph()->NewNode(common()->Deoptimize(), frame_state, effect, if_true); |
84 | 84 |
85 // Connect the deopt to the merge exiting the graph. | 85 // Connect the deopt to the merge exiting the graph. |
86 Node* end_pred = NodeProperties::GetControlInput(graph()->end()); | 86 NodeProperties::MergeControlToEnd(graph(), common(), deopt); |
87 if (end_pred->opcode() == IrOpcode::kMerge) { | |
88 int inputs = end_pred->op()->ControlInputCount() + 1; | |
89 end_pred->AppendInput(graph()->zone(), deopt); | |
90 end_pred->set_op(common()->Merge(inputs)); | |
91 } else { | |
92 Node* merge = graph()->NewNode(common()->Merge(2), end_pred, deopt); | |
93 NodeProperties::ReplaceControlInput(graph()->end(), merge); | |
94 } | |
95 | 87 |
96 return Changed(deopt); | 88 return Changed(deopt); |
97 } | 89 } |
98 | 90 |
99 | 91 |
100 Reduction JSIntrinsicLowering::ReduceInlineIsSmi(Node* node) { | 92 Reduction JSIntrinsicLowering::ReduceInlineIsSmi(Node* node) { |
101 return Change(node, simplified()->ObjectIsSmi()); | 93 return Change(node, simplified()->ObjectIsSmi()); |
102 } | 94 } |
103 | 95 |
104 | 96 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 285 } |
294 | 286 |
295 | 287 |
296 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { | 288 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { |
297 return jsgraph()->machine(); | 289 return jsgraph()->machine(); |
298 } | 290 } |
299 | 291 |
300 } // namespace compiler | 292 } // namespace compiler |
301 } // namespace internal | 293 } // namespace internal |
302 } // namespace v8 | 294 } // namespace v8 |
OLD | NEW |