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