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

Side by Side Diff: src/hydrogen-instructions.h

Issue 6366002: Begin changing Hydrogen branch instructions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Rebase to HEAD> Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 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
11 // with the distribution. 11 // with the distribution.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // HCallNamed 92 // HCallNamed
93 // HCallNew 93 // HCallNew
94 // HCallRuntime 94 // HCallRuntime
95 // HCallStub 95 // HCallStub
96 // HCheckPrototypeMaps 96 // HCheckPrototypeMaps
97 // HConstant 97 // HConstant
98 // HControlInstruction 98 // HControlInstruction
99 // HDeoptimize 99 // HDeoptimize
100 // HGoto 100 // HGoto
101 // HUnaryControlInstruction 101 // HUnaryControlInstruction
102 // HBranch 102 // HCompareMap
103 // HCompareMapAndBranch
104 // HReturn 103 // HReturn
104 // HTest
105 // HThrow 105 // HThrow
106 // HEnterInlined 106 // HEnterInlined
107 // HFunctionLiteral 107 // HFunctionLiteral
108 // HGlobalObject 108 // HGlobalObject
109 // HGlobalReceiver 109 // HGlobalReceiver
110 // HLeaveInlined 110 // HLeaveInlined
111 // HLoadContextSlot 111 // HLoadContextSlot
112 // HLoadGlobal 112 // HLoadGlobal
113 // HMaterializedLiteral 113 // HMaterializedLiteral
114 // HArrayLiteral 114 // HArrayLiteral
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 V(ArgumentsElements) \ 176 V(ArgumentsElements) \
177 V(ArgumentsLength) \ 177 V(ArgumentsLength) \
178 V(ArgumentsObject) \ 178 V(ArgumentsObject) \
179 V(ArrayLiteral) \ 179 V(ArrayLiteral) \
180 V(BitAnd) \ 180 V(BitAnd) \
181 V(BitNot) \ 181 V(BitNot) \
182 V(BitOr) \ 182 V(BitOr) \
183 V(BitXor) \ 183 V(BitXor) \
184 V(BlockEntry) \ 184 V(BlockEntry) \
185 V(BoundsCheck) \ 185 V(BoundsCheck) \
186 V(Branch) \
187 V(CallConstantFunction) \ 186 V(CallConstantFunction) \
188 V(CallFunction) \ 187 V(CallFunction) \
189 V(CallGlobal) \ 188 V(CallGlobal) \
190 V(CallKeyed) \ 189 V(CallKeyed) \
191 V(CallKnownGlobal) \ 190 V(CallKnownGlobal) \
192 V(CallNamed) \ 191 V(CallNamed) \
193 V(CallNew) \ 192 V(CallNew) \
194 V(CallRuntime) \ 193 V(CallRuntime) \
195 V(CallStub) \ 194 V(CallStub) \
196 V(Change) \ 195 V(Change) \
197 V(CheckFunction) \ 196 V(CheckFunction) \
198 V(CheckInstanceType) \ 197 V(CheckInstanceType) \
199 V(CheckMap) \ 198 V(CheckMap) \
200 V(CheckNonSmi) \ 199 V(CheckNonSmi) \
201 V(CheckPrototypeMaps) \ 200 V(CheckPrototypeMaps) \
202 V(CheckSmi) \ 201 V(CheckSmi) \
203 V(Compare) \ 202 V(Compare) \
204 V(CompareJSObjectEq) \ 203 V(CompareJSObjectEq) \
205 V(CompareMapAndBranch) \ 204 V(CompareMap) \
206 V(Constant) \ 205 V(Constant) \
207 V(DeleteProperty) \ 206 V(DeleteProperty) \
208 V(Deoptimize) \ 207 V(Deoptimize) \
209 V(Div) \ 208 V(Div) \
210 V(EnterInlined) \ 209 V(EnterInlined) \
211 V(FixedArrayLength) \ 210 V(FixedArrayLength) \
212 V(FunctionLiteral) \ 211 V(FunctionLiteral) \
213 V(GlobalObject) \ 212 V(GlobalObject) \
214 V(GlobalReceiver) \ 213 V(GlobalReceiver) \
215 V(Goto) \ 214 V(Goto) \
(...skipping 30 matching lines...) Expand all
246 V(Simulate) \ 245 V(Simulate) \
247 V(StackCheck) \ 246 V(StackCheck) \
248 V(StoreGlobal) \ 247 V(StoreGlobal) \
249 V(StoreKeyedFastElement) \ 248 V(StoreKeyedFastElement) \
250 V(StoreKeyedGeneric) \ 249 V(StoreKeyedGeneric) \
251 V(StoreNamedField) \ 250 V(StoreNamedField) \
252 V(StoreNamedGeneric) \ 251 V(StoreNamedGeneric) \
253 V(StringCharCodeAt) \ 252 V(StringCharCodeAt) \
254 V(StringLength) \ 253 V(StringLength) \
255 V(Sub) \ 254 V(Sub) \
255 V(Test) \
256 V(Throw) \ 256 V(Throw) \
257 V(Typeof) \ 257 V(Typeof) \
258 V(TypeofIs) \ 258 V(TypeofIs) \
259 V(UnaryMathOperation) \ 259 V(UnaryMathOperation) \
260 V(UnknownOSRValue) \ 260 V(UnknownOSRValue) \
261 V(ValueOf) 261 V(ValueOf)
262 262
263 #define GVN_FLAG_LIST(V) \ 263 #define GVN_FLAG_LIST(V) \
264 V(Calls) \ 264 V(Calls) \
265 V(InobjectFields) \ 265 V(InobjectFields) \
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 808
809 809
810 class HBlockEntry: public HInstruction { 810 class HBlockEntry: public HInstruction {
811 public: 811 public:
812 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry") 812 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry")
813 }; 813 };
814 814
815 815
816 class HControlInstruction: public HInstruction { 816 class HControlInstruction: public HInstruction {
817 public: 817 public:
818 virtual HBasicBlock* FirstSuccessor() const { return NULL; } 818 HControlInstruction(HBasicBlock* first, HBasicBlock* second)
819 virtual HBasicBlock* SecondSuccessor() const { return NULL; } 819 : first_successor_(first), second_successor_(second) {
820 }
821
822 HBasicBlock* FirstSuccessor() const { return first_successor_; }
823 HBasicBlock* SecondSuccessor() const { return second_successor_; }
824
825 virtual void PrintDataTo(StringStream* stream) const;
820 826
821 DECLARE_INSTRUCTION(ControlInstruction) 827 DECLARE_INSTRUCTION(ControlInstruction)
828
829 private:
830 HBasicBlock* first_successor_;
831 HBasicBlock* second_successor_;
822 }; 832 };
823 833
824 834
825 class HDeoptimize: public HControlInstruction { 835 class HDeoptimize: public HControlInstruction {
826 public: 836 public:
837 HDeoptimize() : HControlInstruction(NULL, NULL) { }
838
827 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") 839 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
828 }; 840 };
829 841
830 842
831 class HGoto: public HControlInstruction { 843 class HGoto: public HControlInstruction {
832 public: 844 public:
833 explicit HGoto(HBasicBlock* destination) 845 explicit HGoto(HBasicBlock* target)
834 : destination_(destination), 846 : HControlInstruction(target, NULL), include_stack_check_(false) {
835 include_stack_check_(false) {} 847 }
836 848
837 virtual HBasicBlock* FirstSuccessor() const { return destination_; }
838 void set_include_stack_check(bool include_stack_check) { 849 void set_include_stack_check(bool include_stack_check) {
839 include_stack_check_ = include_stack_check; 850 include_stack_check_ = include_stack_check;
840 } 851 }
841 bool include_stack_check() const { return include_stack_check_; } 852 bool include_stack_check() const { return include_stack_check_; }
842 853
843 virtual void PrintDataTo(StringStream* stream) const;
844
845 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") 854 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
846 855
847 private: 856 private:
848 HBasicBlock* destination_;
849 bool include_stack_check_; 857 bool include_stack_check_;
850 }; 858 };
851 859
852 860
853 class HUnaryControlInstruction: public HControlInstruction { 861 class HUnaryControlInstruction: public HControlInstruction {
854 public: 862 public:
855 explicit HUnaryControlInstruction(HValue* value) { 863 explicit HUnaryControlInstruction(HValue* value,
864 HBasicBlock* true_target,
865 HBasicBlock* false_target)
866 : HControlInstruction(true_target, false_target) {
856 SetOperandAt(0, value); 867 SetOperandAt(0, value);
857 } 868 }
858 869
859 virtual Representation RequiredInputRepresentation(int index) const { 870 virtual Representation RequiredInputRepresentation(int index) const {
860 return Representation::Tagged(); 871 return Representation::Tagged();
861 } 872 }
862 873
874 virtual void PrintDataTo(StringStream* stream) const;
875
863 HValue* value() const { return OperandAt(0); } 876 HValue* value() const { return OperandAt(0); }
864 virtual int OperandCount() const { return 1; } 877 virtual int OperandCount() const { return 1; }
865 virtual HValue* OperandAt(int index) const { return operands_[index]; } 878 virtual HValue* OperandAt(int index) const { return operands_[index]; }
866 879
867 DECLARE_INSTRUCTION(UnaryControlInstruction) 880 DECLARE_INSTRUCTION(UnaryControlInstruction)
868 881
869 protected: 882 protected:
870 virtual void InternalSetOperandAt(int index, HValue* value) { 883 virtual void InternalSetOperandAt(int index, HValue* value) {
871 operands_[index] = value; 884 operands_[index] = value;
872 } 885 }
873 886
874 private: 887 private:
875 HOperandVector<1> operands_; 888 HOperandVector<1> operands_;
876 }; 889 };
877 890
878 891
879 class HBranch: public HUnaryControlInstruction { 892 class HTest: public HUnaryControlInstruction {
880 public: 893 public:
881 HBranch(HBasicBlock* true_destination, 894 HTest(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target)
882 HBasicBlock* false_destination, 895 : HUnaryControlInstruction(value, true_target, false_target) {
883 HValue* boolean_value) 896 ASSERT(true_target != NULL && false_target != NULL);
884 : HUnaryControlInstruction(boolean_value),
885 true_destination_(true_destination),
886 false_destination_(false_destination) {
887 ASSERT(true_destination != NULL && false_destination != NULL);
888 } 897 }
889 898
890 virtual Representation RequiredInputRepresentation(int index) const { 899 virtual Representation RequiredInputRepresentation(int index) const {
891 return Representation::None(); 900 return Representation::None();
892 } 901 }
893 902
894 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; } 903 DECLARE_CONCRETE_INSTRUCTION(Test, "test")
895 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; }
896
897 virtual void PrintDataTo(StringStream* stream) const;
898
899 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
900
901 private:
902 HBasicBlock* true_destination_;
903 HBasicBlock* false_destination_;
904 }; 904 };
905 905
906 906
907 class HCompareMapAndBranch: public HUnaryControlInstruction { 907 class HCompareMap: public HUnaryControlInstruction {
908 public: 908 public:
909 HCompareMapAndBranch(HValue* result, 909 HCompareMap(HValue* value,
910 Handle<Map> map, 910 Handle<Map> map,
911 HBasicBlock* true_destination, 911 HBasicBlock* true_target,
912 HBasicBlock* false_destination) 912 HBasicBlock* false_target)
913 : HUnaryControlInstruction(result), 913 : HUnaryControlInstruction(value, true_target, false_target),
914 map_(map), 914 map_(map) {
915 true_destination_(true_destination), 915 ASSERT(true_target != NULL);
916 false_destination_(false_destination) { 916 ASSERT(false_target != NULL);
917 ASSERT(true_destination != NULL);
918 ASSERT(false_destination != NULL);
919 ASSERT(!map.is_null()); 917 ASSERT(!map.is_null());
920 } 918 }
921 919
922 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; }
923 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; }
924
925 HBasicBlock* true_destination() const { return true_destination_; }
926 HBasicBlock* false_destination() const { return false_destination_; }
927
928 virtual void PrintDataTo(StringStream* stream) const; 920 virtual void PrintDataTo(StringStream* stream) const;
929 921
930 Handle<Map> map() const { return map_; } 922 Handle<Map> map() const { return map_; }
931 923
932 DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch") 924 DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map")
933 925
934 private: 926 private:
935 Handle<Map> map_; 927 Handle<Map> map_;
936 HBasicBlock* true_destination_;
937 HBasicBlock* false_destination_;
938 }; 928 };
939 929
940 930
941 class HReturn: public HUnaryControlInstruction { 931 class HReturn: public HUnaryControlInstruction {
942 public: 932 public:
943 explicit HReturn(HValue* result) : HUnaryControlInstruction(result) { } 933 explicit HReturn(HValue* value)
944 934 : HUnaryControlInstruction(value, NULL, NULL) {
945 virtual void PrintDataTo(StringStream* stream) const; 935 }
946 936
947 DECLARE_CONCRETE_INSTRUCTION(Return, "return") 937 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
948 }; 938 };
949 939
950 940
951 class HThrow: public HUnaryControlInstruction { 941 class HThrow: public HUnaryControlInstruction {
952 public: 942 public:
953 explicit HThrow(HValue* value) : HUnaryControlInstruction(value) { } 943 explicit HThrow(HValue* value)
954 944 : HUnaryControlInstruction(value, NULL, NULL) { }
955 virtual void PrintDataTo(StringStream* stream) const;
956 945
957 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 946 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
958 }; 947 };
959 948
960 949
961 class HUnaryOperation: public HInstruction { 950 class HUnaryOperation: public HInstruction {
962 public: 951 public:
963 explicit HUnaryOperation(HValue* value) { 952 explicit HUnaryOperation(HValue* value) {
964 SetOperandAt(0, value); 953 SetOperandAt(0, value);
965 } 954 }
(...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3141 HValue* object() const { return left(); } 3130 HValue* object() const { return left(); }
3142 HValue* key() const { return right(); } 3131 HValue* key() const { return right(); }
3143 }; 3132 };
3144 3133
3145 #undef DECLARE_INSTRUCTION 3134 #undef DECLARE_INSTRUCTION
3146 #undef DECLARE_CONCRETE_INSTRUCTION 3135 #undef DECLARE_CONCRETE_INSTRUCTION
3147 3136
3148 } } // namespace v8::internal 3137 } } // namespace v8::internal
3149 3138
3150 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3139 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698