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