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

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

Issue 7535004: Merge bleeding edge up to 8774 into the GC branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 4 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 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 V(IsSmiAndBranch) \ 124 V(IsSmiAndBranch) \
125 V(IsUndetectableAndBranch) \ 125 V(IsUndetectableAndBranch) \
126 V(JSArrayLength) \ 126 V(JSArrayLength) \
127 V(LeaveInlined) \ 127 V(LeaveInlined) \
128 V(LoadContextSlot) \ 128 V(LoadContextSlot) \
129 V(LoadElements) \ 129 V(LoadElements) \
130 V(LoadExternalArrayPointer) \ 130 V(LoadExternalArrayPointer) \
131 V(LoadFunctionPrototype) \ 131 V(LoadFunctionPrototype) \
132 V(LoadGlobalCell) \ 132 V(LoadGlobalCell) \
133 V(LoadGlobalGeneric) \ 133 V(LoadGlobalGeneric) \
134 V(LoadKeyedFastDoubleElement) \
134 V(LoadKeyedFastElement) \ 135 V(LoadKeyedFastElement) \
135 V(LoadKeyedGeneric) \ 136 V(LoadKeyedGeneric) \
136 V(LoadKeyedSpecializedArrayElement) \ 137 V(LoadKeyedSpecializedArrayElement) \
137 V(LoadNamedField) \ 138 V(LoadNamedField) \
138 V(LoadNamedFieldPolymorphic) \ 139 V(LoadNamedFieldPolymorphic) \
139 V(LoadNamedGeneric) \ 140 V(LoadNamedGeneric) \
140 V(Mod) \ 141 V(Mod) \
141 V(Mul) \ 142 V(Mul) \
142 V(ObjectLiteral) \ 143 V(ObjectLiteral) \
143 V(OsrEntry) \ 144 V(OsrEntry) \
144 V(OuterContext) \ 145 V(OuterContext) \
145 V(Parameter) \ 146 V(Parameter) \
146 V(Power) \ 147 V(Power) \
147 V(PushArgument) \ 148 V(PushArgument) \
148 V(RegExpLiteral) \ 149 V(RegExpLiteral) \
149 V(Return) \ 150 V(Return) \
150 V(Sar) \ 151 V(Sar) \
151 V(Shl) \ 152 V(Shl) \
152 V(Shr) \ 153 V(Shr) \
153 V(Simulate) \ 154 V(Simulate) \
154 V(SoftDeoptimize) \ 155 V(SoftDeoptimize) \
155 V(StackCheck) \ 156 V(StackCheck) \
156 V(StoreContextSlot) \ 157 V(StoreContextSlot) \
157 V(StoreGlobalCell) \ 158 V(StoreGlobalCell) \
158 V(StoreGlobalGeneric) \ 159 V(StoreGlobalGeneric) \
160 V(StoreKeyedFastDoubleElement) \
159 V(StoreKeyedFastElement) \ 161 V(StoreKeyedFastElement) \
160 V(StoreKeyedGeneric) \ 162 V(StoreKeyedGeneric) \
161 V(StoreKeyedSpecializedArrayElement) \ 163 V(StoreKeyedSpecializedArrayElement) \
162 V(StoreNamedField) \ 164 V(StoreNamedField) \
163 V(StoreNamedGeneric) \ 165 V(StoreNamedGeneric) \
164 V(StringAdd) \ 166 V(StringAdd) \
165 V(StringCharCodeAt) \ 167 V(StringCharCodeAt) \
166 V(StringCharFromCode) \ 168 V(StringCharFromCode) \
167 V(StringLength) \ 169 V(StringLength) \
168 V(Sub) \ 170 V(Sub) \
169 V(ThisFunction) \ 171 V(ThisFunction) \
170 V(Throw) \ 172 V(Throw) \
171 V(ToFastProperties) \ 173 V(ToFastProperties) \
172 V(ToInt32) \ 174 V(ToInt32) \
173 V(Typeof) \ 175 V(Typeof) \
174 V(TypeofIsAndBranch) \ 176 V(TypeofIsAndBranch) \
175 V(UnaryMathOperation) \ 177 V(UnaryMathOperation) \
176 V(UnknownOSRValue) \ 178 V(UnknownOSRValue) \
177 V(UseConst) \ 179 V(UseConst) \
178 V(ValueOf) 180 V(ValueOf)
179 181
180 #define GVN_FLAG_LIST(V) \ 182 #define GVN_FLAG_LIST(V) \
181 V(Calls) \ 183 V(Calls) \
182 V(InobjectFields) \ 184 V(InobjectFields) \
183 V(BackingStoreFields) \ 185 V(BackingStoreFields) \
184 V(ArrayElements) \ 186 V(ArrayElements) \
187 V(DoubleArrayElements) \
185 V(SpecializedArrayElements) \ 188 V(SpecializedArrayElements) \
186 V(GlobalVars) \ 189 V(GlobalVars) \
187 V(Maps) \ 190 V(Maps) \
188 V(ArrayLengths) \ 191 V(ArrayLengths) \
189 V(ContextSlots) \ 192 V(ContextSlots) \
190 V(OsrEntries) 193 V(OsrEntries)
191 194
192 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ 195 #define DECLARE_ABSTRACT_INSTRUCTION(type) \
193 virtual bool Is##type() const { return true; } \ 196 virtual bool Is##type() const { return true; } \
194 static H##type* cast(HValue* value) { \ 197 static H##type* cast(HValue* value) { \
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 type_ = type; 584 type_ = type;
582 } 585 }
583 586
584 // An operation needs to override this function iff: 587 // An operation needs to override this function iff:
585 // 1) it can produce an int32 output. 588 // 1) it can produce an int32 output.
586 // 2) the true value of its output can potentially be minus zero. 589 // 2) the true value of its output can potentially be minus zero.
587 // The implementation must set a flag so that it bails out in the case where 590 // The implementation must set a flag so that it bails out in the case where
588 // it would otherwise output what should be a minus zero as an int32 zero. 591 // it would otherwise output what should be a minus zero as an int32 zero.
589 // If the operation also exists in a form that takes int32 and outputs int32 592 // If the operation also exists in a form that takes int32 and outputs int32
590 // then the operation should return its input value so that we can propagate 593 // then the operation should return its input value so that we can propagate
591 // back. There are two operations that need to propagate back to more than 594 // back. There are three operations that need to propagate back to more than
592 // one input. They are phi and binary add. They always return NULL and 595 // one input. They are phi and binary div and mul. They always return NULL
593 // expect the caller to take care of things. 596 // and expect the caller to take care of things.
594 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { 597 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) {
595 visited->Add(id()); 598 visited->Add(id());
596 return NULL; 599 return NULL;
597 } 600 }
598 601
599 bool IsDefinedAfter(HBasicBlock* other) const; 602 bool IsDefinedAfter(HBasicBlock* other) const;
600 603
601 // Operands. 604 // Operands.
602 virtual int OperandCount() = 0; 605 virtual int OperandCount() = 0;
603 virtual HValue* OperandAt(int index) = 0; 606 virtual HValue* OperandAt(int index) = 0;
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 } 927 }
925 928
926 virtual void PrintDataTo(StringStream* stream); 929 virtual void PrintDataTo(StringStream* stream);
927 930
928 HValue* value() { return OperandAt(0); } 931 HValue* value() { return OperandAt(0); }
929 }; 932 };
930 933
931 934
932 class HBranch: public HUnaryControlInstruction { 935 class HBranch: public HUnaryControlInstruction {
933 public: 936 public:
934 HBranch(HValue* value, HBasicBlock* true_target, HBasicBlock* false_target) 937 HBranch(HValue* value,
935 : HUnaryControlInstruction(value, true_target, false_target) { 938 HBasicBlock* true_target,
939 HBasicBlock* false_target,
940 ToBooleanStub::Types expected_input_types = ToBooleanStub::no_types())
941 : HUnaryControlInstruction(value, true_target, false_target),
942 expected_input_types_(expected_input_types) {
936 ASSERT(true_target != NULL && false_target != NULL); 943 ASSERT(true_target != NULL && false_target != NULL);
937 } 944 }
938 explicit HBranch(HValue* value) 945 explicit HBranch(HValue* value)
939 : HUnaryControlInstruction(value, NULL, NULL) { } 946 : HUnaryControlInstruction(value, NULL, NULL) { }
940 947
941 948
942 virtual Representation RequiredInputRepresentation(int index) const { 949 virtual Representation RequiredInputRepresentation(int index) const {
943 return Representation::None(); 950 return Representation::None();
944 } 951 }
945 952
953 ToBooleanStub::Types expected_input_types() const {
954 return expected_input_types_;
955 }
956
946 DECLARE_CONCRETE_INSTRUCTION(Branch) 957 DECLARE_CONCRETE_INSTRUCTION(Branch)
958
959 private:
960 ToBooleanStub::Types expected_input_types_;
947 }; 961 };
948 962
949 963
950 class HCompareMap: public HUnaryControlInstruction { 964 class HCompareMap: public HUnaryControlInstruction {
951 public: 965 public:
952 HCompareMap(HValue* value, 966 HCompareMap(HValue* value,
953 Handle<Map> map, 967 Handle<Map> map,
954 HBasicBlock* true_target, 968 HBasicBlock* true_target,
955 HBasicBlock* false_target) 969 HBasicBlock* false_target)
956 : HUnaryControlInstruction(value, true_target, false_target), 970 : HUnaryControlInstruction(value, true_target, false_target),
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 1130
1117 private: 1131 private:
1118 Representation from_; 1132 Representation from_;
1119 bool deoptimize_on_undefined_; 1133 bool deoptimize_on_undefined_;
1120 }; 1134 };
1121 1135
1122 1136
1123 class HClampToUint8: public HUnaryOperation { 1137 class HClampToUint8: public HUnaryOperation {
1124 public: 1138 public:
1125 explicit HClampToUint8(HValue* value) 1139 explicit HClampToUint8(HValue* value)
1126 : HUnaryOperation(value), 1140 : HUnaryOperation(value) {
1127 input_rep_(Representation::None()) { 1141 set_representation(Representation::Integer32());
1128 SetFlag(kFlexibleRepresentation);
1129 set_representation(Representation::Tagged());
1130 SetFlag(kUseGVN); 1142 SetFlag(kUseGVN);
1131 } 1143 }
1132 1144
1133 virtual Representation RequiredInputRepresentation(int index) const { 1145 virtual Representation RequiredInputRepresentation(int index) const {
1134 return input_rep_; 1146 return Representation::None();
1135 }
1136
1137 virtual Representation InferredRepresentation() {
1138 // TODO(danno): Inference on input types should happen separately from
1139 // return representation.
1140 Representation new_rep = value()->representation();
1141 if (input_rep_.IsNone()) {
1142 if (!new_rep.IsNone()) {
1143 input_rep_ = new_rep;
1144 return Representation::Integer32();
1145 } else {
1146 return Representation::None();
1147 }
1148 } else {
1149 return Representation::Integer32();
1150 }
1151 } 1147 }
1152 1148
1153 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) 1149 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8)
1154 1150
1155 protected: 1151 protected:
1156 virtual bool DataEquals(HValue* other) { return true; } 1152 virtual bool DataEquals(HValue* other) { return true; }
1157
1158 private:
1159 Representation input_rep_;
1160 }; 1153 };
1161 1154
1162 1155
1163 class HToInt32: public HUnaryOperation { 1156 class HToInt32: public HUnaryOperation {
1164 public: 1157 public:
1165 explicit HToInt32(HValue* value) 1158 explicit HToInt32(HValue* value)
1166 : HUnaryOperation(value) { 1159 : HUnaryOperation(value) {
1167 set_representation(Representation::Integer32()); 1160 set_representation(Representation::Integer32());
1168 SetFlag(kUseGVN); 1161 SetFlag(kUseGVN);
1169 } 1162 }
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 } 1668 }
1676 1669
1677 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) 1670 DECLARE_CONCRETE_INSTRUCTION(CallRuntime)
1678 1671
1679 private: 1672 private:
1680 const Runtime::Function* c_function_; 1673 const Runtime::Function* c_function_;
1681 Handle<String> name_; 1674 Handle<String> name_;
1682 }; 1675 };
1683 1676
1684 1677
1685 class HJSArrayLength: public HUnaryOperation { 1678 class HJSArrayLength: public HTemplateInstruction<2> {
1686 public: 1679 public:
1687 explicit HJSArrayLength(HValue* value) : HUnaryOperation(value) { 1680 HJSArrayLength(HValue* value, HValue* typecheck) {
1688 // The length of an array is stored as a tagged value in the array 1681 // The length of an array is stored as a tagged value in the array
1689 // object. It is guaranteed to be 32 bit integer, but it can be 1682 // object. It is guaranteed to be 32 bit integer, but it can be
1690 // represented as either a smi or heap number. 1683 // represented as either a smi or heap number.
1684 SetOperandAt(0, value);
1685 SetOperandAt(1, typecheck);
1691 set_representation(Representation::Tagged()); 1686 set_representation(Representation::Tagged());
1692 SetFlag(kUseGVN); 1687 SetFlag(kUseGVN);
1693 SetFlag(kDependsOnArrayLengths); 1688 SetFlag(kDependsOnArrayLengths);
1694 SetFlag(kDependsOnMaps); 1689 SetFlag(kDependsOnMaps);
1695 } 1690 }
1696 1691
1697 virtual Representation RequiredInputRepresentation(int index) const { 1692 virtual Representation RequiredInputRepresentation(int index) const {
1698 return Representation::Tagged(); 1693 return Representation::Tagged();
1699 } 1694 }
1700 1695
1696 HValue* value() { return OperandAt(0); }
1697
1701 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) 1698 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength)
1702 1699
1703 protected: 1700 protected:
1704 virtual bool DataEquals(HValue* other) { return true; } 1701 virtual bool DataEquals(HValue* other) { return true; }
1705 }; 1702 };
1706 1703
1707 1704
1708 class HFixedArrayLength: public HUnaryOperation { 1705 class HFixedArrayLength: public HUnaryOperation {
1709 public: 1706 public:
1710 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { 1707 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 return Representation::Tagged(); 1903 return Representation::Tagged();
1907 } 1904 }
1908 1905
1909 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) 1906 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer)
1910 1907
1911 protected: 1908 protected:
1912 virtual bool DataEquals(HValue* other) { return true; } 1909 virtual bool DataEquals(HValue* other) { return true; }
1913 }; 1910 };
1914 1911
1915 1912
1916 class HCheckMap: public HUnaryOperation { 1913 class HCheckMap: public HTemplateInstruction<2> {
1917 public: 1914 public:
1918 HCheckMap(HValue* value, Handle<Map> map) 1915 HCheckMap(HValue* value, Handle<Map> map, HValue* typecheck = NULL)
1919 : HUnaryOperation(value), map_(map) { 1916 : map_(map) {
1917 SetOperandAt(0, value);
1918 // If callers don't depend on a typecheck, they can pass in NULL. In that
1919 // case we use a copy of the |value| argument as a dummy value.
1920 SetOperandAt(1, typecheck != NULL ? typecheck : value);
1920 set_representation(Representation::Tagged()); 1921 set_representation(Representation::Tagged());
1921 SetFlag(kUseGVN); 1922 SetFlag(kUseGVN);
1922 SetFlag(kDependsOnMaps); 1923 SetFlag(kDependsOnMaps);
1923 } 1924 }
1924 1925
1925 virtual Representation RequiredInputRepresentation(int index) const { 1926 virtual Representation RequiredInputRepresentation(int index) const {
1926 return Representation::Tagged(); 1927 return Representation::Tagged();
1927 } 1928 }
1928 virtual void PrintDataTo(StringStream* stream); 1929 virtual void PrintDataTo(StringStream* stream);
1929 virtual HType CalculateInferredType(); 1930 virtual HType CalculateInferredType();
1930 1931
1931 #ifdef DEBUG 1932 HValue* value() { return OperandAt(0); }
1932 virtual void Verify();
1933 #endif
1934
1935 Handle<Map> map() const { return map_; } 1933 Handle<Map> map() const { return map_; }
1936 1934
1937 DECLARE_CONCRETE_INSTRUCTION(CheckMap) 1935 DECLARE_CONCRETE_INSTRUCTION(CheckMap)
1938 1936
1939 protected: 1937 protected:
1940 virtual bool DataEquals(HValue* other) { 1938 virtual bool DataEquals(HValue* other) {
1941 HCheckMap* b = HCheckMap::cast(other); 1939 HCheckMap* b = HCheckMap::cast(other);
1942 return map_.is_identical_to(b->map()); 1940 return map_.is_identical_to(b->map());
1943 } 1941 }
1944 1942
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 return new HCheckInstanceType(value, IS_STRING); 1990 return new HCheckInstanceType(value, IS_STRING);
1993 } 1991 }
1994 static HCheckInstanceType* NewIsSymbol(HValue* value) { 1992 static HCheckInstanceType* NewIsSymbol(HValue* value) {
1995 return new HCheckInstanceType(value, IS_SYMBOL); 1993 return new HCheckInstanceType(value, IS_SYMBOL);
1996 } 1994 }
1997 1995
1998 virtual Representation RequiredInputRepresentation(int index) const { 1996 virtual Representation RequiredInputRepresentation(int index) const {
1999 return Representation::Tagged(); 1997 return Representation::Tagged();
2000 } 1998 }
2001 1999
2002 #ifdef DEBUG
2003 virtual void Verify();
2004 #endif
2005
2006 virtual HValue* Canonicalize(); 2000 virtual HValue* Canonicalize();
2007 2001
2008 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } 2002 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; }
2009 void GetCheckInterval(InstanceType* first, InstanceType* last); 2003 void GetCheckInterval(InstanceType* first, InstanceType* last);
2010 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); 2004 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag);
2011 2005
2012 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) 2006 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType)
2013 2007
2014 protected: 2008 protected:
2015 // TODO(ager): It could be nice to allow the ommision of instance 2009 // TODO(ager): It could be nice to allow the ommision of instance
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 SetOperandAt(0, index); 2464 SetOperandAt(0, index);
2471 SetOperandAt(1, length); 2465 SetOperandAt(1, length);
2472 set_representation(Representation::Integer32()); 2466 set_representation(Representation::Integer32());
2473 SetFlag(kUseGVN); 2467 SetFlag(kUseGVN);
2474 } 2468 }
2475 2469
2476 virtual Representation RequiredInputRepresentation(int index) const { 2470 virtual Representation RequiredInputRepresentation(int index) const {
2477 return Representation::Integer32(); 2471 return Representation::Integer32();
2478 } 2472 }
2479 2473
2480 #ifdef DEBUG
2481 virtual void Verify();
2482 #endif
2483
2484 HValue* index() { return OperandAt(0); } 2474 HValue* index() { return OperandAt(0); }
2485 HValue* length() { return OperandAt(1); } 2475 HValue* length() { return OperandAt(1); }
2486 2476
2487 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) 2477 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck)
2488 2478
2489 protected: 2479 protected:
2490 virtual bool DataEquals(HValue* other) { return true; } 2480 virtual bool DataEquals(HValue* other) { return true; }
2491 }; 2481 };
2492 2482
2493 2483
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 protected: 3065 protected:
3076 virtual bool DataEquals(HValue* other) { return true; } 3066 virtual bool DataEquals(HValue* other) { return true; }
3077 }; 3067 };
3078 3068
3079 3069
3080 class HShr: public HBitwiseBinaryOperation { 3070 class HShr: public HBitwiseBinaryOperation {
3081 public: 3071 public:
3082 HShr(HValue* context, HValue* left, HValue* right) 3072 HShr(HValue* context, HValue* left, HValue* right)
3083 : HBitwiseBinaryOperation(context, left, right) { } 3073 : HBitwiseBinaryOperation(context, left, right) { }
3084 3074
3075 virtual Range* InferRange();
3085 virtual HType CalculateInferredType(); 3076 virtual HType CalculateInferredType();
3086 3077
3087 DECLARE_CONCRETE_INSTRUCTION(Shr) 3078 DECLARE_CONCRETE_INSTRUCTION(Shr)
3088 3079
3089 protected: 3080 protected:
3090 virtual bool DataEquals(HValue* other) { return true; } 3081 virtual bool DataEquals(HValue* other) { return true; }
3091 }; 3082 };
3092 3083
3093 3084
3094 class HSar: public HBitwiseBinaryOperation { 3085 class HSar: public HBitwiseBinaryOperation {
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
3534 3525
3535 bool RequiresHoleCheck() const; 3526 bool RequiresHoleCheck() const;
3536 3527
3537 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) 3528 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement)
3538 3529
3539 protected: 3530 protected:
3540 virtual bool DataEquals(HValue* other) { return true; } 3531 virtual bool DataEquals(HValue* other) { return true; }
3541 }; 3532 };
3542 3533
3543 3534
3535 class HLoadKeyedFastDoubleElement: public HTemplateInstruction<2> {
3536 public:
3537 HLoadKeyedFastDoubleElement(HValue* elements, HValue* key) {
3538 SetOperandAt(0, elements);
3539 SetOperandAt(1, key);
3540 set_representation(Representation::Double());
3541 SetFlag(kDependsOnDoubleArrayElements);
3542 SetFlag(kUseGVN);
3543 }
3544
3545 HValue* elements() { return OperandAt(0); }
3546 HValue* key() { return OperandAt(1); }
3547
3548 virtual Representation RequiredInputRepresentation(int index) const {
3549 // The key is supposed to be Integer32.
3550 return index == 0
3551 ? Representation::Tagged()
3552 : Representation::Integer32();
3553 }
3554
3555 virtual void PrintDataTo(StringStream* stream);
3556
3557 bool RequiresHoleCheck() const;
3558
3559 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement)
3560
3561 protected:
3562 virtual bool DataEquals(HValue* other) { return true; }
3563 };
3564
3565
3544 class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> { 3566 class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> {
3545 public: 3567 public:
3546 HLoadKeyedSpecializedArrayElement(HValue* external_elements, 3568 HLoadKeyedSpecializedArrayElement(HValue* external_elements,
3547 HValue* key, 3569 HValue* key,
3548 JSObject::ElementsKind elements_kind) 3570 JSObject::ElementsKind elements_kind)
3549 : elements_kind_(elements_kind) { 3571 : elements_kind_(elements_kind) {
3550 SetOperandAt(0, external_elements); 3572 SetOperandAt(0, external_elements);
3551 SetOperandAt(1, key); 3573 SetOperandAt(1, key);
3552 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS || 3574 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS ||
3553 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 3575 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
3719 bool NeedsWriteBarrier() { 3741 bool NeedsWriteBarrier() {
3720 return StoringValueNeedsWriteBarrier(value()); 3742 return StoringValueNeedsWriteBarrier(value());
3721 } 3743 }
3722 3744
3723 virtual void PrintDataTo(StringStream* stream); 3745 virtual void PrintDataTo(StringStream* stream);
3724 3746
3725 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement) 3747 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement)
3726 }; 3748 };
3727 3749
3728 3750
3751 class HStoreKeyedFastDoubleElement: public HTemplateInstruction<3> {
3752 public:
3753 HStoreKeyedFastDoubleElement(HValue* elements,
3754 HValue* key,
3755 HValue* val) {
3756 SetOperandAt(0, elements);
3757 SetOperandAt(1, key);
3758 SetOperandAt(2, val);
3759 SetFlag(kChangesDoubleArrayElements);
3760 }
3761
3762 virtual Representation RequiredInputRepresentation(int index) const {
3763 if (index == 1) {
3764 return Representation::Integer32();
3765 } else if (index == 2) {
3766 return Representation::Double();
3767 } else {
3768 return Representation::Tagged();
3769 }
3770 }
3771
3772 HValue* elements() { return OperandAt(0); }
3773 HValue* key() { return OperandAt(1); }
3774 HValue* value() { return OperandAt(2); }
3775
3776 bool NeedsWriteBarrier() {
3777 return StoringValueNeedsWriteBarrier(value());
3778 }
3779
3780 virtual void PrintDataTo(StringStream* stream);
3781
3782 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement)
3783 };
3784
3785
3729 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> { 3786 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> {
3730 public: 3787 public:
3731 HStoreKeyedSpecializedArrayElement(HValue* external_elements, 3788 HStoreKeyedSpecializedArrayElement(HValue* external_elements,
3732 HValue* key, 3789 HValue* key,
3733 HValue* val, 3790 HValue* val,
3734 JSObject::ElementsKind elements_kind) 3791 JSObject::ElementsKind elements_kind)
3735 : elements_kind_(elements_kind) { 3792 : elements_kind_(elements_kind) {
3736 SetFlag(kChangesSpecializedArrayElements); 3793 SetFlag(kChangesSpecializedArrayElements);
3737 SetOperandAt(0, external_elements); 3794 SetOperandAt(0, external_elements);
3738 SetOperandAt(1, key); 3795 SetOperandAt(1, key);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
4147 4204
4148 DECLARE_CONCRETE_INSTRUCTION(In) 4205 DECLARE_CONCRETE_INSTRUCTION(In)
4149 }; 4206 };
4150 4207
4151 #undef DECLARE_INSTRUCTION 4208 #undef DECLARE_INSTRUCTION
4152 #undef DECLARE_CONCRETE_INSTRUCTION 4209 #undef DECLARE_CONCRETE_INSTRUCTION
4153 4210
4154 } } // namespace v8::internal 4211 } } // namespace v8::internal
4155 4212
4156 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4213 #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