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