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