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

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

Issue 1941673002: [turbofan] Remove left-over change bits from ChangeLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Don't mess with the regions yet Created 4 years, 7 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
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // Schedule the call's IfSuccess node (if there is no exception use). 339 // Schedule the call's IfSuccess node (if there is no exception use).
340 TryScheduleCallIfSuccess(node, control); 340 TryScheduleCallIfSuccess(node, control);
341 } 341 }
342 } 342 }
343 } 343 }
344 344
345 bool EffectControlLinearizer::TryWireInStateEffect(Node* node, Node** effect, 345 bool EffectControlLinearizer::TryWireInStateEffect(Node* node, Node** effect,
346 Node** control) { 346 Node** control) {
347 ValueEffectControl state(nullptr, nullptr, nullptr); 347 ValueEffectControl state(nullptr, nullptr, nullptr);
348 switch (node->opcode()) { 348 switch (node->opcode()) {
349 case IrOpcode::kChangeBitToTagged:
350 state = LowerChangeBitToTagged(node, *effect, *control);
351 break;
352 case IrOpcode::kChangeInt31ToTaggedSigned:
353 state = LowerChangeInt31ToTaggedSigned(node, *effect, *control);
354 break;
349 case IrOpcode::kChangeInt32ToTagged: 355 case IrOpcode::kChangeInt32ToTagged:
350 state = LowerChangeInt32ToTagged(node, *effect, *control); 356 state = LowerChangeInt32ToTagged(node, *effect, *control);
351 break; 357 break;
352 case IrOpcode::kChangeUint32ToTagged: 358 case IrOpcode::kChangeUint32ToTagged:
353 state = LowerChangeUint32ToTagged(node, *effect, *control); 359 state = LowerChangeUint32ToTagged(node, *effect, *control);
354 break; 360 break;
355 case IrOpcode::kChangeFloat64ToTagged: 361 case IrOpcode::kChangeFloat64ToTagged:
356 state = LowerChangeFloat64ToTagged(node, *effect, *control); 362 state = LowerChangeFloat64ToTagged(node, *effect, *control);
357 break; 363 break;
364 case IrOpcode::kChangeTaggedSignedToInt32:
365 state = LowerChangeTaggedSignedToInt32(node, *effect, *control);
366 break;
367 case IrOpcode::kChangeTaggedToBit:
368 state = LowerChangeTaggedToBit(node, *effect, *control);
369 break;
358 case IrOpcode::kChangeTaggedToInt32: 370 case IrOpcode::kChangeTaggedToInt32:
359 state = LowerChangeTaggedToInt32(node, *effect, *control); 371 state = LowerChangeTaggedToInt32(node, *effect, *control);
360 break; 372 break;
361 case IrOpcode::kChangeTaggedToUint32: 373 case IrOpcode::kChangeTaggedToUint32:
362 state = LowerChangeTaggedToUint32(node, *effect, *control); 374 state = LowerChangeTaggedToUint32(node, *effect, *control);
363 break; 375 break;
364 case IrOpcode::kChangeTaggedToFloat64: 376 case IrOpcode::kChangeTaggedToFloat64:
365 state = LowerChangeTaggedToFloat64(node, *effect, *control); 377 state = LowerChangeTaggedToFloat64(node, *effect, *control);
366 break; 378 break;
367 case IrOpcode::kTruncateTaggedToWord32: 379 case IrOpcode::kTruncateTaggedToWord32:
368 state = LowerTruncateTaggedToWord32(node, *effect, *control); 380 state = LowerTruncateTaggedToWord32(node, *effect, *control);
369 break; 381 break;
370 case IrOpcode::kObjectIsCallable: 382 case IrOpcode::kObjectIsCallable:
371 state = LowerObjectIsCallable(node, *effect, *control); 383 state = LowerObjectIsCallable(node, *effect, *control);
372 break; 384 break;
373 case IrOpcode::kObjectIsNumber: 385 case IrOpcode::kObjectIsNumber:
374 state = LowerObjectIsNumber(node, *effect, *control); 386 state = LowerObjectIsNumber(node, *effect, *control);
375 break; 387 break;
376 case IrOpcode::kObjectIsReceiver: 388 case IrOpcode::kObjectIsReceiver:
377 state = LowerObjectIsReceiver(node, *effect, *control); 389 state = LowerObjectIsReceiver(node, *effect, *control);
378 break; 390 break;
391 case IrOpcode::kObjectIsSmi:
392 state = LowerObjectIsSmi(node, *effect, *control);
393 break;
379 case IrOpcode::kObjectIsString: 394 case IrOpcode::kObjectIsString:
380 state = LowerObjectIsString(node, *effect, *control); 395 state = LowerObjectIsString(node, *effect, *control);
381 break; 396 break;
382 case IrOpcode::kObjectIsUndetectable: 397 case IrOpcode::kObjectIsUndetectable:
383 state = LowerObjectIsUndetectable(node, *effect, *control); 398 state = LowerObjectIsUndetectable(node, *effect, *control);
384 break; 399 break;
385 default: 400 default:
386 return false; 401 return false;
387 } 402 }
388 NodeProperties::ReplaceUses(node, state.value); 403 NodeProperties::ReplaceUses(node, state.value);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 469
455 control = graph()->NewNode(common()->Merge(2), if_smi, box.control); 470 control = graph()->NewNode(common()->Merge(2), if_smi, box.control);
456 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), 471 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
457 vsmi, box.value, control); 472 vsmi, box.value, control);
458 effect = 473 effect =
459 graph()->NewNode(common()->EffectPhi(2), effect, box.effect, control); 474 graph()->NewNode(common()->EffectPhi(2), effect, box.effect, control);
460 return ValueEffectControl(value, effect, control); 475 return ValueEffectControl(value, effect, control);
461 } 476 }
462 477
463 EffectControlLinearizer::ValueEffectControl 478 EffectControlLinearizer::ValueEffectControl
479 EffectControlLinearizer::LowerChangeBitToTagged(Node* node, Node* effect,
480 Node* control) {
481 Node* value = node->InputAt(0);
482
483 Node* branch = graph()->NewNode(common()->Branch(), value, control);
484
485 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
486 Node* vtrue = jsgraph()->TrueConstant();
487
488 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
489 Node* vfalse = jsgraph()->FalseConstant();
490
491 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
492 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
493 vtrue, vfalse, control);
494
495 return ValueEffectControl(value, effect, control);
496 }
497
498 EffectControlLinearizer::ValueEffectControl
499 EffectControlLinearizer::LowerChangeInt31ToTaggedSigned(Node* node,
500 Node* effect,
501 Node* control) {
502 Node* value = node->InputAt(0);
503 value = ChangeInt32ToSmi(value);
504 return ValueEffectControl(value, effect, control);
505 }
506
507 EffectControlLinearizer::ValueEffectControl
464 EffectControlLinearizer::LowerChangeInt32ToTagged(Node* node, Node* effect, 508 EffectControlLinearizer::LowerChangeInt32ToTagged(Node* node, Node* effect,
465 Node* control) { 509 Node* control) {
466 Node* value = node->InputAt(0); 510 Node* value = node->InputAt(0);
467 511
468 if (machine()->Is64()) { 512 if (machine()->Is64()) {
469 return ValueEffectControl(ChangeInt32ToSmi(value), effect, control); 513 return ValueEffectControl(ChangeInt32ToSmi(value), effect, control);
470 } 514 }
471 515
472 Node* add = graph()->NewNode(machine()->Int32AddWithOverflow(), value, value); 516 Node* add = graph()->NewNode(machine()->Int32AddWithOverflow(), value, value);
473 517
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 Node* merge = graph()->NewNode(common()->Merge(2), if_true, alloc.control); 555 Node* merge = graph()->NewNode(common()->Merge(2), if_true, alloc.control);
512 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), 556 Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
513 vtrue, alloc.value, merge); 557 vtrue, alloc.value, merge);
514 Node* ephi = 558 Node* ephi =
515 graph()->NewNode(common()->EffectPhi(2), effect, alloc.effect, merge); 559 graph()->NewNode(common()->EffectPhi(2), effect, alloc.effect, merge);
516 560
517 return ValueEffectControl(phi, ephi, merge); 561 return ValueEffectControl(phi, ephi, merge);
518 } 562 }
519 563
520 EffectControlLinearizer::ValueEffectControl 564 EffectControlLinearizer::ValueEffectControl
565 EffectControlLinearizer::LowerChangeTaggedSignedToInt32(Node* node,
566 Node* effect,
567 Node* control) {
568 Node* value = node->InputAt(0);
569 value = ChangeSmiToInt32(value);
570 return ValueEffectControl(value, effect, control);
571 }
572
573 EffectControlLinearizer::ValueEffectControl
574 EffectControlLinearizer::LowerChangeTaggedToBit(Node* node, Node* effect,
575 Node* control) {
576 Node* value = node->InputAt(0);
577 value = graph()->NewNode(machine()->WordEqual(), value,
578 jsgraph()->TrueConstant());
579 return ValueEffectControl(value, effect, control);
580 }
581
582 EffectControlLinearizer::ValueEffectControl
521 EffectControlLinearizer::LowerChangeTaggedToInt32(Node* node, Node* effect, 583 EffectControlLinearizer::LowerChangeTaggedToInt32(Node* node, Node* effect,
522 Node* control) { 584 Node* control) {
523 Node* value = node->InputAt(0); 585 Node* value = node->InputAt(0);
524 586
525 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 587 Node* check = ObjectIsSmi(value);
526 Node* branch = 588 Node* branch =
527 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 589 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
528 590
529 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 591 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
530 Node* etrue = effect; 592 Node* etrue = effect;
531 Node* vtrue = 593 Node* vtrue = ChangeSmiToInt32(value);
532 graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(), value);
533 594
534 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 595 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
535 Node* efalse = effect; 596 Node* efalse = effect;
536 Node* vfalse; 597 Node* vfalse;
537 { 598 {
538 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset); 599 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
539 vfalse = efalse = graph()->NewNode( 600 vfalse = efalse = graph()->NewNode(
540 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value, 601 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
541 efalse, if_false); 602 efalse, if_false);
542 vfalse = graph()->NewNode(machine()->ChangeFloat64ToInt32(), vfalse); 603 vfalse = graph()->NewNode(machine()->ChangeFloat64ToInt32(), vfalse);
543 } 604 }
544 605
545 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 606 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
546 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 607 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
547 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), 608 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
548 vtrue, vfalse, control); 609 vtrue, vfalse, control);
549 610
550 return ValueEffectControl(value, effect, control); 611 return ValueEffectControl(value, effect, control);
551 } 612 }
552 613
553 EffectControlLinearizer::ValueEffectControl 614 EffectControlLinearizer::ValueEffectControl
554 EffectControlLinearizer::LowerChangeTaggedToUint32(Node* node, Node* effect, 615 EffectControlLinearizer::LowerChangeTaggedToUint32(Node* node, Node* effect,
555 Node* control) { 616 Node* control) {
556 Node* value = node->InputAt(0); 617 Node* value = node->InputAt(0);
557 618
558 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 619 Node* check = ObjectIsSmi(value);
559 Node* branch = 620 Node* branch =
560 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 621 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
561 622
562 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 623 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
563 Node* etrue = effect; 624 Node* etrue = effect;
564 Node* vtrue = 625 Node* vtrue = ChangeSmiToInt32(value);
565 graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(), value);
566 626
567 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 627 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
568 Node* efalse = effect; 628 Node* efalse = effect;
569 Node* vfalse; 629 Node* vfalse;
570 { 630 {
571 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset); 631 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
572 vfalse = efalse = graph()->NewNode( 632 vfalse = efalse = graph()->NewNode(
573 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value, 633 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
574 efalse, if_false); 634 efalse, if_false);
575 vfalse = graph()->NewNode(machine()->ChangeFloat64ToUint32(), vfalse); 635 vfalse = graph()->NewNode(machine()->ChangeFloat64ToUint32(), vfalse);
576 } 636 }
577 637
578 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 638 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
579 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 639 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
580 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), 640 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
581 vtrue, vfalse, control); 641 vtrue, vfalse, control);
582 642
583 return ValueEffectControl(value, effect, control); 643 return ValueEffectControl(value, effect, control);
584 } 644 }
585 645
586 EffectControlLinearizer::ValueEffectControl 646 EffectControlLinearizer::ValueEffectControl
587 EffectControlLinearizer::LowerChangeTaggedToFloat64(Node* node, Node* effect, 647 EffectControlLinearizer::LowerChangeTaggedToFloat64(Node* node, Node* effect,
588 Node* control) { 648 Node* control) {
589 Node* value = node->InputAt(0); 649 Node* value = node->InputAt(0);
590 650
591 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 651 Node* check = ObjectIsSmi(value);
592 Node* branch = 652 Node* branch =
593 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 653 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
594 654
595 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 655 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
596 Node* etrue = effect; 656 Node* etrue = effect;
597 Node* vtrue; 657 Node* vtrue;
598 { 658 {
599 vtrue = graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(), value); 659 vtrue = ChangeSmiToInt32(value);
600 vtrue = graph()->NewNode(machine()->ChangeInt32ToFloat64(), vtrue); 660 vtrue = graph()->NewNode(machine()->ChangeInt32ToFloat64(), vtrue);
601 } 661 }
602 662
603 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 663 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
604 Node* efalse = effect; 664 Node* efalse = effect;
605 Node* vfalse; 665 Node* vfalse;
606 { 666 {
607 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset); 667 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
608 vfalse = efalse = graph()->NewNode( 668 vfalse = efalse = graph()->NewNode(
609 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value, 669 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
610 efalse, if_false); 670 efalse, if_false);
611 } 671 }
612 672
613 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 673 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
614 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 674 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
615 value = graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2), 675 value = graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2),
616 vtrue, vfalse, control); 676 vtrue, vfalse, control);
617 677
618 return ValueEffectControl(value, effect, control); 678 return ValueEffectControl(value, effect, control);
619 } 679 }
620 680
621 EffectControlLinearizer::ValueEffectControl 681 EffectControlLinearizer::ValueEffectControl
622 EffectControlLinearizer::LowerTruncateTaggedToWord32(Node* node, Node* effect, 682 EffectControlLinearizer::LowerTruncateTaggedToWord32(Node* node, Node* effect,
623 Node* control) { 683 Node* control) {
624 Node* value = node->InputAt(0); 684 Node* value = node->InputAt(0);
625 685
626 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 686 Node* check = ObjectIsSmi(value);
627 Node* branch = 687 Node* branch =
628 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 688 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
629 689
630 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 690 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
631 Node* etrue = effect; 691 Node* etrue = effect;
632 Node* vtrue = 692 Node* vtrue = ChangeSmiToInt32(value);
633 graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(), value);
634 693
635 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 694 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
636 Node* efalse = effect; 695 Node* efalse = effect;
637 Node* vfalse; 696 Node* vfalse;
638 { 697 {
639 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset); 698 STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
640 vfalse = efalse = graph()->NewNode( 699 vfalse = efalse = graph()->NewNode(
641 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value, 700 simplified()->LoadField(AccessBuilder::ForHeapNumberValue()), value,
642 efalse, if_false); 701 efalse, if_false);
643 vfalse = graph()->NewNode(machine()->TruncateFloat64ToWord32(), vfalse); 702 vfalse = graph()->NewNode(machine()->TruncateFloat64ToWord32(), vfalse);
644 } 703 }
645 704
646 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 705 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
647 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 706 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
648 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), 707 value = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
649 vtrue, vfalse, control); 708 vtrue, vfalse, control);
650 709
651 return ValueEffectControl(value, effect, control); 710 return ValueEffectControl(value, effect, control);
652 } 711 }
653 712
654 EffectControlLinearizer::ValueEffectControl 713 EffectControlLinearizer::ValueEffectControl
655 EffectControlLinearizer::LowerObjectIsCallable(Node* node, Node* effect, 714 EffectControlLinearizer::LowerObjectIsCallable(Node* node, Node* effect,
656 Node* control) { 715 Node* control) {
657 Node* value = node->InputAt(0); 716 Node* value = node->InputAt(0);
658 717
659 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 718 Node* check = ObjectIsSmi(value);
660 Node* branch = 719 Node* branch =
661 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control); 720 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
662 721
663 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 722 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
664 Node* etrue = effect; 723 Node* etrue = effect;
665 Node* vtrue = jsgraph()->Int32Constant(0); 724 Node* vtrue = jsgraph()->Int32Constant(0);
666 725
667 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 726 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
668 Node* efalse = effect; 727 Node* efalse = effect;
669 Node* vfalse; 728 Node* vfalse;
(...skipping 19 matching lines...) Expand all
689 vfalse, control); 748 vfalse, control);
690 749
691 return ValueEffectControl(value, effect, control); 750 return ValueEffectControl(value, effect, control);
692 } 751 }
693 752
694 EffectControlLinearizer::ValueEffectControl 753 EffectControlLinearizer::ValueEffectControl
695 EffectControlLinearizer::LowerObjectIsNumber(Node* node, Node* effect, 754 EffectControlLinearizer::LowerObjectIsNumber(Node* node, Node* effect,
696 Node* control) { 755 Node* control) {
697 Node* value = node->InputAt(0); 756 Node* value = node->InputAt(0);
698 757
699 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 758 Node* check = ObjectIsSmi(value);
700 Node* branch = graph()->NewNode(common()->Branch(), check, control); 759 Node* branch = graph()->NewNode(common()->Branch(), check, control);
701 760
702 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 761 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
703 Node* etrue = effect; 762 Node* etrue = effect;
704 Node* vtrue = jsgraph()->Int32Constant(1); 763 Node* vtrue = jsgraph()->Int32Constant(1);
705 764
706 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 765 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
707 Node* efalse = effect; 766 Node* efalse = effect;
708 Node* vfalse; 767 Node* vfalse;
709 { 768 {
(...skipping 10 matching lines...) Expand all
720 vfalse, control); 779 vfalse, control);
721 780
722 return ValueEffectControl(value, effect, control); 781 return ValueEffectControl(value, effect, control);
723 } 782 }
724 783
725 EffectControlLinearizer::ValueEffectControl 784 EffectControlLinearizer::ValueEffectControl
726 EffectControlLinearizer::LowerObjectIsReceiver(Node* node, Node* effect, 785 EffectControlLinearizer::LowerObjectIsReceiver(Node* node, Node* effect,
727 Node* control) { 786 Node* control) {
728 Node* value = node->InputAt(0); 787 Node* value = node->InputAt(0);
729 788
730 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 789 Node* check = ObjectIsSmi(value);
731 Node* branch = 790 Node* branch =
732 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control); 791 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
733 792
734 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 793 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
735 Node* etrue = effect; 794 Node* etrue = effect;
736 Node* vtrue = jsgraph()->Int32Constant(0); 795 Node* vtrue = jsgraph()->Int32Constant(0);
737 796
738 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 797 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
739 Node* efalse = effect; 798 Node* efalse = effect;
740 Node* vfalse; 799 Node* vfalse;
(...skipping 12 matching lines...) Expand all
753 812
754 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 813 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
755 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 814 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
756 value = graph()->NewNode(common()->Phi(MachineRepresentation::kBit, 2), vtrue, 815 value = graph()->NewNode(common()->Phi(MachineRepresentation::kBit, 2), vtrue,
757 vfalse, control); 816 vfalse, control);
758 817
759 return ValueEffectControl(value, effect, control); 818 return ValueEffectControl(value, effect, control);
760 } 819 }
761 820
762 EffectControlLinearizer::ValueEffectControl 821 EffectControlLinearizer::ValueEffectControl
822 EffectControlLinearizer::LowerObjectIsSmi(Node* node, Node* effect,
823 Node* control) {
824 Node* value = node->InputAt(0);
825 value = ObjectIsSmi(value);
826 return ValueEffectControl(value, effect, control);
827 }
828
829 EffectControlLinearizer::ValueEffectControl
763 EffectControlLinearizer::LowerObjectIsString(Node* node, Node* effect, 830 EffectControlLinearizer::LowerObjectIsString(Node* node, Node* effect,
764 Node* control) { 831 Node* control) {
765 Node* value = node->InputAt(0); 832 Node* value = node->InputAt(0);
766 833
767 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 834 Node* check = ObjectIsSmi(value);
768 Node* branch = 835 Node* branch =
769 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control); 836 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
770 837
771 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 838 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
772 Node* etrue = effect; 839 Node* etrue = effect;
773 Node* vtrue = jsgraph()->Int32Constant(0); 840 Node* vtrue = jsgraph()->Int32Constant(0);
774 841
775 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 842 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
776 Node* efalse = effect; 843 Node* efalse = effect;
777 Node* vfalse; 844 Node* vfalse;
(...skipping 14 matching lines...) Expand all
792 vfalse, control); 859 vfalse, control);
793 860
794 return ValueEffectControl(value, effect, control); 861 return ValueEffectControl(value, effect, control);
795 } 862 }
796 863
797 EffectControlLinearizer::ValueEffectControl 864 EffectControlLinearizer::ValueEffectControl
798 EffectControlLinearizer::LowerObjectIsUndetectable(Node* node, Node* effect, 865 EffectControlLinearizer::LowerObjectIsUndetectable(Node* node, Node* effect,
799 Node* control) { 866 Node* control) {
800 Node* value = node->InputAt(0); 867 Node* value = node->InputAt(0);
801 868
802 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 869 Node* check = ObjectIsSmi(value);
803 Node* branch = 870 Node* branch =
804 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control); 871 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
805 872
806 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 873 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
807 Node* etrue = effect; 874 Node* etrue = effect;
808 Node* vtrue = jsgraph()->Int32Constant(0); 875 Node* vtrue = jsgraph()->Int32Constant(0);
809 876
810 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 877 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
811 Node* efalse = effect; 878 Node* efalse = effect;
812 Node* vfalse; 879 Node* vfalse;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 } 934 }
868 935
869 Node* EffectControlLinearizer::ChangeInt32ToFloat64(Node* value) { 936 Node* EffectControlLinearizer::ChangeInt32ToFloat64(Node* value) {
870 return graph()->NewNode(machine()->ChangeInt32ToFloat64(), value); 937 return graph()->NewNode(machine()->ChangeInt32ToFloat64(), value);
871 } 938 }
872 939
873 Node* EffectControlLinearizer::ChangeUint32ToFloat64(Node* value) { 940 Node* EffectControlLinearizer::ChangeUint32ToFloat64(Node* value) {
874 return graph()->NewNode(machine()->ChangeUint32ToFloat64(), value); 941 return graph()->NewNode(machine()->ChangeUint32ToFloat64(), value);
875 } 942 }
876 943
944 Node* EffectControlLinearizer::ChangeSmiToInt32(Node* value) {
945 value = graph()->NewNode(machine()->WordSar(), value, SmiShiftBitsConstant());
946 if (machine()->Is64()) {
947 value = graph()->NewNode(machine()->TruncateInt64ToInt32(), value);
948 }
949 return value;
950 }
951
952 Node* EffectControlLinearizer::ObjectIsSmi(Node* value) {
953 return graph()->NewNode(
954 machine()->WordEqual(),
955 graph()->NewNode(machine()->WordAnd(), value,
956 jsgraph()->IntPtrConstant(kSmiTagMask)),
957 jsgraph()->IntPtrConstant(kSmiTag));
958 }
959
877 Node* EffectControlLinearizer::SmiMaxValueConstant() { 960 Node* EffectControlLinearizer::SmiMaxValueConstant() {
878 return jsgraph()->Int32Constant(Smi::kMaxValue); 961 return jsgraph()->Int32Constant(Smi::kMaxValue);
879 } 962 }
880 963
881 Node* EffectControlLinearizer::SmiShiftBitsConstant() { 964 Node* EffectControlLinearizer::SmiShiftBitsConstant() {
882 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); 965 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize);
883 } 966 }
884 967
885 } // namespace compiler 968 } // namespace compiler
886 } // namespace internal 969 } // namespace internal
887 } // namespace v8 970 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698