erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +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_MIPS_LITHIUM_MIPS_H_ |
| 29 | #define V8_MIPS_LITHIUM_MIPS_H_ |
| 30 | |
| 31 | #include "hydrogen.h" |
| 32 | #include "lithium-allocator.h" |
| 33 | #include "lithium.h" |
| 34 | #include "safepoint-table.h" |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 35 | #include "utils.h" |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 36 | |
| 37 | namespace v8 { |
| 38 | namespace internal { |
| 39 | |
| 40 | // Forward declarations. |
| 41 | class LCodeGen; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 42 | |
| 43 | #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ |
| 44 | V(ControlInstruction) \ |
| 45 | V(Call) \ |
| 46 | LITHIUM_CONCRETE_INSTRUCTION_LIST(V) |
| 47 | |
| 48 | |
| 49 | #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
| 50 | V(AccessArgumentsAt) \ |
| 51 | V(AddI) \ |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 52 | V(AllocateObject) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 53 | V(ApplyArguments) \ |
| 54 | V(ArgumentsElements) \ |
| 55 | V(ArgumentsLength) \ |
| 56 | V(ArithmeticD) \ |
| 57 | V(ArithmeticT) \ |
| 58 | V(ArrayLiteral) \ |
| 59 | V(BitI) \ |
| 60 | V(BitNotI) \ |
| 61 | V(BoundsCheck) \ |
| 62 | V(Branch) \ |
| 63 | V(CallConstantFunction) \ |
| 64 | V(CallFunction) \ |
| 65 | V(CallGlobal) \ |
| 66 | V(CallKeyed) \ |
| 67 | V(CallKnownGlobal) \ |
| 68 | V(CallNamed) \ |
| 69 | V(CallNew) \ |
| 70 | V(CallRuntime) \ |
| 71 | V(CallStub) \ |
| 72 | V(CheckFunction) \ |
| 73 | V(CheckInstanceType) \ |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 74 | V(CheckMaps) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 75 | V(CheckNonSmi) \ |
| 76 | V(CheckPrototypeMaps) \ |
| 77 | V(CheckSmi) \ |
| 78 | V(ClampDToUint8) \ |
| 79 | V(ClampIToUint8) \ |
| 80 | V(ClampTToUint8) \ |
| 81 | V(ClassOfTestAndBranch) \ |
| 82 | V(CmpConstantEqAndBranch) \ |
| 83 | V(CmpIDAndBranch) \ |
| 84 | V(CmpObjectEqAndBranch) \ |
| 85 | V(CmpMapAndBranch) \ |
| 86 | V(CmpT) \ |
| 87 | V(ConstantD) \ |
| 88 | V(ConstantI) \ |
| 89 | V(ConstantT) \ |
| 90 | V(Context) \ |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 91 | V(DeclareGlobals) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 92 | V(DeleteProperty) \ |
| 93 | V(Deoptimize) \ |
| 94 | V(DivI) \ |
| 95 | V(DoubleToI) \ |
| 96 | V(ElementsKind) \ |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 97 | V(FastLiteral) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 98 | V(FixedArrayBaseLength) \ |
| 99 | V(FunctionLiteral) \ |
| 100 | V(GetCachedArrayIndex) \ |
| 101 | V(GlobalObject) \ |
| 102 | V(GlobalReceiver) \ |
| 103 | V(Goto) \ |
| 104 | V(HasCachedArrayIndexAndBranch) \ |
| 105 | V(HasInstanceTypeAndBranch) \ |
| 106 | V(In) \ |
| 107 | V(InstanceOf) \ |
| 108 | V(InstanceOfKnownGlobal) \ |
| 109 | V(InstructionGap) \ |
| 110 | V(Integer32ToDouble) \ |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 111 | V(Uint32ToDouble) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 112 | V(InvokeFunction) \ |
| 113 | V(IsConstructCallAndBranch) \ |
| 114 | V(IsNilAndBranch) \ |
| 115 | V(IsObjectAndBranch) \ |
mstarzinger@chromium.org | f8c6bd5 | 2011-11-23 12:13:52 +0000 | [diff] [blame] | 116 | V(IsStringAndBranch) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 117 | V(IsSmiAndBranch) \ |
| 118 | V(IsUndetectableAndBranch) \ |
| 119 | V(JSArrayLength) \ |
| 120 | V(Label) \ |
| 121 | V(LazyBailout) \ |
| 122 | V(LoadContextSlot) \ |
| 123 | V(LoadElements) \ |
| 124 | V(LoadExternalArrayPointer) \ |
| 125 | V(LoadFunctionPrototype) \ |
| 126 | V(LoadGlobalCell) \ |
| 127 | V(LoadGlobalGeneric) \ |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 128 | V(LoadKeyed) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 129 | V(LoadKeyedGeneric) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 130 | V(LoadNamedField) \ |
| 131 | V(LoadNamedFieldPolymorphic) \ |
| 132 | V(LoadNamedGeneric) \ |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 133 | V(MapEnumLength) \ |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 134 | V(MathMinMax) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 135 | V(ModI) \ |
| 136 | V(MulI) \ |
| 137 | V(NumberTagD) \ |
| 138 | V(NumberTagI) \ |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 139 | V(NumberTagU) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 140 | V(NumberUntagD) \ |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 141 | V(ObjectLiteral) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 142 | V(OsrEntry) \ |
| 143 | V(OuterContext) \ |
| 144 | V(Parameter) \ |
| 145 | V(Power) \ |
| 146 | V(PushArgument) \ |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 147 | V(Random) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 148 | V(RegExpLiteral) \ |
| 149 | V(Return) \ |
| 150 | V(ShiftI) \ |
| 151 | V(SmiTag) \ |
| 152 | V(SmiUntag) \ |
| 153 | V(StackCheck) \ |
| 154 | V(StoreContextSlot) \ |
| 155 | V(StoreGlobalCell) \ |
| 156 | V(StoreGlobalGeneric) \ |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 157 | V(StoreKeyed) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 158 | V(StoreKeyedGeneric) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 159 | V(StoreNamedField) \ |
| 160 | V(StoreNamedGeneric) \ |
| 161 | V(StringAdd) \ |
| 162 | V(StringCharCodeAt) \ |
| 163 | V(StringCharFromCode) \ |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 164 | V(StringCompareAndBranch) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 165 | V(StringLength) \ |
| 166 | V(SubI) \ |
| 167 | V(TaggedToI) \ |
| 168 | V(ThisFunction) \ |
| 169 | V(Throw) \ |
| 170 | V(ToFastProperties) \ |
| 171 | V(TransitionElementsKind) \ |
| 172 | V(Typeof) \ |
| 173 | V(TypeofIsAndBranch) \ |
| 174 | V(UnaryMathOperation) \ |
| 175 | V(UnknownOSRValue) \ |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 176 | V(ValueOf) \ |
| 177 | V(ForInPrepareMap) \ |
| 178 | V(ForInCacheArray) \ |
| 179 | V(CheckMapValue) \ |
yangguo@chromium.org | 154ff99 | 2012-03-13 08:09:54 +0000 | [diff] [blame] | 180 | V(LoadFieldByIndex) \ |
rossberg@chromium.org | 2c067b1 | 2012-03-19 11:01:52 +0000 | [diff] [blame] | 181 | V(DateField) \ |
jkummerow@chromium.org | 28faa98 | 2012-04-13 09:58:30 +0000 | [diff] [blame] | 182 | V(WrapReceiver) \ |
| 183 | V(Drop) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 184 | |
| 185 | #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ |
| 186 | virtual Opcode opcode() const { return LInstruction::k##type; } \ |
| 187 | virtual void CompileToNative(LCodeGen* generator); \ |
| 188 | virtual const char* Mnemonic() const { return mnemonic; } \ |
| 189 | static L##type* cast(LInstruction* instr) { \ |
| 190 | ASSERT(instr->Is##type()); \ |
| 191 | return reinterpret_cast<L##type*>(instr); \ |
| 192 | } |
| 193 | |
| 194 | |
| 195 | #define DECLARE_HYDROGEN_ACCESSOR(type) \ |
| 196 | H##type* hydrogen() const { \ |
| 197 | return H##type::cast(hydrogen_value()); \ |
| 198 | } |
| 199 | |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 200 | |
| 201 | class LInstruction: public ZoneObject { |
| 202 | public: |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 203 | LInstruction() |
| 204 | : environment_(NULL), |
| 205 | hydrogen_value_(NULL), |
danno@chromium.org | 1044a4d | 2012-04-30 12:34:39 +0000 | [diff] [blame] | 206 | is_call_(false) { } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 207 | virtual ~LInstruction() { } |
| 208 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 209 | virtual void CompileToNative(LCodeGen* generator) = 0; |
| 210 | virtual const char* Mnemonic() const = 0; |
| 211 | virtual void PrintTo(StringStream* stream); |
mstarzinger@chromium.org | 88d326b | 2012-04-23 12:57:22 +0000 | [diff] [blame] | 212 | virtual void PrintDataTo(StringStream* stream); |
| 213 | virtual void PrintOutputOperandTo(StringStream* stream); |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 214 | |
| 215 | enum Opcode { |
| 216 | // Declare a unique enum value for each instruction. |
| 217 | #define DECLARE_OPCODE(type) k##type, |
| 218 | LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) |
| 219 | kNumberOfInstructions |
| 220 | #undef DECLARE_OPCODE |
| 221 | }; |
| 222 | |
| 223 | virtual Opcode opcode() const = 0; |
| 224 | |
| 225 | // Declare non-virtual type testers for all leaf IR classes. |
| 226 | #define DECLARE_PREDICATE(type) \ |
| 227 | bool Is##type() const { return opcode() == k##type; } |
| 228 | LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) |
| 229 | #undef DECLARE_PREDICATE |
| 230 | |
| 231 | // Declare virtual predicates for instructions that don't have |
| 232 | // an opcode. |
| 233 | virtual bool IsGap() const { return false; } |
| 234 | |
| 235 | virtual bool IsControl() const { return false; } |
| 236 | |
| 237 | void set_environment(LEnvironment* env) { environment_ = env; } |
| 238 | LEnvironment* environment() const { return environment_; } |
| 239 | bool HasEnvironment() const { return environment_ != NULL; } |
| 240 | |
| 241 | void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } |
| 242 | LPointerMap* pointer_map() const { return pointer_map_.get(); } |
| 243 | bool HasPointerMap() const { return pointer_map_.is_set(); } |
| 244 | |
| 245 | void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } |
| 246 | HValue* hydrogen_value() const { return hydrogen_value_; } |
| 247 | |
danno@chromium.org | 1044a4d | 2012-04-30 12:34:39 +0000 | [diff] [blame] | 248 | virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 249 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 250 | void MarkAsCall() { is_call_ = true; } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 251 | |
| 252 | // Interface to the register allocator and iterators. |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 253 | bool IsMarkedAsCall() const { return is_call_; } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 254 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 255 | virtual bool HasResult() const = 0; |
| 256 | virtual LOperand* result() = 0; |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 257 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 258 | LOperand* FirstInput() { return InputAt(0); } |
| 259 | LOperand* Output() { return HasResult() ? result() : NULL; } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 260 | |
| 261 | #ifdef DEBUG |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 262 | void VerifyCall(); |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 263 | #endif |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 264 | |
| 265 | private: |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 266 | // Iterator interface. |
| 267 | friend class InputIterator; |
| 268 | virtual int InputCount() = 0; |
| 269 | virtual LOperand* InputAt(int i) = 0; |
| 270 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 271 | friend class TempIterator; |
| 272 | virtual int TempCount() = 0; |
| 273 | virtual LOperand* TempAt(int i) = 0; |
| 274 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 275 | LEnvironment* environment_; |
| 276 | SetOncePointer<LPointerMap> pointer_map_; |
| 277 | HValue* hydrogen_value_; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 278 | bool is_call_; |
| 279 | bool is_save_doubles_; |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 280 | }; |
| 281 | |
| 282 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 283 | // R = number of result operands (0 or 1). |
| 284 | // I = number of input operands. |
| 285 | // T = number of temporary operands. |
| 286 | template<int R, int I, int T> |
| 287 | class LTemplateInstruction: public LInstruction { |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 288 | public: |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 289 | // Allow 0 or 1 output operands. |
| 290 | STATIC_ASSERT(R == 0 || R == 1); |
| 291 | virtual bool HasResult() const { return R != 0; } |
| 292 | void set_result(LOperand* operand) { results_[0] = operand; } |
| 293 | LOperand* result() { return results_[0]; } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 294 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 295 | protected: |
| 296 | EmbeddedContainer<LOperand*, R> results_; |
| 297 | EmbeddedContainer<LOperand*, I> inputs_; |
| 298 | EmbeddedContainer<LOperand*, T> temps_; |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 299 | |
| 300 | private: |
| 301 | virtual int InputCount() { return I; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 302 | virtual LOperand* InputAt(int i) { return inputs_[i]; } |
| 303 | |
| 304 | virtual int TempCount() { return T; } |
| 305 | virtual LOperand* TempAt(int i) { return temps_[i]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 306 | }; |
| 307 | |
| 308 | |
| 309 | class LGap: public LTemplateInstruction<0, 0, 0> { |
| 310 | public: |
| 311 | explicit LGap(HBasicBlock* block) |
| 312 | : block_(block) { |
| 313 | parallel_moves_[BEFORE] = NULL; |
| 314 | parallel_moves_[START] = NULL; |
| 315 | parallel_moves_[END] = NULL; |
| 316 | parallel_moves_[AFTER] = NULL; |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 317 | } |
| 318 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 319 | // Can't use the DECLARE-macro here because of sub-classes. |
| 320 | virtual bool IsGap() const { return true; } |
| 321 | virtual void PrintDataTo(StringStream* stream); |
| 322 | static LGap* cast(LInstruction* instr) { |
| 323 | ASSERT(instr->IsGap()); |
| 324 | return reinterpret_cast<LGap*>(instr); |
| 325 | } |
| 326 | |
| 327 | bool IsRedundant() const; |
| 328 | |
| 329 | HBasicBlock* block() const { return block_; } |
| 330 | |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 331 | enum InnerPosition { |
| 332 | BEFORE, |
| 333 | START, |
| 334 | END, |
| 335 | AFTER, |
| 336 | FIRST_INNER_POSITION = BEFORE, |
| 337 | LAST_INNER_POSITION = AFTER |
| 338 | }; |
| 339 | |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 340 | LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) { |
| 341 | if (parallel_moves_[pos] == NULL) { |
| 342 | parallel_moves_[pos] = new(zone) LParallelMove(zone); |
| 343 | } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 344 | return parallel_moves_[pos]; |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 345 | } |
| 346 | |
| 347 | LParallelMove* GetParallelMove(InnerPosition pos) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 348 | return parallel_moves_[pos]; |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 349 | } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 350 | |
| 351 | private: |
| 352 | LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; |
| 353 | HBasicBlock* block_; |
| 354 | }; |
| 355 | |
| 356 | |
| 357 | class LInstructionGap: public LGap { |
| 358 | public: |
| 359 | explicit LInstructionGap(HBasicBlock* block) : LGap(block) { } |
| 360 | |
| 361 | DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap") |
| 362 | }; |
| 363 | |
| 364 | |
| 365 | class LGoto: public LTemplateInstruction<0, 0, 0> { |
| 366 | public: |
| 367 | explicit LGoto(int block_id) : block_id_(block_id) { } |
| 368 | |
| 369 | DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") |
| 370 | virtual void PrintDataTo(StringStream* stream); |
| 371 | virtual bool IsControl() const { return true; } |
| 372 | |
| 373 | int block_id() const { return block_id_; } |
| 374 | |
| 375 | private: |
| 376 | int block_id_; |
| 377 | }; |
| 378 | |
| 379 | |
| 380 | class LLazyBailout: public LTemplateInstruction<0, 0, 0> { |
| 381 | public: |
| 382 | LLazyBailout() : gap_instructions_size_(0) { } |
| 383 | |
| 384 | DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout") |
| 385 | |
| 386 | void set_gap_instructions_size(int gap_instructions_size) { |
| 387 | gap_instructions_size_ = gap_instructions_size; |
| 388 | } |
| 389 | int gap_instructions_size() { return gap_instructions_size_; } |
| 390 | |
| 391 | private: |
| 392 | int gap_instructions_size_; |
| 393 | }; |
| 394 | |
| 395 | |
| 396 | class LDeoptimize: public LTemplateInstruction<0, 0, 0> { |
| 397 | public: |
| 398 | DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 399 | }; |
| 400 | |
| 401 | |
| 402 | class LLabel: public LGap { |
| 403 | public: |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 404 | explicit LLabel(HBasicBlock* block) |
| 405 | : LGap(block), replacement_(NULL) { } |
| 406 | |
| 407 | DECLARE_CONCRETE_INSTRUCTION(Label, "label") |
| 408 | |
| 409 | virtual void PrintDataTo(StringStream* stream); |
| 410 | |
| 411 | int block_id() const { return block()->block_id(); } |
| 412 | bool is_loop_header() const { return block()->IsLoopHeader(); } |
| 413 | Label* label() { return &label_; } |
| 414 | LLabel* replacement() const { return replacement_; } |
| 415 | void set_replacement(LLabel* label) { replacement_ = label; } |
| 416 | bool HasReplacement() const { return replacement_ != NULL; } |
| 417 | |
| 418 | private: |
| 419 | Label label_; |
| 420 | LLabel* replacement_; |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 421 | }; |
| 422 | |
| 423 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 424 | class LParameter: public LTemplateInstruction<1, 0, 0> { |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 425 | public: |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 426 | DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter") |
| 427 | }; |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 428 | |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 429 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 430 | class LCallStub: public LTemplateInstruction<1, 0, 0> { |
| 431 | public: |
| 432 | DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub") |
| 433 | DECLARE_HYDROGEN_ACCESSOR(CallStub) |
| 434 | |
| 435 | TranscendentalCache::Type transcendental_type() { |
| 436 | return hydrogen()->transcendental_type(); |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 437 | } |
| 438 | }; |
| 439 | |
| 440 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 441 | class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { |
| 442 | public: |
| 443 | DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") |
| 444 | }; |
| 445 | |
| 446 | |
| 447 | template<int I, int T> |
| 448 | class LControlInstruction: public LTemplateInstruction<0, I, T> { |
| 449 | public: |
| 450 | virtual bool IsControl() const { return true; } |
| 451 | |
| 452 | int SuccessorCount() { return hydrogen()->SuccessorCount(); } |
| 453 | HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } |
| 454 | int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); } |
| 455 | int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); } |
| 456 | |
| 457 | private: |
| 458 | HControlInstruction* hydrogen() { |
| 459 | return HControlInstruction::cast(this->hydrogen_value()); |
| 460 | } |
| 461 | }; |
| 462 | |
| 463 | |
rossberg@chromium.org | 2c067b1 | 2012-03-19 11:01:52 +0000 | [diff] [blame] | 464 | class LWrapReceiver: public LTemplateInstruction<1, 2, 0> { |
| 465 | public: |
| 466 | LWrapReceiver(LOperand* receiver, LOperand* function) { |
| 467 | inputs_[0] = receiver; |
| 468 | inputs_[1] = function; |
| 469 | } |
| 470 | |
| 471 | DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver") |
| 472 | |
| 473 | LOperand* receiver() { return inputs_[0]; } |
| 474 | LOperand* function() { return inputs_[1]; } |
| 475 | }; |
| 476 | |
| 477 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 478 | class LApplyArguments: public LTemplateInstruction<1, 4, 0> { |
| 479 | public: |
| 480 | LApplyArguments(LOperand* function, |
| 481 | LOperand* receiver, |
| 482 | LOperand* length, |
| 483 | LOperand* elements) { |
| 484 | inputs_[0] = function; |
| 485 | inputs_[1] = receiver; |
| 486 | inputs_[2] = length; |
| 487 | inputs_[3] = elements; |
| 488 | } |
| 489 | |
| 490 | DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments") |
| 491 | |
| 492 | LOperand* function() { return inputs_[0]; } |
| 493 | LOperand* receiver() { return inputs_[1]; } |
| 494 | LOperand* length() { return inputs_[2]; } |
| 495 | LOperand* elements() { return inputs_[3]; } |
| 496 | }; |
| 497 | |
| 498 | |
| 499 | class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> { |
| 500 | public: |
| 501 | LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) { |
| 502 | inputs_[0] = arguments; |
| 503 | inputs_[1] = length; |
| 504 | inputs_[2] = index; |
| 505 | } |
| 506 | |
| 507 | DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at") |
| 508 | |
| 509 | LOperand* arguments() { return inputs_[0]; } |
| 510 | LOperand* length() { return inputs_[1]; } |
| 511 | LOperand* index() { return inputs_[2]; } |
| 512 | |
| 513 | virtual void PrintDataTo(StringStream* stream); |
| 514 | }; |
| 515 | |
| 516 | |
| 517 | class LArgumentsLength: public LTemplateInstruction<1, 1, 0> { |
| 518 | public: |
| 519 | explicit LArgumentsLength(LOperand* elements) { |
| 520 | inputs_[0] = elements; |
| 521 | } |
| 522 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 523 | LOperand* elements() { return inputs_[0]; } |
| 524 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 525 | DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length") |
| 526 | }; |
| 527 | |
| 528 | |
| 529 | class LArgumentsElements: public LTemplateInstruction<1, 0, 0> { |
| 530 | public: |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 531 | DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements") |
jkummerow@chromium.org | 28faa98 | 2012-04-13 09:58:30 +0000 | [diff] [blame] | 532 | DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 533 | }; |
| 534 | |
| 535 | |
| 536 | class LModI: public LTemplateInstruction<1, 2, 3> { |
| 537 | public: |
| 538 | // Used when the right hand is a constant power of 2. |
| 539 | LModI(LOperand* left, |
| 540 | LOperand* right) { |
| 541 | inputs_[0] = left; |
| 542 | inputs_[1] = right; |
| 543 | temps_[0] = NULL; |
| 544 | temps_[1] = NULL; |
| 545 | temps_[2] = NULL; |
| 546 | } |
| 547 | |
| 548 | // Used for the standard case. |
| 549 | LModI(LOperand* left, |
| 550 | LOperand* right, |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 551 | LOperand* temp, |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 552 | LOperand* temp2, |
| 553 | LOperand* temp3) { |
| 554 | inputs_[0] = left; |
| 555 | inputs_[1] = right; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 556 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 557 | temps_[1] = temp2; |
| 558 | temps_[2] = temp3; |
| 559 | } |
| 560 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 561 | LOperand* left() { return inputs_[0]; } |
| 562 | LOperand* right() { return inputs_[1]; } |
| 563 | LOperand* temp() { return temps_[0]; } |
| 564 | LOperand* temp2() { return temps_[1]; } |
| 565 | LOperand* temp3() { return temps_[2]; } |
| 566 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 567 | DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") |
| 568 | DECLARE_HYDROGEN_ACCESSOR(Mod) |
| 569 | }; |
| 570 | |
| 571 | |
| 572 | class LDivI: public LTemplateInstruction<1, 2, 0> { |
| 573 | public: |
| 574 | LDivI(LOperand* left, LOperand* right) { |
| 575 | inputs_[0] = left; |
| 576 | inputs_[1] = right; |
| 577 | } |
| 578 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 579 | LOperand* left() { return inputs_[0]; } |
| 580 | LOperand* right() { return inputs_[1]; } |
| 581 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 582 | DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") |
| 583 | DECLARE_HYDROGEN_ACCESSOR(Div) |
| 584 | }; |
| 585 | |
| 586 | |
| 587 | class LMulI: public LTemplateInstruction<1, 2, 1> { |
| 588 | public: |
| 589 | LMulI(LOperand* left, LOperand* right, LOperand* temp) { |
| 590 | inputs_[0] = left; |
| 591 | inputs_[1] = right; |
| 592 | temps_[0] = temp; |
| 593 | } |
| 594 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 595 | LOperand* left() { return inputs_[0]; } |
| 596 | LOperand* right() { return inputs_[1]; } |
| 597 | LOperand* temp() { return temps_[0]; } |
| 598 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 599 | DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") |
| 600 | DECLARE_HYDROGEN_ACCESSOR(Mul) |
| 601 | }; |
| 602 | |
| 603 | |
| 604 | class LCmpIDAndBranch: public LControlInstruction<2, 0> { |
| 605 | public: |
| 606 | LCmpIDAndBranch(LOperand* left, LOperand* right) { |
| 607 | inputs_[0] = left; |
| 608 | inputs_[1] = right; |
| 609 | } |
| 610 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 611 | LOperand* left() { return inputs_[0]; } |
| 612 | LOperand* right() { return inputs_[1]; } |
| 613 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 614 | DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch") |
| 615 | DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch) |
| 616 | |
| 617 | Token::Value op() const { return hydrogen()->token(); } |
| 618 | bool is_double() const { |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame^] | 619 | return hydrogen()->representation().IsDouble(); |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 620 | } |
| 621 | |
| 622 | virtual void PrintDataTo(StringStream* stream); |
| 623 | }; |
| 624 | |
| 625 | |
| 626 | class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> { |
| 627 | public: |
| 628 | LUnaryMathOperation(LOperand* value, LOperand* temp) { |
| 629 | inputs_[0] = value; |
| 630 | temps_[0] = temp; |
| 631 | } |
| 632 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 633 | LOperand* value() { return inputs_[0]; } |
| 634 | LOperand* temp() { return temps_[0]; } |
| 635 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 636 | DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation") |
| 637 | DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) |
| 638 | |
| 639 | virtual void PrintDataTo(StringStream* stream); |
| 640 | BuiltinFunctionId op() const { return hydrogen()->op(); } |
| 641 | }; |
| 642 | |
| 643 | |
| 644 | class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> { |
| 645 | public: |
| 646 | LCmpObjectEqAndBranch(LOperand* left, LOperand* right) { |
| 647 | inputs_[0] = left; |
| 648 | inputs_[1] = right; |
| 649 | } |
| 650 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 651 | LOperand* left() { return inputs_[0]; } |
| 652 | LOperand* right() { return inputs_[1]; } |
| 653 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 654 | DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, |
| 655 | "cmp-object-eq-and-branch") |
| 656 | DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch) |
| 657 | }; |
| 658 | |
| 659 | |
| 660 | class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> { |
| 661 | public: |
| 662 | explicit LCmpConstantEqAndBranch(LOperand* left) { |
| 663 | inputs_[0] = left; |
| 664 | } |
| 665 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 666 | LOperand* left() { return inputs_[0]; } |
| 667 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 668 | DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch, |
| 669 | "cmp-constant-eq-and-branch") |
| 670 | DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch) |
| 671 | }; |
| 672 | |
| 673 | |
| 674 | class LIsNilAndBranch: public LControlInstruction<1, 0> { |
| 675 | public: |
| 676 | explicit LIsNilAndBranch(LOperand* value) { |
| 677 | inputs_[0] = value; |
| 678 | } |
| 679 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 680 | LOperand* value() { return inputs_[0]; } |
| 681 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 682 | DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch") |
| 683 | DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch) |
| 684 | |
| 685 | EqualityKind kind() const { return hydrogen()->kind(); } |
| 686 | NilValue nil() const { return hydrogen()->nil(); } |
| 687 | |
| 688 | virtual void PrintDataTo(StringStream* stream); |
| 689 | }; |
| 690 | |
| 691 | |
| 692 | class LIsObjectAndBranch: public LControlInstruction<1, 1> { |
| 693 | public: |
| 694 | LIsObjectAndBranch(LOperand* value, LOperand* temp) { |
| 695 | inputs_[0] = value; |
| 696 | temps_[0] = temp; |
| 697 | } |
| 698 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 699 | LOperand* value() { return inputs_[0]; } |
| 700 | LOperand* temp() { return temps_[0]; } |
| 701 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 702 | DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch") |
| 703 | DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch) |
| 704 | |
| 705 | virtual void PrintDataTo(StringStream* stream); |
| 706 | }; |
| 707 | |
| 708 | |
mstarzinger@chromium.org | f8c6bd5 | 2011-11-23 12:13:52 +0000 | [diff] [blame] | 709 | class LIsStringAndBranch: public LControlInstruction<1, 1> { |
| 710 | public: |
| 711 | LIsStringAndBranch(LOperand* value, LOperand* temp) { |
| 712 | inputs_[0] = value; |
| 713 | temps_[0] = temp; |
| 714 | } |
| 715 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 716 | LOperand* value() { return inputs_[0]; } |
| 717 | LOperand* temp() { return temps_[0]; } |
| 718 | |
mstarzinger@chromium.org | f8c6bd5 | 2011-11-23 12:13:52 +0000 | [diff] [blame] | 719 | DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch") |
| 720 | DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch) |
| 721 | |
| 722 | virtual void PrintDataTo(StringStream* stream); |
| 723 | }; |
| 724 | |
| 725 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 726 | class LIsSmiAndBranch: public LControlInstruction<1, 0> { |
| 727 | public: |
| 728 | explicit LIsSmiAndBranch(LOperand* value) { |
| 729 | inputs_[0] = value; |
| 730 | } |
| 731 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 732 | LOperand* value() { return inputs_[0]; } |
| 733 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 734 | DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch") |
| 735 | DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch) |
| 736 | |
| 737 | virtual void PrintDataTo(StringStream* stream); |
| 738 | }; |
| 739 | |
| 740 | |
| 741 | class LIsUndetectableAndBranch: public LControlInstruction<1, 1> { |
| 742 | public: |
| 743 | explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) { |
| 744 | inputs_[0] = value; |
| 745 | temps_[0] = temp; |
| 746 | } |
| 747 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 748 | LOperand* value() { return inputs_[0]; } |
| 749 | LOperand* temp() { return temps_[0]; } |
| 750 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 751 | DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch, |
| 752 | "is-undetectable-and-branch") |
| 753 | DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch) |
| 754 | |
| 755 | virtual void PrintDataTo(StringStream* stream); |
| 756 | }; |
| 757 | |
| 758 | |
mstarzinger@chromium.org | f8c6bd5 | 2011-11-23 12:13:52 +0000 | [diff] [blame] | 759 | class LStringCompareAndBranch: public LControlInstruction<2, 0> { |
| 760 | public: |
| 761 | LStringCompareAndBranch(LOperand* left, LOperand* right) { |
| 762 | inputs_[0] = left; |
| 763 | inputs_[1] = right; |
| 764 | } |
| 765 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 766 | LOperand* left() { return inputs_[0]; } |
| 767 | LOperand* right() { return inputs_[1]; } |
| 768 | |
mstarzinger@chromium.org | f8c6bd5 | 2011-11-23 12:13:52 +0000 | [diff] [blame] | 769 | DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch, |
| 770 | "string-compare-and-branch") |
| 771 | DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch) |
| 772 | |
| 773 | Token::Value op() const { return hydrogen()->token(); } |
| 774 | |
| 775 | virtual void PrintDataTo(StringStream* stream); |
| 776 | }; |
| 777 | |
| 778 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 779 | class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> { |
| 780 | public: |
| 781 | explicit LHasInstanceTypeAndBranch(LOperand* value) { |
| 782 | inputs_[0] = value; |
| 783 | } |
| 784 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 785 | LOperand* value() { return inputs_[0]; } |
| 786 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 787 | DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch, |
| 788 | "has-instance-type-and-branch") |
| 789 | DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch) |
| 790 | |
| 791 | virtual void PrintDataTo(StringStream* stream); |
| 792 | }; |
| 793 | |
| 794 | |
| 795 | class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> { |
| 796 | public: |
| 797 | explicit LGetCachedArrayIndex(LOperand* value) { |
| 798 | inputs_[0] = value; |
| 799 | } |
| 800 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 801 | LOperand* value() { return inputs_[0]; } |
| 802 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 803 | DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index") |
| 804 | DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex) |
| 805 | }; |
| 806 | |
| 807 | |
| 808 | class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> { |
| 809 | public: |
| 810 | explicit LHasCachedArrayIndexAndBranch(LOperand* value) { |
| 811 | inputs_[0] = value; |
| 812 | } |
| 813 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 814 | LOperand* value() { return inputs_[0]; } |
| 815 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 816 | DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch, |
| 817 | "has-cached-array-index-and-branch") |
| 818 | DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch) |
| 819 | |
| 820 | virtual void PrintDataTo(StringStream* stream); |
| 821 | }; |
| 822 | |
| 823 | |
| 824 | class LClassOfTestAndBranch: public LControlInstruction<1, 1> { |
| 825 | public: |
| 826 | LClassOfTestAndBranch(LOperand* value, LOperand* temp) { |
| 827 | inputs_[0] = value; |
| 828 | temps_[0] = temp; |
| 829 | } |
| 830 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 831 | LOperand* value() { return inputs_[0]; } |
| 832 | LOperand* temp() { return temps_[0]; } |
| 833 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 834 | DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch, |
| 835 | "class-of-test-and-branch") |
| 836 | DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch) |
| 837 | |
| 838 | virtual void PrintDataTo(StringStream* stream); |
| 839 | }; |
| 840 | |
| 841 | |
| 842 | class LCmpT: public LTemplateInstruction<1, 2, 0> { |
| 843 | public: |
| 844 | LCmpT(LOperand* left, LOperand* right) { |
| 845 | inputs_[0] = left; |
| 846 | inputs_[1] = right; |
| 847 | } |
| 848 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 849 | LOperand* left() { return inputs_[0]; } |
| 850 | LOperand* right() { return inputs_[1]; } |
| 851 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 852 | DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") |
| 853 | DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) |
| 854 | |
| 855 | Token::Value op() const { return hydrogen()->token(); } |
| 856 | }; |
| 857 | |
| 858 | |
| 859 | class LInstanceOf: public LTemplateInstruction<1, 2, 0> { |
| 860 | public: |
| 861 | LInstanceOf(LOperand* left, LOperand* right) { |
| 862 | inputs_[0] = left; |
| 863 | inputs_[1] = right; |
| 864 | } |
| 865 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 866 | LOperand* left() { return inputs_[0]; } |
| 867 | LOperand* right() { return inputs_[1]; } |
| 868 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 869 | DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of") |
| 870 | }; |
| 871 | |
| 872 | |
| 873 | class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> { |
| 874 | public: |
| 875 | LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) { |
| 876 | inputs_[0] = value; |
| 877 | temps_[0] = temp; |
| 878 | } |
| 879 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 880 | LOperand* value() { return inputs_[0]; } |
| 881 | LOperand* temp() { return temps_[0]; } |
| 882 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 883 | DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, |
| 884 | "instance-of-known-global") |
| 885 | DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) |
| 886 | |
| 887 | Handle<JSFunction> function() const { return hydrogen()->function(); } |
danno@chromium.org | 1044a4d | 2012-04-30 12:34:39 +0000 | [diff] [blame] | 888 | LEnvironment* GetDeferredLazyDeoptimizationEnvironment() { |
| 889 | return lazy_deopt_env_; |
| 890 | } |
| 891 | virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { |
| 892 | lazy_deopt_env_ = env; |
| 893 | } |
| 894 | |
| 895 | private: |
| 896 | LEnvironment* lazy_deopt_env_; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 897 | }; |
| 898 | |
| 899 | |
| 900 | class LBoundsCheck: public LTemplateInstruction<0, 2, 0> { |
| 901 | public: |
| 902 | LBoundsCheck(LOperand* index, LOperand* length) { |
| 903 | inputs_[0] = index; |
| 904 | inputs_[1] = length; |
| 905 | } |
| 906 | |
| 907 | LOperand* index() { return inputs_[0]; } |
| 908 | LOperand* length() { return inputs_[1]; } |
| 909 | |
| 910 | DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check") |
danno@chromium.org | 129d398 | 2012-07-25 15:01:47 +0000 | [diff] [blame] | 911 | DECLARE_HYDROGEN_ACCESSOR(BoundsCheck) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 912 | }; |
| 913 | |
| 914 | |
| 915 | class LBitI: public LTemplateInstruction<1, 2, 0> { |
| 916 | public: |
| 917 | LBitI(LOperand* left, LOperand* right) { |
| 918 | inputs_[0] = left; |
| 919 | inputs_[1] = right; |
| 920 | } |
| 921 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 922 | LOperand* left() { return inputs_[0]; } |
| 923 | LOperand* right() { return inputs_[1]; } |
| 924 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 925 | Token::Value op() const { return hydrogen()->op(); } |
| 926 | |
| 927 | DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i") |
| 928 | DECLARE_HYDROGEN_ACCESSOR(Bitwise) |
| 929 | }; |
| 930 | |
| 931 | |
| 932 | class LShiftI: public LTemplateInstruction<1, 2, 0> { |
| 933 | public: |
| 934 | LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt) |
| 935 | : op_(op), can_deopt_(can_deopt) { |
| 936 | inputs_[0] = left; |
| 937 | inputs_[1] = right; |
| 938 | } |
| 939 | |
| 940 | Token::Value op() const { return op_; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 941 | LOperand* left() { return inputs_[0]; } |
| 942 | LOperand* right() { return inputs_[1]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 943 | bool can_deopt() const { return can_deopt_; } |
| 944 | |
| 945 | DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i") |
| 946 | |
| 947 | private: |
| 948 | Token::Value op_; |
| 949 | bool can_deopt_; |
| 950 | }; |
| 951 | |
| 952 | |
| 953 | class LSubI: public LTemplateInstruction<1, 2, 0> { |
| 954 | public: |
| 955 | LSubI(LOperand* left, LOperand* right) { |
| 956 | inputs_[0] = left; |
| 957 | inputs_[1] = right; |
| 958 | } |
| 959 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 960 | LOperand* left() { return inputs_[0]; } |
| 961 | LOperand* right() { return inputs_[1]; } |
| 962 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 963 | DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") |
| 964 | DECLARE_HYDROGEN_ACCESSOR(Sub) |
| 965 | }; |
| 966 | |
| 967 | |
| 968 | class LConstantI: public LTemplateInstruction<1, 0, 0> { |
| 969 | public: |
| 970 | DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") |
| 971 | DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 972 | |
| 973 | int32_t value() const { return hydrogen()->Integer32Value(); } |
| 974 | }; |
| 975 | |
| 976 | |
| 977 | class LConstantD: public LTemplateInstruction<1, 0, 0> { |
| 978 | public: |
| 979 | DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") |
| 980 | DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 981 | |
| 982 | double value() const { return hydrogen()->DoubleValue(); } |
| 983 | }; |
| 984 | |
| 985 | |
| 986 | class LConstantT: public LTemplateInstruction<1, 0, 0> { |
| 987 | public: |
| 988 | DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") |
| 989 | DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 990 | |
| 991 | Handle<Object> value() const { return hydrogen()->handle(); } |
| 992 | }; |
| 993 | |
| 994 | |
| 995 | class LBranch: public LControlInstruction<1, 0> { |
| 996 | public: |
| 997 | explicit LBranch(LOperand* value) { |
| 998 | inputs_[0] = value; |
| 999 | } |
| 1000 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1001 | LOperand* value() { return inputs_[0]; } |
| 1002 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1003 | DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
| 1004 | DECLARE_HYDROGEN_ACCESSOR(Branch) |
| 1005 | |
| 1006 | virtual void PrintDataTo(StringStream* stream); |
| 1007 | }; |
| 1008 | |
| 1009 | |
| 1010 | class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> { |
| 1011 | public: |
| 1012 | LCmpMapAndBranch(LOperand* value, LOperand* temp) { |
| 1013 | inputs_[0] = value; |
| 1014 | temps_[0] = temp; |
| 1015 | } |
| 1016 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1017 | LOperand* value() { return inputs_[0]; } |
| 1018 | LOperand* temp() { return temps_[0]; } |
| 1019 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1020 | DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
| 1021 | DECLARE_HYDROGEN_ACCESSOR(CompareMap) |
| 1022 | |
| 1023 | virtual bool IsControl() const { return true; } |
| 1024 | |
| 1025 | Handle<Map> map() const { return hydrogen()->map(); } |
| 1026 | int true_block_id() const { |
| 1027 | return hydrogen()->FirstSuccessor()->block_id(); |
| 1028 | } |
| 1029 | int false_block_id() const { |
| 1030 | return hydrogen()->SecondSuccessor()->block_id(); |
| 1031 | } |
| 1032 | }; |
| 1033 | |
| 1034 | |
| 1035 | class LJSArrayLength: public LTemplateInstruction<1, 1, 0> { |
| 1036 | public: |
| 1037 | explicit LJSArrayLength(LOperand* value) { |
| 1038 | inputs_[0] = value; |
| 1039 | } |
| 1040 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1041 | LOperand* value() { return inputs_[0]; } |
| 1042 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1043 | DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length") |
| 1044 | DECLARE_HYDROGEN_ACCESSOR(JSArrayLength) |
| 1045 | }; |
| 1046 | |
| 1047 | |
| 1048 | class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { |
| 1049 | public: |
| 1050 | explicit LFixedArrayBaseLength(LOperand* value) { |
| 1051 | inputs_[0] = value; |
| 1052 | } |
| 1053 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1054 | LOperand* value() { return inputs_[0]; } |
| 1055 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1056 | DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength, |
| 1057 | "fixed-array-base-length") |
| 1058 | DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength) |
| 1059 | }; |
| 1060 | |
| 1061 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1062 | class LMapEnumLength: public LTemplateInstruction<1, 1, 0> { |
| 1063 | public: |
| 1064 | explicit LMapEnumLength(LOperand* value) { |
| 1065 | inputs_[0] = value; |
| 1066 | } |
| 1067 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1068 | LOperand* value() { return inputs_[0]; } |
| 1069 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1070 | DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length") |
| 1071 | }; |
| 1072 | |
| 1073 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1074 | class LElementsKind: public LTemplateInstruction<1, 1, 0> { |
| 1075 | public: |
| 1076 | explicit LElementsKind(LOperand* value) { |
| 1077 | inputs_[0] = value; |
| 1078 | } |
| 1079 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1080 | LOperand* value() { return inputs_[0]; } |
| 1081 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1082 | DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind") |
| 1083 | DECLARE_HYDROGEN_ACCESSOR(ElementsKind) |
| 1084 | }; |
| 1085 | |
| 1086 | |
| 1087 | class LValueOf: public LTemplateInstruction<1, 1, 1> { |
| 1088 | public: |
| 1089 | LValueOf(LOperand* value, LOperand* temp) { |
| 1090 | inputs_[0] = value; |
| 1091 | temps_[0] = temp; |
| 1092 | } |
| 1093 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1094 | LOperand* value() { return inputs_[0]; } |
| 1095 | LOperand* temp() { return temps_[0]; } |
| 1096 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1097 | DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of") |
| 1098 | DECLARE_HYDROGEN_ACCESSOR(ValueOf) |
| 1099 | }; |
| 1100 | |
| 1101 | |
yangguo@chromium.org | 154ff99 | 2012-03-13 08:09:54 +0000 | [diff] [blame] | 1102 | class LDateField: public LTemplateInstruction<1, 1, 1> { |
| 1103 | public: |
| 1104 | LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) { |
| 1105 | inputs_[0] = date; |
| 1106 | temps_[0] = temp; |
| 1107 | } |
| 1108 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1109 | LOperand* date() { return inputs_[0]; } |
| 1110 | LOperand* temp() { return temps_[0]; } |
| 1111 | Smi* index() const { return index_; } |
| 1112 | |
yangguo@chromium.org | 154ff99 | 2012-03-13 08:09:54 +0000 | [diff] [blame] | 1113 | DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field") |
| 1114 | DECLARE_HYDROGEN_ACCESSOR(ValueOf) |
yangguo@chromium.org | 154ff99 | 2012-03-13 08:09:54 +0000 | [diff] [blame] | 1115 | |
| 1116 | private: |
| 1117 | Smi* index_; |
| 1118 | }; |
| 1119 | |
| 1120 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1121 | class LThrow: public LTemplateInstruction<0, 1, 0> { |
| 1122 | public: |
| 1123 | explicit LThrow(LOperand* value) { |
| 1124 | inputs_[0] = value; |
| 1125 | } |
| 1126 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1127 | LOperand* value() { return inputs_[0]; } |
| 1128 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1129 | DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") |
| 1130 | }; |
| 1131 | |
| 1132 | |
| 1133 | class LBitNotI: public LTemplateInstruction<1, 1, 0> { |
| 1134 | public: |
| 1135 | explicit LBitNotI(LOperand* value) { |
| 1136 | inputs_[0] = value; |
| 1137 | } |
| 1138 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1139 | LOperand* value() { return inputs_[0]; } |
| 1140 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1141 | DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i") |
| 1142 | }; |
| 1143 | |
| 1144 | |
| 1145 | class LAddI: public LTemplateInstruction<1, 2, 0> { |
| 1146 | public: |
| 1147 | LAddI(LOperand* left, LOperand* right) { |
| 1148 | inputs_[0] = left; |
| 1149 | inputs_[1] = right; |
| 1150 | } |
| 1151 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1152 | LOperand* left() { return inputs_[0]; } |
| 1153 | LOperand* right() { return inputs_[1]; } |
| 1154 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1155 | DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i") |
| 1156 | DECLARE_HYDROGEN_ACCESSOR(Add) |
| 1157 | }; |
| 1158 | |
| 1159 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 1160 | class LMathMinMax: public LTemplateInstruction<1, 2, 0> { |
| 1161 | public: |
| 1162 | LMathMinMax(LOperand* left, LOperand* right) { |
| 1163 | inputs_[0] = left; |
| 1164 | inputs_[1] = right; |
| 1165 | } |
| 1166 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1167 | LOperand* left() { return inputs_[0]; } |
| 1168 | LOperand* right() { return inputs_[1]; } |
| 1169 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 1170 | DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max") |
| 1171 | DECLARE_HYDROGEN_ACCESSOR(MathMinMax) |
| 1172 | }; |
| 1173 | |
| 1174 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1175 | class LPower: public LTemplateInstruction<1, 2, 0> { |
| 1176 | public: |
| 1177 | LPower(LOperand* left, LOperand* right) { |
| 1178 | inputs_[0] = left; |
| 1179 | inputs_[1] = right; |
| 1180 | } |
| 1181 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1182 | LOperand* left() { return inputs_[0]; } |
| 1183 | LOperand* right() { return inputs_[1]; } |
| 1184 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1185 | DECLARE_CONCRETE_INSTRUCTION(Power, "power") |
| 1186 | DECLARE_HYDROGEN_ACCESSOR(Power) |
| 1187 | }; |
| 1188 | |
| 1189 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 1190 | class LRandom: public LTemplateInstruction<1, 1, 0> { |
| 1191 | public: |
| 1192 | explicit LRandom(LOperand* global_object) { |
| 1193 | inputs_[0] = global_object; |
| 1194 | } |
| 1195 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1196 | LOperand* global_object() { return inputs_[0]; } |
| 1197 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 1198 | DECLARE_CONCRETE_INSTRUCTION(Random, "random") |
| 1199 | DECLARE_HYDROGEN_ACCESSOR(Random) |
| 1200 | }; |
| 1201 | |
| 1202 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1203 | class LArithmeticD: public LTemplateInstruction<1, 2, 0> { |
| 1204 | public: |
| 1205 | LArithmeticD(Token::Value op, LOperand* left, LOperand* right) |
| 1206 | : op_(op) { |
| 1207 | inputs_[0] = left; |
| 1208 | inputs_[1] = right; |
| 1209 | } |
| 1210 | |
| 1211 | Token::Value op() const { return op_; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1212 | LOperand* left() { return inputs_[0]; } |
| 1213 | LOperand* right() { return inputs_[1]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1214 | |
| 1215 | virtual Opcode opcode() const { return LInstruction::kArithmeticD; } |
| 1216 | virtual void CompileToNative(LCodeGen* generator); |
| 1217 | virtual const char* Mnemonic() const; |
| 1218 | |
| 1219 | private: |
| 1220 | Token::Value op_; |
| 1221 | }; |
| 1222 | |
| 1223 | |
| 1224 | class LArithmeticT: public LTemplateInstruction<1, 2, 0> { |
| 1225 | public: |
| 1226 | LArithmeticT(Token::Value op, LOperand* left, LOperand* right) |
| 1227 | : op_(op) { |
| 1228 | inputs_[0] = left; |
| 1229 | inputs_[1] = right; |
| 1230 | } |
| 1231 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1232 | LOperand* left() { return inputs_[0]; } |
| 1233 | LOperand* right() { return inputs_[1]; } |
| 1234 | Token::Value op() const { return op_; } |
| 1235 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1236 | virtual Opcode opcode() const { return LInstruction::kArithmeticT; } |
| 1237 | virtual void CompileToNative(LCodeGen* generator); |
| 1238 | virtual const char* Mnemonic() const; |
| 1239 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1240 | private: |
| 1241 | Token::Value op_; |
| 1242 | }; |
| 1243 | |
| 1244 | |
| 1245 | class LReturn: public LTemplateInstruction<0, 1, 0> { |
| 1246 | public: |
| 1247 | explicit LReturn(LOperand* value) { |
| 1248 | inputs_[0] = value; |
| 1249 | } |
| 1250 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1251 | LOperand* value() { return inputs_[0]; } |
| 1252 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1253 | DECLARE_CONCRETE_INSTRUCTION(Return, "return") |
| 1254 | }; |
| 1255 | |
| 1256 | |
| 1257 | class LLoadNamedField: public LTemplateInstruction<1, 1, 0> { |
| 1258 | public: |
| 1259 | explicit LLoadNamedField(LOperand* object) { |
| 1260 | inputs_[0] = object; |
| 1261 | } |
| 1262 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1263 | LOperand* object() { return inputs_[0]; } |
| 1264 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1265 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field") |
| 1266 | DECLARE_HYDROGEN_ACCESSOR(LoadNamedField) |
| 1267 | }; |
| 1268 | |
| 1269 | |
| 1270 | class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> { |
| 1271 | public: |
| 1272 | explicit LLoadNamedFieldPolymorphic(LOperand* object) { |
| 1273 | inputs_[0] = object; |
| 1274 | } |
| 1275 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1276 | LOperand* object() { return inputs_[0]; } |
| 1277 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1278 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic") |
| 1279 | DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1280 | }; |
| 1281 | |
| 1282 | |
| 1283 | class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> { |
| 1284 | public: |
| 1285 | explicit LLoadNamedGeneric(LOperand* object) { |
| 1286 | inputs_[0] = object; |
| 1287 | } |
| 1288 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1289 | LOperand* object() { return inputs_[0]; } |
| 1290 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1291 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic") |
| 1292 | DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric) |
| 1293 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1294 | Handle<Object> name() const { return hydrogen()->name(); } |
| 1295 | }; |
| 1296 | |
| 1297 | |
| 1298 | class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> { |
| 1299 | public: |
| 1300 | explicit LLoadFunctionPrototype(LOperand* function) { |
| 1301 | inputs_[0] = function; |
| 1302 | } |
| 1303 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1304 | LOperand* function() { return inputs_[0]; } |
| 1305 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1306 | DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype") |
| 1307 | DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1308 | }; |
| 1309 | |
| 1310 | |
| 1311 | class LLoadElements: public LTemplateInstruction<1, 1, 0> { |
| 1312 | public: |
| 1313 | explicit LLoadElements(LOperand* object) { |
| 1314 | inputs_[0] = object; |
| 1315 | } |
| 1316 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1317 | LOperand* object() { return inputs_[0]; } |
| 1318 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1319 | DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") |
| 1320 | }; |
| 1321 | |
| 1322 | |
| 1323 | class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> { |
| 1324 | public: |
| 1325 | explicit LLoadExternalArrayPointer(LOperand* object) { |
| 1326 | inputs_[0] = object; |
| 1327 | } |
| 1328 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1329 | LOperand* object() { return inputs_[0]; } |
| 1330 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1331 | DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer, |
| 1332 | "load-external-array-pointer") |
| 1333 | }; |
| 1334 | |
| 1335 | |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1336 | class LLoadKeyed: public LTemplateInstruction<1, 2, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1337 | public: |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1338 | LLoadKeyed(LOperand* elements, LOperand* key) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1339 | inputs_[0] = elements; |
| 1340 | inputs_[1] = key; |
| 1341 | } |
| 1342 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1343 | LOperand* elements() { return inputs_[0]; } |
| 1344 | LOperand* key() { return inputs_[1]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1345 | ElementsKind elements_kind() const { |
| 1346 | return hydrogen()->elements_kind(); |
| 1347 | } |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1348 | bool is_external() const { |
| 1349 | return hydrogen()->is_external(); |
| 1350 | } |
| 1351 | |
| 1352 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed") |
| 1353 | DECLARE_HYDROGEN_ACCESSOR(LoadKeyed) |
| 1354 | |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame^] | 1355 | virtual void PrintDataTo(StringStream* stream); |
jkummerow@chromium.org | 777db6f | 2012-05-24 09:33:09 +0000 | [diff] [blame] | 1356 | uint32_t additional_index() const { return hydrogen()->index_offset(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1357 | }; |
| 1358 | |
| 1359 | |
| 1360 | class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> { |
| 1361 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1362 | LLoadKeyedGeneric(LOperand* object, LOperand* key) { |
| 1363 | inputs_[0] = object; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1364 | inputs_[1] = key; |
| 1365 | } |
| 1366 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1367 | LOperand* object() { return inputs_[0]; } |
| 1368 | LOperand* key() { return inputs_[1]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1369 | |
| 1370 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1371 | }; |
| 1372 | |
| 1373 | |
| 1374 | class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> { |
| 1375 | public: |
| 1376 | DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell") |
| 1377 | DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell) |
| 1378 | }; |
| 1379 | |
| 1380 | |
| 1381 | class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> { |
| 1382 | public: |
| 1383 | explicit LLoadGlobalGeneric(LOperand* global_object) { |
| 1384 | inputs_[0] = global_object; |
| 1385 | } |
| 1386 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1387 | LOperand* global_object() { return inputs_[0]; } |
| 1388 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1389 | DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic") |
| 1390 | DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric) |
| 1391 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1392 | Handle<Object> name() const { return hydrogen()->name(); } |
| 1393 | bool for_typeof() const { return hydrogen()->for_typeof(); } |
| 1394 | }; |
| 1395 | |
| 1396 | |
| 1397 | class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> { |
| 1398 | public: |
| 1399 | LStoreGlobalCell(LOperand* value, LOperand* temp) { |
| 1400 | inputs_[0] = value; |
| 1401 | temps_[0] = temp; |
| 1402 | } |
| 1403 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1404 | LOperand* value() { return inputs_[0]; } |
| 1405 | LOperand* temp() { return temps_[0]; } |
| 1406 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1407 | DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell") |
| 1408 | DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell) |
| 1409 | }; |
| 1410 | |
| 1411 | |
| 1412 | class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> { |
| 1413 | public: |
| 1414 | explicit LStoreGlobalGeneric(LOperand* global_object, |
| 1415 | LOperand* value) { |
| 1416 | inputs_[0] = global_object; |
| 1417 | inputs_[1] = value; |
| 1418 | } |
| 1419 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1420 | LOperand* global_object() { return inputs_[0]; } |
| 1421 | LOperand* value() { return inputs_[1]; } |
| 1422 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1423 | DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic") |
| 1424 | DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric) |
| 1425 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1426 | Handle<Object> name() const { return hydrogen()->name(); } |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 1427 | StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1428 | }; |
| 1429 | |
| 1430 | |
| 1431 | class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> { |
| 1432 | public: |
| 1433 | explicit LLoadContextSlot(LOperand* context) { |
| 1434 | inputs_[0] = context; |
| 1435 | } |
| 1436 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1437 | LOperand* context() { return inputs_[0]; } |
| 1438 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1439 | DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") |
| 1440 | DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) |
| 1441 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1442 | int slot_index() { return hydrogen()->slot_index(); } |
| 1443 | |
| 1444 | virtual void PrintDataTo(StringStream* stream); |
| 1445 | }; |
| 1446 | |
| 1447 | |
| 1448 | class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> { |
| 1449 | public: |
| 1450 | LStoreContextSlot(LOperand* context, LOperand* value) { |
| 1451 | inputs_[0] = context; |
| 1452 | inputs_[1] = value; |
| 1453 | } |
| 1454 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1455 | LOperand* context() { return inputs_[0]; } |
| 1456 | LOperand* value() { return inputs_[1]; } |
| 1457 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1458 | DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot") |
| 1459 | DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot) |
| 1460 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1461 | int slot_index() { return hydrogen()->slot_index(); } |
| 1462 | |
| 1463 | virtual void PrintDataTo(StringStream* stream); |
| 1464 | }; |
| 1465 | |
| 1466 | |
| 1467 | class LPushArgument: public LTemplateInstruction<0, 1, 0> { |
| 1468 | public: |
| 1469 | explicit LPushArgument(LOperand* value) { |
| 1470 | inputs_[0] = value; |
| 1471 | } |
| 1472 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1473 | LOperand* value() { return inputs_[0]; } |
| 1474 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1475 | DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") |
| 1476 | }; |
| 1477 | |
| 1478 | |
jkummerow@chromium.org | 28faa98 | 2012-04-13 09:58:30 +0000 | [diff] [blame] | 1479 | class LDrop: public LTemplateInstruction<0, 0, 0> { |
| 1480 | public: |
| 1481 | explicit LDrop(int count) : count_(count) { } |
| 1482 | |
| 1483 | int count() const { return count_; } |
| 1484 | |
| 1485 | DECLARE_CONCRETE_INSTRUCTION(Drop, "drop") |
| 1486 | |
| 1487 | private: |
| 1488 | int count_; |
| 1489 | }; |
| 1490 | |
| 1491 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1492 | class LThisFunction: public LTemplateInstruction<1, 0, 0> { |
| 1493 | public: |
| 1494 | DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function") |
| 1495 | DECLARE_HYDROGEN_ACCESSOR(ThisFunction) |
| 1496 | }; |
| 1497 | |
| 1498 | |
| 1499 | class LContext: public LTemplateInstruction<1, 0, 0> { |
| 1500 | public: |
| 1501 | DECLARE_CONCRETE_INSTRUCTION(Context, "context") |
| 1502 | }; |
| 1503 | |
| 1504 | |
| 1505 | class LOuterContext: public LTemplateInstruction<1, 1, 0> { |
| 1506 | public: |
| 1507 | explicit LOuterContext(LOperand* context) { |
| 1508 | inputs_[0] = context; |
| 1509 | } |
| 1510 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1511 | LOperand* context() { return inputs_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1512 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1513 | DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1514 | }; |
| 1515 | |
| 1516 | |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 1517 | class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> { |
| 1518 | public: |
| 1519 | DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals") |
| 1520 | DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals) |
| 1521 | }; |
| 1522 | |
| 1523 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1524 | class LGlobalObject: public LTemplateInstruction<1, 1, 0> { |
| 1525 | public: |
| 1526 | explicit LGlobalObject(LOperand* context) { |
| 1527 | inputs_[0] = context; |
| 1528 | } |
| 1529 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1530 | LOperand* context() { return inputs_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1531 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1532 | DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1533 | }; |
| 1534 | |
| 1535 | |
| 1536 | class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> { |
| 1537 | public: |
| 1538 | explicit LGlobalReceiver(LOperand* global_object) { |
| 1539 | inputs_[0] = global_object; |
| 1540 | } |
| 1541 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1542 | LOperand* global_object() { return inputs_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1543 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1544 | DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1545 | }; |
| 1546 | |
| 1547 | |
| 1548 | class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> { |
| 1549 | public: |
| 1550 | DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") |
| 1551 | DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) |
| 1552 | |
| 1553 | virtual void PrintDataTo(StringStream* stream); |
| 1554 | |
| 1555 | Handle<JSFunction> function() { return hydrogen()->function(); } |
| 1556 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1557 | }; |
| 1558 | |
| 1559 | |
| 1560 | class LInvokeFunction: public LTemplateInstruction<1, 1, 0> { |
| 1561 | public: |
| 1562 | explicit LInvokeFunction(LOperand* function) { |
| 1563 | inputs_[0] = function; |
| 1564 | } |
| 1565 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1566 | LOperand* function() { return inputs_[0]; } |
| 1567 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1568 | DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") |
| 1569 | DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) |
| 1570 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1571 | virtual void PrintDataTo(StringStream* stream); |
| 1572 | |
| 1573 | int arity() const { return hydrogen()->argument_count() - 1; } |
svenpanne@chromium.org | fb04633 | 2012-04-19 12:02:44 +0000 | [diff] [blame] | 1574 | Handle<JSFunction> known_function() { return hydrogen()->known_function(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1575 | }; |
| 1576 | |
| 1577 | |
| 1578 | class LCallKeyed: public LTemplateInstruction<1, 1, 0> { |
| 1579 | public: |
| 1580 | explicit LCallKeyed(LOperand* key) { |
| 1581 | inputs_[0] = key; |
| 1582 | } |
| 1583 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1584 | LOperand* key() { return inputs_[0]; } |
| 1585 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1586 | DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") |
| 1587 | DECLARE_HYDROGEN_ACCESSOR(CallKeyed) |
| 1588 | |
| 1589 | virtual void PrintDataTo(StringStream* stream); |
| 1590 | |
| 1591 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1592 | }; |
| 1593 | |
| 1594 | |
| 1595 | |
| 1596 | class LCallNamed: public LTemplateInstruction<1, 0, 0> { |
| 1597 | public: |
| 1598 | DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") |
| 1599 | DECLARE_HYDROGEN_ACCESSOR(CallNamed) |
| 1600 | |
| 1601 | virtual void PrintDataTo(StringStream* stream); |
| 1602 | |
| 1603 | Handle<String> name() const { return hydrogen()->name(); } |
| 1604 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1605 | }; |
| 1606 | |
| 1607 | |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1608 | class LCallFunction: public LTemplateInstruction<1, 1, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1609 | public: |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1610 | explicit LCallFunction(LOperand* function) { |
| 1611 | inputs_[0] = function; |
| 1612 | } |
| 1613 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1614 | LOperand* function() { return inputs_[0]; } |
| 1615 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1616 | DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") |
| 1617 | DECLARE_HYDROGEN_ACCESSOR(CallFunction) |
| 1618 | |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1619 | int arity() const { return hydrogen()->argument_count() - 1; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1620 | }; |
| 1621 | |
| 1622 | |
| 1623 | class LCallGlobal: public LTemplateInstruction<1, 0, 0> { |
| 1624 | public: |
| 1625 | DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") |
| 1626 | DECLARE_HYDROGEN_ACCESSOR(CallGlobal) |
| 1627 | |
| 1628 | virtual void PrintDataTo(StringStream* stream); |
| 1629 | |
| 1630 | Handle<String> name() const {return hydrogen()->name(); } |
| 1631 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1632 | }; |
| 1633 | |
| 1634 | |
| 1635 | class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> { |
| 1636 | public: |
| 1637 | DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") |
| 1638 | DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) |
| 1639 | |
| 1640 | virtual void PrintDataTo(StringStream* stream); |
| 1641 | |
| 1642 | Handle<JSFunction> target() const { return hydrogen()->target(); } |
| 1643 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1644 | }; |
| 1645 | |
| 1646 | |
| 1647 | class LCallNew: public LTemplateInstruction<1, 1, 0> { |
| 1648 | public: |
| 1649 | explicit LCallNew(LOperand* constructor) { |
| 1650 | inputs_[0] = constructor; |
| 1651 | } |
| 1652 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1653 | LOperand* constructor() { return inputs_[0]; } |
| 1654 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1655 | DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") |
| 1656 | DECLARE_HYDROGEN_ACCESSOR(CallNew) |
| 1657 | |
| 1658 | virtual void PrintDataTo(StringStream* stream); |
| 1659 | |
| 1660 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1661 | }; |
| 1662 | |
| 1663 | |
| 1664 | class LCallRuntime: public LTemplateInstruction<1, 0, 0> { |
| 1665 | public: |
| 1666 | DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime") |
| 1667 | DECLARE_HYDROGEN_ACCESSOR(CallRuntime) |
| 1668 | |
| 1669 | const Runtime::Function* function() const { return hydrogen()->function(); } |
| 1670 | int arity() const { return hydrogen()->argument_count(); } |
| 1671 | }; |
| 1672 | |
| 1673 | |
| 1674 | class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> { |
| 1675 | public: |
| 1676 | explicit LInteger32ToDouble(LOperand* value) { |
| 1677 | inputs_[0] = value; |
| 1678 | } |
| 1679 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1680 | LOperand* value() { return inputs_[0]; } |
| 1681 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1682 | DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double") |
| 1683 | }; |
| 1684 | |
| 1685 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1686 | class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> { |
| 1687 | public: |
| 1688 | explicit LUint32ToDouble(LOperand* value) { |
| 1689 | inputs_[0] = value; |
| 1690 | } |
| 1691 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1692 | LOperand* value() { return inputs_[0]; } |
| 1693 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1694 | DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") |
| 1695 | }; |
| 1696 | |
| 1697 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1698 | class LNumberTagI: public LTemplateInstruction<1, 1, 0> { |
| 1699 | public: |
| 1700 | explicit LNumberTagI(LOperand* value) { |
| 1701 | inputs_[0] = value; |
| 1702 | } |
| 1703 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1704 | LOperand* value() { return inputs_[0]; } |
| 1705 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1706 | DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") |
| 1707 | }; |
| 1708 | |
| 1709 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1710 | class LNumberTagU: public LTemplateInstruction<1, 1, 0> { |
| 1711 | public: |
| 1712 | explicit LNumberTagU(LOperand* value) { |
| 1713 | inputs_[0] = value; |
| 1714 | } |
| 1715 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1716 | LOperand* value() { return inputs_[0]; } |
| 1717 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1718 | DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u") |
| 1719 | }; |
| 1720 | |
| 1721 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1722 | class LNumberTagD: public LTemplateInstruction<1, 1, 2> { |
| 1723 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1724 | LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1725 | inputs_[0] = value; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1726 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1727 | temps_[1] = temp2; |
| 1728 | } |
| 1729 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1730 | LOperand* value() { return inputs_[0]; } |
| 1731 | LOperand* temp() { return temps_[0]; } |
| 1732 | LOperand* temp2() { return temps_[1]; } |
| 1733 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1734 | DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d") |
| 1735 | }; |
| 1736 | |
| 1737 | |
| 1738 | // Sometimes truncating conversion from a tagged value to an int32. |
| 1739 | class LDoubleToI: public LTemplateInstruction<1, 1, 2> { |
| 1740 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1741 | LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1742 | inputs_[0] = value; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1743 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1744 | temps_[1] = temp2; |
| 1745 | } |
| 1746 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1747 | LOperand* value() { return inputs_[0]; } |
| 1748 | LOperand* temp() { return temps_[0]; } |
| 1749 | LOperand* temp2() { return temps_[1]; } |
| 1750 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1751 | DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i") |
| 1752 | DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) |
| 1753 | |
| 1754 | bool truncating() { return hydrogen()->CanTruncateToInt32(); } |
| 1755 | }; |
| 1756 | |
| 1757 | |
| 1758 | // Truncating conversion from a tagged value to an int32. |
| 1759 | class LTaggedToI: public LTemplateInstruction<1, 1, 3> { |
| 1760 | public: |
| 1761 | LTaggedToI(LOperand* value, |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1762 | LOperand* temp, |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1763 | LOperand* temp2, |
| 1764 | LOperand* temp3) { |
| 1765 | inputs_[0] = value; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1766 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1767 | temps_[1] = temp2; |
| 1768 | temps_[2] = temp3; |
| 1769 | } |
| 1770 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1771 | LOperand* value() { return inputs_[0]; } |
| 1772 | LOperand* temp() { return temps_[0]; } |
| 1773 | LOperand* temp2() { return temps_[1]; } |
| 1774 | LOperand* temp3() { return temps_[2]; } |
| 1775 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1776 | DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i") |
| 1777 | DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) |
| 1778 | |
| 1779 | bool truncating() { return hydrogen()->CanTruncateToInt32(); } |
| 1780 | }; |
| 1781 | |
| 1782 | |
| 1783 | class LSmiTag: public LTemplateInstruction<1, 1, 0> { |
| 1784 | public: |
| 1785 | explicit LSmiTag(LOperand* value) { |
| 1786 | inputs_[0] = value; |
| 1787 | } |
| 1788 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1789 | LOperand* value() { return inputs_[0]; } |
| 1790 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1791 | DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag") |
| 1792 | }; |
| 1793 | |
| 1794 | |
| 1795 | class LNumberUntagD: public LTemplateInstruction<1, 1, 0> { |
| 1796 | public: |
| 1797 | explicit LNumberUntagD(LOperand* value) { |
| 1798 | inputs_[0] = value; |
| 1799 | } |
| 1800 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1801 | LOperand* value() { return inputs_[0]; } |
| 1802 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1803 | DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") |
| 1804 | DECLARE_HYDROGEN_ACCESSOR(Change) |
| 1805 | }; |
| 1806 | |
| 1807 | |
| 1808 | class LSmiUntag: public LTemplateInstruction<1, 1, 0> { |
| 1809 | public: |
| 1810 | LSmiUntag(LOperand* value, bool needs_check) |
| 1811 | : needs_check_(needs_check) { |
| 1812 | inputs_[0] = value; |
| 1813 | } |
| 1814 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1815 | LOperand* value() { return inputs_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1816 | bool needs_check() const { return needs_check_; } |
| 1817 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1818 | DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") |
| 1819 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1820 | private: |
| 1821 | bool needs_check_; |
| 1822 | }; |
| 1823 | |
| 1824 | |
verwaest@chromium.org | 3714139 | 2012-05-31 13:27:02 +0000 | [diff] [blame] | 1825 | class LStoreNamedField: public LTemplateInstruction<0, 2, 1> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1826 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1827 | LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) { |
| 1828 | inputs_[0] = object; |
| 1829 | inputs_[1] = value; |
verwaest@chromium.org | 3714139 | 2012-05-31 13:27:02 +0000 | [diff] [blame] | 1830 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1831 | } |
| 1832 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1833 | LOperand* object() { return inputs_[0]; } |
| 1834 | LOperand* value() { return inputs_[1]; } |
| 1835 | LOperand* temp() { return temps_[0]; } |
| 1836 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1837 | DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field") |
| 1838 | DECLARE_HYDROGEN_ACCESSOR(StoreNamedField) |
| 1839 | |
| 1840 | virtual void PrintDataTo(StringStream* stream); |
| 1841 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1842 | Handle<Object> name() const { return hydrogen()->name(); } |
| 1843 | bool is_in_object() { return hydrogen()->is_in_object(); } |
| 1844 | int offset() { return hydrogen()->offset(); } |
| 1845 | Handle<Map> transition() const { return hydrogen()->transition(); } |
| 1846 | }; |
| 1847 | |
| 1848 | |
| 1849 | class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> { |
| 1850 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1851 | LStoreNamedGeneric(LOperand* object, LOperand* value) { |
| 1852 | inputs_[0] = object; |
| 1853 | inputs_[1] = value; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1854 | } |
| 1855 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1856 | LOperand* object() { return inputs_[0]; } |
| 1857 | LOperand* value() { return inputs_[1]; } |
| 1858 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1859 | DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") |
| 1860 | DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) |
| 1861 | |
| 1862 | virtual void PrintDataTo(StringStream* stream); |
| 1863 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1864 | Handle<Object> name() const { return hydrogen()->name(); } |
| 1865 | StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1866 | }; |
| 1867 | |
| 1868 | |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1869 | class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1870 | public: |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1871 | LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) { |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1872 | inputs_[0] = object; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1873 | inputs_[1] = key; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1874 | inputs_[2] = value; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1875 | } |
| 1876 | |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1877 | bool is_external() const { return hydrogen()->is_external(); } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1878 | LOperand* elements() { return inputs_[0]; } |
| 1879 | LOperand* key() { return inputs_[1]; } |
| 1880 | LOperand* value() { return inputs_[2]; } |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1881 | ElementsKind elements_kind() const { |
| 1882 | return hydrogen()->elements_kind(); |
| 1883 | } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1884 | |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1885 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed") |
| 1886 | DECLARE_HYDROGEN_ACCESSOR(StoreKeyed) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1887 | |
| 1888 | virtual void PrintDataTo(StringStream* stream); |
svenpanne@chromium.org | fb04633 | 2012-04-19 12:02:44 +0000 | [diff] [blame] | 1889 | bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); } |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1890 | uint32_t additional_index() const { return hydrogen()->index_offset(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1891 | }; |
| 1892 | |
| 1893 | |
| 1894 | class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> { |
| 1895 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1896 | LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1897 | inputs_[0] = obj; |
| 1898 | inputs_[1] = key; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1899 | inputs_[2] = value; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1900 | } |
| 1901 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1902 | LOperand* object() { return inputs_[0]; } |
| 1903 | LOperand* key() { return inputs_[1]; } |
| 1904 | LOperand* value() { return inputs_[2]; } |
| 1905 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1906 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") |
| 1907 | DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric) |
| 1908 | |
| 1909 | virtual void PrintDataTo(StringStream* stream); |
| 1910 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 1911 | StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1912 | }; |
| 1913 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1914 | |
| 1915 | class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> { |
| 1916 | public: |
| 1917 | LTransitionElementsKind(LOperand* object, |
| 1918 | LOperand* new_map_temp, |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1919 | LOperand* temp) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1920 | inputs_[0] = object; |
| 1921 | temps_[0] = new_map_temp; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1922 | temps_[1] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1923 | } |
| 1924 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1925 | LOperand* object() { return inputs_[0]; } |
| 1926 | LOperand* new_map_temp() { return temps_[0]; } |
| 1927 | LOperand* temp() { return temps_[1]; } |
| 1928 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1929 | DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind, |
| 1930 | "transition-elements-kind") |
| 1931 | DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind) |
| 1932 | |
| 1933 | virtual void PrintDataTo(StringStream* stream); |
| 1934 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1935 | Handle<Map> original_map() { return hydrogen()->original_map(); } |
| 1936 | Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); } |
| 1937 | }; |
| 1938 | |
| 1939 | |
| 1940 | class LStringAdd: public LTemplateInstruction<1, 2, 0> { |
| 1941 | public: |
| 1942 | LStringAdd(LOperand* left, LOperand* right) { |
| 1943 | inputs_[0] = left; |
| 1944 | inputs_[1] = right; |
| 1945 | } |
| 1946 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1947 | LOperand* left() { return inputs_[0]; } |
| 1948 | LOperand* right() { return inputs_[1]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1949 | |
| 1950 | DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add") |
| 1951 | DECLARE_HYDROGEN_ACCESSOR(StringAdd) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1952 | }; |
| 1953 | |
| 1954 | |
| 1955 | |
| 1956 | class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> { |
| 1957 | public: |
| 1958 | LStringCharCodeAt(LOperand* string, LOperand* index) { |
| 1959 | inputs_[0] = string; |
| 1960 | inputs_[1] = index; |
| 1961 | } |
| 1962 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1963 | LOperand* string() { return inputs_[0]; } |
| 1964 | LOperand* index() { return inputs_[1]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1965 | |
| 1966 | DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at") |
| 1967 | DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1968 | }; |
| 1969 | |
| 1970 | |
| 1971 | class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> { |
| 1972 | public: |
| 1973 | explicit LStringCharFromCode(LOperand* char_code) { |
| 1974 | inputs_[0] = char_code; |
| 1975 | } |
| 1976 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1977 | LOperand* char_code() { return inputs_[0]; } |
| 1978 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1979 | DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code") |
| 1980 | DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1981 | }; |
| 1982 | |
| 1983 | |
| 1984 | class LStringLength: public LTemplateInstruction<1, 1, 0> { |
| 1985 | public: |
| 1986 | explicit LStringLength(LOperand* string) { |
| 1987 | inputs_[0] = string; |
| 1988 | } |
| 1989 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1990 | LOperand* string() { return inputs_[0]; } |
| 1991 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1992 | DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length") |
| 1993 | DECLARE_HYDROGEN_ACCESSOR(StringLength) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1994 | }; |
| 1995 | |
| 1996 | |
| 1997 | class LCheckFunction: public LTemplateInstruction<0, 1, 0> { |
| 1998 | public: |
| 1999 | explicit LCheckFunction(LOperand* value) { |
| 2000 | inputs_[0] = value; |
| 2001 | } |
| 2002 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2003 | LOperand* value() { return inputs_[0]; } |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 2004 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2005 | DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") |
| 2006 | DECLARE_HYDROGEN_ACCESSOR(CheckFunction) |
| 2007 | }; |
| 2008 | |
| 2009 | |
| 2010 | class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> { |
| 2011 | public: |
| 2012 | explicit LCheckInstanceType(LOperand* value) { |
| 2013 | inputs_[0] = value; |
| 2014 | } |
| 2015 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2016 | LOperand* value() { return inputs_[0]; } |
| 2017 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2018 | DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") |
| 2019 | DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) |
| 2020 | }; |
| 2021 | |
| 2022 | |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 2023 | class LCheckMaps: public LTemplateInstruction<0, 1, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2024 | public: |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 2025 | explicit LCheckMaps(LOperand* value) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2026 | inputs_[0] = value; |
| 2027 | } |
| 2028 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2029 | LOperand* value() { return inputs_[0]; } |
| 2030 | |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 2031 | DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps") |
| 2032 | DECLARE_HYDROGEN_ACCESSOR(CheckMaps) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2033 | }; |
| 2034 | |
| 2035 | |
verwaest@chromium.org | e4ee6de | 2012-11-06 12:13:00 +0000 | [diff] [blame] | 2036 | class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 2> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2037 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2038 | LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) { |
| 2039 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2040 | temps_[1] = temp2; |
| 2041 | } |
| 2042 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2043 | LOperand* temp() { return temps_[0]; } |
| 2044 | LOperand* temp2() { return temps_[1]; } |
| 2045 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2046 | DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps") |
| 2047 | DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps) |
| 2048 | |
| 2049 | Handle<JSObject> prototype() const { return hydrogen()->prototype(); } |
| 2050 | Handle<JSObject> holder() const { return hydrogen()->holder(); } |
| 2051 | }; |
| 2052 | |
| 2053 | |
| 2054 | class LCheckSmi: public LTemplateInstruction<0, 1, 0> { |
| 2055 | public: |
| 2056 | explicit LCheckSmi(LOperand* value) { |
| 2057 | inputs_[0] = value; |
| 2058 | } |
| 2059 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2060 | LOperand* value() { return inputs_[0]; } |
| 2061 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2062 | DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi") |
| 2063 | }; |
| 2064 | |
| 2065 | |
| 2066 | class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { |
| 2067 | public: |
| 2068 | explicit LCheckNonSmi(LOperand* value) { |
| 2069 | inputs_[0] = value; |
| 2070 | } |
| 2071 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2072 | LOperand* value() { return inputs_[0]; } |
| 2073 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2074 | DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") |
| 2075 | }; |
| 2076 | |
| 2077 | |
| 2078 | class LClampDToUint8: public LTemplateInstruction<1, 1, 1> { |
| 2079 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2080 | LClampDToUint8(LOperand* unclamped, LOperand* temp) { |
| 2081 | inputs_[0] = unclamped; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2082 | temps_[0] = temp; |
| 2083 | } |
| 2084 | |
| 2085 | LOperand* unclamped() { return inputs_[0]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2086 | LOperand* temp() { return temps_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2087 | |
| 2088 | DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8") |
| 2089 | }; |
| 2090 | |
| 2091 | |
| 2092 | class LClampIToUint8: public LTemplateInstruction<1, 1, 0> { |
| 2093 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2094 | explicit LClampIToUint8(LOperand* unclamped) { |
| 2095 | inputs_[0] = unclamped; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2096 | } |
| 2097 | |
| 2098 | LOperand* unclamped() { return inputs_[0]; } |
| 2099 | |
| 2100 | DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8") |
| 2101 | }; |
| 2102 | |
| 2103 | |
| 2104 | class LClampTToUint8: public LTemplateInstruction<1, 1, 1> { |
| 2105 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2106 | LClampTToUint8(LOperand* unclamped, LOperand* temp) { |
| 2107 | inputs_[0] = unclamped; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2108 | temps_[0] = temp; |
| 2109 | } |
| 2110 | |
| 2111 | LOperand* unclamped() { return inputs_[0]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2112 | LOperand* temp() { return temps_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2113 | |
| 2114 | DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8") |
| 2115 | }; |
| 2116 | |
| 2117 | |
fschneider@chromium.org | 35814e5 | 2012-03-01 15:43:35 +0000 | [diff] [blame] | 2118 | class LAllocateObject: public LTemplateInstruction<1, 0, 2> { |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 2119 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2120 | LAllocateObject(LOperand* temp, LOperand* temp2) { |
| 2121 | temps_[0] = temp; |
fschneider@chromium.org | 35814e5 | 2012-03-01 15:43:35 +0000 | [diff] [blame] | 2122 | temps_[1] = temp2; |
| 2123 | } |
| 2124 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2125 | LOperand* temp() { return temps_[0]; } |
| 2126 | LOperand* temp2() { return temps_[1]; } |
| 2127 | |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 2128 | DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object") |
| 2129 | DECLARE_HYDROGEN_ACCESSOR(AllocateObject) |
| 2130 | }; |
| 2131 | |
| 2132 | |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 2133 | class LFastLiteral: public LTemplateInstruction<1, 0, 0> { |
| 2134 | public: |
| 2135 | DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal") |
| 2136 | DECLARE_HYDROGEN_ACCESSOR(FastLiteral) |
| 2137 | }; |
| 2138 | |
| 2139 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2140 | class LArrayLiteral: public LTemplateInstruction<1, 0, 0> { |
| 2141 | public: |
| 2142 | DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal") |
| 2143 | DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral) |
| 2144 | }; |
| 2145 | |
| 2146 | |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 2147 | class LObjectLiteral: public LTemplateInstruction<1, 0, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2148 | public: |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 2149 | DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal") |
| 2150 | DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2151 | }; |
| 2152 | |
| 2153 | |
| 2154 | class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> { |
| 2155 | public: |
| 2156 | DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal") |
| 2157 | DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral) |
| 2158 | }; |
| 2159 | |
| 2160 | |
| 2161 | class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> { |
| 2162 | public: |
| 2163 | DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") |
| 2164 | DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) |
| 2165 | |
| 2166 | Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); } |
| 2167 | }; |
| 2168 | |
| 2169 | |
| 2170 | class LToFastProperties: public LTemplateInstruction<1, 1, 0> { |
| 2171 | public: |
| 2172 | explicit LToFastProperties(LOperand* value) { |
| 2173 | inputs_[0] = value; |
| 2174 | } |
| 2175 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2176 | LOperand* value() { return inputs_[0]; } |
| 2177 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2178 | DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties") |
| 2179 | DECLARE_HYDROGEN_ACCESSOR(ToFastProperties) |
| 2180 | }; |
| 2181 | |
| 2182 | |
| 2183 | class LTypeof: public LTemplateInstruction<1, 1, 0> { |
| 2184 | public: |
| 2185 | explicit LTypeof(LOperand* value) { |
| 2186 | inputs_[0] = value; |
| 2187 | } |
| 2188 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2189 | LOperand* value() { return inputs_[0]; } |
| 2190 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2191 | DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") |
| 2192 | }; |
| 2193 | |
| 2194 | |
| 2195 | class LTypeofIsAndBranch: public LControlInstruction<1, 0> { |
| 2196 | public: |
| 2197 | explicit LTypeofIsAndBranch(LOperand* value) { |
| 2198 | inputs_[0] = value; |
| 2199 | } |
| 2200 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2201 | LOperand* value() { return inputs_[0]; } |
| 2202 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2203 | DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") |
| 2204 | DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch) |
| 2205 | |
| 2206 | Handle<String> type_literal() { return hydrogen()->type_literal(); } |
| 2207 | |
| 2208 | virtual void PrintDataTo(StringStream* stream); |
| 2209 | }; |
| 2210 | |
| 2211 | |
| 2212 | class LIsConstructCallAndBranch: public LControlInstruction<0, 1> { |
| 2213 | public: |
| 2214 | explicit LIsConstructCallAndBranch(LOperand* temp) { |
| 2215 | temps_[0] = temp; |
| 2216 | } |
| 2217 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2218 | LOperand* temp() { return temps_[0]; } |
| 2219 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2220 | DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch, |
| 2221 | "is-construct-call-and-branch") |
| 2222 | }; |
| 2223 | |
| 2224 | |
| 2225 | class LDeleteProperty: public LTemplateInstruction<1, 2, 0> { |
| 2226 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2227 | LDeleteProperty(LOperand* object, LOperand* key) { |
| 2228 | inputs_[0] = object; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2229 | inputs_[1] = key; |
| 2230 | } |
| 2231 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2232 | LOperand* object() { return inputs_[0]; } |
| 2233 | LOperand* key() { return inputs_[1]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2234 | |
| 2235 | DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2236 | }; |
| 2237 | |
| 2238 | |
| 2239 | class LOsrEntry: public LTemplateInstruction<0, 0, 0> { |
| 2240 | public: |
| 2241 | LOsrEntry(); |
| 2242 | |
| 2243 | DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") |
| 2244 | |
| 2245 | LOperand** SpilledRegisterArray() { return register_spills_; } |
| 2246 | LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; } |
| 2247 | |
| 2248 | void MarkSpilledRegister(int allocation_index, LOperand* spill_operand); |
| 2249 | void MarkSpilledDoubleRegister(int allocation_index, |
| 2250 | LOperand* spill_operand); |
| 2251 | |
| 2252 | private: |
| 2253 | // Arrays of spill slot operands for registers with an assigned spill |
| 2254 | // slot, i.e., that must also be restored to the spill slot on OSR entry. |
| 2255 | // NULL if the register has no assigned spill slot. Indexed by allocation |
| 2256 | // index. |
| 2257 | LOperand* register_spills_[Register::kNumAllocatableRegisters]; |
| 2258 | LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters]; |
| 2259 | }; |
| 2260 | |
| 2261 | |
| 2262 | class LStackCheck: public LTemplateInstruction<0, 0, 0> { |
| 2263 | public: |
| 2264 | DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") |
| 2265 | DECLARE_HYDROGEN_ACCESSOR(StackCheck) |
| 2266 | |
| 2267 | Label* done_label() { return &done_label_; } |
| 2268 | |
| 2269 | private: |
| 2270 | Label done_label_; |
| 2271 | }; |
| 2272 | |
| 2273 | |
| 2274 | class LIn: public LTemplateInstruction<1, 2, 0> { |
| 2275 | public: |
| 2276 | LIn(LOperand* key, LOperand* object) { |
| 2277 | inputs_[0] = key; |
| 2278 | inputs_[1] = object; |
| 2279 | } |
| 2280 | |
| 2281 | LOperand* key() { return inputs_[0]; } |
| 2282 | LOperand* object() { return inputs_[1]; } |
| 2283 | |
| 2284 | DECLARE_CONCRETE_INSTRUCTION(In, "in") |
| 2285 | }; |
| 2286 | |
| 2287 | |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2288 | class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> { |
| 2289 | public: |
| 2290 | explicit LForInPrepareMap(LOperand* object) { |
| 2291 | inputs_[0] = object; |
| 2292 | } |
| 2293 | |
| 2294 | LOperand* object() { return inputs_[0]; } |
| 2295 | |
| 2296 | DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map") |
| 2297 | }; |
| 2298 | |
| 2299 | |
rossberg@chromium.org | 89e18f5 | 2012-10-22 13:09:53 +0000 | [diff] [blame] | 2300 | class LForInCacheArray: public LTemplateInstruction<1, 1, 0> { |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2301 | public: |
rossberg@chromium.org | 89e18f5 | 2012-10-22 13:09:53 +0000 | [diff] [blame] | 2302 | explicit LForInCacheArray(LOperand* map) { |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2303 | inputs_[0] = map; |
| 2304 | } |
| 2305 | |
| 2306 | LOperand* map() { return inputs_[0]; } |
| 2307 | |
| 2308 | DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array") |
| 2309 | |
| 2310 | int idx() { |
| 2311 | return HForInCacheArray::cast(this->hydrogen_value())->idx(); |
| 2312 | } |
| 2313 | }; |
| 2314 | |
| 2315 | |
| 2316 | class LCheckMapValue: public LTemplateInstruction<0, 2, 0> { |
| 2317 | public: |
| 2318 | LCheckMapValue(LOperand* value, LOperand* map) { |
| 2319 | inputs_[0] = value; |
| 2320 | inputs_[1] = map; |
| 2321 | } |
| 2322 | |
| 2323 | LOperand* value() { return inputs_[0]; } |
| 2324 | LOperand* map() { return inputs_[1]; } |
| 2325 | |
| 2326 | DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value") |
| 2327 | }; |
| 2328 | |
| 2329 | |
| 2330 | class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> { |
| 2331 | public: |
| 2332 | LLoadFieldByIndex(LOperand* object, LOperand* index) { |
| 2333 | inputs_[0] = object; |
| 2334 | inputs_[1] = index; |
| 2335 | } |
| 2336 | |
| 2337 | LOperand* object() { return inputs_[0]; } |
| 2338 | LOperand* index() { return inputs_[1]; } |
| 2339 | |
| 2340 | DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") |
| 2341 | }; |
| 2342 | |
| 2343 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2344 | class LChunkBuilder; |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2345 | class LPlatformChunk: public LChunk { |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2346 | public: |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2347 | LPlatformChunk(CompilationInfo* info, HGraph* graph) |
| 2348 | : LChunk(info, graph) { } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2349 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2350 | int GetNextSpillIndex(bool is_double); |
| 2351 | LOperand* GetNextSpillSlot(bool is_double); |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2352 | }; |
| 2353 | |
| 2354 | |
| 2355 | class LChunkBuilder BASE_EMBEDDED { |
| 2356 | public: |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2357 | LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) |
| 2358 | : chunk_(NULL), |
| 2359 | info_(info), |
| 2360 | graph_(graph), |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 2361 | zone_(graph->zone()), |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2362 | status_(UNUSED), |
| 2363 | current_instruction_(NULL), |
| 2364 | current_block_(NULL), |
| 2365 | next_block_(NULL), |
| 2366 | argument_count_(0), |
| 2367 | allocator_(allocator), |
| 2368 | position_(RelocInfo::kNoPosition), |
| 2369 | instruction_pending_deoptimization_environment_(NULL), |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 2370 | pending_deoptimization_ast_id_(BailoutId::None()) { } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2371 | |
| 2372 | // Build the sequence for the graph. |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2373 | LPlatformChunk* Build(); |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2374 | |
| 2375 | // Declare methods that deal with the individual node types. |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2376 | #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2377 | HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
| 2378 | #undef DECLARE_DO |
| 2379 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2380 | private: |
| 2381 | enum Status { |
| 2382 | UNUSED, |
| 2383 | BUILDING, |
| 2384 | DONE, |
| 2385 | ABORTED |
| 2386 | }; |
| 2387 | |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2388 | LPlatformChunk* chunk() const { return chunk_; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2389 | CompilationInfo* info() const { return info_; } |
| 2390 | HGraph* graph() const { return graph_; } |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2391 | Zone* zone() const { return zone_; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2392 | |
| 2393 | bool is_unused() const { return status_ == UNUSED; } |
| 2394 | bool is_building() const { return status_ == BUILDING; } |
| 2395 | bool is_done() const { return status_ == DONE; } |
| 2396 | bool is_aborted() const { return status_ == ABORTED; } |
| 2397 | |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 2398 | void Abort(const char* reason); |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2399 | |
| 2400 | // Methods for getting operands for Use / Define / Temp. |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2401 | LUnallocated* ToUnallocated(Register reg); |
| 2402 | LUnallocated* ToUnallocated(DoubleRegister reg); |
| 2403 | |
| 2404 | // Methods for setting up define-use relationships. |
| 2405 | MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); |
| 2406 | MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); |
| 2407 | MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, |
| 2408 | DoubleRegister fixed_register); |
| 2409 | |
| 2410 | // A value that is guaranteed to be allocated to a register. |
| 2411 | // Operand created by UseRegister is guaranteed to be live until the end of |
| 2412 | // instruction. This means that register allocator will not reuse it's |
| 2413 | // register for any other operand inside instruction. |
| 2414 | // Operand created by UseRegisterAtStart is guaranteed to be live only at |
| 2415 | // instruction start. Register allocator is free to assign the same register |
| 2416 | // to some other operand used inside instruction (i.e. temporary or |
| 2417 | // output). |
| 2418 | MUST_USE_RESULT LOperand* UseRegister(HValue* value); |
| 2419 | MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value); |
| 2420 | |
| 2421 | // An input operand in a register that may be trashed. |
| 2422 | MUST_USE_RESULT LOperand* UseTempRegister(HValue* value); |
| 2423 | |
| 2424 | // An input operand in a register or stack slot. |
| 2425 | MUST_USE_RESULT LOperand* Use(HValue* value); |
| 2426 | MUST_USE_RESULT LOperand* UseAtStart(HValue* value); |
| 2427 | |
| 2428 | // An input operand in a register, stack slot or a constant operand. |
| 2429 | MUST_USE_RESULT LOperand* UseOrConstant(HValue* value); |
| 2430 | MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value); |
| 2431 | |
| 2432 | // An input operand in a register or a constant operand. |
| 2433 | MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value); |
| 2434 | MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value); |
| 2435 | |
| 2436 | // An input operand in register, stack slot or a constant operand. |
| 2437 | // Will not be moved to a register even if one is freely available. |
| 2438 | MUST_USE_RESULT LOperand* UseAny(HValue* value); |
| 2439 | |
| 2440 | // Temporary operand that must be in a register. |
| 2441 | MUST_USE_RESULT LUnallocated* TempRegister(); |
| 2442 | MUST_USE_RESULT LOperand* FixedTemp(Register reg); |
| 2443 | MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); |
| 2444 | |
| 2445 | // Methods for setting up define-use relationships. |
| 2446 | // Return the same instruction that they are passed. |
| 2447 | template<int I, int T> |
| 2448 | LInstruction* Define(LTemplateInstruction<1, I, T>* instr, |
| 2449 | LUnallocated* result); |
| 2450 | template<int I, int T> |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2451 | LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); |
| 2452 | template<int I, int T> |
| 2453 | LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, |
| 2454 | int index); |
| 2455 | template<int I, int T> |
| 2456 | LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); |
| 2457 | template<int I, int T> |
| 2458 | LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr, |
| 2459 | Register reg); |
| 2460 | template<int I, int T> |
| 2461 | LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr, |
| 2462 | DoubleRegister reg); |
| 2463 | LInstruction* AssignEnvironment(LInstruction* instr); |
| 2464 | LInstruction* AssignPointerMap(LInstruction* instr); |
| 2465 | |
| 2466 | enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2467 | |
| 2468 | // By default we assume that instruction sequences generated for calls |
| 2469 | // cannot deoptimize eagerly and we do not attach environment to this |
| 2470 | // instruction. |
| 2471 | LInstruction* MarkAsCall( |
| 2472 | LInstruction* instr, |
| 2473 | HInstruction* hinstr, |
| 2474 | CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2475 | |
| 2476 | LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env, |
| 2477 | int* argument_index_accumulator); |
| 2478 | |
| 2479 | void VisitInstruction(HInstruction* current); |
| 2480 | |
| 2481 | void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
| 2482 | LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2483 | LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2484 | LInstruction* DoArithmeticD(Token::Value op, |
| 2485 | HArithmeticBinaryOperation* instr); |
| 2486 | LInstruction* DoArithmeticT(Token::Value op, |
| 2487 | HArithmeticBinaryOperation* instr); |
| 2488 | |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2489 | LPlatformChunk* chunk_; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2490 | CompilationInfo* info_; |
| 2491 | HGraph* const graph_; |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2492 | Zone* zone_; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2493 | Status status_; |
| 2494 | HInstruction* current_instruction_; |
| 2495 | HBasicBlock* current_block_; |
| 2496 | HBasicBlock* next_block_; |
| 2497 | int argument_count_; |
| 2498 | LAllocator* allocator_; |
| 2499 | int position_; |
| 2500 | LInstruction* instruction_pending_deoptimization_environment_; |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 2501 | BailoutId pending_deoptimization_ast_id_; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2502 | |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2503 | DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2504 | }; |
| 2505 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2506 | #undef DECLARE_HYDROGEN_ACCESSOR |
| 2507 | #undef DECLARE_CONCRETE_INSTRUCTION |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2508 | |
| 2509 | } } // namespace v8::internal |
| 2510 | |
| 2511 | #endif // V8_MIPS_LITHIUM_MIPS_H_ |