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 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1301 | 1301 |
1302 // Perform the actual unsigned integer modulus. | 1302 // Perform the actual unsigned integer modulus. |
1303 Node* value = graph()->NewNode(machine()->Uint32Mod(), lhs, rhs, control); | 1303 Node* value = graph()->NewNode(machine()->Uint32Mod(), lhs, rhs, control); |
1304 | 1304 |
1305 return ValueEffectControl(value, effect, control); | 1305 return ValueEffectControl(value, effect, control); |
1306 } | 1306 } |
1307 | 1307 |
1308 EffectControlLinearizer::ValueEffectControl | 1308 EffectControlLinearizer::ValueEffectControl |
1309 EffectControlLinearizer::LowerCheckedInt32Mul(Node* node, Node* frame_state, | 1309 EffectControlLinearizer::LowerCheckedInt32Mul(Node* node, Node* frame_state, |
1310 Node* effect, Node* control) { | 1310 Node* effect, Node* control) { |
1311 CheckForMinusZeroMode mode = CheckMinusZeroModeOf(node->op()); | |
1311 Node* zero = jsgraph()->Int32Constant(0); | 1312 Node* zero = jsgraph()->Int32Constant(0); |
1312 Node* lhs = node->InputAt(0); | 1313 Node* lhs = node->InputAt(0); |
1313 Node* rhs = node->InputAt(1); | 1314 Node* rhs = node->InputAt(1); |
1314 | 1315 |
1315 Node* projection = | 1316 Node* projection = |
1316 graph()->NewNode(machine()->Int32MulWithOverflow(), lhs, rhs, control); | 1317 graph()->NewNode(machine()->Int32MulWithOverflow(), lhs, rhs, control); |
1317 | 1318 |
1318 Node* check = graph()->NewNode(common()->Projection(1), projection, control); | 1319 Node* check = graph()->NewNode(common()->Projection(1), projection, control); |
1319 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, | 1320 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
1320 frame_state, effect, control); | 1321 frame_state, effect, control); |
1321 | 1322 |
1322 Node* value = graph()->NewNode(common()->Projection(0), projection, control); | 1323 Node* value = graph()->NewNode(common()->Projection(0), projection, control); |
1323 | 1324 |
1325 if (mode == CheckForMinusZeroMode::kDontCheckForMinusZero) { | |
Benedikt Meurer
2016/07/17 17:44:07
Nit: I'd prefer a positive check here, i.e.
if (m
mvstanton
2016/07/18 08:48:58
Done.
| |
1326 return ValueEffectControl(value, effect, control); | |
1327 } | |
1328 | |
1324 Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value, zero); | 1329 Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value, zero); |
1325 Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 1330 Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
1326 check_zero, control); | 1331 check_zero, control); |
1327 | 1332 |
1328 Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero); | 1333 Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero); |
1329 Node* e_if_zero = effect; | 1334 Node* e_if_zero = effect; |
1330 { | 1335 { |
1331 // We may need to return negative zero. | 1336 // We may need to return negative zero. |
1332 Node* or_inputs = graph()->NewNode(machine()->Word32Or(), lhs, rhs); | 1337 Node* or_inputs = graph()->NewNode(machine()->Word32Or(), lhs, rhs); |
1333 Node* check_or = | 1338 Node* check_or = |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2108 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 2113 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
2109 Operator::kNoThrow); | 2114 Operator::kNoThrow); |
2110 to_number_operator_.set(common()->Call(desc)); | 2115 to_number_operator_.set(common()->Call(desc)); |
2111 } | 2116 } |
2112 return to_number_operator_.get(); | 2117 return to_number_operator_.get(); |
2113 } | 2118 } |
2114 | 2119 |
2115 } // namespace compiler | 2120 } // namespace compiler |
2116 } // namespace internal | 2121 } // namespace internal |
2117 } // namespace v8 | 2122 } // namespace v8 |
OLD | NEW |