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