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

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

Issue 6322008: Version 3.0.10... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // HCompareJSObjectEq 74 // HCompareJSObjectEq
75 // HInstanceOf 75 // HInstanceOf
76 // HInstanceOfKnownGlobal 76 // HInstanceOfKnownGlobal
77 // HLoadKeyed 77 // HLoadKeyed
78 // HLoadKeyedFastElement 78 // HLoadKeyedFastElement
79 // HLoadKeyedGeneric 79 // HLoadKeyedGeneric
80 // HPower 80 // HPower
81 // HStoreNamed 81 // HStoreNamed
82 // HStoreNamedField 82 // HStoreNamedField
83 // HStoreNamedGeneric 83 // HStoreNamedGeneric
84 // HStringCharCodeAt
84 // HBlockEntry 85 // HBlockEntry
85 // HCall 86 // HCall
86 // HCallConstantFunction 87 // HCallConstantFunction
87 // HCallFunction 88 // HCallFunction
88 // HCallGlobal 89 // HCallGlobal
89 // HCallKeyed 90 // HCallKeyed
90 // HCallKnownGlobal 91 // HCallKnownGlobal
91 // HCallNamed 92 // HCallNamed
92 // HCallNew 93 // HCallNew
93 // HCallRuntime 94 // HCallRuntime
94 // HCallStub 95 // HCallStub
95 // HCheckPrototypeMaps 96 // HCheckPrototypeMaps
96 // HConstant 97 // HConstant
97 // HControlInstruction 98 // HControlInstruction
98 // HDeoptimize 99 // HDeoptimize
99 // HGoto 100 // HGoto
100 // HUnaryControlInstruction 101 // HUnaryControlInstruction
101 // HBranch 102 // HCompareMap
102 // HCompareMapAndBranch
103 // HReturn 103 // HReturn
104 // HTest
104 // HThrow 105 // HThrow
105 // HEnterInlined 106 // HEnterInlined
106 // HFunctionLiteral 107 // HFunctionLiteral
107 // HGlobalObject 108 // HGlobalObject
108 // HGlobalReceiver 109 // HGlobalReceiver
109 // HLeaveInlined 110 // HLeaveInlined
110 // HLoadContextSlot 111 // HLoadContextSlot
111 // HLoadGlobal 112 // HLoadGlobal
112 // HMaterializedLiteral 113 // HMaterializedLiteral
113 // HArrayLiteral 114 // HArrayLiteral
(...skipping 16 matching lines...) Expand all
130 // HCheckSmi 131 // HCheckSmi
131 // HDeleteProperty 132 // HDeleteProperty
132 // HFixedArrayLength 133 // HFixedArrayLength
133 // HJSArrayLength 134 // HJSArrayLength
134 // HLoadElements 135 // HLoadElements
135 // HTypeofIs 136 // HTypeofIs
136 // HLoadNamedField 137 // HLoadNamedField
137 // HLoadNamedGeneric 138 // HLoadNamedGeneric
138 // HLoadFunctionPrototype 139 // HLoadFunctionPrototype
139 // HPushArgument 140 // HPushArgument
141 // HStringLength
140 // HTypeof 142 // HTypeof
141 // HUnaryMathOperation 143 // HUnaryMathOperation
142 // HUnaryPredicate 144 // HUnaryPredicate
143 // HClassOfTest 145 // HClassOfTest
144 // HHasCachedArrayIndex 146 // HHasCachedArrayIndex
145 // HHasInstanceType 147 // HHasInstanceType
146 // HIsNull 148 // HIsNull
147 // HIsObject 149 // HIsObject
148 // HIsSmi 150 // HIsSmi
149 // HValueOf 151 // HValueOf
(...skipping 24 matching lines...) Expand all
174 V(ArgumentsElements) \ 176 V(ArgumentsElements) \
175 V(ArgumentsLength) \ 177 V(ArgumentsLength) \
176 V(ArgumentsObject) \ 178 V(ArgumentsObject) \
177 V(ArrayLiteral) \ 179 V(ArrayLiteral) \
178 V(BitAnd) \ 180 V(BitAnd) \
179 V(BitNot) \ 181 V(BitNot) \
180 V(BitOr) \ 182 V(BitOr) \
181 V(BitXor) \ 183 V(BitXor) \
182 V(BlockEntry) \ 184 V(BlockEntry) \
183 V(BoundsCheck) \ 185 V(BoundsCheck) \
184 V(Branch) \
185 V(CallConstantFunction) \ 186 V(CallConstantFunction) \
186 V(CallFunction) \ 187 V(CallFunction) \
187 V(CallGlobal) \ 188 V(CallGlobal) \
188 V(CallKeyed) \ 189 V(CallKeyed) \
189 V(CallKnownGlobal) \ 190 V(CallKnownGlobal) \
190 V(CallNamed) \ 191 V(CallNamed) \
191 V(CallNew) \ 192 V(CallNew) \
192 V(CallRuntime) \ 193 V(CallRuntime) \
193 V(CallStub) \ 194 V(CallStub) \
194 V(Change) \ 195 V(Change) \
195 V(CheckFunction) \ 196 V(CheckFunction) \
196 V(CheckInstanceType) \ 197 V(CheckInstanceType) \
197 V(CheckMap) \ 198 V(CheckMap) \
198 V(CheckNonSmi) \ 199 V(CheckNonSmi) \
199 V(CheckPrototypeMaps) \ 200 V(CheckPrototypeMaps) \
200 V(CheckSmi) \ 201 V(CheckSmi) \
201 V(Compare) \ 202 V(Compare) \
202 V(CompareJSObjectEq) \ 203 V(CompareJSObjectEq) \
203 V(CompareMapAndBranch) \ 204 V(CompareMap) \
204 V(Constant) \ 205 V(Constant) \
205 V(DeleteProperty) \ 206 V(DeleteProperty) \
206 V(Deoptimize) \ 207 V(Deoptimize) \
207 V(Div) \ 208 V(Div) \
208 V(EnterInlined) \ 209 V(EnterInlined) \
209 V(FixedArrayLength) \ 210 V(FixedArrayLength) \
210 V(FunctionLiteral) \ 211 V(FunctionLiteral) \
211 V(GlobalObject) \ 212 V(GlobalObject) \
212 V(GlobalReceiver) \ 213 V(GlobalReceiver) \
213 V(Goto) \ 214 V(Goto) \
(...skipping 27 matching lines...) Expand all
241 V(Sar) \ 242 V(Sar) \
242 V(Shl) \ 243 V(Shl) \
243 V(Shr) \ 244 V(Shr) \
244 V(Simulate) \ 245 V(Simulate) \
245 V(StackCheck) \ 246 V(StackCheck) \
246 V(StoreGlobal) \ 247 V(StoreGlobal) \
247 V(StoreKeyedFastElement) \ 248 V(StoreKeyedFastElement) \
248 V(StoreKeyedGeneric) \ 249 V(StoreKeyedGeneric) \
249 V(StoreNamedField) \ 250 V(StoreNamedField) \
250 V(StoreNamedGeneric) \ 251 V(StoreNamedGeneric) \
252 V(StringCharCodeAt) \
253 V(StringLength) \
251 V(Sub) \ 254 V(Sub) \
255 V(Test) \
252 V(Throw) \ 256 V(Throw) \
253 V(Typeof) \ 257 V(Typeof) \
254 V(TypeofIs) \ 258 V(TypeofIs) \
255 V(UnaryMathOperation) \ 259 V(UnaryMathOperation) \
256 V(UnknownOSRValue) \ 260 V(UnknownOSRValue) \
257 V(ValueOf) 261 V(ValueOf)
258 262
259 #define GVN_FLAG_LIST(V) \ 263 #define GVN_FLAG_LIST(V) \
260 V(Calls) \ 264 V(Calls) \
261 V(InobjectFields) \ 265 V(InobjectFields) \
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 808
805 809
806 class HBlockEntry: public HInstruction { 810 class HBlockEntry: public HInstruction {
807 public: 811 public:
808 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry") 812 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry")
809 }; 813 };
810 814
811 815
812 class HControlInstruction: public HInstruction { 816 class HControlInstruction: public HInstruction {
813 public: 817 public:
814 virtual HBasicBlock* FirstSuccessor() const { return NULL; } 818 HControlInstruction(HBasicBlock* first, HBasicBlock* second)
815 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;
816 826
817 DECLARE_INSTRUCTION(ControlInstruction) 827 DECLARE_INSTRUCTION(ControlInstruction)
828
829 private:
830 HBasicBlock* first_successor_;
831 HBasicBlock* second_successor_;
818 }; 832 };
819 833
820 834
821 class HDeoptimize: public HControlInstruction { 835 class HDeoptimize: public HControlInstruction {
822 public: 836 public:
837 HDeoptimize() : HControlInstruction(NULL, NULL) { }
838
823 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") 839 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
824 }; 840 };
825 841
826 842
827 class HGoto: public HControlInstruction { 843 class HGoto: public HControlInstruction {
828 public: 844 public:
829 explicit HGoto(HBasicBlock* destination) 845 explicit HGoto(HBasicBlock* target)
830 : destination_(destination), 846 : HControlInstruction(target, NULL), include_stack_check_(false) {
831 include_stack_check_(false) {} 847 }
832 848
833 virtual HBasicBlock* FirstSuccessor() const { return destination_; }
834 void set_include_stack_check(bool include_stack_check) { 849 void set_include_stack_check(bool include_stack_check) {
835 include_stack_check_ = include_stack_check; 850 include_stack_check_ = include_stack_check;
836 } 851 }
837 bool include_stack_check() const { return include_stack_check_; } 852 bool include_stack_check() const { return include_stack_check_; }
838 853
839 virtual void PrintDataTo(StringStream* stream) const;
840
841 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") 854 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
842 855
843 private: 856 private:
844 HBasicBlock* destination_;
845 bool include_stack_check_; 857 bool include_stack_check_;
846 }; 858 };
847 859
848 860
849 class HUnaryControlInstruction: public HControlInstruction { 861 class HUnaryControlInstruction: public HControlInstruction {
850 public: 862 public:
851 explicit HUnaryControlInstruction(HValue* value) { 863 explicit HUnaryControlInstruction(HValue* value,
864 HBasicBlock* true_target,
865 HBasicBlock* false_target)
866 : HControlInstruction(true_target, false_target) {
852 SetOperandAt(0, value); 867 SetOperandAt(0, value);
853 } 868 }
854 869
855 virtual Representation RequiredInputRepresentation(int index) const { 870 virtual Representation RequiredInputRepresentation(int index) const {
856 return Representation::Tagged(); 871 return Representation::Tagged();
857 } 872 }
858 873
874 virtual void PrintDataTo(StringStream* stream) const;
875
859 HValue* value() const { return OperandAt(0); } 876 HValue* value() const { return OperandAt(0); }
860 virtual int OperandCount() const { return 1; } 877 virtual int OperandCount() const { return 1; }
861 virtual HValue* OperandAt(int index) const { return operands_[index]; } 878 virtual HValue* OperandAt(int index) const { return operands_[index]; }
862 879
863 DECLARE_INSTRUCTION(UnaryControlInstruction) 880 DECLARE_INSTRUCTION(UnaryControlInstruction)
864 881
865 protected: 882 protected:
866 virtual void InternalSetOperandAt(int index, HValue* value) { 883 virtual void InternalSetOperandAt(int index, HValue* value) {
867 operands_[index] = value; 884 operands_[index] = value;
868 } 885 }
869 886
870 private: 887 private:
871 HOperandVector<1> operands_; 888 HOperandVector<1> operands_;
872 }; 889 };
873 890
874 891
875 class HBranch: public HUnaryControlInstruction { 892 class HTest: public HUnaryControlInstruction {
876 public: 893 public:
877 HBranch(HBasicBlock* true_destination, 894 HTest(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target)
878 HBasicBlock* false_destination, 895 : HUnaryControlInstruction(value, true_target, false_target) {
879 HValue* boolean_value) 896 ASSERT(true_target != NULL && false_target != NULL);
880 : HUnaryControlInstruction(boolean_value),
881 true_destination_(true_destination),
882 false_destination_(false_destination) {
883 ASSERT(true_destination != NULL && false_destination != NULL);
884 } 897 }
885 898
886 virtual Representation RequiredInputRepresentation(int index) const { 899 virtual Representation RequiredInputRepresentation(int index) const {
887 return Representation::None(); 900 return Representation::None();
888 } 901 }
889 902
890 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; } 903 DECLARE_CONCRETE_INSTRUCTION(Test, "test")
891 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; }
892
893 virtual void PrintDataTo(StringStream* stream) const;
894
895 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
896
897 private:
898 HBasicBlock* true_destination_;
899 HBasicBlock* false_destination_;
900 }; 904 };
901 905
902 906
903 class HCompareMapAndBranch: public HUnaryControlInstruction { 907 class HCompareMap: public HUnaryControlInstruction {
904 public: 908 public:
905 HCompareMapAndBranch(HValue* result, 909 HCompareMap(HValue* value,
906 Handle<Map> map, 910 Handle<Map> map,
907 HBasicBlock* true_destination, 911 HBasicBlock* true_target,
908 HBasicBlock* false_destination) 912 HBasicBlock* false_target)
909 : HUnaryControlInstruction(result), 913 : HUnaryControlInstruction(value, true_target, false_target),
910 map_(map), 914 map_(map) {
911 true_destination_(true_destination), 915 ASSERT(true_target != NULL);
912 false_destination_(false_destination) { 916 ASSERT(false_target != NULL);
913 ASSERT(true_destination != NULL);
914 ASSERT(false_destination != NULL);
915 ASSERT(!map.is_null()); 917 ASSERT(!map.is_null());
916 } 918 }
917 919
918 virtual HBasicBlock* FirstSuccessor() const { return true_destination_; }
919 virtual HBasicBlock* SecondSuccessor() const { return false_destination_; }
920
921 HBasicBlock* true_destination() const { return true_destination_; }
922 HBasicBlock* false_destination() const { return false_destination_; }
923
924 virtual void PrintDataTo(StringStream* stream) const; 920 virtual void PrintDataTo(StringStream* stream) const;
925 921
926 Handle<Map> map() const { return map_; } 922 Handle<Map> map() const { return map_; }
927 923
928 DECLARE_CONCRETE_INSTRUCTION(CompareMapAndBranch, "compare_map_and_branch") 924 DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map")
929 925
930 private: 926 private:
931 Handle<Map> map_; 927 Handle<Map> map_;
932 HBasicBlock* true_destination_;
933 HBasicBlock* false_destination_;
934 }; 928 };
935 929
936 930
937 class HReturn: public HUnaryControlInstruction { 931 class HReturn: public HUnaryControlInstruction {
938 public: 932 public:
939 explicit HReturn(HValue* result) : HUnaryControlInstruction(result) { } 933 explicit HReturn(HValue* value)
940 934 : HUnaryControlInstruction(value, NULL, NULL) {
941 virtual void PrintDataTo(StringStream* stream) const; 935 }
942 936
943 DECLARE_CONCRETE_INSTRUCTION(Return, "return") 937 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
944 }; 938 };
945 939
946 940
947 class HThrow: public HUnaryControlInstruction { 941 class HThrow: public HUnaryControlInstruction {
948 public: 942 public:
949 explicit HThrow(HValue* value) : HUnaryControlInstruction(value) { } 943 explicit HThrow(HValue* value)
950 944 : HUnaryControlInstruction(value, NULL, NULL) { }
951 virtual void PrintDataTo(StringStream* stream) const;
952 945
953 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 946 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
954 }; 947 };
955 948
956 949
957 class HUnaryOperation: public HInstruction { 950 class HUnaryOperation: public HInstruction {
958 public: 951 public:
959 explicit HUnaryOperation(HValue* value) { 952 explicit HUnaryOperation(HValue* value) {
960 SetOperandAt(0, value); 953 SetOperandAt(0, value);
961 } 954 }
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 1565
1573 class HCheckInstanceType: public HUnaryOperation { 1566 class HCheckInstanceType: public HUnaryOperation {
1574 public: 1567 public:
1575 // Check that the instance type is in the range [first, last] where 1568 // Check that the instance type is in the range [first, last] where
1576 // both first and last are included. 1569 // both first and last are included.
1577 HCheckInstanceType(HValue* value, InstanceType first, InstanceType last) 1570 HCheckInstanceType(HValue* value, InstanceType first, InstanceType last)
1578 : HUnaryOperation(value), first_(first), last_(last) { 1571 : HUnaryOperation(value), first_(first), last_(last) {
1579 ASSERT(first <= last); 1572 ASSERT(first <= last);
1580 set_representation(Representation::Tagged()); 1573 set_representation(Representation::Tagged());
1581 SetFlag(kUseGVN); 1574 SetFlag(kUseGVN);
1575 if ((FIRST_STRING_TYPE < first && last <= LAST_STRING_TYPE) ||
1576 (FIRST_STRING_TYPE <= first && last < LAST_STRING_TYPE)) {
1577 // A particular string instance type can change because of GC or
1578 // externalization, but the value still remains a string.
1579 SetFlag(kDependsOnMaps);
1580 }
1582 } 1581 }
1583 1582
1584 virtual bool IsCheckInstruction() const { return true; } 1583 virtual bool IsCheckInstruction() const { return true; }
1585 1584
1586 virtual Representation RequiredInputRepresentation(int index) const { 1585 virtual Representation RequiredInputRepresentation(int index) const {
1587 return Representation::Tagged(); 1586 return Representation::Tagged();
1588 } 1587 }
1589 1588
1590 #ifdef DEBUG 1589 #ifdef DEBUG
1591 virtual void Verify() const; 1590 virtual void Verify() const;
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 HValue* length() const { return right(); } 2025 HValue* length() const { return right(); }
2027 2026
2028 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check") 2027 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check")
2029 }; 2028 };
2030 2029
2031 2030
2032 class HBitwiseBinaryOperation: public HBinaryOperation { 2031 class HBitwiseBinaryOperation: public HBinaryOperation {
2033 public: 2032 public:
2034 HBitwiseBinaryOperation(HValue* left, HValue* right) 2033 HBitwiseBinaryOperation(HValue* left, HValue* right)
2035 : HBinaryOperation(left, right) { 2034 : HBinaryOperation(left, right) {
2036 // Default to truncating, Integer32, UseGVN. 2035 set_representation(Representation::Tagged());
2037 set_representation(Representation::Integer32()); 2036 SetFlag(kFlexibleRepresentation);
2038 SetFlag(kTruncatingToInt32); 2037 SetFlagMask(AllSideEffects());
2039 SetFlag(kUseGVN);
2040 } 2038 }
2041 2039
2042 virtual Representation RequiredInputRepresentation(int index) const { 2040 virtual Representation RequiredInputRepresentation(int index) const {
2043 return Representation::Integer32(); 2041 return representation();
2044 } 2042 }
2045 2043
2044 virtual void RepresentationChanged(Representation to) {
2045 if (!to.IsTagged()) {
2046 ASSERT(to.IsInteger32());
2047 ClearFlagMask(AllSideEffects());
2048 SetFlag(kTruncatingToInt32);
2049 SetFlag(kUseGVN);
2050 }
2051 }
2052
2053 HType CalculateInferredType() const;
2054
2046 DECLARE_INSTRUCTION(BitwiseBinaryOperation) 2055 DECLARE_INSTRUCTION(BitwiseBinaryOperation)
2047 }; 2056 };
2048 2057
2049 2058
2050 class HArithmeticBinaryOperation: public HBinaryOperation { 2059 class HArithmeticBinaryOperation: public HBinaryOperation {
2051 public: 2060 public:
2052 HArithmeticBinaryOperation(HValue* left, HValue* right) 2061 HArithmeticBinaryOperation(HValue* left, HValue* right)
2053 : HBinaryOperation(left, right) { 2062 : HBinaryOperation(left, right) {
2054 set_representation(Representation::Tagged()); 2063 set_representation(Representation::Tagged());
2055 SetFlag(kFlexibleRepresentation); 2064 SetFlag(kFlexibleRepresentation);
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
2930 public: 2939 public:
2931 HStoreKeyedGeneric(HValue* obj, HValue* key, HValue* val) 2940 HStoreKeyedGeneric(HValue* obj, HValue* key, HValue* val)
2932 : HStoreKeyed(obj, key, val) { 2941 : HStoreKeyed(obj, key, val) {
2933 SetFlagMask(AllSideEffects()); 2942 SetFlagMask(AllSideEffects());
2934 } 2943 }
2935 2944
2936 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic") 2945 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic")
2937 }; 2946 };
2938 2947
2939 2948
2949 class HStringCharCodeAt: public HBinaryOperation {
2950 public:
2951 HStringCharCodeAt(HValue* string, HValue* index)
2952 : HBinaryOperation(string, index) {
2953 set_representation(Representation::Integer32());
2954 SetFlag(kUseGVN);
2955 }
2956
2957 virtual Representation RequiredInputRepresentation(int index) const {
2958 // The index is supposed to be Integer32.
2959 return (index == 1) ? Representation::Integer32()
2960 : Representation::Tagged();
2961 }
2962
2963 virtual bool DataEquals(HValue* other) const { return true; }
2964
2965 HValue* string() const { return OperandAt(0); }
2966 HValue* index() const { return OperandAt(1); }
2967
2968 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string_char_code_at")
2969
2970 protected:
2971 virtual Range* InferRange() {
2972 return new Range(0, String::kMaxUC16CharCode);
2973 }
2974 };
2975
2976
2977 class HStringLength: public HUnaryOperation {
2978 public:
2979 explicit HStringLength(HValue* string) : HUnaryOperation(string) {
2980 set_representation(Representation::Tagged());
2981 SetFlag(kUseGVN);
2982 }
2983
2984 virtual Representation RequiredInputRepresentation(int index) const {
2985 return Representation::Tagged();
2986 }
2987
2988 virtual HType CalculateInferredType() const {
2989 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
2990 return HType::Smi();
2991 }
2992
2993 virtual bool DataEquals(HValue* other) const { return true; }
2994
2995 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string_length")
2996
2997 protected:
2998 virtual Range* InferRange() {
2999 return new Range(0, String::kMaxLength);
3000 }
3001 };
3002
3003
2940 class HMaterializedLiteral: public HInstruction { 3004 class HMaterializedLiteral: public HInstruction {
2941 public: 3005 public:
2942 HMaterializedLiteral(int index, int depth) 3006 HMaterializedLiteral(int index, int depth)
2943 : literal_index_(index), depth_(depth) { 3007 : literal_index_(index), depth_(depth) {
2944 set_representation(Representation::Tagged()); 3008 set_representation(Representation::Tagged());
2945 } 3009 }
2946 3010
2947 int literal_index() const { return literal_index_; } 3011 int literal_index() const { return literal_index_; }
2948 int depth() const { return depth_; } 3012 int depth() const { return depth_; }
2949 3013
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 HValue* object() const { return left(); } 3140 HValue* object() const { return left(); }
3077 HValue* key() const { return right(); } 3141 HValue* key() const { return right(); }
3078 }; 3142 };
3079 3143
3080 #undef DECLARE_INSTRUCTION 3144 #undef DECLARE_INSTRUCTION
3081 #undef DECLARE_CONCRETE_INSTRUCTION 3145 #undef DECLARE_CONCRETE_INSTRUCTION
3082 3146
3083 } } // namespace v8::internal 3147 } } // namespace v8::internal
3084 3148
3085 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3149 #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