Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: src/compiler/effect-control-linearizer.cc

Issue 2154073002: [Turbofan]: Eliminate the check for -0 if it's not possible/observable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
1324 Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value, zero); 1325 if (mode == CheckForMinusZeroMode::kCheckForMinusZero) {
1325 Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse), 1326 Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value, zero);
1326 check_zero, control); 1327 Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse),
1328 check_zero, control);
1327 1329
1328 Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero); 1330 Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero);
1329 Node* e_if_zero = effect; 1331 Node* e_if_zero = effect;
1330 { 1332 {
1331 // We may need to return negative zero. 1333 // We may need to return negative zero.
1332 Node* or_inputs = graph()->NewNode(machine()->Word32Or(), lhs, rhs); 1334 Node* or_inputs = graph()->NewNode(machine()->Word32Or(), lhs, rhs);
1333 Node* check_or = 1335 Node* check_or =
1334 graph()->NewNode(machine()->Int32LessThan(), or_inputs, zero); 1336 graph()->NewNode(machine()->Int32LessThan(), or_inputs, zero);
1335 if_zero = e_if_zero = graph()->NewNode(common()->DeoptimizeIf(), check_or, 1337 if_zero = e_if_zero = graph()->NewNode(common()->DeoptimizeIf(), check_or,
1336 frame_state, e_if_zero, if_zero); 1338 frame_state, e_if_zero, if_zero);
1339 }
1340
1341 Node* if_not_zero = graph()->NewNode(common()->IfFalse(), branch_zero);
1342 Node* e_if_not_zero = effect;
1343
1344 control = graph()->NewNode(common()->Merge(2), if_zero, if_not_zero);
1345 effect = graph()->NewNode(common()->EffectPhi(2), e_if_zero, e_if_not_zero,
1346 control);
1337 } 1347 }
1338 1348
1339 Node* if_not_zero = graph()->NewNode(common()->IfFalse(), branch_zero);
1340 Node* e_if_not_zero = effect;
1341
1342 control = graph()->NewNode(common()->Merge(2), if_zero, if_not_zero);
1343 effect = graph()->NewNode(common()->EffectPhi(2), e_if_zero, e_if_not_zero,
1344 control);
1345
1346 return ValueEffectControl(value, effect, control); 1349 return ValueEffectControl(value, effect, control);
1347 } 1350 }
1348 1351
1349 EffectControlLinearizer::ValueEffectControl 1352 EffectControlLinearizer::ValueEffectControl
1350 EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node, 1353 EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node,
1351 Node* frame_state, 1354 Node* frame_state,
1352 Node* effect, 1355 Node* effect,
1353 Node* control) { 1356 Node* control) {
1354 Node* value = node->InputAt(0); 1357 Node* value = node->InputAt(0);
1355 Node* max_int = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::max()); 1358 Node* max_int = jsgraph()->Int32Constant(std::numeric_limits<int32_t>::max());
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 2111 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
2109 Operator::kNoThrow); 2112 Operator::kNoThrow);
2110 to_number_operator_.set(common()->Call(desc)); 2113 to_number_operator_.set(common()->Call(desc));
2111 } 2114 }
2112 return to_number_operator_.get(); 2115 return to_number_operator_.get();
2113 } 2116 }
2114 2117
2115 } // namespace compiler 2118 } // namespace compiler
2116 } // namespace internal 2119 } // namespace internal
2117 } // namespace v8 2120 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/representation-change.cc » ('j') | src/compiler/simplified-lowering.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698