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

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 1783483002: [interpreter] Add support for scalable operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Re-generate golden files. Created 4 years, 9 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/bytecode-graph-builder.h ('k') | src/debug/debug.cc » ('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/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/compiler/bytecode-branch-analysis.h" 7 #include "src/compiler/bytecode-branch-analysis.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/operator-properties.h" 9 #include "src/compiler/operator-properties.h"
10 #include "src/interpreter/bytecodes.h" 10 #include "src/interpreter/bytecodes.h"
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 set_branch_analysis(nullptr); 563 set_branch_analysis(nullptr);
564 set_bytecode_iterator(nullptr); 564 set_bytecode_iterator(nullptr);
565 DCHECK(exception_handlers_.empty()); 565 DCHECK(exception_handlers_.empty());
566 } 566 }
567 567
568 void BytecodeGraphBuilder::VisitLdaZero() { 568 void BytecodeGraphBuilder::VisitLdaZero() {
569 Node* node = jsgraph()->ZeroConstant(); 569 Node* node = jsgraph()->ZeroConstant();
570 environment()->BindAccumulator(node); 570 environment()->BindAccumulator(node);
571 } 571 }
572 572
573 void BytecodeGraphBuilder::VisitLdaSmi8() { 573 void BytecodeGraphBuilder::VisitLdaSmi() {
574 Node* node = jsgraph()->Constant(bytecode_iterator().GetImmediateOperand(0)); 574 Node* node = jsgraph()->Constant(bytecode_iterator().GetImmediateOperand(0));
575 environment()->BindAccumulator(node); 575 environment()->BindAccumulator(node);
576 } 576 }
577 577
578 void BytecodeGraphBuilder::VisitLdaConstantWide() {
579 Node* node =
580 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
581 environment()->BindAccumulator(node);
582 }
583
584 void BytecodeGraphBuilder::VisitLdaConstant() { 578 void BytecodeGraphBuilder::VisitLdaConstant() {
585 Node* node = 579 Node* node =
586 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); 580 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
587 environment()->BindAccumulator(node); 581 environment()->BindAccumulator(node);
588 } 582 }
589 583
590 void BytecodeGraphBuilder::VisitLdaUndefined() { 584 void BytecodeGraphBuilder::VisitLdaUndefined() {
591 Node* node = jsgraph()->UndefinedConstant(); 585 Node* node = jsgraph()->UndefinedConstant();
592 environment()->BindAccumulator(node); 586 environment()->BindAccumulator(node);
593 } 587 }
(...skipping 28 matching lines...) Expand all
622 Node* value = environment()->LookupAccumulator(); 616 Node* value = environment()->LookupAccumulator();
623 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), value); 617 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), value);
624 } 618 }
625 619
626 void BytecodeGraphBuilder::VisitMov() { 620 void BytecodeGraphBuilder::VisitMov() {
627 Node* value = 621 Node* value =
628 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 622 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
629 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value); 623 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value);
630 } 624 }
631 625
632 void BytecodeGraphBuilder::VisitMovWide() { VisitMov(); }
633
634 void BytecodeGraphBuilder::BuildLoadGlobal( 626 void BytecodeGraphBuilder::BuildLoadGlobal(
635 TypeofMode typeof_mode) { 627 TypeofMode typeof_mode) {
636 FrameStateBeforeAndAfter states(this); 628 FrameStateBeforeAndAfter states(this);
637 Handle<Name> name = 629 Handle<Name> name =
638 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 630 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
639 VectorSlotPair feedback = 631 VectorSlotPair feedback =
640 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); 632 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
641 633
642 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); 634 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
643 Node* node = NewNode(op, GetFunctionClosure()); 635 Node* node = NewNode(op, GetFunctionClosure());
644 environment()->BindAccumulator(node, &states); 636 environment()->BindAccumulator(node, &states);
645 } 637 }
646 638
647 void BytecodeGraphBuilder::VisitLdaGlobal() { 639 void BytecodeGraphBuilder::VisitLdaGlobal() {
648 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); 640 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
649 } 641 }
650 642
651 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() { 643 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() {
652 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); 644 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
653 } 645 }
654 646
655 void BytecodeGraphBuilder::VisitLdaGlobalWide() {
656 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
657 }
658
659 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofWide() {
660 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
661 }
662
663 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { 647 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) {
664 FrameStateBeforeAndAfter states(this); 648 FrameStateBeforeAndAfter states(this);
665 Handle<Name> name = 649 Handle<Name> name =
666 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 650 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
667 VectorSlotPair feedback = 651 VectorSlotPair feedback =
668 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); 652 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
669 Node* value = environment()->LookupAccumulator(); 653 Node* value = environment()->LookupAccumulator();
670 654
671 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback); 655 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback);
672 Node* node = NewNode(op, value, GetFunctionClosure()); 656 Node* node = NewNode(op, value, GetFunctionClosure());
673 environment()->RecordAfterState(node, &states); 657 environment()->RecordAfterState(node, &states);
674 } 658 }
675 659
676 void BytecodeGraphBuilder::VisitStaGlobalSloppy() { 660 void BytecodeGraphBuilder::VisitStaGlobalSloppy() {
677 BuildStoreGlobal(LanguageMode::SLOPPY); 661 BuildStoreGlobal(LanguageMode::SLOPPY);
678 } 662 }
679 663
680 void BytecodeGraphBuilder::VisitStaGlobalStrict() { 664 void BytecodeGraphBuilder::VisitStaGlobalStrict() {
681 BuildStoreGlobal(LanguageMode::STRICT); 665 BuildStoreGlobal(LanguageMode::STRICT);
682 } 666 }
683 667
684 void BytecodeGraphBuilder::VisitStaGlobalSloppyWide() {
685 BuildStoreGlobal(LanguageMode::SLOPPY);
686 }
687
688 void BytecodeGraphBuilder::VisitStaGlobalStrictWide() {
689 BuildStoreGlobal(LanguageMode::STRICT);
690 }
691
692 void BytecodeGraphBuilder::VisitLdaContextSlot() { 668 void BytecodeGraphBuilder::VisitLdaContextSlot() {
693 // TODO(mythria): LoadContextSlots are unrolled by the required depth when 669 // TODO(mythria): LoadContextSlots are unrolled by the required depth when
694 // generating bytecode. Hence the value of depth is always 0. Update this 670 // generating bytecode. Hence the value of depth is always 0. Update this
695 // code, when the implementation changes. 671 // code, when the implementation changes.
696 // TODO(mythria): immutable flag is also set to false. This information is not 672 // TODO(mythria): immutable flag is also set to false. This information is not
697 // available in bytecode array. update this code when the implementation 673 // available in bytecode array. update this code when the implementation
698 // changes. 674 // changes.
699 const Operator* op = javascript()->LoadContext( 675 const Operator* op = javascript()->LoadContext(
700 0, bytecode_iterator().GetIndexOperand(1), false); 676 0, bytecode_iterator().GetIndexOperand(1), false);
701 Node* context = 677 Node* context =
702 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 678 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
703 Node* node = NewNode(op, context); 679 Node* node = NewNode(op, context);
704 environment()->BindAccumulator(node); 680 environment()->BindAccumulator(node);
705 } 681 }
706 682
707 void BytecodeGraphBuilder::VisitLdaContextSlotWide() { VisitLdaContextSlot(); }
708
709 void BytecodeGraphBuilder::VisitStaContextSlot() { 683 void BytecodeGraphBuilder::VisitStaContextSlot() {
710 // TODO(mythria): LoadContextSlots are unrolled by the required depth when 684 // TODO(mythria): LoadContextSlots are unrolled by the required depth when
711 // generating bytecode. Hence the value of depth is always 0. Update this 685 // generating bytecode. Hence the value of depth is always 0. Update this
712 // code, when the implementation changes. 686 // code, when the implementation changes.
713 const Operator* op = 687 const Operator* op =
714 javascript()->StoreContext(0, bytecode_iterator().GetIndexOperand(1)); 688 javascript()->StoreContext(0, bytecode_iterator().GetIndexOperand(1));
715 Node* context = 689 Node* context =
716 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 690 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
717 Node* value = environment()->LookupAccumulator(); 691 Node* value = environment()->LookupAccumulator();
718 NewNode(op, context, value); 692 NewNode(op, context, value);
719 } 693 }
720 694
721 void BytecodeGraphBuilder::VisitStaContextSlotWide() { VisitStaContextSlot(); }
722
723 void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) { 695 void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) {
724 FrameStateBeforeAndAfter states(this); 696 FrameStateBeforeAndAfter states(this);
725 Node* name = 697 Node* name =
726 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); 698 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
727 const Operator* op = 699 const Operator* op =
728 javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF 700 javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
729 ? Runtime::kLoadLookupSlot 701 ? Runtime::kLoadLookupSlot
730 : Runtime::kLoadLookupSlotInsideTypeof); 702 : Runtime::kLoadLookupSlotInsideTypeof);
731 Node* value = NewNode(op, name); 703 Node* value = NewNode(op, name);
732 environment()->BindAccumulator(value, &states); 704 environment()->BindAccumulator(value, &states);
(...skipping 12 matching lines...) Expand all
745 Node* value = environment()->LookupAccumulator(); 717 Node* value = environment()->LookupAccumulator();
746 Node* name = 718 Node* name =
747 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); 719 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
748 const Operator* op = javascript()->CallRuntime( 720 const Operator* op = javascript()->CallRuntime(
749 is_strict(language_mode) ? Runtime::kStoreLookupSlot_Strict 721 is_strict(language_mode) ? Runtime::kStoreLookupSlot_Strict
750 : Runtime::kStoreLookupSlot_Sloppy); 722 : Runtime::kStoreLookupSlot_Sloppy);
751 Node* store = NewNode(op, name, value); 723 Node* store = NewNode(op, name, value);
752 environment()->BindAccumulator(store, &states); 724 environment()->BindAccumulator(store, &states);
753 } 725 }
754 726
755 void BytecodeGraphBuilder::VisitLdaLookupSlotWide() { VisitLdaLookupSlot(); }
756
757 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeofWide() {
758 VisitLdaLookupSlotInsideTypeof();
759 }
760
761 void BytecodeGraphBuilder::VisitStaLookupSlotSloppy() { 727 void BytecodeGraphBuilder::VisitStaLookupSlotSloppy() {
762 BuildStaLookupSlot(LanguageMode::SLOPPY); 728 BuildStaLookupSlot(LanguageMode::SLOPPY);
763 } 729 }
764 730
765 void BytecodeGraphBuilder::VisitStaLookupSlotStrict() { 731 void BytecodeGraphBuilder::VisitStaLookupSlotStrict() {
766 BuildStaLookupSlot(LanguageMode::STRICT); 732 BuildStaLookupSlot(LanguageMode::STRICT);
767 } 733 }
768 734
769 void BytecodeGraphBuilder::VisitStaLookupSlotSloppyWide() {
770 VisitStaLookupSlotSloppy();
771 }
772
773 void BytecodeGraphBuilder::VisitStaLookupSlotStrictWide() {
774 VisitStaLookupSlotStrict();
775 }
776
777 void BytecodeGraphBuilder::BuildNamedLoad() { 735 void BytecodeGraphBuilder::BuildNamedLoad() {
778 FrameStateBeforeAndAfter states(this); 736 FrameStateBeforeAndAfter states(this);
779 Node* object = 737 Node* object =
780 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 738 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
781 Handle<Name> name = 739 Handle<Name> name =
782 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); 740 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1));
783 VectorSlotPair feedback = 741 VectorSlotPair feedback =
784 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); 742 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
785 743
786 const Operator* op = javascript()->LoadNamed(name, feedback); 744 const Operator* op = javascript()->LoadNamed(name, feedback);
787 Node* node = NewNode(op, object, GetFunctionClosure()); 745 Node* node = NewNode(op, object, GetFunctionClosure());
788 environment()->BindAccumulator(node, &states); 746 environment()->BindAccumulator(node, &states);
789 } 747 }
790 748
791 void BytecodeGraphBuilder::VisitLoadIC() { BuildNamedLoad(); } 749 void BytecodeGraphBuilder::VisitLoadIC() { BuildNamedLoad(); }
792 750
793 void BytecodeGraphBuilder::VisitLoadICWide() { BuildNamedLoad(); }
794
795 void BytecodeGraphBuilder::BuildKeyedLoad() { 751 void BytecodeGraphBuilder::BuildKeyedLoad() {
796 FrameStateBeforeAndAfter states(this); 752 FrameStateBeforeAndAfter states(this);
797 Node* key = environment()->LookupAccumulator(); 753 Node* key = environment()->LookupAccumulator();
798 Node* object = 754 Node* object =
799 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 755 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
800 VectorSlotPair feedback = 756 VectorSlotPair feedback =
801 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); 757 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
802 758
803 const Operator* op = javascript()->LoadProperty(feedback); 759 const Operator* op = javascript()->LoadProperty(feedback);
804 Node* node = NewNode(op, object, key, GetFunctionClosure()); 760 Node* node = NewNode(op, object, key, GetFunctionClosure());
805 environment()->BindAccumulator(node, &states); 761 environment()->BindAccumulator(node, &states);
806 } 762 }
807 763
808 void BytecodeGraphBuilder::VisitKeyedLoadIC() { BuildKeyedLoad(); } 764 void BytecodeGraphBuilder::VisitKeyedLoadIC() { BuildKeyedLoad(); }
809 765
810 void BytecodeGraphBuilder::VisitKeyedLoadICWide() { BuildKeyedLoad(); }
811
812 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) { 766 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) {
813 FrameStateBeforeAndAfter states(this); 767 FrameStateBeforeAndAfter states(this);
814 Node* value = environment()->LookupAccumulator(); 768 Node* value = environment()->LookupAccumulator();
815 Node* object = 769 Node* object =
816 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 770 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
817 Handle<Name> name = 771 Handle<Name> name =
818 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); 772 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1));
819 VectorSlotPair feedback = 773 VectorSlotPair feedback =
820 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); 774 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
821 775
822 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback); 776 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback);
823 Node* node = NewNode(op, object, value, GetFunctionClosure()); 777 Node* node = NewNode(op, object, value, GetFunctionClosure());
824 environment()->RecordAfterState(node, &states); 778 environment()->RecordAfterState(node, &states);
825 } 779 }
826 780
827 void BytecodeGraphBuilder::VisitStoreICSloppy() { 781 void BytecodeGraphBuilder::VisitStoreICSloppy() {
828 BuildNamedStore(LanguageMode::SLOPPY); 782 BuildNamedStore(LanguageMode::SLOPPY);
829 } 783 }
830 784
831 void BytecodeGraphBuilder::VisitStoreICStrict() { 785 void BytecodeGraphBuilder::VisitStoreICStrict() {
832 BuildNamedStore(LanguageMode::STRICT); 786 BuildNamedStore(LanguageMode::STRICT);
833 } 787 }
834 788
835 void BytecodeGraphBuilder::VisitStoreICSloppyWide() {
836 BuildNamedStore(LanguageMode::SLOPPY);
837 }
838
839 void BytecodeGraphBuilder::VisitStoreICStrictWide() {
840 BuildNamedStore(LanguageMode::STRICT);
841 }
842
843 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) { 789 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) {
844 FrameStateBeforeAndAfter states(this); 790 FrameStateBeforeAndAfter states(this);
845 Node* value = environment()->LookupAccumulator(); 791 Node* value = environment()->LookupAccumulator();
846 Node* object = 792 Node* object =
847 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 793 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
848 Node* key = 794 Node* key =
849 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); 795 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
850 VectorSlotPair feedback = 796 VectorSlotPair feedback =
851 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); 797 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
852 798
853 const Operator* op = javascript()->StoreProperty(language_mode, feedback); 799 const Operator* op = javascript()->StoreProperty(language_mode, feedback);
854 Node* node = NewNode(op, object, key, value, GetFunctionClosure()); 800 Node* node = NewNode(op, object, key, value, GetFunctionClosure());
855 environment()->RecordAfterState(node, &states); 801 environment()->RecordAfterState(node, &states);
856 } 802 }
857 803
858 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy() { 804 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy() {
859 BuildKeyedStore(LanguageMode::SLOPPY); 805 BuildKeyedStore(LanguageMode::SLOPPY);
860 } 806 }
861 807
862 void BytecodeGraphBuilder::VisitKeyedStoreICStrict() { 808 void BytecodeGraphBuilder::VisitKeyedStoreICStrict() {
863 BuildKeyedStore(LanguageMode::STRICT); 809 BuildKeyedStore(LanguageMode::STRICT);
864 } 810 }
865 811
866 void BytecodeGraphBuilder::VisitKeyedStoreICSloppyWide() {
867 BuildKeyedStore(LanguageMode::SLOPPY);
868 }
869
870 void BytecodeGraphBuilder::VisitKeyedStoreICStrictWide() {
871 BuildKeyedStore(LanguageMode::STRICT);
872 }
873
874 void BytecodeGraphBuilder::VisitPushContext() { 812 void BytecodeGraphBuilder::VisitPushContext() {
875 Node* new_context = environment()->LookupAccumulator(); 813 Node* new_context = environment()->LookupAccumulator();
876 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), 814 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0),
877 environment()->Context()); 815 environment()->Context());
878 environment()->SetContext(new_context); 816 environment()->SetContext(new_context);
879 } 817 }
880 818
881 void BytecodeGraphBuilder::VisitPopContext() { 819 void BytecodeGraphBuilder::VisitPopContext() {
882 Node* context = 820 Node* context =
883 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 821 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
884 environment()->SetContext(context); 822 environment()->SetContext(context);
885 } 823 }
886 824
887 void BytecodeGraphBuilder::VisitCreateClosure() { 825 void BytecodeGraphBuilder::VisitCreateClosure() {
888 Handle<SharedFunctionInfo> shared_info = Handle<SharedFunctionInfo>::cast( 826 Handle<SharedFunctionInfo> shared_info = Handle<SharedFunctionInfo>::cast(
889 bytecode_iterator().GetConstantForIndexOperand(0)); 827 bytecode_iterator().GetConstantForIndexOperand(0));
890 PretenureFlag tenured = 828 PretenureFlag tenured =
891 bytecode_iterator().GetImmediateOperand(1) ? TENURED : NOT_TENURED; 829 bytecode_iterator().GetFlagOperand(1) ? TENURED : NOT_TENURED;
892 const Operator* op = javascript()->CreateClosure(shared_info, tenured); 830 const Operator* op = javascript()->CreateClosure(shared_info, tenured);
893 Node* closure = NewNode(op); 831 Node* closure = NewNode(op);
894 environment()->BindAccumulator(closure); 832 environment()->BindAccumulator(closure);
895 } 833 }
896 834
897 void BytecodeGraphBuilder::VisitCreateClosureWide() { VisitCreateClosure(); }
898
899 void BytecodeGraphBuilder::BuildCreateArguments(CreateArgumentsType type) { 835 void BytecodeGraphBuilder::BuildCreateArguments(CreateArgumentsType type) {
900 FrameStateBeforeAndAfter states(this); 836 FrameStateBeforeAndAfter states(this);
901 const Operator* op = javascript()->CreateArguments(type); 837 const Operator* op = javascript()->CreateArguments(type);
902 Node* object = NewNode(op, GetFunctionClosure()); 838 Node* object = NewNode(op, GetFunctionClosure());
903 environment()->BindAccumulator(object, &states); 839 environment()->BindAccumulator(object, &states);
904 } 840 }
905 841
906 void BytecodeGraphBuilder::VisitCreateMappedArguments() { 842 void BytecodeGraphBuilder::VisitCreateMappedArguments() {
907 BuildCreateArguments(CreateArgumentsType::kMappedArguments); 843 BuildCreateArguments(CreateArgumentsType::kMappedArguments);
908 } 844 }
909 845
910 void BytecodeGraphBuilder::VisitCreateUnmappedArguments() { 846 void BytecodeGraphBuilder::VisitCreateUnmappedArguments() {
911 BuildCreateArguments(CreateArgumentsType::kUnmappedArguments); 847 BuildCreateArguments(CreateArgumentsType::kUnmappedArguments);
912 } 848 }
913 849
914 void BytecodeGraphBuilder::VisitCreateRestParameter() { 850 void BytecodeGraphBuilder::VisitCreateRestParameter() {
915 BuildCreateArguments(CreateArgumentsType::kRestParameter); 851 BuildCreateArguments(CreateArgumentsType::kRestParameter);
916 } 852 }
917 853
918 void BytecodeGraphBuilder::BuildCreateLiteral(const Operator* op) { 854 void BytecodeGraphBuilder::BuildCreateLiteral(const Operator* op) {
919 FrameStateBeforeAndAfter states(this); 855 FrameStateBeforeAndAfter states(this);
920 Node* literal = NewNode(op, GetFunctionClosure()); 856 Node* literal = NewNode(op, GetFunctionClosure());
921 environment()->BindAccumulator(literal, &states); 857 environment()->BindAccumulator(literal, &states);
922 } 858 }
923 859
924 void BytecodeGraphBuilder::BuildCreateRegExpLiteral() { 860 void BytecodeGraphBuilder::VisitCreateRegExpLiteral() {
925 Handle<String> constant_pattern = 861 Handle<String> constant_pattern =
926 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 862 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
927 int literal_index = bytecode_iterator().GetIndexOperand(1); 863 int literal_index = bytecode_iterator().GetIndexOperand(1);
928 int literal_flags = bytecode_iterator().GetImmediateOperand(2); 864 int literal_flags = bytecode_iterator().GetFlagOperand(2);
929 const Operator* op = javascript()->CreateLiteralRegExp( 865 const Operator* op = javascript()->CreateLiteralRegExp(
930 constant_pattern, literal_flags, literal_index); 866 constant_pattern, literal_flags, literal_index);
931 BuildCreateLiteral(op); 867 BuildCreateLiteral(op);
932 } 868 }
933 869
934 void BytecodeGraphBuilder::VisitCreateRegExpLiteral() { 870 void BytecodeGraphBuilder::VisitCreateArrayLiteral() {
935 BuildCreateRegExpLiteral();
936 }
937
938 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide() {
939 BuildCreateRegExpLiteral();
940 }
941
942 void BytecodeGraphBuilder::BuildCreateArrayLiteral() {
943 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast( 871 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast(
944 bytecode_iterator().GetConstantForIndexOperand(0)); 872 bytecode_iterator().GetConstantForIndexOperand(0));
945 int literal_index = bytecode_iterator().GetIndexOperand(1); 873 int literal_index = bytecode_iterator().GetIndexOperand(1);
946 int literal_flags = bytecode_iterator().GetImmediateOperand(2); 874 int literal_flags = bytecode_iterator().GetFlagOperand(2);
947 int number_of_elements = constant_elements->length(); 875 int number_of_elements = constant_elements->length();
948 const Operator* op = javascript()->CreateLiteralArray( 876 const Operator* op = javascript()->CreateLiteralArray(
949 constant_elements, literal_flags, literal_index, number_of_elements); 877 constant_elements, literal_flags, literal_index, number_of_elements);
950 BuildCreateLiteral(op); 878 BuildCreateLiteral(op);
951 } 879 }
952 880
953 void BytecodeGraphBuilder::VisitCreateArrayLiteral() { 881 void BytecodeGraphBuilder::VisitCreateObjectLiteral() {
954 BuildCreateArrayLiteral();
955 }
956
957 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide() {
958 BuildCreateArrayLiteral();
959 }
960
961 void BytecodeGraphBuilder::BuildCreateObjectLiteral() {
962 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast( 882 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast(
963 bytecode_iterator().GetConstantForIndexOperand(0)); 883 bytecode_iterator().GetConstantForIndexOperand(0));
964 int literal_index = bytecode_iterator().GetIndexOperand(1); 884 int literal_index = bytecode_iterator().GetIndexOperand(1);
965 int literal_flags = bytecode_iterator().GetImmediateOperand(2); 885 int literal_flags = bytecode_iterator().GetFlagOperand(2);
966 // TODO(mstarzinger): Thread through number of properties. 886 // TODO(mstarzinger): Thread through number of properties.
967 int number_of_properties = constant_properties->length() / 2; 887 int number_of_properties = constant_properties->length() / 2;
968 const Operator* op = javascript()->CreateLiteralObject( 888 const Operator* op = javascript()->CreateLiteralObject(
969 constant_properties, literal_flags, literal_index, number_of_properties); 889 constant_properties, literal_flags, literal_index, number_of_properties);
970 BuildCreateLiteral(op); 890 BuildCreateLiteral(op);
971 } 891 }
972 892
973 void BytecodeGraphBuilder::VisitCreateObjectLiteral() {
974 BuildCreateObjectLiteral();
975 }
976
977 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide() {
978 BuildCreateObjectLiteral();
979 }
980
981
982 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, 893 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op,
983 Node* callee, 894 Node* callee,
984 interpreter::Register receiver, 895 interpreter::Register receiver,
985 size_t arity) { 896 size_t arity) {
986 Node** all = local_zone()->NewArray<Node*>(static_cast<int>(arity)); 897 Node** all = local_zone()->NewArray<Node*>(static_cast<int>(arity));
987 all[0] = callee; 898 all[0] = callee;
988 all[1] = environment()->LookupRegister(receiver); 899 all[1] = environment()->LookupRegister(receiver);
989 int receiver_index = receiver.index(); 900 int receiver_index = receiver.index();
990 for (int i = 2; i < static_cast<int>(arity); ++i) { 901 for (int i = 2; i < static_cast<int>(arity); ++i) {
991 all[i] = environment()->LookupRegister( 902 all[i] = environment()->LookupRegister(
(...skipping 17 matching lines...) Expand all
1009 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); 920 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3));
1010 921
1011 const Operator* call = javascript()->CallFunction( 922 const Operator* call = javascript()->CallFunction(
1012 arg_count + 1, feedback, receiver_hint, tail_call_mode); 923 arg_count + 1, feedback, receiver_hint, tail_call_mode);
1013 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); 924 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1);
1014 environment()->BindAccumulator(value, &states); 925 environment()->BindAccumulator(value, &states);
1015 } 926 }
1016 927
1017 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); } 928 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); }
1018 929
1019 void BytecodeGraphBuilder::VisitCallWide() {
1020 BuildCall(TailCallMode::kDisallow);
1021 }
1022
1023 void BytecodeGraphBuilder::VisitTailCall() { BuildCall(TailCallMode::kAllow); } 930 void BytecodeGraphBuilder::VisitTailCall() { BuildCall(TailCallMode::kAllow); }
1024 931
1025 void BytecodeGraphBuilder::VisitTailCallWide() { 932 void BytecodeGraphBuilder::VisitCallJSRuntime() {
1026 BuildCall(TailCallMode::kAllow);
1027 }
1028
1029 void BytecodeGraphBuilder::BuildCallJSRuntime() {
1030 FrameStateBeforeAndAfter states(this); 933 FrameStateBeforeAndAfter states(this);
1031 Node* callee = 934 Node* callee =
1032 BuildLoadNativeContextField(bytecode_iterator().GetIndexOperand(0)); 935 BuildLoadNativeContextField(bytecode_iterator().GetIndexOperand(0));
1033 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); 936 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1);
1034 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 937 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1035 938
1036 // Create node to perform the JS runtime call. 939 // Create node to perform the JS runtime call.
1037 const Operator* call = javascript()->CallFunction(arg_count + 1); 940 const Operator* call = javascript()->CallFunction(arg_count + 1);
1038 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); 941 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1);
1039 environment()->BindAccumulator(value, &states); 942 environment()->BindAccumulator(value, &states);
1040 } 943 }
1041 944
1042 void BytecodeGraphBuilder::VisitCallJSRuntime() { BuildCallJSRuntime(); }
1043
1044 void BytecodeGraphBuilder::VisitCallJSRuntimeWide() { BuildCallJSRuntime(); }
1045
1046 Node* BytecodeGraphBuilder::ProcessCallRuntimeArguments( 945 Node* BytecodeGraphBuilder::ProcessCallRuntimeArguments(
1047 const Operator* call_runtime_op, interpreter::Register first_arg, 946 const Operator* call_runtime_op, interpreter::Register first_arg,
1048 size_t arity) { 947 size_t arity) {
1049 Node** all = local_zone()->NewArray<Node*>(arity); 948 Node** all = local_zone()->NewArray<Node*>(arity);
1050 int first_arg_index = first_arg.index(); 949 int first_arg_index = first_arg.index();
1051 for (int i = 0; i < static_cast<int>(arity); ++i) { 950 for (int i = 0; i < static_cast<int>(arity); ++i) {
1052 all[i] = environment()->LookupRegister( 951 all[i] = environment()->LookupRegister(
1053 interpreter::Register(first_arg_index + i)); 952 interpreter::Register(first_arg_index + i));
1054 } 953 }
1055 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false); 954 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false);
1056 return value; 955 return value;
1057 } 956 }
1058 957
1059 void BytecodeGraphBuilder::BuildCallRuntime() { 958 void BytecodeGraphBuilder::VisitCallRuntime() {
1060 FrameStateBeforeAndAfter states(this); 959 FrameStateBeforeAndAfter states(this);
1061 Runtime::FunctionId functionId = 960 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>(
1062 static_cast<Runtime::FunctionId>(bytecode_iterator().GetIndexOperand(0)); 961 bytecode_iterator().GetRuntimeIdOperand(0));
1063 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 962 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1064 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 963 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1065 964
1066 // Create node to perform the runtime call. 965 // Create node to perform the runtime call.
1067 const Operator* call = javascript()->CallRuntime(functionId, arg_count); 966 const Operator* call = javascript()->CallRuntime(functionId, arg_count);
1068 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); 967 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count);
1069 environment()->BindAccumulator(value, &states); 968 environment()->BindAccumulator(value, &states);
1070 } 969 }
1071 970
1072 void BytecodeGraphBuilder::VisitCallRuntime() { BuildCallRuntime(); } 971 void BytecodeGraphBuilder::VisitCallRuntimeForPair() {
1073
1074 void BytecodeGraphBuilder::VisitCallRuntimeWide() { BuildCallRuntime(); }
1075
1076 void BytecodeGraphBuilder::BuildCallRuntimeForPair() {
1077 FrameStateBeforeAndAfter states(this); 972 FrameStateBeforeAndAfter states(this);
1078 Runtime::FunctionId functionId = 973 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>(
1079 static_cast<Runtime::FunctionId>(bytecode_iterator().GetIndexOperand(0)); 974 bytecode_iterator().GetRuntimeIdOperand(0));
1080 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 975 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1081 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 976 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1082 interpreter::Register first_return = 977 interpreter::Register first_return =
1083 bytecode_iterator().GetRegisterOperand(3); 978 bytecode_iterator().GetRegisterOperand(3);
1084 979
1085 // Create node to perform the runtime call. 980 // Create node to perform the runtime call.
1086 const Operator* call = javascript()->CallRuntime(functionId, arg_count); 981 const Operator* call = javascript()->CallRuntime(functionId, arg_count);
1087 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count); 982 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count);
1088 environment()->BindRegistersToProjections(first_return, return_pair, &states); 983 environment()->BindRegistersToProjections(first_return, return_pair, &states);
1089 } 984 }
1090 985
1091 void BytecodeGraphBuilder::VisitCallRuntimeForPair() {
1092 BuildCallRuntimeForPair();
1093 }
1094
1095 void BytecodeGraphBuilder::VisitCallRuntimeForPairWide() {
1096 BuildCallRuntimeForPair();
1097 }
1098
1099 Node* BytecodeGraphBuilder::ProcessCallNewArguments( 986 Node* BytecodeGraphBuilder::ProcessCallNewArguments(
1100 const Operator* call_new_op, Node* callee, Node* new_target, 987 const Operator* call_new_op, Node* callee, Node* new_target,
1101 interpreter::Register first_arg, size_t arity) { 988 interpreter::Register first_arg, size_t arity) {
1102 Node** all = local_zone()->NewArray<Node*>(arity); 989 Node** all = local_zone()->NewArray<Node*>(arity);
1103 all[0] = new_target; 990 all[0] = new_target;
1104 int first_arg_index = first_arg.index(); 991 int first_arg_index = first_arg.index();
1105 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { 992 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) {
1106 all[i] = environment()->LookupRegister( 993 all[i] = environment()->LookupRegister(
1107 interpreter::Register(first_arg_index + i - 1)); 994 interpreter::Register(first_arg_index + i - 1));
1108 } 995 }
1109 all[arity - 1] = callee; 996 all[arity - 1] = callee;
1110 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); 997 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false);
1111 return value; 998 return value;
1112 } 999 }
1113 1000
1114 void BytecodeGraphBuilder::BuildCallConstruct() { 1001 void BytecodeGraphBuilder::VisitNew() {
1115 FrameStateBeforeAndAfter states(this); 1002 FrameStateBeforeAndAfter states(this);
1116 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); 1003 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0);
1117 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 1004 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1118 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 1005 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1119 1006
1120 Node* new_target = environment()->LookupAccumulator(); 1007 Node* new_target = environment()->LookupAccumulator();
1121 Node* callee = environment()->LookupRegister(callee_reg); 1008 Node* callee = environment()->LookupRegister(callee_reg);
1122 // TODO(turbofan): Pass the feedback here. 1009 // TODO(turbofan): Pass the feedback here.
1123 const Operator* call = javascript()->CallConstruct( 1010 const Operator* call = javascript()->CallConstruct(
1124 static_cast<int>(arg_count) + 2, VectorSlotPair()); 1011 static_cast<int>(arg_count) + 2, VectorSlotPair());
1125 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, 1012 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg,
1126 arg_count + 2); 1013 arg_count + 2);
1127 environment()->BindAccumulator(value, &states); 1014 environment()->BindAccumulator(value, &states);
1128 } 1015 }
1129 1016
1130 void BytecodeGraphBuilder::VisitNew() { BuildCallConstruct(); }
1131
1132 void BytecodeGraphBuilder::VisitNewWide() { BuildCallConstruct(); }
1133
1134 void BytecodeGraphBuilder::BuildThrow() { 1017 void BytecodeGraphBuilder::BuildThrow() {
1135 FrameStateBeforeAndAfter states(this); 1018 FrameStateBeforeAndAfter states(this);
1136 Node* value = environment()->LookupAccumulator(); 1019 Node* value = environment()->LookupAccumulator();
1137 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); 1020 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value);
1138 environment()->BindAccumulator(call, &states); 1021 environment()->BindAccumulator(call, &states);
1139 } 1022 }
1140 1023
1141 void BytecodeGraphBuilder::VisitThrow() { 1024 void BytecodeGraphBuilder::VisitThrow() {
1142 BuildThrow(); 1025 BuildThrow();
1143 Node* call = environment()->LookupAccumulator(); 1026 Node* call = environment()->LookupAccumulator();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 } 1208 }
1326 1209
1327 void BytecodeGraphBuilder::VisitToNumber() { 1210 void BytecodeGraphBuilder::VisitToNumber() {
1328 BuildCastOperator(javascript()->ToNumber()); 1211 BuildCastOperator(javascript()->ToNumber());
1329 } 1212 }
1330 1213
1331 void BytecodeGraphBuilder::VisitJump() { BuildJump(); } 1214 void BytecodeGraphBuilder::VisitJump() { BuildJump(); }
1332 1215
1333 void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); } 1216 void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); }
1334 1217
1335 void BytecodeGraphBuilder::VisitJumpConstantWide() { BuildJump(); }
1336 1218
1337 void BytecodeGraphBuilder::VisitJumpIfTrue() { 1219 void BytecodeGraphBuilder::VisitJumpIfTrue() {
1338 BuildJumpIfEqual(jsgraph()->TrueConstant()); 1220 BuildJumpIfEqual(jsgraph()->TrueConstant());
1339 } 1221 }
1340 1222
1341 void BytecodeGraphBuilder::VisitJumpIfTrueConstant() { 1223 void BytecodeGraphBuilder::VisitJumpIfTrueConstant() {
1342 BuildJumpIfEqual(jsgraph()->TrueConstant()); 1224 BuildJumpIfEqual(jsgraph()->TrueConstant());
1343 } 1225 }
1344 1226
1345 void BytecodeGraphBuilder::VisitJumpIfTrueConstantWide() {
1346 BuildJumpIfEqual(jsgraph()->TrueConstant());
1347 }
1348
1349 void BytecodeGraphBuilder::VisitJumpIfFalse() { 1227 void BytecodeGraphBuilder::VisitJumpIfFalse() {
1350 BuildJumpIfEqual(jsgraph()->FalseConstant()); 1228 BuildJumpIfEqual(jsgraph()->FalseConstant());
1351 } 1229 }
1352 1230
1353 void BytecodeGraphBuilder::VisitJumpIfFalseConstant() { 1231 void BytecodeGraphBuilder::VisitJumpIfFalseConstant() {
1354 BuildJumpIfEqual(jsgraph()->FalseConstant()); 1232 BuildJumpIfEqual(jsgraph()->FalseConstant());
1355 } 1233 }
1356 1234
1357 void BytecodeGraphBuilder::VisitJumpIfFalseConstantWide() {
1358 BuildJumpIfEqual(jsgraph()->FalseConstant());
1359 }
1360
1361 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrue() { 1235 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrue() {
1362 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant()); 1236 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant());
1363 } 1237 }
1364 1238
1365 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstant() { 1239 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstant() {
1366 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant()); 1240 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant());
1367 } 1241 }
1368 1242
1369 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstantWide() {
1370 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant());
1371 }
1372
1373 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalse() { 1243 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalse() {
1374 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); 1244 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant());
1375 } 1245 }
1376 1246
1377 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() { 1247 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() {
1378 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); 1248 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant());
1379 } 1249 }
1380 1250
1381 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstantWide() {
1382 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant());
1383 }
1384
1385 void BytecodeGraphBuilder::VisitJumpIfNotHole() { BuildJumpIfNotHole(); } 1251 void BytecodeGraphBuilder::VisitJumpIfNotHole() { BuildJumpIfNotHole(); }
1386 1252
1387 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstant() { 1253 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstant() {
1388 BuildJumpIfNotHole(); 1254 BuildJumpIfNotHole();
1389 } 1255 }
1390 1256
1391 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstantWide() {
1392 BuildJumpIfNotHole();
1393 }
1394
1395 void BytecodeGraphBuilder::VisitJumpIfNull() { 1257 void BytecodeGraphBuilder::VisitJumpIfNull() {
1396 BuildJumpIfEqual(jsgraph()->NullConstant()); 1258 BuildJumpIfEqual(jsgraph()->NullConstant());
1397 } 1259 }
1398 1260
1399 void BytecodeGraphBuilder::VisitJumpIfNullConstant() { 1261 void BytecodeGraphBuilder::VisitJumpIfNullConstant() {
1400 BuildJumpIfEqual(jsgraph()->NullConstant()); 1262 BuildJumpIfEqual(jsgraph()->NullConstant());
1401 } 1263 }
1402 1264
1403 void BytecodeGraphBuilder::VisitJumpIfNullConstantWide() {
1404 BuildJumpIfEqual(jsgraph()->NullConstant());
1405 }
1406
1407 void BytecodeGraphBuilder::VisitJumpIfUndefined() { 1265 void BytecodeGraphBuilder::VisitJumpIfUndefined() {
1408 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); 1266 BuildJumpIfEqual(jsgraph()->UndefinedConstant());
1409 } 1267 }
1410 1268
1411 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() { 1269 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() {
1412 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); 1270 BuildJumpIfEqual(jsgraph()->UndefinedConstant());
1413 } 1271 }
1414 1272
1415 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstantWide() {
1416 BuildJumpIfEqual(jsgraph()->UndefinedConstant());
1417 }
1418
1419 void BytecodeGraphBuilder::VisitStackCheck() { 1273 void BytecodeGraphBuilder::VisitStackCheck() {
1420 FrameStateBeforeAndAfter states(this); 1274 FrameStateBeforeAndAfter states(this);
1421 Node* node = NewNode(javascript()->StackCheck()); 1275 Node* node = NewNode(javascript()->StackCheck());
1422 environment()->RecordAfterState(node, &states); 1276 environment()->RecordAfterState(node, &states);
1423 } 1277 }
1424 1278
1425 void BytecodeGraphBuilder::VisitReturn() { 1279 void BytecodeGraphBuilder::VisitReturn() {
1426 Node* control = 1280 Node* control =
1427 NewNode(common()->Return(), environment()->LookupAccumulator()); 1281 NewNode(common()->Return(), environment()->LookupAccumulator());
1428 MergeControlToLeaveFunction(control); 1282 MergeControlToLeaveFunction(control);
(...skipping 15 matching lines...) Expand all
1444 void BytecodeGraphBuilder::BuildForInPrepare() { 1298 void BytecodeGraphBuilder::BuildForInPrepare() {
1445 FrameStateBeforeAndAfter states(this); 1299 FrameStateBeforeAndAfter states(this);
1446 Node* receiver = environment()->LookupAccumulator(); 1300 Node* receiver = environment()->LookupAccumulator();
1447 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); 1301 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver);
1448 environment()->BindRegistersToProjections( 1302 environment()->BindRegistersToProjections(
1449 bytecode_iterator().GetRegisterOperand(0), prepare, &states); 1303 bytecode_iterator().GetRegisterOperand(0), prepare, &states);
1450 } 1304 }
1451 1305
1452 void BytecodeGraphBuilder::VisitForInPrepare() { BuildForInPrepare(); } 1306 void BytecodeGraphBuilder::VisitForInPrepare() { BuildForInPrepare(); }
1453 1307
1454 void BytecodeGraphBuilder::VisitForInPrepareWide() { BuildForInPrepare(); }
1455
1456 void BytecodeGraphBuilder::VisitForInDone() { 1308 void BytecodeGraphBuilder::VisitForInDone() {
1457 FrameStateBeforeAndAfter states(this); 1309 FrameStateBeforeAndAfter states(this);
1458 Node* index = 1310 Node* index =
1459 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1311 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1460 Node* cache_length = 1312 Node* cache_length =
1461 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); 1313 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
1462 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); 1314 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length);
1463 environment()->BindAccumulator(exit_cond, &states); 1315 environment()->BindAccumulator(exit_cond, &states);
1464 } 1316 }
1465 1317
1466 void BytecodeGraphBuilder::BuildForInNext() { 1318 void BytecodeGraphBuilder::BuildForInNext() {
1467 FrameStateBeforeAndAfter states(this); 1319 FrameStateBeforeAndAfter states(this);
1468 Node* receiver = 1320 Node* receiver =
1469 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1321 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1470 Node* index = 1322 Node* index =
1471 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); 1323 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
1472 int catch_reg_pair_index = bytecode_iterator().GetRegisterOperand(2).index(); 1324 int catch_reg_pair_index = bytecode_iterator().GetRegisterOperand(2).index();
1473 Node* cache_type = environment()->LookupRegister( 1325 Node* cache_type = environment()->LookupRegister(
1474 interpreter::Register(catch_reg_pair_index)); 1326 interpreter::Register(catch_reg_pair_index));
1475 Node* cache_array = environment()->LookupRegister( 1327 Node* cache_array = environment()->LookupRegister(
1476 interpreter::Register(catch_reg_pair_index + 1)); 1328 interpreter::Register(catch_reg_pair_index + 1));
1477 1329
1478 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, 1330 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array,
1479 cache_type, index); 1331 cache_type, index);
1480 environment()->BindAccumulator(value, &states); 1332 environment()->BindAccumulator(value, &states);
1481 } 1333 }
1482 1334
1483 void BytecodeGraphBuilder::VisitForInNext() { BuildForInNext(); } 1335 void BytecodeGraphBuilder::VisitForInNext() { BuildForInNext(); }
1484 1336
1485 void BytecodeGraphBuilder::VisitForInNextWide() { BuildForInNext(); }
1486
1487 void BytecodeGraphBuilder::VisitForInStep() { 1337 void BytecodeGraphBuilder::VisitForInStep() {
1488 FrameStateBeforeAndAfter states(this); 1338 FrameStateBeforeAndAfter states(this);
1489 Node* index = 1339 Node* index =
1490 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1340 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1491 index = NewNode(javascript()->ForInStep(), index); 1341 index = NewNode(javascript()->ForInStep(), index);
1492 environment()->BindAccumulator(index, &states); 1342 environment()->BindAccumulator(index, &states);
1493 } 1343 }
1494 1344
1345 void BytecodeGraphBuilder::VisitWide() {
1346 // Consumed by the BytecodeArrayIterator.
1347 UNREACHABLE();
1348 }
1349
1350 void BytecodeGraphBuilder::VisitExtraWide() {
1351 // Consumed by the BytecodeArrayIterator.
1352 UNREACHABLE();
1353 }
1354
1355 void BytecodeGraphBuilder::VisitIllegal() {
1356 // Never present in valid bytecode.
1357 UNREACHABLE();
1358 }
1359
1495 void BytecodeGraphBuilder::SwitchToMergeEnvironment(int current_offset) { 1360 void BytecodeGraphBuilder::SwitchToMergeEnvironment(int current_offset) {
1496 if (merge_environments_[current_offset] != nullptr) { 1361 if (merge_environments_[current_offset] != nullptr) {
1497 if (environment() != nullptr) { 1362 if (environment() != nullptr) {
1498 merge_environments_[current_offset]->Merge(environment()); 1363 merge_environments_[current_offset]->Merge(environment());
1499 } 1364 }
1500 set_environment(merge_environments_[current_offset]); 1365 set_environment(merge_environments_[current_offset]);
1501 } 1366 }
1502 } 1367 }
1503 1368
1504 void BytecodeGraphBuilder::BuildLoopHeaderEnvironment(int current_offset) { 1369 void BytecodeGraphBuilder::BuildLoopHeaderEnvironment(int current_offset) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 // Phi does not exist yet, introduce one. 1622 // Phi does not exist yet, introduce one.
1758 value = NewPhi(inputs, value, control); 1623 value = NewPhi(inputs, value, control);
1759 value->ReplaceInput(inputs - 1, other); 1624 value->ReplaceInput(inputs - 1, other);
1760 } 1625 }
1761 return value; 1626 return value;
1762 } 1627 }
1763 1628
1764 } // namespace compiler 1629 } // namespace compiler
1765 } // namespace internal 1630 } // namespace internal
1766 } // namespace v8 1631 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698