blob: 1920935e613cdb837a86c2e3540d10dca8d3db2a [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.
Ben Murdochb0fe1622011-05-05 13:52:32 +01004
5#ifndef V8_ARM_LITHIUM_ARM_H_
6#define V8_ARM_LITHIUM_ARM_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"
Ben Murdochb0fe1622011-05-05 13:52:32 +010013
14namespace v8 {
15namespace internal {
16
17// Forward declarations.
18class LCodeGen;
Ben Murdochb0fe1622011-05-05 13:52:32 +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(CheckNonSmi) \
42 V(CheckMaps) \
43 V(CheckMapValue) \
44 V(CheckSmi) \
45 V(CheckValue) \
46 V(ClampDToUint8) \
47 V(ClampIToUint8) \
48 V(ClampTToUint8) \
49 V(ClassOfTestAndBranch) \
50 V(CompareMinusZeroAndBranch) \
51 V(CompareNumericAndBranch) \
52 V(CmpObjectEqAndBranch) \
53 V(CmpHoleAndBranch) \
54 V(CmpMapAndBranch) \
55 V(CmpT) \
56 V(ConstantD) \
57 V(ConstantE) \
58 V(ConstantI) \
59 V(ConstantS) \
60 V(ConstantT) \
61 V(ConstructDouble) \
62 V(Context) \
63 V(DateField) \
64 V(DebugBreak) \
65 V(DeclareGlobals) \
66 V(Deoptimize) \
67 V(DivByConstI) \
68 V(DivByPowerOf2I) \
69 V(DivI) \
70 V(DoubleBits) \
71 V(DoubleToI) \
72 V(DoubleToSmi) \
73 V(Drop) \
74 V(Dummy) \
75 V(DummyUse) \
76 V(FlooringDivByConstI) \
77 V(FlooringDivByPowerOf2I) \
78 V(FlooringDivI) \
79 V(ForInCacheArray) \
80 V(ForInPrepareMap) \
81 V(FunctionLiteral) \
82 V(GetCachedArrayIndex) \
83 V(Goto) \
84 V(HasCachedArrayIndexAndBranch) \
85 V(HasInstanceTypeAndBranch) \
86 V(InnerAllocatedObject) \
87 V(InstanceOf) \
88 V(InstanceOfKnownGlobal) \
89 V(InstructionGap) \
90 V(Integer32ToDouble) \
91 V(InvokeFunction) \
92 V(IsConstructCallAndBranch) \
93 V(IsObjectAndBranch) \
94 V(IsStringAndBranch) \
95 V(IsSmiAndBranch) \
96 V(IsUndetectableAndBranch) \
97 V(Label) \
98 V(LazyBailout) \
99 V(LoadContextSlot) \
100 V(LoadRoot) \
101 V(LoadFieldByIndex) \
102 V(LoadFunctionPrototype) \
103 V(LoadGlobalCell) \
104 V(LoadGlobalGeneric) \
105 V(LoadKeyed) \
106 V(LoadKeyedGeneric) \
107 V(LoadNamedField) \
108 V(LoadNamedGeneric) \
109 V(MapEnumLength) \
110 V(MathAbs) \
111 V(MathClz32) \
112 V(MathExp) \
113 V(MathFloor) \
114 V(MathFround) \
115 V(MathLog) \
116 V(MathMinMax) \
117 V(MathPowHalf) \
118 V(MathRound) \
119 V(MathSqrt) \
120 V(ModByConstI) \
121 V(ModByPowerOf2I) \
122 V(ModI) \
123 V(MulI) \
124 V(MultiplyAddD) \
125 V(MultiplySubD) \
126 V(NumberTagD) \
127 V(NumberTagI) \
128 V(NumberTagU) \
129 V(NumberUntagD) \
130 V(OsrEntry) \
131 V(Parameter) \
132 V(Power) \
133 V(PushArgument) \
134 V(RegExpLiteral) \
135 V(Return) \
136 V(SeqStringGetChar) \
137 V(SeqStringSetChar) \
138 V(ShiftI) \
139 V(SmiTag) \
140 V(SmiUntag) \
141 V(StackCheck) \
142 V(StoreCodeEntry) \
143 V(StoreContextSlot) \
144 V(StoreFrameContext) \
145 V(StoreGlobalCell) \
146 V(StoreKeyed) \
147 V(StoreKeyedGeneric) \
148 V(StoreNamedField) \
149 V(StoreNamedGeneric) \
150 V(StringAdd) \
151 V(StringCharCodeAt) \
152 V(StringCharFromCode) \
153 V(StringCompareAndBranch) \
154 V(SubI) \
155 V(RSubI) \
156 V(TaggedToI) \
157 V(TailCallThroughMegamorphicCache) \
158 V(ThisFunction) \
159 V(ToFastProperties) \
160 V(TransitionElementsKind) \
161 V(TrapAllocationMemento) \
162 V(Typeof) \
163 V(TypeofIsAndBranch) \
164 V(Uint32ToDouble) \
165 V(UnknownOSRValue) \
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100166 V(WrapReceiver)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100167
168
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400169#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
170 Opcode opcode() const FINAL { return LInstruction::k##type; } \
171 void CompileToNative(LCodeGen* generator) FINAL; \
172 const char* Mnemonic() const FINAL { return mnemonic; } \
173 static L##type* cast(LInstruction* instr) { \
174 DCHECK(instr->Is##type()); \
175 return reinterpret_cast<L##type*>(instr); \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100176 }
177
178
Ben Murdochb0fe1622011-05-05 13:52:32 +0100179#define DECLARE_HYDROGEN_ACCESSOR(type) \
180 H##type* hydrogen() const { \
181 return H##type::cast(hydrogen_value()); \
182 }
183
184
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000185class LInstruction : public ZoneObject {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100186 public:
187 LInstruction()
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000188 : environment_(NULL),
189 hydrogen_value_(NULL),
190 bit_field_(IsCallBits::encode(false)) {
191 }
192
193 virtual ~LInstruction() {}
Ben Murdochb0fe1622011-05-05 13:52:32 +0100194
195 virtual void CompileToNative(LCodeGen* generator) = 0;
196 virtual const char* Mnemonic() const = 0;
Steve Block1e0659c2011-05-24 12:43:12 +0100197 virtual void PrintTo(StringStream* stream);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000198 virtual void PrintDataTo(StringStream* stream);
199 virtual void PrintOutputOperandTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100200
Ben Murdoch257744e2011-11-30 15:57:28 +0000201 enum Opcode {
202 // Declare a unique enum value for each instruction.
203#define DECLARE_OPCODE(type) k##type,
204 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
205 kNumberOfInstructions
206#undef DECLARE_OPCODE
207 };
208
209 virtual Opcode opcode() const = 0;
210
211 // Declare non-virtual type testers for all leaf IR classes.
212#define DECLARE_PREDICATE(type) \
213 bool Is##type() const { return opcode() == k##type; }
214 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
215#undef DECLARE_PREDICATE
216
217 // Declare virtual predicates for instructions that don't have
218 // an opcode.
219 virtual bool IsGap() const { return false; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100220
Steve Block1e0659c2011-05-24 12:43:12 +0100221 virtual bool IsControl() const { return false; }
Steve Block1e0659c2011-05-24 12:43:12 +0100222
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000223 // Try deleting this instruction if possible.
224 virtual bool TryDelete() { return false; }
225
Steve Block1e0659c2011-05-24 12:43:12 +0100226 void set_environment(LEnvironment* env) { environment_ = env; }
227 LEnvironment* environment() const { return environment_; }
228 bool HasEnvironment() const { return environment_ != NULL; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100229
230 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
231 LPointerMap* pointer_map() const { return pointer_map_.get(); }
232 bool HasPointerMap() const { return pointer_map_.is_set(); }
233
Ben Murdochb0fe1622011-05-05 13:52:32 +0100234 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
235 HValue* hydrogen_value() const { return hydrogen_value_; }
236
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000237 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100238
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000239 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); }
240 bool IsCall() const { return IsCallBits::decode(bit_field_); }
Steve Block1e0659c2011-05-24 12:43:12 +0100241
242 // Interface to the register allocator and iterators.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000243 bool ClobbersTemps() const { return IsCall(); }
244 bool ClobbersRegisters() const { return IsCall(); }
245 virtual bool ClobbersDoubleRegisters(Isolate* isolate) const {
246 return IsCall();
247 }
248
249 // Interface to the register allocator and iterators.
250 bool IsMarkedAsCall() const { return IsCall(); }
Steve Block1e0659c2011-05-24 12:43:12 +0100251
252 virtual bool HasResult() const = 0;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000253 virtual LOperand* result() const = 0;
Steve Block1e0659c2011-05-24 12:43:12 +0100254
255 LOperand* FirstInput() { return InputAt(0); }
256 LOperand* Output() { return HasResult() ? result() : NULL; }
257
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000258 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
259
Steve Block1e0659c2011-05-24 12:43:12 +0100260#ifdef DEBUG
261 void VerifyCall();
262#endif
263
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000264 virtual int InputCount() = 0;
265 virtual LOperand* InputAt(int i) = 0;
266
Ben Murdochb0fe1622011-05-05 13:52:32 +0100267 private:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000268 // Iterator support.
269 friend class InputIterator;
270
271 friend class TempIterator;
272 virtual int TempCount() = 0;
273 virtual LOperand* TempAt(int i) = 0;
274
275 class IsCallBits: public BitField<bool, 0, 1> {};
276
Steve Block1e0659c2011-05-24 12:43:12 +0100277 LEnvironment* environment_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100278 SetOncePointer<LPointerMap> pointer_map_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100279 HValue* hydrogen_value_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000280 int bit_field_;
281};
282
283
284// R = number of result operands (0 or 1).
285template<int R>
286class LTemplateResultInstruction : public LInstruction {
287 public:
288 // Allow 0 or 1 output operands.
289 STATIC_ASSERT(R == 0 || R == 1);
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400290 bool HasResult() const FINAL { return R != 0 && result() != NULL; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000291 void set_result(LOperand* operand) { results_[0] = operand; }
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400292 LOperand* result() const OVERRIDE { return results_[0]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000293
294 protected:
295 EmbeddedContainer<LOperand*, R> results_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100296};
297
298
Steve Block1e0659c2011-05-24 12:43:12 +0100299// R = number of result operands (0 or 1).
300// I = number of input operands.
301// T = number of temporary operands.
302template<int R, int I, int T>
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000303class LTemplateInstruction : public LTemplateResultInstruction<R> {
Steve Block1e0659c2011-05-24 12:43:12 +0100304 protected:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000305 EmbeddedContainer<LOperand*, I> inputs_;
306 EmbeddedContainer<LOperand*, T> temps_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000307
308 private:
309 // Iterator support.
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400310 int InputCount() FINAL { return I; }
311 LOperand* InputAt(int i) FINAL { return inputs_[i]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000312
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400313 int TempCount() FINAL { return T; }
314 LOperand* TempAt(int i) FINAL { return temps_[i]; }
Steve Block1e0659c2011-05-24 12:43:12 +0100315};
316
317
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000318class LGap : public LTemplateInstruction<0, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100319 public:
320 explicit LGap(HBasicBlock* block)
321 : block_(block) {
322 parallel_moves_[BEFORE] = NULL;
323 parallel_moves_[START] = NULL;
324 parallel_moves_[END] = NULL;
325 parallel_moves_[AFTER] = NULL;
326 }
327
Ben Murdoch257744e2011-11-30 15:57:28 +0000328 // Can't use the DECLARE-macro here because of sub-classes.
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400329 bool IsGap() const OVERRIDE { return true; }
330 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch257744e2011-11-30 15:57:28 +0000331 static LGap* cast(LInstruction* instr) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000332 DCHECK(instr->IsGap());
Ben Murdoch257744e2011-11-30 15:57:28 +0000333 return reinterpret_cast<LGap*>(instr);
334 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100335
336 bool IsRedundant() const;
337
338 HBasicBlock* block() const { return block_; }
339
340 enum InnerPosition {
341 BEFORE,
342 START,
343 END,
344 AFTER,
345 FIRST_INNER_POSITION = BEFORE,
346 LAST_INNER_POSITION = AFTER
347 };
348
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000349 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
350 if (parallel_moves_[pos] == NULL) {
351 parallel_moves_[pos] = new(zone) LParallelMove(zone);
352 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100353 return parallel_moves_[pos];
354 }
355
356 LParallelMove* GetParallelMove(InnerPosition pos) {
357 return parallel_moves_[pos];
358 }
359
360 private:
361 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
362 HBasicBlock* block_;
363};
364
365
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000366class LInstructionGap FINAL : public LGap {
Ben Murdoch257744e2011-11-30 15:57:28 +0000367 public:
368 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
369
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400370 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000371 return !IsRedundant();
372 }
373
Ben Murdoch257744e2011-11-30 15:57:28 +0000374 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
375};
376
377
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000378class LGoto FINAL : public LTemplateInstruction<0, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100379 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000380 explicit LGoto(HBasicBlock* block) : block_(block) { }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100381
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400382 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100383 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400384 void PrintDataTo(StringStream* stream) OVERRIDE;
385 bool IsControl() const OVERRIDE { return true; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100386
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000387 int block_id() const { return block_->block_id(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100388
389 private:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000390 HBasicBlock* block_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100391};
392
393
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000394class LLazyBailout FINAL : public LTemplateInstruction<0, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100395 public:
396 LLazyBailout() : gap_instructions_size_(0) { }
397
398 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
399
400 void set_gap_instructions_size(int gap_instructions_size) {
401 gap_instructions_size_ = gap_instructions_size;
402 }
403 int gap_instructions_size() { return gap_instructions_size_; }
404
405 private:
406 int gap_instructions_size_;
407};
408
409
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000410class LDummy FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100411 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000412 LDummy() {}
413 DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
Ben Murdochb0fe1622011-05-05 13:52:32 +0100414};
415
416
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000417class LDummyUse FINAL : public LTemplateInstruction<1, 1, 0> {
418 public:
419 explicit LDummyUse(LOperand* value) {
420 inputs_[0] = value;
421 }
422 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
423};
424
425
426class LDeoptimize FINAL : public LTemplateInstruction<0, 0, 0> {
427 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400428 bool IsControl() const OVERRIDE { return true; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000429 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
430 DECLARE_HYDROGEN_ACCESSOR(Deoptimize)
431};
432
433
434class LLabel FINAL : public LGap {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100435 public:
436 explicit LLabel(HBasicBlock* block)
437 : LGap(block), replacement_(NULL) { }
438
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400439 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE { return false; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100440 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
441
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400442 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100443
444 int block_id() const { return block()->block_id(); }
445 bool is_loop_header() const { return block()->IsLoopHeader(); }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000446 bool is_osr_entry() const { return block()->is_osr_entry(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100447 Label* label() { return &label_; }
448 LLabel* replacement() const { return replacement_; }
449 void set_replacement(LLabel* label) { replacement_ = label; }
450 bool HasReplacement() const { return replacement_ != NULL; }
451
452 private:
453 Label label_;
454 LLabel* replacement_;
455};
456
457
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000458class LParameter FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100459 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400460 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE { return false; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100461 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
462};
463
464
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000465class LCallStub FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100466 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000467 explicit LCallStub(LOperand* context) {
468 inputs_[0] = context;
469 }
470
471 LOperand* context() { return inputs_[0]; }
472
Ben Murdochb0fe1622011-05-05 13:52:32 +0100473 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
474 DECLARE_HYDROGEN_ACCESSOR(CallStub)
475};
476
477
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000478class LTailCallThroughMegamorphicCache FINAL
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400479 : public LTemplateInstruction<0, 5, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100480 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400481 LTailCallThroughMegamorphicCache(LOperand* context, LOperand* receiver,
482 LOperand* name, LOperand* slot,
483 LOperand* vector) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000484 inputs_[0] = context;
485 inputs_[1] = receiver;
486 inputs_[2] = name;
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400487 inputs_[3] = slot;
488 inputs_[4] = vector;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000489 }
490
491 LOperand* context() { return inputs_[0]; }
492 LOperand* receiver() { return inputs_[1]; }
493 LOperand* name() { return inputs_[2]; }
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400494 LOperand* slot() { return inputs_[3]; }
495 LOperand* vector() { return inputs_[4]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000496
497 DECLARE_CONCRETE_INSTRUCTION(TailCallThroughMegamorphicCache,
498 "tail-call-through-megamorphic-cache")
499 DECLARE_HYDROGEN_ACCESSOR(TailCallThroughMegamorphicCache)
500};
501
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400502
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000503class LUnknownOSRValue FINAL : public LTemplateInstruction<1, 0, 0> {
504 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400505 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE { return false; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100506 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
507};
508
509
Steve Block1e0659c2011-05-24 12:43:12 +0100510template<int I, int T>
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000511class LControlInstruction : public LTemplateInstruction<0, I, T> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100512 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000513 LControlInstruction() : false_label_(NULL), true_label_(NULL) { }
514
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400515 bool IsControl() const FINAL { return true; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100516
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000517 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
518 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000519
520 int TrueDestination(LChunk* chunk) {
521 return chunk->LookupDestination(true_block_id());
522 }
523 int FalseDestination(LChunk* chunk) {
524 return chunk->LookupDestination(false_block_id());
525 }
526
527 Label* TrueLabel(LChunk* chunk) {
528 if (true_label_ == NULL) {
529 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk));
530 }
531 return true_label_;
532 }
533 Label* FalseLabel(LChunk* chunk) {
534 if (false_label_ == NULL) {
535 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk));
536 }
537 return false_label_;
538 }
539
540 protected:
541 int true_block_id() { return SuccessorAt(0)->block_id(); }
542 int false_block_id() { return SuccessorAt(1)->block_id(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100543
544 private:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000545 HControlInstruction* hydrogen() {
546 return HControlInstruction::cast(this->hydrogen_value());
547 }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000548
549 Label* false_label_;
550 Label* true_label_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100551};
552
553
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000554class LWrapReceiver FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100555 public:
556 LWrapReceiver(LOperand* receiver, LOperand* function) {
557 inputs_[0] = receiver;
558 inputs_[1] = function;
559 }
560
561 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000562 DECLARE_HYDROGEN_ACCESSOR(WrapReceiver)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100563
564 LOperand* receiver() { return inputs_[0]; }
565 LOperand* function() { return inputs_[1]; }
566};
567
568
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000569class LApplyArguments FINAL : public LTemplateInstruction<1, 4, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100570 public:
571 LApplyArguments(LOperand* function,
572 LOperand* receiver,
573 LOperand* length,
Steve Block1e0659c2011-05-24 12:43:12 +0100574 LOperand* elements) {
575 inputs_[0] = function;
576 inputs_[1] = receiver;
577 inputs_[2] = length;
578 inputs_[3] = elements;
579 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100580
581 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
582
Steve Block1e0659c2011-05-24 12:43:12 +0100583 LOperand* function() { return inputs_[0]; }
584 LOperand* receiver() { return inputs_[1]; }
585 LOperand* length() { return inputs_[2]; }
586 LOperand* elements() { return inputs_[3]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100587};
588
589
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000590class LAccessArgumentsAt FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100591 public:
Steve Block1e0659c2011-05-24 12:43:12 +0100592 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
593 inputs_[0] = arguments;
594 inputs_[1] = length;
595 inputs_[2] = index;
596 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100597
598 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
599
Steve Block1e0659c2011-05-24 12:43:12 +0100600 LOperand* arguments() { return inputs_[0]; }
601 LOperand* length() { return inputs_[1]; }
602 LOperand* index() { return inputs_[2]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100603
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400604 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100605};
606
607
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000608class LArgumentsLength FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100609 public:
Steve Block1e0659c2011-05-24 12:43:12 +0100610 explicit LArgumentsLength(LOperand* elements) {
611 inputs_[0] = elements;
612 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100613
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000614 LOperand* elements() { return inputs_[0]; }
615
Ben Murdochb0fe1622011-05-05 13:52:32 +0100616 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
617};
618
619
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000620class LArgumentsElements FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100621 public:
Ben Murdochb0fe1622011-05-05 13:52:32 +0100622 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000623 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100624};
625
626
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000627class LModByPowerOf2I FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100628 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000629 LModByPowerOf2I(LOperand* dividend, int32_t divisor) {
630 inputs_[0] = dividend;
631 divisor_ = divisor;
Steve Block44f0eee2011-05-26 01:26:41 +0100632 }
633
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000634 LOperand* dividend() { return inputs_[0]; }
635 int32_t divisor() const { return divisor_; }
636
637 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
638 DECLARE_HYDROGEN_ACCESSOR(Mod)
639
640 private:
641 int32_t divisor_;
642};
643
644
645class LModByConstI FINAL : public LTemplateInstruction<1, 1, 0> {
646 public:
647 LModByConstI(LOperand* dividend, int32_t divisor) {
648 inputs_[0] = dividend;
649 divisor_ = divisor;
650 }
651
652 LOperand* dividend() { return inputs_[0]; }
653 int32_t divisor() const { return divisor_; }
654
655 DECLARE_CONCRETE_INSTRUCTION(ModByConstI, "mod-by-const-i")
656 DECLARE_HYDROGEN_ACCESSOR(Mod)
657
658 private:
659 int32_t divisor_;
660};
661
662
663class LModI FINAL : public LTemplateInstruction<1, 2, 2> {
664 public:
665 LModI(LOperand* left, LOperand* right, LOperand* temp, LOperand* temp2) {
Steve Block44f0eee2011-05-26 01:26:41 +0100666 inputs_[0] = left;
667 inputs_[1] = right;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000668 temps_[0] = temp;
Steve Block44f0eee2011-05-26 01:26:41 +0100669 temps_[1] = temp2;
Steve Block1e0659c2011-05-24 12:43:12 +0100670 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100671
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000672 LOperand* left() { return inputs_[0]; }
673 LOperand* right() { return inputs_[1]; }
674 LOperand* temp() { return temps_[0]; }
675 LOperand* temp2() { return temps_[1]; }
676
Ben Murdochb0fe1622011-05-05 13:52:32 +0100677 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
678 DECLARE_HYDROGEN_ACCESSOR(Mod)
679};
680
681
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000682class LDivByPowerOf2I FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100683 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000684 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
685 inputs_[0] = dividend;
686 divisor_ = divisor;
Steve Block1e0659c2011-05-24 12:43:12 +0100687 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100688
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000689 LOperand* dividend() { return inputs_[0]; }
690 int32_t divisor() const { return divisor_; }
691
692 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
Ben Murdochb0fe1622011-05-05 13:52:32 +0100693 DECLARE_HYDROGEN_ACCESSOR(Div)
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000694
695 private:
696 int32_t divisor_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100697};
698
699
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000700class LDivByConstI FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100701 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000702 LDivByConstI(LOperand* dividend, int32_t divisor) {
703 inputs_[0] = dividend;
704 divisor_ = divisor;
705 }
706
707 LOperand* dividend() { return inputs_[0]; }
708 int32_t divisor() const { return divisor_; }
709
710 DECLARE_CONCRETE_INSTRUCTION(DivByConstI, "div-by-const-i")
711 DECLARE_HYDROGEN_ACCESSOR(Div)
712
713 private:
714 int32_t divisor_;
715};
716
717
718class LDivI FINAL : public LTemplateInstruction<1, 2, 1> {
719 public:
720 LDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
721 inputs_[0] = dividend;
722 inputs_[1] = divisor;
Steve Block1e0659c2011-05-24 12:43:12 +0100723 temps_[0] = temp;
724 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100725
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000726 LOperand* dividend() { return inputs_[0]; }
727 LOperand* divisor() { return inputs_[1]; }
728 LOperand* temp() { return temps_[0]; }
729
730 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
731 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
732};
733
734
735class LFlooringDivByPowerOf2I FINAL : public LTemplateInstruction<1, 1, 0> {
736 public:
737 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
738 inputs_[0] = dividend;
739 divisor_ = divisor;
740 }
741
742 LOperand* dividend() { return inputs_[0]; }
743 int32_t divisor() { return divisor_; }
744
745 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
746 "flooring-div-by-power-of-2-i")
747 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
748
749 private:
750 int32_t divisor_;
751};
752
753
754class LFlooringDivByConstI FINAL : public LTemplateInstruction<1, 1, 2> {
755 public:
756 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) {
757 inputs_[0] = dividend;
758 divisor_ = divisor;
759 temps_[0] = temp;
760 }
761
762 LOperand* dividend() { return inputs_[0]; }
763 int32_t divisor() const { return divisor_; }
764 LOperand* temp() { return temps_[0]; }
765
766 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
767 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
768
769 private:
770 int32_t divisor_;
771};
772
773
774class LFlooringDivI FINAL : public LTemplateInstruction<1, 2, 1> {
775 public:
776 LFlooringDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
777 inputs_[0] = dividend;
778 inputs_[1] = divisor;
779 temps_[0] = temp;
780 }
781
782 LOperand* dividend() { return inputs_[0]; }
783 LOperand* divisor() { return inputs_[1]; }
784 LOperand* temp() { return temps_[0]; }
785
786 DECLARE_CONCRETE_INSTRUCTION(FlooringDivI, "flooring-div-i")
787 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
788};
789
790
791class LMulI FINAL : public LTemplateInstruction<1, 2, 0> {
792 public:
793 LMulI(LOperand* left, LOperand* right) {
794 inputs_[0] = left;
795 inputs_[1] = right;
796 }
797
798 LOperand* left() { return inputs_[0]; }
799 LOperand* right() { return inputs_[1]; }
800
Ben Murdochb0fe1622011-05-05 13:52:32 +0100801 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
802 DECLARE_HYDROGEN_ACCESSOR(Mul)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100803};
804
805
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000806// Instruction for computing multiplier * multiplicand + addend.
807class LMultiplyAddD FINAL : public LTemplateInstruction<1, 3, 0> {
Steve Block1e0659c2011-05-24 12:43:12 +0100808 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000809 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
810 LOperand* multiplicand) {
811 inputs_[0] = addend;
812 inputs_[1] = multiplier;
813 inputs_[2] = multiplicand;
814 }
815
816 LOperand* addend() { return inputs_[0]; }
817 LOperand* multiplier() { return inputs_[1]; }
818 LOperand* multiplicand() { return inputs_[2]; }
819
820 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
821};
822
823
824// Instruction for computing minuend - multiplier * multiplicand.
825class LMultiplySubD FINAL : public LTemplateInstruction<1, 3, 0> {
826 public:
827 LMultiplySubD(LOperand* minuend, LOperand* multiplier,
828 LOperand* multiplicand) {
829 inputs_[0] = minuend;
830 inputs_[1] = multiplier;
831 inputs_[2] = multiplicand;
832 }
833
834 LOperand* minuend() { return inputs_[0]; }
835 LOperand* multiplier() { return inputs_[1]; }
836 LOperand* multiplicand() { return inputs_[2]; }
837
838 DECLARE_CONCRETE_INSTRUCTION(MultiplySubD, "multiply-sub-d")
839};
840
841
842class LDebugBreak FINAL : public LTemplateInstruction<0, 0, 0> {
843 public:
844 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
845};
846
847
848class LCompareNumericAndBranch FINAL : public LControlInstruction<2, 0> {
849 public:
850 LCompareNumericAndBranch(LOperand* left, LOperand* right) {
Steve Block1e0659c2011-05-24 12:43:12 +0100851 inputs_[0] = left;
852 inputs_[1] = right;
853 }
854
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000855 LOperand* left() { return inputs_[0]; }
856 LOperand* right() { return inputs_[1]; }
857
858 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch,
859 "compare-numeric-and-branch")
860 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100861
Ben Murdochb8e0da22011-05-16 14:20:40 +0100862 Token::Value op() const { return hydrogen()->token(); }
863 bool is_double() const {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000864 return hydrogen()->representation().IsDouble();
Ben Murdochb8e0da22011-05-16 14:20:40 +0100865 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100866
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400867 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100868};
869
870
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000871class LMathFloor FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100872 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000873 explicit LMathFloor(LOperand* value) {
874 inputs_[0] = value;
875 }
876
877 LOperand* value() { return inputs_[0]; }
878
879 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
880 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
881};
882
883
884class LMathRound FINAL : public LTemplateInstruction<1, 1, 1> {
885 public:
886 LMathRound(LOperand* value, LOperand* temp) {
Steve Block1e0659c2011-05-24 12:43:12 +0100887 inputs_[0] = value;
888 temps_[0] = temp;
889 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100890
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000891 LOperand* value() { return inputs_[0]; }
892 LOperand* temp() { return temps_[0]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100893
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000894 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
895 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100896};
897
898
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000899class LMathFround FINAL : public LTemplateInstruction<1, 1, 0> {
900 public:
901 explicit LMathFround(LOperand* value) { inputs_[0] = value; }
902
903 LOperand* value() { return inputs_[0]; }
904
905 DECLARE_CONCRETE_INSTRUCTION(MathFround, "math-fround")
906};
907
908
909class LMathAbs FINAL : public LTemplateInstruction<1, 2, 0> {
910 public:
911 LMathAbs(LOperand* context, LOperand* value) {
912 inputs_[1] = context;
913 inputs_[0] = value;
914 }
915
916 LOperand* context() { return inputs_[1]; }
917 LOperand* value() { return inputs_[0]; }
918
919 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
920 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
921};
922
923
924class LMathLog FINAL : public LTemplateInstruction<1, 1, 0> {
925 public:
926 explicit LMathLog(LOperand* value) {
927 inputs_[0] = value;
928 }
929
930 LOperand* value() { return inputs_[0]; }
931
932 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
933};
934
935
936class LMathClz32 FINAL : public LTemplateInstruction<1, 1, 0> {
937 public:
938 explicit LMathClz32(LOperand* value) {
939 inputs_[0] = value;
940 }
941
942 LOperand* value() { return inputs_[0]; }
943
944 DECLARE_CONCRETE_INSTRUCTION(MathClz32, "math-clz32")
945};
946
947
948class LMathExp FINAL : public LTemplateInstruction<1, 1, 3> {
949 public:
950 LMathExp(LOperand* value,
951 LOperand* double_temp,
952 LOperand* temp1,
953 LOperand* temp2) {
954 inputs_[0] = value;
955 temps_[0] = temp1;
956 temps_[1] = temp2;
957 temps_[2] = double_temp;
958 ExternalReference::InitializeMathExpData();
959 }
960
961 LOperand* value() { return inputs_[0]; }
962 LOperand* temp1() { return temps_[0]; }
963 LOperand* temp2() { return temps_[1]; }
964 LOperand* double_temp() { return temps_[2]; }
965
966 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
967};
968
969
970class LMathSqrt FINAL : public LTemplateInstruction<1, 1, 0> {
971 public:
972 explicit LMathSqrt(LOperand* value) {
973 inputs_[0] = value;
974 }
975
976 LOperand* value() { return inputs_[0]; }
977
978 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
979};
980
981
982class LMathPowHalf FINAL : public LTemplateInstruction<1, 1, 0> {
983 public:
984 explicit LMathPowHalf(LOperand* value) {
985 inputs_[0] = value;
986 }
987
988 LOperand* value() { return inputs_[0]; }
989
990 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
991};
992
993
994class LCmpObjectEqAndBranch FINAL : public LControlInstruction<2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100995 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000996 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
Steve Block1e0659c2011-05-24 12:43:12 +0100997 inputs_[0] = left;
998 inputs_[1] = right;
999 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001000
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001001 LOperand* left() { return inputs_[0]; }
1002 LOperand* right() { return inputs_[1]; }
1003
1004 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001005 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001006};
1007
1008
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001009class LCmpHoleAndBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001010 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001011 explicit LCmpHoleAndBranch(LOperand* object) {
1012 inputs_[0] = object;
Steve Block1e0659c2011-05-24 12:43:12 +01001013 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001014
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001015 LOperand* object() { return inputs_[0]; }
1016
1017 DECLARE_CONCRETE_INSTRUCTION(CmpHoleAndBranch, "cmp-hole-and-branch")
1018 DECLARE_HYDROGEN_ACCESSOR(CompareHoleAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001019};
1020
1021
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001022class LCompareMinusZeroAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001023 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001024 LCompareMinusZeroAndBranch(LOperand* value, LOperand* temp) {
Steve Block1e0659c2011-05-24 12:43:12 +01001025 inputs_[0] = value;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001026 temps_[0] = temp;
Steve Block1e0659c2011-05-24 12:43:12 +01001027 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001028
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001029 LOperand* value() { return inputs_[0]; }
1030 LOperand* temp() { return temps_[0]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001031
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001032 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch,
1033 "cmp-minus-zero-and-branch")
1034 DECLARE_HYDROGEN_ACCESSOR(CompareMinusZeroAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001035};
1036
1037
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001038class LIsObjectAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001039 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001040 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
1041 inputs_[0] = value;
1042 temps_[0] = temp;
1043 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001044
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001045 LOperand* value() { return inputs_[0]; }
1046 LOperand* temp() { return temps_[0]; }
1047
Ben Murdochb0fe1622011-05-05 13:52:32 +01001048 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001049 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001050
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001051 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001052};
1053
1054
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001055class LIsStringAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001056 public:
1057 LIsStringAndBranch(LOperand* value, LOperand* temp) {
1058 inputs_[0] = value;
1059 temps_[0] = temp;
1060 }
1061
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001062 LOperand* value() { return inputs_[0]; }
1063 LOperand* temp() { return temps_[0]; }
1064
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001065 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
1066 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
1067
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001068 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001069};
1070
1071
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001072class LIsSmiAndBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001073 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001074 explicit LIsSmiAndBranch(LOperand* value) {
1075 inputs_[0] = value;
1076 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001077
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001078 LOperand* value() { return inputs_[0]; }
1079
Ben Murdochb0fe1622011-05-05 13:52:32 +01001080 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001081 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001082
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001083 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001084};
1085
1086
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001087class LIsUndetectableAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdoch257744e2011-11-30 15:57:28 +00001088 public:
1089 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
1090 inputs_[0] = value;
1091 temps_[0] = temp;
1092 }
1093
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001094 LOperand* value() { return inputs_[0]; }
1095 LOperand* temp() { return temps_[0]; }
1096
Ben Murdoch257744e2011-11-30 15:57:28 +00001097 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
1098 "is-undetectable-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001099 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
Ben Murdoch257744e2011-11-30 15:57:28 +00001100
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001101 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch257744e2011-11-30 15:57:28 +00001102};
1103
1104
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001105class LStringCompareAndBranch FINAL : public LControlInstruction<3, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001106 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001107 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) {
1108 inputs_[0] = context;
1109 inputs_[1] = left;
1110 inputs_[2] = right;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001111 }
1112
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001113 LOperand* context() { return inputs_[0]; }
1114 LOperand* left() { return inputs_[1]; }
1115 LOperand* right() { return inputs_[2]; }
1116
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001117 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
1118 "string-compare-and-branch")
1119 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
1120
1121 Token::Value op() const { return hydrogen()->token(); }
1122
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001123 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001124};
1125
1126
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001127class LHasInstanceTypeAndBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001128 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001129 explicit LHasInstanceTypeAndBranch(LOperand* value) {
1130 inputs_[0] = value;
1131 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001132
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001133 LOperand* value() { return inputs_[0]; }
1134
Ben Murdochb0fe1622011-05-05 13:52:32 +01001135 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
1136 "has-instance-type-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001137 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001138
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001139 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001140};
1141
1142
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001143class LGetCachedArrayIndex FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001144 public:
1145 explicit LGetCachedArrayIndex(LOperand* value) {
1146 inputs_[0] = value;
1147 }
1148
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001149 LOperand* value() { return inputs_[0]; }
1150
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001151 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
1152 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
1153};
1154
1155
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001156class LHasCachedArrayIndexAndBranch FINAL
1157 : public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001158 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001159 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
1160 inputs_[0] = value;
1161 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001162
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001163 LOperand* value() { return inputs_[0]; }
1164
Ben Murdochb0fe1622011-05-05 13:52:32 +01001165 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
1166 "has-cached-array-index-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001167 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001168
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001169 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001170};
1171
1172
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001173class LClassOfTestAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001174 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001175 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
1176 inputs_[0] = value;
1177 temps_[0] = temp;
1178 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001179
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001180 LOperand* value() { return inputs_[0]; }
1181 LOperand* temp() { return temps_[0]; }
1182
Ben Murdochb0fe1622011-05-05 13:52:32 +01001183 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1184 "class-of-test-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001185 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001186
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001187 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001188};
1189
1190
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001191class LCmpT FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001192 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001193 LCmpT(LOperand* context, LOperand* left, LOperand* right) {
1194 inputs_[0] = context;
1195 inputs_[1] = left;
1196 inputs_[2] = right;
Steve Block1e0659c2011-05-24 12:43:12 +01001197 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001198
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001199 LOperand* context() { return inputs_[0]; }
1200 LOperand* left() { return inputs_[1]; }
1201 LOperand* right() { return inputs_[2]; }
1202
Ben Murdochb0fe1622011-05-05 13:52:32 +01001203 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001204 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001205
Steve Block1e0659c2011-05-24 12:43:12 +01001206 Token::Value op() const { return hydrogen()->token(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001207};
1208
1209
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001210class LInstanceOf FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001211 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001212 LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
1213 inputs_[0] = context;
1214 inputs_[1] = left;
1215 inputs_[2] = right;
Steve Block1e0659c2011-05-24 12:43:12 +01001216 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001217
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001218 LOperand* context() { return inputs_[0]; }
1219 LOperand* left() { return inputs_[1]; }
1220 LOperand* right() { return inputs_[2]; }
1221
Ben Murdochb0fe1622011-05-05 13:52:32 +01001222 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1223};
1224
1225
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001226class LInstanceOfKnownGlobal FINAL : public LTemplateInstruction<1, 2, 1> {
Ben Murdoch086aeea2011-05-13 15:57:08 +01001227 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001228 LInstanceOfKnownGlobal(LOperand* context, LOperand* value, LOperand* temp) {
1229 inputs_[0] = context;
1230 inputs_[1] = value;
Steve Block1e0659c2011-05-24 12:43:12 +01001231 temps_[0] = temp;
1232 }
Ben Murdoch086aeea2011-05-13 15:57:08 +01001233
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001234 LOperand* context() { return inputs_[0]; }
1235 LOperand* value() { return inputs_[1]; }
1236 LOperand* temp() { return temps_[0]; }
1237
Ben Murdoch086aeea2011-05-13 15:57:08 +01001238 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1239 "instance-of-known-global")
1240 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1241
1242 Handle<JSFunction> function() const { return hydrogen()->function(); }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001243 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
1244 return lazy_deopt_env_;
1245 }
1246 virtual void SetDeferredLazyDeoptimizationEnvironment(
1247 LEnvironment* env) OVERRIDE {
1248 lazy_deopt_env_ = env;
1249 }
1250
1251 private:
1252 LEnvironment* lazy_deopt_env_;
Ben Murdoch086aeea2011-05-13 15:57:08 +01001253};
1254
1255
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001256class LBoundsCheck FINAL : public LTemplateInstruction<0, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001257 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001258 LBoundsCheck(LOperand* index, LOperand* length) {
1259 inputs_[0] = index;
1260 inputs_[1] = length;
1261 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001262
Steve Block1e0659c2011-05-24 12:43:12 +01001263 LOperand* index() { return inputs_[0]; }
1264 LOperand* length() { return inputs_[1]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001265
1266 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001267 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001268};
1269
1270
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001271class LBitI FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001272 public:
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001273 LBitI(LOperand* left, LOperand* right) {
Steve Block1e0659c2011-05-24 12:43:12 +01001274 inputs_[0] = left;
1275 inputs_[1] = right;
1276 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001277
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001278 LOperand* left() { return inputs_[0]; }
1279 LOperand* right() { return inputs_[1]; }
1280
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001281 Token::Value op() const { return hydrogen()->op(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001282
1283 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001284 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001285};
1286
1287
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001288class LShiftI FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001289 public:
1290 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
Steve Block1e0659c2011-05-24 12:43:12 +01001291 : op_(op), can_deopt_(can_deopt) {
1292 inputs_[0] = left;
1293 inputs_[1] = right;
1294 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001295
1296 Token::Value op() const { return op_; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001297 LOperand* left() { return inputs_[0]; }
1298 LOperand* right() { return inputs_[1]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001299 bool can_deopt() const { return can_deopt_; }
1300
1301 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1302
1303 private:
1304 Token::Value op_;
1305 bool can_deopt_;
1306};
1307
1308
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001309class LSubI FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001310 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001311 LSubI(LOperand* left, LOperand* right) {
1312 inputs_[0] = left;
1313 inputs_[1] = right;
1314 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001315
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001316 LOperand* left() { return inputs_[0]; }
1317 LOperand* right() { return inputs_[1]; }
1318
Ben Murdochb0fe1622011-05-05 13:52:32 +01001319 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1320 DECLARE_HYDROGEN_ACCESSOR(Sub)
1321};
1322
1323
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001324class LRSubI FINAL : public LTemplateInstruction<1, 2, 0> {
1325 public:
1326 LRSubI(LOperand* left, LOperand* right) {
1327 inputs_[0] = left;
1328 inputs_[1] = right;
1329 }
1330
1331 LOperand* left() { return inputs_[0]; }
1332 LOperand* right() { return inputs_[1]; }
1333
1334 DECLARE_CONCRETE_INSTRUCTION(RSubI, "rsub-i")
1335 DECLARE_HYDROGEN_ACCESSOR(Sub)
1336};
1337
1338
1339class LConstantI FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001340 public:
Ben Murdochb0fe1622011-05-05 13:52:32 +01001341 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
Steve Block1e0659c2011-05-24 12:43:12 +01001342 DECLARE_HYDROGEN_ACCESSOR(Constant)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001343
Steve Block1e0659c2011-05-24 12:43:12 +01001344 int32_t value() const { return hydrogen()->Integer32Value(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001345};
1346
1347
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001348class LConstantS FINAL : public LTemplateInstruction<1, 0, 0> {
1349 public:
1350 DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s")
1351 DECLARE_HYDROGEN_ACCESSOR(Constant)
1352
1353 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); }
1354};
1355
1356
1357class LConstantD FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001358 public:
Ben Murdochb0fe1622011-05-05 13:52:32 +01001359 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
Steve Block1e0659c2011-05-24 12:43:12 +01001360 DECLARE_HYDROGEN_ACCESSOR(Constant)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001361
Steve Block1e0659c2011-05-24 12:43:12 +01001362 double value() const { return hydrogen()->DoubleValue(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001363};
1364
1365
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001366class LConstantE FINAL : public LTemplateInstruction<1, 0, 0> {
1367 public:
1368 DECLARE_CONCRETE_INSTRUCTION(ConstantE, "constant-e")
1369 DECLARE_HYDROGEN_ACCESSOR(Constant)
1370
1371 ExternalReference value() const {
1372 return hydrogen()->ExternalReferenceValue();
1373 }
1374};
1375
1376
1377class LConstantT FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001378 public:
Ben Murdochb0fe1622011-05-05 13:52:32 +01001379 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
Steve Block1e0659c2011-05-24 12:43:12 +01001380 DECLARE_HYDROGEN_ACCESSOR(Constant)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001381
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001382 Handle<Object> value(Isolate* isolate) const {
1383 return hydrogen()->handle(isolate);
1384 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001385};
1386
1387
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001388class LBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001389 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001390 explicit LBranch(LOperand* value) {
1391 inputs_[0] = value;
1392 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001393
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001394 LOperand* value() { return inputs_[0]; }
1395
Ben Murdochb0fe1622011-05-05 13:52:32 +01001396 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001397 DECLARE_HYDROGEN_ACCESSOR(Branch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001398
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001399 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001400};
1401
1402
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001403class LCmpMapAndBranch FINAL : public LControlInstruction<1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001404 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001405 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1406 inputs_[0] = value;
1407 temps_[0] = temp;
1408 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001409
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001410 LOperand* value() { return inputs_[0]; }
1411 LOperand* temp() { return temps_[0]; }
1412
Ben Murdochb0fe1622011-05-05 13:52:32 +01001413 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
Steve Block1e0659c2011-05-24 12:43:12 +01001414 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001415
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001416 Handle<Map> map() const { return hydrogen()->map().handle(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001417};
1418
1419
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001420class LMapEnumLength FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001421 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001422 explicit LMapEnumLength(LOperand* value) {
Steve Block1e0659c2011-05-24 12:43:12 +01001423 inputs_[0] = value;
1424 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001425
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001426 LOperand* value() { return inputs_[0]; }
1427
1428 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
Steve Block9fac8402011-05-12 15:51:54 +01001429};
Ben Murdochb0fe1622011-05-05 13:52:32 +01001430
Ben Murdochb0fe1622011-05-05 13:52:32 +01001431
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001432class LDateField FINAL : public LTemplateInstruction<1, 1, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001433 public:
1434 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1435 inputs_[0] = date;
1436 temps_[0] = temp;
1437 }
1438
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001439 LOperand* date() { return inputs_[0]; }
1440 LOperand* temp() { return temps_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001441 Smi* index() const { return index_; }
1442
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001443 DECLARE_CONCRETE_INSTRUCTION(DateField, "date-field")
1444 DECLARE_HYDROGEN_ACCESSOR(DateField)
1445
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001446 private:
1447 Smi* index_;
1448};
1449
1450
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001451class LSeqStringGetChar FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001452 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001453 LSeqStringGetChar(LOperand* string, LOperand* index) {
1454 inputs_[0] = string;
1455 inputs_[1] = index;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001456 }
1457
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001458 LOperand* string() const { return inputs_[0]; }
1459 LOperand* index() const { return inputs_[1]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001460
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001461 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar, "seq-string-get-char")
1462 DECLARE_HYDROGEN_ACCESSOR(SeqStringGetChar)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001463};
1464
1465
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001466class LSeqStringSetChar FINAL : public LTemplateInstruction<1, 4, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001467 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001468 LSeqStringSetChar(LOperand* context,
1469 LOperand* string,
1470 LOperand* index,
1471 LOperand* value) {
1472 inputs_[0] = context;
1473 inputs_[1] = string;
1474 inputs_[2] = index;
1475 inputs_[3] = value;
Steve Block1e0659c2011-05-24 12:43:12 +01001476 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001477
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001478 LOperand* string() { return inputs_[1]; }
1479 LOperand* index() { return inputs_[2]; }
1480 LOperand* value() { return inputs_[3]; }
1481
1482 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1483 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001484};
1485
1486
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001487class LAddI FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001488 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001489 LAddI(LOperand* left, LOperand* right) {
1490 inputs_[0] = left;
1491 inputs_[1] = right;
1492 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001493
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001494 LOperand* left() { return inputs_[0]; }
1495 LOperand* right() { return inputs_[1]; }
1496
Ben Murdochb0fe1622011-05-05 13:52:32 +01001497 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1498 DECLARE_HYDROGEN_ACCESSOR(Add)
1499};
1500
1501
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001502class LMathMinMax FINAL : public LTemplateInstruction<1, 2, 0> {
1503 public:
1504 LMathMinMax(LOperand* left, LOperand* right) {
1505 inputs_[0] = left;
1506 inputs_[1] = right;
1507 }
1508
1509 LOperand* left() { return inputs_[0]; }
1510 LOperand* right() { return inputs_[1]; }
1511
1512 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
1513 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1514};
1515
1516
1517class LPower FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001518 public:
1519 LPower(LOperand* left, LOperand* right) {
1520 inputs_[0] = left;
1521 inputs_[1] = right;
1522 }
1523
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001524 LOperand* left() { return inputs_[0]; }
1525 LOperand* right() { return inputs_[1]; }
1526
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001527 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1528 DECLARE_HYDROGEN_ACCESSOR(Power)
1529};
1530
1531
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001532class LArithmeticD FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001533 public:
1534 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
Steve Block1e0659c2011-05-24 12:43:12 +01001535 : op_(op) {
1536 inputs_[0] = left;
1537 inputs_[1] = right;
1538 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001539
1540 Token::Value op() const { return op_; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001541 LOperand* left() { return inputs_[0]; }
1542 LOperand* right() { return inputs_[1]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001543
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001544 Opcode opcode() const OVERRIDE { return LInstruction::kArithmeticD; }
1545 void CompileToNative(LCodeGen* generator) OVERRIDE;
1546 const char* Mnemonic() const OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001547
1548 private:
1549 Token::Value op_;
1550};
1551
1552
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001553class LArithmeticT FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001554 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001555 LArithmeticT(Token::Value op,
1556 LOperand* context,
1557 LOperand* left,
1558 LOperand* right)
Steve Block1e0659c2011-05-24 12:43:12 +01001559 : op_(op) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001560 inputs_[0] = context;
1561 inputs_[1] = left;
1562 inputs_[2] = right;
Steve Block1e0659c2011-05-24 12:43:12 +01001563 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001564
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001565 LOperand* context() { return inputs_[0]; }
1566 LOperand* left() { return inputs_[1]; }
1567 LOperand* right() { return inputs_[2]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001568 Token::Value op() const { return op_; }
1569
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001570 Opcode opcode() const OVERRIDE { return LInstruction::kArithmeticT; }
1571 void CompileToNative(LCodeGen* generator) OVERRIDE;
1572 const char* Mnemonic() const OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001573
Ben Murdochb0fe1622011-05-05 13:52:32 +01001574 private:
1575 Token::Value op_;
1576};
1577
1578
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001579class LReturn FINAL : public LTemplateInstruction<0, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001580 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001581 LReturn(LOperand* value, LOperand* context, LOperand* parameter_count) {
Steve Block1e0659c2011-05-24 12:43:12 +01001582 inputs_[0] = value;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001583 inputs_[1] = context;
1584 inputs_[2] = parameter_count;
Steve Block1e0659c2011-05-24 12:43:12 +01001585 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001586
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001587 LOperand* value() { return inputs_[0]; }
1588
1589 bool has_constant_parameter_count() {
1590 return parameter_count()->IsConstantOperand();
1591 }
1592 LConstantOperand* constant_parameter_count() {
1593 DCHECK(has_constant_parameter_count());
1594 return LConstantOperand::cast(parameter_count());
1595 }
1596 LOperand* parameter_count() { return inputs_[2]; }
1597
Ben Murdochb0fe1622011-05-05 13:52:32 +01001598 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1599};
1600
1601
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001602class LLoadNamedField FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001603 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001604 explicit LLoadNamedField(LOperand* object) {
1605 inputs_[0] = object;
1606 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001607
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001608 LOperand* object() { return inputs_[0]; }
1609
Ben Murdochb0fe1622011-05-05 13:52:32 +01001610 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1611 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1612};
1613
1614
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001615class LLoadNamedGeneric FINAL : public LTemplateInstruction<1, 2, 1> {
Steve Block44f0eee2011-05-26 01:26:41 +01001616 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001617 LLoadNamedGeneric(LOperand* context, LOperand* object, LOperand* vector) {
1618 inputs_[0] = context;
1619 inputs_[1] = object;
1620 temps_[0] = vector;
Steve Block44f0eee2011-05-26 01:26:41 +01001621 }
1622
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001623 LOperand* context() { return inputs_[0]; }
1624 LOperand* object() { return inputs_[1]; }
1625 LOperand* temp_vector() { return temps_[0]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001626
1627 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1628 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1629
Ben Murdochb0fe1622011-05-05 13:52:32 +01001630 Handle<Object> name() const { return hydrogen()->name(); }
1631};
1632
1633
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001634class LLoadFunctionPrototype FINAL : public LTemplateInstruction<1, 1, 0> {
Steve Block9fac8402011-05-12 15:51:54 +01001635 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001636 explicit LLoadFunctionPrototype(LOperand* function) {
1637 inputs_[0] = function;
1638 }
Steve Block9fac8402011-05-12 15:51:54 +01001639
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001640 LOperand* function() { return inputs_[0]; }
1641
Steve Block9fac8402011-05-12 15:51:54 +01001642 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1643 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
Steve Block9fac8402011-05-12 15:51:54 +01001644};
1645
1646
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001647class LLoadRoot FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001648 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001649 DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
1650 DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001651
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001652 Heap::RootListIndex index() const { return hydrogen()->index(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001653};
1654
1655
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001656class LLoadKeyed FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001657 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001658 LLoadKeyed(LOperand* elements, LOperand* key) {
Steve Block1e0659c2011-05-24 12:43:12 +01001659 inputs_[0] = elements;
1660 inputs_[1] = key;
1661 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001662
Steve Block1e0659c2011-05-24 12:43:12 +01001663 LOperand* elements() { return inputs_[0]; }
1664 LOperand* key() { return inputs_[1]; }
Ben Murdoch589d6972011-11-30 16:04:58 +00001665 ElementsKind elements_kind() const {
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001666 return hydrogen()->elements_kind();
Steve Block44f0eee2011-05-26 01:26:41 +01001667 }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001668 bool is_external() const {
1669 return hydrogen()->is_external();
1670 }
1671 bool is_fixed_typed_array() const {
1672 return hydrogen()->is_fixed_typed_array();
1673 }
1674 bool is_typed_elements() const {
1675 return is_external() || is_fixed_typed_array();
Steve Block1e0659c2011-05-24 12:43:12 +01001676 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001677
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001678 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1679 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001680
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001681 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001682 uint32_t base_offset() const { return hydrogen()->base_offset(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001683};
1684
1685
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001686class LLoadKeyedGeneric FINAL : public LTemplateInstruction<1, 3, 1> {
1687 public:
1688 LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key,
1689 LOperand* vector) {
1690 inputs_[0] = context;
1691 inputs_[1] = object;
1692 inputs_[2] = key;
1693 temps_[0] = vector;
1694 }
1695
1696 LOperand* context() { return inputs_[0]; }
1697 LOperand* object() { return inputs_[1]; }
1698 LOperand* key() { return inputs_[2]; }
1699 LOperand* temp_vector() { return temps_[0]; }
1700
1701 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1702 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedGeneric)
1703};
1704
1705
1706class LLoadGlobalCell FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001707 public:
Ben Murdoch8b112d22011-06-08 16:22:53 +01001708 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1709 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001710};
1711
1712
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001713class LLoadGlobalGeneric FINAL : public LTemplateInstruction<1, 2, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001714 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001715 LLoadGlobalGeneric(LOperand* context, LOperand* global_object,
1716 LOperand* vector) {
1717 inputs_[0] = context;
1718 inputs_[1] = global_object;
1719 temps_[0] = vector;
Ben Murdoch8b112d22011-06-08 16:22:53 +01001720 }
1721
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001722 LOperand* context() { return inputs_[0]; }
1723 LOperand* global_object() { return inputs_[1]; }
1724 LOperand* temp_vector() { return temps_[0]; }
1725
Ben Murdoch8b112d22011-06-08 16:22:53 +01001726 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1727 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1728
Ben Murdoch8b112d22011-06-08 16:22:53 +01001729 Handle<Object> name() const { return hydrogen()->name(); }
1730 bool for_typeof() const { return hydrogen()->for_typeof(); }
1731};
1732
1733
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001734class LStoreGlobalCell FINAL : public LTemplateInstruction<0, 1, 1> {
Ben Murdoch8b112d22011-06-08 16:22:53 +01001735 public:
1736 LStoreGlobalCell(LOperand* value, LOperand* temp) {
Steve Block1e0659c2011-05-24 12:43:12 +01001737 inputs_[0] = value;
1738 temps_[0] = temp;
1739 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001740
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001741 LOperand* value() { return inputs_[0]; }
1742 LOperand* temp() { return temps_[0]; }
1743
Ben Murdoch8b112d22011-06-08 16:22:53 +01001744 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1745 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1746};
1747
1748
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001749class LLoadContextSlot FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb8e0da22011-05-16 14:20:40 +01001750 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001751 explicit LLoadContextSlot(LOperand* context) {
1752 inputs_[0] = context;
1753 }
1754
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001755 LOperand* context() { return inputs_[0]; }
1756
Ben Murdochb8e0da22011-05-16 14:20:40 +01001757 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1758 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1759
Steve Block1e0659c2011-05-24 12:43:12 +01001760 int slot_index() { return hydrogen()->slot_index(); }
Ben Murdochb8e0da22011-05-16 14:20:40 +01001761
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001762 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8e0da22011-05-16 14:20:40 +01001763};
1764
1765
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001766class LStoreContextSlot FINAL : public LTemplateInstruction<0, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001767 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001768 LStoreContextSlot(LOperand* context, LOperand* value) {
1769 inputs_[0] = context;
1770 inputs_[1] = value;
1771 }
1772
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001773 LOperand* context() { return inputs_[0]; }
1774 LOperand* value() { return inputs_[1]; }
1775
Steve Block1e0659c2011-05-24 12:43:12 +01001776 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1777 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1778
Steve Block1e0659c2011-05-24 12:43:12 +01001779 int slot_index() { return hydrogen()->slot_index(); }
Steve Block1e0659c2011-05-24 12:43:12 +01001780
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001781 void PrintDataTo(StringStream* stream) OVERRIDE;
Steve Block1e0659c2011-05-24 12:43:12 +01001782};
1783
1784
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001785class LPushArgument FINAL : public LTemplateInstruction<0, 1, 0> {
Steve Block1e0659c2011-05-24 12:43:12 +01001786 public:
1787 explicit LPushArgument(LOperand* value) {
1788 inputs_[0] = value;
1789 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001790
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001791 LOperand* value() { return inputs_[0]; }
1792
Ben Murdochb0fe1622011-05-05 13:52:32 +01001793 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1794};
1795
1796
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001797class LDrop FINAL : public LTemplateInstruction<0, 0, 0> {
1798 public:
1799 explicit LDrop(int count) : count_(count) { }
1800
1801 int count() const { return count_; }
1802
1803 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1804
1805 private:
1806 int count_;
1807};
1808
1809
1810class LStoreCodeEntry FINAL: public LTemplateInstruction<0, 2, 0> {
1811 public:
1812 LStoreCodeEntry(LOperand* function, LOperand* code_object) {
1813 inputs_[0] = function;
1814 inputs_[1] = code_object;
1815 }
1816
1817 LOperand* function() { return inputs_[0]; }
1818 LOperand* code_object() { return inputs_[1]; }
1819
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001820 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001821
1822 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry, "store-code-entry")
1823 DECLARE_HYDROGEN_ACCESSOR(StoreCodeEntry)
1824};
1825
1826
1827class LInnerAllocatedObject FINAL: public LTemplateInstruction<1, 2, 0> {
1828 public:
1829 LInnerAllocatedObject(LOperand* base_object, LOperand* offset) {
1830 inputs_[0] = base_object;
1831 inputs_[1] = offset;
1832 }
1833
1834 LOperand* base_object() const { return inputs_[0]; }
1835 LOperand* offset() const { return inputs_[1]; }
1836
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001837 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001838
1839 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "inner-allocated-object")
1840};
1841
1842
1843class LThisFunction FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001844 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001845 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001846 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001847};
1848
1849
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001850class LContext FINAL : public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001851 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001852 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001853 DECLARE_HYDROGEN_ACCESSOR(Context)
Steve Block1e0659c2011-05-24 12:43:12 +01001854};
1855
1856
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001857class LDeclareGlobals FINAL : public LTemplateInstruction<0, 1, 0> {
Steve Block1e0659c2011-05-24 12:43:12 +01001858 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001859 explicit LDeclareGlobals(LOperand* context) {
Steve Block1e0659c2011-05-24 12:43:12 +01001860 inputs_[0] = context;
1861 }
1862
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001863 LOperand* context() { return inputs_[0]; }
Steve Block1e0659c2011-05-24 12:43:12 +01001864
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001865 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1866 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1867};
1868
1869
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001870class LCallJSFunction FINAL : public LTemplateInstruction<1, 1, 0> {
Steve Block1e0659c2011-05-24 12:43:12 +01001871 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001872 explicit LCallJSFunction(LOperand* function) {
1873 inputs_[0] = function;
Steve Block1e0659c2011-05-24 12:43:12 +01001874 }
1875
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001876 LOperand* function() { return inputs_[0]; }
Steve Block1e0659c2011-05-24 12:43:12 +01001877
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001878 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function")
1879 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001880
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001881 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001882
Ben Murdochb0fe1622011-05-05 13:52:32 +01001883 int arity() const { return hydrogen()->argument_count() - 1; }
1884};
1885
1886
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001887class LCallWithDescriptor FINAL : public LTemplateResultInstruction<1> {
Ben Murdoch257744e2011-11-30 15:57:28 +00001888 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001889 LCallWithDescriptor(CallInterfaceDescriptor descriptor,
1890 const ZoneList<LOperand*>& operands, Zone* zone)
1891 : descriptor_(descriptor),
1892 inputs_(descriptor.GetRegisterParameterCount() + 1, zone) {
1893 DCHECK(descriptor.GetRegisterParameterCount() + 1 == operands.length());
1894 inputs_.AddAll(operands, zone);
Ben Murdoch257744e2011-11-30 15:57:28 +00001895 }
1896
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001897 LOperand* target() const { return inputs_[0]; }
1898
1899 const CallInterfaceDescriptor descriptor() { return descriptor_; }
1900
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001901 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1902
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001903 private:
1904 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1905
1906 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001907
1908 int arity() const { return hydrogen()->argument_count() - 1; }
1909
1910 CallInterfaceDescriptor descriptor_;
1911 ZoneList<LOperand*> inputs_;
1912
1913 // Iterator support.
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001914 int InputCount() FINAL { return inputs_.length(); }
1915 LOperand* InputAt(int i) FINAL { return inputs_[i]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001916
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001917 int TempCount() FINAL { return 0; }
1918 LOperand* TempAt(int i) FINAL { return NULL; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001919};
1920
1921
1922class LInvokeFunction FINAL : public LTemplateInstruction<1, 2, 0> {
1923 public:
1924 LInvokeFunction(LOperand* context, LOperand* function) {
1925 inputs_[0] = context;
1926 inputs_[1] = function;
1927 }
1928
1929 LOperand* context() { return inputs_[0]; }
1930 LOperand* function() { return inputs_[1]; }
1931
Ben Murdoch257744e2011-11-30 15:57:28 +00001932 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1933 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1934
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001935 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch257744e2011-11-30 15:57:28 +00001936
1937 int arity() const { return hydrogen()->argument_count() - 1; }
1938};
1939
1940
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001941class LCallFunction FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001942 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001943 LCallFunction(LOperand* context, LOperand* function) {
1944 inputs_[0] = context;
1945 inputs_[1] = function;
Steve Block1e0659c2011-05-24 12:43:12 +01001946 }
1947
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001948 LOperand* context() { return inputs_[0]; }
1949 LOperand* function() { return inputs_[1]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001950
Ben Murdochb0fe1622011-05-05 13:52:32 +01001951 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1952 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1953
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001954 int arity() const { return hydrogen()->argument_count() - 1; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001955};
1956
1957
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001958class LCallNew FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001959 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001960 LCallNew(LOperand* context, LOperand* constructor) {
1961 inputs_[0] = context;
1962 inputs_[1] = constructor;
Steve Block1e0659c2011-05-24 12:43:12 +01001963 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001964
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001965 LOperand* context() { return inputs_[0]; }
1966 LOperand* constructor() { return inputs_[1]; }
1967
Ben Murdochb0fe1622011-05-05 13:52:32 +01001968 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1969 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1970
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001971 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001972
1973 int arity() const { return hydrogen()->argument_count() - 1; }
1974};
1975
1976
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001977class LCallNewArray FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001978 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001979 LCallNewArray(LOperand* context, LOperand* constructor) {
1980 inputs_[0] = context;
1981 inputs_[1] = constructor;
1982 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001983
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001984 LOperand* context() { return inputs_[0]; }
1985 LOperand* constructor() { return inputs_[1]; }
1986
1987 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1988 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1989
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001990 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001991
1992 int arity() const { return hydrogen()->argument_count() - 1; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001993};
1994
1995
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001996class LCallRuntime FINAL : public LTemplateInstruction<1, 1, 0> {
1997 public:
1998 explicit LCallRuntime(LOperand* context) {
1999 inputs_[0] = context;
2000 }
2001
2002 LOperand* context() { return inputs_[0]; }
2003
2004 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
2005 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
2006
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002007 bool ClobbersDoubleRegisters(Isolate* isolate) const OVERRIDE {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002008 return save_doubles() == kDontSaveFPRegs;
2009 }
2010
2011 const Runtime::Function* function() const { return hydrogen()->function(); }
2012 int arity() const { return hydrogen()->argument_count(); }
2013 SaveFPRegsMode save_doubles() const { return hydrogen()->save_doubles(); }
2014};
2015
2016
2017class LInteger32ToDouble FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002018 public:
Steve Block1e0659c2011-05-24 12:43:12 +01002019 explicit LInteger32ToDouble(LOperand* value) {
2020 inputs_[0] = value;
2021 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002022
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002023 LOperand* value() { return inputs_[0]; }
2024
Ben Murdochb0fe1622011-05-05 13:52:32 +01002025 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
2026};
2027
2028
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002029class LUint32ToDouble FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002030 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002031 explicit LUint32ToDouble(LOperand* value) {
Steve Block1e0659c2011-05-24 12:43:12 +01002032 inputs_[0] = value;
2033 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002034
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002035 LOperand* value() { return inputs_[0]; }
2036
2037 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
2038};
2039
2040
2041class LNumberTagI FINAL : public LTemplateInstruction<1, 1, 2> {
2042 public:
2043 LNumberTagI(LOperand* value, LOperand* temp1, LOperand* temp2) {
2044 inputs_[0] = value;
2045 temps_[0] = temp1;
2046 temps_[1] = temp2;
2047 }
2048
2049 LOperand* value() { return inputs_[0]; }
2050 LOperand* temp1() { return temps_[0]; }
2051 LOperand* temp2() { return temps_[1]; }
2052
Ben Murdochb0fe1622011-05-05 13:52:32 +01002053 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
2054};
2055
2056
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002057class LNumberTagU FINAL : public LTemplateInstruction<1, 1, 2> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002058 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002059 LNumberTagU(LOperand* value, LOperand* temp1, LOperand* temp2) {
Steve Block1e0659c2011-05-24 12:43:12 +01002060 inputs_[0] = value;
2061 temps_[0] = temp1;
2062 temps_[1] = temp2;
2063 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002064
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002065 LOperand* value() { return inputs_[0]; }
2066 LOperand* temp1() { return temps_[0]; }
2067 LOperand* temp2() { return temps_[1]; }
2068
2069 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
2070};
2071
2072
2073class LNumberTagD FINAL : public LTemplateInstruction<1, 1, 2> {
2074 public:
2075 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
2076 inputs_[0] = value;
2077 temps_[0] = temp;
2078 temps_[1] = temp2;
2079 }
2080
2081 LOperand* value() { return inputs_[0]; }
2082 LOperand* temp() { return temps_[0]; }
2083 LOperand* temp2() { return temps_[1]; }
2084
Ben Murdochb0fe1622011-05-05 13:52:32 +01002085 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002086 DECLARE_HYDROGEN_ACCESSOR(Change)
2087};
2088
2089
2090class LDoubleToSmi FINAL : public LTemplateInstruction<1, 1, 0> {
2091 public:
2092 explicit LDoubleToSmi(LOperand* value) {
2093 inputs_[0] = value;
2094 }
2095
2096 LOperand* value() { return inputs_[0]; }
2097
2098 DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi")
2099 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2100
2101 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002102};
2103
2104
2105// Sometimes truncating conversion from a tagged value to an int32.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002106class LDoubleToI FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002107 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002108 explicit LDoubleToI(LOperand* value) {
Steve Block1e0659c2011-05-24 12:43:12 +01002109 inputs_[0] = value;
Steve Block1e0659c2011-05-24 12:43:12 +01002110 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002111
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002112 LOperand* value() { return inputs_[0]; }
2113
Ben Murdochb0fe1622011-05-05 13:52:32 +01002114 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002115 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002116
2117 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2118};
2119
2120
2121// Truncating conversion from a tagged value to an int32.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002122class LTaggedToI FINAL : public LTemplateInstruction<1, 1, 2> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002123 public:
Steve Block44f0eee2011-05-26 01:26:41 +01002124 LTaggedToI(LOperand* value,
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002125 LOperand* temp,
2126 LOperand* temp2) {
Steve Block1e0659c2011-05-24 12:43:12 +01002127 inputs_[0] = value;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002128 temps_[0] = temp;
Steve Block44f0eee2011-05-26 01:26:41 +01002129 temps_[1] = temp2;
Steve Block1e0659c2011-05-24 12:43:12 +01002130 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002131
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002132 LOperand* value() { return inputs_[0]; }
2133 LOperand* temp() { return temps_[0]; }
2134 LOperand* temp2() { return temps_[1]; }
2135
Ben Murdochb0fe1622011-05-05 13:52:32 +01002136 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002137 DECLARE_HYDROGEN_ACCESSOR(Change)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002138
2139 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002140};
2141
2142
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002143class LSmiTag FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002144 public:
Steve Block1e0659c2011-05-24 12:43:12 +01002145 explicit LSmiTag(LOperand* value) {
2146 inputs_[0] = value;
2147 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002148
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002149 LOperand* value() { return inputs_[0]; }
2150
Ben Murdochb0fe1622011-05-05 13:52:32 +01002151 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002152 DECLARE_HYDROGEN_ACCESSOR(Change)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002153};
2154
2155
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002156class LNumberUntagD FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002157 public:
Steve Block1e0659c2011-05-24 12:43:12 +01002158 explicit LNumberUntagD(LOperand* value) {
2159 inputs_[0] = value;
2160 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002161
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002162 LOperand* value() { return inputs_[0]; }
2163
Ben Murdochb0fe1622011-05-05 13:52:32 +01002164 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
Ben Murdoch7d3e7fc2011-07-12 16:37:06 +01002165 DECLARE_HYDROGEN_ACCESSOR(Change)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002166};
2167
2168
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002169class LSmiUntag FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002170 public:
Steve Block1e0659c2011-05-24 12:43:12 +01002171 LSmiUntag(LOperand* value, bool needs_check)
2172 : needs_check_(needs_check) {
2173 inputs_[0] = value;
2174 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002175
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002176 LOperand* value() { return inputs_[0]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002177 bool needs_check() const { return needs_check_; }
2178
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002179 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2180
Ben Murdochb0fe1622011-05-05 13:52:32 +01002181 private:
2182 bool needs_check_;
2183};
2184
2185
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002186class LStoreNamedField FINAL : public LTemplateInstruction<0, 2, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002187 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002188 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2189 inputs_[0] = object;
2190 inputs_[1] = value;
2191 temps_[0] = temp;
Steve Block1e0659c2011-05-24 12:43:12 +01002192 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002193
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002194 LOperand* object() { return inputs_[0]; }
2195 LOperand* value() { return inputs_[1]; }
2196 LOperand* temp() { return temps_[0]; }
2197
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002198 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2199 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2200
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002201 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002202
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002203 Representation representation() const {
2204 return hydrogen()->field_representation();
2205 }
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002206};
2207
2208
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002209class LStoreNamedGeneric FINAL : public LTemplateInstruction<0, 3, 0> {
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002210 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002211 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value) {
2212 inputs_[0] = context;
2213 inputs_[1] = object;
2214 inputs_[2] = value;
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002215 }
2216
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002217 LOperand* context() { return inputs_[0]; }
2218 LOperand* object() { return inputs_[1]; }
2219 LOperand* value() { return inputs_[2]; }
2220
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002221 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2222 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002223
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002224 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002225
Ben Murdochb8e0da22011-05-16 14:20:40 +01002226 Handle<Object> name() const { return hydrogen()->name(); }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002227 StrictMode strict_mode() { return hydrogen()->strict_mode(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002228};
2229
2230
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002231class LStoreKeyed FINAL : public LTemplateInstruction<0, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002232 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002233 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
2234 inputs_[0] = object;
Steve Block1e0659c2011-05-24 12:43:12 +01002235 inputs_[1] = key;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002236 inputs_[2] = value;
Steve Block1e0659c2011-05-24 12:43:12 +01002237 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002238
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002239 bool is_external() const { return hydrogen()->is_external(); }
2240 bool is_fixed_typed_array() const {
2241 return hydrogen()->is_fixed_typed_array();
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002242 }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002243 bool is_typed_elements() const {
2244 return is_external() || is_fixed_typed_array();
2245 }
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002246 LOperand* elements() { return inputs_[0]; }
2247 LOperand* key() { return inputs_[1]; }
2248 LOperand* value() { return inputs_[2]; }
Ben Murdoch589d6972011-11-30 16:04:58 +00002249 ElementsKind elements_kind() const {
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002250 return hydrogen()->elements_kind();
Steve Block44f0eee2011-05-26 01:26:41 +01002251 }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002252
2253 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2254 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
2255
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002256 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002257 bool NeedsCanonicalization() {
2258 if (hydrogen()->value()->IsAdd() || hydrogen()->value()->IsSub() ||
2259 hydrogen()->value()->IsMul() || hydrogen()->value()->IsDiv()) {
2260 return false;
2261 }
2262 return hydrogen()->NeedsCanonicalization();
2263 }
2264 uint32_t base_offset() const { return hydrogen()->base_offset(); }
Steve Block44f0eee2011-05-26 01:26:41 +01002265};
2266
Ben Murdochb0fe1622011-05-05 13:52:32 +01002267
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002268class LStoreKeyedGeneric FINAL : public LTemplateInstruction<0, 4, 0> {
2269 public:
2270 LStoreKeyedGeneric(LOperand* context,
2271 LOperand* obj,
2272 LOperand* key,
2273 LOperand* value) {
2274 inputs_[0] = context;
2275 inputs_[1] = obj;
2276 inputs_[2] = key;
2277 inputs_[3] = value;
2278 }
2279
2280 LOperand* context() { return inputs_[0]; }
2281 LOperand* object() { return inputs_[1]; }
2282 LOperand* key() { return inputs_[2]; }
2283 LOperand* value() { return inputs_[3]; }
2284
2285 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2286 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2287
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002288 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002289
2290 StrictMode strict_mode() { return hydrogen()->strict_mode(); }
2291};
2292
2293
2294class LTransitionElementsKind FINAL : public LTemplateInstruction<0, 2, 1> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002295 public:
2296 LTransitionElementsKind(LOperand* object,
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002297 LOperand* context,
2298 LOperand* new_map_temp) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002299 inputs_[0] = object;
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002300 inputs_[1] = context;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002301 temps_[0] = new_map_temp;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002302 }
2303
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002304 LOperand* context() { return inputs_[1]; }
2305 LOperand* object() { return inputs_[0]; }
2306 LOperand* new_map_temp() { return temps_[0]; }
2307
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002308 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2309 "transition-elements-kind")
2310 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2311
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002312 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002313
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002314 Handle<Map> original_map() { return hydrogen()->original_map().handle(); }
2315 Handle<Map> transitioned_map() {
2316 return hydrogen()->transitioned_map().handle();
2317 }
2318 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2319 ElementsKind to_kind() { return hydrogen()->to_kind(); }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002320};
2321
2322
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002323class LTrapAllocationMemento FINAL : public LTemplateInstruction<0, 1, 1> {
Ben Murdoch257744e2011-11-30 15:57:28 +00002324 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002325 LTrapAllocationMemento(LOperand* object,
2326 LOperand* temp) {
2327 inputs_[0] = object;
2328 temps_[0] = temp;
Ben Murdoch257744e2011-11-30 15:57:28 +00002329 }
2330
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002331 LOperand* object() { return inputs_[0]; }
2332 LOperand* temp() { return temps_[0]; }
2333
2334 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2335 "trap-allocation-memento")
2336};
2337
2338
2339class LStringAdd FINAL : public LTemplateInstruction<1, 3, 0> {
2340 public:
2341 LStringAdd(LOperand* context, LOperand* left, LOperand* right) {
2342 inputs_[0] = context;
2343 inputs_[1] = left;
2344 inputs_[2] = right;
2345 }
2346
2347 LOperand* context() { return inputs_[0]; }
2348 LOperand* left() { return inputs_[1]; }
2349 LOperand* right() { return inputs_[2]; }
2350
Ben Murdoch257744e2011-11-30 15:57:28 +00002351 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2352 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
Ben Murdoch257744e2011-11-30 15:57:28 +00002353};
2354
2355
2356
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002357class LStringCharCodeAt FINAL : public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002358 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002359 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) {
2360 inputs_[0] = context;
2361 inputs_[1] = string;
2362 inputs_[2] = index;
Steve Block1e0659c2011-05-24 12:43:12 +01002363 }
2364
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002365 LOperand* context() { return inputs_[0]; }
2366 LOperand* string() { return inputs_[1]; }
2367 LOperand* index() { return inputs_[2]; }
2368
Steve Block1e0659c2011-05-24 12:43:12 +01002369 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2370 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
Steve Block1e0659c2011-05-24 12:43:12 +01002371};
2372
2373
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002374class LStringCharFromCode FINAL : public LTemplateInstruction<1, 2, 0> {
Steve Block44f0eee2011-05-26 01:26:41 +01002375 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002376 explicit LStringCharFromCode(LOperand* context, LOperand* char_code) {
2377 inputs_[0] = context;
2378 inputs_[1] = char_code;
Steve Block44f0eee2011-05-26 01:26:41 +01002379 }
2380
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002381 LOperand* context() { return inputs_[0]; }
2382 LOperand* char_code() { return inputs_[1]; }
2383
Steve Block44f0eee2011-05-26 01:26:41 +01002384 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2385 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
Steve Block44f0eee2011-05-26 01:26:41 +01002386};
2387
2388
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002389class LCheckValue FINAL : public LTemplateInstruction<0, 1, 0> {
Steve Block1e0659c2011-05-24 12:43:12 +01002390 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002391 explicit LCheckValue(LOperand* value) {
Steve Block1e0659c2011-05-24 12:43:12 +01002392 inputs_[0] = value;
2393 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002394
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002395 LOperand* value() { return inputs_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002396
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002397 DECLARE_CONCRETE_INSTRUCTION(CheckValue, "check-value")
2398 DECLARE_HYDROGEN_ACCESSOR(CheckValue)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002399};
2400
2401
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002402class LCheckInstanceType FINAL : public LTemplateInstruction<0, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002403 public:
Steve Block1e0659c2011-05-24 12:43:12 +01002404 explicit LCheckInstanceType(LOperand* value) {
2405 inputs_[0] = value;
2406 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002407
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002408 LOperand* value() { return inputs_[0]; }
2409
Ben Murdochb0fe1622011-05-05 13:52:32 +01002410 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2411 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002412};
2413
2414
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002415class LCheckMaps FINAL : public LTemplateInstruction<0, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002416 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002417 explicit LCheckMaps(LOperand* value = NULL) {
Steve Block1e0659c2011-05-24 12:43:12 +01002418 inputs_[0] = value;
2419 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002420
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002421 LOperand* value() { return inputs_[0]; }
2422
2423 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2424 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002425};
2426
2427
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002428class LCheckSmi FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002429 public:
Steve Block44f0eee2011-05-26 01:26:41 +01002430 explicit LCheckSmi(LOperand* value) {
Steve Block1e0659c2011-05-24 12:43:12 +01002431 inputs_[0] = value;
2432 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002433
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002434 LOperand* value() { return inputs_[0]; }
2435
Steve Block44f0eee2011-05-26 01:26:41 +01002436 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2437};
Ben Murdochb0fe1622011-05-05 13:52:32 +01002438
Steve Block44f0eee2011-05-26 01:26:41 +01002439
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002440class LCheckNonSmi FINAL : public LTemplateInstruction<0, 1, 0> {
Steve Block44f0eee2011-05-26 01:26:41 +01002441 public:
2442 explicit LCheckNonSmi(LOperand* value) {
2443 inputs_[0] = value;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002444 }
2445
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002446 LOperand* value() { return inputs_[0]; }
2447
Steve Block44f0eee2011-05-26 01:26:41 +01002448 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002449 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002450};
2451
2452
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002453class LClampDToUint8 FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch257744e2011-11-30 15:57:28 +00002454 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002455 explicit LClampDToUint8(LOperand* unclamped) {
2456 inputs_[0] = unclamped;
Ben Murdoch257744e2011-11-30 15:57:28 +00002457 }
2458
2459 LOperand* unclamped() { return inputs_[0]; }
2460
2461 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2462};
2463
2464
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002465class LClampIToUint8 FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch257744e2011-11-30 15:57:28 +00002466 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002467 explicit LClampIToUint8(LOperand* unclamped) {
2468 inputs_[0] = unclamped;
Ben Murdoch257744e2011-11-30 15:57:28 +00002469 }
2470
2471 LOperand* unclamped() { return inputs_[0]; }
2472
2473 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2474};
2475
2476
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002477class LClampTToUint8 FINAL : public LTemplateInstruction<1, 1, 1> {
Ben Murdoch257744e2011-11-30 15:57:28 +00002478 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002479 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2480 inputs_[0] = unclamped;
Ben Murdoch257744e2011-11-30 15:57:28 +00002481 temps_[0] = temp;
2482 }
2483
2484 LOperand* unclamped() { return inputs_[0]; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002485 LOperand* temp() { return temps_[0]; }
Ben Murdoch257744e2011-11-30 15:57:28 +00002486
2487 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2488};
2489
2490
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002491class LDoubleBits FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002492 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002493 explicit LDoubleBits(LOperand* value) {
2494 inputs_[0] = value;
2495 }
2496
2497 LOperand* value() { return inputs_[0]; }
2498
2499 DECLARE_CONCRETE_INSTRUCTION(DoubleBits, "double-bits")
2500 DECLARE_HYDROGEN_ACCESSOR(DoubleBits)
2501};
2502
2503
2504class LConstructDouble FINAL : public LTemplateInstruction<1, 2, 0> {
2505 public:
2506 LConstructDouble(LOperand* hi, LOperand* lo) {
2507 inputs_[0] = hi;
2508 inputs_[1] = lo;
2509 }
2510
2511 LOperand* hi() { return inputs_[0]; }
2512 LOperand* lo() { return inputs_[1]; }
2513
2514 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble, "construct-double")
2515};
2516
2517
2518class LAllocate FINAL : public LTemplateInstruction<1, 2, 2> {
2519 public:
2520 LAllocate(LOperand* context,
2521 LOperand* size,
2522 LOperand* temp1,
2523 LOperand* temp2) {
2524 inputs_[0] = context;
2525 inputs_[1] = size;
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002526 temps_[0] = temp1;
2527 temps_[1] = temp2;
2528 }
2529
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002530 LOperand* context() { return inputs_[0]; }
2531 LOperand* size() { return inputs_[1]; }
2532 LOperand* temp1() { return temps_[0]; }
2533 LOperand* temp2() { return temps_[1]; }
2534
2535 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2536 DECLARE_HYDROGEN_ACCESSOR(Allocate)
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002537};
2538
2539
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002540class LRegExpLiteral FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002541 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002542 explicit LRegExpLiteral(LOperand* context) {
2543 inputs_[0] = context;
2544 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002545
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002546 LOperand* context() { return inputs_[0]; }
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002547
Ben Murdochb0fe1622011-05-05 13:52:32 +01002548 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2549 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2550};
2551
2552
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002553class LFunctionLiteral FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002554 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002555 explicit LFunctionLiteral(LOperand* context) {
2556 inputs_[0] = context;
2557 }
2558
2559 LOperand* context() { return inputs_[0]; }
2560
Ben Murdochb0fe1622011-05-05 13:52:32 +01002561 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2562 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002563};
2564
2565
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002566class LToFastProperties FINAL : public LTemplateInstruction<1, 1, 0> {
Steve Block44f0eee2011-05-26 01:26:41 +01002567 public:
2568 explicit LToFastProperties(LOperand* value) {
2569 inputs_[0] = value;
2570 }
2571
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002572 LOperand* value() { return inputs_[0]; }
2573
Steve Block44f0eee2011-05-26 01:26:41 +01002574 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2575 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2576};
2577
2578
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002579class LTypeof FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002580 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002581 LTypeof(LOperand* context, LOperand* value) {
2582 inputs_[0] = context;
2583 inputs_[1] = value;
Steve Block1e0659c2011-05-24 12:43:12 +01002584 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002585
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002586 LOperand* context() { return inputs_[0]; }
2587 LOperand* value() { return inputs_[1]; }
2588
Ben Murdochb0fe1622011-05-05 13:52:32 +01002589 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2590};
2591
2592
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002593class LTypeofIsAndBranch FINAL : public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002594 public:
Steve Block1e0659c2011-05-24 12:43:12 +01002595 explicit LTypeofIsAndBranch(LOperand* value) {
2596 inputs_[0] = value;
2597 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002598
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002599 LOperand* value() { return inputs_[0]; }
2600
Ben Murdochb0fe1622011-05-05 13:52:32 +01002601 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002602 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002603
Steve Block1e0659c2011-05-24 12:43:12 +01002604 Handle<String> type_literal() { return hydrogen()->type_literal(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002605
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002606 void PrintDataTo(StringStream* stream) OVERRIDE;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002607};
2608
2609
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002610class LIsConstructCallAndBranch FINAL : public LControlInstruction<0, 1> {
Steve Block1e0659c2011-05-24 12:43:12 +01002611 public:
2612 explicit LIsConstructCallAndBranch(LOperand* temp) {
2613 temps_[0] = temp;
2614 }
2615
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002616 LOperand* temp() { return temps_[0]; }
2617
Steve Block1e0659c2011-05-24 12:43:12 +01002618 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2619 "is-construct-call-and-branch")
2620};
2621
2622
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002623class LOsrEntry FINAL : public LTemplateInstruction<0, 0, 0> {
Steve Block1e0659c2011-05-24 12:43:12 +01002624 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002625 LOsrEntry() {}
2626
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002627 bool HasInterestingComment(LCodeGen* gen) const OVERRIDE { return false; }
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002628 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2629};
2630
2631
2632class LStackCheck FINAL : public LTemplateInstruction<0, 1, 0> {
2633 public:
2634 explicit LStackCheck(LOperand* context) {
2635 inputs_[0] = context;
Steve Block1e0659c2011-05-24 12:43:12 +01002636 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002637
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002638 LOperand* context() { return inputs_[0]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002639
Ben Murdochb0fe1622011-05-05 13:52:32 +01002640 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002641 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2642
2643 Label* done_label() { return &done_label_; }
2644
2645 private:
2646 Label done_label_;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002647};
2648
2649
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002650class LForInPrepareMap FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch257744e2011-11-30 15:57:28 +00002651 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002652 LForInPrepareMap(LOperand* context, LOperand* object) {
2653 inputs_[0] = context;
Ben Murdoch257744e2011-11-30 15:57:28 +00002654 inputs_[1] = object;
2655 }
2656
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002657 LOperand* context() { return inputs_[0]; }
Ben Murdoch257744e2011-11-30 15:57:28 +00002658 LOperand* object() { return inputs_[1]; }
2659
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002660 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2661};
2662
2663
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002664class LForInCacheArray FINAL : public LTemplateInstruction<1, 1, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002665 public:
2666 explicit LForInCacheArray(LOperand* map) {
2667 inputs_[0] = map;
2668 }
2669
2670 LOperand* map() { return inputs_[0]; }
2671
2672 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2673
2674 int idx() {
2675 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2676 }
2677};
2678
2679
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002680class LCheckMapValue FINAL : public LTemplateInstruction<0, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002681 public:
2682 LCheckMapValue(LOperand* value, LOperand* map) {
2683 inputs_[0] = value;
2684 inputs_[1] = map;
2685 }
2686
2687 LOperand* value() { return inputs_[0]; }
2688 LOperand* map() { return inputs_[1]; }
2689
2690 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2691};
2692
2693
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002694class LLoadFieldByIndex FINAL : public LTemplateInstruction<1, 2, 0> {
Ben Murdoch3ef787d2012-04-12 10:51:47 +01002695 public:
2696 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2697 inputs_[0] = object;
2698 inputs_[1] = index;
2699 }
2700
2701 LOperand* object() { return inputs_[0]; }
2702 LOperand* index() { return inputs_[1]; }
2703
2704 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2705};
2706
2707
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002708class LStoreFrameContext: public LTemplateInstruction<0, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002709 public:
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002710 explicit LStoreFrameContext(LOperand* context) {
2711 inputs_[0] = context;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002712 }
2713
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002714 LOperand* context() { return inputs_[0]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002715
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002716 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext, "store-frame-context")
Ben Murdochb0fe1622011-05-05 13:52:32 +01002717};
2718
2719
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002720class LAllocateBlockContext: public LTemplateInstruction<1, 2, 0> {
2721 public:
2722 LAllocateBlockContext(LOperand* context, LOperand* function) {
2723 inputs_[0] = context;
2724 inputs_[1] = function;
2725 }
2726
2727 LOperand* context() { return inputs_[0]; }
2728 LOperand* function() { return inputs_[1]; }
2729
2730 Handle<ScopeInfo> scope_info() { return hydrogen()->scope_info(); }
2731
2732 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext, "allocate-block-context")
2733 DECLARE_HYDROGEN_ACCESSOR(AllocateBlockContext)
2734};
2735
2736
2737class LChunkBuilder;
2738class LPlatformChunk FINAL : public LChunk {
2739 public:
2740 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2741 : LChunk(info, graph) { }
2742
2743 int GetNextSpillIndex(RegisterKind kind);
2744 LOperand* GetNextSpillSlot(RegisterKind kind);
2745};
2746
2747
2748class LChunkBuilder FINAL : public LChunkBuilderBase {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002749 public:
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002750 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002751 : LChunkBuilderBase(info, graph),
Ben Murdochb0fe1622011-05-05 13:52:32 +01002752 current_instruction_(NULL),
2753 current_block_(NULL),
2754 next_block_(NULL),
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002755 allocator_(allocator) {}
Ben Murdochb0fe1622011-05-05 13:52:32 +01002756
2757 // Build the sequence for the graph.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002758 LPlatformChunk* Build();
Ben Murdochb0fe1622011-05-05 13:52:32 +01002759
2760 // Declare methods that deal with the individual node types.
2761#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2762 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2763#undef DECLARE_DO
2764
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002765 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2766 LInstruction* DoMultiplySub(HValue* minuend, HMul* mul);
2767 LInstruction* DoRSub(HSub* instr);
2768
2769 static bool HasMagicNumberForDivisor(int32_t divisor);
2770
2771 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2772 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2773 LInstruction* DoMathFround(HUnaryMathOperation* instr);
2774 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2775 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2776 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2777 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2778 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2779 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2780 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2781 LInstruction* DoDivByConstI(HDiv* instr);
2782 LInstruction* DoDivI(HDiv* instr);
2783 LInstruction* DoModByPowerOf2I(HMod* instr);
2784 LInstruction* DoModByConstI(HMod* instr);
2785 LInstruction* DoModI(HMod* instr);
2786 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2787 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2788 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr);
2789
Ben Murdochb0fe1622011-05-05 13:52:32 +01002790 private:
Ben Murdochb0fe1622011-05-05 13:52:32 +01002791 // Methods for getting operands for Use / Define / Temp.
Ben Murdochb0fe1622011-05-05 13:52:32 +01002792 LUnallocated* ToUnallocated(Register reg);
2793 LUnallocated* ToUnallocated(DoubleRegister reg);
2794
2795 // Methods for setting up define-use relationships.
Steve Block1e0659c2011-05-24 12:43:12 +01002796 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2797 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2798 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2799 DoubleRegister fixed_register);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002800
2801 // A value that is guaranteed to be allocated to a register.
2802 // Operand created by UseRegister is guaranteed to be live until the end of
2803 // instruction. This means that register allocator will not reuse it's
2804 // register for any other operand inside instruction.
2805 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2806 // instruction start. Register allocator is free to assign the same register
2807 // to some other operand used inside instruction (i.e. temporary or
2808 // output).
Steve Block1e0659c2011-05-24 12:43:12 +01002809 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2810 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002811
Ben Murdochb8e0da22011-05-16 14:20:40 +01002812 // An input operand in a register that may be trashed.
Steve Block1e0659c2011-05-24 12:43:12 +01002813 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
Ben Murdochb8e0da22011-05-16 14:20:40 +01002814
2815 // An input operand in a register or stack slot.
Steve Block1e0659c2011-05-24 12:43:12 +01002816 MUST_USE_RESULT LOperand* Use(HValue* value);
2817 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
Ben Murdochb8e0da22011-05-16 14:20:40 +01002818
2819 // An input operand in a register, stack slot or a constant operand.
Steve Block1e0659c2011-05-24 12:43:12 +01002820 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2821 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
Ben Murdochb8e0da22011-05-16 14:20:40 +01002822
2823 // An input operand in a register or a constant operand.
Steve Block1e0659c2011-05-24 12:43:12 +01002824 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2825 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002826
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002827 // An input operand in a constant operand.
2828 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2829
Ben Murdochb8e0da22011-05-16 14:20:40 +01002830 // An input operand in register, stack slot or a constant operand.
2831 // Will not be moved to a register even if one is freely available.
Emily Bernierd0a1eb72015-03-24 16:35:39 -04002832 MUST_USE_RESULT LOperand* UseAny(HValue* value) OVERRIDE;
Steve Block1e0659c2011-05-24 12:43:12 +01002833
2834 // Temporary operand that must be in a register.
2835 MUST_USE_RESULT LUnallocated* TempRegister();
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002836 MUST_USE_RESULT LUnallocated* TempDoubleRegister();
Steve Block1e0659c2011-05-24 12:43:12 +01002837 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2838 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
Ben Murdochb8e0da22011-05-16 14:20:40 +01002839
Ben Murdochb0fe1622011-05-05 13:52:32 +01002840 // Methods for setting up define-use relationships.
2841 // Return the same instruction that they are passed.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002842 LInstruction* Define(LTemplateResultInstruction<1>* instr,
2843 LUnallocated* result);
2844 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr);
2845 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr,
2846 int index);
2847 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr);
2848 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr,
2849 Register reg);
2850 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr,
2851 DoubleRegister reg);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002852 LInstruction* AssignEnvironment(LInstruction* instr);
2853 LInstruction* AssignPointerMap(LInstruction* instr);
2854
2855 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2856
2857 // By default we assume that instruction sequences generated for calls
2858 // cannot deoptimize eagerly and we do not attach environment to this
2859 // instruction.
2860 LInstruction* MarkAsCall(
2861 LInstruction* instr,
2862 HInstruction* hinstr,
2863 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002864
Ben Murdochb0fe1622011-05-05 13:52:32 +01002865 void VisitInstruction(HInstruction* current);
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002866 void AddInstruction(LInstruction* instr, HInstruction* current);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002867
2868 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002869 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2870 LInstruction* DoArithmeticD(Token::Value op,
2871 HArithmeticBinaryOperation* instr);
2872 LInstruction* DoArithmeticT(Token::Value op,
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002873 HBinaryOperation* instr);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002874
Ben Murdochb0fe1622011-05-05 13:52:32 +01002875 HInstruction* current_instruction_;
2876 HBasicBlock* current_block_;
2877 HBasicBlock* next_block_;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002878 LAllocator* allocator_;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002879
2880 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2881};
2882
2883#undef DECLARE_HYDROGEN_ACCESSOR
Ben Murdochb0fe1622011-05-05 13:52:32 +01002884#undef DECLARE_CONCRETE_INSTRUCTION
2885
2886} } // namespace v8::internal
2887
2888#endif // V8_ARM_LITHIUM_ARM_H_