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