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