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