| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class HValue; | 44 class HValue; |
| 45 class LInstruction; | 45 class LInstruction; |
| 46 class LChunkBuilder; | 46 class LChunkBuilder; |
| 47 | 47 |
| 48 | 48 |
| 49 #define HYDROGEN_ALL_INSTRUCTION_LIST(V) \ | 49 #define HYDROGEN_ALL_INSTRUCTION_LIST(V) \ |
| 50 V(ArithmeticBinaryOperation) \ | 50 V(ArithmeticBinaryOperation) \ |
| 51 V(BinaryCall) \ | 51 V(BinaryCall) \ |
| 52 V(BinaryOperation) \ | 52 V(BinaryOperation) \ |
| 53 V(BitwiseBinaryOperation) \ | 53 V(BitwiseBinaryOperation) \ |
| 54 V(Call) \ | |
| 55 V(ControlInstruction) \ | 54 V(ControlInstruction) \ |
| 56 V(Instruction) \ | 55 V(Instruction) \ |
| 57 V(LoadKeyed) \ | |
| 58 V(MaterializedLiteral) \ | |
| 59 V(Phi) \ | 56 V(Phi) \ |
| 60 V(StoreKeyed) \ | |
| 61 V(StoreNamed) \ | |
| 62 V(UnaryCall) \ | 57 V(UnaryCall) \ |
| 63 V(UnaryControlInstruction) \ | 58 V(UnaryControlInstruction) \ |
| 64 V(UnaryOperation) \ | 59 V(UnaryOperation) \ |
| 65 HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) | 60 HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) |
| 66 | 61 |
| 67 | 62 |
| 68 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ | 63 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ |
| 69 V(AbnormalExit) \ | 64 V(AbnormalExit) \ |
| 70 V(AccessArgumentsAt) \ | 65 V(AccessArgumentsAt) \ |
| 71 V(Add) \ | 66 V(Add) \ |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } \ | 181 } \ |
| 187 Opcode opcode() const { return HValue::k##type; } | 182 Opcode opcode() const { return HValue::k##type; } |
| 188 | 183 |
| 189 | 184 |
| 190 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | 185 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
| 191 virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \ | 186 virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \ |
| 192 virtual const char* Mnemonic() const { return mnemonic; } \ | 187 virtual const char* Mnemonic() const { return mnemonic; } \ |
| 193 DECLARE_INSTRUCTION(type) | 188 DECLARE_INSTRUCTION(type) |
| 194 | 189 |
| 195 | 190 |
| 196 | |
| 197 template<int kSize> | |
| 198 class HOperandVector : public EmbeddedVector<HValue*, kSize> { | |
| 199 public: | |
| 200 HOperandVector() : EmbeddedVector<HValue*, kSize>(NULL) { } | |
| 201 }; | |
| 202 | |
| 203 | |
| 204 class Range: public ZoneObject { | 191 class Range: public ZoneObject { |
| 205 public: | 192 public: |
| 206 Range() : lower_(kMinInt), | 193 Range() : lower_(kMinInt), |
| 207 upper_(kMaxInt), | 194 upper_(kMaxInt), |
| 208 next_(NULL), | 195 next_(NULL), |
| 209 can_be_minus_zero_(false) { } | 196 can_be_minus_zero_(false) { } |
| 210 | 197 |
| 211 Range(int32_t lower, int32_t upper) | 198 Range(int32_t lower, int32_t upper) |
| 212 : lower_(lower), upper_(upper), next_(NULL), can_be_minus_zero_(false) { } | 199 : lower_(lower), upper_(upper), next_(NULL), can_be_minus_zero_(false) { } |
| 213 | 200 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // one input. They are phi and binary add. They always return NULL and | 524 // one input. They are phi and binary add. They always return NULL and |
| 538 // expect the caller to take care of things. | 525 // expect the caller to take care of things. |
| 539 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { | 526 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { |
| 540 visited->Add(id()); | 527 visited->Add(id()); |
| 541 return NULL; | 528 return NULL; |
| 542 } | 529 } |
| 543 | 530 |
| 544 bool IsDefinedAfter(HBasicBlock* other) const; | 531 bool IsDefinedAfter(HBasicBlock* other) const; |
| 545 | 532 |
| 546 // Operands. | 533 // Operands. |
| 547 virtual int OperandCount() { return 0; } | 534 virtual int OperandCount() = 0; |
| 548 virtual HValue* OperandAt(int index) { | 535 virtual HValue* OperandAt(int index) = 0; |
| 549 UNREACHABLE(); | |
| 550 return NULL; | |
| 551 } | |
| 552 void SetOperandAt(int index, HValue* value); | 536 void SetOperandAt(int index, HValue* value); |
| 553 | 537 |
| 554 int LookupOperandIndex(int occurrence_index, HValue* op); | 538 int LookupOperandIndex(int occurrence_index, HValue* op); |
| 555 bool UsesMultipleTimes(HValue* op); | 539 bool UsesMultipleTimes(HValue* op); |
| 556 | 540 |
| 557 void ReplaceAndDelete(HValue* other); | 541 void ReplaceAndDelete(HValue* other); |
| 558 void ReplaceValue(HValue* other); | 542 void ReplaceValue(HValue* other); |
| 559 void ReplaceAtUse(HValue* use, HValue* other); | 543 void ReplaceAtUse(HValue* use, HValue* other); |
| 560 void ReplaceFirstAtUse(HValue* use, HValue* other, Representation r); | 544 void ReplaceFirstAtUse(HValue* use, HValue* other, Representation r); |
| 561 bool HasNoUses() const { return uses_.is_empty(); } | 545 bool HasNoUses() const { return uses_.is_empty(); } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 protected: | 603 protected: |
| 620 // This function must be overridden for instructions with flag kUseGVN, to | 604 // This function must be overridden for instructions with flag kUseGVN, to |
| 621 // compare the non-Operand parts of the instruction. | 605 // compare the non-Operand parts of the instruction. |
| 622 virtual bool DataEquals(HValue* other) { | 606 virtual bool DataEquals(HValue* other) { |
| 623 UNREACHABLE(); | 607 UNREACHABLE(); |
| 624 return false; | 608 return false; |
| 625 } | 609 } |
| 626 virtual void RepresentationChanged(Representation to) { } | 610 virtual void RepresentationChanged(Representation to) { } |
| 627 virtual Range* InferRange(); | 611 virtual Range* InferRange(); |
| 628 virtual void DeleteFromGraph() = 0; | 612 virtual void DeleteFromGraph() = 0; |
| 629 virtual void InternalSetOperandAt(int index, HValue* value) { UNREACHABLE(); } | 613 virtual void InternalSetOperandAt(int index, HValue* value) = 0; |
| 630 void clear_block() { | 614 void clear_block() { |
| 631 ASSERT(block_ != NULL); | 615 ASSERT(block_ != NULL); |
| 632 block_ = NULL; | 616 block_ = NULL; |
| 633 } | 617 } |
| 634 | 618 |
| 635 void set_representation(Representation r) { | 619 void set_representation(Representation r) { |
| 636 // Representation is set-once. | 620 // Representation is set-once. |
| 637 ASSERT(representation_.IsNone() && !r.IsNone()); | 621 ASSERT(representation_.IsNone() && !r.IsNone()); |
| 638 representation_ = r; | 622 representation_ = r; |
| 639 } | 623 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; | 667 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
| 684 | 668 |
| 685 #ifdef DEBUG | 669 #ifdef DEBUG |
| 686 virtual void Verify(); | 670 virtual void Verify(); |
| 687 #endif | 671 #endif |
| 688 | 672 |
| 689 // Returns whether this is some kind of deoptimizing check | 673 // Returns whether this is some kind of deoptimizing check |
| 690 // instruction. | 674 // instruction. |
| 691 virtual bool IsCheckInstruction() const { return false; } | 675 virtual bool IsCheckInstruction() const { return false; } |
| 692 | 676 |
| 677 virtual bool IsCall() { return false; } |
| 678 |
| 693 DECLARE_INSTRUCTION(Instruction) | 679 DECLARE_INSTRUCTION(Instruction) |
| 694 | 680 |
| 695 protected: | 681 protected: |
| 696 HInstruction() | 682 HInstruction() |
| 697 : next_(NULL), | 683 : next_(NULL), |
| 698 previous_(NULL), | 684 previous_(NULL), |
| 699 position_(RelocInfo::kNoPosition) { | 685 position_(RelocInfo::kNoPosition) { |
| 700 SetFlag(kDependsOnOsrEntries); | 686 SetFlag(kDependsOnOsrEntries); |
| 701 } | 687 } |
| 702 | 688 |
| 703 virtual void DeleteFromGraph() { Unlink(); } | 689 virtual void DeleteFromGraph() { Unlink(); } |
| 704 | 690 |
| 705 private: | 691 private: |
| 706 void InitializeAsFirst(HBasicBlock* block) { | 692 void InitializeAsFirst(HBasicBlock* block) { |
| 707 ASSERT(!IsLinked()); | 693 ASSERT(!IsLinked()); |
| 708 SetBlock(block); | 694 SetBlock(block); |
| 709 } | 695 } |
| 710 | 696 |
| 711 HInstruction* next_; | 697 HInstruction* next_; |
| 712 HInstruction* previous_; | 698 HInstruction* previous_; |
| 713 int position_; | 699 int position_; |
| 714 | 700 |
| 715 friend class HBasicBlock; | 701 friend class HBasicBlock; |
| 716 }; | 702 }; |
| 717 | 703 |
| 718 | 704 |
| 719 class HBlockEntry: public HInstruction { | |
| 720 public: | |
| 721 | |
| 722 virtual Representation RequiredInputRepresentation(int index) const { | |
| 723 return Representation::None(); | |
| 724 } | |
| 725 | |
| 726 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry") | |
| 727 }; | |
| 728 | |
| 729 | |
| 730 class HControlInstruction: public HInstruction { | 705 class HControlInstruction: public HInstruction { |
| 731 public: | 706 public: |
| 732 HControlInstruction(HBasicBlock* first, HBasicBlock* second) | 707 HControlInstruction(HBasicBlock* first, HBasicBlock* second) |
| 733 : first_successor_(first), second_successor_(second) { | 708 : first_successor_(first), second_successor_(second) { |
| 734 } | 709 } |
| 735 | 710 |
| 736 HBasicBlock* FirstSuccessor() const { return first_successor_; } | 711 HBasicBlock* FirstSuccessor() const { return first_successor_; } |
| 737 HBasicBlock* SecondSuccessor() const { return second_successor_; } | 712 HBasicBlock* SecondSuccessor() const { return second_successor_; } |
| 738 | 713 |
| 739 virtual void PrintDataTo(StringStream* stream); | 714 virtual void PrintDataTo(StringStream* stream); |
| 740 | 715 |
| 741 DECLARE_INSTRUCTION(ControlInstruction) | 716 DECLARE_INSTRUCTION(ControlInstruction) |
| 742 | 717 |
| 743 private: | 718 private: |
| 744 HBasicBlock* first_successor_; | 719 HBasicBlock* first_successor_; |
| 745 HBasicBlock* second_successor_; | 720 HBasicBlock* second_successor_; |
| 746 }; | 721 }; |
| 747 | 722 |
| 748 | 723 |
| 749 class HDeoptimize: public HControlInstruction { | 724 template<int NumElements> |
| 725 class HOperandContainer { |
| 750 public: | 726 public: |
| 751 HDeoptimize() : HControlInstruction(NULL, NULL) { } | 727 HOperandContainer() : elems_() { } |
| 728 |
| 729 int length() { return NumElements; } |
| 730 HValue*& operator[](int i) { |
| 731 ASSERT(i < length()); |
| 732 return elems_[i]; |
| 733 } |
| 734 |
| 735 private: |
| 736 HValue* elems_[NumElements]; |
| 737 }; |
| 738 |
| 739 |
| 740 template<> |
| 741 class HOperandContainer<0> { |
| 742 public: |
| 743 int length() { return 0; } |
| 744 HValue*& operator[](int i) { |
| 745 UNREACHABLE(); |
| 746 static HValue* t = 0; |
| 747 return t; |
| 748 } |
| 749 }; |
| 750 |
| 751 |
| 752 template<int V> |
| 753 class HTemplateInstruction : public HInstruction { |
| 754 public: |
| 755 int OperandCount() { return V; } |
| 756 HValue* OperandAt(int i) { return inputs_[i]; } |
| 757 |
| 758 protected: |
| 759 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
| 760 |
| 761 private: |
| 762 HOperandContainer<V> inputs_; |
| 763 }; |
| 764 |
| 765 |
| 766 template<int V> |
| 767 class HTemplateControlInstruction : public HControlInstruction { |
| 768 public: |
| 769 HTemplateControlInstruction<V>(HBasicBlock* first, HBasicBlock* second) |
| 770 : HControlInstruction(first, second) { } |
| 771 int OperandCount() { return V; } |
| 772 HValue* OperandAt(int i) { return inputs_[i]; } |
| 773 |
| 774 protected: |
| 775 void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
| 776 |
| 777 private: |
| 778 HOperandContainer<V> inputs_; |
| 779 }; |
| 780 |
| 781 |
| 782 class HBlockEntry: public HTemplateInstruction<0> { |
| 783 public: |
| 784 virtual Representation RequiredInputRepresentation(int index) const { |
| 785 return Representation::None(); |
| 786 } |
| 787 |
| 788 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry") |
| 789 }; |
| 790 |
| 791 |
| 792 class HDeoptimize: public HTemplateControlInstruction<0> { |
| 793 public: |
| 794 HDeoptimize() : HTemplateControlInstruction<0>(NULL, NULL) { } |
| 752 | 795 |
| 753 virtual Representation RequiredInputRepresentation(int index) const { | 796 virtual Representation RequiredInputRepresentation(int index) const { |
| 754 return Representation::None(); | 797 return Representation::None(); |
| 755 } | 798 } |
| 756 | 799 |
| 757 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") | 800 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") |
| 758 }; | 801 }; |
| 759 | 802 |
| 760 | 803 |
| 761 class HGoto: public HControlInstruction { | 804 class HGoto: public HTemplateControlInstruction<0> { |
| 762 public: | 805 public: |
| 763 explicit HGoto(HBasicBlock* target) | 806 explicit HGoto(HBasicBlock* target) |
| 764 : HControlInstruction(target, NULL), include_stack_check_(false) { | 807 : HTemplateControlInstruction<0>(target, NULL), |
| 765 } | 808 include_stack_check_(false) { } |
| 766 | 809 |
| 767 void set_include_stack_check(bool include_stack_check) { | 810 void set_include_stack_check(bool include_stack_check) { |
| 768 include_stack_check_ = include_stack_check; | 811 include_stack_check_ = include_stack_check; |
| 769 } | 812 } |
| 770 bool include_stack_check() const { return include_stack_check_; } | 813 bool include_stack_check() const { return include_stack_check_; } |
| 771 | 814 |
| 772 virtual Representation RequiredInputRepresentation(int index) const { | 815 virtual Representation RequiredInputRepresentation(int index) const { |
| 773 return Representation::None(); | 816 return Representation::None(); |
| 774 } | 817 } |
| 775 | 818 |
| 776 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") | 819 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") |
| 777 | 820 |
| 778 private: | 821 private: |
| 779 bool include_stack_check_; | 822 bool include_stack_check_; |
| 780 }; | 823 }; |
| 781 | 824 |
| 782 | 825 |
| 783 class HUnaryControlInstruction: public HControlInstruction { | 826 class HUnaryControlInstruction: public HTemplateControlInstruction<1> { |
| 784 public: | 827 public: |
| 785 explicit HUnaryControlInstruction(HValue* value, | 828 explicit HUnaryControlInstruction(HValue* value, |
| 786 HBasicBlock* true_target, | 829 HBasicBlock* true_target, |
| 787 HBasicBlock* false_target) | 830 HBasicBlock* false_target) |
| 788 : HControlInstruction(true_target, false_target) { | 831 : HTemplateControlInstruction<1>(true_target, false_target) { |
| 789 SetOperandAt(0, value); | 832 SetOperandAt(0, value); |
| 790 } | 833 } |
| 791 | 834 |
| 792 virtual void PrintDataTo(StringStream* stream); | 835 virtual void PrintDataTo(StringStream* stream); |
| 793 | 836 |
| 794 HValue* value() { return OperandAt(0); } | 837 HValue* value() { return OperandAt(0); } |
| 795 virtual int OperandCount() { return 1; } | |
| 796 virtual HValue* OperandAt(int index) { return operands_[index]; } | |
| 797 | 838 |
| 798 DECLARE_INSTRUCTION(UnaryControlInstruction) | 839 DECLARE_INSTRUCTION(UnaryControlInstruction) |
| 799 | |
| 800 protected: | |
| 801 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 802 operands_[index] = value; | |
| 803 } | |
| 804 | |
| 805 private: | |
| 806 HOperandVector<1> operands_; | |
| 807 }; | 840 }; |
| 808 | 841 |
| 809 | 842 |
| 810 class HTest: public HUnaryControlInstruction { | 843 class HTest: public HUnaryControlInstruction { |
| 811 public: | 844 public: |
| 812 HTest(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target) | 845 HTest(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target) |
| 813 : HUnaryControlInstruction(value, true_target, false_target) { | 846 : HUnaryControlInstruction(value, true_target, false_target) { |
| 814 ASSERT(true_target != NULL && false_target != NULL); | 847 ASSERT(true_target != NULL && false_target != NULL); |
| 815 } | 848 } |
| 816 | 849 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 } | 890 } |
| 858 | 891 |
| 859 virtual Representation RequiredInputRepresentation(int index) const { | 892 virtual Representation RequiredInputRepresentation(int index) const { |
| 860 return Representation::Tagged(); | 893 return Representation::Tagged(); |
| 861 } | 894 } |
| 862 | 895 |
| 863 DECLARE_CONCRETE_INSTRUCTION(Return, "return") | 896 DECLARE_CONCRETE_INSTRUCTION(Return, "return") |
| 864 }; | 897 }; |
| 865 | 898 |
| 866 | 899 |
| 867 class HAbnormalExit: public HControlInstruction { | 900 class HAbnormalExit: public HTemplateControlInstruction<0> { |
| 868 public: | 901 public: |
| 869 HAbnormalExit() : HControlInstruction(NULL, NULL) { } | 902 HAbnormalExit() : HTemplateControlInstruction<0>(NULL, NULL) { } |
| 870 | 903 |
| 871 virtual Representation RequiredInputRepresentation(int index) const { | 904 virtual Representation RequiredInputRepresentation(int index) const { |
| 872 return Representation::None(); | 905 return Representation::None(); |
| 873 } | 906 } |
| 874 | 907 |
| 875 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit, "abnormal_exit") | 908 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit, "abnormal_exit") |
| 876 }; | 909 }; |
| 877 | 910 |
| 878 | 911 |
| 879 class HUnaryOperation: public HInstruction { | 912 class HUnaryOperation: public HTemplateInstruction<1> { |
| 880 public: | 913 public: |
| 881 explicit HUnaryOperation(HValue* value) { | 914 explicit HUnaryOperation(HValue* value) { |
| 882 SetOperandAt(0, value); | 915 SetOperandAt(0, value); |
| 883 } | 916 } |
| 884 | 917 |
| 885 HValue* value() { return OperandAt(0); } | 918 HValue* value() { return OperandAt(0); } |
| 886 virtual void PrintDataTo(StringStream* stream); | 919 virtual void PrintDataTo(StringStream* stream); |
| 887 virtual int OperandCount() { return 1; } | |
| 888 virtual HValue* OperandAt(int index) { return operands_[index]; } | |
| 889 | 920 |
| 890 DECLARE_INSTRUCTION(UnaryOperation) | 921 DECLARE_INSTRUCTION(UnaryOperation) |
| 891 | |
| 892 protected: | |
| 893 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 894 operands_[index] = value; | |
| 895 } | |
| 896 | |
| 897 private: | |
| 898 HOperandVector<1> operands_; | |
| 899 }; | 922 }; |
| 900 | 923 |
| 901 | 924 |
| 902 class HThrow: public HUnaryOperation { | 925 class HThrow: public HUnaryOperation { |
| 903 public: | 926 public: |
| 904 explicit HThrow(HValue* value) : HUnaryOperation(value) { | 927 explicit HThrow(HValue* value) : HUnaryOperation(value) { |
| 905 SetAllSideEffects(); | 928 SetAllSideEffects(); |
| 906 } | 929 } |
| 907 | 930 |
| 908 virtual Representation RequiredInputRepresentation(int index) const { | 931 virtual Representation RequiredInputRepresentation(int index) const { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 SetOperandAt(values_.length() - 1, value); | 1052 SetOperandAt(values_.length() - 1, value); |
| 1030 } | 1053 } |
| 1031 int ast_id_; | 1054 int ast_id_; |
| 1032 int pop_count_; | 1055 int pop_count_; |
| 1033 int environment_length_; | 1056 int environment_length_; |
| 1034 ZoneList<HValue*> values_; | 1057 ZoneList<HValue*> values_; |
| 1035 ZoneList<int> assigned_indexes_; | 1058 ZoneList<int> assigned_indexes_; |
| 1036 }; | 1059 }; |
| 1037 | 1060 |
| 1038 | 1061 |
| 1039 class HStackCheck: public HInstruction { | 1062 class HStackCheck: public HTemplateInstruction<0> { |
| 1040 public: | 1063 public: |
| 1041 HStackCheck() { } | 1064 HStackCheck() { } |
| 1042 | 1065 |
| 1043 virtual Representation RequiredInputRepresentation(int index) const { | 1066 virtual Representation RequiredInputRepresentation(int index) const { |
| 1044 return Representation::None(); | 1067 return Representation::None(); |
| 1045 } | 1068 } |
| 1046 | 1069 |
| 1047 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack_check") | 1070 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack_check") |
| 1048 }; | 1071 }; |
| 1049 | 1072 |
| 1050 | 1073 |
| 1051 class HEnterInlined: public HInstruction { | 1074 class HEnterInlined: public HTemplateInstruction<0> { |
| 1052 public: | 1075 public: |
| 1053 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function) | 1076 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function) |
| 1054 : closure_(closure), function_(function) { | 1077 : closure_(closure), function_(function) { |
| 1055 } | 1078 } |
| 1056 | 1079 |
| 1057 virtual void PrintDataTo(StringStream* stream); | 1080 virtual void PrintDataTo(StringStream* stream); |
| 1058 | 1081 |
| 1059 Handle<JSFunction> closure() const { return closure_; } | 1082 Handle<JSFunction> closure() const { return closure_; } |
| 1060 FunctionLiteral* function() const { return function_; } | 1083 FunctionLiteral* function() const { return function_; } |
| 1061 | 1084 |
| 1062 virtual Representation RequiredInputRepresentation(int index) const { | 1085 virtual Representation RequiredInputRepresentation(int index) const { |
| 1063 return Representation::None(); | 1086 return Representation::None(); |
| 1064 } | 1087 } |
| 1065 | 1088 |
| 1066 DECLARE_CONCRETE_INSTRUCTION(EnterInlined, "enter_inlined") | 1089 DECLARE_CONCRETE_INSTRUCTION(EnterInlined, "enter_inlined") |
| 1067 | 1090 |
| 1068 private: | 1091 private: |
| 1069 Handle<JSFunction> closure_; | 1092 Handle<JSFunction> closure_; |
| 1070 FunctionLiteral* function_; | 1093 FunctionLiteral* function_; |
| 1071 }; | 1094 }; |
| 1072 | 1095 |
| 1073 | 1096 |
| 1074 class HLeaveInlined: public HInstruction { | 1097 class HLeaveInlined: public HTemplateInstruction<0> { |
| 1075 public: | 1098 public: |
| 1076 HLeaveInlined() {} | 1099 HLeaveInlined() {} |
| 1077 | 1100 |
| 1078 virtual Representation RequiredInputRepresentation(int index) const { | 1101 virtual Representation RequiredInputRepresentation(int index) const { |
| 1079 return Representation::None(); | 1102 return Representation::None(); |
| 1080 } | 1103 } |
| 1081 | 1104 |
| 1082 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined, "leave_inlined") | 1105 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined, "leave_inlined") |
| 1083 }; | 1106 }; |
| 1084 | 1107 |
| 1085 | 1108 |
| 1086 class HPushArgument: public HUnaryOperation { | 1109 class HPushArgument: public HUnaryOperation { |
| 1087 public: | 1110 public: |
| 1088 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { | 1111 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { |
| 1089 set_representation(Representation::Tagged()); | 1112 set_representation(Representation::Tagged()); |
| 1090 } | 1113 } |
| 1091 | 1114 |
| 1092 virtual Representation RequiredInputRepresentation(int index) const { | 1115 virtual Representation RequiredInputRepresentation(int index) const { |
| 1093 return Representation::Tagged(); | 1116 return Representation::Tagged(); |
| 1094 } | 1117 } |
| 1095 | 1118 |
| 1096 HValue* argument() { return OperandAt(0); } | 1119 HValue* argument() { return OperandAt(0); } |
| 1097 | 1120 |
| 1098 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument") | 1121 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument") |
| 1099 }; | 1122 }; |
| 1100 | 1123 |
| 1101 | 1124 |
| 1102 class HContext: public HInstruction { | 1125 class HContext: public HTemplateInstruction<0> { |
| 1103 public: | 1126 public: |
| 1104 HContext() { | 1127 HContext() { |
| 1105 set_representation(Representation::Tagged()); | 1128 set_representation(Representation::Tagged()); |
| 1106 SetFlag(kUseGVN); | 1129 SetFlag(kUseGVN); |
| 1107 } | 1130 } |
| 1108 | 1131 |
| 1109 virtual Representation RequiredInputRepresentation(int index) const { | 1132 virtual Representation RequiredInputRepresentation(int index) const { |
| 1110 return Representation::None(); | 1133 return Representation::None(); |
| 1111 } | 1134 } |
| 1112 | 1135 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 | 1188 |
| 1166 virtual Representation RequiredInputRepresentation(int index) const { | 1189 virtual Representation RequiredInputRepresentation(int index) const { |
| 1167 return Representation::Tagged(); | 1190 return Representation::Tagged(); |
| 1168 } | 1191 } |
| 1169 | 1192 |
| 1170 protected: | 1193 protected: |
| 1171 virtual bool DataEquals(HValue* other) { return true; } | 1194 virtual bool DataEquals(HValue* other) { return true; } |
| 1172 }; | 1195 }; |
| 1173 | 1196 |
| 1174 | 1197 |
| 1175 class HCall: public HInstruction { | 1198 template <int V> |
| 1199 class HCall: public HTemplateInstruction<V> { |
| 1176 public: | 1200 public: |
| 1177 // The argument count includes the receiver. | 1201 // The argument count includes the receiver. |
| 1178 explicit HCall(int argument_count) : argument_count_(argument_count) { | 1202 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { |
| 1179 set_representation(Representation::Tagged()); | 1203 this->set_representation(Representation::Tagged()); |
| 1180 SetAllSideEffects(); | 1204 this->SetAllSideEffects(); |
| 1181 } | 1205 } |
| 1182 | 1206 |
| 1183 virtual HType CalculateInferredType() { return HType::Tagged(); } | 1207 virtual HType CalculateInferredType() { return HType::Tagged(); } |
| 1184 | 1208 |
| 1185 virtual int argument_count() const { return argument_count_; } | 1209 virtual int argument_count() const { return argument_count_; } |
| 1186 | 1210 |
| 1187 virtual void PrintDataTo(StringStream* stream); | 1211 virtual bool IsCall() { return true; } |
| 1188 | |
| 1189 DECLARE_INSTRUCTION(Call) | |
| 1190 | 1212 |
| 1191 private: | 1213 private: |
| 1192 int argument_count_; | 1214 int argument_count_; |
| 1193 }; | 1215 }; |
| 1194 | 1216 |
| 1195 | 1217 |
| 1196 class HUnaryCall: public HCall { | 1218 class HUnaryCall: public HCall<1> { |
| 1197 public: | 1219 public: |
| 1198 HUnaryCall(HValue* value, int argument_count) | 1220 HUnaryCall(HValue* value, int argument_count) |
| 1199 : HCall(argument_count), value_(NULL) { | 1221 : HCall<1>(argument_count) { |
| 1200 SetOperandAt(0, value); | 1222 SetOperandAt(0, value); |
| 1201 } | 1223 } |
| 1202 | 1224 |
| 1225 virtual Representation RequiredInputRepresentation(int index) const { |
| 1226 return Representation::Tagged(); |
| 1227 } |
| 1228 |
| 1203 virtual void PrintDataTo(StringStream* stream); | 1229 virtual void PrintDataTo(StringStream* stream); |
| 1204 | 1230 |
| 1205 HValue* value() { return value_; } | 1231 HValue* value() { return OperandAt(0); } |
| 1206 | |
| 1207 virtual int OperandCount() { return 1; } | |
| 1208 virtual HValue* OperandAt(int index) { | |
| 1209 ASSERT(index == 0); | |
| 1210 return value_; | |
| 1211 } | |
| 1212 | 1232 |
| 1213 DECLARE_INSTRUCTION(UnaryCall) | 1233 DECLARE_INSTRUCTION(UnaryCall) |
| 1214 | |
| 1215 protected: | |
| 1216 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 1217 ASSERT(index == 0); | |
| 1218 value_ = value; | |
| 1219 } | |
| 1220 | |
| 1221 private: | |
| 1222 HValue* value_; | |
| 1223 }; | 1234 }; |
| 1224 | 1235 |
| 1225 | 1236 |
| 1226 class HBinaryCall: public HCall { | 1237 class HBinaryCall: public HCall<2> { |
| 1227 public: | 1238 public: |
| 1228 HBinaryCall(HValue* first, HValue* second, int argument_count) | 1239 HBinaryCall(HValue* first, HValue* second, int argument_count) |
| 1229 : HCall(argument_count) { | 1240 : HCall<2>(argument_count) { |
| 1230 SetOperandAt(0, first); | 1241 SetOperandAt(0, first); |
| 1231 SetOperandAt(1, second); | 1242 SetOperandAt(1, second); |
| 1232 } | 1243 } |
| 1233 | 1244 |
| 1234 virtual void PrintDataTo(StringStream* stream); | 1245 virtual void PrintDataTo(StringStream* stream); |
| 1235 | 1246 |
| 1236 HValue* first() const { return operands_[0]; } | 1247 virtual Representation RequiredInputRepresentation(int index) const { |
| 1237 HValue* second() const { return operands_[1]; } | 1248 return Representation::Tagged(); |
| 1249 } |
| 1238 | 1250 |
| 1239 virtual int OperandCount() { return 2; } | 1251 HValue* first() { return OperandAt(0); } |
| 1240 virtual HValue* OperandAt(int index) { return operands_[index]; } | 1252 HValue* second() { return OperandAt(1); } |
| 1241 | 1253 |
| 1242 DECLARE_INSTRUCTION(BinaryCall) | 1254 DECLARE_INSTRUCTION(BinaryCall) |
| 1243 | |
| 1244 protected: | |
| 1245 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 1246 operands_[index] = value; | |
| 1247 } | |
| 1248 | |
| 1249 private: | |
| 1250 HOperandVector<2> operands_; | |
| 1251 }; | 1255 }; |
| 1252 | 1256 |
| 1253 | 1257 |
| 1254 class HCallConstantFunction: public HCall { | 1258 class HCallConstantFunction: public HCall<0> { |
| 1255 public: | 1259 public: |
| 1256 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | 1260 HCallConstantFunction(Handle<JSFunction> function, int argument_count) |
| 1257 : HCall(argument_count), function_(function) { } | 1261 : HCall<0>(argument_count), function_(function) { } |
| 1258 | 1262 |
| 1259 Handle<JSFunction> function() const { return function_; } | 1263 Handle<JSFunction> function() const { return function_; } |
| 1260 | 1264 |
| 1261 bool IsApplyFunction() const { | 1265 bool IsApplyFunction() const { |
| 1262 return function_->code() == Builtins::builtin(Builtins::FunctionApply); | 1266 return function_->code() == Builtins::builtin(Builtins::FunctionApply); |
| 1263 } | 1267 } |
| 1264 | 1268 |
| 1265 virtual void PrintDataTo(StringStream* stream); | 1269 virtual void PrintDataTo(StringStream* stream); |
| 1266 | 1270 |
| 1267 virtual Representation RequiredInputRepresentation(int index) const { | 1271 virtual Representation RequiredInputRepresentation(int index) const { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1278 class HCallKeyed: public HBinaryCall { | 1282 class HCallKeyed: public HBinaryCall { |
| 1279 public: | 1283 public: |
| 1280 HCallKeyed(HValue* context, HValue* key, int argument_count) | 1284 HCallKeyed(HValue* context, HValue* key, int argument_count) |
| 1281 : HBinaryCall(context, key, argument_count) { | 1285 : HBinaryCall(context, key, argument_count) { |
| 1282 } | 1286 } |
| 1283 | 1287 |
| 1284 virtual Representation RequiredInputRepresentation(int index) const { | 1288 virtual Representation RequiredInputRepresentation(int index) const { |
| 1285 return Representation::Tagged(); | 1289 return Representation::Tagged(); |
| 1286 } | 1290 } |
| 1287 | 1291 |
| 1288 HValue* context() const { return first(); } | 1292 HValue* context() { return first(); } |
| 1289 HValue* key() const { return second(); } | 1293 HValue* key() { return second(); } |
| 1290 | 1294 |
| 1291 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call_keyed") | 1295 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call_keyed") |
| 1292 }; | 1296 }; |
| 1293 | 1297 |
| 1294 | 1298 |
| 1295 class HCallNamed: public HUnaryCall { | 1299 class HCallNamed: public HUnaryCall { |
| 1296 public: | 1300 public: |
| 1297 HCallNamed(HValue* context, Handle<String> name, int argument_count) | 1301 HCallNamed(HValue* context, Handle<String> name, int argument_count) |
| 1298 : HUnaryCall(context, argument_count), name_(name) { | 1302 : HUnaryCall(context, argument_count), name_(name) { |
| 1299 } | 1303 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 return Representation::Tagged(); | 1349 return Representation::Tagged(); |
| 1346 } | 1350 } |
| 1347 | 1351 |
| 1348 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global") | 1352 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global") |
| 1349 | 1353 |
| 1350 private: | 1354 private: |
| 1351 Handle<String> name_; | 1355 Handle<String> name_; |
| 1352 }; | 1356 }; |
| 1353 | 1357 |
| 1354 | 1358 |
| 1355 class HCallKnownGlobal: public HCall { | 1359 class HCallKnownGlobal: public HCall<0> { |
| 1356 public: | 1360 public: |
| 1357 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) | 1361 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) |
| 1358 : HCall(argument_count), target_(target) { } | 1362 : HCall<0>(argument_count), target_(target) { } |
| 1359 | 1363 |
| 1360 virtual void PrintDataTo(StringStream* stream); | 1364 virtual void PrintDataTo(StringStream* stream); |
| 1361 | 1365 |
| 1362 Handle<JSFunction> target() const { return target_; } | 1366 Handle<JSFunction> target() const { return target_; } |
| 1363 | 1367 |
| 1364 virtual Representation RequiredInputRepresentation(int index) const { | 1368 virtual Representation RequiredInputRepresentation(int index) const { |
| 1365 return Representation::None(); | 1369 return Representation::None(); |
| 1366 } | 1370 } |
| 1367 | 1371 |
| 1368 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global") | 1372 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global") |
| 1369 | 1373 |
| 1370 private: | 1374 private: |
| 1371 Handle<JSFunction> target_; | 1375 Handle<JSFunction> target_; |
| 1372 }; | 1376 }; |
| 1373 | 1377 |
| 1374 | 1378 |
| 1375 class HCallNew: public HBinaryCall { | 1379 class HCallNew: public HBinaryCall { |
| 1376 public: | 1380 public: |
| 1377 HCallNew(HValue* context, HValue* constructor, int argument_count) | 1381 HCallNew(HValue* context, HValue* constructor, int argument_count) |
| 1378 : HBinaryCall(context, constructor, argument_count) { | 1382 : HBinaryCall(context, constructor, argument_count) { |
| 1379 } | 1383 } |
| 1380 | 1384 |
| 1381 virtual Representation RequiredInputRepresentation(int index) const { | 1385 virtual Representation RequiredInputRepresentation(int index) const { |
| 1382 return Representation::Tagged(); | 1386 return Representation::Tagged(); |
| 1383 } | 1387 } |
| 1384 | 1388 |
| 1385 HValue* context() const { return first(); } | 1389 HValue* context() { return first(); } |
| 1386 HValue* constructor() const { return second(); } | 1390 HValue* constructor() { return second(); } |
| 1387 | 1391 |
| 1388 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new") | 1392 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new") |
| 1389 }; | 1393 }; |
| 1390 | 1394 |
| 1391 | 1395 |
| 1392 class HCallRuntime: public HCall { | 1396 class HCallRuntime: public HCall<0> { |
| 1393 public: | 1397 public: |
| 1394 HCallRuntime(Handle<String> name, | 1398 HCallRuntime(Handle<String> name, |
| 1395 Runtime::Function* c_function, | 1399 Runtime::Function* c_function, |
| 1396 int argument_count) | 1400 int argument_count) |
| 1397 : HCall(argument_count), c_function_(c_function), name_(name) { } | 1401 : HCall<0>(argument_count), c_function_(c_function), name_(name) { } |
| 1398 virtual void PrintDataTo(StringStream* stream); | 1402 virtual void PrintDataTo(StringStream* stream); |
| 1399 | 1403 |
| 1400 Runtime::Function* function() const { return c_function_; } | 1404 Runtime::Function* function() const { return c_function_; } |
| 1401 Handle<String> name() const { return name_; } | 1405 Handle<String> name() const { return name_; } |
| 1402 | 1406 |
| 1403 virtual Representation RequiredInputRepresentation(int index) const { | 1407 virtual Representation RequiredInputRepresentation(int index) const { |
| 1404 return Representation::None(); | 1408 return Representation::None(); |
| 1405 } | 1409 } |
| 1406 | 1410 |
| 1407 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") | 1411 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 virtual void Verify(); | 1758 virtual void Verify(); |
| 1755 #endif | 1759 #endif |
| 1756 | 1760 |
| 1757 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") | 1761 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") |
| 1758 | 1762 |
| 1759 protected: | 1763 protected: |
| 1760 virtual bool DataEquals(HValue* other) { return true; } | 1764 virtual bool DataEquals(HValue* other) { return true; } |
| 1761 }; | 1765 }; |
| 1762 | 1766 |
| 1763 | 1767 |
| 1764 class HCheckPrototypeMaps: public HInstruction { | 1768 class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
| 1765 public: | 1769 public: |
| 1766 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) | 1770 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) |
| 1767 : prototype_(prototype), holder_(holder) { | 1771 : prototype_(prototype), holder_(holder) { |
| 1768 SetFlag(kUseGVN); | 1772 SetFlag(kUseGVN); |
| 1769 SetFlag(kDependsOnMaps); | 1773 SetFlag(kDependsOnMaps); |
| 1770 } | 1774 } |
| 1771 | 1775 |
| 1772 virtual bool IsCheckInstruction() const { return true; } | 1776 virtual bool IsCheckInstruction() const { return true; } |
| 1773 | 1777 |
| 1774 #ifdef DEBUG | 1778 #ifdef DEBUG |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 private: | 1920 private: |
| 1917 ZoneList<HValue*> inputs_; | 1921 ZoneList<HValue*> inputs_; |
| 1918 int merged_index_; | 1922 int merged_index_; |
| 1919 | 1923 |
| 1920 int non_phi_uses_[Representation::kNumRepresentations]; | 1924 int non_phi_uses_[Representation::kNumRepresentations]; |
| 1921 int indirect_uses_[Representation::kNumRepresentations]; | 1925 int indirect_uses_[Representation::kNumRepresentations]; |
| 1922 int phi_id_; | 1926 int phi_id_; |
| 1923 }; | 1927 }; |
| 1924 | 1928 |
| 1925 | 1929 |
| 1926 class HArgumentsObject: public HInstruction { | 1930 class HArgumentsObject: public HTemplateInstruction<0> { |
| 1927 public: | 1931 public: |
| 1928 HArgumentsObject() { | 1932 HArgumentsObject() { |
| 1929 set_representation(Representation::Tagged()); | 1933 set_representation(Representation::Tagged()); |
| 1930 SetFlag(kIsArguments); | 1934 SetFlag(kIsArguments); |
| 1931 } | 1935 } |
| 1932 | 1936 |
| 1933 virtual Representation RequiredInputRepresentation(int index) const { | 1937 virtual Representation RequiredInputRepresentation(int index) const { |
| 1934 return Representation::None(); | 1938 return Representation::None(); |
| 1935 } | 1939 } |
| 1936 | 1940 |
| 1937 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") | 1941 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") |
| 1938 }; | 1942 }; |
| 1939 | 1943 |
| 1940 | 1944 |
| 1941 class HConstant: public HInstruction { | 1945 class HConstant: public HTemplateInstruction<0> { |
| 1942 public: | 1946 public: |
| 1943 HConstant(Handle<Object> handle, Representation r); | 1947 HConstant(Handle<Object> handle, Representation r); |
| 1944 | 1948 |
| 1945 Handle<Object> handle() const { return handle_; } | 1949 Handle<Object> handle() const { return handle_; } |
| 1946 | 1950 |
| 1947 bool InOldSpace() const { return !Heap::InNewSpace(*handle_); } | 1951 bool InOldSpace() const { return !Heap::InNewSpace(*handle_); } |
| 1948 | 1952 |
| 1949 virtual Representation RequiredInputRepresentation(int index) const { | 1953 virtual Representation RequiredInputRepresentation(int index) const { |
| 1950 return Representation::None(); | 1954 return Representation::None(); |
| 1951 } | 1955 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 // The following two values represent the int32 and the double value of the | 1998 // The following two values represent the int32 and the double value of the |
| 1995 // given constant if there is a lossless conversion between the constant | 1999 // given constant if there is a lossless conversion between the constant |
| 1996 // and the specific representation. | 2000 // and the specific representation. |
| 1997 bool has_int32_value_; | 2001 bool has_int32_value_; |
| 1998 int32_t int32_value_; | 2002 int32_t int32_value_; |
| 1999 bool has_double_value_; | 2003 bool has_double_value_; |
| 2000 double double_value_; | 2004 double double_value_; |
| 2001 }; | 2005 }; |
| 2002 | 2006 |
| 2003 | 2007 |
| 2004 class HBinaryOperation: public HInstruction { | 2008 class HBinaryOperation: public HTemplateInstruction<2> { |
| 2005 public: | 2009 public: |
| 2006 HBinaryOperation(HValue* left, HValue* right) { | 2010 HBinaryOperation(HValue* left, HValue* right) { |
| 2007 ASSERT(left != NULL && right != NULL); | 2011 ASSERT(left != NULL && right != NULL); |
| 2008 SetOperandAt(0, left); | 2012 SetOperandAt(0, left); |
| 2009 SetOperandAt(1, right); | 2013 SetOperandAt(1, right); |
| 2010 } | 2014 } |
| 2011 | 2015 |
| 2012 HValue* left() { return OperandAt(0); } | 2016 HValue* left() { return OperandAt(0); } |
| 2013 HValue* right() { return OperandAt(1); } | 2017 HValue* right() { return OperandAt(1); } |
| 2014 | 2018 |
| 2015 // TODO(kasperl): Move these helpers to the IA-32 Lithium | 2019 // TODO(kasperl): Move these helpers to the IA-32 Lithium |
| 2016 // instruction sequence builder. | 2020 // instruction sequence builder. |
| 2017 HValue* LeastConstantOperand() { | 2021 HValue* LeastConstantOperand() { |
| 2018 if (IsCommutative() && left()->IsConstant()) return right(); | 2022 if (IsCommutative() && left()->IsConstant()) return right(); |
| 2019 return left(); | 2023 return left(); |
| 2020 } | 2024 } |
| 2021 HValue* MostConstantOperand() { | 2025 HValue* MostConstantOperand() { |
| 2022 if (IsCommutative() && left()->IsConstant()) return left(); | 2026 if (IsCommutative() && left()->IsConstant()) return left(); |
| 2023 return right(); | 2027 return right(); |
| 2024 } | 2028 } |
| 2025 | 2029 |
| 2026 virtual bool IsCommutative() const { return false; } | 2030 virtual bool IsCommutative() const { return false; } |
| 2027 | 2031 |
| 2028 virtual void PrintDataTo(StringStream* stream); | 2032 virtual void PrintDataTo(StringStream* stream); |
| 2029 virtual int OperandCount() { return operands_.length(); } | |
| 2030 virtual HValue* OperandAt(int index) { return operands_[index]; } | |
| 2031 | 2033 |
| 2032 DECLARE_INSTRUCTION(BinaryOperation) | 2034 DECLARE_INSTRUCTION(BinaryOperation) |
| 2033 | |
| 2034 protected: | |
| 2035 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 2036 operands_[index] = value; | |
| 2037 } | |
| 2038 | |
| 2039 HOperandVector<2> operands_; | |
| 2040 }; | 2035 }; |
| 2041 | 2036 |
| 2042 | 2037 |
| 2043 class HApplyArguments: public HInstruction { | 2038 class HApplyArguments: public HTemplateInstruction<4> { |
| 2044 public: | 2039 public: |
| 2045 HApplyArguments(HValue* function, | 2040 HApplyArguments(HValue* function, |
| 2046 HValue* receiver, | 2041 HValue* receiver, |
| 2047 HValue* length, | 2042 HValue* length, |
| 2048 HValue* elements) { | 2043 HValue* elements) { |
| 2049 set_representation(Representation::Tagged()); | 2044 set_representation(Representation::Tagged()); |
| 2050 SetOperandAt(0, function); | 2045 SetOperandAt(0, function); |
| 2051 SetOperandAt(1, receiver); | 2046 SetOperandAt(1, receiver); |
| 2052 SetOperandAt(2, length); | 2047 SetOperandAt(2, length); |
| 2053 SetOperandAt(3, elements); | 2048 SetOperandAt(3, elements); |
| 2054 SetAllSideEffects(); | 2049 SetAllSideEffects(); |
| 2055 } | 2050 } |
| 2056 | 2051 |
| 2057 virtual Representation RequiredInputRepresentation(int index) const { | 2052 virtual Representation RequiredInputRepresentation(int index) const { |
| 2058 // The length is untagged, all other inputs are tagged. | 2053 // The length is untagged, all other inputs are tagged. |
| 2059 return (index == 2) | 2054 return (index == 2) |
| 2060 ? Representation::Integer32() | 2055 ? Representation::Integer32() |
| 2061 : Representation::Tagged(); | 2056 : Representation::Tagged(); |
| 2062 } | 2057 } |
| 2063 | 2058 |
| 2064 HValue* function() { return OperandAt(0); } | 2059 HValue* function() { return OperandAt(0); } |
| 2065 HValue* receiver() { return OperandAt(1); } | 2060 HValue* receiver() { return OperandAt(1); } |
| 2066 HValue* length() { return OperandAt(2); } | 2061 HValue* length() { return OperandAt(2); } |
| 2067 HValue* elements() { return OperandAt(3); } | 2062 HValue* elements() { return OperandAt(3); } |
| 2068 | 2063 |
| 2069 virtual int OperandCount() { return operands_.length(); } | |
| 2070 virtual HValue* OperandAt(int index) { return operands_[index]; } | |
| 2071 | |
| 2072 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply_arguments") | 2064 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply_arguments") |
| 2073 | |
| 2074 protected: | |
| 2075 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 2076 operands_[index] = value; | |
| 2077 } | |
| 2078 | |
| 2079 private: | |
| 2080 HOperandVector<4> operands_; | |
| 2081 }; | 2065 }; |
| 2082 | 2066 |
| 2083 | 2067 |
| 2084 class HArgumentsElements: public HInstruction { | 2068 class HArgumentsElements: public HTemplateInstruction<0> { |
| 2085 public: | 2069 public: |
| 2086 HArgumentsElements() { | 2070 HArgumentsElements() { |
| 2087 // The value produced by this instruction is a pointer into the stack | 2071 // The value produced by this instruction is a pointer into the stack |
| 2088 // that looks as if it was a smi because of alignment. | 2072 // that looks as if it was a smi because of alignment. |
| 2089 set_representation(Representation::Tagged()); | 2073 set_representation(Representation::Tagged()); |
| 2090 SetFlag(kUseGVN); | 2074 SetFlag(kUseGVN); |
| 2091 } | 2075 } |
| 2092 | 2076 |
| 2093 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements") | 2077 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements") |
| 2094 | 2078 |
| 2095 virtual Representation RequiredInputRepresentation(int index) const { | 2079 virtual Representation RequiredInputRepresentation(int index) const { |
| 2096 return Representation::None(); | 2080 return Representation::None(); |
| 2097 } | 2081 } |
| 2098 | 2082 |
| 2099 protected: | 2083 protected: |
| 2100 virtual bool DataEquals(HValue* other) { return true; } | 2084 virtual bool DataEquals(HValue* other) { return true; } |
| 2101 }; | 2085 }; |
| 2102 | 2086 |
| 2103 | 2087 |
| 2104 class HArgumentsLength: public HUnaryOperation { | 2088 class HArgumentsLength: public HUnaryOperation { |
| 2105 public: | 2089 public: |
| 2106 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | 2090 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { |
| 2107 set_representation(Representation::Integer32()); | 2091 set_representation(Representation::Integer32()); |
| 2108 SetFlag(kUseGVN); | 2092 SetFlag(kUseGVN); |
| 2109 } | 2093 } |
| 2110 | 2094 |
| 2111 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length") | |
| 2112 | |
| 2113 virtual Representation RequiredInputRepresentation(int index) const { | 2095 virtual Representation RequiredInputRepresentation(int index) const { |
| 2114 return Representation::Tagged(); | 2096 return Representation::Tagged(); |
| 2115 } | 2097 } |
| 2116 | 2098 |
| 2099 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length") |
| 2100 |
| 2117 protected: | 2101 protected: |
| 2118 virtual bool DataEquals(HValue* other) { return true; } | 2102 virtual bool DataEquals(HValue* other) { return true; } |
| 2119 }; | 2103 }; |
| 2120 | 2104 |
| 2121 | 2105 |
| 2122 class HAccessArgumentsAt: public HInstruction { | 2106 class HAccessArgumentsAt: public HTemplateInstruction<3> { |
| 2123 public: | 2107 public: |
| 2124 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { | 2108 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
| 2125 set_representation(Representation::Tagged()); | 2109 set_representation(Representation::Tagged()); |
| 2126 SetFlag(kUseGVN); | 2110 SetFlag(kUseGVN); |
| 2127 SetOperandAt(0, arguments); | 2111 SetOperandAt(0, arguments); |
| 2128 SetOperandAt(1, length); | 2112 SetOperandAt(1, length); |
| 2129 SetOperandAt(2, index); | 2113 SetOperandAt(2, index); |
| 2130 } | 2114 } |
| 2131 | 2115 |
| 2132 virtual void PrintDataTo(StringStream* stream); | 2116 virtual void PrintDataTo(StringStream* stream); |
| 2133 | 2117 |
| 2134 virtual Representation RequiredInputRepresentation(int index) const { | 2118 virtual Representation RequiredInputRepresentation(int index) const { |
| 2135 // The arguments elements is considered tagged. | 2119 // The arguments elements is considered tagged. |
| 2136 return index == 0 | 2120 return index == 0 |
| 2137 ? Representation::Tagged() | 2121 ? Representation::Tagged() |
| 2138 : Representation::Integer32(); | 2122 : Representation::Integer32(); |
| 2139 } | 2123 } |
| 2140 | 2124 |
| 2141 HValue* arguments() { return operands_[0]; } | 2125 HValue* arguments() { return OperandAt(0); } |
| 2142 HValue* length() { return operands_[1]; } | 2126 HValue* length() { return OperandAt(1); } |
| 2143 HValue* index() { return operands_[2]; } | 2127 HValue* index() { return OperandAt(2); } |
| 2144 | |
| 2145 virtual int OperandCount() { return operands_.length(); } | |
| 2146 virtual HValue* OperandAt(int index) { return operands_[index]; } | |
| 2147 | 2128 |
| 2148 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at") | 2129 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at") |
| 2149 | 2130 |
| 2150 protected: | |
| 2151 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 2152 operands_[index] = value; | |
| 2153 } | |
| 2154 | |
| 2155 virtual bool DataEquals(HValue* other) { return true; } | 2131 virtual bool DataEquals(HValue* other) { return true; } |
| 2156 | |
| 2157 private: | |
| 2158 HOperandVector<3> operands_; | |
| 2159 }; | 2132 }; |
| 2160 | 2133 |
| 2161 | 2134 |
| 2162 class HBoundsCheck: public HBinaryOperation { | 2135 class HBoundsCheck: public HBinaryOperation { |
| 2163 public: | 2136 public: |
| 2164 HBoundsCheck(HValue* index, HValue* length) | 2137 HBoundsCheck(HValue* index, HValue* length) |
| 2165 : HBinaryOperation(index, length) { | 2138 : HBinaryOperation(index, length) { |
| 2166 SetFlag(kUseGVN); | 2139 SetFlag(kUseGVN); |
| 2167 } | 2140 } |
| 2168 | 2141 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2366 public: | 2339 public: |
| 2367 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } | 2340 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } |
| 2368 | 2341 |
| 2369 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") | 2342 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") |
| 2370 | 2343 |
| 2371 protected: | 2344 protected: |
| 2372 virtual bool DataEquals(HValue* other) { return true; } | 2345 virtual bool DataEquals(HValue* other) { return true; } |
| 2373 }; | 2346 }; |
| 2374 | 2347 |
| 2375 | 2348 |
| 2376 class HIsConstructCall: public HInstruction { | 2349 class HIsConstructCall: public HTemplateInstruction<0> { |
| 2377 public: | 2350 public: |
| 2378 HIsConstructCall() { | 2351 HIsConstructCall() { |
| 2379 set_representation(Representation::Tagged()); | 2352 set_representation(Representation::Tagged()); |
| 2380 SetFlag(kUseGVN); | 2353 SetFlag(kUseGVN); |
| 2381 } | 2354 } |
| 2382 | 2355 |
| 2383 virtual bool EmitAtUses() const { | 2356 virtual bool EmitAtUses() const { |
| 2384 return !HasSideEffects() && (uses()->length() <= 1); | 2357 return !HasSideEffects() && (uses()->length() <= 1); |
| 2385 } | 2358 } |
| 2386 | 2359 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 virtual bool DataEquals(HValue* other) { | 2454 virtual bool DataEquals(HValue* other) { |
| 2482 HTypeofIs* b = HTypeofIs::cast(other); | 2455 HTypeofIs* b = HTypeofIs::cast(other); |
| 2483 return type_literal_.is_identical_to(b->type_literal_); | 2456 return type_literal_.is_identical_to(b->type_literal_); |
| 2484 } | 2457 } |
| 2485 | 2458 |
| 2486 private: | 2459 private: |
| 2487 Handle<String> type_literal_; | 2460 Handle<String> type_literal_; |
| 2488 }; | 2461 }; |
| 2489 | 2462 |
| 2490 | 2463 |
| 2491 class HInstanceOf: public HInstruction { | 2464 class HInstanceOf: public HTemplateInstruction<3> { |
| 2492 public: | 2465 public: |
| 2493 HInstanceOf(HValue* context, HValue* left, HValue* right) { | 2466 HInstanceOf(HValue* context, HValue* left, HValue* right) { |
| 2494 SetOperandAt(0, context); | 2467 SetOperandAt(0, context); |
| 2495 SetOperandAt(1, left); | 2468 SetOperandAt(1, left); |
| 2496 SetOperandAt(2, right); | 2469 SetOperandAt(2, right); |
| 2497 set_representation(Representation::Tagged()); | 2470 set_representation(Representation::Tagged()); |
| 2498 SetAllSideEffects(); | 2471 SetAllSideEffects(); |
| 2499 } | 2472 } |
| 2500 | 2473 |
| 2501 HValue* context() { return operands_[0]; } | 2474 HValue* context() { return OperandAt(0); } |
| 2502 HValue* left() { return operands_[1]; } | 2475 HValue* left() { return OperandAt(1); } |
| 2503 HValue* right() { return operands_[2]; } | 2476 HValue* right() { return OperandAt(2); } |
| 2504 | 2477 |
| 2505 virtual bool EmitAtUses() const { | 2478 virtual bool EmitAtUses() const { |
| 2506 return !HasSideEffects() && (uses()->length() <= 1); | 2479 return !HasSideEffects() && (uses()->length() <= 1); |
| 2507 } | 2480 } |
| 2508 | 2481 |
| 2509 virtual Representation RequiredInputRepresentation(int index) const { | 2482 virtual Representation RequiredInputRepresentation(int index) const { |
| 2510 return Representation::Tagged(); | 2483 return Representation::Tagged(); |
| 2511 } | 2484 } |
| 2512 | 2485 |
| 2513 virtual void PrintDataTo(StringStream* stream); | 2486 virtual void PrintDataTo(StringStream* stream); |
| 2514 | 2487 |
| 2515 virtual int OperandCount() { return 3; } | |
| 2516 virtual HValue* OperandAt(int index) { return operands_[index]; } | |
| 2517 | |
| 2518 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") | 2488 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") |
| 2519 | |
| 2520 protected: | |
| 2521 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 2522 operands_[index] = value; | |
| 2523 } | |
| 2524 | |
| 2525 private: | |
| 2526 HOperandVector<3> operands_; | |
| 2527 }; | 2489 }; |
| 2528 | 2490 |
| 2529 | 2491 |
| 2530 class HInstanceOfKnownGlobal: public HUnaryOperation { | 2492 class HInstanceOfKnownGlobal: public HUnaryOperation { |
| 2531 public: | 2493 public: |
| 2532 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) | 2494 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) |
| 2533 : HUnaryOperation(left), function_(right) { | 2495 : HUnaryOperation(left), function_(right) { |
| 2534 set_representation(Representation::Tagged()); | 2496 set_representation(Representation::Tagged()); |
| 2535 SetAllSideEffects(); | 2497 SetAllSideEffects(); |
| 2536 } | 2498 } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2753 virtual Range* InferRange(); | 2715 virtual Range* InferRange(); |
| 2754 virtual HType CalculateInferredType(); | 2716 virtual HType CalculateInferredType(); |
| 2755 | 2717 |
| 2756 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar") | 2718 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar") |
| 2757 | 2719 |
| 2758 protected: | 2720 protected: |
| 2759 virtual bool DataEquals(HValue* other) { return true; } | 2721 virtual bool DataEquals(HValue* other) { return true; } |
| 2760 }; | 2722 }; |
| 2761 | 2723 |
| 2762 | 2724 |
| 2763 class HOsrEntry: public HInstruction { | 2725 class HOsrEntry: public HTemplateInstruction<0> { |
| 2764 public: | 2726 public: |
| 2765 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { | 2727 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { |
| 2766 SetFlag(kChangesOsrEntries); | 2728 SetFlag(kChangesOsrEntries); |
| 2767 } | 2729 } |
| 2768 | 2730 |
| 2769 int ast_id() const { return ast_id_; } | 2731 int ast_id() const { return ast_id_; } |
| 2770 | 2732 |
| 2771 virtual Representation RequiredInputRepresentation(int index) const { | 2733 virtual Representation RequiredInputRepresentation(int index) const { |
| 2772 return Representation::None(); | 2734 return Representation::None(); |
| 2773 } | 2735 } |
| 2774 | 2736 |
| 2775 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr_entry") | 2737 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr_entry") |
| 2776 | 2738 |
| 2777 private: | 2739 private: |
| 2778 int ast_id_; | 2740 int ast_id_; |
| 2779 }; | 2741 }; |
| 2780 | 2742 |
| 2781 | 2743 |
| 2782 class HParameter: public HInstruction { | 2744 class HParameter: public HTemplateInstruction<0> { |
| 2783 public: | 2745 public: |
| 2784 explicit HParameter(unsigned index) : index_(index) { | 2746 explicit HParameter(unsigned index) : index_(index) { |
| 2785 set_representation(Representation::Tagged()); | 2747 set_representation(Representation::Tagged()); |
| 2786 } | 2748 } |
| 2787 | 2749 |
| 2788 unsigned index() const { return index_; } | 2750 unsigned index() const { return index_; } |
| 2789 | 2751 |
| 2790 virtual void PrintDataTo(StringStream* stream); | 2752 virtual void PrintDataTo(StringStream* stream); |
| 2791 | 2753 |
| 2792 virtual Representation RequiredInputRepresentation(int index) const { | 2754 virtual Representation RequiredInputRepresentation(int index) const { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2826 } | 2788 } |
| 2827 | 2789 |
| 2828 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub") | 2790 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub") |
| 2829 | 2791 |
| 2830 private: | 2792 private: |
| 2831 CodeStub::Major major_key_; | 2793 CodeStub::Major major_key_; |
| 2832 TranscendentalCache::Type transcendental_type_; | 2794 TranscendentalCache::Type transcendental_type_; |
| 2833 }; | 2795 }; |
| 2834 | 2796 |
| 2835 | 2797 |
| 2836 class HUnknownOSRValue: public HInstruction { | 2798 class HUnknownOSRValue: public HTemplateInstruction<0> { |
| 2837 public: | 2799 public: |
| 2838 HUnknownOSRValue() { set_representation(Representation::Tagged()); } | 2800 HUnknownOSRValue() { set_representation(Representation::Tagged()); } |
| 2839 | 2801 |
| 2840 virtual Representation RequiredInputRepresentation(int index) const { | 2802 virtual Representation RequiredInputRepresentation(int index) const { |
| 2841 return Representation::None(); | 2803 return Representation::None(); |
| 2842 } | 2804 } |
| 2843 | 2805 |
| 2844 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value") | 2806 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value") |
| 2845 }; | 2807 }; |
| 2846 | 2808 |
| 2847 | 2809 |
| 2848 class HLoadGlobal: public HInstruction { | 2810 class HLoadGlobal: public HTemplateInstruction<0> { |
| 2849 public: | 2811 public: |
| 2850 HLoadGlobal(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) | 2812 HLoadGlobal(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) |
| 2851 : cell_(cell), check_hole_value_(check_hole_value) { | 2813 : cell_(cell), check_hole_value_(check_hole_value) { |
| 2852 set_representation(Representation::Tagged()); | 2814 set_representation(Representation::Tagged()); |
| 2853 SetFlag(kUseGVN); | 2815 SetFlag(kUseGVN); |
| 2854 SetFlag(kDependsOnGlobalVars); | 2816 SetFlag(kDependsOnGlobalVars); |
| 2855 } | 2817 } |
| 2856 | 2818 |
| 2857 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 2819 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
| 2858 bool check_hole_value() const { return check_hole_value_; } | 2820 bool check_hole_value() const { return check_hole_value_; } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3049 return Representation::Tagged(); | 3011 return Representation::Tagged(); |
| 3050 } | 3012 } |
| 3051 | 3013 |
| 3052 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") | 3014 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") |
| 3053 | 3015 |
| 3054 protected: | 3016 protected: |
| 3055 virtual bool DataEquals(HValue* other) { return true; } | 3017 virtual bool DataEquals(HValue* other) { return true; } |
| 3056 }; | 3018 }; |
| 3057 | 3019 |
| 3058 | 3020 |
| 3059 class HLoadKeyed: public HBinaryOperation { | 3021 class HLoadKeyedFastElement: public HBinaryOperation { |
| 3060 public: | 3022 public: |
| 3061 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { | 3023 HLoadKeyedFastElement(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { |
| 3062 set_representation(Representation::Tagged()); | 3024 set_representation(Representation::Tagged()); |
| 3063 } | |
| 3064 | |
| 3065 virtual void PrintDataTo(StringStream* stream); | |
| 3066 | |
| 3067 virtual Representation RequiredInputRepresentation(int index) const { | |
| 3068 return Representation::Tagged(); | |
| 3069 } | |
| 3070 HValue* object() { return OperandAt(0); } | |
| 3071 HValue* key() { return OperandAt(1); } | |
| 3072 | |
| 3073 DECLARE_INSTRUCTION(LoadKeyed) | |
| 3074 }; | |
| 3075 | |
| 3076 | |
| 3077 class HLoadKeyedFastElement: public HLoadKeyed { | |
| 3078 public: | |
| 3079 HLoadKeyedFastElement(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { | |
| 3080 SetFlag(kDependsOnArrayElements); | 3025 SetFlag(kDependsOnArrayElements); |
| 3081 SetFlag(kUseGVN); | 3026 SetFlag(kUseGVN); |
| 3082 } | 3027 } |
| 3083 | 3028 |
| 3029 HValue* object() { return OperandAt(0); } |
| 3030 HValue* key() { return OperandAt(1); } |
| 3031 |
| 3084 virtual Representation RequiredInputRepresentation(int index) const { | 3032 virtual Representation RequiredInputRepresentation(int index) const { |
| 3085 // The key is supposed to be Integer32. | 3033 // The key is supposed to be Integer32. |
| 3086 return (index == 1) ? Representation::Integer32() | 3034 return (index == 1) ? Representation::Integer32() |
| 3087 : Representation::Tagged(); | 3035 : Representation::Tagged(); |
| 3088 } | 3036 } |
| 3089 | 3037 |
| 3038 virtual void PrintDataTo(StringStream* stream); |
| 3039 |
| 3090 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, | 3040 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, |
| 3091 "load_keyed_fast_element") | 3041 "load_keyed_fast_element") |
| 3092 | 3042 |
| 3093 protected: | 3043 protected: |
| 3094 virtual bool DataEquals(HValue* other) { return true; } | 3044 virtual bool DataEquals(HValue* other) { return true; } |
| 3095 }; | 3045 }; |
| 3096 | 3046 |
| 3097 | 3047 |
| 3098 class HLoadPixelArrayElement: public HBinaryOperation { | 3048 class HLoadPixelArrayElement: public HBinaryOperation { |
| 3099 public: | 3049 public: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3119 HValue* key() { return OperandAt(1); } | 3069 HValue* key() { return OperandAt(1); } |
| 3120 | 3070 |
| 3121 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayElement, | 3071 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayElement, |
| 3122 "load_pixel_array_element") | 3072 "load_pixel_array_element") |
| 3123 | 3073 |
| 3124 protected: | 3074 protected: |
| 3125 virtual bool DataEquals(HValue* other) { return true; } | 3075 virtual bool DataEquals(HValue* other) { return true; } |
| 3126 }; | 3076 }; |
| 3127 | 3077 |
| 3128 | 3078 |
| 3129 class HLoadKeyedGeneric: public HLoadKeyed { | 3079 class HLoadKeyedGeneric: public HTemplateInstruction<3> { |
| 3130 public: | 3080 public: |
| 3131 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) | 3081 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) { |
| 3132 : HLoadKeyed(obj, key), context_(NULL) { | 3082 set_representation(Representation::Tagged()); |
| 3083 SetOperandAt(0, obj); |
| 3084 SetOperandAt(1, key); |
| 3133 SetOperandAt(2, context); | 3085 SetOperandAt(2, context); |
| 3134 SetAllSideEffects(); | 3086 SetAllSideEffects(); |
| 3135 } | 3087 } |
| 3136 | 3088 |
| 3137 HValue* context() const { return context_; } | 3089 HValue* object() { return OperandAt(0); } |
| 3138 HValue* object() { return operands_[0]; } | 3090 HValue* key() { return OperandAt(1); } |
| 3139 HValue* key() { return operands_[1]; } | 3091 HValue* context() { return OperandAt(2); } |
| 3140 | 3092 |
| 3141 virtual int OperandCount() { return 3; } | 3093 virtual void PrintDataTo(StringStream* stream); |
| 3142 virtual HValue* OperandAt(int index) { | |
| 3143 return (index < 2) ? operands_[index] : context_; | |
| 3144 } | |
| 3145 | |
| 3146 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") | |
| 3147 | |
| 3148 protected: | |
| 3149 virtual void InternalSetOperandAt(int index, HValue* value); | |
| 3150 | |
| 3151 private: | |
| 3152 HValue* context_; | |
| 3153 }; | |
| 3154 | |
| 3155 | |
| 3156 class HStoreNamed: public HBinaryOperation { | |
| 3157 public: | |
| 3158 HStoreNamed(HValue* obj, Handle<String> name, HValue* val) | |
| 3159 : HBinaryOperation(obj, val), name_(name) { | |
| 3160 } | |
| 3161 | 3094 |
| 3162 virtual Representation RequiredInputRepresentation(int index) const { | 3095 virtual Representation RequiredInputRepresentation(int index) const { |
| 3163 return Representation::Tagged(); | 3096 return Representation::Tagged(); |
| 3164 } | 3097 } |
| 3165 | 3098 |
| 3166 virtual void PrintDataTo(StringStream* stream); | 3099 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") |
| 3167 | |
| 3168 HValue* object() { return OperandAt(0); } | |
| 3169 Handle<String> name() const { return name_; } | |
| 3170 HValue* value() { return OperandAt(1); } | |
| 3171 void set_value(HValue* value) { SetOperandAt(1, value); } | |
| 3172 | |
| 3173 DECLARE_INSTRUCTION(StoreNamed) | |
| 3174 | |
| 3175 private: | |
| 3176 Handle<String> name_; | |
| 3177 }; | 3100 }; |
| 3178 | 3101 |
| 3179 | 3102 |
| 3180 class HStoreNamedField: public HStoreNamed { | 3103 class HStoreNamedField: public HBinaryOperation { |
| 3181 public: | 3104 public: |
| 3182 HStoreNamedField(HValue* obj, | 3105 HStoreNamedField(HValue* obj, |
| 3183 Handle<String> name, | 3106 Handle<String> name, |
| 3184 HValue* val, | 3107 HValue* val, |
| 3185 bool in_object, | 3108 bool in_object, |
| 3186 int offset) | 3109 int offset) |
| 3187 : HStoreNamed(obj, name, val), | 3110 : HBinaryOperation(obj, val), |
| 3111 name_(name), |
| 3188 is_in_object_(in_object), | 3112 is_in_object_(in_object), |
| 3189 offset_(offset) { | 3113 offset_(offset) { |
| 3190 if (is_in_object_) { | 3114 if (is_in_object_) { |
| 3191 SetFlag(kChangesInobjectFields); | 3115 SetFlag(kChangesInobjectFields); |
| 3192 } else { | 3116 } else { |
| 3193 SetFlag(kChangesBackingStoreFields); | 3117 SetFlag(kChangesBackingStoreFields); |
| 3194 } | 3118 } |
| 3195 } | 3119 } |
| 3196 | 3120 |
| 3197 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field") | 3121 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field") |
| 3198 | 3122 |
| 3199 virtual Representation RequiredInputRepresentation(int index) const { | 3123 virtual Representation RequiredInputRepresentation(int index) const { |
| 3200 return Representation::Tagged(); | 3124 return Representation::Tagged(); |
| 3201 } | 3125 } |
| 3202 virtual void PrintDataTo(StringStream* stream); | 3126 virtual void PrintDataTo(StringStream* stream); |
| 3203 | 3127 |
| 3128 HValue* object() { return OperandAt(0); } |
| 3129 HValue* value() { return OperandAt(1); } |
| 3130 |
| 3131 Handle<String> name() const { return name_; } |
| 3204 bool is_in_object() const { return is_in_object_; } | 3132 bool is_in_object() const { return is_in_object_; } |
| 3205 int offset() const { return offset_; } | 3133 int offset() const { return offset_; } |
| 3206 Handle<Map> transition() const { return transition_; } | 3134 Handle<Map> transition() const { return transition_; } |
| 3207 void set_transition(Handle<Map> map) { transition_ = map; } | 3135 void set_transition(Handle<Map> map) { transition_ = map; } |
| 3208 | 3136 |
| 3209 bool NeedsWriteBarrier() { | 3137 bool NeedsWriteBarrier() { |
| 3210 return StoringValueNeedsWriteBarrier(value()); | 3138 return StoringValueNeedsWriteBarrier(value()); |
| 3211 } | 3139 } |
| 3212 | 3140 |
| 3213 private: | 3141 private: |
| 3142 Handle<String> name_; |
| 3214 bool is_in_object_; | 3143 bool is_in_object_; |
| 3215 int offset_; | 3144 int offset_; |
| 3216 Handle<Map> transition_; | 3145 Handle<Map> transition_; |
| 3217 }; | 3146 }; |
| 3218 | 3147 |
| 3219 | 3148 |
| 3220 class HStoreNamedGeneric: public HStoreNamed { | 3149 class HStoreNamedGeneric: public HTemplateInstruction<3> { |
| 3221 public: | 3150 public: |
| 3222 HStoreNamedGeneric(HValue* context, | 3151 HStoreNamedGeneric(HValue* context, |
| 3223 HValue* object, | 3152 HValue* object, |
| 3224 Handle<String> name, | 3153 Handle<String> name, |
| 3225 HValue* value) | 3154 HValue* value) |
| 3226 : HStoreNamed(object, name, value), context_(NULL) { | 3155 : name_(name) { |
| 3156 SetOperandAt(0, object); |
| 3157 SetOperandAt(1, value); |
| 3227 SetOperandAt(2, context); | 3158 SetOperandAt(2, context); |
| 3228 SetAllSideEffects(); | 3159 SetAllSideEffects(); |
| 3229 } | 3160 } |
| 3230 | 3161 |
| 3231 HValue* context() const { return context_; } | 3162 HValue* object() { return OperandAt(0); } |
| 3232 HValue* object() const { return operands_[0]; } | 3163 HValue* value() { return OperandAt(1); } |
| 3233 HValue* value() const { return operands_[1]; } | 3164 HValue* context() { return OperandAt(2); } |
| 3234 | 3165 Handle<String> name() { return name_; } |
| 3235 virtual int OperandCount() { return 3; } | |
| 3236 | |
| 3237 virtual HValue* OperandAt(int index) { | |
| 3238 return (index < 2) ? operands_[index] : context_; | |
| 3239 } | |
| 3240 | |
| 3241 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store_named_generic") | |
| 3242 | |
| 3243 protected: | |
| 3244 virtual void InternalSetOperandAt(int index, HValue* value); | |
| 3245 | |
| 3246 private: | |
| 3247 HValue* context_; | |
| 3248 }; | |
| 3249 | |
| 3250 | |
| 3251 class HStoreKeyed: public HInstruction { | |
| 3252 public: | |
| 3253 HStoreKeyed(HValue* obj, HValue* key, HValue* val) { | |
| 3254 SetOperandAt(0, obj); | |
| 3255 SetOperandAt(1, key); | |
| 3256 SetOperandAt(2, val); | |
| 3257 } | |
| 3258 | 3166 |
| 3259 virtual void PrintDataTo(StringStream* stream); | 3167 virtual void PrintDataTo(StringStream* stream); |
| 3260 virtual int OperandCount() { return operands_.length(); } | |
| 3261 virtual HValue* OperandAt(int index) { return operands_[index]; } | |
| 3262 | 3168 |
| 3263 virtual Representation RequiredInputRepresentation(int index) const { | 3169 virtual Representation RequiredInputRepresentation(int index) const { |
| 3264 return Representation::Tagged(); | 3170 return Representation::Tagged(); |
| 3265 } | 3171 } |
| 3266 | 3172 |
| 3173 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store_named_generic") |
| 3174 |
| 3175 private: |
| 3176 Handle<String> name_; |
| 3177 }; |
| 3178 |
| 3179 |
| 3180 class HStoreKeyedFastElement: public HTemplateInstruction<3> { |
| 3181 public: |
| 3182 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) { |
| 3183 SetOperandAt(0, obj); |
| 3184 SetOperandAt(1, key); |
| 3185 SetOperandAt(2, val); |
| 3186 SetFlag(kChangesArrayElements); |
| 3187 } |
| 3188 |
| 3189 virtual Representation RequiredInputRepresentation(int index) const { |
| 3190 // The key is supposed to be Integer32. |
| 3191 return (index == 1) ? Representation::Integer32() |
| 3192 : Representation::Tagged(); |
| 3193 } |
| 3194 |
| 3267 HValue* object() { return OperandAt(0); } | 3195 HValue* object() { return OperandAt(0); } |
| 3268 HValue* key() { return OperandAt(1); } | 3196 HValue* key() { return OperandAt(1); } |
| 3269 HValue* value() { return OperandAt(2); } | 3197 HValue* value() { return OperandAt(2); } |
| 3270 | 3198 |
| 3271 bool NeedsWriteBarrier() { | 3199 bool NeedsWriteBarrier() { |
| 3272 return StoringValueNeedsWriteBarrier(value()); | 3200 return StoringValueNeedsWriteBarrier(value()); |
| 3273 } | 3201 } |
| 3274 | 3202 |
| 3275 DECLARE_INSTRUCTION(StoreKeyed) | 3203 virtual void PrintDataTo(StringStream* stream); |
| 3276 | |
| 3277 protected: | |
| 3278 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 3279 operands_[index] = value; | |
| 3280 } | |
| 3281 | |
| 3282 HOperandVector<3> operands_; | |
| 3283 }; | |
| 3284 | |
| 3285 | |
| 3286 class HStoreKeyedFastElement: public HStoreKeyed { | |
| 3287 public: | |
| 3288 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) | |
| 3289 : HStoreKeyed(obj, key, val) { | |
| 3290 SetFlag(kChangesArrayElements); | |
| 3291 } | |
| 3292 | |
| 3293 virtual Representation RequiredInputRepresentation(int index) const { | |
| 3294 // The key is supposed to be Integer32. | |
| 3295 return (index == 1) ? Representation::Integer32() | |
| 3296 : Representation::Tagged(); | |
| 3297 } | |
| 3298 | 3204 |
| 3299 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, | 3205 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, |
| 3300 "store_keyed_fast_element") | 3206 "store_keyed_fast_element") |
| 3301 }; | 3207 }; |
| 3302 | 3208 |
| 3303 | 3209 |
| 3304 class HStorePixelArrayElement: public HInstruction { | 3210 class HStorePixelArrayElement: public HTemplateInstruction<3> { |
| 3305 public: | 3211 public: |
| 3306 HStorePixelArrayElement(HValue* external_elements, HValue* key, HValue* val) { | 3212 HStorePixelArrayElement(HValue* external_elements, HValue* key, HValue* val) { |
| 3307 SetFlag(kChangesPixelArrayElements); | 3213 SetFlag(kChangesPixelArrayElements); |
| 3308 SetOperandAt(0, external_elements); | 3214 SetOperandAt(0, external_elements); |
| 3309 SetOperandAt(1, key); | 3215 SetOperandAt(1, key); |
| 3310 SetOperandAt(2, val); | 3216 SetOperandAt(2, val); |
| 3311 } | 3217 } |
| 3312 | 3218 |
| 3313 virtual void PrintDataTo(StringStream* stream); | 3219 virtual void PrintDataTo(StringStream* stream); |
| 3314 virtual int OperandCount() { return operands_.length(); } | |
| 3315 virtual HValue* OperandAt(int index) { return operands_[index]; } | |
| 3316 | 3220 |
| 3317 virtual Representation RequiredInputRepresentation(int index) const { | 3221 virtual Representation RequiredInputRepresentation(int index) const { |
| 3318 if (index == 0) { | 3222 if (index == 0) { |
| 3319 return Representation::External(); | 3223 return Representation::External(); |
| 3320 } else { | 3224 } else { |
| 3321 return Representation::Integer32(); | 3225 return Representation::Integer32(); |
| 3322 } | 3226 } |
| 3323 } | 3227 } |
| 3324 | 3228 |
| 3325 HValue* external_pointer() { return operands_[0]; } | 3229 HValue* external_pointer() { return OperandAt(0); } |
| 3326 HValue* key() { return operands_[1]; } | 3230 HValue* key() { return OperandAt(1); } |
| 3327 HValue* value() { return operands_[2]; } | 3231 HValue* value() { return OperandAt(2); } |
| 3328 | 3232 |
| 3329 DECLARE_CONCRETE_INSTRUCTION(StorePixelArrayElement, | 3233 DECLARE_CONCRETE_INSTRUCTION(StorePixelArrayElement, |
| 3330 "store_pixel_array_element") | 3234 "store_pixel_array_element") |
| 3331 | |
| 3332 protected: | |
| 3333 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 3334 operands_[index] = value; | |
| 3335 } | |
| 3336 | |
| 3337 HOperandVector<3> operands_; | |
| 3338 }; | 3235 }; |
| 3339 | 3236 |
| 3340 | 3237 |
| 3341 class HStoreKeyedGeneric: public HStoreKeyed { | 3238 class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
| 3342 public: | 3239 public: |
| 3343 HStoreKeyedGeneric(HValue* context, | 3240 HStoreKeyedGeneric(HValue* context, |
| 3344 HValue* object, | 3241 HValue* object, |
| 3345 HValue* key, | 3242 HValue* key, |
| 3346 HValue* value) | 3243 HValue* value) { |
| 3347 : HStoreKeyed(object, key, value), context_(NULL) { | 3244 SetOperandAt(0, object); |
| 3245 SetOperandAt(1, key); |
| 3246 SetOperandAt(2, value); |
| 3348 SetOperandAt(3, context); | 3247 SetOperandAt(3, context); |
| 3349 SetAllSideEffects(); | 3248 SetAllSideEffects(); |
| 3350 } | 3249 } |
| 3351 | 3250 |
| 3352 HValue* context() { return context_; } | 3251 HValue* object() { return OperandAt(0); } |
| 3353 HValue* object() { return operands_[0]; } | 3252 HValue* key() { return OperandAt(1); } |
| 3354 HValue* key() { return operands_[1]; } | 3253 HValue* value() { return OperandAt(2); } |
| 3355 HValue* value() { return operands_[2]; } | 3254 HValue* context() { return OperandAt(3); } |
| 3356 | 3255 |
| 3357 virtual int OperandCount() { return 4; } | 3256 virtual Representation RequiredInputRepresentation(int index) const { |
| 3358 | 3257 return Representation::Tagged(); |
| 3359 virtual HValue* OperandAt(int index) { | |
| 3360 return (index < 3) ? operands_[index] : context_; | |
| 3361 } | 3258 } |
| 3362 | 3259 |
| 3260 virtual void PrintDataTo(StringStream* stream); |
| 3261 |
| 3363 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic") | 3262 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic") |
| 3364 | |
| 3365 protected: | |
| 3366 virtual void InternalSetOperandAt(int index, HValue* value); | |
| 3367 | |
| 3368 private: | |
| 3369 HValue* context_; | |
| 3370 }; | 3263 }; |
| 3371 | 3264 |
| 3372 | 3265 |
| 3373 class HStringCharCodeAt: public HBinaryOperation { | 3266 class HStringCharCodeAt: public HBinaryOperation { |
| 3374 public: | 3267 public: |
| 3375 HStringCharCodeAt(HValue* string, HValue* index) | 3268 HStringCharCodeAt(HValue* string, HValue* index) |
| 3376 : HBinaryOperation(string, index) { | 3269 : HBinaryOperation(string, index) { |
| 3377 set_representation(Representation::Integer32()); | 3270 set_representation(Representation::Integer32()); |
| 3378 SetFlag(kUseGVN); | 3271 SetFlag(kUseGVN); |
| 3379 } | 3272 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3418 | 3311 |
| 3419 protected: | 3312 protected: |
| 3420 virtual bool DataEquals(HValue* other) { return true; } | 3313 virtual bool DataEquals(HValue* other) { return true; } |
| 3421 | 3314 |
| 3422 virtual Range* InferRange() { | 3315 virtual Range* InferRange() { |
| 3423 return new Range(0, String::kMaxLength); | 3316 return new Range(0, String::kMaxLength); |
| 3424 } | 3317 } |
| 3425 }; | 3318 }; |
| 3426 | 3319 |
| 3427 | 3320 |
| 3428 class HMaterializedLiteral: public HInstruction { | 3321 template <int V> |
| 3322 class HMaterializedLiteral: public HTemplateInstruction<V> { |
| 3429 public: | 3323 public: |
| 3430 HMaterializedLiteral(int index, int depth) | 3324 HMaterializedLiteral<V>(int index, int depth) |
| 3431 : literal_index_(index), depth_(depth) { | 3325 : literal_index_(index), depth_(depth) { |
| 3432 set_representation(Representation::Tagged()); | 3326 this->set_representation(Representation::Tagged()); |
| 3433 } | 3327 } |
| 3434 | 3328 |
| 3435 int literal_index() const { return literal_index_; } | 3329 int literal_index() const { return literal_index_; } |
| 3436 int depth() const { return depth_; } | 3330 int depth() const { return depth_; } |
| 3437 | 3331 |
| 3438 DECLARE_INSTRUCTION(MaterializedLiteral) | |
| 3439 | |
| 3440 private: | 3332 private: |
| 3441 int literal_index_; | 3333 int literal_index_; |
| 3442 int depth_; | 3334 int depth_; |
| 3443 }; | 3335 }; |
| 3444 | 3336 |
| 3445 | 3337 |
| 3446 class HArrayLiteral: public HMaterializedLiteral { | 3338 class HArrayLiteral: public HMaterializedLiteral<0> { |
| 3447 public: | 3339 public: |
| 3448 HArrayLiteral(Handle<FixedArray> constant_elements, | 3340 HArrayLiteral(Handle<FixedArray> constant_elements, |
| 3449 int length, | 3341 int length, |
| 3450 int literal_index, | 3342 int literal_index, |
| 3451 int depth) | 3343 int depth) |
| 3452 : HMaterializedLiteral(literal_index, depth), | 3344 : HMaterializedLiteral<0>(literal_index, depth), |
| 3453 length_(length), | 3345 length_(length), |
| 3454 constant_elements_(constant_elements) {} | 3346 constant_elements_(constant_elements) {} |
| 3455 | 3347 |
| 3456 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 3348 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
| 3457 int length() const { return length_; } | 3349 int length() const { return length_; } |
| 3458 | 3350 |
| 3459 bool IsCopyOnWrite() const; | 3351 bool IsCopyOnWrite() const; |
| 3460 | 3352 |
| 3461 virtual Representation RequiredInputRepresentation(int index) const { | 3353 virtual Representation RequiredInputRepresentation(int index) const { |
| 3462 return Representation::None(); | 3354 return Representation::None(); |
| 3463 } | 3355 } |
| 3464 | 3356 |
| 3465 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array_literal") | 3357 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array_literal") |
| 3466 | 3358 |
| 3467 private: | 3359 private: |
| 3468 int length_; | 3360 int length_; |
| 3469 Handle<FixedArray> constant_elements_; | 3361 Handle<FixedArray> constant_elements_; |
| 3470 }; | 3362 }; |
| 3471 | 3363 |
| 3472 | 3364 |
| 3473 class HObjectLiteral: public HMaterializedLiteral { | 3365 class HObjectLiteral: public HMaterializedLiteral<1> { |
| 3474 public: | 3366 public: |
| 3475 HObjectLiteral(HValue* context, | 3367 HObjectLiteral(HValue* context, |
| 3476 Handle<FixedArray> constant_properties, | 3368 Handle<FixedArray> constant_properties, |
| 3477 bool fast_elements, | 3369 bool fast_elements, |
| 3478 int literal_index, | 3370 int literal_index, |
| 3479 int depth) | 3371 int depth) |
| 3480 : HMaterializedLiteral(literal_index, depth), | 3372 : HMaterializedLiteral<1>(literal_index, depth), |
| 3481 context_(NULL), | |
| 3482 constant_properties_(constant_properties), | 3373 constant_properties_(constant_properties), |
| 3483 fast_elements_(fast_elements) { | 3374 fast_elements_(fast_elements) { |
| 3484 SetOperandAt(0, context); | 3375 SetOperandAt(0, context); |
| 3485 } | 3376 } |
| 3486 | 3377 |
| 3487 HValue* context() const { return context_; } | 3378 HValue* context() { return OperandAt(0); } |
| 3488 Handle<FixedArray> constant_properties() const { | 3379 Handle<FixedArray> constant_properties() const { |
| 3489 return constant_properties_; | 3380 return constant_properties_; |
| 3490 } | 3381 } |
| 3491 bool fast_elements() const { return fast_elements_; } | 3382 bool fast_elements() const { return fast_elements_; } |
| 3492 | 3383 |
| 3493 virtual int OperandCount() { return 1; } | |
| 3494 virtual HValue* OperandAt(int index) { return context_; } | |
| 3495 | |
| 3496 virtual Representation RequiredInputRepresentation(int index) const { | 3384 virtual Representation RequiredInputRepresentation(int index) const { |
| 3497 return Representation::Tagged(); | 3385 return Representation::Tagged(); |
| 3498 } | 3386 } |
| 3499 | 3387 |
| 3500 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object_literal") | 3388 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object_literal") |
| 3501 | 3389 |
| 3502 protected: | |
| 3503 virtual void InternalSetOperandAt(int index, HValue* value) { | |
| 3504 context_ = value; | |
| 3505 } | |
| 3506 | |
| 3507 private: | 3390 private: |
| 3508 HValue* context_; | |
| 3509 Handle<FixedArray> constant_properties_; | 3391 Handle<FixedArray> constant_properties_; |
| 3510 bool fast_elements_; | 3392 bool fast_elements_; |
| 3511 }; | 3393 }; |
| 3512 | 3394 |
| 3513 | 3395 |
| 3514 class HRegExpLiteral: public HMaterializedLiteral { | 3396 class HRegExpLiteral: public HMaterializedLiteral<0> { |
| 3515 public: | 3397 public: |
| 3516 HRegExpLiteral(Handle<String> pattern, | 3398 HRegExpLiteral(Handle<String> pattern, |
| 3517 Handle<String> flags, | 3399 Handle<String> flags, |
| 3518 int literal_index) | 3400 int literal_index) |
| 3519 : HMaterializedLiteral(literal_index, 0), | 3401 : HMaterializedLiteral<0>(literal_index, 0), |
| 3520 pattern_(pattern), | 3402 pattern_(pattern), |
| 3521 flags_(flags) { } | 3403 flags_(flags) { } |
| 3522 | 3404 |
| 3523 Handle<String> pattern() { return pattern_; } | 3405 Handle<String> pattern() { return pattern_; } |
| 3524 Handle<String> flags() { return flags_; } | 3406 Handle<String> flags() { return flags_; } |
| 3525 | 3407 |
| 3526 virtual Representation RequiredInputRepresentation(int index) const { | 3408 virtual Representation RequiredInputRepresentation(int index) const { |
| 3527 return Representation::None(); | 3409 return Representation::None(); |
| 3528 } | 3410 } |
| 3529 | 3411 |
| 3530 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp_literal") | 3412 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp_literal") |
| 3531 | 3413 |
| 3532 private: | 3414 private: |
| 3533 Handle<String> pattern_; | 3415 Handle<String> pattern_; |
| 3534 Handle<String> flags_; | 3416 Handle<String> flags_; |
| 3535 }; | 3417 }; |
| 3536 | 3418 |
| 3537 | 3419 |
| 3538 class HFunctionLiteral: public HInstruction { | 3420 class HFunctionLiteral: public HTemplateInstruction<0> { |
| 3539 public: | 3421 public: |
| 3540 HFunctionLiteral(Handle<SharedFunctionInfo> shared, bool pretenure) | 3422 HFunctionLiteral(Handle<SharedFunctionInfo> shared, bool pretenure) |
| 3541 : shared_info_(shared), pretenure_(pretenure) { | 3423 : shared_info_(shared), pretenure_(pretenure) { |
| 3542 set_representation(Representation::Tagged()); | 3424 set_representation(Representation::Tagged()); |
| 3543 } | 3425 } |
| 3544 | 3426 |
| 3545 virtual Representation RequiredInputRepresentation(int index) const { | 3427 virtual Representation RequiredInputRepresentation(int index) const { |
| 3546 return Representation::None(); | 3428 return Representation::None(); |
| 3547 } | 3429 } |
| 3548 | 3430 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3602 HValue* object() { return left(); } | 3484 HValue* object() { return left(); } |
| 3603 HValue* key() { return right(); } | 3485 HValue* key() { return right(); } |
| 3604 }; | 3486 }; |
| 3605 | 3487 |
| 3606 #undef DECLARE_INSTRUCTION | 3488 #undef DECLARE_INSTRUCTION |
| 3607 #undef DECLARE_CONCRETE_INSTRUCTION | 3489 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3608 | 3490 |
| 3609 } } // namespace v8::internal | 3491 } } // namespace v8::internal |
| 3610 | 3492 |
| 3611 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3493 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |