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