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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 break; | 593 break; |
594 case IrOpcode::kChangeInt32ToTagged: | 594 case IrOpcode::kChangeInt32ToTagged: |
595 state = LowerChangeInt32ToTagged(node, *effect, *control); | 595 state = LowerChangeInt32ToTagged(node, *effect, *control); |
596 break; | 596 break; |
597 case IrOpcode::kChangeUint32ToTagged: | 597 case IrOpcode::kChangeUint32ToTagged: |
598 state = LowerChangeUint32ToTagged(node, *effect, *control); | 598 state = LowerChangeUint32ToTagged(node, *effect, *control); |
599 break; | 599 break; |
600 case IrOpcode::kChangeFloat64ToTagged: | 600 case IrOpcode::kChangeFloat64ToTagged: |
601 state = LowerChangeFloat64ToTagged(node, *effect, *control); | 601 state = LowerChangeFloat64ToTagged(node, *effect, *control); |
602 break; | 602 break; |
| 603 case IrOpcode::kChangeFloat64ToTaggedPointer: |
| 604 state = LowerChangeFloat64ToTaggedPointer(node, *effect, *control); |
| 605 break; |
603 case IrOpcode::kChangeTaggedSignedToInt32: | 606 case IrOpcode::kChangeTaggedSignedToInt32: |
604 state = LowerChangeTaggedSignedToInt32(node, *effect, *control); | 607 state = LowerChangeTaggedSignedToInt32(node, *effect, *control); |
605 break; | 608 break; |
606 case IrOpcode::kChangeTaggedToBit: | 609 case IrOpcode::kChangeTaggedToBit: |
607 state = LowerChangeTaggedToBit(node, *effect, *control); | 610 state = LowerChangeTaggedToBit(node, *effect, *control); |
608 break; | 611 break; |
609 case IrOpcode::kChangeTaggedToInt32: | 612 case IrOpcode::kChangeTaggedToInt32: |
610 state = LowerChangeTaggedToInt32(node, *effect, *control); | 613 state = LowerChangeTaggedToInt32(node, *effect, *control); |
611 break; | 614 break; |
612 case IrOpcode::kChangeTaggedToUint32: | 615 case IrOpcode::kChangeTaggedToUint32: |
(...skipping 16 matching lines...) Expand all Loading... |
629 break; | 632 break; |
630 case IrOpcode::kCheckNumber: | 633 case IrOpcode::kCheckNumber: |
631 state = LowerCheckNumber(node, frame_state, *effect, *control); | 634 state = LowerCheckNumber(node, frame_state, *effect, *control); |
632 break; | 635 break; |
633 case IrOpcode::kCheckString: | 636 case IrOpcode::kCheckString: |
634 state = LowerCheckString(node, frame_state, *effect, *control); | 637 state = LowerCheckString(node, frame_state, *effect, *control); |
635 break; | 638 break; |
636 case IrOpcode::kCheckIf: | 639 case IrOpcode::kCheckIf: |
637 state = LowerCheckIf(node, frame_state, *effect, *control); | 640 state = LowerCheckIf(node, frame_state, *effect, *control); |
638 break; | 641 break; |
639 case IrOpcode::kCheckHeapObject: | |
640 state = LowerCheckHeapObject(node, frame_state, *effect, *control); | |
641 break; | |
642 case IrOpcode::kCheckedInt32Add: | 642 case IrOpcode::kCheckedInt32Add: |
643 state = LowerCheckedInt32Add(node, frame_state, *effect, *control); | 643 state = LowerCheckedInt32Add(node, frame_state, *effect, *control); |
644 break; | 644 break; |
645 case IrOpcode::kCheckedInt32Sub: | 645 case IrOpcode::kCheckedInt32Sub: |
646 state = LowerCheckedInt32Sub(node, frame_state, *effect, *control); | 646 state = LowerCheckedInt32Sub(node, frame_state, *effect, *control); |
647 break; | 647 break; |
648 case IrOpcode::kCheckedInt32Div: | 648 case IrOpcode::kCheckedInt32Div: |
649 state = LowerCheckedInt32Div(node, frame_state, *effect, *control); | 649 state = LowerCheckedInt32Div(node, frame_state, *effect, *control); |
650 break; | 650 break; |
651 case IrOpcode::kCheckedInt32Mod: | 651 case IrOpcode::kCheckedInt32Mod: |
(...skipping 29 matching lines...) Expand all Loading... |
681 case IrOpcode::kCheckedTaggedToInt32: | 681 case IrOpcode::kCheckedTaggedToInt32: |
682 state = LowerCheckedTaggedToInt32(node, frame_state, *effect, *control); | 682 state = LowerCheckedTaggedToInt32(node, frame_state, *effect, *control); |
683 break; | 683 break; |
684 case IrOpcode::kCheckedTaggedToFloat64: | 684 case IrOpcode::kCheckedTaggedToFloat64: |
685 state = LowerCheckedTaggedToFloat64(node, frame_state, *effect, *control); | 685 state = LowerCheckedTaggedToFloat64(node, frame_state, *effect, *control); |
686 break; | 686 break; |
687 case IrOpcode::kCheckedTaggedToTaggedSigned: | 687 case IrOpcode::kCheckedTaggedToTaggedSigned: |
688 state = LowerCheckedTaggedToTaggedSigned(node, frame_state, *effect, | 688 state = LowerCheckedTaggedToTaggedSigned(node, frame_state, *effect, |
689 *control); | 689 *control); |
690 break; | 690 break; |
| 691 case IrOpcode::kCheckedTaggedToTaggedPointer: |
| 692 state = LowerCheckedTaggedToTaggedPointer(node, frame_state, *effect, |
| 693 *control); |
| 694 break; |
691 case IrOpcode::kTruncateTaggedToWord32: | 695 case IrOpcode::kTruncateTaggedToWord32: |
692 state = LowerTruncateTaggedToWord32(node, *effect, *control); | 696 state = LowerTruncateTaggedToWord32(node, *effect, *control); |
693 break; | 697 break; |
694 case IrOpcode::kCheckedTruncateTaggedToWord32: | 698 case IrOpcode::kCheckedTruncateTaggedToWord32: |
695 state = LowerCheckedTruncateTaggedToWord32(node, frame_state, *effect, | 699 state = LowerCheckedTruncateTaggedToWord32(node, frame_state, *effect, |
696 *control); | 700 *control); |
697 break; | 701 break; |
698 case IrOpcode::kObjectIsCallable: | 702 case IrOpcode::kObjectIsCallable: |
699 state = LowerObjectIsCallable(node, *effect, *control); | 703 state = LowerObjectIsCallable(node, *effect, *control); |
700 break; | 704 break; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 } | 790 } |
787 | 791 |
788 EffectControlLinearizer::ValueEffectControl | 792 EffectControlLinearizer::ValueEffectControl |
789 EffectControlLinearizer::LowerChangeFloat64ToTagged(Node* node, Node* effect, | 793 EffectControlLinearizer::LowerChangeFloat64ToTagged(Node* node, Node* effect, |
790 Node* control) { | 794 Node* control) { |
791 Node* value = node->InputAt(0); | 795 Node* value = node->InputAt(0); |
792 return AllocateHeapNumberWithValue(value, effect, control); | 796 return AllocateHeapNumberWithValue(value, effect, control); |
793 } | 797 } |
794 | 798 |
795 EffectControlLinearizer::ValueEffectControl | 799 EffectControlLinearizer::ValueEffectControl |
| 800 EffectControlLinearizer::LowerChangeFloat64ToTaggedPointer(Node* node, |
| 801 Node* effect, |
| 802 Node* control) { |
| 803 Node* value = node->InputAt(0); |
| 804 return AllocateHeapNumberWithValue(value, effect, control); |
| 805 } |
| 806 |
| 807 EffectControlLinearizer::ValueEffectControl |
796 EffectControlLinearizer::LowerChangeBitToTagged(Node* node, Node* effect, | 808 EffectControlLinearizer::LowerChangeBitToTagged(Node* node, Node* effect, |
797 Node* control) { | 809 Node* control) { |
798 Node* value = node->InputAt(0); | 810 Node* value = node->InputAt(0); |
799 | 811 |
800 Node* branch = graph()->NewNode(common()->Branch(), value, control); | 812 Node* branch = graph()->NewNode(common()->Branch(), value, control); |
801 | 813 |
802 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 814 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
803 Node* vtrue = jsgraph()->TrueConstant(); | 815 Node* vtrue = jsgraph()->TrueConstant(); |
804 | 816 |
805 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 817 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 Node* value = node->InputAt(0); | 1279 Node* value = node->InputAt(0); |
1268 | 1280 |
1269 control = effect = | 1281 control = effect = |
1270 graph()->NewNode(common()->DeoptimizeUnless(DeoptimizeReason::kNoReason), | 1282 graph()->NewNode(common()->DeoptimizeUnless(DeoptimizeReason::kNoReason), |
1271 value, frame_state, effect, control); | 1283 value, frame_state, effect, control); |
1272 | 1284 |
1273 return ValueEffectControl(value, effect, control); | 1285 return ValueEffectControl(value, effect, control); |
1274 } | 1286 } |
1275 | 1287 |
1276 EffectControlLinearizer::ValueEffectControl | 1288 EffectControlLinearizer::ValueEffectControl |
1277 EffectControlLinearizer::LowerCheckHeapObject(Node* node, Node* frame_state, | |
1278 Node* effect, Node* control) { | |
1279 Node* value = node->InputAt(0); | |
1280 | |
1281 Node* check = ObjectIsSmi(value); | |
1282 control = effect = | |
1283 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kSmi), check, | |
1284 frame_state, effect, control); | |
1285 | |
1286 return ValueEffectControl(value, effect, control); | |
1287 } | |
1288 | |
1289 EffectControlLinearizer::ValueEffectControl | |
1290 EffectControlLinearizer::LowerCheckedInt32Add(Node* node, Node* frame_state, | 1289 EffectControlLinearizer::LowerCheckedInt32Add(Node* node, Node* frame_state, |
1291 Node* effect, Node* control) { | 1290 Node* effect, Node* control) { |
1292 Node* lhs = node->InputAt(0); | 1291 Node* lhs = node->InputAt(0); |
1293 Node* rhs = node->InputAt(1); | 1292 Node* rhs = node->InputAt(1); |
1294 | 1293 |
1295 Node* value = | 1294 Node* value = |
1296 graph()->NewNode(machine()->Int32AddWithOverflow(), lhs, rhs, control); | 1295 graph()->NewNode(machine()->Int32AddWithOverflow(), lhs, rhs, control); |
1297 | 1296 |
1298 Node* check = graph()->NewNode(common()->Projection(1), value, control); | 1297 Node* check = graph()->NewNode(common()->Projection(1), value, control); |
1299 control = effect = | 1298 control = effect = |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 | 1875 |
1877 Node* check = ObjectIsSmi(value); | 1876 Node* check = ObjectIsSmi(value); |
1878 control = effect = | 1877 control = effect = |
1879 graph()->NewNode(common()->DeoptimizeUnless(DeoptimizeReason::kNotASmi), | 1878 graph()->NewNode(common()->DeoptimizeUnless(DeoptimizeReason::kNotASmi), |
1880 check, frame_state, effect, control); | 1879 check, frame_state, effect, control); |
1881 | 1880 |
1882 return ValueEffectControl(value, effect, control); | 1881 return ValueEffectControl(value, effect, control); |
1883 } | 1882 } |
1884 | 1883 |
1885 EffectControlLinearizer::ValueEffectControl | 1884 EffectControlLinearizer::ValueEffectControl |
| 1885 EffectControlLinearizer::LowerCheckedTaggedToTaggedPointer(Node* node, |
| 1886 Node* frame_state, |
| 1887 Node* effect, |
| 1888 Node* control) { |
| 1889 Node* value = node->InputAt(0); |
| 1890 |
| 1891 Node* check = ObjectIsSmi(value); |
| 1892 control = effect = |
| 1893 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kSmi), check, |
| 1894 frame_state, effect, control); |
| 1895 |
| 1896 return ValueEffectControl(value, effect, control); |
| 1897 } |
| 1898 |
| 1899 EffectControlLinearizer::ValueEffectControl |
1886 EffectControlLinearizer::LowerTruncateTaggedToWord32(Node* node, Node* effect, | 1900 EffectControlLinearizer::LowerTruncateTaggedToWord32(Node* node, Node* effect, |
1887 Node* control) { | 1901 Node* control) { |
1888 Node* value = node->InputAt(0); | 1902 Node* value = node->InputAt(0); |
1889 | 1903 |
1890 Node* check = ObjectIsSmi(value); | 1904 Node* check = ObjectIsSmi(value); |
1891 Node* branch = | 1905 Node* branch = |
1892 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); | 1906 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); |
1893 | 1907 |
1894 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 1908 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
1895 Node* etrue = effect; | 1909 Node* etrue = effect; |
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3642 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3656 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3643 Operator::kEliminatable); | 3657 Operator::kEliminatable); |
3644 to_number_operator_.set(common()->Call(desc)); | 3658 to_number_operator_.set(common()->Call(desc)); |
3645 } | 3659 } |
3646 return to_number_operator_.get(); | 3660 return to_number_operator_.get(); |
3647 } | 3661 } |
3648 | 3662 |
3649 } // namespace compiler | 3663 } // namespace compiler |
3650 } // namespace internal | 3664 } // namespace internal |
3651 } // namespace v8 | 3665 } // namespace v8 |
OLD | NEW |