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