vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
| 29 | #define V8_HYDROGEN_INSTRUCTIONS_H_ |
| 30 | |
| 31 | #include "v8.h" |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 32 | |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 33 | #include "allocation.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 34 | #include "code-stubs.h" |
fschneider@chromium.org | fb144a0 | 2011-05-04 12:43:48 +0000 | [diff] [blame] | 35 | #include "data-flow.h" |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 36 | #include "small-pointer-list.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 37 | #include "string-stream.h" |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 38 | #include "v8conversions.h" |
| 39 | #include "v8utils.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 40 | #include "zone.h" |
| 41 | |
| 42 | namespace v8 { |
| 43 | namespace internal { |
| 44 | |
| 45 | // Forward declarations. |
| 46 | class HBasicBlock; |
| 47 | class HEnvironment; |
| 48 | class HInstruction; |
| 49 | class HLoopInformation; |
| 50 | class HValue; |
| 51 | class LInstruction; |
| 52 | class LChunkBuilder; |
| 53 | |
| 54 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 55 | #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 56 | V(BitwiseBinaryOperation) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 57 | V(ControlInstruction) \ |
| 58 | V(Instruction) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 59 | |
| 60 | |
| 61 | #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 62 | V(AbnormalExit) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 63 | V(AccessArgumentsAt) \ |
| 64 | V(Add) \ |
| 65 | V(ApplyArguments) \ |
| 66 | V(ArgumentsElements) \ |
| 67 | V(ArgumentsLength) \ |
| 68 | V(ArgumentsObject) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 69 | V(ArrayLiteral) \ |
| 70 | V(BitAnd) \ |
| 71 | V(BitNot) \ |
| 72 | V(BitOr) \ |
| 73 | V(BitXor) \ |
| 74 | V(BlockEntry) \ |
| 75 | V(BoundsCheck) \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 76 | V(Branch) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 77 | V(CallConstantFunction) \ |
| 78 | V(CallFunction) \ |
| 79 | V(CallGlobal) \ |
| 80 | V(CallKeyed) \ |
| 81 | V(CallKnownGlobal) \ |
| 82 | V(CallNamed) \ |
| 83 | V(CallNew) \ |
| 84 | V(CallRuntime) \ |
| 85 | V(CallStub) \ |
| 86 | V(Change) \ |
| 87 | V(CheckFunction) \ |
| 88 | V(CheckInstanceType) \ |
| 89 | V(CheckMap) \ |
| 90 | V(CheckNonSmi) \ |
| 91 | V(CheckPrototypeMaps) \ |
| 92 | V(CheckSmi) \ |
kmillikin@chromium.org | c53e10d | 2011-05-18 09:12:58 +0000 | [diff] [blame] | 93 | V(ClampToUint8) \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 94 | V(ClassOfTestAndBranch) \ |
| 95 | V(CompareIDAndBranch) \ |
| 96 | V(CompareGeneric) \ |
| 97 | V(CompareObjectEqAndBranch) \ |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 98 | V(CompareMap) \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 99 | V(CompareConstantEqAndBranch) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 100 | V(Constant) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 101 | V(Context) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 102 | V(DeleteProperty) \ |
| 103 | V(Deoptimize) \ |
| 104 | V(Div) \ |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 105 | V(ElementsKind) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 106 | V(EnterInlined) \ |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 107 | V(FixedArrayBaseLength) \ |
kmillikin@chromium.org | c53e10d | 2011-05-18 09:12:58 +0000 | [diff] [blame] | 108 | V(ForceRepresentation) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 109 | V(FunctionLiteral) \ |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 110 | V(GetCachedArrayIndex) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 111 | V(GlobalObject) \ |
| 112 | V(GlobalReceiver) \ |
| 113 | V(Goto) \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 114 | V(HasCachedArrayIndexAndBranch) \ |
| 115 | V(HasInstanceTypeAndBranch) \ |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 116 | V(In) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 117 | V(InstanceOf) \ |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 118 | V(InstanceOfKnownGlobal) \ |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 119 | V(InvokeFunction) \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 120 | V(IsConstructCallAndBranch) \ |
| 121 | V(IsNullAndBranch) \ |
| 122 | V(IsObjectAndBranch) \ |
| 123 | V(IsSmiAndBranch) \ |
| 124 | V(IsUndetectableAndBranch) \ |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 125 | V(JSArrayLength) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 126 | V(LeaveInlined) \ |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 127 | V(LoadContextSlot) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 128 | V(LoadElements) \ |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 129 | V(LoadExternalArrayPointer) \ |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 130 | V(LoadFunctionPrototype) \ |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 131 | V(LoadGlobalCell) \ |
| 132 | V(LoadGlobalGeneric) \ |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 133 | V(LoadKeyedFastDoubleElement) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 134 | V(LoadKeyedFastElement) \ |
| 135 | V(LoadKeyedGeneric) \ |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 136 | V(LoadKeyedSpecializedArrayElement) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 137 | V(LoadNamedField) \ |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 138 | V(LoadNamedFieldPolymorphic) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 139 | V(LoadNamedGeneric) \ |
| 140 | V(Mod) \ |
| 141 | V(Mul) \ |
| 142 | V(ObjectLiteral) \ |
| 143 | V(OsrEntry) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 144 | V(OuterContext) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 145 | V(Parameter) \ |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 146 | V(Power) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 147 | V(PushArgument) \ |
| 148 | V(RegExpLiteral) \ |
| 149 | V(Return) \ |
| 150 | V(Sar) \ |
| 151 | V(Shl) \ |
| 152 | V(Shr) \ |
| 153 | V(Simulate) \ |
jkummerow@chromium.org | e297f59 | 2011-06-08 10:05:15 +0000 | [diff] [blame] | 154 | V(SoftDeoptimize) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 155 | V(StackCheck) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 156 | V(StoreContextSlot) \ |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 157 | V(StoreGlobalCell) \ |
| 158 | V(StoreGlobalGeneric) \ |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 159 | V(StoreKeyedFastDoubleElement) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 160 | V(StoreKeyedFastElement) \ |
| 161 | V(StoreKeyedGeneric) \ |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 162 | V(StoreKeyedSpecializedArrayElement) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 163 | V(StoreNamedField) \ |
| 164 | V(StoreNamedGeneric) \ |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 165 | V(StringAdd) \ |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 166 | V(StringCharCodeAt) \ |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 167 | V(StringCharFromCode) \ |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 168 | V(StringLength) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 169 | V(Sub) \ |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 170 | V(ThisFunction) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 171 | V(Throw) \ |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 172 | V(ToFastProperties) \ |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 173 | V(ToInt32) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 174 | V(Typeof) \ |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 175 | V(TypeofIsAndBranch) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 176 | V(UnaryMathOperation) \ |
| 177 | V(UnknownOSRValue) \ |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 178 | V(UseConst) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 179 | V(ValueOf) |
| 180 | |
| 181 | #define GVN_FLAG_LIST(V) \ |
| 182 | V(Calls) \ |
| 183 | V(InobjectFields) \ |
| 184 | V(BackingStoreFields) \ |
| 185 | V(ArrayElements) \ |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 186 | V(DoubleArrayElements) \ |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 187 | V(SpecializedArrayElements) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 188 | V(GlobalVars) \ |
| 189 | V(Maps) \ |
| 190 | V(ArrayLengths) \ |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 191 | V(ContextSlots) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 192 | V(OsrEntries) |
| 193 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 194 | #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 195 | virtual bool Is##type() const { return true; } \ |
| 196 | static H##type* cast(HValue* value) { \ |
| 197 | ASSERT(value->Is##type()); \ |
| 198 | return reinterpret_cast<H##type*>(value); \ |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 199 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 200 | |
| 201 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 202 | #define DECLARE_CONCRETE_INSTRUCTION(type) \ |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 203 | virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \ |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 204 | static H##type* cast(HValue* value) { \ |
| 205 | ASSERT(value->Is##type()); \ |
| 206 | return reinterpret_cast<H##type*>(value); \ |
| 207 | } \ |
| 208 | virtual Opcode opcode() const { return HValue::k##type; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 209 | |
| 210 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 211 | class Range: public ZoneObject { |
| 212 | public: |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 213 | Range() |
| 214 | : lower_(kMinInt), |
| 215 | upper_(kMaxInt), |
| 216 | next_(NULL), |
| 217 | can_be_minus_zero_(false) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 218 | |
| 219 | Range(int32_t lower, int32_t upper) |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 220 | : lower_(lower), |
| 221 | upper_(upper), |
| 222 | next_(NULL), |
| 223 | can_be_minus_zero_(false) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 224 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 225 | int32_t upper() const { return upper_; } |
| 226 | int32_t lower() const { return lower_; } |
| 227 | Range* next() const { return next_; } |
| 228 | Range* CopyClearLower() const { return new Range(kMinInt, upper_); } |
| 229 | Range* CopyClearUpper() const { return new Range(lower_, kMaxInt); } |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 230 | Range* Copy() const { |
| 231 | Range* result = new Range(lower_, upper_); |
| 232 | result->set_can_be_minus_zero(CanBeMinusZero()); |
| 233 | return result; |
| 234 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 235 | int32_t Mask() const; |
| 236 | void set_can_be_minus_zero(bool b) { can_be_minus_zero_ = b; } |
| 237 | bool CanBeMinusZero() const { return CanBeZero() && can_be_minus_zero_; } |
| 238 | bool CanBeZero() const { return upper_ >= 0 && lower_ <= 0; } |
| 239 | bool CanBeNegative() const { return lower_ < 0; } |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 240 | bool Includes(int value) const { return lower_ <= value && upper_ >= value; } |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 241 | bool IsMostGeneric() const { |
| 242 | return lower_ == kMinInt && upper_ == kMaxInt && CanBeMinusZero(); |
| 243 | } |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 244 | bool IsInSmiRange() const { |
| 245 | return lower_ >= Smi::kMinValue && upper_ <= Smi::kMaxValue; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 246 | } |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 247 | void KeepOrder(); |
| 248 | void Verify() const; |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 249 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 250 | void StackUpon(Range* other) { |
| 251 | Intersect(other); |
| 252 | next_ = other; |
| 253 | } |
| 254 | |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 255 | void Intersect(Range* other); |
| 256 | void Union(Range* other); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 257 | |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 258 | void AddConstant(int32_t value); |
| 259 | void Sar(int32_t value); |
| 260 | void Shl(int32_t value); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 261 | bool AddAndCheckOverflow(Range* other); |
| 262 | bool SubAndCheckOverflow(Range* other); |
| 263 | bool MulAndCheckOverflow(Range* other); |
| 264 | |
| 265 | private: |
| 266 | int32_t lower_; |
| 267 | int32_t upper_; |
| 268 | Range* next_; |
| 269 | bool can_be_minus_zero_; |
| 270 | }; |
| 271 | |
| 272 | |
| 273 | class Representation { |
| 274 | public: |
| 275 | enum Kind { |
| 276 | kNone, |
| 277 | kTagged, |
| 278 | kDouble, |
| 279 | kInteger32, |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 280 | kExternal, |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 281 | kNumRepresentations |
| 282 | }; |
| 283 | |
| 284 | Representation() : kind_(kNone) { } |
| 285 | |
| 286 | static Representation None() { return Representation(kNone); } |
| 287 | static Representation Tagged() { return Representation(kTagged); } |
| 288 | static Representation Integer32() { return Representation(kInteger32); } |
| 289 | static Representation Double() { return Representation(kDouble); } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 290 | static Representation External() { return Representation(kExternal); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 291 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 292 | bool Equals(const Representation& other) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 293 | return kind_ == other.kind_; |
| 294 | } |
| 295 | |
ager@chromium.org | a9aa5fa | 2011-04-13 08:46:07 +0000 | [diff] [blame] | 296 | Kind kind() const { return static_cast<Kind>(kind_); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 297 | bool IsNone() const { return kind_ == kNone; } |
| 298 | bool IsTagged() const { return kind_ == kTagged; } |
| 299 | bool IsInteger32() const { return kind_ == kInteger32; } |
| 300 | bool IsDouble() const { return kind_ == kDouble; } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 301 | bool IsExternal() const { return kind_ == kExternal; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 302 | bool IsSpecialization() const { |
| 303 | return kind_ == kInteger32 || kind_ == kDouble; |
| 304 | } |
| 305 | const char* Mnemonic() const; |
| 306 | |
| 307 | private: |
| 308 | explicit Representation(Kind k) : kind_(k) { } |
| 309 | |
ager@chromium.org | a9aa5fa | 2011-04-13 08:46:07 +0000 | [diff] [blame] | 310 | // Make sure kind fits in int8. |
| 311 | STATIC_ASSERT(kNumRepresentations <= (1 << kBitsPerByte)); |
| 312 | |
| 313 | int8_t kind_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | |
| 317 | class HType { |
| 318 | public: |
| 319 | HType() : type_(kUninitialized) { } |
| 320 | |
| 321 | static HType Tagged() { return HType(kTagged); } |
| 322 | static HType TaggedPrimitive() { return HType(kTaggedPrimitive); } |
| 323 | static HType TaggedNumber() { return HType(kTaggedNumber); } |
| 324 | static HType Smi() { return HType(kSmi); } |
| 325 | static HType HeapNumber() { return HType(kHeapNumber); } |
| 326 | static HType String() { return HType(kString); } |
| 327 | static HType Boolean() { return HType(kBoolean); } |
| 328 | static HType NonPrimitive() { return HType(kNonPrimitive); } |
| 329 | static HType JSArray() { return HType(kJSArray); } |
| 330 | static HType JSObject() { return HType(kJSObject); } |
| 331 | static HType Uninitialized() { return HType(kUninitialized); } |
| 332 | |
| 333 | // Return the weakest (least precise) common type. |
| 334 | HType Combine(HType other) { |
| 335 | return HType(static_cast<Type>(type_ & other.type_)); |
| 336 | } |
| 337 | |
| 338 | bool Equals(const HType& other) { |
| 339 | return type_ == other.type_; |
| 340 | } |
| 341 | |
| 342 | bool IsSubtypeOf(const HType& other) { |
| 343 | return Combine(other).Equals(other); |
| 344 | } |
| 345 | |
| 346 | bool IsTagged() { |
| 347 | ASSERT(type_ != kUninitialized); |
| 348 | return ((type_ & kTagged) == kTagged); |
| 349 | } |
| 350 | |
| 351 | bool IsTaggedPrimitive() { |
| 352 | ASSERT(type_ != kUninitialized); |
| 353 | return ((type_ & kTaggedPrimitive) == kTaggedPrimitive); |
| 354 | } |
| 355 | |
| 356 | bool IsTaggedNumber() { |
| 357 | ASSERT(type_ != kUninitialized); |
| 358 | return ((type_ & kTaggedNumber) == kTaggedNumber); |
| 359 | } |
| 360 | |
| 361 | bool IsSmi() { |
| 362 | ASSERT(type_ != kUninitialized); |
| 363 | return ((type_ & kSmi) == kSmi); |
| 364 | } |
| 365 | |
| 366 | bool IsHeapNumber() { |
| 367 | ASSERT(type_ != kUninitialized); |
| 368 | return ((type_ & kHeapNumber) == kHeapNumber); |
| 369 | } |
| 370 | |
| 371 | bool IsString() { |
| 372 | ASSERT(type_ != kUninitialized); |
| 373 | return ((type_ & kString) == kString); |
| 374 | } |
| 375 | |
| 376 | bool IsBoolean() { |
| 377 | ASSERT(type_ != kUninitialized); |
| 378 | return ((type_ & kBoolean) == kBoolean); |
| 379 | } |
| 380 | |
| 381 | bool IsNonPrimitive() { |
| 382 | ASSERT(type_ != kUninitialized); |
| 383 | return ((type_ & kNonPrimitive) == kNonPrimitive); |
| 384 | } |
| 385 | |
| 386 | bool IsJSArray() { |
| 387 | ASSERT(type_ != kUninitialized); |
| 388 | return ((type_ & kJSArray) == kJSArray); |
| 389 | } |
| 390 | |
| 391 | bool IsJSObject() { |
| 392 | ASSERT(type_ != kUninitialized); |
| 393 | return ((type_ & kJSObject) == kJSObject); |
| 394 | } |
| 395 | |
| 396 | bool IsUninitialized() { |
| 397 | return type_ == kUninitialized; |
| 398 | } |
| 399 | |
| 400 | static HType TypeFromValue(Handle<Object> value); |
| 401 | |
| 402 | const char* ToString(); |
| 403 | const char* ToShortString(); |
| 404 | |
| 405 | private: |
| 406 | enum Type { |
| 407 | kTagged = 0x1, // 0000 0000 0000 0001 |
| 408 | kTaggedPrimitive = 0x5, // 0000 0000 0000 0101 |
| 409 | kTaggedNumber = 0xd, // 0000 0000 0000 1101 |
| 410 | kSmi = 0x1d, // 0000 0000 0001 1101 |
| 411 | kHeapNumber = 0x2d, // 0000 0000 0010 1101 |
| 412 | kString = 0x45, // 0000 0000 0100 0101 |
| 413 | kBoolean = 0x85, // 0000 0000 1000 0101 |
| 414 | kNonPrimitive = 0x101, // 0000 0001 0000 0001 |
| 415 | kJSObject = 0x301, // 0000 0011 0000 0001 |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 416 | kJSArray = 0x701, // 0000 0111 0000 0001 |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 417 | kUninitialized = 0x1fff // 0001 1111 1111 1111 |
| 418 | }; |
| 419 | |
ager@chromium.org | a9aa5fa | 2011-04-13 08:46:07 +0000 | [diff] [blame] | 420 | // Make sure type fits in int16. |
| 421 | STATIC_ASSERT(kUninitialized < (1 << (2 * kBitsPerByte))); |
| 422 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 423 | explicit HType(Type t) : type_(t) { } |
| 424 | |
ager@chromium.org | a9aa5fa | 2011-04-13 08:46:07 +0000 | [diff] [blame] | 425 | int16_t type_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 426 | }; |
| 427 | |
| 428 | |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 429 | class HUseListNode: public ZoneObject { |
| 430 | public: |
| 431 | HUseListNode(HValue* value, int index, HUseListNode* tail) |
| 432 | : tail_(tail), value_(value), index_(index) { |
| 433 | } |
| 434 | |
| 435 | HUseListNode* tail() const { return tail_; } |
| 436 | HValue* value() const { return value_; } |
| 437 | int index() const { return index_; } |
| 438 | |
| 439 | void set_tail(HUseListNode* list) { tail_ = list; } |
| 440 | |
| 441 | #ifdef DEBUG |
| 442 | void Zap() { |
| 443 | tail_ = reinterpret_cast<HUseListNode*>(1); |
| 444 | value_ = NULL; |
| 445 | index_ = -1; |
| 446 | } |
| 447 | #endif |
| 448 | |
| 449 | private: |
| 450 | HUseListNode* tail_; |
| 451 | HValue* value_; |
| 452 | int index_; |
| 453 | }; |
| 454 | |
| 455 | |
| 456 | // We reuse use list nodes behind the scenes as uses are added and deleted. |
| 457 | // This class is the safe way to iterate uses while deleting them. |
| 458 | class HUseIterator BASE_EMBEDDED { |
| 459 | public: |
| 460 | bool Done() { return current_ == NULL; } |
| 461 | void Advance(); |
| 462 | |
| 463 | HValue* value() { |
| 464 | ASSERT(!Done()); |
| 465 | return value_; |
| 466 | } |
| 467 | |
| 468 | int index() { |
| 469 | ASSERT(!Done()); |
| 470 | return index_; |
| 471 | } |
| 472 | |
| 473 | private: |
| 474 | explicit HUseIterator(HUseListNode* head); |
| 475 | |
| 476 | HUseListNode* current_; |
| 477 | HUseListNode* next_; |
| 478 | HValue* value_; |
| 479 | int index_; |
| 480 | |
| 481 | friend class HValue; |
| 482 | }; |
| 483 | |
| 484 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 485 | class HValue: public ZoneObject { |
| 486 | public: |
| 487 | static const int kNoNumber = -1; |
| 488 | |
| 489 | // There must be one corresponding kDepends flag for every kChanges flag and |
| 490 | // the order of the kChanges flags must be exactly the same as of the kDepends |
| 491 | // flags. |
| 492 | enum Flag { |
| 493 | // Declare global value numbering flags. |
| 494 | #define DECLARE_DO(type) kChanges##type, kDependsOn##type, |
| 495 | GVN_FLAG_LIST(DECLARE_DO) |
| 496 | #undef DECLARE_DO |
| 497 | kFlexibleRepresentation, |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 498 | // Participate in Global Value Numbering, i.e. elimination of |
| 499 | // unnecessary recomputations. If an instruction sets this flag, it must |
| 500 | // implement DataEquals(), which will be used to determine if other |
| 501 | // occurrences of the instruction are indeed the same. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 502 | kUseGVN, |
| 503 | kCanOverflow, |
| 504 | kBailoutOnMinusZero, |
| 505 | kCanBeDivByZero, |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 506 | kDeoptimizeOnUndefined, |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 507 | kIsArguments, |
| 508 | kTruncatingToInt32, |
| 509 | kLastFlag = kTruncatingToInt32 |
| 510 | }; |
| 511 | |
| 512 | STATIC_ASSERT(kLastFlag < kBitsPerInt); |
| 513 | |
| 514 | static const int kChangesToDependsFlagsLeftShift = 1; |
| 515 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 516 | static int ConvertChangesToDependsFlags(int flags) { |
| 517 | return flags << kChangesToDependsFlagsLeftShift; |
| 518 | } |
| 519 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 520 | static HValue* cast(HValue* value) { return value; } |
| 521 | |
| 522 | enum Opcode { |
| 523 | // Declare a unique enum value for each hydrogen instruction. |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 524 | #define DECLARE_OPCODE(type) k##type, |
| 525 | HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) |
| 526 | kPhi |
| 527 | #undef DECLARE_OPCODE |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 528 | }; |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 529 | virtual Opcode opcode() const = 0; |
| 530 | |
| 531 | // Declare a non-virtual predicates for each concrete HInstruction or HValue. |
| 532 | #define DECLARE_PREDICATE(type) \ |
| 533 | bool Is##type() const { return opcode() == k##type; } |
| 534 | HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) |
| 535 | #undef DECLARE_PREDICATE |
| 536 | bool IsPhi() const { return opcode() == kPhi; } |
| 537 | |
| 538 | // Declare virtual predicates for abstract HInstruction or HValue |
| 539 | #define DECLARE_PREDICATE(type) \ |
| 540 | virtual bool Is##type() const { return false; } |
| 541 | HYDROGEN_ABSTRACT_INSTRUCTION_LIST(DECLARE_PREDICATE) |
| 542 | #undef DECLARE_PREDICATE |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 543 | |
| 544 | HValue() : block_(NULL), |
| 545 | id_(kNoNumber), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 546 | type_(HType::Tagged()), |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 547 | use_list_(NULL), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 548 | range_(NULL), |
| 549 | flags_(0) {} |
| 550 | virtual ~HValue() {} |
| 551 | |
| 552 | HBasicBlock* block() const { return block_; } |
| 553 | void SetBlock(HBasicBlock* block); |
| 554 | |
| 555 | int id() const { return id_; } |
| 556 | void set_id(int id) { id_ = id; } |
| 557 | |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 558 | HUseIterator uses() const { return HUseIterator(use_list_); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 559 | |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 560 | virtual bool EmitAtUses() { return false; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 561 | Representation representation() const { return representation_; } |
| 562 | void ChangeRepresentation(Representation r) { |
| 563 | // Representation was already set and is allowed to be changed. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 564 | ASSERT(!r.IsNone()); |
| 565 | ASSERT(CheckFlag(kFlexibleRepresentation)); |
| 566 | RepresentationChanged(r); |
| 567 | representation_ = r; |
| 568 | } |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 569 | void AssumeRepresentation(Representation r); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 570 | |
fschneider@chromium.org | fb144a0 | 2011-05-04 12:43:48 +0000 | [diff] [blame] | 571 | virtual bool IsConvertibleToInteger() const { return true; } |
| 572 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 573 | HType type() const { return type_; } |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 574 | void set_type(HType new_type) { |
| 575 | ASSERT(new_type.IsSubtypeOf(type_)); |
| 576 | type_ = new_type; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | // An operation needs to override this function iff: |
| 580 | // 1) it can produce an int32 output. |
| 581 | // 2) the true value of its output can potentially be minus zero. |
| 582 | // The implementation must set a flag so that it bails out in the case where |
| 583 | // it would otherwise output what should be a minus zero as an int32 zero. |
| 584 | // If the operation also exists in a form that takes int32 and outputs int32 |
| 585 | // then the operation should return its input value so that we can propagate |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 586 | // back. There are three operations that need to propagate back to more than |
| 587 | // one input. They are phi and binary div and mul. They always return NULL |
| 588 | // and expect the caller to take care of things. |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 589 | virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { |
| 590 | visited->Add(id()); |
| 591 | return NULL; |
| 592 | } |
| 593 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 594 | bool IsDefinedAfter(HBasicBlock* other) const; |
| 595 | |
| 596 | // Operands. |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 597 | virtual int OperandCount() = 0; |
| 598 | virtual HValue* OperandAt(int index) = 0; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 599 | void SetOperandAt(int index, HValue* value); |
| 600 | |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 601 | void DeleteAndReplaceWith(HValue* other); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 602 | void ReplaceAllUsesWith(HValue* other); |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 603 | bool HasNoUses() const { return use_list_ == NULL; } |
| 604 | bool HasMultipleUses() const { |
| 605 | return use_list_ != NULL && use_list_->tail() != NULL; |
| 606 | } |
| 607 | int UseCount() const; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 608 | void ClearOperands(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 609 | |
| 610 | int flags() const { return flags_; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 611 | void SetFlag(Flag f) { flags_ |= (1 << f); } |
| 612 | void ClearFlag(Flag f) { flags_ &= ~(1 << f); } |
| 613 | bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } |
| 614 | |
| 615 | void SetAllSideEffects() { flags_ |= AllSideEffects(); } |
| 616 | void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); } |
| 617 | bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 618 | |
fschneider@chromium.org | 1805e21 | 2011-09-05 10:49:12 +0000 | [diff] [blame] | 619 | int ChangesFlags() const { return flags_ & ChangesFlagsMask(); } |
| 620 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 621 | Range* range() const { return range_; } |
| 622 | bool HasRange() const { return range_ != NULL; } |
| 623 | void AddNewRange(Range* r); |
| 624 | void RemoveLastAddedRange(); |
| 625 | void ComputeInitialRange(); |
| 626 | |
| 627 | // Representation helpers. |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 628 | virtual Representation RequiredInputRepresentation(int index) const = 0; |
| 629 | |
| 630 | virtual Representation InferredRepresentation() { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 631 | return representation(); |
| 632 | } |
| 633 | |
| 634 | // This gives the instruction an opportunity to replace itself with an |
| 635 | // instruction that does the same in some better way. To replace an |
| 636 | // instruction with a new one, first add the new instruction to the graph, |
| 637 | // then return it. Return NULL to have the instruction deleted. |
| 638 | virtual HValue* Canonicalize() { return this; } |
| 639 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 640 | bool Equals(HValue* other); |
| 641 | virtual intptr_t Hashcode(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 642 | |
| 643 | // Printing support. |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 644 | virtual void PrintTo(StringStream* stream) = 0; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 645 | void PrintNameTo(StringStream* stream); |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 646 | void PrintTypeTo(StringStream* stream); |
| 647 | void PrintRangeTo(StringStream* stream); |
| 648 | void PrintChangesTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 649 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 650 | const char* Mnemonic() const; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 651 | |
| 652 | // Updated the inferred type of this instruction and returns true if |
| 653 | // it has changed. |
| 654 | bool UpdateInferredType(); |
| 655 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 656 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 657 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 658 | #ifdef DEBUG |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 659 | virtual void Verify() = 0; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 660 | #endif |
| 661 | |
| 662 | protected: |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 663 | // This function must be overridden for instructions with flag kUseGVN, to |
| 664 | // compare the non-Operand parts of the instruction. |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 665 | virtual bool DataEquals(HValue* other) { |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 666 | UNREACHABLE(); |
| 667 | return false; |
| 668 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 669 | virtual void RepresentationChanged(Representation to) { } |
| 670 | virtual Range* InferRange(); |
| 671 | virtual void DeleteFromGraph() = 0; |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 672 | virtual void InternalSetOperandAt(int index, HValue* value) = 0; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 673 | void clear_block() { |
| 674 | ASSERT(block_ != NULL); |
| 675 | block_ = NULL; |
| 676 | } |
| 677 | |
| 678 | void set_representation(Representation r) { |
| 679 | // Representation is set-once. |
| 680 | ASSERT(representation_.IsNone() && !r.IsNone()); |
| 681 | representation_ = r; |
| 682 | } |
| 683 | |
| 684 | private: |
fschneider@chromium.org | 1805e21 | 2011-09-05 10:49:12 +0000 | [diff] [blame] | 685 | static int ChangesFlagsMask() { |
| 686 | int result = 0; |
| 687 | // Create changes mask. |
| 688 | #define ADD_FLAG(type) result |= (1 << kChanges##type); |
| 689 | GVN_FLAG_LIST(ADD_FLAG) |
| 690 | #undef ADD_FLAG |
| 691 | return result; |
| 692 | } |
| 693 | |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 694 | // A flag mask to mark an instruction as having arbitrary side effects. |
| 695 | static int AllSideEffects() { |
| 696 | return ChangesFlagsMask() & ~(1 << kChangesOsrEntries); |
| 697 | } |
| 698 | |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 699 | // Remove the matching use from the use list if present. Returns the |
| 700 | // removed list node or NULL. |
| 701 | HUseListNode* RemoveUse(HValue* value, int index); |
| 702 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 703 | void RegisterUse(int index, HValue* new_value); |
| 704 | |
| 705 | HBasicBlock* block_; |
| 706 | |
| 707 | // The id of this instruction in the hydrogen graph, assigned when first |
| 708 | // added to the graph. Reflects creation order. |
| 709 | int id_; |
| 710 | |
| 711 | Representation representation_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 712 | HType type_; |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 713 | HUseListNode* use_list_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 714 | Range* range_; |
| 715 | int flags_; |
| 716 | |
| 717 | DISALLOW_COPY_AND_ASSIGN(HValue); |
| 718 | }; |
| 719 | |
| 720 | |
| 721 | class HInstruction: public HValue { |
| 722 | public: |
| 723 | HInstruction* next() const { return next_; } |
| 724 | HInstruction* previous() const { return previous_; } |
| 725 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 726 | virtual void PrintTo(StringStream* stream); |
| 727 | virtual void PrintDataTo(StringStream* stream) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 728 | |
| 729 | bool IsLinked() const { return block() != NULL; } |
| 730 | void Unlink(); |
| 731 | void InsertBefore(HInstruction* next); |
| 732 | void InsertAfter(HInstruction* previous); |
| 733 | |
| 734 | int position() const { return position_; } |
| 735 | bool has_position() const { return position_ != RelocInfo::kNoPosition; } |
| 736 | void set_position(int position) { position_ = position; } |
| 737 | |
| 738 | virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
| 739 | |
| 740 | #ifdef DEBUG |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 741 | virtual void Verify(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 742 | #endif |
| 743 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 744 | virtual bool IsCall() { return false; } |
| 745 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 746 | DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 747 | |
| 748 | protected: |
| 749 | HInstruction() |
| 750 | : next_(NULL), |
| 751 | previous_(NULL), |
| 752 | position_(RelocInfo::kNoPosition) { |
| 753 | SetFlag(kDependsOnOsrEntries); |
| 754 | } |
| 755 | |
| 756 | virtual void DeleteFromGraph() { Unlink(); } |
| 757 | |
| 758 | private: |
| 759 | void InitializeAsFirst(HBasicBlock* block) { |
| 760 | ASSERT(!IsLinked()); |
| 761 | SetBlock(block); |
| 762 | } |
| 763 | |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 764 | void PrintMnemonicTo(StringStream* stream); |
| 765 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 766 | HInstruction* next_; |
| 767 | HInstruction* previous_; |
| 768 | int position_; |
| 769 | |
| 770 | friend class HBasicBlock; |
| 771 | }; |
| 772 | |
| 773 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 774 | template<int V> |
| 775 | class HTemplateInstruction : public HInstruction { |
| 776 | public: |
| 777 | int OperandCount() { return V; } |
| 778 | HValue* OperandAt(int i) { return inputs_[i]; } |
| 779 | |
| 780 | protected: |
| 781 | void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
| 782 | |
| 783 | private: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 784 | EmbeddedContainer<HValue*, V> inputs_; |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 785 | }; |
| 786 | |
| 787 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 788 | class HControlInstruction: public HInstruction { |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 789 | public: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 790 | virtual HBasicBlock* SuccessorAt(int i) = 0; |
| 791 | virtual int SuccessorCount() = 0; |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 792 | virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 793 | |
| 794 | virtual void PrintDataTo(StringStream* stream); |
| 795 | |
| 796 | HBasicBlock* FirstSuccessor() { |
| 797 | return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; |
| 798 | } |
| 799 | HBasicBlock* SecondSuccessor() { |
| 800 | return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; |
| 801 | } |
| 802 | |
| 803 | DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) |
| 804 | }; |
| 805 | |
| 806 | |
| 807 | class HSuccessorIterator BASE_EMBEDDED { |
| 808 | public: |
| 809 | explicit HSuccessorIterator(HControlInstruction* instr) |
| 810 | : instr_(instr), current_(0) { } |
| 811 | |
| 812 | bool Done() { return current_ >= instr_->SuccessorCount(); } |
| 813 | HBasicBlock* Current() { return instr_->SuccessorAt(current_); } |
| 814 | void Advance() { current_++; } |
| 815 | |
| 816 | private: |
| 817 | HControlInstruction* instr_; |
| 818 | int current_; |
| 819 | }; |
| 820 | |
| 821 | |
| 822 | template<int S, int V> |
| 823 | class HTemplateControlInstruction: public HControlInstruction { |
| 824 | public: |
| 825 | int SuccessorCount() { return S; } |
| 826 | HBasicBlock* SuccessorAt(int i) { return successors_[i]; } |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 827 | void SetSuccessorAt(int i, HBasicBlock* block) { successors_[i] = block; } |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 828 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 829 | int OperandCount() { return V; } |
| 830 | HValue* OperandAt(int i) { return inputs_[i]; } |
| 831 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 832 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 833 | protected: |
| 834 | void InternalSetOperandAt(int i, HValue* value) { inputs_[i] = value; } |
| 835 | |
| 836 | private: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 837 | EmbeddedContainer<HBasicBlock*, S> successors_; |
| 838 | EmbeddedContainer<HValue*, V> inputs_; |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 839 | }; |
| 840 | |
| 841 | |
| 842 | class HBlockEntry: public HTemplateInstruction<0> { |
| 843 | public: |
| 844 | virtual Representation RequiredInputRepresentation(int index) const { |
| 845 | return Representation::None(); |
| 846 | } |
| 847 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 848 | DECLARE_CONCRETE_INSTRUCTION(BlockEntry) |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 849 | }; |
| 850 | |
| 851 | |
jkummerow@chromium.org | e297f59 | 2011-06-08 10:05:15 +0000 | [diff] [blame] | 852 | // We insert soft-deoptimize when we hit code with unknown typefeedback, |
| 853 | // so that we get a chance of re-optimizing with useful typefeedback. |
| 854 | // HSoftDeoptimize does not end a basic block as opposed to HDeoptimize. |
| 855 | class HSoftDeoptimize: public HTemplateInstruction<0> { |
| 856 | public: |
| 857 | virtual Representation RequiredInputRepresentation(int index) const { |
| 858 | return Representation::None(); |
| 859 | } |
| 860 | |
| 861 | DECLARE_CONCRETE_INSTRUCTION(SoftDeoptimize) |
| 862 | }; |
| 863 | |
| 864 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 865 | class HDeoptimize: public HControlInstruction { |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 866 | public: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 867 | explicit HDeoptimize(int environment_length) : values_(environment_length) { } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 868 | |
| 869 | virtual Representation RequiredInputRepresentation(int index) const { |
| 870 | return Representation::None(); |
| 871 | } |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 872 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 873 | virtual int OperandCount() { return values_.length(); } |
| 874 | virtual HValue* OperandAt(int index) { return values_[index]; } |
jkummerow@chromium.org | e297f59 | 2011-06-08 10:05:15 +0000 | [diff] [blame] | 875 | virtual void PrintDataTo(StringStream* stream); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 876 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 877 | virtual int SuccessorCount() { return 0; } |
| 878 | virtual HBasicBlock* SuccessorAt(int i) { |
| 879 | UNREACHABLE(); |
| 880 | return NULL; |
| 881 | } |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 882 | virtual void SetSuccessorAt(int i, HBasicBlock* block) { |
| 883 | UNREACHABLE(); |
| 884 | } |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 885 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 886 | void AddEnvironmentValue(HValue* value) { |
| 887 | values_.Add(NULL); |
| 888 | SetOperandAt(values_.length() - 1, value); |
| 889 | } |
| 890 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 891 | DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 892 | |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 893 | enum UseEnvironment { |
| 894 | kNoUses, |
| 895 | kUseAll |
| 896 | }; |
| 897 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 898 | protected: |
| 899 | virtual void InternalSetOperandAt(int index, HValue* value) { |
| 900 | values_[index] = value; |
| 901 | } |
| 902 | |
| 903 | private: |
| 904 | ZoneList<HValue*> values_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 905 | }; |
| 906 | |
| 907 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 908 | class HGoto: public HTemplateControlInstruction<1, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 909 | public: |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 910 | explicit HGoto(HBasicBlock* target) { |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 911 | SetSuccessorAt(0, target); |
| 912 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 913 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 914 | virtual Representation RequiredInputRepresentation(int index) const { |
| 915 | return Representation::None(); |
| 916 | } |
| 917 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 918 | DECLARE_CONCRETE_INSTRUCTION(Goto) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 919 | }; |
| 920 | |
| 921 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 922 | class HUnaryControlInstruction: public HTemplateControlInstruction<2, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 923 | public: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 924 | HUnaryControlInstruction(HValue* value, |
| 925 | HBasicBlock* true_target, |
| 926 | HBasicBlock* false_target) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 927 | SetOperandAt(0, value); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 928 | SetSuccessorAt(0, true_target); |
| 929 | SetSuccessorAt(1, false_target); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 930 | } |
| 931 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 932 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 933 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 934 | HValue* value() { return OperandAt(0); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 935 | }; |
| 936 | |
| 937 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 938 | class HBranch: public HUnaryControlInstruction { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 939 | public: |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 940 | HBranch(HValue* value, |
| 941 | HBasicBlock* true_target, |
| 942 | HBasicBlock* false_target, |
| 943 | ToBooleanStub::Types expected_input_types = ToBooleanStub::no_types()) |
| 944 | : HUnaryControlInstruction(value, true_target, false_target), |
| 945 | expected_input_types_(expected_input_types) { |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 946 | ASSERT(true_target != NULL && false_target != NULL); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 947 | } |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 948 | explicit HBranch(HValue* value) |
| 949 | : HUnaryControlInstruction(value, NULL, NULL) { } |
| 950 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 951 | |
| 952 | virtual Representation RequiredInputRepresentation(int index) const { |
| 953 | return Representation::None(); |
| 954 | } |
| 955 | |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 956 | ToBooleanStub::Types expected_input_types() const { |
| 957 | return expected_input_types_; |
| 958 | } |
| 959 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 960 | DECLARE_CONCRETE_INSTRUCTION(Branch) |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 961 | |
| 962 | private: |
| 963 | ToBooleanStub::Types expected_input_types_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 964 | }; |
| 965 | |
| 966 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 967 | class HCompareMap: public HUnaryControlInstruction { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 968 | public: |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 969 | HCompareMap(HValue* value, |
| 970 | Handle<Map> map, |
| 971 | HBasicBlock* true_target, |
| 972 | HBasicBlock* false_target) |
| 973 | : HUnaryControlInstruction(value, true_target, false_target), |
| 974 | map_(map) { |
| 975 | ASSERT(true_target != NULL); |
| 976 | ASSERT(false_target != NULL); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 977 | ASSERT(!map.is_null()); |
| 978 | } |
| 979 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 980 | virtual void PrintDataTo(StringStream* stream); |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 981 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 982 | Handle<Map> map() const { return map_; } |
| 983 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 984 | virtual Representation RequiredInputRepresentation(int index) const { |
| 985 | return Representation::Tagged(); |
| 986 | } |
| 987 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 988 | DECLARE_CONCRETE_INSTRUCTION(CompareMap) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 989 | |
| 990 | private: |
| 991 | Handle<Map> map_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 992 | }; |
| 993 | |
| 994 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 995 | class HReturn: public HTemplateControlInstruction<0, 1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 996 | public: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 997 | explicit HReturn(HValue* value) { |
| 998 | SetOperandAt(0, value); |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 999 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1000 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1001 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1002 | return Representation::Tagged(); |
| 1003 | } |
| 1004 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 1005 | virtual void PrintDataTo(StringStream* stream); |
| 1006 | |
| 1007 | HValue* value() { return OperandAt(0); } |
| 1008 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1009 | DECLARE_CONCRETE_INSTRUCTION(Return) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1010 | }; |
| 1011 | |
| 1012 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 1013 | class HAbnormalExit: public HTemplateControlInstruction<0, 0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1014 | public: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1015 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1016 | return Representation::None(); |
| 1017 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1018 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1019 | DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1020 | }; |
| 1021 | |
| 1022 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1023 | class HUnaryOperation: public HTemplateInstruction<1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1024 | public: |
| 1025 | explicit HUnaryOperation(HValue* value) { |
| 1026 | SetOperandAt(0, value); |
| 1027 | } |
| 1028 | |
ricow@chromium.org | c54d365 | 2011-05-30 09:20:16 +0000 | [diff] [blame] | 1029 | static HUnaryOperation* cast(HValue* value) { |
| 1030 | return reinterpret_cast<HUnaryOperation*>(value); |
| 1031 | } |
| 1032 | |
| 1033 | virtual bool CanTruncateToInt32() const { |
| 1034 | return CheckFlag(kTruncatingToInt32); |
| 1035 | } |
| 1036 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1037 | HValue* value() { return OperandAt(0); } |
| 1038 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1039 | }; |
| 1040 | |
| 1041 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1042 | class HThrow: public HTemplateInstruction<2> { |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 1043 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1044 | HThrow(HValue* context, HValue* value) { |
| 1045 | SetOperandAt(0, context); |
| 1046 | SetOperandAt(1, value); |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 1047 | SetAllSideEffects(); |
| 1048 | } |
| 1049 | |
| 1050 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1051 | return Representation::Tagged(); |
| 1052 | } |
| 1053 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1054 | HValue* context() { return OperandAt(0); } |
| 1055 | HValue* value() { return OperandAt(1); } |
| 1056 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1057 | DECLARE_CONCRETE_INSTRUCTION(Throw) |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 1058 | }; |
| 1059 | |
| 1060 | |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 1061 | class HUseConst: public HUnaryOperation { |
| 1062 | public: |
| 1063 | explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } |
| 1064 | |
| 1065 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1066 | return Representation::None(); |
| 1067 | } |
| 1068 | |
| 1069 | DECLARE_CONCRETE_INSTRUCTION(UseConst) |
| 1070 | }; |
| 1071 | |
| 1072 | |
kmillikin@chromium.org | c53e10d | 2011-05-18 09:12:58 +0000 | [diff] [blame] | 1073 | class HForceRepresentation: public HTemplateInstruction<1> { |
| 1074 | public: |
| 1075 | HForceRepresentation(HValue* value, Representation required_representation) { |
| 1076 | SetOperandAt(0, value); |
| 1077 | set_representation(required_representation); |
| 1078 | } |
| 1079 | |
| 1080 | HValue* value() { return OperandAt(0); } |
| 1081 | |
| 1082 | virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1083 | |
| 1084 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1085 | return representation(); // Same as the output representation. |
| 1086 | } |
| 1087 | |
| 1088 | DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
| 1089 | }; |
| 1090 | |
| 1091 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1092 | class HChange: public HUnaryOperation { |
| 1093 | public: |
| 1094 | HChange(HValue* value, |
| 1095 | Representation from, |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 1096 | Representation to, |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 1097 | bool is_truncating, |
| 1098 | bool deoptimize_on_undefined) |
| 1099 | : HUnaryOperation(value), |
| 1100 | from_(from), |
| 1101 | deoptimize_on_undefined_(deoptimize_on_undefined) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1102 | ASSERT(!from.IsNone() && !to.IsNone()); |
| 1103 | ASSERT(!from.Equals(to)); |
| 1104 | set_representation(to); |
| 1105 | SetFlag(kUseGVN); |
karlklose@chromium.org | 8f806e8 | 2011-03-07 14:06:08 +0000 | [diff] [blame] | 1106 | if (is_truncating) SetFlag(kTruncatingToInt32); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1107 | } |
| 1108 | |
| 1109 | virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1110 | |
| 1111 | Representation from() const { return from_; } |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 1112 | Representation to() const { return representation(); } |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 1113 | bool deoptimize_on_undefined() const { return deoptimize_on_undefined_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1114 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1115 | return from_; |
| 1116 | } |
| 1117 | |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 1118 | virtual Range* InferRange(); |
| 1119 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1120 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1121 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1122 | DECLARE_CONCRETE_INSTRUCTION(Change) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1123 | |
| 1124 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1125 | virtual bool DataEquals(HValue* other) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1126 | if (!other->IsChange()) return false; |
| 1127 | HChange* change = HChange::cast(other); |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1128 | return to().Equals(change->to()) |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 1129 | && deoptimize_on_undefined() == change->deoptimize_on_undefined(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1130 | } |
| 1131 | |
| 1132 | private: |
| 1133 | Representation from_; |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 1134 | bool deoptimize_on_undefined_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1135 | }; |
| 1136 | |
| 1137 | |
kmillikin@chromium.org | c53e10d | 2011-05-18 09:12:58 +0000 | [diff] [blame] | 1138 | class HClampToUint8: public HUnaryOperation { |
| 1139 | public: |
| 1140 | explicit HClampToUint8(HValue* value) |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 1141 | : HUnaryOperation(value) { |
| 1142 | set_representation(Representation::Integer32()); |
kmillikin@chromium.org | c53e10d | 2011-05-18 09:12:58 +0000 | [diff] [blame] | 1143 | SetFlag(kUseGVN); |
| 1144 | } |
| 1145 | |
| 1146 | virtual Representation RequiredInputRepresentation(int index) const { |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 1147 | return Representation::None(); |
kmillikin@chromium.org | c53e10d | 2011-05-18 09:12:58 +0000 | [diff] [blame] | 1148 | } |
| 1149 | |
| 1150 | DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
| 1151 | |
| 1152 | protected: |
| 1153 | virtual bool DataEquals(HValue* other) { return true; } |
kmillikin@chromium.org | c53e10d | 2011-05-18 09:12:58 +0000 | [diff] [blame] | 1154 | }; |
| 1155 | |
| 1156 | |
ricow@chromium.org | c54d365 | 2011-05-30 09:20:16 +0000 | [diff] [blame] | 1157 | class HToInt32: public HUnaryOperation { |
| 1158 | public: |
| 1159 | explicit HToInt32(HValue* value) |
| 1160 | : HUnaryOperation(value) { |
| 1161 | set_representation(Representation::Integer32()); |
| 1162 | SetFlag(kUseGVN); |
| 1163 | } |
| 1164 | |
| 1165 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1166 | return Representation::None(); |
| 1167 | } |
| 1168 | |
| 1169 | virtual bool CanTruncateToInt32() const { |
| 1170 | return true; |
| 1171 | } |
| 1172 | |
| 1173 | virtual HValue* Canonicalize() { |
| 1174 | if (value()->representation().IsInteger32()) { |
| 1175 | return value(); |
| 1176 | } else { |
| 1177 | return this; |
| 1178 | } |
| 1179 | } |
| 1180 | |
| 1181 | DECLARE_CONCRETE_INSTRUCTION(ToInt32) |
| 1182 | |
| 1183 | protected: |
| 1184 | virtual bool DataEquals(HValue* other) { return true; } |
| 1185 | }; |
| 1186 | |
| 1187 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1188 | class HSimulate: public HInstruction { |
| 1189 | public: |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 1190 | HSimulate(int ast_id, int pop_count) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1191 | : ast_id_(ast_id), |
| 1192 | pop_count_(pop_count), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1193 | values_(2), |
| 1194 | assigned_indexes_(2) {} |
| 1195 | virtual ~HSimulate() {} |
| 1196 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1197 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1198 | |
| 1199 | bool HasAstId() const { return ast_id_ != AstNode::kNoNumber; } |
| 1200 | int ast_id() const { return ast_id_; } |
| 1201 | void set_ast_id(int id) { |
| 1202 | ASSERT(!HasAstId()); |
| 1203 | ast_id_ = id; |
| 1204 | } |
| 1205 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1206 | int pop_count() const { return pop_count_; } |
| 1207 | const ZoneList<HValue*>* values() const { return &values_; } |
| 1208 | int GetAssignedIndexAt(int index) const { |
| 1209 | ASSERT(HasAssignedIndexAt(index)); |
| 1210 | return assigned_indexes_[index]; |
| 1211 | } |
| 1212 | bool HasAssignedIndexAt(int index) const { |
| 1213 | return assigned_indexes_[index] != kNoIndex; |
| 1214 | } |
| 1215 | void AddAssignedValue(int index, HValue* value) { |
| 1216 | AddValue(index, value); |
| 1217 | } |
| 1218 | void AddPushedValue(HValue* value) { |
| 1219 | AddValue(kNoIndex, value); |
| 1220 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1221 | virtual int OperandCount() { return values_.length(); } |
| 1222 | virtual HValue* OperandAt(int index) { return values_[index]; } |
| 1223 | |
| 1224 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1225 | return Representation::None(); |
| 1226 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1227 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1228 | DECLARE_CONCRETE_INSTRUCTION(Simulate) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1229 | |
| 1230 | #ifdef DEBUG |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 1231 | virtual void Verify(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1232 | #endif |
| 1233 | |
| 1234 | protected: |
| 1235 | virtual void InternalSetOperandAt(int index, HValue* value) { |
| 1236 | values_[index] = value; |
| 1237 | } |
| 1238 | |
| 1239 | private: |
| 1240 | static const int kNoIndex = -1; |
| 1241 | void AddValue(int index, HValue* value) { |
| 1242 | assigned_indexes_.Add(index); |
| 1243 | // Resize the list of pushed values. |
| 1244 | values_.Add(NULL); |
| 1245 | // Set the operand through the base method in HValue to make sure that the |
| 1246 | // use lists are correctly updated. |
| 1247 | SetOperandAt(values_.length() - 1, value); |
| 1248 | } |
| 1249 | int ast_id_; |
| 1250 | int pop_count_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1251 | ZoneList<HValue*> values_; |
| 1252 | ZoneList<int> assigned_indexes_; |
| 1253 | }; |
| 1254 | |
| 1255 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1256 | class HStackCheck: public HTemplateInstruction<1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1257 | public: |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 1258 | enum Type { |
| 1259 | kFunctionEntry, |
| 1260 | kBackwardsBranch |
| 1261 | }; |
| 1262 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1263 | HStackCheck(HValue* context, Type type) : type_(type) { |
| 1264 | SetOperandAt(0, context); |
| 1265 | } |
| 1266 | |
| 1267 | HValue* context() { return OperandAt(0); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1268 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1269 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1270 | return Representation::Tagged(); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1271 | } |
| 1272 | |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 1273 | void Eliminate() { |
| 1274 | // The stack check eliminator might try to eliminate the same stack |
| 1275 | // check instruction multiple times. |
| 1276 | if (IsLinked()) { |
| 1277 | DeleteFromGraph(); |
| 1278 | } |
| 1279 | } |
| 1280 | |
| 1281 | bool is_function_entry() { return type_ == kFunctionEntry; } |
| 1282 | bool is_backwards_branch() { return type_ == kBackwardsBranch; } |
| 1283 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1284 | DECLARE_CONCRETE_INSTRUCTION(StackCheck) |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 1285 | |
| 1286 | private: |
| 1287 | Type type_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1288 | }; |
| 1289 | |
| 1290 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1291 | class HEnterInlined: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1292 | public: |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 1293 | HEnterInlined(Handle<JSFunction> closure, |
| 1294 | FunctionLiteral* function, |
| 1295 | CallKind call_kind) |
| 1296 | : closure_(closure), |
| 1297 | function_(function), |
| 1298 | call_kind_(call_kind) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1299 | } |
| 1300 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1301 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1302 | |
| 1303 | Handle<JSFunction> closure() const { return closure_; } |
| 1304 | FunctionLiteral* function() const { return function_; } |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 1305 | CallKind call_kind() const { return call_kind_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1306 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1307 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1308 | return Representation::None(); |
| 1309 | } |
| 1310 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1311 | DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1312 | |
| 1313 | private: |
| 1314 | Handle<JSFunction> closure_; |
| 1315 | FunctionLiteral* function_; |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 1316 | CallKind call_kind_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1317 | }; |
| 1318 | |
| 1319 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1320 | class HLeaveInlined: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1321 | public: |
| 1322 | HLeaveInlined() {} |
| 1323 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1324 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1325 | return Representation::None(); |
| 1326 | } |
| 1327 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1328 | DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1329 | }; |
| 1330 | |
| 1331 | |
| 1332 | class HPushArgument: public HUnaryOperation { |
| 1333 | public: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1334 | explicit HPushArgument(HValue* value) : HUnaryOperation(value) { |
| 1335 | set_representation(Representation::Tagged()); |
| 1336 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1337 | |
| 1338 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1339 | return Representation::Tagged(); |
| 1340 | } |
| 1341 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1342 | HValue* argument() { return OperandAt(0); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1343 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1344 | DECLARE_CONCRETE_INSTRUCTION(PushArgument) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1345 | }; |
| 1346 | |
| 1347 | |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 1348 | class HThisFunction: public HTemplateInstruction<0> { |
| 1349 | public: |
| 1350 | HThisFunction() { |
| 1351 | set_representation(Representation::Tagged()); |
| 1352 | SetFlag(kUseGVN); |
| 1353 | } |
| 1354 | |
| 1355 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1356 | return Representation::None(); |
| 1357 | } |
| 1358 | |
| 1359 | DECLARE_CONCRETE_INSTRUCTION(ThisFunction) |
| 1360 | |
| 1361 | protected: |
| 1362 | virtual bool DataEquals(HValue* other) { return true; } |
| 1363 | }; |
| 1364 | |
| 1365 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1366 | class HContext: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1367 | public: |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1368 | HContext() { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1369 | set_representation(Representation::Tagged()); |
| 1370 | SetFlag(kUseGVN); |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1371 | } |
| 1372 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1373 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1374 | return Representation::None(); |
| 1375 | } |
| 1376 | |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 1377 | DECLARE_CONCRETE_INSTRUCTION(Context) |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1378 | |
| 1379 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1380 | virtual bool DataEquals(HValue* other) { return true; } |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1381 | }; |
| 1382 | |
| 1383 | |
| 1384 | class HOuterContext: public HUnaryOperation { |
| 1385 | public: |
| 1386 | explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { |
| 1387 | set_representation(Representation::Tagged()); |
| 1388 | SetFlag(kUseGVN); |
| 1389 | } |
| 1390 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1391 | DECLARE_CONCRETE_INSTRUCTION(OuterContext); |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1392 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1393 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1394 | return Representation::Tagged(); |
| 1395 | } |
| 1396 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1397 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1398 | virtual bool DataEquals(HValue* other) { return true; } |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1399 | }; |
| 1400 | |
| 1401 | |
| 1402 | class HGlobalObject: public HUnaryOperation { |
| 1403 | public: |
| 1404 | explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { |
| 1405 | set_representation(Representation::Tagged()); |
| 1406 | SetFlag(kUseGVN); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1407 | } |
| 1408 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1409 | DECLARE_CONCRETE_INSTRUCTION(GlobalObject) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 1410 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1411 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1412 | return Representation::Tagged(); |
| 1413 | } |
| 1414 | |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 1415 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1416 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1417 | }; |
| 1418 | |
| 1419 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1420 | class HGlobalReceiver: public HUnaryOperation { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1421 | public: |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 1422 | explicit HGlobalReceiver(HValue* global_object) |
| 1423 | : HUnaryOperation(global_object) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1424 | set_representation(Representation::Tagged()); |
| 1425 | SetFlag(kUseGVN); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1426 | } |
| 1427 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1428 | DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 1429 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1430 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1431 | return Representation::Tagged(); |
| 1432 | } |
| 1433 | |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 1434 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1435 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1436 | }; |
| 1437 | |
| 1438 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1439 | template <int V> |
| 1440 | class HCall: public HTemplateInstruction<V> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1441 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1442 | // The argument count includes the receiver. |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1443 | explicit HCall<V>(int argument_count) : argument_count_(argument_count) { |
| 1444 | this->set_representation(Representation::Tagged()); |
| 1445 | this->SetAllSideEffects(); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1446 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1447 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1448 | virtual HType CalculateInferredType() { return HType::Tagged(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1449 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1450 | virtual int argument_count() const { return argument_count_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1451 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1452 | virtual bool IsCall() { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1453 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1454 | private: |
| 1455 | int argument_count_; |
| 1456 | }; |
| 1457 | |
| 1458 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1459 | class HUnaryCall: public HCall<1> { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1460 | public: |
| 1461 | HUnaryCall(HValue* value, int argument_count) |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1462 | : HCall<1>(argument_count) { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1463 | SetOperandAt(0, value); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1464 | } |
| 1465 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1466 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1467 | return Representation::Tagged(); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1468 | } |
| 1469 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1470 | virtual void PrintDataTo(StringStream* stream); |
| 1471 | |
| 1472 | HValue* value() { return OperandAt(0); } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1473 | }; |
| 1474 | |
| 1475 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1476 | class HBinaryCall: public HCall<2> { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1477 | public: |
| 1478 | HBinaryCall(HValue* first, HValue* second, int argument_count) |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1479 | : HCall<2>(argument_count) { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1480 | SetOperandAt(0, first); |
| 1481 | SetOperandAt(1, second); |
| 1482 | } |
| 1483 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1484 | virtual void PrintDataTo(StringStream* stream); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1485 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1486 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1487 | return Representation::Tagged(); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1488 | } |
| 1489 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1490 | HValue* first() { return OperandAt(0); } |
| 1491 | HValue* second() { return OperandAt(1); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1492 | }; |
| 1493 | |
| 1494 | |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 1495 | class HInvokeFunction: public HBinaryCall { |
| 1496 | public: |
| 1497 | HInvokeFunction(HValue* context, HValue* function, int argument_count) |
| 1498 | : HBinaryCall(context, function, argument_count) { |
| 1499 | } |
| 1500 | |
| 1501 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1502 | return Representation::Tagged(); |
| 1503 | } |
| 1504 | |
| 1505 | HValue* context() { return first(); } |
| 1506 | HValue* function() { return second(); } |
| 1507 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1508 | DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 1509 | }; |
| 1510 | |
| 1511 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1512 | class HCallConstantFunction: public HCall<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1513 | public: |
| 1514 | HCallConstantFunction(Handle<JSFunction> function, int argument_count) |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1515 | : HCall<0>(argument_count), function_(function) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1516 | |
| 1517 | Handle<JSFunction> function() const { return function_; } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1518 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1519 | bool IsApplyFunction() const { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1520 | return function_->code() == |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1521 | Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1522 | } |
| 1523 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1524 | virtual void PrintDataTo(StringStream* stream); |
| 1525 | |
| 1526 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1527 | return Representation::None(); |
| 1528 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1529 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1530 | DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1531 | |
| 1532 | private: |
| 1533 | Handle<JSFunction> function_; |
| 1534 | }; |
| 1535 | |
| 1536 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1537 | class HCallKeyed: public HBinaryCall { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1538 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1539 | HCallKeyed(HValue* context, HValue* key, int argument_count) |
| 1540 | : HBinaryCall(context, key, argument_count) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1541 | } |
| 1542 | |
| 1543 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1544 | return Representation::Tagged(); |
| 1545 | } |
| 1546 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1547 | HValue* context() { return first(); } |
| 1548 | HValue* key() { return second(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1549 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1550 | DECLARE_CONCRETE_INSTRUCTION(CallKeyed) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1551 | }; |
| 1552 | |
| 1553 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1554 | class HCallNamed: public HUnaryCall { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1555 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1556 | HCallNamed(HValue* context, Handle<String> name, int argument_count) |
| 1557 | : HUnaryCall(context, argument_count), name_(name) { |
| 1558 | } |
| 1559 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1560 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1561 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1562 | HValue* context() { return value(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1563 | Handle<String> name() const { return name_; } |
| 1564 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1565 | DECLARE_CONCRETE_INSTRUCTION(CallNamed) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1566 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1567 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1568 | return Representation::Tagged(); |
| 1569 | } |
| 1570 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1571 | private: |
| 1572 | Handle<String> name_; |
| 1573 | }; |
| 1574 | |
| 1575 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1576 | class HCallFunction: public HUnaryCall { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1577 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1578 | HCallFunction(HValue* context, int argument_count) |
| 1579 | : HUnaryCall(context, argument_count) { |
| 1580 | } |
| 1581 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1582 | HValue* context() { return value(); } |
| 1583 | |
| 1584 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1585 | return Representation::Tagged(); |
| 1586 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1587 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1588 | DECLARE_CONCRETE_INSTRUCTION(CallFunction) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1589 | }; |
| 1590 | |
| 1591 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1592 | class HCallGlobal: public HUnaryCall { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1593 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1594 | HCallGlobal(HValue* context, Handle<String> name, int argument_count) |
| 1595 | : HUnaryCall(context, argument_count), name_(name) { |
| 1596 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1597 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1598 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1599 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1600 | HValue* context() { return value(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1601 | Handle<String> name() const { return name_; } |
| 1602 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1603 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1604 | return Representation::Tagged(); |
| 1605 | } |
| 1606 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1607 | DECLARE_CONCRETE_INSTRUCTION(CallGlobal) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1608 | |
| 1609 | private: |
| 1610 | Handle<String> name_; |
| 1611 | }; |
| 1612 | |
| 1613 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1614 | class HCallKnownGlobal: public HCall<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1615 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1616 | HCallKnownGlobal(Handle<JSFunction> target, int argument_count) |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1617 | : HCall<0>(argument_count), target_(target) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1618 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1619 | virtual void PrintDataTo(StringStream* stream); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1620 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1621 | Handle<JSFunction> target() const { return target_; } |
| 1622 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1623 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1624 | return Representation::None(); |
| 1625 | } |
| 1626 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1627 | DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1628 | |
| 1629 | private: |
| 1630 | Handle<JSFunction> target_; |
| 1631 | }; |
| 1632 | |
| 1633 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1634 | class HCallNew: public HBinaryCall { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1635 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1636 | HCallNew(HValue* context, HValue* constructor, int argument_count) |
| 1637 | : HBinaryCall(context, constructor, argument_count) { |
| 1638 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1639 | |
| 1640 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1641 | return Representation::Tagged(); |
| 1642 | } |
| 1643 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1644 | HValue* context() { return first(); } |
| 1645 | HValue* constructor() { return second(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1646 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1647 | DECLARE_CONCRETE_INSTRUCTION(CallNew) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1648 | }; |
| 1649 | |
| 1650 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1651 | class HCallRuntime: public HCall<1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1652 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1653 | HCallRuntime(HValue* context, |
| 1654 | Handle<String> name, |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1655 | const Runtime::Function* c_function, |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1656 | int argument_count) |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1657 | : HCall<1>(argument_count), c_function_(c_function), name_(name) { |
| 1658 | SetOperandAt(0, context); |
| 1659 | } |
| 1660 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1661 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1662 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1663 | HValue* context() { return OperandAt(0); } |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1664 | const Runtime::Function* function() const { return c_function_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1665 | Handle<String> name() const { return name_; } |
| 1666 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1667 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1668 | return Representation::Tagged(); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1669 | } |
| 1670 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1671 | DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1672 | |
| 1673 | private: |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 1674 | const Runtime::Function* c_function_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1675 | Handle<String> name_; |
| 1676 | }; |
| 1677 | |
| 1678 | |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 1679 | class HJSArrayLength: public HTemplateInstruction<2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1680 | public: |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 1681 | HJSArrayLength(HValue* value, HValue* typecheck) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1682 | // The length of an array is stored as a tagged value in the array |
| 1683 | // object. It is guaranteed to be 32 bit integer, but it can be |
| 1684 | // represented as either a smi or heap number. |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 1685 | SetOperandAt(0, value); |
| 1686 | SetOperandAt(1, typecheck); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1687 | set_representation(Representation::Tagged()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1688 | SetFlag(kUseGVN); |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1689 | SetFlag(kDependsOnArrayLengths); |
| 1690 | SetFlag(kDependsOnMaps); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1691 | } |
| 1692 | |
| 1693 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1694 | return Representation::Tagged(); |
| 1695 | } |
| 1696 | |
jkummerow@chromium.org | 486075a | 2011-09-07 12:44:28 +0000 | [diff] [blame^] | 1697 | virtual void PrintDataTo(StringStream* stream); |
| 1698 | |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 1699 | HValue* value() { return OperandAt(0); } |
jkummerow@chromium.org | 486075a | 2011-09-07 12:44:28 +0000 | [diff] [blame^] | 1700 | HValue* typecheck() { return OperandAt(1); } |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 1701 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1702 | DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 1703 | |
| 1704 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1705 | virtual bool DataEquals(HValue* other) { return true; } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1706 | }; |
| 1707 | |
| 1708 | |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 1709 | class HFixedArrayBaseLength: public HUnaryOperation { |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1710 | public: |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 1711 | explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1712 | set_representation(Representation::Tagged()); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1713 | SetFlag(kUseGVN); |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1714 | SetFlag(kDependsOnArrayLengths); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 1715 | } |
| 1716 | |
| 1717 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1718 | return Representation::Tagged(); |
| 1719 | } |
| 1720 | |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 1721 | DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1722 | |
| 1723 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1724 | virtual bool DataEquals(HValue* other) { return true; } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1725 | }; |
| 1726 | |
| 1727 | |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 1728 | class HElementsKind: public HUnaryOperation { |
| 1729 | public: |
| 1730 | explicit HElementsKind(HValue* value) : HUnaryOperation(value) { |
| 1731 | set_representation(Representation::Integer32()); |
| 1732 | SetFlag(kUseGVN); |
| 1733 | SetFlag(kDependsOnMaps); |
| 1734 | } |
| 1735 | |
| 1736 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1737 | return Representation::Tagged(); |
| 1738 | } |
| 1739 | |
| 1740 | DECLARE_CONCRETE_INSTRUCTION(ElementsKind) |
| 1741 | |
| 1742 | protected: |
| 1743 | virtual bool DataEquals(HValue* other) { return true; } |
| 1744 | }; |
| 1745 | |
| 1746 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1747 | class HBitNot: public HUnaryOperation { |
| 1748 | public: |
| 1749 | explicit HBitNot(HValue* value) : HUnaryOperation(value) { |
| 1750 | set_representation(Representation::Integer32()); |
| 1751 | SetFlag(kUseGVN); |
| 1752 | SetFlag(kTruncatingToInt32); |
| 1753 | } |
| 1754 | |
| 1755 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1756 | return Representation::Integer32(); |
| 1757 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1758 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1759 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1760 | DECLARE_CONCRETE_INSTRUCTION(BitNot) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 1761 | |
| 1762 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1763 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1764 | }; |
| 1765 | |
| 1766 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1767 | class HUnaryMathOperation: public HTemplateInstruction<2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1768 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1769 | HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) |
| 1770 | : op_(op) { |
| 1771 | SetOperandAt(0, context); |
| 1772 | SetOperandAt(1, value); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1773 | switch (op) { |
| 1774 | case kMathFloor: |
| 1775 | case kMathRound: |
| 1776 | case kMathCeil: |
| 1777 | set_representation(Representation::Integer32()); |
| 1778 | break; |
| 1779 | case kMathAbs: |
| 1780 | set_representation(Representation::Tagged()); |
| 1781 | SetFlag(kFlexibleRepresentation); |
| 1782 | break; |
| 1783 | case kMathSqrt: |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1784 | case kMathPowHalf: |
| 1785 | case kMathLog: |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 1786 | case kMathSin: |
| 1787 | case kMathCos: |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1788 | set_representation(Representation::Double()); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1789 | break; |
| 1790 | default: |
| 1791 | UNREACHABLE(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1792 | } |
| 1793 | SetFlag(kUseGVN); |
| 1794 | } |
| 1795 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1796 | HValue* context() { return OperandAt(0); } |
| 1797 | HValue* value() { return OperandAt(1); } |
| 1798 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1799 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1800 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1801 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1802 | |
| 1803 | virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1804 | |
| 1805 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 1806 | if (index == 0) { |
| 1807 | return Representation::Tagged(); |
| 1808 | } else { |
| 1809 | switch (op_) { |
| 1810 | case kMathFloor: |
| 1811 | case kMathRound: |
| 1812 | case kMathCeil: |
| 1813 | case kMathSqrt: |
| 1814 | case kMathPowHalf: |
| 1815 | case kMathLog: |
| 1816 | case kMathSin: |
| 1817 | case kMathCos: |
| 1818 | return Representation::Double(); |
| 1819 | case kMathAbs: |
| 1820 | return representation(); |
| 1821 | default: |
| 1822 | UNREACHABLE(); |
| 1823 | return Representation::None(); |
| 1824 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1825 | } |
| 1826 | } |
| 1827 | |
| 1828 | virtual HValue* Canonicalize() { |
| 1829 | // If the input is integer32 then we replace the floor instruction |
| 1830 | // with its inputs. This happens before the representation changes are |
| 1831 | // introduced. |
| 1832 | if (op() == kMathFloor) { |
| 1833 | if (value()->representation().IsInteger32()) return value(); |
| 1834 | } |
| 1835 | return this; |
| 1836 | } |
| 1837 | |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1838 | BuiltinFunctionId op() const { return op_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1839 | const char* OpName() const; |
| 1840 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1841 | DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1842 | |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1843 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1844 | virtual bool DataEquals(HValue* other) { |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1845 | HUnaryMathOperation* b = HUnaryMathOperation::cast(other); |
| 1846 | return op_ == b->op(); |
| 1847 | } |
| 1848 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1849 | private: |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 1850 | BuiltinFunctionId op_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1851 | }; |
| 1852 | |
| 1853 | |
| 1854 | class HLoadElements: public HUnaryOperation { |
| 1855 | public: |
| 1856 | explicit HLoadElements(HValue* value) : HUnaryOperation(value) { |
| 1857 | set_representation(Representation::Tagged()); |
| 1858 | SetFlag(kUseGVN); |
| 1859 | SetFlag(kDependsOnMaps); |
| 1860 | } |
| 1861 | |
| 1862 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1863 | return Representation::Tagged(); |
| 1864 | } |
| 1865 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1866 | DECLARE_CONCRETE_INSTRUCTION(LoadElements) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 1867 | |
| 1868 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1869 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1870 | }; |
| 1871 | |
| 1872 | |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 1873 | class HLoadExternalArrayPointer: public HUnaryOperation { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1874 | public: |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 1875 | explicit HLoadExternalArrayPointer(HValue* value) |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1876 | : HUnaryOperation(value) { |
| 1877 | set_representation(Representation::External()); |
| 1878 | // The result of this instruction is idempotent as long as its inputs don't |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 1879 | // change. The external array of a specialized array elements object cannot |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1880 | // change once set, so it's no necessary to introduce any additional |
| 1881 | // dependencies on top of the inputs. |
| 1882 | SetFlag(kUseGVN); |
| 1883 | } |
| 1884 | |
| 1885 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1886 | return Representation::Tagged(); |
| 1887 | } |
| 1888 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1889 | DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1890 | |
| 1891 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1892 | virtual bool DataEquals(HValue* other) { return true; } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 1893 | }; |
| 1894 | |
| 1895 | |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 1896 | class HCheckMap: public HTemplateInstruction<2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1897 | public: |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 1898 | HCheckMap(HValue* value, Handle<Map> map, HValue* typecheck = NULL) |
| 1899 | : map_(map) { |
| 1900 | SetOperandAt(0, value); |
| 1901 | // If callers don't depend on a typecheck, they can pass in NULL. In that |
| 1902 | // case we use a copy of the |value| argument as a dummy value. |
| 1903 | SetOperandAt(1, typecheck != NULL ? typecheck : value); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1904 | set_representation(Representation::Tagged()); |
| 1905 | SetFlag(kUseGVN); |
| 1906 | SetFlag(kDependsOnMaps); |
| 1907 | } |
| 1908 | |
| 1909 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1910 | return Representation::Tagged(); |
| 1911 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1912 | virtual void PrintDataTo(StringStream* stream); |
| 1913 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1914 | |
ricow@chromium.org | 9fa0967 | 2011-07-25 11:05:35 +0000 | [diff] [blame] | 1915 | HValue* value() { return OperandAt(0); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1916 | Handle<Map> map() const { return map_; } |
| 1917 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1918 | DECLARE_CONCRETE_INSTRUCTION(CheckMap) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1919 | |
| 1920 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1921 | virtual bool DataEquals(HValue* other) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1922 | HCheckMap* b = HCheckMap::cast(other); |
| 1923 | return map_.is_identical_to(b->map()); |
| 1924 | } |
| 1925 | |
| 1926 | private: |
| 1927 | Handle<Map> map_; |
| 1928 | }; |
| 1929 | |
| 1930 | |
| 1931 | class HCheckFunction: public HUnaryOperation { |
| 1932 | public: |
| 1933 | HCheckFunction(HValue* value, Handle<JSFunction> function) |
| 1934 | : HUnaryOperation(value), target_(function) { |
| 1935 | set_representation(Representation::Tagged()); |
| 1936 | SetFlag(kUseGVN); |
| 1937 | } |
| 1938 | |
| 1939 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1940 | return Representation::Tagged(); |
| 1941 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1942 | virtual void PrintDataTo(StringStream* stream); |
| 1943 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1944 | |
| 1945 | #ifdef DEBUG |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 1946 | virtual void Verify(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1947 | #endif |
| 1948 | |
| 1949 | Handle<JSFunction> target() const { return target_; } |
| 1950 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1951 | DECLARE_CONCRETE_INSTRUCTION(CheckFunction) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1952 | |
| 1953 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1954 | virtual bool DataEquals(HValue* other) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1955 | HCheckFunction* b = HCheckFunction::cast(other); |
| 1956 | return target_.is_identical_to(b->target()); |
| 1957 | } |
| 1958 | |
| 1959 | private: |
| 1960 | Handle<JSFunction> target_; |
| 1961 | }; |
| 1962 | |
| 1963 | |
| 1964 | class HCheckInstanceType: public HUnaryOperation { |
| 1965 | public: |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 1966 | static HCheckInstanceType* NewIsSpecObject(HValue* value) { |
| 1967 | return new HCheckInstanceType(value, IS_SPEC_OBJECT); |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 1968 | } |
| 1969 | static HCheckInstanceType* NewIsJSArray(HValue* value) { |
| 1970 | return new HCheckInstanceType(value, IS_JS_ARRAY); |
| 1971 | } |
| 1972 | static HCheckInstanceType* NewIsString(HValue* value) { |
| 1973 | return new HCheckInstanceType(value, IS_STRING); |
| 1974 | } |
| 1975 | static HCheckInstanceType* NewIsSymbol(HValue* value) { |
| 1976 | return new HCheckInstanceType(value, IS_SYMBOL); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1977 | } |
| 1978 | |
| 1979 | virtual Representation RequiredInputRepresentation(int index) const { |
| 1980 | return Representation::Tagged(); |
| 1981 | } |
| 1982 | |
sgjesse@chromium.org | 6db8871 | 2011-07-11 11:41:22 +0000 | [diff] [blame] | 1983 | virtual HValue* Canonicalize(); |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 1984 | |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 1985 | bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } |
| 1986 | void GetCheckInterval(InstanceType* first, InstanceType* last); |
| 1987 | void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1988 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 1989 | DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1990 | |
| 1991 | protected: |
| 1992 | // TODO(ager): It could be nice to allow the ommision of instance |
| 1993 | // type checks if we have already performed an instance type check |
| 1994 | // with a larger range. |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 1995 | virtual bool DataEquals(HValue* other) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1996 | HCheckInstanceType* b = HCheckInstanceType::cast(other); |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 1997 | return check_ == b->check_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 1998 | } |
| 1999 | |
| 2000 | private: |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 2001 | enum Check { |
ricow@chromium.org | d2be901 | 2011-06-01 06:00:58 +0000 | [diff] [blame] | 2002 | IS_SPEC_OBJECT, |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 2003 | IS_JS_ARRAY, |
| 2004 | IS_STRING, |
| 2005 | IS_SYMBOL, |
| 2006 | LAST_INTERVAL_CHECK = IS_JS_ARRAY |
| 2007 | }; |
| 2008 | |
| 2009 | HCheckInstanceType(HValue* value, Check check) |
| 2010 | : HUnaryOperation(value), check_(check) { |
| 2011 | set_representation(Representation::Tagged()); |
| 2012 | SetFlag(kUseGVN); |
| 2013 | } |
| 2014 | |
| 2015 | const Check check_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2016 | }; |
| 2017 | |
| 2018 | |
| 2019 | class HCheckNonSmi: public HUnaryOperation { |
| 2020 | public: |
| 2021 | explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { |
| 2022 | set_representation(Representation::Tagged()); |
| 2023 | SetFlag(kUseGVN); |
| 2024 | } |
| 2025 | |
| 2026 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2027 | return Representation::Tagged(); |
| 2028 | } |
| 2029 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2030 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2031 | |
| 2032 | #ifdef DEBUG |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2033 | virtual void Verify(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2034 | #endif |
| 2035 | |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 2036 | virtual HValue* Canonicalize() { |
| 2037 | HType value_type = value()->type(); |
| 2038 | if (!value_type.IsUninitialized() && |
| 2039 | (value_type.IsHeapNumber() || |
| 2040 | value_type.IsString() || |
| 2041 | value_type.IsBoolean() || |
| 2042 | value_type.IsNonPrimitive())) { |
| 2043 | return NULL; |
| 2044 | } |
| 2045 | return this; |
| 2046 | } |
| 2047 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2048 | DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2049 | |
| 2050 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2051 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2052 | }; |
| 2053 | |
| 2054 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2055 | class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2056 | public: |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 2057 | HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) |
| 2058 | : prototype_(prototype), holder_(holder) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2059 | SetFlag(kUseGVN); |
| 2060 | SetFlag(kDependsOnMaps); |
| 2061 | } |
| 2062 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2063 | #ifdef DEBUG |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2064 | virtual void Verify(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2065 | #endif |
| 2066 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 2067 | Handle<JSObject> prototype() const { return prototype_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2068 | Handle<JSObject> holder() const { return holder_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2069 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2070 | DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2071 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2072 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2073 | return Representation::None(); |
| 2074 | } |
| 2075 | |
| 2076 | virtual intptr_t Hashcode() { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 2077 | ASSERT(!HEAP->IsAllocationAllowed()); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 2078 | intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); |
| 2079 | hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); |
| 2080 | return hash; |
| 2081 | } |
| 2082 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2083 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2084 | virtual bool DataEquals(HValue* other) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2085 | HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 2086 | return prototype_.is_identical_to(b->prototype()) && |
| 2087 | holder_.is_identical_to(b->holder()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2088 | } |
| 2089 | |
| 2090 | private: |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 2091 | Handle<JSObject> prototype_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2092 | Handle<JSObject> holder_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2093 | }; |
| 2094 | |
| 2095 | |
| 2096 | class HCheckSmi: public HUnaryOperation { |
| 2097 | public: |
| 2098 | explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { |
| 2099 | set_representation(Representation::Tagged()); |
| 2100 | SetFlag(kUseGVN); |
| 2101 | } |
| 2102 | |
| 2103 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2104 | return Representation::Tagged(); |
| 2105 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2106 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2107 | |
| 2108 | #ifdef DEBUG |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2109 | virtual void Verify(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2110 | #endif |
| 2111 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2112 | DECLARE_CONCRETE_INSTRUCTION(CheckSmi) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2113 | |
| 2114 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2115 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2116 | }; |
| 2117 | |
| 2118 | |
| 2119 | class HPhi: public HValue { |
| 2120 | public: |
| 2121 | explicit HPhi(int merged_index) |
| 2122 | : inputs_(2), |
| 2123 | merged_index_(merged_index), |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 2124 | phi_id_(-1), |
fschneider@chromium.org | fb144a0 | 2011-05-04 12:43:48 +0000 | [diff] [blame] | 2125 | is_live_(false), |
| 2126 | is_convertible_to_integer_(true) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2127 | for (int i = 0; i < Representation::kNumRepresentations; i++) { |
| 2128 | non_phi_uses_[i] = 0; |
| 2129 | indirect_uses_[i] = 0; |
| 2130 | } |
| 2131 | ASSERT(merged_index >= 0); |
| 2132 | set_representation(Representation::Tagged()); |
| 2133 | SetFlag(kFlexibleRepresentation); |
| 2134 | } |
| 2135 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2136 | virtual Representation InferredRepresentation() { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2137 | bool double_occurred = false; |
| 2138 | bool int32_occurred = false; |
| 2139 | for (int i = 0; i < OperandCount(); ++i) { |
| 2140 | HValue* value = OperandAt(i); |
| 2141 | if (value->representation().IsDouble()) double_occurred = true; |
| 2142 | if (value->representation().IsInteger32()) int32_occurred = true; |
| 2143 | if (value->representation().IsTagged()) return Representation::Tagged(); |
| 2144 | } |
| 2145 | |
| 2146 | if (double_occurred) return Representation::Double(); |
| 2147 | if (int32_occurred) return Representation::Integer32(); |
| 2148 | return Representation::None(); |
| 2149 | } |
| 2150 | |
| 2151 | virtual Range* InferRange(); |
| 2152 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2153 | return representation(); |
| 2154 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2155 | virtual HType CalculateInferredType(); |
| 2156 | virtual int OperandCount() { return inputs_.length(); } |
| 2157 | virtual HValue* OperandAt(int index) { return inputs_[index]; } |
| 2158 | HValue* GetRedundantReplacement(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2159 | void AddInput(HValue* value); |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 2160 | bool HasRealUses(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2161 | |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 2162 | bool IsReceiver() { return merged_index_ == 0; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2163 | |
| 2164 | int merged_index() const { return merged_index_; } |
| 2165 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2166 | virtual void PrintTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2167 | |
| 2168 | #ifdef DEBUG |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2169 | virtual void Verify(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2170 | #endif |
| 2171 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2172 | void InitRealUses(int id); |
| 2173 | void AddNonPhiUsesFrom(HPhi* other); |
| 2174 | void AddIndirectUsesTo(int* use_count); |
| 2175 | |
| 2176 | int tagged_non_phi_uses() const { |
| 2177 | return non_phi_uses_[Representation::kTagged]; |
| 2178 | } |
| 2179 | int int32_non_phi_uses() const { |
| 2180 | return non_phi_uses_[Representation::kInteger32]; |
| 2181 | } |
| 2182 | int double_non_phi_uses() const { |
| 2183 | return non_phi_uses_[Representation::kDouble]; |
| 2184 | } |
| 2185 | int tagged_indirect_uses() const { |
| 2186 | return indirect_uses_[Representation::kTagged]; |
| 2187 | } |
| 2188 | int int32_indirect_uses() const { |
| 2189 | return indirect_uses_[Representation::kInteger32]; |
| 2190 | } |
| 2191 | int double_indirect_uses() const { |
| 2192 | return indirect_uses_[Representation::kDouble]; |
| 2193 | } |
| 2194 | int phi_id() { return phi_id_; } |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 2195 | bool is_live() { return is_live_; } |
| 2196 | void set_is_live(bool b) { is_live_ = b; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2197 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2198 | static HPhi* cast(HValue* value) { |
| 2199 | ASSERT(value->IsPhi()); |
| 2200 | return reinterpret_cast<HPhi*>(value); |
| 2201 | } |
| 2202 | virtual Opcode opcode() const { return HValue::kPhi; } |
| 2203 | |
fschneider@chromium.org | fb144a0 | 2011-05-04 12:43:48 +0000 | [diff] [blame] | 2204 | virtual bool IsConvertibleToInteger() const { |
| 2205 | return is_convertible_to_integer_; |
| 2206 | } |
| 2207 | |
| 2208 | void set_is_convertible_to_integer(bool b) { |
| 2209 | is_convertible_to_integer_ = b; |
| 2210 | } |
| 2211 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2212 | protected: |
| 2213 | virtual void DeleteFromGraph(); |
| 2214 | virtual void InternalSetOperandAt(int index, HValue* value) { |
| 2215 | inputs_[index] = value; |
| 2216 | } |
| 2217 | |
| 2218 | private: |
| 2219 | ZoneList<HValue*> inputs_; |
| 2220 | int merged_index_; |
| 2221 | |
| 2222 | int non_phi_uses_[Representation::kNumRepresentations]; |
| 2223 | int indirect_uses_[Representation::kNumRepresentations]; |
| 2224 | int phi_id_; |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 2225 | bool is_live_; |
fschneider@chromium.org | fb144a0 | 2011-05-04 12:43:48 +0000 | [diff] [blame] | 2226 | bool is_convertible_to_integer_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2227 | }; |
| 2228 | |
| 2229 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2230 | class HArgumentsObject: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2231 | public: |
| 2232 | HArgumentsObject() { |
| 2233 | set_representation(Representation::Tagged()); |
| 2234 | SetFlag(kIsArguments); |
| 2235 | } |
| 2236 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2237 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2238 | return Representation::None(); |
| 2239 | } |
| 2240 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2241 | DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2242 | }; |
| 2243 | |
| 2244 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2245 | class HConstant: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2246 | public: |
| 2247 | HConstant(Handle<Object> handle, Representation r); |
| 2248 | |
| 2249 | Handle<Object> handle() const { return handle_; } |
| 2250 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 2251 | bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 2252 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2253 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2254 | return Representation::None(); |
| 2255 | } |
| 2256 | |
fschneider@chromium.org | fb144a0 | 2011-05-04 12:43:48 +0000 | [diff] [blame] | 2257 | virtual bool IsConvertibleToInteger() const { |
| 2258 | if (handle_->IsSmi()) return true; |
| 2259 | if (handle_->IsHeapNumber() && |
| 2260 | (HeapNumber::cast(*handle_)->value() == |
| 2261 | static_cast<double>(NumberToInt32(*handle_)))) return true; |
| 2262 | return false; |
| 2263 | } |
| 2264 | |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 2265 | virtual bool EmitAtUses() { return !representation().IsDouble(); } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2266 | virtual void PrintDataTo(StringStream* stream); |
| 2267 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2268 | bool IsInteger() const { return handle_->IsSmi(); } |
| 2269 | HConstant* CopyToRepresentation(Representation r) const; |
| 2270 | HConstant* CopyToTruncatedInt32() const; |
| 2271 | bool HasInteger32Value() const { return has_int32_value_; } |
| 2272 | int32_t Integer32Value() const { |
| 2273 | ASSERT(HasInteger32Value()); |
| 2274 | return int32_value_; |
| 2275 | } |
| 2276 | bool HasDoubleValue() const { return has_double_value_; } |
| 2277 | double DoubleValue() const { |
| 2278 | ASSERT(HasDoubleValue()); |
| 2279 | return double_value_; |
| 2280 | } |
| 2281 | bool HasStringValue() const { return handle_->IsString(); } |
| 2282 | |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 2283 | bool ToBoolean() const; |
| 2284 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2285 | virtual intptr_t Hashcode() { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 2286 | ASSERT(!HEAP->allow_allocation(false)); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2287 | return reinterpret_cast<intptr_t>(*handle()); |
| 2288 | } |
| 2289 | |
| 2290 | #ifdef DEBUG |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2291 | virtual void Verify() { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2292 | #endif |
| 2293 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2294 | DECLARE_CONCRETE_INSTRUCTION(Constant) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2295 | |
| 2296 | protected: |
| 2297 | virtual Range* InferRange(); |
| 2298 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2299 | virtual bool DataEquals(HValue* other) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2300 | HConstant* other_constant = HConstant::cast(other); |
| 2301 | return handle().is_identical_to(other_constant->handle()); |
| 2302 | } |
| 2303 | |
| 2304 | private: |
| 2305 | Handle<Object> handle_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2306 | |
| 2307 | // The following two values represent the int32 and the double value of the |
| 2308 | // given constant if there is a lossless conversion between the constant |
| 2309 | // and the specific representation. |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 2310 | bool has_int32_value_ : 1; |
| 2311 | bool has_double_value_ : 1; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2312 | int32_t int32_value_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2313 | double double_value_; |
| 2314 | }; |
| 2315 | |
| 2316 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2317 | class HBinaryOperation: public HTemplateInstruction<3> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2318 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2319 | HBinaryOperation(HValue* context, HValue* left, HValue* right) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2320 | ASSERT(left != NULL && right != NULL); |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2321 | SetOperandAt(0, context); |
| 2322 | SetOperandAt(1, left); |
| 2323 | SetOperandAt(2, right); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2324 | } |
| 2325 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2326 | HValue* context() { return OperandAt(0); } |
| 2327 | HValue* left() { return OperandAt(1); } |
| 2328 | HValue* right() { return OperandAt(2); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2329 | |
| 2330 | // TODO(kasperl): Move these helpers to the IA-32 Lithium |
| 2331 | // instruction sequence builder. |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2332 | HValue* LeastConstantOperand() { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2333 | if (IsCommutative() && left()->IsConstant()) return right(); |
| 2334 | return left(); |
| 2335 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2336 | HValue* MostConstantOperand() { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2337 | if (IsCommutative() && left()->IsConstant()) return left(); |
| 2338 | return right(); |
| 2339 | } |
| 2340 | |
| 2341 | virtual bool IsCommutative() const { return false; } |
| 2342 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2343 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2344 | }; |
| 2345 | |
| 2346 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2347 | class HApplyArguments: public HTemplateInstruction<4> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2348 | public: |
| 2349 | HApplyArguments(HValue* function, |
| 2350 | HValue* receiver, |
| 2351 | HValue* length, |
| 2352 | HValue* elements) { |
| 2353 | set_representation(Representation::Tagged()); |
| 2354 | SetOperandAt(0, function); |
| 2355 | SetOperandAt(1, receiver); |
| 2356 | SetOperandAt(2, length); |
| 2357 | SetOperandAt(3, elements); |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 2358 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2359 | } |
| 2360 | |
| 2361 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2362 | // The length is untagged, all other inputs are tagged. |
| 2363 | return (index == 2) |
| 2364 | ? Representation::Integer32() |
| 2365 | : Representation::Tagged(); |
| 2366 | } |
| 2367 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2368 | HValue* function() { return OperandAt(0); } |
| 2369 | HValue* receiver() { return OperandAt(1); } |
| 2370 | HValue* length() { return OperandAt(2); } |
| 2371 | HValue* elements() { return OperandAt(3); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2372 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2373 | DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2374 | }; |
| 2375 | |
| 2376 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2377 | class HArgumentsElements: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2378 | public: |
| 2379 | HArgumentsElements() { |
| 2380 | // The value produced by this instruction is a pointer into the stack |
| 2381 | // that looks as if it was a smi because of alignment. |
| 2382 | set_representation(Representation::Tagged()); |
| 2383 | SetFlag(kUseGVN); |
| 2384 | } |
| 2385 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2386 | DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2387 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2388 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2389 | return Representation::None(); |
| 2390 | } |
| 2391 | |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2392 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2393 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2394 | }; |
| 2395 | |
| 2396 | |
| 2397 | class HArgumentsLength: public HUnaryOperation { |
| 2398 | public: |
| 2399 | explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { |
| 2400 | set_representation(Representation::Integer32()); |
| 2401 | SetFlag(kUseGVN); |
| 2402 | } |
| 2403 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2404 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2405 | return Representation::Tagged(); |
| 2406 | } |
| 2407 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2408 | DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2409 | |
| 2410 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2411 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2412 | }; |
| 2413 | |
| 2414 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2415 | class HAccessArgumentsAt: public HTemplateInstruction<3> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2416 | public: |
| 2417 | HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
| 2418 | set_representation(Representation::Tagged()); |
| 2419 | SetFlag(kUseGVN); |
| 2420 | SetOperandAt(0, arguments); |
| 2421 | SetOperandAt(1, length); |
| 2422 | SetOperandAt(2, index); |
| 2423 | } |
| 2424 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2425 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2426 | |
| 2427 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2428 | // The arguments elements is considered tagged. |
| 2429 | return index == 0 |
| 2430 | ? Representation::Tagged() |
| 2431 | : Representation::Integer32(); |
| 2432 | } |
| 2433 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2434 | HValue* arguments() { return OperandAt(0); } |
| 2435 | HValue* length() { return OperandAt(1); } |
| 2436 | HValue* index() { return OperandAt(2); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2437 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2438 | DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2439 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2440 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2441 | }; |
| 2442 | |
| 2443 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2444 | class HBoundsCheck: public HTemplateInstruction<2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2445 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2446 | HBoundsCheck(HValue* index, HValue* length) { |
| 2447 | SetOperandAt(0, index); |
| 2448 | SetOperandAt(1, length); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 2449 | set_representation(Representation::Integer32()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2450 | SetFlag(kUseGVN); |
| 2451 | } |
| 2452 | |
| 2453 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2454 | return Representation::Integer32(); |
| 2455 | } |
| 2456 | |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 2457 | virtual void PrintDataTo(StringStream* stream); |
| 2458 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2459 | HValue* index() { return OperandAt(0); } |
| 2460 | HValue* length() { return OperandAt(1); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2461 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2462 | DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2463 | |
| 2464 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2465 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2466 | }; |
| 2467 | |
| 2468 | |
| 2469 | class HBitwiseBinaryOperation: public HBinaryOperation { |
| 2470 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2471 | HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) |
| 2472 | : HBinaryOperation(context, left, right) { |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 2473 | set_representation(Representation::Tagged()); |
| 2474 | SetFlag(kFlexibleRepresentation); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2475 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2476 | } |
| 2477 | |
| 2478 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2479 | return index == 0 |
| 2480 | ? Representation::Tagged() |
| 2481 | : representation(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2482 | } |
| 2483 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 2484 | virtual void RepresentationChanged(Representation to) { |
| 2485 | if (!to.IsTagged()) { |
| 2486 | ASSERT(to.IsInteger32()); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2487 | ClearAllSideEffects(); |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 2488 | SetFlag(kTruncatingToInt32); |
| 2489 | SetFlag(kUseGVN); |
| 2490 | } |
| 2491 | } |
| 2492 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2493 | virtual HType CalculateInferredType(); |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 2494 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2495 | DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2496 | }; |
| 2497 | |
| 2498 | |
| 2499 | class HArithmeticBinaryOperation: public HBinaryOperation { |
| 2500 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2501 | HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
| 2502 | : HBinaryOperation(context, left, right) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2503 | set_representation(Representation::Tagged()); |
| 2504 | SetFlag(kFlexibleRepresentation); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2505 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2506 | } |
| 2507 | |
| 2508 | virtual void RepresentationChanged(Representation to) { |
| 2509 | if (!to.IsTagged()) { |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2510 | ClearAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2511 | SetFlag(kUseGVN); |
| 2512 | } |
| 2513 | } |
| 2514 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2515 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2516 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2517 | return index == 0 |
| 2518 | ? Representation::Tagged() |
| 2519 | : representation(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2520 | } |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2521 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2522 | virtual Representation InferredRepresentation() { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2523 | if (left()->representation().Equals(right()->representation())) { |
| 2524 | return left()->representation(); |
| 2525 | } |
| 2526 | return HValue::InferredRepresentation(); |
| 2527 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2528 | }; |
| 2529 | |
| 2530 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2531 | class HCompareGeneric: public HBinaryOperation { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2532 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2533 | HCompareGeneric(HValue* context, |
| 2534 | HValue* left, |
| 2535 | HValue* right, |
| 2536 | Token::Value token) |
| 2537 | : HBinaryOperation(context, left, right), token_(token) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2538 | ASSERT(Token::IsCompareOp(token)); |
| 2539 | set_representation(Representation::Tagged()); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2540 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2541 | } |
| 2542 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2543 | virtual Representation RequiredInputRepresentation(int index) const { |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2544 | return Representation::Tagged(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2545 | } |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2546 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2547 | Representation GetInputRepresentation() const { |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2548 | return Representation::Tagged(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2549 | } |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2550 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2551 | Token::Value token() const { return token_; } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2552 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2553 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2554 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2555 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2556 | DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
| 2557 | |
| 2558 | private: |
| 2559 | Token::Value token_; |
| 2560 | }; |
| 2561 | |
| 2562 | |
| 2563 | class HCompareIDAndBranch: public HTemplateControlInstruction<2, 2> { |
| 2564 | public: |
| 2565 | HCompareIDAndBranch(HValue* left, HValue* right, Token::Value token) |
| 2566 | : token_(token) { |
| 2567 | ASSERT(Token::IsCompareOp(token)); |
| 2568 | SetOperandAt(0, left); |
| 2569 | SetOperandAt(1, right); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2570 | } |
| 2571 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2572 | HValue* left() { return OperandAt(0); } |
| 2573 | HValue* right() { return OperandAt(1); } |
| 2574 | Token::Value token() const { return token_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2575 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2576 | void SetInputRepresentation(Representation r); |
| 2577 | Representation GetInputRepresentation() const { |
| 2578 | return input_representation_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2579 | } |
| 2580 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2581 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2582 | return input_representation_; |
| 2583 | } |
| 2584 | virtual void PrintDataTo(StringStream* stream); |
| 2585 | |
| 2586 | DECLARE_CONCRETE_INSTRUCTION(CompareIDAndBranch) |
| 2587 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2588 | private: |
| 2589 | Representation input_representation_; |
| 2590 | Token::Value token_; |
| 2591 | }; |
| 2592 | |
| 2593 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2594 | class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2595 | public: |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2596 | HCompareObjectEqAndBranch(HValue* left, HValue* right) { |
| 2597 | SetOperandAt(0, left); |
| 2598 | SetOperandAt(1, right); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2599 | } |
| 2600 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2601 | HValue* left() { return OperandAt(0); } |
| 2602 | HValue* right() { return OperandAt(1); } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 2603 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2604 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2605 | return Representation::Tagged(); |
| 2606 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2607 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2608 | DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2609 | }; |
| 2610 | |
| 2611 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2612 | class HCompareConstantEqAndBranch: public HUnaryControlInstruction { |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 2613 | public: |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2614 | HCompareConstantEqAndBranch(HValue* left, int right, Token::Value op) |
| 2615 | : HUnaryControlInstruction(left, NULL, NULL), op_(op), right_(right) { |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 2616 | ASSERT(op == Token::EQ_STRICT); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 2617 | } |
| 2618 | |
| 2619 | Token::Value op() const { return op_; } |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2620 | HValue* left() { return value(); } |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 2621 | int right() const { return right_; } |
| 2622 | |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 2623 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2624 | return Representation::Integer32(); |
| 2625 | } |
| 2626 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2627 | DECLARE_CONCRETE_INSTRUCTION(CompareConstantEqAndBranch); |
whesse@chromium.org | 7b26015 | 2011-06-20 15:33:18 +0000 | [diff] [blame] | 2628 | |
| 2629 | private: |
| 2630 | const Token::Value op_; |
| 2631 | const int right_; |
| 2632 | }; |
| 2633 | |
| 2634 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2635 | class HIsNullAndBranch: public HUnaryControlInstruction { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2636 | public: |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2637 | HIsNullAndBranch(HValue* value, bool is_strict) |
| 2638 | : HUnaryControlInstruction(value, NULL, NULL), is_strict_(is_strict) { } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 2639 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2640 | bool is_strict() const { return is_strict_; } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 2641 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2642 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2643 | return Representation::Tagged(); |
| 2644 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2645 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2646 | DECLARE_CONCRETE_INSTRUCTION(IsNullAndBranch) |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 2647 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2648 | private: |
| 2649 | bool is_strict_; |
| 2650 | }; |
| 2651 | |
| 2652 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2653 | class HIsObjectAndBranch: public HUnaryControlInstruction { |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 2654 | public: |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2655 | explicit HIsObjectAndBranch(HValue* value) |
| 2656 | : HUnaryControlInstruction(value, NULL, NULL) { } |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 2657 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2658 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2659 | return Representation::Tagged(); |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 2660 | } |
| 2661 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2662 | DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) |
| 2663 | }; |
| 2664 | |
| 2665 | |
| 2666 | class HIsSmiAndBranch: public HUnaryControlInstruction { |
| 2667 | public: |
| 2668 | explicit HIsSmiAndBranch(HValue* value) |
| 2669 | : HUnaryControlInstruction(value, NULL, NULL) { } |
| 2670 | |
| 2671 | DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) |
| 2672 | |
| 2673 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2674 | return Representation::Tagged(); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 2675 | } |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 2676 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2677 | protected: |
| 2678 | virtual bool DataEquals(HValue* other) { return true; } |
| 2679 | }; |
| 2680 | |
| 2681 | |
| 2682 | class HIsUndetectableAndBranch: public HUnaryControlInstruction { |
| 2683 | public: |
| 2684 | explicit HIsUndetectableAndBranch(HValue* value) |
| 2685 | : HUnaryControlInstruction(value, NULL, NULL) { } |
| 2686 | |
| 2687 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2688 | return Representation::Tagged(); |
| 2689 | } |
| 2690 | |
| 2691 | DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) |
| 2692 | }; |
| 2693 | |
| 2694 | |
| 2695 | class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> { |
| 2696 | public: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2697 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2698 | return Representation::None(); |
| 2699 | } |
| 2700 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2701 | DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) |
erik.corry@gmail.com | d91075f | 2011-02-10 07:45:38 +0000 | [diff] [blame] | 2702 | }; |
| 2703 | |
| 2704 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2705 | class HHasInstanceTypeAndBranch: public HUnaryControlInstruction { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2706 | public: |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2707 | HHasInstanceTypeAndBranch(HValue* value, InstanceType type) |
| 2708 | : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } |
| 2709 | HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) |
| 2710 | : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2711 | ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. |
| 2712 | } |
| 2713 | |
| 2714 | InstanceType from() { return from_; } |
| 2715 | InstanceType to() { return to_; } |
| 2716 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2717 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2718 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2719 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2720 | return Representation::Tagged(); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 2721 | } |
| 2722 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2723 | DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) |
| 2724 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2725 | private: |
| 2726 | InstanceType from_; |
| 2727 | InstanceType to_; // Inclusive range, not all combinations work. |
| 2728 | }; |
| 2729 | |
| 2730 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2731 | class HHasCachedArrayIndexAndBranch: public HUnaryControlInstruction { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2732 | public: |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2733 | explicit HHasCachedArrayIndexAndBranch(HValue* value) |
| 2734 | : HUnaryControlInstruction(value, NULL, NULL) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2735 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2736 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2737 | return Representation::Tagged(); |
| 2738 | } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2739 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2740 | DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2741 | }; |
| 2742 | |
| 2743 | |
vegorov@chromium.org | 3cf4731 | 2011-06-29 13:20:01 +0000 | [diff] [blame] | 2744 | class HGetCachedArrayIndex: public HUnaryOperation { |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 2745 | public: |
vegorov@chromium.org | 3cf4731 | 2011-06-29 13:20:01 +0000 | [diff] [blame] | 2746 | explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { |
| 2747 | set_representation(Representation::Tagged()); |
| 2748 | SetFlag(kUseGVN); |
| 2749 | } |
| 2750 | |
| 2751 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2752 | return Representation::Tagged(); |
| 2753 | } |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 2754 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2755 | DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 2756 | |
| 2757 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2758 | virtual bool DataEquals(HValue* other) { return true; } |
kmillikin@chromium.org | 49edbdf | 2011-02-16 12:32:18 +0000 | [diff] [blame] | 2759 | }; |
| 2760 | |
| 2761 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2762 | class HClassOfTestAndBranch: public HUnaryControlInstruction { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2763 | public: |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2764 | HClassOfTestAndBranch(HValue* value, Handle<String> class_name) |
| 2765 | : HUnaryControlInstruction(value, NULL, NULL), |
| 2766 | class_name_(class_name) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2767 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2768 | DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) |
| 2769 | |
| 2770 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2771 | return Representation::Tagged(); |
| 2772 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2773 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2774 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2775 | |
| 2776 | Handle<String> class_name() const { return class_name_; } |
| 2777 | |
| 2778 | private: |
| 2779 | Handle<String> class_name_; |
| 2780 | }; |
| 2781 | |
| 2782 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2783 | class HTypeofIsAndBranch: public HUnaryControlInstruction { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2784 | public: |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2785 | HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) |
| 2786 | : HUnaryControlInstruction(value, NULL, NULL), |
| 2787 | type_literal_(type_literal) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2788 | |
| 2789 | Handle<String> type_literal() { return type_literal_; } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2790 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2791 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2792 | DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2793 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 2794 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2795 | return Representation::Tagged(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2796 | } |
| 2797 | |
| 2798 | private: |
| 2799 | Handle<String> type_literal_; |
| 2800 | }; |
| 2801 | |
| 2802 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2803 | class HInstanceOf: public HBinaryOperation { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2804 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2805 | HInstanceOf(HValue* context, HValue* left, HValue* right) |
| 2806 | : HBinaryOperation(context, left, right) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2807 | set_representation(Representation::Tagged()); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2808 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2809 | } |
| 2810 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2811 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2812 | return Representation::Tagged(); |
| 2813 | } |
| 2814 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 2815 | virtual HType CalculateInferredType(); |
| 2816 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2817 | virtual void PrintDataTo(StringStream* stream); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 2818 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2819 | DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2820 | }; |
| 2821 | |
| 2822 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2823 | class HInstanceOfKnownGlobal: public HTemplateInstruction<2> { |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 2824 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2825 | HInstanceOfKnownGlobal(HValue* context, |
| 2826 | HValue* left, |
| 2827 | Handle<JSFunction> right) |
| 2828 | : function_(right) { |
| 2829 | SetOperandAt(0, context); |
| 2830 | SetOperandAt(1, left); |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 2831 | set_representation(Representation::Tagged()); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2832 | SetAllSideEffects(); |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 2833 | } |
| 2834 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2835 | HValue* context() { return OperandAt(0); } |
| 2836 | HValue* left() { return OperandAt(1); } |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 2837 | Handle<JSFunction> function() { return function_; } |
| 2838 | |
| 2839 | virtual Representation RequiredInputRepresentation(int index) const { |
| 2840 | return Representation::Tagged(); |
| 2841 | } |
| 2842 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 2843 | virtual HType CalculateInferredType(); |
| 2844 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2845 | DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 2846 | |
| 2847 | private: |
| 2848 | Handle<JSFunction> function_; |
| 2849 | }; |
| 2850 | |
| 2851 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2852 | class HPower: public HTemplateInstruction<2> { |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 2853 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2854 | HPower(HValue* left, HValue* right) { |
| 2855 | SetOperandAt(0, left); |
| 2856 | SetOperandAt(1, right); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 2857 | set_representation(Representation::Double()); |
| 2858 | SetFlag(kUseGVN); |
| 2859 | } |
| 2860 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2861 | HValue* left() { return OperandAt(0); } |
| 2862 | HValue* right() { return OperandAt(1); } |
| 2863 | |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 2864 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2865 | return index == 0 |
| 2866 | ? Representation::Double() |
| 2867 | : Representation::None(); |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 2868 | } |
| 2869 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2870 | DECLARE_CONCRETE_INSTRUCTION(Power) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2871 | |
| 2872 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2873 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 2874 | }; |
| 2875 | |
| 2876 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2877 | class HAdd: public HArithmeticBinaryOperation { |
| 2878 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2879 | HAdd(HValue* context, HValue* left, HValue* right) |
| 2880 | : HArithmeticBinaryOperation(context, left, right) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2881 | SetFlag(kCanOverflow); |
| 2882 | } |
| 2883 | |
| 2884 | // Add is only commutative if two integer values are added and not if two |
| 2885 | // tagged values are added (because it might be a String concatenation). |
| 2886 | virtual bool IsCommutative() const { |
| 2887 | return !representation().IsTagged(); |
| 2888 | } |
| 2889 | |
| 2890 | virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2891 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2892 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2893 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2894 | DECLARE_CONCRETE_INSTRUCTION(Add) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2895 | |
| 2896 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2897 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2898 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2899 | virtual Range* InferRange(); |
| 2900 | }; |
| 2901 | |
| 2902 | |
| 2903 | class HSub: public HArithmeticBinaryOperation { |
| 2904 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2905 | HSub(HValue* context, HValue* left, HValue* right) |
| 2906 | : HArithmeticBinaryOperation(context, left, right) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2907 | SetFlag(kCanOverflow); |
| 2908 | } |
| 2909 | |
| 2910 | virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2911 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2912 | DECLARE_CONCRETE_INSTRUCTION(Sub) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2913 | |
| 2914 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2915 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2916 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2917 | virtual Range* InferRange(); |
| 2918 | }; |
| 2919 | |
| 2920 | |
| 2921 | class HMul: public HArithmeticBinaryOperation { |
| 2922 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2923 | HMul(HValue* context, HValue* left, HValue* right) |
| 2924 | : HArithmeticBinaryOperation(context, left, right) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2925 | SetFlag(kCanOverflow); |
| 2926 | } |
| 2927 | |
| 2928 | virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2929 | |
| 2930 | // Only commutative if it is certain that not two objects are multiplicated. |
| 2931 | virtual bool IsCommutative() const { |
| 2932 | return !representation().IsTagged(); |
| 2933 | } |
| 2934 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2935 | DECLARE_CONCRETE_INSTRUCTION(Mul) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2936 | |
| 2937 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2938 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2939 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2940 | virtual Range* InferRange(); |
| 2941 | }; |
| 2942 | |
| 2943 | |
| 2944 | class HMod: public HArithmeticBinaryOperation { |
| 2945 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2946 | HMod(HValue* context, HValue* left, HValue* right) |
| 2947 | : HArithmeticBinaryOperation(context, left, right) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2948 | SetFlag(kCanBeDivByZero); |
| 2949 | } |
| 2950 | |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 2951 | bool HasPowerOf2Divisor() { |
| 2952 | if (right()->IsConstant() && |
| 2953 | HConstant::cast(right())->HasInteger32Value()) { |
| 2954 | int32_t value = HConstant::cast(right())->Integer32Value(); |
| 2955 | return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); |
| 2956 | } |
| 2957 | |
| 2958 | return false; |
| 2959 | } |
| 2960 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2961 | virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2962 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2963 | DECLARE_CONCRETE_INSTRUCTION(Mod) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2964 | |
| 2965 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2966 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2967 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2968 | virtual Range* InferRange(); |
| 2969 | }; |
| 2970 | |
| 2971 | |
| 2972 | class HDiv: public HArithmeticBinaryOperation { |
| 2973 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2974 | HDiv(HValue* context, HValue* left, HValue* right) |
| 2975 | : HArithmeticBinaryOperation(context, left, right) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2976 | SetFlag(kCanBeDivByZero); |
| 2977 | SetFlag(kCanOverflow); |
| 2978 | } |
| 2979 | |
| 2980 | virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 2981 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2982 | DECLARE_CONCRETE_INSTRUCTION(Div) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2983 | |
| 2984 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2985 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 2986 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2987 | virtual Range* InferRange(); |
| 2988 | }; |
| 2989 | |
| 2990 | |
| 2991 | class HBitAnd: public HBitwiseBinaryOperation { |
| 2992 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 2993 | HBitAnd(HValue* context, HValue* left, HValue* right) |
| 2994 | : HBitwiseBinaryOperation(context, left, right) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2995 | |
| 2996 | virtual bool IsCommutative() const { return true; } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 2997 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 2998 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 2999 | DECLARE_CONCRETE_INSTRUCTION(BitAnd) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3000 | |
| 3001 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3002 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3003 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3004 | virtual Range* InferRange(); |
| 3005 | }; |
| 3006 | |
| 3007 | |
| 3008 | class HBitXor: public HBitwiseBinaryOperation { |
| 3009 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3010 | HBitXor(HValue* context, HValue* left, HValue* right) |
| 3011 | : HBitwiseBinaryOperation(context, left, right) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3012 | |
| 3013 | virtual bool IsCommutative() const { return true; } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3014 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3015 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3016 | DECLARE_CONCRETE_INSTRUCTION(BitXor) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3017 | |
| 3018 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3019 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3020 | }; |
| 3021 | |
| 3022 | |
| 3023 | class HBitOr: public HBitwiseBinaryOperation { |
| 3024 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3025 | HBitOr(HValue* context, HValue* left, HValue* right) |
| 3026 | : HBitwiseBinaryOperation(context, left, right) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3027 | |
| 3028 | virtual bool IsCommutative() const { return true; } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3029 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3030 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3031 | DECLARE_CONCRETE_INSTRUCTION(BitOr) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3032 | |
| 3033 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3034 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3035 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3036 | virtual Range* InferRange(); |
| 3037 | }; |
| 3038 | |
| 3039 | |
| 3040 | class HShl: public HBitwiseBinaryOperation { |
| 3041 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3042 | HShl(HValue* context, HValue* left, HValue* right) |
| 3043 | : HBitwiseBinaryOperation(context, left, right) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3044 | |
| 3045 | virtual Range* InferRange(); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3046 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3047 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3048 | DECLARE_CONCRETE_INSTRUCTION(Shl) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3049 | |
| 3050 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3051 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3052 | }; |
| 3053 | |
| 3054 | |
| 3055 | class HShr: public HBitwiseBinaryOperation { |
| 3056 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3057 | HShr(HValue* context, HValue* left, HValue* right) |
| 3058 | : HBitwiseBinaryOperation(context, left, right) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3059 | |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 3060 | virtual Range* InferRange(); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3061 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3062 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3063 | DECLARE_CONCRETE_INSTRUCTION(Shr) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3064 | |
| 3065 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3066 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3067 | }; |
| 3068 | |
| 3069 | |
| 3070 | class HSar: public HBitwiseBinaryOperation { |
| 3071 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3072 | HSar(HValue* context, HValue* left, HValue* right) |
| 3073 | : HBitwiseBinaryOperation(context, left, right) { } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3074 | |
| 3075 | virtual Range* InferRange(); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3076 | virtual HType CalculateInferredType(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3077 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3078 | DECLARE_CONCRETE_INSTRUCTION(Sar) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3079 | |
| 3080 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3081 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3082 | }; |
| 3083 | |
| 3084 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3085 | class HOsrEntry: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3086 | public: |
| 3087 | explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { |
| 3088 | SetFlag(kChangesOsrEntries); |
| 3089 | } |
| 3090 | |
| 3091 | int ast_id() const { return ast_id_; } |
| 3092 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3093 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3094 | return Representation::None(); |
| 3095 | } |
| 3096 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3097 | DECLARE_CONCRETE_INSTRUCTION(OsrEntry) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3098 | |
| 3099 | private: |
| 3100 | int ast_id_; |
| 3101 | }; |
| 3102 | |
| 3103 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3104 | class HParameter: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3105 | public: |
| 3106 | explicit HParameter(unsigned index) : index_(index) { |
| 3107 | set_representation(Representation::Tagged()); |
| 3108 | } |
| 3109 | |
| 3110 | unsigned index() const { return index_; } |
| 3111 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3112 | virtual void PrintDataTo(StringStream* stream); |
| 3113 | |
| 3114 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3115 | return Representation::None(); |
| 3116 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3117 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3118 | DECLARE_CONCRETE_INSTRUCTION(Parameter) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3119 | |
| 3120 | private: |
| 3121 | unsigned index_; |
| 3122 | }; |
| 3123 | |
| 3124 | |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3125 | class HCallStub: public HUnaryCall { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3126 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3127 | HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) |
| 3128 | : HUnaryCall(context, argument_count), |
| 3129 | major_key_(major_key), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3130 | transcendental_type_(TranscendentalCache::kNumberOfCaches) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3131 | } |
| 3132 | |
| 3133 | CodeStub::Major major_key() { return major_key_; } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3134 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3135 | HValue* context() { return value(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3136 | |
| 3137 | void set_transcendental_type(TranscendentalCache::Type transcendental_type) { |
| 3138 | transcendental_type_ = transcendental_type; |
| 3139 | } |
| 3140 | TranscendentalCache::Type transcendental_type() { |
| 3141 | return transcendental_type_; |
| 3142 | } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3143 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3144 | virtual void PrintDataTo(StringStream* stream); |
| 3145 | |
| 3146 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3147 | return Representation::Tagged(); |
| 3148 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3149 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3150 | DECLARE_CONCRETE_INSTRUCTION(CallStub) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3151 | |
| 3152 | private: |
| 3153 | CodeStub::Major major_key_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3154 | TranscendentalCache::Type transcendental_type_; |
| 3155 | }; |
| 3156 | |
| 3157 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3158 | class HUnknownOSRValue: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3159 | public: |
| 3160 | HUnknownOSRValue() { set_representation(Representation::Tagged()); } |
| 3161 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3162 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3163 | return Representation::None(); |
| 3164 | } |
| 3165 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3166 | DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3167 | }; |
| 3168 | |
| 3169 | |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 3170 | class HLoadGlobalCell: public HTemplateInstruction<0> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3171 | public: |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 3172 | HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3173 | : cell_(cell), check_hole_value_(check_hole_value) { |
| 3174 | set_representation(Representation::Tagged()); |
| 3175 | SetFlag(kUseGVN); |
| 3176 | SetFlag(kDependsOnGlobalVars); |
| 3177 | } |
| 3178 | |
| 3179 | Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
| 3180 | bool check_hole_value() const { return check_hole_value_; } |
| 3181 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3182 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3183 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3184 | virtual intptr_t Hashcode() { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 3185 | ASSERT(!HEAP->allow_allocation(false)); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3186 | return reinterpret_cast<intptr_t>(*cell_); |
| 3187 | } |
| 3188 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3189 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3190 | return Representation::None(); |
| 3191 | } |
| 3192 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3193 | DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3194 | |
| 3195 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3196 | virtual bool DataEquals(HValue* other) { |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 3197 | HLoadGlobalCell* b = HLoadGlobalCell::cast(other); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3198 | return cell_.is_identical_to(b->cell()); |
| 3199 | } |
| 3200 | |
| 3201 | private: |
| 3202 | Handle<JSGlobalPropertyCell> cell_; |
| 3203 | bool check_hole_value_; |
| 3204 | }; |
| 3205 | |
| 3206 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3207 | class HLoadGlobalGeneric: public HTemplateInstruction<2> { |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 3208 | public: |
| 3209 | HLoadGlobalGeneric(HValue* context, |
| 3210 | HValue* global_object, |
| 3211 | Handle<Object> name, |
| 3212 | bool for_typeof) |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3213 | : name_(name), |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 3214 | for_typeof_(for_typeof) { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3215 | SetOperandAt(0, context); |
| 3216 | SetOperandAt(1, global_object); |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 3217 | set_representation(Representation::Tagged()); |
| 3218 | SetAllSideEffects(); |
| 3219 | } |
| 3220 | |
| 3221 | HValue* context() { return OperandAt(0); } |
| 3222 | HValue* global_object() { return OperandAt(1); } |
| 3223 | Handle<Object> name() const { return name_; } |
| 3224 | bool for_typeof() const { return for_typeof_; } |
| 3225 | |
| 3226 | virtual void PrintDataTo(StringStream* stream); |
| 3227 | |
| 3228 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3229 | return Representation::Tagged(); |
| 3230 | } |
| 3231 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3232 | DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 3233 | |
| 3234 | private: |
| 3235 | Handle<Object> name_; |
| 3236 | bool for_typeof_; |
| 3237 | }; |
| 3238 | |
| 3239 | |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 3240 | class HStoreGlobalCell: public HUnaryOperation { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3241 | public: |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 3242 | HStoreGlobalCell(HValue* value, |
| 3243 | Handle<JSGlobalPropertyCell> cell, |
| 3244 | bool check_hole_value) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3245 | : HUnaryOperation(value), |
| 3246 | cell_(cell), |
| 3247 | check_hole_value_(check_hole_value) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3248 | SetFlag(kChangesGlobalVars); |
| 3249 | } |
| 3250 | |
| 3251 | Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3252 | bool check_hole_value() const { return check_hole_value_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3253 | |
| 3254 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3255 | return Representation::Tagged(); |
| 3256 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3257 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3258 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3259 | DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3260 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3261 | private: |
| 3262 | Handle<JSGlobalPropertyCell> cell_; |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3263 | bool check_hole_value_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3264 | }; |
| 3265 | |
| 3266 | |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 3267 | class HStoreGlobalGeneric: public HTemplateInstruction<3> { |
| 3268 | public: |
| 3269 | HStoreGlobalGeneric(HValue* context, |
| 3270 | HValue* global_object, |
| 3271 | Handle<Object> name, |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 3272 | HValue* value, |
| 3273 | bool strict_mode) |
| 3274 | : name_(name), |
| 3275 | strict_mode_(strict_mode) { |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 3276 | SetOperandAt(0, context); |
| 3277 | SetOperandAt(1, global_object); |
| 3278 | SetOperandAt(2, value); |
| 3279 | set_representation(Representation::Tagged()); |
| 3280 | SetAllSideEffects(); |
| 3281 | } |
| 3282 | |
| 3283 | HValue* context() { return OperandAt(0); } |
| 3284 | HValue* global_object() { return OperandAt(1); } |
| 3285 | Handle<Object> name() const { return name_; } |
| 3286 | HValue* value() { return OperandAt(2); } |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 3287 | bool strict_mode() { return strict_mode_; } |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 3288 | |
| 3289 | virtual void PrintDataTo(StringStream* stream); |
| 3290 | |
| 3291 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3292 | return Representation::Tagged(); |
| 3293 | } |
| 3294 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3295 | DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 3296 | |
| 3297 | private: |
| 3298 | Handle<Object> name_; |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 3299 | bool strict_mode_; |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 3300 | }; |
| 3301 | |
| 3302 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3303 | class HLoadContextSlot: public HUnaryOperation { |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 3304 | public: |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3305 | HLoadContextSlot(HValue* context , int slot_index) |
| 3306 | : HUnaryOperation(context), slot_index_(slot_index) { |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 3307 | set_representation(Representation::Tagged()); |
| 3308 | SetFlag(kUseGVN); |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3309 | SetFlag(kDependsOnContextSlots); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 3310 | } |
| 3311 | |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 3312 | int slot_index() const { return slot_index_; } |
| 3313 | |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3314 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3315 | return Representation::Tagged(); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 3316 | } |
| 3317 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3318 | virtual void PrintDataTo(StringStream* stream); |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3319 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3320 | DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 3321 | |
| 3322 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3323 | virtual bool DataEquals(HValue* other) { |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 3324 | HLoadContextSlot* b = HLoadContextSlot::cast(other); |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3325 | return (slot_index() == b->slot_index()); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 3326 | } |
| 3327 | |
| 3328 | private: |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3329 | int slot_index_; |
| 3330 | }; |
| 3331 | |
| 3332 | |
| 3333 | static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
sgjesse@chromium.org | 6db8871 | 2011-07-11 11:41:22 +0000 | [diff] [blame] | 3334 | return !value->type().IsBoolean() |
| 3335 | && !value->type().IsSmi() |
| 3336 | && !(value->IsConstant() && HConstant::cast(value)->InOldSpace()); |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3337 | } |
| 3338 | |
| 3339 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3340 | class HStoreContextSlot: public HTemplateInstruction<2> { |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3341 | public: |
| 3342 | HStoreContextSlot(HValue* context, int slot_index, HValue* value) |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3343 | : slot_index_(slot_index) { |
| 3344 | SetOperandAt(0, context); |
| 3345 | SetOperandAt(1, value); |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3346 | SetFlag(kChangesContextSlots); |
| 3347 | } |
| 3348 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3349 | HValue* context() { return OperandAt(0); } |
| 3350 | HValue* value() { return OperandAt(1); } |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3351 | int slot_index() const { return slot_index_; } |
| 3352 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3353 | bool NeedsWriteBarrier() { |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3354 | return StoringValueNeedsWriteBarrier(value()); |
| 3355 | } |
| 3356 | |
| 3357 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3358 | return Representation::Tagged(); |
| 3359 | } |
| 3360 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3361 | virtual void PrintDataTo(StringStream* stream); |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3362 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3363 | DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3364 | |
| 3365 | private: |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 3366 | int slot_index_; |
| 3367 | }; |
| 3368 | |
| 3369 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3370 | class HLoadNamedField: public HUnaryOperation { |
| 3371 | public: |
| 3372 | HLoadNamedField(HValue* object, bool is_in_object, int offset) |
| 3373 | : HUnaryOperation(object), |
| 3374 | is_in_object_(is_in_object), |
| 3375 | offset_(offset) { |
| 3376 | set_representation(Representation::Tagged()); |
| 3377 | SetFlag(kUseGVN); |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3378 | SetFlag(kDependsOnMaps); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3379 | if (is_in_object) { |
| 3380 | SetFlag(kDependsOnInobjectFields); |
| 3381 | } else { |
| 3382 | SetFlag(kDependsOnBackingStoreFields); |
| 3383 | } |
| 3384 | } |
| 3385 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3386 | HValue* object() { return OperandAt(0); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3387 | bool is_in_object() const { return is_in_object_; } |
| 3388 | int offset() const { return offset_; } |
| 3389 | |
| 3390 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3391 | return Representation::Tagged(); |
| 3392 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3393 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3394 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3395 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3396 | |
| 3397 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3398 | virtual bool DataEquals(HValue* other) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3399 | HLoadNamedField* b = HLoadNamedField::cast(other); |
| 3400 | return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; |
| 3401 | } |
| 3402 | |
| 3403 | private: |
| 3404 | bool is_in_object_; |
| 3405 | int offset_; |
| 3406 | }; |
| 3407 | |
| 3408 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3409 | class HLoadNamedFieldPolymorphic: public HTemplateInstruction<2> { |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3410 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3411 | HLoadNamedFieldPolymorphic(HValue* context, |
| 3412 | HValue* object, |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 3413 | SmallMapList* types, |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3414 | Handle<String> name); |
| 3415 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3416 | HValue* context() { return OperandAt(0); } |
| 3417 | HValue* object() { return OperandAt(1); } |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 3418 | SmallMapList* types() { return &types_; } |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3419 | Handle<String> name() { return name_; } |
| 3420 | bool need_generic() { return need_generic_; } |
| 3421 | |
| 3422 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3423 | return Representation::Tagged(); |
| 3424 | } |
| 3425 | |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 3426 | virtual void PrintDataTo(StringStream* stream); |
| 3427 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3428 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3429 | |
| 3430 | static const int kMaxLoadPolymorphism = 4; |
| 3431 | |
| 3432 | protected: |
| 3433 | virtual bool DataEquals(HValue* value); |
| 3434 | |
| 3435 | private: |
ricow@chromium.org | ddd545c | 2011-08-24 12:02:41 +0000 | [diff] [blame] | 3436 | SmallMapList types_; |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3437 | Handle<String> name_; |
| 3438 | bool need_generic_; |
| 3439 | }; |
| 3440 | |
| 3441 | |
| 3442 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3443 | class HLoadNamedGeneric: public HTemplateInstruction<2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3444 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3445 | HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3446 | : name_(name) { |
| 3447 | SetOperandAt(0, context); |
| 3448 | SetOperandAt(1, object); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3449 | set_representation(Representation::Tagged()); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3450 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3451 | } |
| 3452 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3453 | HValue* context() { return OperandAt(0); } |
| 3454 | HValue* object() { return OperandAt(1); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3455 | Handle<Object> name() const { return name_; } |
| 3456 | |
| 3457 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3458 | return Representation::Tagged(); |
| 3459 | } |
| 3460 | |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 3461 | virtual void PrintDataTo(StringStream* stream); |
| 3462 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3463 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3464 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3465 | private: |
| 3466 | Handle<Object> name_; |
| 3467 | }; |
| 3468 | |
| 3469 | |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 3470 | class HLoadFunctionPrototype: public HUnaryOperation { |
| 3471 | public: |
| 3472 | explicit HLoadFunctionPrototype(HValue* function) |
| 3473 | : HUnaryOperation(function) { |
| 3474 | set_representation(Representation::Tagged()); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3475 | SetFlag(kUseGVN); |
| 3476 | SetFlag(kDependsOnCalls); |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 3477 | } |
| 3478 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3479 | HValue* function() { return OperandAt(0); } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 3480 | |
| 3481 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3482 | return Representation::Tagged(); |
| 3483 | } |
| 3484 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3485 | DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 3486 | |
| 3487 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3488 | virtual bool DataEquals(HValue* other) { return true; } |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 3489 | }; |
| 3490 | |
| 3491 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3492 | class HLoadKeyedFastElement: public HTemplateInstruction<2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3493 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3494 | HLoadKeyedFastElement(HValue* obj, HValue* key) { |
| 3495 | SetOperandAt(0, obj); |
| 3496 | SetOperandAt(1, key); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3497 | set_representation(Representation::Tagged()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3498 | SetFlag(kDependsOnArrayElements); |
| 3499 | SetFlag(kUseGVN); |
| 3500 | } |
| 3501 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3502 | HValue* object() { return OperandAt(0); } |
| 3503 | HValue* key() { return OperandAt(1); } |
| 3504 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3505 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3506 | // The key is supposed to be Integer32. |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3507 | return index == 0 |
| 3508 | ? Representation::Tagged() |
| 3509 | : Representation::Integer32(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3510 | } |
| 3511 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3512 | virtual void PrintDataTo(StringStream* stream); |
| 3513 | |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 3514 | bool RequiresHoleCheck() const; |
| 3515 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3516 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3517 | |
| 3518 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3519 | virtual bool DataEquals(HValue* other) { return true; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3520 | }; |
| 3521 | |
| 3522 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 3523 | class HLoadKeyedFastDoubleElement: public HTemplateInstruction<2> { |
| 3524 | public: |
| 3525 | HLoadKeyedFastDoubleElement(HValue* elements, HValue* key) { |
| 3526 | SetOperandAt(0, elements); |
| 3527 | SetOperandAt(1, key); |
| 3528 | set_representation(Representation::Double()); |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 3529 | SetFlag(kDependsOnDoubleArrayElements); |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 3530 | SetFlag(kUseGVN); |
| 3531 | } |
| 3532 | |
| 3533 | HValue* elements() { return OperandAt(0); } |
| 3534 | HValue* key() { return OperandAt(1); } |
| 3535 | |
| 3536 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3537 | // The key is supposed to be Integer32. |
| 3538 | return index == 0 |
| 3539 | ? Representation::Tagged() |
| 3540 | : Representation::Integer32(); |
| 3541 | } |
| 3542 | |
| 3543 | virtual void PrintDataTo(StringStream* stream); |
| 3544 | |
| 3545 | bool RequiresHoleCheck() const; |
| 3546 | |
| 3547 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement) |
| 3548 | |
| 3549 | protected: |
| 3550 | virtual bool DataEquals(HValue* other) { return true; } |
| 3551 | }; |
| 3552 | |
| 3553 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3554 | class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3555 | public: |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3556 | HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
| 3557 | HValue* key, |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 3558 | JSObject::ElementsKind elements_kind) |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3559 | : elements_kind_(elements_kind) { |
| 3560 | SetOperandAt(0, external_elements); |
| 3561 | SetOperandAt(1, key); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 3562 | if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS || |
| 3563 | elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3564 | set_representation(Representation::Double()); |
| 3565 | } else { |
| 3566 | set_representation(Representation::Integer32()); |
| 3567 | } |
| 3568 | SetFlag(kDependsOnSpecializedArrayElements); |
| 3569 | // Native code could change the specialized array. |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3570 | SetFlag(kDependsOnCalls); |
| 3571 | SetFlag(kUseGVN); |
| 3572 | } |
| 3573 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3574 | virtual void PrintDataTo(StringStream* stream); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3575 | |
| 3576 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3577 | // The key is supposed to be Integer32, but the base pointer |
| 3578 | // for the element load is a naked pointer. |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3579 | return index == 0 |
| 3580 | ? Representation::External() |
| 3581 | : Representation::Integer32(); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3582 | } |
| 3583 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3584 | HValue* external_pointer() { return OperandAt(0); } |
| 3585 | HValue* key() { return OperandAt(1); } |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 3586 | JSObject::ElementsKind elements_kind() const { return elements_kind_; } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3587 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3588 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement) |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3589 | |
| 3590 | protected: |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3591 | virtual bool DataEquals(HValue* other) { |
| 3592 | if (!other->IsLoadKeyedSpecializedArrayElement()) return false; |
| 3593 | HLoadKeyedSpecializedArrayElement* cast_other = |
| 3594 | HLoadKeyedSpecializedArrayElement::cast(other); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 3595 | return elements_kind_ == cast_other->elements_kind(); |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3596 | } |
| 3597 | |
| 3598 | private: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 3599 | JSObject::ElementsKind elements_kind_; |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3600 | }; |
| 3601 | |
| 3602 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3603 | class HLoadKeyedGeneric: public HTemplateInstruction<3> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3604 | public: |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 3605 | HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3606 | set_representation(Representation::Tagged()); |
| 3607 | SetOperandAt(0, obj); |
| 3608 | SetOperandAt(1, key); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3609 | SetOperandAt(2, context); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3610 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3611 | } |
| 3612 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3613 | HValue* object() { return OperandAt(0); } |
| 3614 | HValue* key() { return OperandAt(1); } |
| 3615 | HValue* context() { return OperandAt(2); } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3616 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3617 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3618 | |
| 3619 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3620 | return Representation::Tagged(); |
| 3621 | } |
| 3622 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3623 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3624 | }; |
| 3625 | |
| 3626 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3627 | class HStoreNamedField: public HTemplateInstruction<2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3628 | public: |
| 3629 | HStoreNamedField(HValue* obj, |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3630 | Handle<String> name, |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3631 | HValue* val, |
| 3632 | bool in_object, |
| 3633 | int offset) |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3634 | : name_(name), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3635 | is_in_object_(in_object), |
| 3636 | offset_(offset) { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3637 | SetOperandAt(0, obj); |
| 3638 | SetOperandAt(1, val); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3639 | if (is_in_object_) { |
| 3640 | SetFlag(kChangesInobjectFields); |
| 3641 | } else { |
| 3642 | SetFlag(kChangesBackingStoreFields); |
| 3643 | } |
| 3644 | } |
| 3645 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3646 | DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3647 | |
| 3648 | virtual Representation RequiredInputRepresentation(int index) const { |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3649 | return Representation::Tagged(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3650 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3651 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3652 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3653 | HValue* object() { return OperandAt(0); } |
| 3654 | HValue* value() { return OperandAt(1); } |
| 3655 | |
| 3656 | Handle<String> name() const { return name_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3657 | bool is_in_object() const { return is_in_object_; } |
| 3658 | int offset() const { return offset_; } |
| 3659 | Handle<Map> transition() const { return transition_; } |
| 3660 | void set_transition(Handle<Map> map) { transition_ = map; } |
| 3661 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3662 | bool NeedsWriteBarrier() { |
ricow@chromium.org | 83aa549 | 2011-02-07 12:42:56 +0000 | [diff] [blame] | 3663 | return StoringValueNeedsWriteBarrier(value()); |
| 3664 | } |
| 3665 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3666 | private: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3667 | Handle<String> name_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3668 | bool is_in_object_; |
| 3669 | int offset_; |
| 3670 | Handle<Map> transition_; |
| 3671 | }; |
| 3672 | |
| 3673 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3674 | class HStoreNamedGeneric: public HTemplateInstruction<3> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3675 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3676 | HStoreNamedGeneric(HValue* context, |
| 3677 | HValue* object, |
| 3678 | Handle<String> name, |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 3679 | HValue* value, |
| 3680 | bool strict_mode) |
| 3681 | : name_(name), |
| 3682 | strict_mode_(strict_mode) { |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3683 | SetOperandAt(0, object); |
| 3684 | SetOperandAt(1, value); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3685 | SetOperandAt(2, context); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3686 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3687 | } |
| 3688 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3689 | HValue* object() { return OperandAt(0); } |
| 3690 | HValue* value() { return OperandAt(1); } |
| 3691 | HValue* context() { return OperandAt(2); } |
| 3692 | Handle<String> name() { return name_; } |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 3693 | bool strict_mode() { return strict_mode_; } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3694 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3695 | virtual void PrintDataTo(StringStream* stream); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3696 | |
| 3697 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3698 | return Representation::Tagged(); |
| 3699 | } |
| 3700 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3701 | DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3702 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3703 | private: |
| 3704 | Handle<String> name_; |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 3705 | bool strict_mode_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3706 | }; |
| 3707 | |
| 3708 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3709 | class HStoreKeyedFastElement: public HTemplateInstruction<3> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3710 | public: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3711 | HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) { |
| 3712 | SetOperandAt(0, obj); |
| 3713 | SetOperandAt(1, key); |
| 3714 | SetOperandAt(2, val); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3715 | SetFlag(kChangesArrayElements); |
| 3716 | } |
| 3717 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3718 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3719 | // The key is supposed to be Integer32. |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3720 | return index == 1 |
| 3721 | ? Representation::Integer32() |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3722 | : Representation::Tagged(); |
| 3723 | } |
| 3724 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3725 | HValue* object() { return OperandAt(0); } |
| 3726 | HValue* key() { return OperandAt(1); } |
| 3727 | HValue* value() { return OperandAt(2); } |
| 3728 | |
| 3729 | bool NeedsWriteBarrier() { |
| 3730 | return StoringValueNeedsWriteBarrier(value()); |
| 3731 | } |
| 3732 | |
| 3733 | virtual void PrintDataTo(StringStream* stream); |
| 3734 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3735 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3736 | }; |
| 3737 | |
| 3738 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 3739 | class HStoreKeyedFastDoubleElement: public HTemplateInstruction<3> { |
| 3740 | public: |
| 3741 | HStoreKeyedFastDoubleElement(HValue* elements, |
| 3742 | HValue* key, |
| 3743 | HValue* val) { |
| 3744 | SetOperandAt(0, elements); |
| 3745 | SetOperandAt(1, key); |
| 3746 | SetOperandAt(2, val); |
ricow@chromium.org | 2c99e28 | 2011-07-28 09:15:17 +0000 | [diff] [blame] | 3747 | SetFlag(kChangesDoubleArrayElements); |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 3748 | } |
| 3749 | |
| 3750 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3751 | if (index == 1) { |
| 3752 | return Representation::Integer32(); |
| 3753 | } else if (index == 2) { |
| 3754 | return Representation::Double(); |
| 3755 | } else { |
| 3756 | return Representation::Tagged(); |
| 3757 | } |
| 3758 | } |
| 3759 | |
| 3760 | HValue* elements() { return OperandAt(0); } |
| 3761 | HValue* key() { return OperandAt(1); } |
| 3762 | HValue* value() { return OperandAt(2); } |
| 3763 | |
| 3764 | bool NeedsWriteBarrier() { |
| 3765 | return StoringValueNeedsWriteBarrier(value()); |
| 3766 | } |
| 3767 | |
| 3768 | virtual void PrintDataTo(StringStream* stream); |
| 3769 | |
| 3770 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement) |
| 3771 | }; |
| 3772 | |
| 3773 | |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3774 | class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> { |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3775 | public: |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3776 | HStoreKeyedSpecializedArrayElement(HValue* external_elements, |
| 3777 | HValue* key, |
| 3778 | HValue* val, |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 3779 | JSObject::ElementsKind elements_kind) |
| 3780 | : elements_kind_(elements_kind) { |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3781 | SetFlag(kChangesSpecializedArrayElements); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3782 | SetOperandAt(0, external_elements); |
| 3783 | SetOperandAt(1, key); |
| 3784 | SetOperandAt(2, val); |
| 3785 | } |
| 3786 | |
| 3787 | virtual void PrintDataTo(StringStream* stream); |
| 3788 | |
| 3789 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3790 | if (index == 0) { |
| 3791 | return Representation::External(); |
| 3792 | } else { |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 3793 | bool float_or_double_elements = |
| 3794 | elements_kind() == JSObject::EXTERNAL_FLOAT_ELEMENTS || |
| 3795 | elements_kind() == JSObject::EXTERNAL_DOUBLE_ELEMENTS; |
| 3796 | if (index == 2 && float_or_double_elements) { |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3797 | return Representation::Double(); |
| 3798 | } else { |
| 3799 | return Representation::Integer32(); |
| 3800 | } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3801 | } |
| 3802 | } |
| 3803 | |
| 3804 | HValue* external_pointer() { return OperandAt(0); } |
| 3805 | HValue* key() { return OperandAt(1); } |
| 3806 | HValue* value() { return OperandAt(2); } |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 3807 | JSObject::ElementsKind elements_kind() const { return elements_kind_; } |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3808 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3809 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement) |
| 3810 | |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3811 | private: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 3812 | JSObject::ElementsKind elements_kind_; |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3813 | }; |
| 3814 | |
| 3815 | |
| 3816 | class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3817 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3818 | HStoreKeyedGeneric(HValue* context, |
| 3819 | HValue* object, |
| 3820 | HValue* key, |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 3821 | HValue* value, |
| 3822 | bool strict_mode) |
| 3823 | : strict_mode_(strict_mode) { |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3824 | SetOperandAt(0, object); |
| 3825 | SetOperandAt(1, key); |
| 3826 | SetOperandAt(2, value); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3827 | SetOperandAt(3, context); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3828 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3829 | } |
| 3830 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3831 | HValue* object() { return OperandAt(0); } |
| 3832 | HValue* key() { return OperandAt(1); } |
| 3833 | HValue* value() { return OperandAt(2); } |
| 3834 | HValue* context() { return OperandAt(3); } |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 3835 | bool strict_mode() { return strict_mode_; } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3836 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3837 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3838 | return Representation::Tagged(); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 3839 | } |
| 3840 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3841 | virtual void PrintDataTo(StringStream* stream); |
| 3842 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3843 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 3844 | |
| 3845 | private: |
| 3846 | bool strict_mode_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3847 | }; |
| 3848 | |
| 3849 | |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 3850 | class HStringAdd: public HBinaryOperation { |
| 3851 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3852 | HStringAdd(HValue* context, HValue* left, HValue* right) |
| 3853 | : HBinaryOperation(context, left, right) { |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 3854 | set_representation(Representation::Tagged()); |
| 3855 | SetFlag(kUseGVN); |
| 3856 | SetFlag(kDependsOnMaps); |
| 3857 | } |
| 3858 | |
| 3859 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3860 | return Representation::Tagged(); |
| 3861 | } |
| 3862 | |
| 3863 | virtual HType CalculateInferredType() { |
| 3864 | return HType::String(); |
| 3865 | } |
| 3866 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3867 | DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
danno@chromium.org | 160a7b0 | 2011-04-18 15:51:38 +0000 | [diff] [blame] | 3868 | |
| 3869 | protected: |
| 3870 | virtual bool DataEquals(HValue* other) { return true; } |
| 3871 | }; |
| 3872 | |
| 3873 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3874 | class HStringCharCodeAt: public HTemplateInstruction<3> { |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3875 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3876 | HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
| 3877 | SetOperandAt(0, context); |
| 3878 | SetOperandAt(1, string); |
| 3879 | SetOperandAt(2, index); |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3880 | set_representation(Representation::Integer32()); |
| 3881 | SetFlag(kUseGVN); |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3882 | SetFlag(kDependsOnMaps); |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3883 | } |
| 3884 | |
| 3885 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3886 | // The index is supposed to be Integer32. |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3887 | return index == 2 |
| 3888 | ? Representation::Integer32() |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3889 | : Representation::Tagged(); |
| 3890 | } |
| 3891 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3892 | HValue* context() { return OperandAt(0); } |
| 3893 | HValue* string() { return OperandAt(1); } |
| 3894 | HValue* index() { return OperandAt(2); } |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3895 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3896 | DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3897 | |
| 3898 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3899 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3900 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3901 | virtual Range* InferRange() { |
| 3902 | return new Range(0, String::kMaxUC16CharCode); |
| 3903 | } |
| 3904 | }; |
| 3905 | |
| 3906 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3907 | class HStringCharFromCode: public HTemplateInstruction<2> { |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 3908 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3909 | HStringCharFromCode(HValue* context, HValue* char_code) { |
| 3910 | SetOperandAt(0, context); |
| 3911 | SetOperandAt(1, char_code); |
| 3912 | set_representation(Representation::Tagged()); |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 3913 | SetFlag(kUseGVN); |
| 3914 | } |
| 3915 | |
| 3916 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3917 | return index == 0 |
| 3918 | ? Representation::Tagged() |
| 3919 | : Representation::Integer32(); |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 3920 | } |
| 3921 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3922 | HValue* context() { return OperandAt(0); } |
| 3923 | HValue* value() { return OperandAt(1); } |
| 3924 | |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 3925 | virtual bool DataEquals(HValue* other) { return true; } |
| 3926 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3927 | DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
whesse@chromium.org | b08986c | 2011-03-14 16:13:42 +0000 | [diff] [blame] | 3928 | }; |
| 3929 | |
| 3930 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3931 | class HStringLength: public HUnaryOperation { |
| 3932 | public: |
| 3933 | explicit HStringLength(HValue* string) : HUnaryOperation(string) { |
| 3934 | set_representation(Representation::Tagged()); |
| 3935 | SetFlag(kUseGVN); |
fschneider@chromium.org | 7979bbb | 2011-03-28 10:47:03 +0000 | [diff] [blame] | 3936 | SetFlag(kDependsOnMaps); |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3937 | } |
| 3938 | |
| 3939 | virtual Representation RequiredInputRepresentation(int index) const { |
| 3940 | return Representation::Tagged(); |
| 3941 | } |
| 3942 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3943 | virtual HType CalculateInferredType() { |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3944 | STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
| 3945 | return HType::Smi(); |
| 3946 | } |
| 3947 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3948 | DECLARE_CONCRETE_INSTRUCTION(StringLength) |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3949 | |
| 3950 | protected: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3951 | virtual bool DataEquals(HValue* other) { return true; } |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 3952 | |
vegorov@chromium.org | 0a4e901 | 2011-01-24 12:33:13 +0000 | [diff] [blame] | 3953 | virtual Range* InferRange() { |
| 3954 | return new Range(0, String::kMaxLength); |
| 3955 | } |
| 3956 | }; |
| 3957 | |
| 3958 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3959 | template <int V> |
| 3960 | class HMaterializedLiteral: public HTemplateInstruction<V> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3961 | public: |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3962 | HMaterializedLiteral<V>(int index, int depth) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3963 | : literal_index_(index), depth_(depth) { |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3964 | this->set_representation(Representation::Tagged()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3965 | } |
| 3966 | |
| 3967 | int literal_index() const { return literal_index_; } |
| 3968 | int depth() const { return depth_; } |
| 3969 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3970 | private: |
| 3971 | int literal_index_; |
| 3972 | int depth_; |
| 3973 | }; |
| 3974 | |
| 3975 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3976 | class HArrayLiteral: public HMaterializedLiteral<1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3977 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3978 | HArrayLiteral(HValue* context, |
| 3979 | Handle<FixedArray> constant_elements, |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3980 | int length, |
| 3981 | int literal_index, |
| 3982 | int depth) |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3983 | : HMaterializedLiteral<1>(literal_index, depth), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3984 | length_(length), |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3985 | constant_elements_(constant_elements) { |
| 3986 | SetOperandAt(0, context); |
| 3987 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3988 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3989 | HValue* context() { return OperandAt(0); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 3990 | Handle<FixedArray> constant_elements() const { return constant_elements_; } |
| 3991 | int length() const { return length_; } |
| 3992 | |
| 3993 | bool IsCopyOnWrite() const; |
| 3994 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3995 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 3996 | return Representation::Tagged(); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 3997 | } |
| 3998 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 3999 | DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4000 | |
| 4001 | private: |
| 4002 | int length_; |
| 4003 | Handle<FixedArray> constant_elements_; |
| 4004 | }; |
| 4005 | |
| 4006 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4007 | class HObjectLiteral: public HMaterializedLiteral<1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4008 | public: |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 4009 | HObjectLiteral(HValue* context, |
| 4010 | Handle<FixedArray> constant_properties, |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4011 | bool fast_elements, |
| 4012 | int literal_index, |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 4013 | int depth, |
| 4014 | bool has_function) |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4015 | : HMaterializedLiteral<1>(literal_index, depth), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4016 | constant_properties_(constant_properties), |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 4017 | fast_elements_(fast_elements), |
| 4018 | has_function_(has_function) { |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 4019 | SetOperandAt(0, context); |
| 4020 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4021 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4022 | HValue* context() { return OperandAt(0); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4023 | Handle<FixedArray> constant_properties() const { |
| 4024 | return constant_properties_; |
| 4025 | } |
| 4026 | bool fast_elements() const { return fast_elements_; } |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 4027 | bool has_function() const { return has_function_; } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4028 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4029 | virtual Representation RequiredInputRepresentation(int index) const { |
| 4030 | return Representation::Tagged(); |
| 4031 | } |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 4032 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 4033 | DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4034 | |
| 4035 | private: |
| 4036 | Handle<FixedArray> constant_properties_; |
| 4037 | bool fast_elements_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 4038 | bool has_function_; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4039 | }; |
| 4040 | |
| 4041 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4042 | class HRegExpLiteral: public HMaterializedLiteral<1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4043 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4044 | HRegExpLiteral(HValue* context, |
| 4045 | Handle<String> pattern, |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4046 | Handle<String> flags, |
| 4047 | int literal_index) |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4048 | : HMaterializedLiteral<1>(literal_index, 0), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4049 | pattern_(pattern), |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4050 | flags_(flags) { |
| 4051 | SetOperandAt(0, context); |
| 4052 | } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4053 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4054 | HValue* context() { return OperandAt(0); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4055 | Handle<String> pattern() { return pattern_; } |
| 4056 | Handle<String> flags() { return flags_; } |
| 4057 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4058 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4059 | return Representation::Tagged(); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4060 | } |
| 4061 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 4062 | DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4063 | |
| 4064 | private: |
| 4065 | Handle<String> pattern_; |
| 4066 | Handle<String> flags_; |
| 4067 | }; |
| 4068 | |
| 4069 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4070 | class HFunctionLiteral: public HTemplateInstruction<1> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4071 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4072 | HFunctionLiteral(HValue* context, |
| 4073 | Handle<SharedFunctionInfo> shared, |
| 4074 | bool pretenure) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4075 | : shared_info_(shared), pretenure_(pretenure) { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4076 | SetOperandAt(0, context); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4077 | set_representation(Representation::Tagged()); |
| 4078 | } |
| 4079 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4080 | HValue* context() { return OperandAt(0); } |
| 4081 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4082 | virtual Representation RequiredInputRepresentation(int index) const { |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4083 | return Representation::Tagged(); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4084 | } |
| 4085 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 4086 | DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4087 | |
| 4088 | Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
| 4089 | bool pretenure() const { return pretenure_; } |
| 4090 | |
| 4091 | private: |
| 4092 | Handle<SharedFunctionInfo> shared_info_; |
| 4093 | bool pretenure_; |
| 4094 | }; |
| 4095 | |
| 4096 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4097 | class HTypeof: public HTemplateInstruction<2> { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4098 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4099 | explicit HTypeof(HValue* context, HValue* value) { |
| 4100 | SetOperandAt(0, context); |
| 4101 | SetOperandAt(1, value); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4102 | set_representation(Representation::Tagged()); |
| 4103 | } |
| 4104 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4105 | HValue* context() { return OperandAt(0); } |
| 4106 | HValue* value() { return OperandAt(1); } |
| 4107 | |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 4108 | virtual Representation RequiredInputRepresentation(int index) const { |
| 4109 | return Representation::Tagged(); |
| 4110 | } |
| 4111 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 4112 | DECLARE_CONCRETE_INSTRUCTION(Typeof) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4113 | }; |
| 4114 | |
| 4115 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 4116 | class HToFastProperties: public HUnaryOperation { |
| 4117 | public: |
| 4118 | explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
| 4119 | // This instruction is not marked as having side effects, but |
| 4120 | // changes the map of the input operand. Use it only when creating |
| 4121 | // object literals. |
| 4122 | ASSERT(value->IsObjectLiteral()); |
| 4123 | set_representation(Representation::Tagged()); |
| 4124 | } |
| 4125 | |
| 4126 | virtual Representation RequiredInputRepresentation(int index) const { |
| 4127 | return Representation::Tagged(); |
| 4128 | } |
| 4129 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 4130 | DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 4131 | }; |
| 4132 | |
| 4133 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4134 | class HValueOf: public HUnaryOperation { |
| 4135 | public: |
| 4136 | explicit HValueOf(HValue* value) : HUnaryOperation(value) { |
| 4137 | set_representation(Representation::Tagged()); |
| 4138 | } |
| 4139 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4140 | virtual Representation RequiredInputRepresentation(int index) const { |
| 4141 | return Representation::Tagged(); |
| 4142 | } |
| 4143 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 4144 | DECLARE_CONCRETE_INSTRUCTION(ValueOf) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4145 | }; |
| 4146 | |
| 4147 | |
| 4148 | class HDeleteProperty: public HBinaryOperation { |
| 4149 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4150 | HDeleteProperty(HValue* context, HValue* obj, HValue* key) |
| 4151 | : HBinaryOperation(context, obj, key) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4152 | set_representation(Representation::Tagged()); |
ager@chromium.org | 378b34e | 2011-01-28 08:04:38 +0000 | [diff] [blame] | 4153 | SetAllSideEffects(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4154 | } |
| 4155 | |
| 4156 | virtual Representation RequiredInputRepresentation(int index) const { |
| 4157 | return Representation::Tagged(); |
| 4158 | } |
| 4159 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 4160 | virtual HType CalculateInferredType(); |
| 4161 | |
ricow@chromium.org | dcebac0 | 2011-04-20 09:44:50 +0000 | [diff] [blame] | 4162 | DECLARE_CONCRETE_INSTRUCTION(DeleteProperty) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4163 | |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 4164 | HValue* object() { return left(); } |
| 4165 | HValue* key() { return right(); } |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4166 | }; |
| 4167 | |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 4168 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4169 | class HIn: public HTemplateInstruction<3> { |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 4170 | public: |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4171 | HIn(HValue* context, HValue* key, HValue* object) { |
| 4172 | SetOperandAt(0, context); |
| 4173 | SetOperandAt(1, key); |
| 4174 | SetOperandAt(2, object); |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 4175 | set_representation(Representation::Tagged()); |
| 4176 | SetAllSideEffects(); |
| 4177 | } |
| 4178 | |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 4179 | HValue* context() { return OperandAt(0); } |
| 4180 | HValue* key() { return OperandAt(1); } |
| 4181 | HValue* object() { return OperandAt(2); } |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 4182 | |
| 4183 | virtual Representation RequiredInputRepresentation(int index) const { |
| 4184 | return Representation::Tagged(); |
| 4185 | } |
| 4186 | |
| 4187 | virtual HType CalculateInferredType() { |
| 4188 | return HType::Boolean(); |
| 4189 | } |
| 4190 | |
| 4191 | virtual void PrintDataTo(StringStream* stream); |
| 4192 | |
| 4193 | DECLARE_CONCRETE_INSTRUCTION(In) |
| 4194 | }; |
| 4195 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 4196 | #undef DECLARE_INSTRUCTION |
| 4197 | #undef DECLARE_CONCRETE_INSTRUCTION |
| 4198 | |
| 4199 | } } // namespace v8::internal |
| 4200 | |
| 4201 | #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |