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

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

Issue 2066223002: [turbofan] Introduce CheckHole and CheckHoleNaN operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. Blacklist test Created 4 years, 6 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 break; 448 break;
449 case IrOpcode::kObjectIsUndetectable: 449 case IrOpcode::kObjectIsUndetectable:
450 state = LowerObjectIsUndetectable(node, *effect, *control); 450 state = LowerObjectIsUndetectable(node, *effect, *control);
451 break; 451 break;
452 case IrOpcode::kStringFromCharCode: 452 case IrOpcode::kStringFromCharCode:
453 state = LowerStringFromCharCode(node, *effect, *control); 453 state = LowerStringFromCharCode(node, *effect, *control);
454 break; 454 break;
455 case IrOpcode::kCheckIf: 455 case IrOpcode::kCheckIf:
456 state = LowerCheckIf(node, frame_state, *effect, *control); 456 state = LowerCheckIf(node, frame_state, *effect, *control);
457 break; 457 break;
458 case IrOpcode::kCheckFloat64Hole:
459 state = LowerCheckFloat64Hole(node, frame_state, *effect, *control);
460 break;
461 case IrOpcode::kCheckTaggedHole:
462 state = LowerCheckTaggedHole(node, frame_state, *effect, *control);
463 break;
458 case IrOpcode::kPlainPrimitiveToNumber: 464 case IrOpcode::kPlainPrimitiveToNumber:
459 state = LowerPlainPrimitiveToNumber(node, *effect, *control); 465 state = LowerPlainPrimitiveToNumber(node, *effect, *control);
460 break; 466 break;
461 case IrOpcode::kPlainPrimitiveToWord32: 467 case IrOpcode::kPlainPrimitiveToWord32:
462 state = LowerPlainPrimitiveToWord32(node, *effect, *control); 468 state = LowerPlainPrimitiveToWord32(node, *effect, *control);
463 break; 469 break;
464 case IrOpcode::kPlainPrimitiveToFloat64: 470 case IrOpcode::kPlainPrimitiveToFloat64:
465 state = LowerPlainPrimitiveToFloat64(node, *effect, *control); 471 state = LowerPlainPrimitiveToFloat64(node, *effect, *control);
466 break; 472 break;
467 default: 473 default:
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state, 1295 EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state,
1290 Node* effect, Node* control) { 1296 Node* effect, Node* control) {
1291 NodeProperties::ReplaceEffectInput(node, effect); 1297 NodeProperties::ReplaceEffectInput(node, effect);
1292 NodeProperties::ReplaceControlInput(node, control); 1298 NodeProperties::ReplaceControlInput(node, control);
1293 node->InsertInput(graph()->zone(), 1, frame_state); 1299 node->InsertInput(graph()->zone(), 1, frame_state);
1294 NodeProperties::ChangeOp(node, common()->DeoptimizeIf()); 1300 NodeProperties::ChangeOp(node, common()->DeoptimizeIf());
1295 return ValueEffectControl(node, node, node); 1301 return ValueEffectControl(node, node, node);
1296 } 1302 }
1297 1303
1298 EffectControlLinearizer::ValueEffectControl 1304 EffectControlLinearizer::ValueEffectControl
1305 EffectControlLinearizer::LowerCheckFloat64Hole(Node* node, Node* frame_state,
1306 Node* effect, Node* control) {
1307 // If we reach this point w/o eliminating the {node} that's marked
1308 // with allow-return-hole, we cannot do anything, so just deoptimize
1309 // in case of the hole NaN (similar to Crankshaft).
1310 Node* value = node->InputAt(0);
1311 Node* check = graph()->NewNode(
1312 machine()->Word32Equal(),
1313 graph()->NewNode(machine()->Float64ExtractHighWord32(), value),
1314 jsgraph()->Int32Constant(kHoleNanUpper32));
1315 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check,
1316 frame_state, effect, control);
1317
1318 // Make sure the lowered node does not appear in any use lists.
1319 node->TrimInputCount(0);
1320
1321 return ValueEffectControl(value, effect, control);
1322 }
1323
1324 EffectControlLinearizer::ValueEffectControl
1325 EffectControlLinearizer::LowerCheckTaggedHole(Node* node, Node* frame_state,
1326 Node* effect, Node* control) {
1327 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op());
1328 Node* value = node->InputAt(0);
1329 Node* check = graph()->NewNode(machine()->WordEqual(), value,
1330 jsgraph()->TheHoleConstant());
1331 switch (mode) {
1332 case CheckTaggedHoleMode::kConvertHoleToUndefined:
1333 value = graph()->NewNode(
1334 common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse),
1335 check, jsgraph()->UndefinedConstant(), value);
1336 break;
1337 case CheckTaggedHoleMode::kNeverReturnHole:
1338 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check,
1339 frame_state, effect, control);
1340 break;
1341 }
1342
1343 // Make sure the lowered node does not appear in any use lists.
1344 node->TrimInputCount(0);
1345
1346 return ValueEffectControl(value, effect, control);
1347 }
1348
1349 EffectControlLinearizer::ValueEffectControl
1299 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, 1350 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect,
1300 Node* control) { 1351 Node* control) {
1301 Node* result = effect = graph()->NewNode( 1352 Node* result = effect = graph()->NewNode(
1302 simplified()->Allocate(NOT_TENURED), 1353 simplified()->Allocate(NOT_TENURED),
1303 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control); 1354 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control);
1304 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), 1355 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
1305 result, jsgraph()->HeapNumberMapConstant(), effect, 1356 result, jsgraph()->HeapNumberMapConstant(), effect,
1306 control); 1357 control);
1307 effect = graph()->NewNode( 1358 effect = graph()->NewNode(
1308 simplified()->StoreField(AccessBuilder::ForHeapNumberValue()), result, 1359 simplified()->StoreField(AccessBuilder::ForHeapNumberValue()), result,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 1544 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
1494 Operator::kNoThrow); 1545 Operator::kNoThrow);
1495 to_number_operator_.set(common()->Call(desc)); 1546 to_number_operator_.set(common()->Call(desc));
1496 } 1547 }
1497 return to_number_operator_.get(); 1548 return to_number_operator_.get();
1498 } 1549 }
1499 1550
1500 } // namespace compiler 1551 } // namespace compiler
1501 } // namespace internal 1552 } // namespace internal
1502 } // namespace v8 1553 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698