erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_MIPS_LITHIUM_MIPS_H_ |
| 29 | #define V8_MIPS_LITHIUM_MIPS_H_ |
| 30 | |
| 31 | #include "hydrogen.h" |
| 32 | #include "lithium-allocator.h" |
| 33 | #include "lithium.h" |
| 34 | #include "safepoint-table.h" |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 35 | #include "utils.h" |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 36 | |
| 37 | namespace v8 { |
| 38 | namespace internal { |
| 39 | |
| 40 | // Forward declarations. |
| 41 | class LCodeGen; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 42 | |
| 43 | #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ |
| 44 | V(ControlInstruction) \ |
| 45 | V(Call) \ |
| 46 | LITHIUM_CONCRETE_INSTRUCTION_LIST(V) |
| 47 | |
| 48 | |
| 49 | #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
| 50 | V(AccessArgumentsAt) \ |
| 51 | V(AddI) \ |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 52 | V(AllocateObject) \ |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 53 | V(Allocate) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 54 | V(ApplyArguments) \ |
| 55 | V(ArgumentsElements) \ |
| 56 | V(ArgumentsLength) \ |
| 57 | V(ArithmeticD) \ |
| 58 | V(ArithmeticT) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 59 | V(BitI) \ |
| 60 | V(BitNotI) \ |
| 61 | V(BoundsCheck) \ |
| 62 | V(Branch) \ |
| 63 | V(CallConstantFunction) \ |
| 64 | V(CallFunction) \ |
| 65 | V(CallGlobal) \ |
| 66 | V(CallKeyed) \ |
| 67 | V(CallKnownGlobal) \ |
| 68 | V(CallNamed) \ |
| 69 | V(CallNew) \ |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 70 | V(CallNewArray) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 71 | V(CallRuntime) \ |
| 72 | V(CallStub) \ |
| 73 | V(CheckFunction) \ |
| 74 | V(CheckInstanceType) \ |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 75 | V(CheckMaps) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 76 | V(CheckNonSmi) \ |
| 77 | V(CheckPrototypeMaps) \ |
| 78 | V(CheckSmi) \ |
| 79 | V(ClampDToUint8) \ |
| 80 | V(ClampIToUint8) \ |
| 81 | V(ClampTToUint8) \ |
| 82 | V(ClassOfTestAndBranch) \ |
| 83 | V(CmpConstantEqAndBranch) \ |
| 84 | V(CmpIDAndBranch) \ |
| 85 | V(CmpObjectEqAndBranch) \ |
| 86 | V(CmpMapAndBranch) \ |
| 87 | V(CmpT) \ |
| 88 | V(ConstantD) \ |
| 89 | V(ConstantI) \ |
rossberg@chromium.org | b99c754 | 2013-05-31 11:40:45 +0000 | [diff] [blame^] | 90 | V(ConstantS) \ |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 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 | |
rossberg@chromium.org | b99c754 | 2013-05-31 11:40:45 +0000 | [diff] [blame^] | 1157 | class LConstantS: public LTemplateInstruction<1, 0, 0> { |
| 1158 | public: |
| 1159 | DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s") |
| 1160 | DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 1161 | |
| 1162 | Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); } |
| 1163 | }; |
| 1164 | |
| 1165 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1166 | class LConstantD: public LTemplateInstruction<1, 0, 0> { |
| 1167 | public: |
| 1168 | DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") |
| 1169 | DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 1170 | |
| 1171 | double value() const { return hydrogen()->DoubleValue(); } |
| 1172 | }; |
| 1173 | |
| 1174 | |
| 1175 | class LConstantT: public LTemplateInstruction<1, 0, 0> { |
| 1176 | public: |
| 1177 | DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") |
| 1178 | DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 1179 | |
| 1180 | Handle<Object> value() const { return hydrogen()->handle(); } |
| 1181 | }; |
| 1182 | |
| 1183 | |
| 1184 | class LBranch: public LControlInstruction<1, 0> { |
| 1185 | public: |
| 1186 | explicit LBranch(LOperand* value) { |
| 1187 | inputs_[0] = value; |
| 1188 | } |
| 1189 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1190 | LOperand* value() { return inputs_[0]; } |
| 1191 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1192 | DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
| 1193 | DECLARE_HYDROGEN_ACCESSOR(Branch) |
| 1194 | |
| 1195 | virtual void PrintDataTo(StringStream* stream); |
| 1196 | }; |
| 1197 | |
| 1198 | |
| 1199 | class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> { |
| 1200 | public: |
| 1201 | LCmpMapAndBranch(LOperand* value, LOperand* temp) { |
| 1202 | inputs_[0] = value; |
| 1203 | temps_[0] = temp; |
| 1204 | } |
| 1205 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1206 | LOperand* value() { return inputs_[0]; } |
| 1207 | LOperand* temp() { return temps_[0]; } |
| 1208 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1209 | DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
| 1210 | DECLARE_HYDROGEN_ACCESSOR(CompareMap) |
| 1211 | |
| 1212 | virtual bool IsControl() const { return true; } |
| 1213 | |
| 1214 | Handle<Map> map() const { return hydrogen()->map(); } |
| 1215 | int true_block_id() const { |
| 1216 | return hydrogen()->FirstSuccessor()->block_id(); |
| 1217 | } |
| 1218 | int false_block_id() const { |
| 1219 | return hydrogen()->SecondSuccessor()->block_id(); |
| 1220 | } |
| 1221 | }; |
| 1222 | |
| 1223 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1224 | class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { |
| 1225 | public: |
| 1226 | explicit LFixedArrayBaseLength(LOperand* value) { |
| 1227 | inputs_[0] = value; |
| 1228 | } |
| 1229 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1230 | LOperand* value() { return inputs_[0]; } |
| 1231 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1232 | DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength, |
| 1233 | "fixed-array-base-length") |
| 1234 | DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength) |
| 1235 | }; |
| 1236 | |
| 1237 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1238 | class LMapEnumLength: public LTemplateInstruction<1, 1, 0> { |
| 1239 | public: |
| 1240 | explicit LMapEnumLength(LOperand* value) { |
| 1241 | inputs_[0] = value; |
| 1242 | } |
| 1243 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1244 | LOperand* value() { return inputs_[0]; } |
| 1245 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1246 | DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length") |
| 1247 | }; |
| 1248 | |
| 1249 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1250 | class LElementsKind: public LTemplateInstruction<1, 1, 0> { |
| 1251 | public: |
| 1252 | explicit LElementsKind(LOperand* value) { |
| 1253 | inputs_[0] = value; |
| 1254 | } |
| 1255 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1256 | LOperand* value() { return inputs_[0]; } |
| 1257 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1258 | DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind") |
| 1259 | DECLARE_HYDROGEN_ACCESSOR(ElementsKind) |
| 1260 | }; |
| 1261 | |
| 1262 | |
| 1263 | class LValueOf: public LTemplateInstruction<1, 1, 1> { |
| 1264 | public: |
| 1265 | LValueOf(LOperand* value, LOperand* temp) { |
| 1266 | inputs_[0] = value; |
| 1267 | temps_[0] = temp; |
| 1268 | } |
| 1269 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1270 | LOperand* value() { return inputs_[0]; } |
| 1271 | LOperand* temp() { return temps_[0]; } |
| 1272 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1273 | DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of") |
| 1274 | DECLARE_HYDROGEN_ACCESSOR(ValueOf) |
| 1275 | }; |
| 1276 | |
| 1277 | |
yangguo@chromium.org | 154ff99 | 2012-03-13 08:09:54 +0000 | [diff] [blame] | 1278 | class LDateField: public LTemplateInstruction<1, 1, 1> { |
| 1279 | public: |
| 1280 | LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) { |
| 1281 | inputs_[0] = date; |
| 1282 | temps_[0] = temp; |
| 1283 | } |
| 1284 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1285 | LOperand* date() { return inputs_[0]; } |
| 1286 | LOperand* temp() { return temps_[0]; } |
| 1287 | Smi* index() const { return index_; } |
| 1288 | |
yangguo@chromium.org | 154ff99 | 2012-03-13 08:09:54 +0000 | [diff] [blame] | 1289 | DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field") |
| 1290 | DECLARE_HYDROGEN_ACCESSOR(ValueOf) |
yangguo@chromium.org | 154ff99 | 2012-03-13 08:09:54 +0000 | [diff] [blame] | 1291 | |
| 1292 | private: |
| 1293 | Smi* index_; |
| 1294 | }; |
| 1295 | |
| 1296 | |
yangguo@chromium.org | a6bbcc8 | 2012-12-21 12:35:02 +0000 | [diff] [blame] | 1297 | class LSeqStringSetChar: public LTemplateInstruction<1, 3, 0> { |
| 1298 | public: |
| 1299 | LSeqStringSetChar(String::Encoding encoding, |
| 1300 | LOperand* string, |
| 1301 | LOperand* index, |
| 1302 | LOperand* value) : encoding_(encoding) { |
| 1303 | inputs_[0] = string; |
| 1304 | inputs_[1] = index; |
| 1305 | inputs_[2] = value; |
| 1306 | } |
| 1307 | |
| 1308 | String::Encoding encoding() { return encoding_; } |
| 1309 | LOperand* string() { return inputs_[0]; } |
| 1310 | LOperand* index() { return inputs_[1]; } |
| 1311 | LOperand* value() { return inputs_[2]; } |
| 1312 | |
| 1313 | DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char") |
| 1314 | DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar) |
| 1315 | |
| 1316 | private: |
| 1317 | String::Encoding encoding_; |
| 1318 | }; |
| 1319 | |
| 1320 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1321 | class LThrow: public LTemplateInstruction<0, 1, 0> { |
| 1322 | public: |
| 1323 | explicit LThrow(LOperand* value) { |
| 1324 | inputs_[0] = value; |
| 1325 | } |
| 1326 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1327 | LOperand* value() { return inputs_[0]; } |
| 1328 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1329 | DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") |
| 1330 | }; |
| 1331 | |
| 1332 | |
| 1333 | class LBitNotI: public LTemplateInstruction<1, 1, 0> { |
| 1334 | public: |
| 1335 | explicit LBitNotI(LOperand* value) { |
| 1336 | inputs_[0] = value; |
| 1337 | } |
| 1338 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1339 | LOperand* value() { return inputs_[0]; } |
| 1340 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1341 | DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i") |
| 1342 | }; |
| 1343 | |
| 1344 | |
| 1345 | class LAddI: public LTemplateInstruction<1, 2, 0> { |
| 1346 | public: |
| 1347 | LAddI(LOperand* left, LOperand* right) { |
| 1348 | inputs_[0] = left; |
| 1349 | inputs_[1] = right; |
| 1350 | } |
| 1351 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1352 | LOperand* left() { return inputs_[0]; } |
| 1353 | LOperand* right() { return inputs_[1]; } |
| 1354 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1355 | DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i") |
| 1356 | DECLARE_HYDROGEN_ACCESSOR(Add) |
| 1357 | }; |
| 1358 | |
| 1359 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 1360 | class LMathMinMax: public LTemplateInstruction<1, 2, 0> { |
| 1361 | public: |
| 1362 | LMathMinMax(LOperand* left, LOperand* right) { |
| 1363 | inputs_[0] = left; |
| 1364 | inputs_[1] = right; |
| 1365 | } |
| 1366 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1367 | LOperand* left() { return inputs_[0]; } |
| 1368 | LOperand* right() { return inputs_[1]; } |
| 1369 | |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 1370 | DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max") |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 1371 | DECLARE_HYDROGEN_ACCESSOR(MathMinMax) |
| 1372 | }; |
| 1373 | |
| 1374 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1375 | class LPower: public LTemplateInstruction<1, 2, 0> { |
| 1376 | public: |
| 1377 | LPower(LOperand* left, LOperand* right) { |
| 1378 | inputs_[0] = left; |
| 1379 | inputs_[1] = right; |
| 1380 | } |
| 1381 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1382 | LOperand* left() { return inputs_[0]; } |
| 1383 | LOperand* right() { return inputs_[1]; } |
| 1384 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1385 | DECLARE_CONCRETE_INSTRUCTION(Power, "power") |
| 1386 | DECLARE_HYDROGEN_ACCESSOR(Power) |
| 1387 | }; |
| 1388 | |
| 1389 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 1390 | class LRandom: public LTemplateInstruction<1, 1, 0> { |
| 1391 | public: |
| 1392 | explicit LRandom(LOperand* global_object) { |
| 1393 | inputs_[0] = global_object; |
| 1394 | } |
| 1395 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1396 | LOperand* global_object() { return inputs_[0]; } |
| 1397 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 1398 | DECLARE_CONCRETE_INSTRUCTION(Random, "random") |
| 1399 | DECLARE_HYDROGEN_ACCESSOR(Random) |
| 1400 | }; |
| 1401 | |
| 1402 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1403 | class LArithmeticD: public LTemplateInstruction<1, 2, 0> { |
| 1404 | public: |
| 1405 | LArithmeticD(Token::Value op, LOperand* left, LOperand* right) |
| 1406 | : op_(op) { |
| 1407 | inputs_[0] = left; |
| 1408 | inputs_[1] = right; |
| 1409 | } |
| 1410 | |
| 1411 | Token::Value op() const { return op_; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1412 | LOperand* left() { return inputs_[0]; } |
| 1413 | LOperand* right() { return inputs_[1]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1414 | |
| 1415 | virtual Opcode opcode() const { return LInstruction::kArithmeticD; } |
| 1416 | virtual void CompileToNative(LCodeGen* generator); |
| 1417 | virtual const char* Mnemonic() const; |
| 1418 | |
| 1419 | private: |
| 1420 | Token::Value op_; |
| 1421 | }; |
| 1422 | |
| 1423 | |
| 1424 | class LArithmeticT: public LTemplateInstruction<1, 2, 0> { |
| 1425 | public: |
| 1426 | LArithmeticT(Token::Value op, LOperand* left, LOperand* right) |
| 1427 | : op_(op) { |
| 1428 | inputs_[0] = left; |
| 1429 | inputs_[1] = right; |
| 1430 | } |
| 1431 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1432 | LOperand* left() { return inputs_[0]; } |
| 1433 | LOperand* right() { return inputs_[1]; } |
| 1434 | Token::Value op() const { return op_; } |
| 1435 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1436 | virtual Opcode opcode() const { return LInstruction::kArithmeticT; } |
| 1437 | virtual void CompileToNative(LCodeGen* generator); |
| 1438 | virtual const char* Mnemonic() const; |
| 1439 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1440 | private: |
| 1441 | Token::Value op_; |
| 1442 | }; |
| 1443 | |
| 1444 | |
ulan@chromium.org | 6e196bf | 2013-03-13 09:38:22 +0000 | [diff] [blame] | 1445 | class LReturn: public LTemplateInstruction<0, 2, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1446 | public: |
ulan@chromium.org | 6e196bf | 2013-03-13 09:38:22 +0000 | [diff] [blame] | 1447 | explicit LReturn(LOperand* value, LOperand* parameter_count) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1448 | inputs_[0] = value; |
ulan@chromium.org | 6e196bf | 2013-03-13 09:38:22 +0000 | [diff] [blame] | 1449 | inputs_[1] = parameter_count; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1450 | } |
| 1451 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1452 | LOperand* value() { return inputs_[0]; } |
| 1453 | |
ulan@chromium.org | 6e196bf | 2013-03-13 09:38:22 +0000 | [diff] [blame] | 1454 | bool has_constant_parameter_count() { |
| 1455 | return parameter_count()->IsConstantOperand(); |
| 1456 | } |
| 1457 | LConstantOperand* constant_parameter_count() { |
| 1458 | ASSERT(has_constant_parameter_count()); |
| 1459 | return LConstantOperand::cast(parameter_count()); |
| 1460 | } |
| 1461 | LOperand* parameter_count() { return inputs_[1]; } |
| 1462 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1463 | DECLARE_CONCRETE_INSTRUCTION(Return, "return") |
| 1464 | }; |
| 1465 | |
| 1466 | |
| 1467 | class LLoadNamedField: public LTemplateInstruction<1, 1, 0> { |
| 1468 | public: |
| 1469 | explicit LLoadNamedField(LOperand* object) { |
| 1470 | inputs_[0] = object; |
| 1471 | } |
| 1472 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1473 | LOperand* object() { return inputs_[0]; } |
| 1474 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1475 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field") |
| 1476 | DECLARE_HYDROGEN_ACCESSOR(LoadNamedField) |
| 1477 | }; |
| 1478 | |
| 1479 | |
| 1480 | class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> { |
| 1481 | public: |
| 1482 | explicit LLoadNamedFieldPolymorphic(LOperand* object) { |
| 1483 | inputs_[0] = object; |
| 1484 | } |
| 1485 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1486 | LOperand* object() { return inputs_[0]; } |
| 1487 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1488 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic") |
| 1489 | DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1490 | }; |
| 1491 | |
| 1492 | |
| 1493 | class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> { |
| 1494 | public: |
| 1495 | explicit LLoadNamedGeneric(LOperand* object) { |
| 1496 | inputs_[0] = object; |
| 1497 | } |
| 1498 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1499 | LOperand* object() { return inputs_[0]; } |
| 1500 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1501 | DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic") |
| 1502 | DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric) |
| 1503 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1504 | Handle<Object> name() const { return hydrogen()->name(); } |
| 1505 | }; |
| 1506 | |
| 1507 | |
| 1508 | class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> { |
| 1509 | public: |
| 1510 | explicit LLoadFunctionPrototype(LOperand* function) { |
| 1511 | inputs_[0] = function; |
| 1512 | } |
| 1513 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1514 | LOperand* function() { return inputs_[0]; } |
| 1515 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1516 | DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype") |
| 1517 | DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1518 | }; |
| 1519 | |
| 1520 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1521 | class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> { |
| 1522 | public: |
| 1523 | explicit LLoadExternalArrayPointer(LOperand* object) { |
| 1524 | inputs_[0] = object; |
| 1525 | } |
| 1526 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1527 | LOperand* object() { return inputs_[0]; } |
| 1528 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1529 | DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer, |
| 1530 | "load-external-array-pointer") |
| 1531 | }; |
| 1532 | |
| 1533 | |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1534 | class LLoadKeyed: public LTemplateInstruction<1, 2, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1535 | public: |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1536 | LLoadKeyed(LOperand* elements, LOperand* key) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1537 | inputs_[0] = elements; |
| 1538 | inputs_[1] = key; |
| 1539 | } |
| 1540 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1541 | LOperand* elements() { return inputs_[0]; } |
| 1542 | LOperand* key() { return inputs_[1]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1543 | ElementsKind elements_kind() const { |
| 1544 | return hydrogen()->elements_kind(); |
| 1545 | } |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 1546 | bool is_external() const { |
| 1547 | return hydrogen()->is_external(); |
| 1548 | } |
| 1549 | |
| 1550 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed") |
| 1551 | DECLARE_HYDROGEN_ACCESSOR(LoadKeyed) |
| 1552 | |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 1553 | virtual void PrintDataTo(StringStream* stream); |
jkummerow@chromium.org | 777db6f | 2012-05-24 09:33:09 +0000 | [diff] [blame] | 1554 | uint32_t additional_index() const { return hydrogen()->index_offset(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1555 | }; |
| 1556 | |
| 1557 | |
| 1558 | class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> { |
| 1559 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1560 | LLoadKeyedGeneric(LOperand* object, LOperand* key) { |
| 1561 | inputs_[0] = object; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1562 | inputs_[1] = key; |
| 1563 | } |
| 1564 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1565 | LOperand* object() { return inputs_[0]; } |
| 1566 | LOperand* key() { return inputs_[1]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1567 | |
| 1568 | DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1569 | }; |
| 1570 | |
| 1571 | |
| 1572 | class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> { |
| 1573 | public: |
| 1574 | DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell") |
| 1575 | DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell) |
| 1576 | }; |
| 1577 | |
| 1578 | |
| 1579 | class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> { |
| 1580 | public: |
| 1581 | explicit LLoadGlobalGeneric(LOperand* global_object) { |
| 1582 | inputs_[0] = global_object; |
| 1583 | } |
| 1584 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1585 | LOperand* global_object() { return inputs_[0]; } |
| 1586 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1587 | DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic") |
| 1588 | DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric) |
| 1589 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1590 | Handle<Object> name() const { return hydrogen()->name(); } |
| 1591 | bool for_typeof() const { return hydrogen()->for_typeof(); } |
| 1592 | }; |
| 1593 | |
| 1594 | |
| 1595 | class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> { |
| 1596 | public: |
| 1597 | LStoreGlobalCell(LOperand* value, LOperand* temp) { |
| 1598 | inputs_[0] = value; |
| 1599 | temps_[0] = temp; |
| 1600 | } |
| 1601 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1602 | LOperand* value() { return inputs_[0]; } |
| 1603 | LOperand* temp() { return temps_[0]; } |
| 1604 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1605 | DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell") |
| 1606 | DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell) |
| 1607 | }; |
| 1608 | |
| 1609 | |
| 1610 | class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> { |
| 1611 | public: |
| 1612 | explicit LStoreGlobalGeneric(LOperand* global_object, |
| 1613 | LOperand* value) { |
| 1614 | inputs_[0] = global_object; |
| 1615 | inputs_[1] = value; |
| 1616 | } |
| 1617 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1618 | LOperand* global_object() { return inputs_[0]; } |
| 1619 | LOperand* value() { return inputs_[1]; } |
| 1620 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1621 | DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic") |
| 1622 | DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric) |
| 1623 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1624 | Handle<Object> name() const { return hydrogen()->name(); } |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 1625 | StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1626 | }; |
| 1627 | |
| 1628 | |
| 1629 | class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> { |
| 1630 | public: |
| 1631 | explicit LLoadContextSlot(LOperand* context) { |
| 1632 | inputs_[0] = context; |
| 1633 | } |
| 1634 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1635 | LOperand* context() { return inputs_[0]; } |
| 1636 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1637 | DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") |
| 1638 | DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) |
| 1639 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1640 | int slot_index() { return hydrogen()->slot_index(); } |
| 1641 | |
| 1642 | virtual void PrintDataTo(StringStream* stream); |
| 1643 | }; |
| 1644 | |
| 1645 | |
| 1646 | class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> { |
| 1647 | public: |
| 1648 | LStoreContextSlot(LOperand* context, LOperand* value) { |
| 1649 | inputs_[0] = context; |
| 1650 | inputs_[1] = value; |
| 1651 | } |
| 1652 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1653 | LOperand* context() { return inputs_[0]; } |
| 1654 | LOperand* value() { return inputs_[1]; } |
| 1655 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1656 | DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot") |
| 1657 | DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot) |
| 1658 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1659 | int slot_index() { return hydrogen()->slot_index(); } |
| 1660 | |
| 1661 | virtual void PrintDataTo(StringStream* stream); |
| 1662 | }; |
| 1663 | |
| 1664 | |
| 1665 | class LPushArgument: public LTemplateInstruction<0, 1, 0> { |
| 1666 | public: |
| 1667 | explicit LPushArgument(LOperand* value) { |
| 1668 | inputs_[0] = value; |
| 1669 | } |
| 1670 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1671 | LOperand* value() { return inputs_[0]; } |
| 1672 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1673 | DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") |
| 1674 | }; |
| 1675 | |
| 1676 | |
jkummerow@chromium.org | 28faa98 | 2012-04-13 09:58:30 +0000 | [diff] [blame] | 1677 | class LDrop: public LTemplateInstruction<0, 0, 0> { |
| 1678 | public: |
| 1679 | explicit LDrop(int count) : count_(count) { } |
| 1680 | |
| 1681 | int count() const { return count_; } |
| 1682 | |
| 1683 | DECLARE_CONCRETE_INSTRUCTION(Drop, "drop") |
| 1684 | |
| 1685 | private: |
| 1686 | int count_; |
| 1687 | }; |
| 1688 | |
| 1689 | |
jkummerow@chromium.org | 4c54a2a | 2013-03-19 17:51:30 +0000 | [diff] [blame] | 1690 | class LInnerAllocatedObject: public LTemplateInstruction<1, 1, 0> { |
| 1691 | public: |
| 1692 | explicit LInnerAllocatedObject(LOperand* base_object) { |
| 1693 | inputs_[0] = base_object; |
| 1694 | } |
| 1695 | |
| 1696 | LOperand* base_object() { return inputs_[0]; } |
| 1697 | int offset() { return hydrogen()->offset(); } |
| 1698 | |
| 1699 | virtual void PrintDataTo(StringStream* stream); |
| 1700 | |
| 1701 | DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "sub-allocated-object") |
| 1702 | DECLARE_HYDROGEN_ACCESSOR(InnerAllocatedObject) |
| 1703 | }; |
| 1704 | |
| 1705 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1706 | class LThisFunction: public LTemplateInstruction<1, 0, 0> { |
| 1707 | public: |
| 1708 | DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function") |
| 1709 | DECLARE_HYDROGEN_ACCESSOR(ThisFunction) |
| 1710 | }; |
| 1711 | |
| 1712 | |
| 1713 | class LContext: public LTemplateInstruction<1, 0, 0> { |
| 1714 | public: |
| 1715 | DECLARE_CONCRETE_INSTRUCTION(Context, "context") |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 1716 | DECLARE_HYDROGEN_ACCESSOR(Context) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1717 | }; |
| 1718 | |
| 1719 | |
| 1720 | class LOuterContext: public LTemplateInstruction<1, 1, 0> { |
| 1721 | public: |
| 1722 | explicit LOuterContext(LOperand* context) { |
| 1723 | inputs_[0] = context; |
| 1724 | } |
| 1725 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1726 | LOperand* context() { return inputs_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1727 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1728 | DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1729 | }; |
| 1730 | |
| 1731 | |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 1732 | class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> { |
| 1733 | public: |
| 1734 | DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals") |
| 1735 | DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals) |
| 1736 | }; |
| 1737 | |
| 1738 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1739 | class LGlobalObject: public LTemplateInstruction<1, 1, 0> { |
| 1740 | public: |
| 1741 | explicit LGlobalObject(LOperand* context) { |
| 1742 | inputs_[0] = context; |
| 1743 | } |
| 1744 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1745 | LOperand* context() { return inputs_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1746 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1747 | DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1748 | }; |
| 1749 | |
| 1750 | |
| 1751 | class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> { |
| 1752 | public: |
| 1753 | explicit LGlobalReceiver(LOperand* global_object) { |
| 1754 | inputs_[0] = global_object; |
| 1755 | } |
| 1756 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1757 | LOperand* global_object() { return inputs_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1758 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1759 | DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1760 | }; |
| 1761 | |
| 1762 | |
| 1763 | class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> { |
| 1764 | public: |
| 1765 | DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") |
| 1766 | DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) |
| 1767 | |
| 1768 | virtual void PrintDataTo(StringStream* stream); |
| 1769 | |
| 1770 | Handle<JSFunction> function() { return hydrogen()->function(); } |
| 1771 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1772 | }; |
| 1773 | |
| 1774 | |
| 1775 | class LInvokeFunction: public LTemplateInstruction<1, 1, 0> { |
| 1776 | public: |
| 1777 | explicit LInvokeFunction(LOperand* function) { |
| 1778 | inputs_[0] = function; |
| 1779 | } |
| 1780 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1781 | LOperand* function() { return inputs_[0]; } |
| 1782 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1783 | DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") |
| 1784 | DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) |
| 1785 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1786 | virtual void PrintDataTo(StringStream* stream); |
| 1787 | |
| 1788 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1789 | }; |
| 1790 | |
| 1791 | |
| 1792 | class LCallKeyed: public LTemplateInstruction<1, 1, 0> { |
| 1793 | public: |
| 1794 | explicit LCallKeyed(LOperand* key) { |
| 1795 | inputs_[0] = key; |
| 1796 | } |
| 1797 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1798 | LOperand* key() { return inputs_[0]; } |
| 1799 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1800 | DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") |
| 1801 | DECLARE_HYDROGEN_ACCESSOR(CallKeyed) |
| 1802 | |
| 1803 | virtual void PrintDataTo(StringStream* stream); |
| 1804 | |
| 1805 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1806 | }; |
| 1807 | |
| 1808 | |
| 1809 | |
| 1810 | class LCallNamed: public LTemplateInstruction<1, 0, 0> { |
| 1811 | public: |
| 1812 | DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") |
| 1813 | DECLARE_HYDROGEN_ACCESSOR(CallNamed) |
| 1814 | |
| 1815 | virtual void PrintDataTo(StringStream* stream); |
| 1816 | |
| 1817 | Handle<String> name() const { return hydrogen()->name(); } |
| 1818 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1819 | }; |
| 1820 | |
| 1821 | |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1822 | class LCallFunction: public LTemplateInstruction<1, 1, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1823 | public: |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1824 | explicit LCallFunction(LOperand* function) { |
| 1825 | inputs_[0] = function; |
| 1826 | } |
| 1827 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1828 | LOperand* function() { return inputs_[0]; } |
| 1829 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1830 | DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") |
| 1831 | DECLARE_HYDROGEN_ACCESSOR(CallFunction) |
| 1832 | |
danno@chromium.org | c612e02 | 2011-11-10 11:38:15 +0000 | [diff] [blame] | 1833 | int arity() const { return hydrogen()->argument_count() - 1; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1834 | }; |
| 1835 | |
| 1836 | |
| 1837 | class LCallGlobal: public LTemplateInstruction<1, 0, 0> { |
| 1838 | public: |
| 1839 | DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") |
| 1840 | DECLARE_HYDROGEN_ACCESSOR(CallGlobal) |
| 1841 | |
| 1842 | virtual void PrintDataTo(StringStream* stream); |
| 1843 | |
| 1844 | Handle<String> name() const {return hydrogen()->name(); } |
| 1845 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1846 | }; |
| 1847 | |
| 1848 | |
| 1849 | class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> { |
| 1850 | public: |
| 1851 | DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") |
| 1852 | DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) |
| 1853 | |
| 1854 | virtual void PrintDataTo(StringStream* stream); |
| 1855 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1856 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1857 | }; |
| 1858 | |
| 1859 | |
| 1860 | class LCallNew: public LTemplateInstruction<1, 1, 0> { |
| 1861 | public: |
| 1862 | explicit LCallNew(LOperand* constructor) { |
| 1863 | inputs_[0] = constructor; |
| 1864 | } |
| 1865 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1866 | LOperand* constructor() { return inputs_[0]; } |
| 1867 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1868 | DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") |
| 1869 | DECLARE_HYDROGEN_ACCESSOR(CallNew) |
| 1870 | |
| 1871 | virtual void PrintDataTo(StringStream* stream); |
| 1872 | |
| 1873 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1874 | }; |
| 1875 | |
| 1876 | |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 1877 | class LCallNewArray: public LTemplateInstruction<1, 1, 0> { |
| 1878 | public: |
| 1879 | explicit LCallNewArray(LOperand* constructor) { |
| 1880 | inputs_[0] = constructor; |
| 1881 | } |
| 1882 | |
| 1883 | LOperand* constructor() { return inputs_[0]; } |
| 1884 | |
| 1885 | DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array") |
| 1886 | DECLARE_HYDROGEN_ACCESSOR(CallNewArray) |
| 1887 | |
| 1888 | virtual void PrintDataTo(StringStream* stream); |
| 1889 | |
| 1890 | int arity() const { return hydrogen()->argument_count() - 1; } |
| 1891 | }; |
| 1892 | |
| 1893 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1894 | class LCallRuntime: public LTemplateInstruction<1, 0, 0> { |
| 1895 | public: |
| 1896 | DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime") |
| 1897 | DECLARE_HYDROGEN_ACCESSOR(CallRuntime) |
| 1898 | |
| 1899 | const Runtime::Function* function() const { return hydrogen()->function(); } |
| 1900 | int arity() const { return hydrogen()->argument_count(); } |
| 1901 | }; |
| 1902 | |
| 1903 | |
| 1904 | class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> { |
| 1905 | public: |
| 1906 | explicit LInteger32ToDouble(LOperand* value) { |
| 1907 | inputs_[0] = value; |
| 1908 | } |
| 1909 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1910 | LOperand* value() { return inputs_[0]; } |
| 1911 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1912 | DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double") |
| 1913 | }; |
| 1914 | |
| 1915 | |
svenpanne@chromium.org | a53e8e0 | 2013-05-24 12:35:50 +0000 | [diff] [blame] | 1916 | class LInteger32ToSmi: public LTemplateInstruction<1, 1, 0> { |
| 1917 | public: |
| 1918 | explicit LInteger32ToSmi(LOperand* value) { |
| 1919 | inputs_[0] = value; |
| 1920 | } |
| 1921 | |
| 1922 | LOperand* value() { return inputs_[0]; } |
| 1923 | |
| 1924 | DECLARE_CONCRETE_INSTRUCTION(Integer32ToSmi, "int32-to-smi") |
| 1925 | DECLARE_HYDROGEN_ACCESSOR(Change) |
| 1926 | }; |
| 1927 | |
| 1928 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1929 | class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> { |
| 1930 | public: |
| 1931 | explicit LUint32ToDouble(LOperand* value) { |
| 1932 | inputs_[0] = value; |
| 1933 | } |
| 1934 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1935 | LOperand* value() { return inputs_[0]; } |
| 1936 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1937 | DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") |
| 1938 | }; |
| 1939 | |
| 1940 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1941 | class LNumberTagI: public LTemplateInstruction<1, 1, 0> { |
| 1942 | public: |
| 1943 | explicit LNumberTagI(LOperand* value) { |
| 1944 | inputs_[0] = value; |
| 1945 | } |
| 1946 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1947 | LOperand* value() { return inputs_[0]; } |
| 1948 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1949 | DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") |
| 1950 | }; |
| 1951 | |
| 1952 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1953 | class LNumberTagU: public LTemplateInstruction<1, 1, 0> { |
| 1954 | public: |
| 1955 | explicit LNumberTagU(LOperand* value) { |
| 1956 | inputs_[0] = value; |
| 1957 | } |
| 1958 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1959 | LOperand* value() { return inputs_[0]; } |
| 1960 | |
jkummerow@chromium.org | 78502a9 | 2012-09-06 13:50:42 +0000 | [diff] [blame] | 1961 | DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u") |
| 1962 | }; |
| 1963 | |
| 1964 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1965 | class LNumberTagD: public LTemplateInstruction<1, 1, 2> { |
| 1966 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1967 | LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1968 | inputs_[0] = value; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1969 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1970 | temps_[1] = temp2; |
| 1971 | } |
| 1972 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 1973 | LOperand* value() { return inputs_[0]; } |
| 1974 | LOperand* temp() { return temps_[0]; } |
| 1975 | LOperand* temp2() { return temps_[1]; } |
| 1976 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1977 | DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d") |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 1978 | DECLARE_HYDROGEN_ACCESSOR(Change) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 1979 | }; |
| 1980 | |
| 1981 | |
svenpanne@chromium.org | a53e8e0 | 2013-05-24 12:35:50 +0000 | [diff] [blame] | 1982 | class LDoubleToSmi: public LTemplateInstruction<1, 1, 2> { |
| 1983 | public: |
| 1984 | LDoubleToSmi(LOperand* value, LOperand* temp, LOperand* temp2) { |
| 1985 | inputs_[0] = value; |
| 1986 | temps_[0] = temp; |
| 1987 | temps_[1] = temp2; |
| 1988 | } |
| 1989 | |
| 1990 | LOperand* value() { return inputs_[0]; } |
| 1991 | LOperand* temp() { return temps_[0]; } |
| 1992 | LOperand* temp2() { return temps_[1]; } |
| 1993 | |
| 1994 | DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi") |
| 1995 | DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) |
| 1996 | |
| 1997 | bool truncating() { return hydrogen()->CanTruncateToInt32(); } |
| 1998 | }; |
| 1999 | |
| 2000 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2001 | // Sometimes truncating conversion from a tagged value to an int32. |
| 2002 | class LDoubleToI: public LTemplateInstruction<1, 1, 2> { |
| 2003 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2004 | LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2005 | inputs_[0] = value; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2006 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2007 | temps_[1] = temp2; |
| 2008 | } |
| 2009 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2010 | LOperand* value() { return inputs_[0]; } |
| 2011 | LOperand* temp() { return temps_[0]; } |
| 2012 | LOperand* temp2() { return temps_[1]; } |
| 2013 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2014 | DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i") |
| 2015 | DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) |
| 2016 | |
| 2017 | bool truncating() { return hydrogen()->CanTruncateToInt32(); } |
| 2018 | }; |
| 2019 | |
| 2020 | |
| 2021 | // Truncating conversion from a tagged value to an int32. |
| 2022 | class LTaggedToI: public LTemplateInstruction<1, 1, 3> { |
| 2023 | public: |
| 2024 | LTaggedToI(LOperand* value, |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2025 | LOperand* temp, |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2026 | LOperand* temp2, |
| 2027 | LOperand* temp3) { |
| 2028 | inputs_[0] = value; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2029 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2030 | temps_[1] = temp2; |
| 2031 | temps_[2] = temp3; |
| 2032 | } |
| 2033 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2034 | LOperand* value() { return inputs_[0]; } |
| 2035 | LOperand* temp() { return temps_[0]; } |
| 2036 | LOperand* temp2() { return temps_[1]; } |
| 2037 | LOperand* temp3() { return temps_[2]; } |
| 2038 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2039 | DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i") |
| 2040 | DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) |
| 2041 | |
| 2042 | bool truncating() { return hydrogen()->CanTruncateToInt32(); } |
| 2043 | }; |
| 2044 | |
| 2045 | |
| 2046 | class LSmiTag: public LTemplateInstruction<1, 1, 0> { |
| 2047 | public: |
| 2048 | explicit LSmiTag(LOperand* value) { |
| 2049 | inputs_[0] = value; |
| 2050 | } |
| 2051 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2052 | LOperand* value() { return inputs_[0]; } |
| 2053 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2054 | DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag") |
| 2055 | }; |
| 2056 | |
| 2057 | |
| 2058 | class LNumberUntagD: public LTemplateInstruction<1, 1, 0> { |
| 2059 | public: |
| 2060 | explicit LNumberUntagD(LOperand* value) { |
| 2061 | inputs_[0] = value; |
| 2062 | } |
| 2063 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2064 | LOperand* value() { return inputs_[0]; } |
| 2065 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2066 | DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") |
| 2067 | DECLARE_HYDROGEN_ACCESSOR(Change) |
| 2068 | }; |
| 2069 | |
| 2070 | |
| 2071 | class LSmiUntag: public LTemplateInstruction<1, 1, 0> { |
| 2072 | public: |
| 2073 | LSmiUntag(LOperand* value, bool needs_check) |
| 2074 | : needs_check_(needs_check) { |
| 2075 | inputs_[0] = value; |
| 2076 | } |
| 2077 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2078 | LOperand* value() { return inputs_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2079 | bool needs_check() const { return needs_check_; } |
| 2080 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2081 | DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") |
| 2082 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2083 | private: |
| 2084 | bool needs_check_; |
| 2085 | }; |
| 2086 | |
| 2087 | |
verwaest@chromium.org | 3714139 | 2012-05-31 13:27:02 +0000 | [diff] [blame] | 2088 | class LStoreNamedField: public LTemplateInstruction<0, 2, 1> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2089 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2090 | LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) { |
| 2091 | inputs_[0] = object; |
| 2092 | inputs_[1] = value; |
verwaest@chromium.org | 3714139 | 2012-05-31 13:27:02 +0000 | [diff] [blame] | 2093 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2094 | } |
| 2095 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2096 | LOperand* object() { return inputs_[0]; } |
| 2097 | LOperand* value() { return inputs_[1]; } |
| 2098 | LOperand* temp() { return temps_[0]; } |
| 2099 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2100 | DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field") |
| 2101 | DECLARE_HYDROGEN_ACCESSOR(StoreNamedField) |
| 2102 | |
| 2103 | virtual void PrintDataTo(StringStream* stream); |
| 2104 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2105 | Handle<Map> transition() const { return hydrogen()->transition(); } |
danno@chromium.org | f005df6 | 2013-04-30 16:36:45 +0000 | [diff] [blame] | 2106 | Representation representation() const { |
| 2107 | return hydrogen()->field_representation(); |
| 2108 | } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2109 | }; |
| 2110 | |
| 2111 | |
| 2112 | class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> { |
| 2113 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2114 | LStoreNamedGeneric(LOperand* object, LOperand* value) { |
| 2115 | inputs_[0] = object; |
| 2116 | inputs_[1] = value; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2117 | } |
| 2118 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2119 | LOperand* object() { return inputs_[0]; } |
| 2120 | LOperand* value() { return inputs_[1]; } |
| 2121 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2122 | DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") |
| 2123 | DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) |
| 2124 | |
| 2125 | virtual void PrintDataTo(StringStream* stream); |
| 2126 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2127 | Handle<Object> name() const { return hydrogen()->name(); } |
| 2128 | StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2129 | }; |
| 2130 | |
| 2131 | |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 2132 | class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2133 | public: |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 2134 | LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) { |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2135 | inputs_[0] = object; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2136 | inputs_[1] = key; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2137 | inputs_[2] = value; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2138 | } |
| 2139 | |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 2140 | bool is_external() const { return hydrogen()->is_external(); } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2141 | LOperand* elements() { return inputs_[0]; } |
| 2142 | LOperand* key() { return inputs_[1]; } |
| 2143 | LOperand* value() { return inputs_[2]; } |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 2144 | ElementsKind elements_kind() const { |
| 2145 | return hydrogen()->elements_kind(); |
| 2146 | } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2147 | |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 2148 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed") |
| 2149 | DECLARE_HYDROGEN_ACCESSOR(StoreKeyed) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2150 | |
| 2151 | virtual void PrintDataTo(StringStream* stream); |
svenpanne@chromium.org | fb04633 | 2012-04-19 12:02:44 +0000 | [diff] [blame] | 2152 | bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); } |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 2153 | uint32_t additional_index() const { return hydrogen()->index_offset(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2154 | }; |
| 2155 | |
| 2156 | |
| 2157 | class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> { |
| 2158 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2159 | LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2160 | inputs_[0] = obj; |
| 2161 | inputs_[1] = key; |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2162 | inputs_[2] = value; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2163 | } |
| 2164 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2165 | LOperand* object() { return inputs_[0]; } |
| 2166 | LOperand* key() { return inputs_[1]; } |
| 2167 | LOperand* value() { return inputs_[2]; } |
| 2168 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2169 | DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") |
| 2170 | DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric) |
| 2171 | |
| 2172 | virtual void PrintDataTo(StringStream* stream); |
| 2173 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 2174 | StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2175 | }; |
| 2176 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2177 | |
mstarzinger@chromium.org | f705b50 | 2013-04-04 11:38:09 +0000 | [diff] [blame] | 2178 | class LTransitionElementsKind: public LTemplateInstruction<0, 1, 2> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2179 | public: |
| 2180 | LTransitionElementsKind(LOperand* object, |
| 2181 | LOperand* new_map_temp, |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 2182 | LOperand* fixed_object_temp) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2183 | inputs_[0] = object; |
| 2184 | temps_[0] = new_map_temp; |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 2185 | temps_[1] = fixed_object_temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2186 | } |
| 2187 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2188 | LOperand* object() { return inputs_[0]; } |
| 2189 | LOperand* new_map_temp() { return temps_[0]; } |
| 2190 | LOperand* temp() { return temps_[1]; } |
| 2191 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2192 | DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind, |
| 2193 | "transition-elements-kind") |
| 2194 | DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind) |
| 2195 | |
| 2196 | virtual void PrintDataTo(StringStream* stream); |
| 2197 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2198 | Handle<Map> original_map() { return hydrogen()->original_map(); } |
| 2199 | Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); } |
yangguo@chromium.org | 003650e | 2013-01-24 16:31:08 +0000 | [diff] [blame] | 2200 | ElementsKind from_kind() { return hydrogen()->from_kind(); } |
| 2201 | ElementsKind to_kind() { return hydrogen()->to_kind(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2202 | }; |
| 2203 | |
| 2204 | |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 2205 | class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> { |
| 2206 | public: |
| 2207 | LTrapAllocationMemento(LOperand* object, |
| 2208 | LOperand* temp) { |
| 2209 | inputs_[0] = object; |
| 2210 | temps_[0] = temp; |
| 2211 | } |
| 2212 | |
| 2213 | LOperand* object() { return inputs_[0]; } |
| 2214 | LOperand* temp() { return temps_[0]; } |
| 2215 | |
| 2216 | DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento, |
| 2217 | "trap-allocation-memento") |
| 2218 | }; |
| 2219 | |
| 2220 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2221 | class LStringAdd: public LTemplateInstruction<1, 2, 0> { |
| 2222 | public: |
| 2223 | LStringAdd(LOperand* left, LOperand* right) { |
| 2224 | inputs_[0] = left; |
| 2225 | inputs_[1] = right; |
| 2226 | } |
| 2227 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2228 | LOperand* left() { return inputs_[0]; } |
| 2229 | LOperand* right() { return inputs_[1]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2230 | |
| 2231 | DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add") |
| 2232 | DECLARE_HYDROGEN_ACCESSOR(StringAdd) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2233 | }; |
| 2234 | |
| 2235 | |
| 2236 | |
| 2237 | class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> { |
| 2238 | public: |
| 2239 | LStringCharCodeAt(LOperand* string, LOperand* index) { |
| 2240 | inputs_[0] = string; |
| 2241 | inputs_[1] = index; |
| 2242 | } |
| 2243 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2244 | LOperand* string() { return inputs_[0]; } |
| 2245 | LOperand* index() { return inputs_[1]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2246 | |
| 2247 | DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at") |
| 2248 | DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2249 | }; |
| 2250 | |
| 2251 | |
| 2252 | class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> { |
| 2253 | public: |
| 2254 | explicit LStringCharFromCode(LOperand* char_code) { |
| 2255 | inputs_[0] = char_code; |
| 2256 | } |
| 2257 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2258 | LOperand* char_code() { return inputs_[0]; } |
| 2259 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2260 | DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code") |
| 2261 | DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2262 | }; |
| 2263 | |
| 2264 | |
| 2265 | class LStringLength: public LTemplateInstruction<1, 1, 0> { |
| 2266 | public: |
| 2267 | explicit LStringLength(LOperand* string) { |
| 2268 | inputs_[0] = string; |
| 2269 | } |
| 2270 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2271 | LOperand* string() { return inputs_[0]; } |
| 2272 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2273 | DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length") |
| 2274 | DECLARE_HYDROGEN_ACCESSOR(StringLength) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2275 | }; |
| 2276 | |
| 2277 | |
| 2278 | class LCheckFunction: public LTemplateInstruction<0, 1, 0> { |
| 2279 | public: |
| 2280 | explicit LCheckFunction(LOperand* value) { |
| 2281 | inputs_[0] = value; |
| 2282 | } |
| 2283 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2284 | LOperand* value() { return inputs_[0]; } |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 2285 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2286 | DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") |
| 2287 | DECLARE_HYDROGEN_ACCESSOR(CheckFunction) |
| 2288 | }; |
| 2289 | |
| 2290 | |
| 2291 | class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> { |
| 2292 | public: |
| 2293 | explicit LCheckInstanceType(LOperand* value) { |
| 2294 | inputs_[0] = value; |
| 2295 | } |
| 2296 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2297 | LOperand* value() { return inputs_[0]; } |
| 2298 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2299 | DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") |
| 2300 | DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) |
| 2301 | }; |
| 2302 | |
| 2303 | |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 2304 | class LCheckMaps: public LTemplateInstruction<0, 1, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2305 | public: |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 2306 | explicit LCheckMaps(LOperand* value) { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2307 | inputs_[0] = value; |
| 2308 | } |
| 2309 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2310 | LOperand* value() { return inputs_[0]; } |
| 2311 | |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 2312 | DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps") |
| 2313 | DECLARE_HYDROGEN_ACCESSOR(CheckMaps) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2314 | }; |
| 2315 | |
| 2316 | |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 2317 | class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2318 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2319 | LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) { |
| 2320 | temps_[0] = temp; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2321 | temps_[1] = temp2; |
| 2322 | } |
| 2323 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2324 | LOperand* temp() { return temps_[0]; } |
| 2325 | LOperand* temp2() { return temps_[1]; } |
| 2326 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2327 | DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps") |
| 2328 | DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps) |
| 2329 | |
yangguo@chromium.org | 003650e | 2013-01-24 16:31:08 +0000 | [diff] [blame] | 2330 | ZoneList<Handle<JSObject> >* prototypes() const { |
| 2331 | return hydrogen()->prototypes(); |
| 2332 | } |
| 2333 | ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2334 | }; |
| 2335 | |
| 2336 | |
jkummerow@chromium.org | c118402 | 2013-05-28 16:58:15 +0000 | [diff] [blame] | 2337 | class LCheckSmi: public LTemplateInstruction<1, 1, 0> { |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2338 | public: |
| 2339 | explicit LCheckSmi(LOperand* value) { |
| 2340 | inputs_[0] = value; |
| 2341 | } |
| 2342 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2343 | LOperand* value() { return inputs_[0]; } |
| 2344 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2345 | DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi") |
| 2346 | }; |
| 2347 | |
| 2348 | |
| 2349 | class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> { |
| 2350 | public: |
| 2351 | explicit LCheckNonSmi(LOperand* value) { |
| 2352 | inputs_[0] = value; |
| 2353 | } |
| 2354 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2355 | LOperand* value() { return inputs_[0]; } |
| 2356 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2357 | DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") |
| 2358 | }; |
| 2359 | |
| 2360 | |
| 2361 | class LClampDToUint8: public LTemplateInstruction<1, 1, 1> { |
| 2362 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2363 | LClampDToUint8(LOperand* unclamped, LOperand* temp) { |
| 2364 | inputs_[0] = unclamped; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2365 | temps_[0] = temp; |
| 2366 | } |
| 2367 | |
| 2368 | LOperand* unclamped() { return inputs_[0]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2369 | LOperand* temp() { return temps_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2370 | |
| 2371 | DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8") |
| 2372 | }; |
| 2373 | |
| 2374 | |
| 2375 | class LClampIToUint8: public LTemplateInstruction<1, 1, 0> { |
| 2376 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2377 | explicit LClampIToUint8(LOperand* unclamped) { |
| 2378 | inputs_[0] = unclamped; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2379 | } |
| 2380 | |
| 2381 | LOperand* unclamped() { return inputs_[0]; } |
| 2382 | |
| 2383 | DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8") |
| 2384 | }; |
| 2385 | |
| 2386 | |
| 2387 | class LClampTToUint8: public LTemplateInstruction<1, 1, 1> { |
| 2388 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2389 | LClampTToUint8(LOperand* unclamped, LOperand* temp) { |
| 2390 | inputs_[0] = unclamped; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2391 | temps_[0] = temp; |
| 2392 | } |
| 2393 | |
| 2394 | LOperand* unclamped() { return inputs_[0]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2395 | LOperand* temp() { return temps_[0]; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2396 | |
| 2397 | DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8") |
| 2398 | }; |
| 2399 | |
| 2400 | |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 2401 | class LAllocateObject: public LTemplateInstruction<1, 1, 2> { |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 2402 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2403 | LAllocateObject(LOperand* temp, LOperand* temp2) { |
| 2404 | temps_[0] = temp; |
fschneider@chromium.org | 35814e5 | 2012-03-01 15:43:35 +0000 | [diff] [blame] | 2405 | temps_[1] = temp2; |
| 2406 | } |
| 2407 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2408 | LOperand* temp() { return temps_[0]; } |
| 2409 | LOperand* temp2() { return temps_[1]; } |
| 2410 | |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 2411 | DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object") |
| 2412 | DECLARE_HYDROGEN_ACCESSOR(AllocateObject) |
| 2413 | }; |
| 2414 | |
| 2415 | |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 2416 | class LAllocate: public LTemplateInstruction<1, 2, 2> { |
| 2417 | public: |
| 2418 | LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) { |
| 2419 | inputs_[1] = size; |
| 2420 | temps_[0] = temp1; |
| 2421 | temps_[1] = temp2; |
| 2422 | } |
| 2423 | |
| 2424 | LOperand* size() { return inputs_[1]; } |
| 2425 | LOperand* temp1() { return temps_[0]; } |
| 2426 | LOperand* temp2() { return temps_[1]; } |
| 2427 | |
| 2428 | DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate") |
| 2429 | DECLARE_HYDROGEN_ACCESSOR(Allocate) |
| 2430 | }; |
| 2431 | |
| 2432 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2433 | class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> { |
| 2434 | public: |
| 2435 | DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal") |
| 2436 | DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral) |
| 2437 | }; |
| 2438 | |
| 2439 | |
| 2440 | class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> { |
| 2441 | public: |
| 2442 | DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") |
| 2443 | DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2444 | }; |
| 2445 | |
| 2446 | |
| 2447 | class LToFastProperties: public LTemplateInstruction<1, 1, 0> { |
| 2448 | public: |
| 2449 | explicit LToFastProperties(LOperand* value) { |
| 2450 | inputs_[0] = value; |
| 2451 | } |
| 2452 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2453 | LOperand* value() { return inputs_[0]; } |
| 2454 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2455 | DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties") |
| 2456 | DECLARE_HYDROGEN_ACCESSOR(ToFastProperties) |
| 2457 | }; |
| 2458 | |
| 2459 | |
| 2460 | class LTypeof: public LTemplateInstruction<1, 1, 0> { |
| 2461 | public: |
| 2462 | explicit LTypeof(LOperand* value) { |
| 2463 | inputs_[0] = value; |
| 2464 | } |
| 2465 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2466 | LOperand* value() { return inputs_[0]; } |
| 2467 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2468 | DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") |
| 2469 | }; |
| 2470 | |
| 2471 | |
| 2472 | class LTypeofIsAndBranch: public LControlInstruction<1, 0> { |
| 2473 | public: |
| 2474 | explicit LTypeofIsAndBranch(LOperand* value) { |
| 2475 | inputs_[0] = value; |
| 2476 | } |
| 2477 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2478 | LOperand* value() { return inputs_[0]; } |
| 2479 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2480 | DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") |
| 2481 | DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch) |
| 2482 | |
| 2483 | Handle<String> type_literal() { return hydrogen()->type_literal(); } |
| 2484 | |
| 2485 | virtual void PrintDataTo(StringStream* stream); |
| 2486 | }; |
| 2487 | |
| 2488 | |
| 2489 | class LIsConstructCallAndBranch: public LControlInstruction<0, 1> { |
| 2490 | public: |
| 2491 | explicit LIsConstructCallAndBranch(LOperand* temp) { |
| 2492 | temps_[0] = temp; |
| 2493 | } |
| 2494 | |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2495 | LOperand* temp() { return temps_[0]; } |
| 2496 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2497 | DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch, |
| 2498 | "is-construct-call-and-branch") |
| 2499 | }; |
| 2500 | |
| 2501 | |
| 2502 | class LDeleteProperty: public LTemplateInstruction<1, 2, 0> { |
| 2503 | public: |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2504 | LDeleteProperty(LOperand* object, LOperand* key) { |
| 2505 | inputs_[0] = object; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2506 | inputs_[1] = key; |
| 2507 | } |
| 2508 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2509 | LOperand* object() { return inputs_[0]; } |
| 2510 | LOperand* key() { return inputs_[1]; } |
svenpanne@chromium.org | c859c4f | 2012-10-15 11:51:39 +0000 | [diff] [blame] | 2511 | |
| 2512 | DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2513 | }; |
| 2514 | |
| 2515 | |
| 2516 | class LOsrEntry: public LTemplateInstruction<0, 0, 0> { |
| 2517 | public: |
| 2518 | LOsrEntry(); |
| 2519 | |
ulan@chromium.org | 32d7dba | 2013-04-24 10:59:06 +0000 | [diff] [blame] | 2520 | virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2521 | DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") |
| 2522 | |
| 2523 | LOperand** SpilledRegisterArray() { return register_spills_; } |
| 2524 | LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; } |
| 2525 | |
| 2526 | void MarkSpilledRegister(int allocation_index, LOperand* spill_operand); |
| 2527 | void MarkSpilledDoubleRegister(int allocation_index, |
| 2528 | LOperand* spill_operand); |
| 2529 | |
| 2530 | private: |
| 2531 | // Arrays of spill slot operands for registers with an assigned spill |
| 2532 | // slot, i.e., that must also be restored to the spill slot on OSR entry. |
| 2533 | // NULL if the register has no assigned spill slot. Indexed by allocation |
| 2534 | // index. |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 2535 | LOperand* register_spills_[Register::kMaxNumAllocatableRegisters]; |
| 2536 | LOperand* double_register_spills_[ |
| 2537 | DoubleRegister::kMaxNumAllocatableRegisters]; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2538 | }; |
| 2539 | |
| 2540 | |
| 2541 | class LStackCheck: public LTemplateInstruction<0, 0, 0> { |
| 2542 | public: |
| 2543 | DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") |
| 2544 | DECLARE_HYDROGEN_ACCESSOR(StackCheck) |
| 2545 | |
| 2546 | Label* done_label() { return &done_label_; } |
| 2547 | |
| 2548 | private: |
| 2549 | Label done_label_; |
| 2550 | }; |
| 2551 | |
| 2552 | |
| 2553 | class LIn: public LTemplateInstruction<1, 2, 0> { |
| 2554 | public: |
| 2555 | LIn(LOperand* key, LOperand* object) { |
| 2556 | inputs_[0] = key; |
| 2557 | inputs_[1] = object; |
| 2558 | } |
| 2559 | |
| 2560 | LOperand* key() { return inputs_[0]; } |
| 2561 | LOperand* object() { return inputs_[1]; } |
| 2562 | |
| 2563 | DECLARE_CONCRETE_INSTRUCTION(In, "in") |
| 2564 | }; |
| 2565 | |
| 2566 | |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2567 | class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> { |
| 2568 | public: |
| 2569 | explicit LForInPrepareMap(LOperand* object) { |
| 2570 | inputs_[0] = object; |
| 2571 | } |
| 2572 | |
| 2573 | LOperand* object() { return inputs_[0]; } |
| 2574 | |
| 2575 | DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map") |
| 2576 | }; |
| 2577 | |
| 2578 | |
rossberg@chromium.org | 89e18f5 | 2012-10-22 13:09:53 +0000 | [diff] [blame] | 2579 | class LForInCacheArray: public LTemplateInstruction<1, 1, 0> { |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2580 | public: |
rossberg@chromium.org | 89e18f5 | 2012-10-22 13:09:53 +0000 | [diff] [blame] | 2581 | explicit LForInCacheArray(LOperand* map) { |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2582 | inputs_[0] = map; |
| 2583 | } |
| 2584 | |
| 2585 | LOperand* map() { return inputs_[0]; } |
| 2586 | |
| 2587 | DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array") |
| 2588 | |
| 2589 | int idx() { |
| 2590 | return HForInCacheArray::cast(this->hydrogen_value())->idx(); |
| 2591 | } |
| 2592 | }; |
| 2593 | |
| 2594 | |
| 2595 | class LCheckMapValue: public LTemplateInstruction<0, 2, 0> { |
| 2596 | public: |
| 2597 | LCheckMapValue(LOperand* value, LOperand* map) { |
| 2598 | inputs_[0] = value; |
| 2599 | inputs_[1] = map; |
| 2600 | } |
| 2601 | |
| 2602 | LOperand* value() { return inputs_[0]; } |
| 2603 | LOperand* map() { return inputs_[1]; } |
| 2604 | |
| 2605 | DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value") |
| 2606 | }; |
| 2607 | |
| 2608 | |
| 2609 | class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> { |
| 2610 | public: |
| 2611 | LLoadFieldByIndex(LOperand* object, LOperand* index) { |
| 2612 | inputs_[0] = object; |
| 2613 | inputs_[1] = index; |
| 2614 | } |
| 2615 | |
| 2616 | LOperand* object() { return inputs_[0]; } |
| 2617 | LOperand* index() { return inputs_[1]; } |
| 2618 | |
| 2619 | DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") |
| 2620 | }; |
| 2621 | |
| 2622 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2623 | class LChunkBuilder; |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2624 | class LPlatformChunk: public LChunk { |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2625 | public: |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2626 | LPlatformChunk(CompilationInfo* info, HGraph* graph) |
| 2627 | : LChunk(info, graph) { } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2628 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2629 | int GetNextSpillIndex(bool is_double); |
| 2630 | LOperand* GetNextSpillSlot(bool is_double); |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2631 | }; |
| 2632 | |
| 2633 | |
| 2634 | class LChunkBuilder BASE_EMBEDDED { |
| 2635 | public: |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2636 | LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) |
| 2637 | : chunk_(NULL), |
| 2638 | info_(info), |
| 2639 | graph_(graph), |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 2640 | zone_(graph->zone()), |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2641 | status_(UNUSED), |
| 2642 | current_instruction_(NULL), |
| 2643 | current_block_(NULL), |
| 2644 | next_block_(NULL), |
| 2645 | argument_count_(0), |
| 2646 | allocator_(allocator), |
| 2647 | position_(RelocInfo::kNoPosition), |
| 2648 | instruction_pending_deoptimization_environment_(NULL), |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 2649 | pending_deoptimization_ast_id_(BailoutId::None()) { } |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2650 | |
| 2651 | // Build the sequence for the graph. |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2652 | LPlatformChunk* Build(); |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2653 | |
| 2654 | // Declare methods that deal with the individual node types. |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2655 | #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2656 | HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
| 2657 | #undef DECLARE_DO |
| 2658 | |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 2659 | LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend); |
| 2660 | |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 2661 | LInstruction* DoMathFloor(HUnaryMathOperation* instr); |
| 2662 | LInstruction* DoMathRound(HUnaryMathOperation* instr); |
| 2663 | LInstruction* DoMathAbs(HUnaryMathOperation* instr); |
| 2664 | LInstruction* DoMathLog(HUnaryMathOperation* instr); |
| 2665 | LInstruction* DoMathSin(HUnaryMathOperation* instr); |
| 2666 | LInstruction* DoMathCos(HUnaryMathOperation* instr); |
| 2667 | LInstruction* DoMathTan(HUnaryMathOperation* instr); |
| 2668 | LInstruction* DoMathExp(HUnaryMathOperation* instr); |
| 2669 | LInstruction* DoMathSqrt(HUnaryMathOperation* instr); |
| 2670 | LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); |
| 2671 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2672 | private: |
| 2673 | enum Status { |
| 2674 | UNUSED, |
| 2675 | BUILDING, |
| 2676 | DONE, |
| 2677 | ABORTED |
| 2678 | }; |
| 2679 | |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2680 | LPlatformChunk* chunk() const { return chunk_; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2681 | CompilationInfo* info() const { return info_; } |
| 2682 | HGraph* graph() const { return graph_; } |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2683 | Zone* zone() const { return zone_; } |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2684 | |
| 2685 | bool is_unused() const { return status_ == UNUSED; } |
| 2686 | bool is_building() const { return status_ == BUILDING; } |
| 2687 | bool is_done() const { return status_ == DONE; } |
| 2688 | bool is_aborted() const { return status_ == ABORTED; } |
| 2689 | |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 2690 | void Abort(const char* reason); |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2691 | |
| 2692 | // Methods for getting operands for Use / Define / Temp. |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2693 | LUnallocated* ToUnallocated(Register reg); |
| 2694 | LUnallocated* ToUnallocated(DoubleRegister reg); |
| 2695 | |
| 2696 | // Methods for setting up define-use relationships. |
| 2697 | MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); |
| 2698 | MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); |
| 2699 | MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, |
| 2700 | DoubleRegister fixed_register); |
| 2701 | |
| 2702 | // A value that is guaranteed to be allocated to a register. |
| 2703 | // Operand created by UseRegister is guaranteed to be live until the end of |
| 2704 | // instruction. This means that register allocator will not reuse it's |
| 2705 | // register for any other operand inside instruction. |
| 2706 | // Operand created by UseRegisterAtStart is guaranteed to be live only at |
| 2707 | // instruction start. Register allocator is free to assign the same register |
| 2708 | // to some other operand used inside instruction (i.e. temporary or |
| 2709 | // output). |
| 2710 | MUST_USE_RESULT LOperand* UseRegister(HValue* value); |
| 2711 | MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value); |
| 2712 | |
| 2713 | // An input operand in a register that may be trashed. |
| 2714 | MUST_USE_RESULT LOperand* UseTempRegister(HValue* value); |
| 2715 | |
| 2716 | // An input operand in a register or stack slot. |
| 2717 | MUST_USE_RESULT LOperand* Use(HValue* value); |
| 2718 | MUST_USE_RESULT LOperand* UseAtStart(HValue* value); |
| 2719 | |
| 2720 | // An input operand in a register, stack slot or a constant operand. |
| 2721 | MUST_USE_RESULT LOperand* UseOrConstant(HValue* value); |
| 2722 | MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value); |
| 2723 | |
| 2724 | // An input operand in a register or a constant operand. |
| 2725 | MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value); |
| 2726 | MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value); |
| 2727 | |
danno@chromium.org | f005df6 | 2013-04-30 16:36:45 +0000 | [diff] [blame] | 2728 | // An input operand in a constant operand. |
| 2729 | MUST_USE_RESULT LOperand* UseConstant(HValue* value); |
| 2730 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2731 | // An input operand in register, stack slot or a constant operand. |
| 2732 | // Will not be moved to a register even if one is freely available. |
| 2733 | MUST_USE_RESULT LOperand* UseAny(HValue* value); |
| 2734 | |
| 2735 | // Temporary operand that must be in a register. |
| 2736 | MUST_USE_RESULT LUnallocated* TempRegister(); |
| 2737 | MUST_USE_RESULT LOperand* FixedTemp(Register reg); |
| 2738 | MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); |
| 2739 | |
| 2740 | // Methods for setting up define-use relationships. |
| 2741 | // Return the same instruction that they are passed. |
| 2742 | template<int I, int T> |
| 2743 | LInstruction* Define(LTemplateInstruction<1, I, T>* instr, |
| 2744 | LUnallocated* result); |
| 2745 | template<int I, int T> |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2746 | LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); |
| 2747 | template<int I, int T> |
| 2748 | LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr, |
| 2749 | int index); |
| 2750 | template<int I, int T> |
| 2751 | LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr); |
| 2752 | template<int I, int T> |
| 2753 | LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr, |
| 2754 | Register reg); |
| 2755 | template<int I, int T> |
| 2756 | LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr, |
| 2757 | DoubleRegister reg); |
| 2758 | LInstruction* AssignEnvironment(LInstruction* instr); |
| 2759 | LInstruction* AssignPointerMap(LInstruction* instr); |
| 2760 | |
| 2761 | enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; |
| 2762 | |
| 2763 | // By default we assume that instruction sequences generated for calls |
| 2764 | // cannot deoptimize eagerly and we do not attach environment to this |
| 2765 | // instruction. |
| 2766 | LInstruction* MarkAsCall( |
| 2767 | LInstruction* instr, |
| 2768 | HInstruction* hinstr, |
| 2769 | CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2770 | |
| 2771 | LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env, |
| 2772 | int* argument_index_accumulator); |
| 2773 | |
| 2774 | void VisitInstruction(HInstruction* current); |
| 2775 | |
| 2776 | void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
| 2777 | LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2778 | LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
| 2779 | LInstruction* DoArithmeticD(Token::Value op, |
| 2780 | HArithmeticBinaryOperation* instr); |
| 2781 | LInstruction* DoArithmeticT(Token::Value op, |
| 2782 | HArithmeticBinaryOperation* instr); |
| 2783 | |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 2784 | LPlatformChunk* chunk_; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2785 | CompilationInfo* info_; |
| 2786 | HGraph* const graph_; |
ulan@chromium.org | 812308e | 2012-02-29 15:58:45 +0000 | [diff] [blame] | 2787 | Zone* zone_; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2788 | Status status_; |
| 2789 | HInstruction* current_instruction_; |
| 2790 | HBasicBlock* current_block_; |
| 2791 | HBasicBlock* next_block_; |
| 2792 | int argument_count_; |
| 2793 | LAllocator* allocator_; |
| 2794 | int position_; |
| 2795 | LInstruction* instruction_pending_deoptimization_environment_; |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 2796 | BailoutId pending_deoptimization_ast_id_; |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2797 | |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2798 | DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2799 | }; |
| 2800 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 2801 | #undef DECLARE_HYDROGEN_ACCESSOR |
| 2802 | #undef DECLARE_CONCRETE_INSTRUCTION |
lrn@chromium.org | 7516f05 | 2011-03-30 08:52:27 +0000 | [diff] [blame] | 2803 | |
| 2804 | } } // namespace v8::internal |
| 2805 | |
| 2806 | #endif // V8_MIPS_LITHIUM_MIPS_H_ |