blob: ecffef7ef33bc03003b768283374ed6bfd476f14 [file] [log] [blame]
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001// Copyright 2012 the V8 project authors. All rights reserved.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Steve Block44f0eee2011-05-26 01:26:41 +01004
5#ifndef V8_MIPS_LITHIUM_MIPS_H_
6#define V8_MIPS_LITHIUM_MIPS_H_
7
Ben Murdochb8a8cc12014-11-26 15:28:44 +00008#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 Block44f0eee2011-05-26 01:26:41 +010013
14namespace v8 {
15namespace internal {
16
17// Forward declarations.
18class LCodeGen;
Ben Murdoch3ef787d2012-04-12 10:51:47 +010019
Ben Murdochb8a8cc12014-11-26 15:28:44 +000020#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 Murdoch3ef787d2012-04-12 10:51:47 +0100164 V(WrapReceiver)
165
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400166#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 Murdoch3ef787d2012-04-12 10:51:47 +0100173 }
174
175
176#define DECLARE_HYDROGEN_ACCESSOR(type) \
177 H##type* hydrogen() const { \
178 return H##type::cast(hydrogen_value()); \
179 }
180
Steve Block44f0eee2011-05-26 01:26:41 +0100181
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000182class LInstruction : public ZoneObject {
Steve Block44f0eee2011-05-26 01:26:41 +0100183 public:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100184 LInstruction()
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000185 : environment_(NULL),
186 hydrogen_value_(NULL),
187 bit_field_(IsCallBits::encode(false)) {
188 }
189
190 virtual ~LInstruction() {}
Steve Block44f0eee2011-05-26 01:26:41 +0100191
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100192 virtual void CompileToNative(LCodeGen* generator) = 0;
193 virtual const char* Mnemonic() const = 0;
194 virtual void PrintTo(StringStream* stream);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000195 virtual void PrintDataTo(StringStream* stream);
196 virtual void PrintOutputOperandTo(StringStream* stream);
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100197
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 Murdochb8a8cc12014-11-26 15:28:44 +0000220 // Try deleting this instruction if possible.
221 virtual bool TryDelete() { return false; }
222
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100223 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 Murdochb8a8cc12014-11-26 15:28:44 +0000234 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
Steve Block44f0eee2011-05-26 01:26:41 +0100235
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000236 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); }
237 bool IsCall() const { return IsCallBits::decode(bit_field_); }
Steve Block44f0eee2011-05-26 01:26:41 +0100238
239 // Interface to the register allocator and iterators.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000240 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 Block44f0eee2011-05-26 01:26:41 +0100248
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100249 virtual bool HasResult() const = 0;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000250 virtual LOperand* result() const = 0;
Steve Block44f0eee2011-05-26 01:26:41 +0100251
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100252 LOperand* FirstInput() { return InputAt(0); }
253 LOperand* Output() { return HasResult() ? result() : NULL; }
Steve Block44f0eee2011-05-26 01:26:41 +0100254
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000255 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
256
Steve Block44f0eee2011-05-26 01:26:41 +0100257#ifdef DEBUG
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100258 void VerifyCall();
Steve Block44f0eee2011-05-26 01:26:41 +0100259#endif
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100260
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000261 virtual int InputCount() = 0;
262 virtual LOperand* InputAt(int i) = 0;
263
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100264 private:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000265 // 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 Murdoch3ef787d2012-04-12 10:51:47 +0100274 LEnvironment* environment_;
275 SetOncePointer<LPointerMap> pointer_map_;
276 HValue* hydrogen_value_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000277 int bit_field_;
278};
279
280
281// R = number of result operands (0 or 1).
282template<int R>
283class LTemplateResultInstruction : public LInstruction {
284 public:
285 // Allow 0 or 1 output operands.
286 STATIC_ASSERT(R == 0 || R == 1);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400287 bool HasResult() const FINAL { return R != 0 && result() != NULL; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000288 void set_result(LOperand* operand) { results_[0] = operand; }
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400289 LOperand* result() const OVERRIDE { return results_[0]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000290
291 protected:
292 EmbeddedContainer<LOperand*, R> results_;
Steve Block44f0eee2011-05-26 01:26:41 +0100293};
294
295
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100296// R = number of result operands (0 or 1).
297// I = number of input operands.
298// T = number of temporary operands.
299template<int R, int I, int T>
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000300class LTemplateInstruction : public LTemplateResultInstruction<R> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100301 protected:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100302 EmbeddedContainer<LOperand*, I> inputs_;
303 EmbeddedContainer<LOperand*, T> temps_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000304
305 private:
306 // Iterator support.
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400307 int InputCount() FINAL { return I; }
308 LOperand* InputAt(int i) FINAL { return inputs_[i]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000309
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400310 int TempCount() FINAL { return T; }
311 LOperand* TempAt(int i) FINAL { return temps_[i]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100312};
313
314
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000315class LGap : public LTemplateInstruction<0, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100316 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 Block44f0eee2011-05-26 01:26:41 +0100323 }
324
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100325 // Can't use the DECLARE-macro here because of sub-classes.
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400326 bool IsGap() const FINAL { return true; }
327 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100328 static LGap* cast(LInstruction* instr) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000329 DCHECK(instr->IsGap());
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100330 return reinterpret_cast<LGap*>(instr);
331 }
332
333 bool IsRedundant() const;
334
335 HBasicBlock* block() const { return block_; }
336
Steve Block44f0eee2011-05-26 01:26:41 +0100337 enum InnerPosition {
338 BEFORE,
339 START,
340 END,
341 AFTER,
342 FIRST_INNER_POSITION = BEFORE,
343 LAST_INNER_POSITION = AFTER
344 };
345
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000346 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
347 if (parallel_moves_[pos] == NULL) {
348 parallel_moves_[pos] = new(zone) LParallelMove(zone);
349 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100350 return parallel_moves_[pos];
Steve Block44f0eee2011-05-26 01:26:41 +0100351 }
352
353 LParallelMove* GetParallelMove(InnerPosition pos) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100354 return parallel_moves_[pos];
Steve Block44f0eee2011-05-26 01:26:41 +0100355 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100356
357 private:
358 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
359 HBasicBlock* block_;
360};
361
362
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000363class LInstructionGap FINAL : public LGap {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100364 public:
365 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
366
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400367 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000368 return !IsRedundant();
369 }
370
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100371 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
372};
373
374
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000375class LGoto FINAL : public LTemplateInstruction<0, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100376 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000377 explicit LGoto(HBasicBlock* block) : block_(block) { }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100378
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400379 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100380 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400381 void PrintDataTo(StringStream* stream) OVERRIDE;
382 bool IsControl() const OVERRIDE { return true; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100383
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000384 int block_id() const { return block_->block_id(); }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100385
386 private:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000387 HBasicBlock* block_;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100388};
389
390
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000391class LLazyBailout FINAL : public LTemplateInstruction<0, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100392 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 Murdochb8a8cc12014-11-26 15:28:44 +0000407class LDummy FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100408 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000409 LDummy() {}
410 DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
Steve Block44f0eee2011-05-26 01:26:41 +0100411};
412
413
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000414class 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
423class LDeoptimize FINAL : public LTemplateInstruction<0, 0, 0> {
424 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400425 bool IsControl() const OVERRIDE { return true; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000426 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
427 DECLARE_HYDROGEN_ACCESSOR(Deoptimize)
428};
429
430
431class LLabel FINAL : public LGap {
Steve Block44f0eee2011-05-26 01:26:41 +0100432 public:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100433 explicit LLabel(HBasicBlock* block)
434 : LGap(block), replacement_(NULL) { }
435
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400436 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE { return false; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100437 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
438
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400439 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100440
441 int block_id() const { return block()->block_id(); }
442 bool is_loop_header() const { return block()->IsLoopHeader(); }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000443 bool is_osr_entry() const { return block()->is_osr_entry(); }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100444 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 Murdoch592a9fc2012-03-05 11:04:45 +0000452};
Steve Block44f0eee2011-05-26 01:26:41 +0100453
Steve Block44f0eee2011-05-26 01:26:41 +0100454
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000455class LParameter FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000456 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400457 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE { return false; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100458 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
459};
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000460
Ben Murdoch5d4cdbf2012-04-11 10:23:59 +0100461
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000462class LCallStub FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100463 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000464 explicit LCallStub(LOperand* context) {
465 inputs_[0] = context;
466 }
467
468 LOperand* context() { return inputs_[0]; }
469
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100470 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
471 DECLARE_HYDROGEN_ACCESSOR(CallStub)
Ben Murdoch5d4cdbf2012-04-11 10:23:59 +0100472};
473
474
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000475class LTailCallThroughMegamorphicCache FINAL
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400476 : public LTemplateInstruction<0, 5, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100477 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400478 LTailCallThroughMegamorphicCache(LOperand* context, LOperand* receiver,
479 LOperand* name, LOperand* slot,
480 LOperand* vector) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000481 inputs_[0] = context;
482 inputs_[1] = receiver;
483 inputs_[2] = name;
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400484 inputs_[3] = slot;
485 inputs_[4] = vector;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000486 }
487
488 LOperand* context() { return inputs_[0]; }
489 LOperand* receiver() { return inputs_[1]; }
490 LOperand* name() { return inputs_[2]; }
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400491 LOperand* slot() { return inputs_[3]; }
492 LOperand* vector() { return inputs_[4]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000493
494 DECLARE_CONCRETE_INSTRUCTION(TailCallThroughMegamorphicCache,
495 "tail-call-through-megamorphic-cache")
496 DECLARE_HYDROGEN_ACCESSOR(TailCallThroughMegamorphicCache)
497};
498
499
500class LUnknownOSRValue FINAL : public LTemplateInstruction<1, 0, 0> {
501 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400502 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE { return false; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100503 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
504};
505
506
507template<int I, int T>
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000508class LControlInstruction : public LTemplateInstruction<0, I, T> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100509 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000510 LControlInstruction() : false_label_(NULL), true_label_(NULL) { }
511
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400512 bool IsControl() const FINAL { return true; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100513
514 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
515 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000516
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 Murdoch3ef787d2012-04-12 10:51:47 +0100540
541 private:
542 HControlInstruction* hydrogen() {
543 return HControlInstruction::cast(this->hydrogen_value());
544 }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000545
546 Label* false_label_;
547 Label* true_label_;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100548};
549
550
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000551class LWrapReceiver FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100552 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 Murdochb8a8cc12014-11-26 15:28:44 +0000559 DECLARE_HYDROGEN_ACCESSOR(WrapReceiver)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100560
561 LOperand* receiver() { return inputs_[0]; }
562 LOperand* function() { return inputs_[1]; }
563};
564
565
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000566class LApplyArguments FINAL : public LTemplateInstruction<1, 4, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100567 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 Murdochb8a8cc12014-11-26 15:28:44 +0000587class LAccessArgumentsAt FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100588 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 Bernierd0a1eb72015-03-24 16:35:39 -0400601 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100602};
603
604
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000605class LArgumentsLength FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100606 public:
607 explicit LArgumentsLength(LOperand* elements) {
608 inputs_[0] = elements;
609 }
610
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000611 LOperand* elements() { return inputs_[0]; }
612
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100613 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
614};
615
616
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000617class LArgumentsElements FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100618 public:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100619 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000620 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100621};
622
623
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000624class LModByPowerOf2I FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100625 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000626 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
642class 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
660class LModI FINAL : public LTemplateInstruction<1, 2, 3> {
661 public:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100662 LModI(LOperand* left,
663 LOperand* right) {
664 inputs_[0] = left;
665 inputs_[1] = right;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100666 }
667
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000668 LOperand* left() { return inputs_[0]; }
669 LOperand* right() { return inputs_[1]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100670
671 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
672 DECLARE_HYDROGEN_ACCESSOR(Mod)
673};
674
675
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000676class LDivByPowerOf2I FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100677 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000678 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
679 inputs_[0] = dividend;
680 divisor_ = divisor;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100681 }
682
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000683 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 Murdoch3ef787d2012-04-12 10:51:47 +0100687 DECLARE_HYDROGEN_ACCESSOR(Div)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000688
689 private:
690 int32_t divisor_;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100691};
692
693
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000694class LDivByConstI FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100695 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000696 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
712class 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 Murdoch3ef787d2012-04-12 10:51:47 +0100717 temps_[0] = temp;
718 }
719
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000720 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
729class 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
748class 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
768class 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
783class 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 Murdoch3ef787d2012-04-12 10:51:47 +0100793 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
794 DECLARE_HYDROGEN_ACCESSOR(Mul)
795};
796
797
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000798// Instruction for computing multiplier * multiplicand + addend.
799class LMultiplyAddD FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100800 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000801 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
816class LDebugBreak FINAL : public LTemplateInstruction<0, 0, 0> {
817 public:
818 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
819};
820
821
822class LCompareNumericAndBranch FINAL : public LControlInstruction<2, 0> {
823 public:
824 LCompareNumericAndBranch(LOperand* left, LOperand* right) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100825 inputs_[0] = left;
826 inputs_[1] = right;
827 }
828
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000829 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 Murdoch3ef787d2012-04-12 10:51:47 +0100835
836 Token::Value op() const { return hydrogen()->token(); }
837 bool is_double() const {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000838 return hydrogen()->representation().IsDouble();
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100839 }
840
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400841 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100842};
843
844
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000845class LMathFloor FINAL : public LTemplateInstruction<1, 1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100846 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000847 LMathFloor(LOperand* value, LOperand* temp) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100848 inputs_[0] = value;
849 temps_[0] = temp;
850 }
851
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000852 LOperand* value() { return inputs_[0]; }
853 LOperand* temp() { return temps_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100854
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000855 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
856 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100857};
858
859
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000860class 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
875class 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
885class 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
900class 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
912class 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
924class 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
946class 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
958class 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
972class LCmpObjectEqAndBranch FINAL : public LControlInstruction<2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100973 public:
974 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
975 inputs_[0] = left;
976 inputs_[1] = right;
977 }
978
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000979 LOperand* left() { return inputs_[0]; }
980 LOperand* right() { return inputs_[1]; }
981
982 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch")
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100983 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
984};
985
986
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000987class LCmpHoleAndBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100988 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000989 explicit LCmpHoleAndBranch(LOperand* object) {
990 inputs_[0] = object;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100991 }
992
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000993 LOperand* object() { return inputs_[0]; }
994
995 DECLARE_CONCRETE_INSTRUCTION(CmpHoleAndBranch, "cmp-hole-and-branch")
996 DECLARE_HYDROGEN_ACCESSOR(CompareHoleAndBranch)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100997};
998
999
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001000class LCompareMinusZeroAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001001 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001002 LCompareMinusZeroAndBranch(LOperand* value, LOperand* temp) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001003 inputs_[0] = value;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001004 temps_[0] = temp;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001005 }
1006
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001007 LOperand* value() { return inputs_[0]; }
1008 LOperand* temp() { return temps_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001009
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001010 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch,
1011 "cmp-minus-zero-and-branch")
1012 DECLARE_HYDROGEN_ACCESSOR(CompareMinusZeroAndBranch)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001013};
1014
1015
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001016class LIsObjectAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001017 public:
1018 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
1019 inputs_[0] = value;
1020 temps_[0] = temp;
1021 }
1022
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001023 LOperand* value() { return inputs_[0]; }
1024 LOperand* temp() { return temps_[0]; }
1025
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001026 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
1027 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
1028
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001029 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001030};
1031
1032
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001033class LIsStringAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001034 public:
1035 LIsStringAndBranch(LOperand* value, LOperand* temp) {
1036 inputs_[0] = value;
1037 temps_[0] = temp;
1038 }
1039
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001040 LOperand* value() { return inputs_[0]; }
1041 LOperand* temp() { return temps_[0]; }
1042
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001043 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
1044 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
1045
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001046 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001047};
1048
1049
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001050class LIsSmiAndBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001051 public:
1052 explicit LIsSmiAndBranch(LOperand* value) {
1053 inputs_[0] = value;
1054 }
1055
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001056 LOperand* value() { return inputs_[0]; }
1057
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001058 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
1059 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
1060
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001061 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001062};
1063
1064
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001065class LIsUndetectableAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001066 public:
1067 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
1068 inputs_[0] = value;
1069 temps_[0] = temp;
1070 }
1071
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001072 LOperand* value() { return inputs_[0]; }
1073 LOperand* temp() { return temps_[0]; }
1074
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001075 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
1076 "is-undetectable-and-branch")
1077 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
1078
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001079 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001080};
1081
1082
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001083class LStringCompareAndBranch FINAL : public LControlInstruction<3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001084 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001085 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) {
1086 inputs_[0] = context;
1087 inputs_[1] = left;
1088 inputs_[2] = right;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001089 }
1090
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001091 LOperand* context() { return inputs_[0]; }
1092 LOperand* left() { return inputs_[1]; }
1093 LOperand* right() { return inputs_[2]; }
1094
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001095 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 Bernierd0a1eb72015-03-24 16:35:39 -04001101 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001102};
1103
1104
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001105class LHasInstanceTypeAndBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001106 public:
1107 explicit LHasInstanceTypeAndBranch(LOperand* value) {
1108 inputs_[0] = value;
1109 }
1110
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001111 LOperand* value() { return inputs_[0]; }
1112
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001113 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
1114 "has-instance-type-and-branch")
1115 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
1116
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001117 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001118};
1119
1120
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001121class LGetCachedArrayIndex FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001122 public:
1123 explicit LGetCachedArrayIndex(LOperand* value) {
1124 inputs_[0] = value;
1125 }
1126
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001127 LOperand* value() { return inputs_[0]; }
1128
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001129 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
1130 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
1131};
1132
1133
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001134class LHasCachedArrayIndexAndBranch FINAL
1135 : public LControlInstruction<1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001136 public:
1137 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
1138 inputs_[0] = value;
1139 }
1140
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001141 LOperand* value() { return inputs_[0]; }
1142
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001143 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
1144 "has-cached-array-index-and-branch")
1145 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
1146
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001147 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001148};
1149
1150
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001151class LClassOfTestAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001152 public:
1153 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
1154 inputs_[0] = value;
1155 temps_[0] = temp;
1156 }
1157
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001158 LOperand* value() { return inputs_[0]; }
1159 LOperand* temp() { return temps_[0]; }
1160
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001161 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1162 "class-of-test-and-branch")
1163 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1164
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001165 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001166};
1167
1168
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001169class LCmpT FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001170 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001171 LCmpT(LOperand* context, LOperand* left, LOperand* right) {
1172 inputs_[0] = context;
1173 inputs_[1] = left;
1174 inputs_[2] = right;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001175 }
1176
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001177 LOperand* context() { return inputs_[0]; }
1178 LOperand* left() { return inputs_[1]; }
1179 LOperand* right() { return inputs_[2]; }
1180
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001181 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1182 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1183
1184 Token::Value op() const { return hydrogen()->token(); }
1185};
1186
1187
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001188class LInstanceOf FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001189 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001190 LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
1191 inputs_[0] = context;
1192 inputs_[1] = left;
1193 inputs_[2] = right;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001194 }
1195
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001196 LOperand* context() { return inputs_[0]; }
1197 LOperand* left() { return inputs_[1]; }
1198 LOperand* right() { return inputs_[2]; }
1199
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001200 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1201};
1202
1203
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001204class LInstanceOfKnownGlobal FINAL : public LTemplateInstruction<1, 2, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001205 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001206 LInstanceOfKnownGlobal(LOperand* context, LOperand* value, LOperand* temp) {
1207 inputs_[0] = context;
1208 inputs_[1] = value;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001209 temps_[0] = temp;
1210 }
1211
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001212 LOperand* context() { return inputs_[0]; }
1213 LOperand* value() { return inputs_[1]; }
1214 LOperand* temp() { return temps_[0]; }
1215
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001216 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1217 "instance-of-known-global")
1218 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1219
1220 Handle<JSFunction> function() const { return hydrogen()->function(); }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001221 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 Murdoch3ef787d2012-04-12 10:51:47 +01001231};
1232
1233
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001234class LBoundsCheck FINAL : public LTemplateInstruction<0, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001235 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 Murdochb8a8cc12014-11-26 15:28:44 +00001245 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001246};
1247
1248
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001249class LBitI FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001250 public:
1251 LBitI(LOperand* left, LOperand* right) {
1252 inputs_[0] = left;
1253 inputs_[1] = right;
1254 }
1255
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001256 LOperand* left() { return inputs_[0]; }
1257 LOperand* right() { return inputs_[1]; }
1258
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001259 Token::Value op() const { return hydrogen()->op(); }
1260
1261 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1262 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1263};
1264
1265
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001266class LShiftI FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001267 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 Murdochb8a8cc12014-11-26 15:28:44 +00001275 LOperand* left() { return inputs_[0]; }
1276 LOperand* right() { return inputs_[1]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001277 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 Murdochb8a8cc12014-11-26 15:28:44 +00001287class LSubI FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001288 public:
1289 LSubI(LOperand* left, LOperand* right) {
1290 inputs_[0] = left;
1291 inputs_[1] = right;
1292 }
1293
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001294 LOperand* left() { return inputs_[0]; }
1295 LOperand* right() { return inputs_[1]; }
1296
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001297 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1298 DECLARE_HYDROGEN_ACCESSOR(Sub)
1299};
1300
1301
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001302class LConstantI FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001303 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 Murdochb8a8cc12014-11-26 15:28:44 +00001311class 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
1320class LConstantD FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001321 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 Murdochb8a8cc12014-11-26 15:28:44 +00001329class 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
1340class LConstantT FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001341 public:
1342 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1343 DECLARE_HYDROGEN_ACCESSOR(Constant)
1344
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001345 Handle<Object> value(Isolate* isolate) const {
1346 return hydrogen()->handle(isolate);
1347 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001348};
1349
1350
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001351class LBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001352 public:
1353 explicit LBranch(LOperand* value) {
1354 inputs_[0] = value;
1355 }
1356
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001357 LOperand* value() { return inputs_[0]; }
1358
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001359 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1360 DECLARE_HYDROGEN_ACCESSOR(Branch)
1361
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001362 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001363};
1364
1365
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001366class LCmpMapAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001367 public:
1368 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1369 inputs_[0] = value;
1370 temps_[0] = temp;
1371 }
1372
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001373 LOperand* value() { return inputs_[0]; }
1374 LOperand* temp() { return temps_[0]; }
1375
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001376 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1377 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1378
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001379 Handle<Map> map() const { return hydrogen()->map().handle(); }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001380};
1381
1382
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001383class LMapEnumLength FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001384 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001385 explicit LMapEnumLength(LOperand* value) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001386 inputs_[0] = value;
1387 }
1388
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001389 LOperand* value() { return inputs_[0]; }
1390
1391 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001392};
1393
1394
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001395class LDateField FINAL : public LTemplateInstruction<1, 1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001396 public:
1397 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1398 inputs_[0] = date;
1399 temps_[0] = temp;
1400 }
1401
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001402 LOperand* date() { return inputs_[0]; }
1403 LOperand* temp() { return temps_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001404 Smi* index() const { return index_; }
1405
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001406 DECLARE_CONCRETE_INSTRUCTION(DateField, "date-field")
1407 DECLARE_HYDROGEN_ACCESSOR(DateField)
1408
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001409 private:
1410 Smi* index_;
1411};
1412
1413
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001414class LSeqStringGetChar FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001415 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001416 LSeqStringGetChar(LOperand* string, LOperand* index) {
1417 inputs_[0] = string;
1418 inputs_[1] = index;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001419 }
1420
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001421 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 Murdoch3ef787d2012-04-12 10:51:47 +01001426};
1427
1428
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001429class LSeqStringSetChar FINAL : public LTemplateInstruction<1, 4, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001430 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001431 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 Murdoch3ef787d2012-04-12 10:51:47 +01001439 }
1440
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001441 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 Murdoch3ef787d2012-04-12 10:51:47 +01001447};
1448
1449
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001450class LAddI FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001451 public:
1452 LAddI(LOperand* left, LOperand* right) {
1453 inputs_[0] = left;
1454 inputs_[1] = right;
1455 }
1456
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001457 LOperand* left() { return inputs_[0]; }
1458 LOperand* right() { return inputs_[1]; }
1459
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001460 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1461 DECLARE_HYDROGEN_ACCESSOR(Add)
1462};
1463
1464
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001465class 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
1480class LPower FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001481 public:
1482 LPower(LOperand* left, LOperand* right) {
1483 inputs_[0] = left;
1484 inputs_[1] = right;
1485 }
1486
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001487 LOperand* left() { return inputs_[0]; }
1488 LOperand* right() { return inputs_[1]; }
1489
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001490 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1491 DECLARE_HYDROGEN_ACCESSOR(Power)
1492};
1493
1494
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001495class LArithmeticD FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001496 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 Murdochb8a8cc12014-11-26 15:28:44 +00001504 LOperand* left() { return inputs_[0]; }
1505 LOperand* right() { return inputs_[1]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001506
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001507 Opcode opcode() const OVERRIDE { return LInstruction::kArithmeticD; }
1508 void CompileToNative(LCodeGen* generator) OVERRIDE;
1509 const char* Mnemonic() const OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001510
1511 private:
1512 Token::Value op_;
1513};
1514
1515
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001516class LArithmeticT FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001517 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001518 LArithmeticT(Token::Value op,
1519 LOperand* context,
1520 LOperand* left,
1521 LOperand* right)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001522 : op_(op) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001523 inputs_[0] = context;
1524 inputs_[1] = left;
1525 inputs_[2] = right;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001526 }
1527
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001528 LOperand* context() { return inputs_[0]; }
1529 LOperand* left() { return inputs_[1]; }
1530 LOperand* right() { return inputs_[2]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001531 Token::Value op() const { return op_; }
1532
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001533 Opcode opcode() const FINAL { return LInstruction::kArithmeticT; }
1534 void CompileToNative(LCodeGen* generator) OVERRIDE;
1535 const char* Mnemonic() const OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001536
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001537 private:
1538 Token::Value op_;
1539};
1540
1541
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001542class LReturn FINAL : public LTemplateInstruction<0, 3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001543 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001544 LReturn(LOperand* value, LOperand* context, LOperand* parameter_count) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001545 inputs_[0] = value;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001546 inputs_[1] = context;
1547 inputs_[2] = parameter_count;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001548 }
1549
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001550 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 Murdoch3ef787d2012-04-12 10:51:47 +01001561 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1562};
1563
1564
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001565class LLoadNamedField FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001566 public:
1567 explicit LLoadNamedField(LOperand* object) {
1568 inputs_[0] = object;
1569 }
1570
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001571 LOperand* object() { return inputs_[0]; }
1572
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001573 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1574 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1575};
1576
1577
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001578class LLoadNamedGeneric FINAL : public LTemplateInstruction<1, 2, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001579 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001580 LLoadNamedGeneric(LOperand* context, LOperand* object, LOperand* vector) {
1581 inputs_[0] = context;
1582 inputs_[1] = object;
1583 temps_[0] = vector;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001584 }
1585
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001586 LOperand* context() { return inputs_[0]; }
1587 LOperand* object() { return inputs_[1]; }
1588 LOperand* temp_vector() { return temps_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001589
1590 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1591 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1592
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001593 Handle<Object> name() const { return hydrogen()->name(); }
1594};
1595
1596
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001597class LLoadFunctionPrototype FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001598 public:
1599 explicit LLoadFunctionPrototype(LOperand* function) {
1600 inputs_[0] = function;
1601 }
1602
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001603 LOperand* function() { return inputs_[0]; }
1604
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001605 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1606 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001607};
1608
1609
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001610class LLoadRoot FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001611 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001612 DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
1613 DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001614
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001615 Heap::RootListIndex index() const { return hydrogen()->index(); }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001616};
1617
1618
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001619class LLoadKeyed FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001620 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001621 LLoadKeyed(LOperand* elements, LOperand* key) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001622 inputs_[0] = elements;
1623 inputs_[1] = key;
1624 }
1625
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001626 LOperand* elements() { return inputs_[0]; }
1627 LOperand* key() { return inputs_[1]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001628 ElementsKind elements_kind() const {
1629 return hydrogen()->elements_kind();
1630 }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001631 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 Murdoch3ef787d2012-04-12 10:51:47 +01001639 }
1640
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001641 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1642 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001643
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001644 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001645 uint32_t base_offset() const { return hydrogen()->base_offset(); }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001646};
1647
1648
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001649class 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
1669class LLoadGlobalCell FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001670 public:
1671 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1672 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1673};
1674
1675
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001676class LLoadGlobalGeneric FINAL : public LTemplateInstruction<1, 2, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001677 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001678 LLoadGlobalGeneric(LOperand* context, LOperand* global_object,
1679 LOperand* vector) {
1680 inputs_[0] = context;
1681 inputs_[1] = global_object;
1682 temps_[0] = vector;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001683 }
1684
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001685 LOperand* context() { return inputs_[0]; }
1686 LOperand* global_object() { return inputs_[1]; }
1687 LOperand* temp_vector() { return temps_[0]; }
1688
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001689 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1690 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1691
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001692 Handle<Object> name() const { return hydrogen()->name(); }
1693 bool for_typeof() const { return hydrogen()->for_typeof(); }
1694};
1695
1696
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001697class LStoreGlobalCell FINAL : public LTemplateInstruction<0, 1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001698 public:
1699 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1700 inputs_[0] = value;
1701 temps_[0] = temp;
1702 }
1703
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001704 LOperand* value() { return inputs_[0]; }
1705 LOperand* temp() { return temps_[0]; }
1706
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001707 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1708 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001709};
1710
1711
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001712class LLoadContextSlot FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001713 public:
1714 explicit LLoadContextSlot(LOperand* context) {
1715 inputs_[0] = context;
1716 }
1717
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001718 LOperand* context() { return inputs_[0]; }
1719
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001720 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1721 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1722
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001723 int slot_index() { return hydrogen()->slot_index(); }
1724
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001725 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001726};
1727
1728
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001729class LStoreContextSlot FINAL : public LTemplateInstruction<0, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001730 public:
1731 LStoreContextSlot(LOperand* context, LOperand* value) {
1732 inputs_[0] = context;
1733 inputs_[1] = value;
1734 }
1735
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001736 LOperand* context() { return inputs_[0]; }
1737 LOperand* value() { return inputs_[1]; }
1738
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001739 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1740 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1741
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001742 int slot_index() { return hydrogen()->slot_index(); }
1743
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001744 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001745};
1746
1747
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001748class LPushArgument FINAL : public LTemplateInstruction<0, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001749 public:
1750 explicit LPushArgument(LOperand* value) {
1751 inputs_[0] = value;
1752 }
1753
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001754 LOperand* value() { return inputs_[0]; }
1755
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001756 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1757};
1758
1759
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001760class 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
1773class 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 Bernierd0a1eb72015-03-24 16:35:39 -04001783 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001784
1785 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry, "store-code-entry")
1786 DECLARE_HYDROGEN_ACCESSOR(StoreCodeEntry)
1787};
1788
1789
1790class 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 Bernierd0a1eb72015-03-24 16:35:39 -04001800 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001801
1802 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "inner-allocated-object")
1803};
1804
1805
1806class LThisFunction FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001807 public:
1808 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1809 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1810};
1811
1812
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001813class LContext FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001814 public:
1815 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001816 DECLARE_HYDROGEN_ACCESSOR(Context)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001817};
1818
1819
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001820class LDeclareGlobals FINAL : public LTemplateInstruction<0, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001821 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001822 explicit LDeclareGlobals(LOperand* context) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001823 inputs_[0] = context;
1824 }
1825
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001826 LOperand* context() { return inputs_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001827
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001828 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1829 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1830};
1831
1832
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001833class LCallJSFunction FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001834 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001835 explicit LCallJSFunction(LOperand* function) {
1836 inputs_[0] = function;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001837 }
1838
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001839 LOperand* function() { return inputs_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001840
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001841 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function")
1842 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001843
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001844 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001845
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001846 int arity() const { return hydrogen()->argument_count() - 1; }
1847};
1848
1849
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001850class LCallWithDescriptor FINAL : public LTemplateResultInstruction<1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001851 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001852 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 Murdoch3ef787d2012-04-12 10:51:47 +01001858 }
1859
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001860 LOperand* target() const { return inputs_[0]; }
1861
1862 const CallInterfaceDescriptor descriptor() { return descriptor_; }
1863
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001864 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1865
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001866 private:
1867 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1868
1869 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001870
1871 int arity() const { return hydrogen()->argument_count() - 1; }
1872
1873 CallInterfaceDescriptor descriptor_;
1874 ZoneList<LOperand*> inputs_;
1875
1876 // Iterator support.
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001877 int InputCount() FINAL { return inputs_.length(); }
1878 LOperand* InputAt(int i) FINAL { return inputs_[i]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001879
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001880 int TempCount() FINAL { return 0; }
1881 LOperand* TempAt(int i) FINAL { return NULL; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001882};
1883
1884
1885class 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 Murdoch3ef787d2012-04-12 10:51:47 +01001895 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1896 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1897
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001898 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001899
1900 int arity() const { return hydrogen()->argument_count() - 1; }
1901};
1902
1903
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001904class LCallFunction FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001905 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001906 LCallFunction(LOperand* context, LOperand* function) {
1907 inputs_[0] = context;
1908 inputs_[1] = function;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001909 }
1910
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001911 LOperand* context() { return inputs_[0]; }
1912 LOperand* function() { return inputs_[1]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001913
1914 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1915 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1916
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001917 int arity() const { return hydrogen()->argument_count() - 1; }
1918};
1919
1920
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001921class LCallNew FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001922 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001923 LCallNew(LOperand* context, LOperand* constructor) {
1924 inputs_[0] = context;
1925 inputs_[1] = constructor;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001926 }
1927
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001928 LOperand* context() { return inputs_[0]; }
1929 LOperand* constructor() { return inputs_[1]; }
1930
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001931 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1932 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1933
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001934 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001935
1936 int arity() const { return hydrogen()->argument_count() - 1; }
1937};
1938
1939
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001940class LCallNewArray FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001941 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001942 LCallNewArray(LOperand* context, LOperand* constructor) {
1943 inputs_[0] = context;
1944 inputs_[1] = constructor;
1945 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001946
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001947 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 Bernierd0a1eb72015-03-24 16:35:39 -04001953 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001954
1955 int arity() const { return hydrogen()->argument_count() - 1; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001956};
1957
1958
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001959class 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 Bernierd0a1eb72015-03-24 16:35:39 -04001970 bool ClobbersDoubleRegisters(Isolate* isolate) const OVERRIDE {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001971 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
1980class LInteger32ToDouble FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001981 public:
1982 explicit LInteger32ToDouble(LOperand* value) {
1983 inputs_[0] = value;
1984 }
1985
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001986 LOperand* value() { return inputs_[0]; }
1987
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001988 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1989};
1990
1991
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001992class LUint32ToDouble FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001993 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001994 explicit LUint32ToDouble(LOperand* value) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001995 inputs_[0] = value;
1996 }
1997
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001998 LOperand* value() { return inputs_[0]; }
1999
2000 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
2001};
2002
2003
2004class 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 Murdoch3ef787d2012-04-12 10:51:47 +01002016 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
2017};
2018
2019
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002020class LNumberTagU FINAL : public LTemplateInstruction<1, 1, 2> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002021 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002022 LNumberTagU(LOperand* value, LOperand* temp1, LOperand* temp2) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002023 inputs_[0] = value;
2024 temps_[0] = temp1;
2025 temps_[1] = temp2;
2026 }
2027
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002028 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
2036class 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 Murdoch3ef787d2012-04-12 10:51:47 +01002048 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002049 DECLARE_HYDROGEN_ACCESSOR(Change)
2050};
2051
2052
2053class 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 Murdoch3ef787d2012-04-12 10:51:47 +01002065};
2066
2067
2068// Sometimes truncating conversion from a tagged value to an int32.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002069class LDoubleToI FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002070 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002071 explicit LDoubleToI(LOperand* value) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002072 inputs_[0] = value;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002073 }
2074
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002075 LOperand* value() { return inputs_[0]; }
2076
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002077 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 Murdochb8a8cc12014-11-26 15:28:44 +00002085class LTaggedToI FINAL : public LTemplateInstruction<1, 1, 2> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002086 public:
2087 LTaggedToI(LOperand* value,
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002088 LOperand* temp,
2089 LOperand* temp2) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002090 inputs_[0] = value;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002091 temps_[0] = temp;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002092 temps_[1] = temp2;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002093 }
2094
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002095 LOperand* value() { return inputs_[0]; }
2096 LOperand* temp() { return temps_[0]; }
2097 LOperand* temp2() { return temps_[1]; }
2098
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002099 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002100 DECLARE_HYDROGEN_ACCESSOR(Change)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002101
2102 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2103};
2104
2105
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002106class LSmiTag FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002107 public:
2108 explicit LSmiTag(LOperand* value) {
2109 inputs_[0] = value;
2110 }
2111
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002112 LOperand* value() { return inputs_[0]; }
2113
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002114 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002115 DECLARE_HYDROGEN_ACCESSOR(Change)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002116};
2117
2118
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002119class LNumberUntagD FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002120 public:
2121 explicit LNumberUntagD(LOperand* value) {
2122 inputs_[0] = value;
2123 }
2124
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002125 LOperand* value() { return inputs_[0]; }
2126
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002127 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2128 DECLARE_HYDROGEN_ACCESSOR(Change)
2129};
2130
2131
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002132class LSmiUntag FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002133 public:
2134 LSmiUntag(LOperand* value, bool needs_check)
2135 : needs_check_(needs_check) {
2136 inputs_[0] = value;
2137 }
2138
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002139 LOperand* value() { return inputs_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002140 bool needs_check() const { return needs_check_; }
2141
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002142 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2143
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002144 private:
2145 bool needs_check_;
2146};
2147
2148
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002149class LStoreNamedField FINAL : public LTemplateInstruction<0, 2, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002150 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002151 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2152 inputs_[0] = object;
2153 inputs_[1] = value;
2154 temps_[0] = temp;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002155 }
2156
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002157 LOperand* object() { return inputs_[0]; }
2158 LOperand* value() { return inputs_[1]; }
2159 LOperand* temp() { return temps_[0]; }
2160
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002161 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2162 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2163
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002164 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002165
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002166 Representation representation() const {
2167 return hydrogen()->field_representation();
2168 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002169};
2170
2171
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002172class LStoreNamedGeneric FINAL : public LTemplateInstruction<0, 3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002173 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002174 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value) {
2175 inputs_[0] = context;
2176 inputs_[1] = object;
2177 inputs_[2] = value;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002178 }
2179
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002180 LOperand* context() { return inputs_[0]; }
2181 LOperand* object() { return inputs_[1]; }
2182 LOperand* value() { return inputs_[2]; }
2183
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002184 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2185 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2186
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002187 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002188
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002189 Handle<Object> name() const { return hydrogen()->name(); }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002190 StrictMode strict_mode() { return hydrogen()->strict_mode(); }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002191};
2192
2193
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002194class LStoreKeyed FINAL : public LTemplateInstruction<0, 3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002195 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002196 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
2197 inputs_[0] = object;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002198 inputs_[1] = key;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002199 inputs_[2] = value;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002200 }
2201
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002202 bool is_external() const { return hydrogen()->is_external(); }
2203 bool is_fixed_typed_array() const {
2204 return hydrogen()->is_fixed_typed_array();
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002205 }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002206 bool is_typed_elements() const {
2207 return is_external() || is_fixed_typed_array();
2208 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002209 LOperand* elements() { return inputs_[0]; }
2210 LOperand* key() { return inputs_[1]; }
2211 LOperand* value() { return inputs_[2]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002212 ElementsKind elements_kind() const {
2213 return hydrogen()->elements_kind();
2214 }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002215
2216 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2217 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
2218
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002219 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002220 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
2221 uint32_t base_offset() const { return hydrogen()->base_offset(); }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002222};
2223
2224
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002225class 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 Bernierd0a1eb72015-03-24 16:35:39 -04002245 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002246
2247 StrictMode strict_mode() { return hydrogen()->strict_mode(); }
2248};
2249
2250
2251class LTransitionElementsKind FINAL : public LTemplateInstruction<0, 2, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002252 public:
2253 LTransitionElementsKind(LOperand* object,
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002254 LOperand* context,
2255 LOperand* new_map_temp) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002256 inputs_[0] = object;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002257 inputs_[1] = context;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002258 temps_[0] = new_map_temp;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002259 }
2260
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002261 LOperand* context() { return inputs_[1]; }
2262 LOperand* object() { return inputs_[0]; }
2263 LOperand* new_map_temp() { return temps_[0]; }
2264
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002265 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2266 "transition-elements-kind")
2267 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2268
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002269 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002270
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002271 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 Murdoch3ef787d2012-04-12 10:51:47 +01002277};
2278
2279
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002280class LTrapAllocationMemento FINAL : public LTemplateInstruction<0, 1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002281 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002282 LTrapAllocationMemento(LOperand* object,
2283 LOperand* temp) {
2284 inputs_[0] = object;
2285 temps_[0] = temp;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002286 }
2287
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002288 LOperand* object() { return inputs_[0]; }
2289 LOperand* temp() { return temps_[0]; }
2290
2291 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2292 "trap-allocation-memento")
2293};
2294
2295
2296class 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 Murdoch3ef787d2012-04-12 10:51:47 +01002308 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2309 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002310};
2311
2312
2313
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002314class LStringCharCodeAt FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002315 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002316 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) {
2317 inputs_[0] = context;
2318 inputs_[1] = string;
2319 inputs_[2] = index;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002320 }
2321
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002322 LOperand* context() { return inputs_[0]; }
2323 LOperand* string() { return inputs_[1]; }
2324 LOperand* index() { return inputs_[2]; }
2325
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002326 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2327 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002328};
2329
2330
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002331class LStringCharFromCode FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002332 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002333 explicit LStringCharFromCode(LOperand* context, LOperand* char_code) {
2334 inputs_[0] = context;
2335 inputs_[1] = char_code;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002336 }
2337
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002338 LOperand* context() { return inputs_[0]; }
2339 LOperand* char_code() { return inputs_[1]; }
2340
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002341 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2342 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002343};
2344
2345
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002346class LCheckValue FINAL : public LTemplateInstruction<0, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002347 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002348 explicit LCheckValue(LOperand* value) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002349 inputs_[0] = value;
2350 }
2351
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002352 LOperand* value() { return inputs_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002353
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002354 DECLARE_CONCRETE_INSTRUCTION(CheckValue, "check-value")
2355 DECLARE_HYDROGEN_ACCESSOR(CheckValue)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002356};
2357
2358
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002359class LCheckInstanceType FINAL : public LTemplateInstruction<0, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002360 public:
2361 explicit LCheckInstanceType(LOperand* value) {
2362 inputs_[0] = value;
2363 }
2364
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002365 LOperand* value() { return inputs_[0]; }
2366
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002367 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2368 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2369};
2370
2371
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002372class LCheckMaps FINAL : public LTemplateInstruction<0, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002373 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002374 explicit LCheckMaps(LOperand* value = NULL) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002375 inputs_[0] = value;
2376 }
2377
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002378 LOperand* value() { return inputs_[0]; }
2379
2380 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2381 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002382};
2383
2384
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002385class LCheckSmi FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002386 public:
2387 explicit LCheckSmi(LOperand* value) {
2388 inputs_[0] = value;
2389 }
2390
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002391 LOperand* value() { return inputs_[0]; }
2392
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002393 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2394};
2395
2396
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002397class LCheckNonSmi FINAL : public LTemplateInstruction<0, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002398 public:
2399 explicit LCheckNonSmi(LOperand* value) {
2400 inputs_[0] = value;
2401 }
2402
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002403 LOperand* value() { return inputs_[0]; }
2404
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002405 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002406 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002407};
2408
2409
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002410class LClampDToUint8 FINAL : public LTemplateInstruction<1, 1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002411 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002412 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2413 inputs_[0] = unclamped;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002414 temps_[0] = temp;
2415 }
2416
2417 LOperand* unclamped() { return inputs_[0]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002418 LOperand* temp() { return temps_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002419
2420 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2421};
2422
2423
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002424class LClampIToUint8 FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002425 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002426 explicit LClampIToUint8(LOperand* unclamped) {
2427 inputs_[0] = unclamped;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002428 }
2429
2430 LOperand* unclamped() { return inputs_[0]; }
2431
2432 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2433};
2434
2435
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002436class LClampTToUint8 FINAL : public LTemplateInstruction<1, 1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002437 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002438 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2439 inputs_[0] = unclamped;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002440 temps_[0] = temp;
2441 }
2442
2443 LOperand* unclamped() { return inputs_[0]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002444 LOperand* temp() { return temps_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002445
2446 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2447};
2448
2449
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002450class LDoubleBits FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002451 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002452 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
2463class 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
2477class 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 Murdoch3ef787d2012-04-12 10:51:47 +01002485 temps_[0] = temp1;
2486 temps_[1] = temp2;
2487 }
2488
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002489 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 Murdoch3ef787d2012-04-12 10:51:47 +01002496};
2497
2498
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002499class LRegExpLiteral FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002500 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002501 explicit LRegExpLiteral(LOperand* context) {
2502 inputs_[0] = context;
2503 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002504
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002505 LOperand* context() { return inputs_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002506
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002507 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2508 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2509};
2510
2511
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002512class LFunctionLiteral FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002513 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002514 explicit LFunctionLiteral(LOperand* context) {
2515 inputs_[0] = context;
2516 }
2517
2518 LOperand* context() { return inputs_[0]; }
2519
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002520 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2521 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002522};
2523
2524
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002525class LToFastProperties FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002526 public:
2527 explicit LToFastProperties(LOperand* value) {
2528 inputs_[0] = value;
2529 }
2530
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002531 LOperand* value() { return inputs_[0]; }
2532
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002533 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2534 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2535};
2536
2537
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002538class LTypeof FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002539 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002540 LTypeof(LOperand* context, LOperand* value) {
2541 inputs_[0] = context;
2542 inputs_[1] = value;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002543 }
2544
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002545 LOperand* context() { return inputs_[0]; }
2546 LOperand* value() { return inputs_[1]; }
2547
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002548 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2549};
2550
2551
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002552class LTypeofIsAndBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002553 public:
2554 explicit LTypeofIsAndBranch(LOperand* value) {
2555 inputs_[0] = value;
2556 }
2557
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002558 LOperand* value() { return inputs_[0]; }
2559
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002560 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 Bernierd0a1eb72015-03-24 16:35:39 -04002565 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002566};
2567
2568
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002569class LIsConstructCallAndBranch FINAL : public LControlInstruction<0, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002570 public:
2571 explicit LIsConstructCallAndBranch(LOperand* temp) {
2572 temps_[0] = temp;
2573 }
2574
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002575 LOperand* temp() { return temps_[0]; }
2576
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002577 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2578 "is-construct-call-and-branch")
2579};
2580
2581
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002582class LOsrEntry FINAL : public LTemplateInstruction<0, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002583 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002584 LOsrEntry() {}
2585
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002586 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE { return false; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002587 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2588};
2589
2590
2591class LStackCheck FINAL : public LTemplateInstruction<0, 1, 0> {
2592 public:
2593 explicit LStackCheck(LOperand* context) {
2594 inputs_[0] = context;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002595 }
2596
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002597 LOperand* context() { return inputs_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002598
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002599 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 Murdochb8a8cc12014-11-26 15:28:44 +00002609class LForInPrepareMap FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002610 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002611 LForInPrepareMap(LOperand* context, LOperand* object) {
2612 inputs_[0] = context;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002613 inputs_[1] = object;
2614 }
2615
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002616 LOperand* context() { return inputs_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002617 LOperand* object() { return inputs_[1]; }
2618
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002619 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2620};
2621
2622
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002623class LForInCacheArray FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002624 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 Murdochb8a8cc12014-11-26 15:28:44 +00002639class LCheckMapValue FINAL : public LTemplateInstruction<0, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002640 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 Murdochb8a8cc12014-11-26 15:28:44 +00002653class LLoadFieldByIndex FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002654 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 Murdochb8a8cc12014-11-26 15:28:44 +00002667class LStoreFrameContext: public LTemplateInstruction<0, 1, 0> {
Steve Block44f0eee2011-05-26 01:26:41 +01002668 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002669 explicit LStoreFrameContext(LOperand* context) {
2670 inputs_[0] = context;
Steve Block44f0eee2011-05-26 01:26:41 +01002671 }
2672
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002673 LOperand* context() { return inputs_[0]; }
Steve Block44f0eee2011-05-26 01:26:41 +01002674
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002675 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext, "store-frame-context")
Steve Block44f0eee2011-05-26 01:26:41 +01002676};
2677
2678
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002679class 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
2696class LChunkBuilder;
2697class 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
2707class LChunkBuilder FINAL : public LChunkBuilderBase {
Steve Block44f0eee2011-05-26 01:26:41 +01002708 public:
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002709 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002710 : LChunkBuilderBase(info, graph),
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002711 current_instruction_(NULL),
2712 current_block_(NULL),
2713 next_block_(NULL),
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002714 allocator_(allocator) {}
Steve Block44f0eee2011-05-26 01:26:41 +01002715
2716 // Build the sequence for the graph.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002717 LPlatformChunk* Build();
Ben Murdoch592a9fc2012-03-05 11:04:45 +00002718
Ben Murdoch85b71792012-04-11 18:30:58 +01002719 // Declare methods that deal with the individual node types.
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002720#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
Ben Murdoch85b71792012-04-11 18:30:58 +01002721 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2722#undef DECLARE_DO
Ben Murdoch592a9fc2012-03-05 11:04:45 +00002723
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002724 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 Murdoch3ef787d2012-04-12 10:51:47 +01002747 private:
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002748 // 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 Murdochb8a8cc12014-11-26 15:28:44 +00002784 // An input operand in a constant operand.
2785 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2786
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002787 // 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 Bernierd0a1eb72015-03-24 16:35:39 -04002789 MUST_USE_RESULT LOperand* UseAny(HValue* value) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002790
2791 // Temporary operand that must be in a register.
2792 MUST_USE_RESULT LUnallocated* TempRegister();
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002793 MUST_USE_RESULT LUnallocated* TempDoubleRegister();
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002794 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 Murdochb8a8cc12014-11-26 15:28:44 +00002799 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 Murdoch3ef787d2012-04-12 10:51:47 +01002809 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 Murdoch3ef787d2012-04-12 10:51:47 +01002821
2822 void VisitInstruction(HInstruction* current);
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002823 void AddInstruction(LInstruction* instr, HInstruction* current);
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002824
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 Murdochb8a8cc12014-11-26 15:28:44 +00002831 HBinaryOperation* instr);
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002832
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002833 HInstruction* current_instruction_;
2834 HBasicBlock* current_block_;
2835 HBasicBlock* next_block_;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002836 LAllocator* allocator_;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002837
Steve Block44f0eee2011-05-26 01:26:41 +01002838 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2839};
2840
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002841#undef DECLARE_HYDROGEN_ACCESSOR
2842#undef DECLARE_CONCRETE_INSTRUCTION
Steve Block44f0eee2011-05-26 01:26:41 +01002843
2844} } // namespace v8::internal
2845
2846#endif // V8_MIPS_LITHIUM_MIPS_H_