blob: 5d282ec7aa9f72886e83ce2eb79adeddfa5e04ad [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_MIPS64_LITHIUM_MIPS_H_
6#define V8_CRANKSHAFT_MIPS64_LITHIUM_MIPS_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(AddE) \
23 V(AddI) \
24 V(AddS) \
25 V(Allocate) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000026 V(ApplyArguments) \
27 V(ArgumentsElements) \
28 V(ArgumentsLength) \
29 V(ArithmeticD) \
30 V(ArithmeticT) \
31 V(BitI) \
32 V(BoundsCheck) \
33 V(Branch) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000034 V(CallWithDescriptor) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000035 V(CallNewArray) \
36 V(CallRuntime) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000037 V(CheckArrayBufferNotNeutered) \
38 V(CheckInstanceType) \
39 V(CheckMaps) \
40 V(CheckMapValue) \
41 V(CheckNonSmi) \
42 V(CheckSmi) \
43 V(CheckValue) \
44 V(ClampDToUint8) \
45 V(ClampIToUint8) \
46 V(ClampTToUint8) \
47 V(ClassOfTestAndBranch) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000048 V(CompareNumericAndBranch) \
49 V(CmpObjectEqAndBranch) \
50 V(CmpHoleAndBranch) \
51 V(CmpMapAndBranch) \
52 V(CmpT) \
53 V(ConstantD) \
54 V(ConstantE) \
55 V(ConstantI) \
56 V(ConstantS) \
57 V(ConstantT) \
58 V(ConstructDouble) \
59 V(Context) \
60 V(DebugBreak) \
61 V(DeclareGlobals) \
62 V(Deoptimize) \
63 V(DivByConstI) \
64 V(DivByPowerOf2I) \
65 V(DivI) \
66 V(DoubleToI) \
67 V(DoubleBits) \
68 V(DoubleToSmi) \
69 V(Drop) \
70 V(Dummy) \
71 V(DummyUse) \
Ben Murdochc5610432016-08-08 18:44:38 +010072 V(FastAllocate) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000073 V(FlooringDivByConstI) \
74 V(FlooringDivByPowerOf2I) \
75 V(FlooringDivI) \
76 V(ForInCacheArray) \
77 V(ForInPrepareMap) \
78 V(GetCachedArrayIndex) \
79 V(Goto) \
80 V(HasCachedArrayIndexAndBranch) \
81 V(HasInPrototypeChainAndBranch) \
82 V(HasInstanceTypeAndBranch) \
83 V(InnerAllocatedObject) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000084 V(InstructionGap) \
85 V(Integer32ToDouble) \
86 V(InvokeFunction) \
87 V(IsStringAndBranch) \
88 V(IsSmiAndBranch) \
89 V(IsUndetectableAndBranch) \
90 V(Label) \
91 V(LazyBailout) \
92 V(LoadContextSlot) \
93 V(LoadRoot) \
94 V(LoadFieldByIndex) \
95 V(LoadFunctionPrototype) \
96 V(LoadGlobalGeneric) \
97 V(LoadKeyed) \
98 V(LoadKeyedGeneric) \
99 V(LoadNamedField) \
100 V(LoadNamedGeneric) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000101 V(MathAbs) \
102 V(MathExp) \
103 V(MathClz32) \
104 V(MathFloor) \
105 V(MathFround) \
106 V(MathLog) \
107 V(MathMinMax) \
108 V(MathPowHalf) \
109 V(MathRound) \
110 V(MathSqrt) \
111 V(MaybeGrowElements) \
112 V(ModByConstI) \
113 V(ModByPowerOf2I) \
114 V(ModI) \
115 V(MulI) \
116 V(MulS) \
117 V(MultiplyAddD) \
118 V(NumberTagD) \
119 V(NumberTagU) \
120 V(NumberUntagD) \
121 V(OsrEntry) \
122 V(Parameter) \
123 V(Power) \
124 V(Prologue) \
125 V(PushArgument) \
126 V(Return) \
127 V(SeqStringGetChar) \
128 V(SeqStringSetChar) \
129 V(ShiftI) \
130 V(SmiTag) \
131 V(SmiUntag) \
132 V(StackCheck) \
133 V(StoreCodeEntry) \
134 V(StoreContextSlot) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000135 V(StoreKeyed) \
136 V(StoreKeyedGeneric) \
137 V(StoreNamedField) \
138 V(StoreNamedGeneric) \
139 V(StringAdd) \
140 V(StringCharCodeAt) \
141 V(StringCharFromCode) \
142 V(StringCompareAndBranch) \
143 V(SubI) \
144 V(SubS) \
145 V(TaggedToI) \
146 V(ThisFunction) \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000147 V(TransitionElementsKind) \
148 V(TrapAllocationMemento) \
149 V(Typeof) \
150 V(TypeofIsAndBranch) \
151 V(Uint32ToDouble) \
152 V(UnknownOSRValue) \
153 V(WrapReceiver)
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 interface.
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 final { 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, 3> {
626 public:
627 LModI(LOperand* left,
628 LOperand* right) {
629 inputs_[0] = left;
630 inputs_[1] = right;
631 }
632
633 LOperand* left() { return inputs_[0]; }
634 LOperand* right() { return inputs_[1]; }
635
636 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
637 DECLARE_HYDROGEN_ACCESSOR(Mod)
638};
639
640
641class LDivByPowerOf2I final : public LTemplateInstruction<1, 1, 0> {
642 public:
643 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
644 inputs_[0] = dividend;
645 divisor_ = divisor;
646 }
647
648 LOperand* dividend() { return inputs_[0]; }
649 int32_t divisor() const { return divisor_; }
650
651 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
652 DECLARE_HYDROGEN_ACCESSOR(Div)
653
654 private:
655 int32_t divisor_;
656};
657
658
659class LDivByConstI final : public LTemplateInstruction<1, 1, 0> {
660 public:
661 LDivByConstI(LOperand* dividend, int32_t divisor) {
662 inputs_[0] = dividend;
663 divisor_ = divisor;
664 }
665
666 LOperand* dividend() { return inputs_[0]; }
667 int32_t divisor() const { return divisor_; }
668
669 DECLARE_CONCRETE_INSTRUCTION(DivByConstI, "div-by-const-i")
670 DECLARE_HYDROGEN_ACCESSOR(Div)
671
672 private:
673 int32_t divisor_;
674};
675
676
677class LDivI final : public LTemplateInstruction<1, 2, 1> {
678 public:
679 LDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
680 inputs_[0] = dividend;
681 inputs_[1] = divisor;
682 temps_[0] = temp;
683 }
684
685 LOperand* dividend() { return inputs_[0]; }
686 LOperand* divisor() { return inputs_[1]; }
687 LOperand* temp() { return temps_[0]; }
688
689 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
690 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
691};
692
693
694class LFlooringDivByPowerOf2I final : public LTemplateInstruction<1, 1, 0> {
695 public:
696 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
697 inputs_[0] = dividend;
698 divisor_ = divisor;
699 }
700
701 LOperand* dividend() { return inputs_[0]; }
702 int32_t divisor() { return divisor_; }
703
704 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
705 "flooring-div-by-power-of-2-i")
706 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
707
708 private:
709 int32_t divisor_;
710};
711
712
713class LFlooringDivByConstI final : public LTemplateInstruction<1, 1, 2> {
714 public:
715 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) {
716 inputs_[0] = dividend;
717 divisor_ = divisor;
718 temps_[0] = temp;
719 }
720
721 LOperand* dividend() { return inputs_[0]; }
722 int32_t divisor() const { return divisor_; }
723 LOperand* temp() { return temps_[0]; }
724
725 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
726 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
727
728 private:
729 int32_t divisor_;
730};
731
732
733class LFlooringDivI final : public LTemplateInstruction<1, 2, 0> {
734 public:
735 LFlooringDivI(LOperand* dividend, LOperand* divisor) {
736 inputs_[0] = dividend;
737 inputs_[1] = divisor;
738 }
739
740 LOperand* dividend() { return inputs_[0]; }
741 LOperand* divisor() { return inputs_[1]; }
742
743 DECLARE_CONCRETE_INSTRUCTION(FlooringDivI, "flooring-div-i")
744 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
745};
746
747
748class LMulS final : public LTemplateInstruction<1, 2, 0> {
749 public:
750 LMulS(LOperand* left, LOperand* right) {
751 inputs_[0] = left;
752 inputs_[1] = right;
753 }
754
755 LOperand* left() { return inputs_[0]; }
756 LOperand* right() { return inputs_[1]; }
757
758 DECLARE_CONCRETE_INSTRUCTION(MulS, "mul-s")
759 DECLARE_HYDROGEN_ACCESSOR(Mul)
760};
761
762
763class LMulI final : public LTemplateInstruction<1, 2, 0> {
764 public:
765 LMulI(LOperand* left, LOperand* right) {
766 inputs_[0] = left;
767 inputs_[1] = right;
768 }
769
770 LOperand* left() { return inputs_[0]; }
771 LOperand* right() { return inputs_[1]; }
772
773 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
774 DECLARE_HYDROGEN_ACCESSOR(Mul)
775};
776
777
778// Instruction for computing multiplier * multiplicand + addend.
779class LMultiplyAddD final : public LTemplateInstruction<1, 3, 0> {
780 public:
781 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
782 LOperand* multiplicand) {
783 inputs_[0] = addend;
784 inputs_[1] = multiplier;
785 inputs_[2] = multiplicand;
786 }
787
788 LOperand* addend() { return inputs_[0]; }
789 LOperand* multiplier() { return inputs_[1]; }
790 LOperand* multiplicand() { return inputs_[2]; }
791
792 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
793};
794
795
796class LDebugBreak final : public LTemplateInstruction<0, 0, 0> {
797 public:
798 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
799};
800
801
802class LCompareNumericAndBranch final : public LControlInstruction<2, 0> {
803 public:
804 LCompareNumericAndBranch(LOperand* left, LOperand* right) {
805 inputs_[0] = left;
806 inputs_[1] = right;
807 }
808
809 LOperand* left() { return inputs_[0]; }
810 LOperand* right() { return inputs_[1]; }
811
812 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch,
813 "compare-numeric-and-branch")
814 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch)
815
816 Token::Value op() const { return hydrogen()->token(); }
817 bool is_double() const {
818 return hydrogen()->representation().IsDouble();
819 }
820
821 void PrintDataTo(StringStream* stream) override;
822};
823
824
825class LMathFloor final : public LTemplateInstruction<1, 1, 1> {
826 public:
827 LMathFloor(LOperand* value, LOperand* temp) {
828 inputs_[0] = value;
829 temps_[0] = temp;
830 }
831
832 LOperand* value() { return inputs_[0]; }
833 LOperand* temp() { return temps_[0]; }
834
835 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
836 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
837};
838
839
840class LMathRound final : public LTemplateInstruction<1, 1, 1> {
841 public:
842 LMathRound(LOperand* value, LOperand* temp) {
843 inputs_[0] = value;
844 temps_[0] = temp;
845 }
846
847 LOperand* value() { return inputs_[0]; }
848 LOperand* temp() { return temps_[0]; }
849
850 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
851 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
852};
853
854
855class LMathFround final : public LTemplateInstruction<1, 1, 0> {
856 public:
857 explicit LMathFround(LOperand* value) { inputs_[0] = value; }
858
859 LOperand* value() { return inputs_[0]; }
860
861 DECLARE_CONCRETE_INSTRUCTION(MathFround, "math-fround")
862};
863
864
865class LMathAbs final : public LTemplateInstruction<1, 2, 0> {
866 public:
867 LMathAbs(LOperand* context, LOperand* value) {
868 inputs_[1] = context;
869 inputs_[0] = value;
870 }
871
872 LOperand* context() { return inputs_[1]; }
873 LOperand* value() { return inputs_[0]; }
874
875 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
876 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
877};
878
879
880class LMathLog final : public LTemplateInstruction<1, 1, 0> {
881 public:
882 explicit LMathLog(LOperand* value) {
883 inputs_[0] = value;
884 }
885
886 LOperand* value() { return inputs_[0]; }
887
888 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
889};
890
891
892class LMathClz32 final : public LTemplateInstruction<1, 1, 0> {
893 public:
894 explicit LMathClz32(LOperand* value) {
895 inputs_[0] = value;
896 }
897
898 LOperand* value() { return inputs_[0]; }
899
900 DECLARE_CONCRETE_INSTRUCTION(MathClz32, "math-clz32")
901};
902
903
904class LMathExp final : public LTemplateInstruction<1, 1, 3> {
905 public:
906 LMathExp(LOperand* value,
907 LOperand* double_temp,
908 LOperand* temp1,
909 LOperand* temp2) {
910 inputs_[0] = value;
911 temps_[0] = temp1;
912 temps_[1] = temp2;
913 temps_[2] = double_temp;
914 ExternalReference::InitializeMathExpData();
915 }
916
917 LOperand* value() { return inputs_[0]; }
918 LOperand* temp1() { return temps_[0]; }
919 LOperand* temp2() { return temps_[1]; }
920 LOperand* double_temp() { return temps_[2]; }
921
922 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
923};
924
925
926class LMathSqrt final : public LTemplateInstruction<1, 1, 0> {
927 public:
928 explicit LMathSqrt(LOperand* value) {
929 inputs_[0] = value;
930 }
931
932 LOperand* value() { return inputs_[0]; }
933
934 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
935};
936
937
938class LMathPowHalf final : public LTemplateInstruction<1, 1, 1> {
939 public:
940 LMathPowHalf(LOperand* value, LOperand* temp) {
941 inputs_[0] = value;
942 temps_[0] = temp;
943 }
944
945 LOperand* value() { return inputs_[0]; }
946 LOperand* temp() { return temps_[0]; }
947
948 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
949};
950
951
952class LCmpObjectEqAndBranch final : public LControlInstruction<2, 0> {
953 public:
954 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
955 inputs_[0] = left;
956 inputs_[1] = right;
957 }
958
959 LOperand* left() { return inputs_[0]; }
960 LOperand* right() { return inputs_[1]; }
961
962 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch")
963 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
964};
965
966
967class LCmpHoleAndBranch final : public LControlInstruction<1, 0> {
968 public:
969 explicit LCmpHoleAndBranch(LOperand* object) {
970 inputs_[0] = object;
971 }
972
973 LOperand* object() { return inputs_[0]; }
974
975 DECLARE_CONCRETE_INSTRUCTION(CmpHoleAndBranch, "cmp-hole-and-branch")
976 DECLARE_HYDROGEN_ACCESSOR(CompareHoleAndBranch)
977};
978
979
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000980class LIsStringAndBranch final : public LControlInstruction<1, 1> {
981 public:
982 LIsStringAndBranch(LOperand* value, LOperand* temp) {
983 inputs_[0] = value;
984 temps_[0] = temp;
985 }
986
987 LOperand* value() { return inputs_[0]; }
988 LOperand* temp() { return temps_[0]; }
989
990 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
991 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
992
993 void PrintDataTo(StringStream* stream) override;
994};
995
996
997class LIsSmiAndBranch final : public LControlInstruction<1, 0> {
998 public:
999 explicit LIsSmiAndBranch(LOperand* value) {
1000 inputs_[0] = value;
1001 }
1002
1003 LOperand* value() { return inputs_[0]; }
1004
1005 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
1006 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
1007
1008 void PrintDataTo(StringStream* stream) override;
1009};
1010
1011
1012class LIsUndetectableAndBranch final : public LControlInstruction<1, 1> {
1013 public:
1014 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
1015 inputs_[0] = value;
1016 temps_[0] = temp;
1017 }
1018
1019 LOperand* value() { return inputs_[0]; }
1020 LOperand* temp() { return temps_[0]; }
1021
1022 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
1023 "is-undetectable-and-branch")
1024 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
1025
1026 void PrintDataTo(StringStream* stream) override;
1027};
1028
1029
1030class LStringCompareAndBranch final : public LControlInstruction<3, 0> {
1031 public:
1032 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) {
1033 inputs_[0] = context;
1034 inputs_[1] = left;
1035 inputs_[2] = right;
1036 }
1037
1038 LOperand* context() { return inputs_[0]; }
1039 LOperand* left() { return inputs_[1]; }
1040 LOperand* right() { return inputs_[2]; }
1041
1042 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
1043 "string-compare-and-branch")
1044 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
1045
1046 Token::Value op() const { return hydrogen()->token(); }
1047
1048 void PrintDataTo(StringStream* stream) override;
1049};
1050
1051
1052class LHasInstanceTypeAndBranch final : public LControlInstruction<1, 0> {
1053 public:
1054 explicit LHasInstanceTypeAndBranch(LOperand* value) {
1055 inputs_[0] = value;
1056 }
1057
1058 LOperand* value() { return inputs_[0]; }
1059
1060 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
1061 "has-instance-type-and-branch")
1062 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
1063
1064 void PrintDataTo(StringStream* stream) override;
1065};
1066
1067
1068class LGetCachedArrayIndex final : public LTemplateInstruction<1, 1, 0> {
1069 public:
1070 explicit LGetCachedArrayIndex(LOperand* value) {
1071 inputs_[0] = value;
1072 }
1073
1074 LOperand* value() { return inputs_[0]; }
1075
1076 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
1077 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
1078};
1079
1080
1081class LHasCachedArrayIndexAndBranch final : public LControlInstruction<1, 0> {
1082 public:
1083 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
1084 inputs_[0] = value;
1085 }
1086
1087 LOperand* value() { return inputs_[0]; }
1088
1089 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
1090 "has-cached-array-index-and-branch")
1091 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
1092
1093 void PrintDataTo(StringStream* stream) override;
1094};
1095
1096
1097class LClassOfTestAndBranch final : public LControlInstruction<1, 1> {
1098 public:
1099 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
1100 inputs_[0] = value;
1101 temps_[0] = temp;
1102 }
1103
1104 LOperand* value() { return inputs_[0]; }
1105 LOperand* temp() { return temps_[0]; }
1106
1107 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1108 "class-of-test-and-branch")
1109 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1110
1111 void PrintDataTo(StringStream* stream) override;
1112};
1113
1114
1115class LCmpT final : public LTemplateInstruction<1, 3, 0> {
1116 public:
1117 LCmpT(LOperand* context, LOperand* left, LOperand* right) {
1118 inputs_[0] = context;
1119 inputs_[1] = left;
1120 inputs_[2] = right;
1121 }
1122
1123 LOperand* context() { return inputs_[0]; }
1124 LOperand* left() { return inputs_[1]; }
1125 LOperand* right() { return inputs_[2]; }
1126
1127 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1128 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1129
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001130 Token::Value op() const { return hydrogen()->token(); }
1131};
1132
1133
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001134class LHasInPrototypeChainAndBranch final : public LControlInstruction<2, 0> {
1135 public:
1136 LHasInPrototypeChainAndBranch(LOperand* object, LOperand* prototype) {
1137 inputs_[0] = object;
1138 inputs_[1] = prototype;
1139 }
1140
1141 LOperand* object() const { return inputs_[0]; }
1142 LOperand* prototype() const { return inputs_[1]; }
1143
1144 DECLARE_CONCRETE_INSTRUCTION(HasInPrototypeChainAndBranch,
1145 "has-in-prototype-chain-and-branch")
1146 DECLARE_HYDROGEN_ACCESSOR(HasInPrototypeChainAndBranch)
1147};
1148
1149
1150class LBoundsCheck final : public LTemplateInstruction<0, 2, 0> {
1151 public:
1152 LBoundsCheck(LOperand* index, LOperand* length) {
1153 inputs_[0] = index;
1154 inputs_[1] = length;
1155 }
1156
1157 LOperand* index() { return inputs_[0]; }
1158 LOperand* length() { return inputs_[1]; }
1159
1160 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
1161 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
1162};
1163
1164
1165class LBitI final : public LTemplateInstruction<1, 2, 0> {
1166 public:
1167 LBitI(LOperand* left, LOperand* right) {
1168 inputs_[0] = left;
1169 inputs_[1] = right;
1170 }
1171
1172 LOperand* left() { return inputs_[0]; }
1173 LOperand* right() { return inputs_[1]; }
1174
1175 Token::Value op() const { return hydrogen()->op(); }
1176
1177 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1178 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1179};
1180
1181
1182class LShiftI final : public LTemplateInstruction<1, 2, 0> {
1183 public:
1184 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1185 : op_(op), can_deopt_(can_deopt) {
1186 inputs_[0] = left;
1187 inputs_[1] = right;
1188 }
1189
1190 Token::Value op() const { return op_; }
1191 LOperand* left() { return inputs_[0]; }
1192 LOperand* right() { return inputs_[1]; }
1193 bool can_deopt() const { return can_deopt_; }
1194
1195 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1196
1197 private:
1198 Token::Value op_;
1199 bool can_deopt_;
1200};
1201
1202
1203class LSubI final : public LTemplateInstruction<1, 2, 0> {
1204 public:
1205 LSubI(LOperand* left, LOperand* right) {
1206 inputs_[0] = left;
1207 inputs_[1] = right;
1208 }
1209
1210 LOperand* left() { return inputs_[0]; }
1211 LOperand* right() { return inputs_[1]; }
1212
1213 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1214 DECLARE_HYDROGEN_ACCESSOR(Sub)
1215};
1216
1217
1218class LSubS final : public LTemplateInstruction<1, 2, 0> {
1219 public:
1220 LSubS(LOperand* left, LOperand* right) {
1221 inputs_[0] = left;
1222 inputs_[1] = right;
1223 }
1224
1225 LOperand* left() { return inputs_[0]; }
1226 LOperand* right() { return inputs_[1]; }
1227
1228 DECLARE_CONCRETE_INSTRUCTION(SubS, "sub-s")
1229 DECLARE_HYDROGEN_ACCESSOR(Sub)
1230};
1231
1232
1233class LConstantI final : public LTemplateInstruction<1, 0, 0> {
1234 public:
1235 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1236 DECLARE_HYDROGEN_ACCESSOR(Constant)
1237
1238 int32_t value() const { return hydrogen()->Integer32Value(); }
1239};
1240
1241
1242class LConstantS final : public LTemplateInstruction<1, 0, 0> {
1243 public:
1244 DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s")
1245 DECLARE_HYDROGEN_ACCESSOR(Constant)
1246
1247 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); }
1248};
1249
1250
1251class LConstantD final : public LTemplateInstruction<1, 0, 0> {
1252 public:
1253 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1254 DECLARE_HYDROGEN_ACCESSOR(Constant)
1255
1256 double value() const { return hydrogen()->DoubleValue(); }
1257};
1258
1259
1260class LConstantE final : public LTemplateInstruction<1, 0, 0> {
1261 public:
1262 DECLARE_CONCRETE_INSTRUCTION(ConstantE, "constant-e")
1263 DECLARE_HYDROGEN_ACCESSOR(Constant)
1264
1265 ExternalReference value() const {
1266 return hydrogen()->ExternalReferenceValue();
1267 }
1268};
1269
1270
1271class LConstantT final : public LTemplateInstruction<1, 0, 0> {
1272 public:
1273 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1274 DECLARE_HYDROGEN_ACCESSOR(Constant)
1275
1276 Handle<Object> value(Isolate* isolate) const {
1277 return hydrogen()->handle(isolate);
1278 }
1279};
1280
1281
1282class LBranch final : public LControlInstruction<1, 0> {
1283 public:
1284 explicit LBranch(LOperand* value) {
1285 inputs_[0] = value;
1286 }
1287
1288 LOperand* value() { return inputs_[0]; }
1289
1290 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1291 DECLARE_HYDROGEN_ACCESSOR(Branch)
1292
1293 void PrintDataTo(StringStream* stream) override;
1294};
1295
1296
1297class LCmpMapAndBranch final : public LControlInstruction<1, 1> {
1298 public:
1299 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1300 inputs_[0] = value;
1301 temps_[0] = temp;
1302 }
1303
1304 LOperand* value() { return inputs_[0]; }
1305 LOperand* temp() { return temps_[0]; }
1306
1307 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1308 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1309
1310 Handle<Map> map() const { return hydrogen()->map().handle(); }
1311};
1312
1313
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001314class LSeqStringGetChar final : public LTemplateInstruction<1, 2, 0> {
1315 public:
1316 LSeqStringGetChar(LOperand* string, LOperand* index) {
1317 inputs_[0] = string;
1318 inputs_[1] = index;
1319 }
1320
1321 LOperand* string() const { return inputs_[0]; }
1322 LOperand* index() const { return inputs_[1]; }
1323
1324 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar, "seq-string-get-char")
1325 DECLARE_HYDROGEN_ACCESSOR(SeqStringGetChar)
1326};
1327
1328
1329class LSeqStringSetChar final : public LTemplateInstruction<1, 4, 0> {
1330 public:
1331 LSeqStringSetChar(LOperand* context,
1332 LOperand* string,
1333 LOperand* index,
1334 LOperand* value) {
1335 inputs_[0] = context;
1336 inputs_[1] = string;
1337 inputs_[2] = index;
1338 inputs_[3] = value;
1339 }
1340
1341 LOperand* string() { return inputs_[1]; }
1342 LOperand* index() { return inputs_[2]; }
1343 LOperand* value() { return inputs_[3]; }
1344
1345 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1346 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1347};
1348
1349
1350class LAddE final : public LTemplateInstruction<1, 2, 0> {
1351 public:
1352 LAddE(LOperand* left, LOperand* right) {
1353 inputs_[0] = left;
1354 inputs_[1] = right;
1355 }
1356
1357 LOperand* left() { return inputs_[0]; }
1358 LOperand* right() { return inputs_[1]; }
1359
1360 DECLARE_CONCRETE_INSTRUCTION(AddE, "add-e")
1361 DECLARE_HYDROGEN_ACCESSOR(Add)
1362};
1363
1364
1365class LAddI final : public LTemplateInstruction<1, 2, 0> {
1366 public:
1367 LAddI(LOperand* left, LOperand* right) {
1368 inputs_[0] = left;
1369 inputs_[1] = right;
1370 }
1371
1372 LOperand* left() { return inputs_[0]; }
1373 LOperand* right() { return inputs_[1]; }
1374
1375 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1376 DECLARE_HYDROGEN_ACCESSOR(Add)
1377};
1378
1379
1380class LAddS final : public LTemplateInstruction<1, 2, 0> {
1381 public:
1382 LAddS(LOperand* left, LOperand* right) {
1383 inputs_[0] = left;
1384 inputs_[1] = right;
1385 }
1386
1387 LOperand* left() { return inputs_[0]; }
1388 LOperand* right() { return inputs_[1]; }
1389
1390 DECLARE_CONCRETE_INSTRUCTION(AddS, "add-s")
1391 DECLARE_HYDROGEN_ACCESSOR(Add)
1392};
1393
1394
1395class LMathMinMax final : public LTemplateInstruction<1, 2, 0> {
1396 public:
1397 LMathMinMax(LOperand* left, LOperand* right) {
1398 inputs_[0] = left;
1399 inputs_[1] = right;
1400 }
1401
1402 LOperand* left() { return inputs_[0]; }
1403 LOperand* right() { return inputs_[1]; }
1404
1405 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
1406 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1407};
1408
1409
1410class LPower final : public LTemplateInstruction<1, 2, 0> {
1411 public:
1412 LPower(LOperand* left, LOperand* right) {
1413 inputs_[0] = left;
1414 inputs_[1] = right;
1415 }
1416
1417 LOperand* left() { return inputs_[0]; }
1418 LOperand* right() { return inputs_[1]; }
1419
1420 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1421 DECLARE_HYDROGEN_ACCESSOR(Power)
1422};
1423
1424
1425class LArithmeticD final : public LTemplateInstruction<1, 2, 0> {
1426 public:
1427 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1428 : op_(op) {
1429 inputs_[0] = left;
1430 inputs_[1] = right;
1431 }
1432
1433 Token::Value op() const { return op_; }
1434 LOperand* left() { return inputs_[0]; }
1435 LOperand* right() { return inputs_[1]; }
1436
1437 Opcode opcode() const override { return LInstruction::kArithmeticD; }
1438 void CompileToNative(LCodeGen* generator) override;
1439 const char* Mnemonic() const override;
1440
1441 private:
1442 Token::Value op_;
1443};
1444
1445
1446class LArithmeticT final : public LTemplateInstruction<1, 3, 0> {
1447 public:
1448 LArithmeticT(Token::Value op,
1449 LOperand* context,
1450 LOperand* left,
1451 LOperand* right)
1452 : op_(op) {
1453 inputs_[0] = context;
1454 inputs_[1] = left;
1455 inputs_[2] = right;
1456 }
1457
1458 LOperand* context() { return inputs_[0]; }
1459 LOperand* left() { return inputs_[1]; }
1460 LOperand* right() { return inputs_[2]; }
1461 Token::Value op() const { return op_; }
1462
1463 Opcode opcode() const final { return LInstruction::kArithmeticT; }
1464 void CompileToNative(LCodeGen* generator) override;
1465 const char* Mnemonic() const override;
1466
1467 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
1468
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001469 private:
1470 Token::Value op_;
1471};
1472
1473
1474class LReturn final : public LTemplateInstruction<0, 3, 0> {
1475 public:
1476 LReturn(LOperand* value, LOperand* context, LOperand* parameter_count) {
1477 inputs_[0] = value;
1478 inputs_[1] = context;
1479 inputs_[2] = parameter_count;
1480 }
1481
1482 LOperand* value() { return inputs_[0]; }
1483
1484 bool has_constant_parameter_count() {
1485 return parameter_count()->IsConstantOperand();
1486 }
1487 LConstantOperand* constant_parameter_count() {
1488 DCHECK(has_constant_parameter_count());
1489 return LConstantOperand::cast(parameter_count());
1490 }
1491 LOperand* parameter_count() { return inputs_[2]; }
1492
1493 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1494};
1495
1496
1497class LLoadNamedField final : public LTemplateInstruction<1, 1, 0> {
1498 public:
1499 explicit LLoadNamedField(LOperand* object) {
1500 inputs_[0] = object;
1501 }
1502
1503 LOperand* object() { return inputs_[0]; }
1504
1505 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1506 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1507};
1508
1509
1510class LLoadNamedGeneric final : public LTemplateInstruction<1, 2, 1> {
1511 public:
1512 LLoadNamedGeneric(LOperand* context, LOperand* object, LOperand* vector) {
1513 inputs_[0] = context;
1514 inputs_[1] = object;
1515 temps_[0] = vector;
1516 }
1517
1518 LOperand* context() { return inputs_[0]; }
1519 LOperand* object() { return inputs_[1]; }
1520 LOperand* temp_vector() { return temps_[0]; }
1521
1522 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1523 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1524
1525 Handle<Object> name() const { return hydrogen()->name(); }
1526};
1527
1528
1529class LLoadFunctionPrototype final : public LTemplateInstruction<1, 1, 0> {
1530 public:
1531 explicit LLoadFunctionPrototype(LOperand* function) {
1532 inputs_[0] = function;
1533 }
1534
1535 LOperand* function() { return inputs_[0]; }
1536
1537 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1538 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1539};
1540
1541
1542class LLoadRoot final : public LTemplateInstruction<1, 0, 0> {
1543 public:
1544 DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
1545 DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
1546
1547 Heap::RootListIndex index() const { return hydrogen()->index(); }
1548};
1549
1550
1551class LLoadKeyed final : public LTemplateInstruction<1, 3, 0> {
1552 public:
1553 LLoadKeyed(LOperand* elements, LOperand* key, LOperand* backing_store_owner) {
1554 inputs_[0] = elements;
1555 inputs_[1] = key;
1556 inputs_[2] = backing_store_owner;
1557 }
1558
1559 LOperand* elements() { return inputs_[0]; }
1560 LOperand* key() { return inputs_[1]; }
1561 LOperand* backing_store_owner() { return inputs_[2]; }
1562 ElementsKind elements_kind() const {
1563 return hydrogen()->elements_kind();
1564 }
1565 bool is_fixed_typed_array() const {
1566 return hydrogen()->is_fixed_typed_array();
1567 }
1568
1569 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1570 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1571
1572 void PrintDataTo(StringStream* stream) override;
1573 uint32_t base_offset() const { return hydrogen()->base_offset(); }
1574};
1575
1576
1577class LLoadKeyedGeneric final : public LTemplateInstruction<1, 3, 1> {
1578 public:
1579 LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key,
1580 LOperand* vector) {
1581 inputs_[0] = context;
1582 inputs_[1] = object;
1583 inputs_[2] = key;
1584 temps_[0] = vector;
1585 }
1586
1587 LOperand* context() { return inputs_[0]; }
1588 LOperand* object() { return inputs_[1]; }
1589 LOperand* key() { return inputs_[2]; }
1590 LOperand* temp_vector() { return temps_[0]; }
1591
1592 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1593 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedGeneric)
1594};
1595
1596
1597class LLoadGlobalGeneric final : public LTemplateInstruction<1, 2, 1> {
1598 public:
1599 LLoadGlobalGeneric(LOperand* context, LOperand* global_object,
1600 LOperand* vector) {
1601 inputs_[0] = context;
1602 inputs_[1] = global_object;
1603 temps_[0] = vector;
1604 }
1605
1606 LOperand* context() { return inputs_[0]; }
1607 LOperand* global_object() { return inputs_[1]; }
1608 LOperand* temp_vector() { return temps_[0]; }
1609
1610 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1611 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1612
1613 Handle<Object> name() const { return hydrogen()->name(); }
1614 TypeofMode typeof_mode() const { return hydrogen()->typeof_mode(); }
1615};
1616
1617
1618class LLoadContextSlot final : public LTemplateInstruction<1, 1, 0> {
1619 public:
1620 explicit LLoadContextSlot(LOperand* context) {
1621 inputs_[0] = context;
1622 }
1623
1624 LOperand* context() { return inputs_[0]; }
1625
1626 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1627 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1628
1629 int slot_index() { return hydrogen()->slot_index(); }
1630
1631 void PrintDataTo(StringStream* stream) override;
1632};
1633
1634
1635class LStoreContextSlot final : public LTemplateInstruction<0, 2, 0> {
1636 public:
1637 LStoreContextSlot(LOperand* context, LOperand* value) {
1638 inputs_[0] = context;
1639 inputs_[1] = value;
1640 }
1641
1642 LOperand* context() { return inputs_[0]; }
1643 LOperand* value() { return inputs_[1]; }
1644
1645 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1646 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1647
1648 int slot_index() { return hydrogen()->slot_index(); }
1649
1650 void PrintDataTo(StringStream* stream) override;
1651};
1652
1653
1654class LPushArgument final : public LTemplateInstruction<0, 1, 0> {
1655 public:
1656 explicit LPushArgument(LOperand* value) {
1657 inputs_[0] = value;
1658 }
1659
1660 LOperand* value() { return inputs_[0]; }
1661
1662 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1663};
1664
1665
1666class LDrop final : public LTemplateInstruction<0, 0, 0> {
1667 public:
1668 explicit LDrop(int count) : count_(count) { }
1669
1670 int count() const { return count_; }
1671
1672 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1673
1674 private:
1675 int count_;
1676};
1677
1678
1679class LStoreCodeEntry final : public LTemplateInstruction<0, 2, 0> {
1680 public:
1681 LStoreCodeEntry(LOperand* function, LOperand* code_object) {
1682 inputs_[0] = function;
1683 inputs_[1] = code_object;
1684 }
1685
1686 LOperand* function() { return inputs_[0]; }
1687 LOperand* code_object() { return inputs_[1]; }
1688
1689 void PrintDataTo(StringStream* stream) override;
1690
1691 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry, "store-code-entry")
1692 DECLARE_HYDROGEN_ACCESSOR(StoreCodeEntry)
1693};
1694
1695
1696class LInnerAllocatedObject final : public LTemplateInstruction<1, 2, 0> {
1697 public:
1698 LInnerAllocatedObject(LOperand* base_object, LOperand* offset) {
1699 inputs_[0] = base_object;
1700 inputs_[1] = offset;
1701 }
1702
1703 LOperand* base_object() const { return inputs_[0]; }
1704 LOperand* offset() const { return inputs_[1]; }
1705
1706 void PrintDataTo(StringStream* stream) override;
1707
1708 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "inner-allocated-object")
1709};
1710
1711
1712class LThisFunction final : public LTemplateInstruction<1, 0, 0> {
1713 public:
1714 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1715 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1716};
1717
1718
1719class LContext final : public LTemplateInstruction<1, 0, 0> {
1720 public:
1721 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1722 DECLARE_HYDROGEN_ACCESSOR(Context)
1723};
1724
1725
1726class LDeclareGlobals final : public LTemplateInstruction<0, 1, 0> {
1727 public:
1728 explicit LDeclareGlobals(LOperand* context) {
1729 inputs_[0] = context;
1730 }
1731
1732 LOperand* context() { return inputs_[0]; }
1733
1734 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1735 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1736};
1737
1738
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001739class LCallWithDescriptor final : public LTemplateResultInstruction<1> {
1740 public:
1741 LCallWithDescriptor(CallInterfaceDescriptor descriptor,
1742 const ZoneList<LOperand*>& operands, Zone* zone)
1743 : descriptor_(descriptor),
1744 inputs_(descriptor.GetRegisterParameterCount() +
1745 kImplicitRegisterParameterCount,
1746 zone) {
1747 DCHECK(descriptor.GetRegisterParameterCount() +
1748 kImplicitRegisterParameterCount ==
1749 operands.length());
1750 inputs_.AddAll(operands, zone);
1751 }
1752
1753 LOperand* target() const { return inputs_[0]; }
1754
1755 const CallInterfaceDescriptor descriptor() { return descriptor_; }
1756
1757 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1758
1759 // The target and context are passed as implicit parameters that are not
1760 // explicitly listed in the descriptor.
1761 static const int kImplicitRegisterParameterCount = 2;
1762
1763 private:
1764 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1765
1766 void PrintDataTo(StringStream* stream) override;
1767
1768 int arity() const { return hydrogen()->argument_count() - 1; }
1769
1770 CallInterfaceDescriptor descriptor_;
1771 ZoneList<LOperand*> inputs_;
1772
1773 // Iterator support.
1774 int InputCount() final { return inputs_.length(); }
1775 LOperand* InputAt(int i) final { return inputs_[i]; }
1776
1777 int TempCount() final { return 0; }
1778 LOperand* TempAt(int i) final { return NULL; }
1779};
1780
1781
1782class LInvokeFunction final : public LTemplateInstruction<1, 2, 0> {
1783 public:
1784 LInvokeFunction(LOperand* context, LOperand* function) {
1785 inputs_[0] = context;
1786 inputs_[1] = function;
1787 }
1788
1789 LOperand* context() { return inputs_[0]; }
1790 LOperand* function() { return inputs_[1]; }
1791
1792 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1793 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1794
1795 void PrintDataTo(StringStream* stream) override;
1796
1797 int arity() const { return hydrogen()->argument_count() - 1; }
1798};
1799
1800
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001801class LCallNewArray final : public LTemplateInstruction<1, 2, 0> {
1802 public:
1803 LCallNewArray(LOperand* context, LOperand* constructor) {
1804 inputs_[0] = context;
1805 inputs_[1] = constructor;
1806 }
1807
1808 LOperand* context() { return inputs_[0]; }
1809 LOperand* constructor() { return inputs_[1]; }
1810
1811 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1812 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1813
1814 void PrintDataTo(StringStream* stream) override;
1815
1816 int arity() const { return hydrogen()->argument_count() - 1; }
1817};
1818
1819
1820class LCallRuntime final : public LTemplateInstruction<1, 1, 0> {
1821 public:
1822 explicit LCallRuntime(LOperand* context) {
1823 inputs_[0] = context;
1824 }
1825
1826 LOperand* context() { return inputs_[0]; }
1827
1828 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1829 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1830
1831 bool ClobbersDoubleRegisters(Isolate* isolate) const override {
1832 return save_doubles() == kDontSaveFPRegs;
1833 }
1834
1835 const Runtime::Function* function() const { return hydrogen()->function(); }
1836 int arity() const { return hydrogen()->argument_count(); }
1837 SaveFPRegsMode save_doubles() const { return hydrogen()->save_doubles(); }
1838};
1839
1840
1841class LInteger32ToDouble final : public LTemplateInstruction<1, 1, 0> {
1842 public:
1843 explicit LInteger32ToDouble(LOperand* value) {
1844 inputs_[0] = value;
1845 }
1846
1847 LOperand* value() { return inputs_[0]; }
1848
1849 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1850};
1851
1852
1853class LUint32ToDouble final : public LTemplateInstruction<1, 1, 0> {
1854 public:
1855 explicit LUint32ToDouble(LOperand* value) {
1856 inputs_[0] = value;
1857 }
1858
1859 LOperand* value() { return inputs_[0]; }
1860
1861 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1862};
1863
1864
1865class LNumberTagU final : public LTemplateInstruction<1, 1, 2> {
1866 public:
1867 LNumberTagU(LOperand* value, LOperand* temp1, LOperand* temp2) {
1868 inputs_[0] = value;
1869 temps_[0] = temp1;
1870 temps_[1] = temp2;
1871 }
1872
1873 LOperand* value() { return inputs_[0]; }
1874 LOperand* temp1() { return temps_[0]; }
1875 LOperand* temp2() { return temps_[1]; }
1876
1877 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1878};
1879
1880
1881class LNumberTagD final : public LTemplateInstruction<1, 1, 2> {
1882 public:
1883 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
1884 inputs_[0] = value;
1885 temps_[0] = temp;
1886 temps_[1] = temp2;
1887 }
1888
1889 LOperand* value() { return inputs_[0]; }
1890 LOperand* temp() { return temps_[0]; }
1891 LOperand* temp2() { return temps_[1]; }
1892
1893 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1894 DECLARE_HYDROGEN_ACCESSOR(Change)
1895};
1896
1897
1898class LDoubleToSmi final : public LTemplateInstruction<1, 1, 0> {
1899 public:
1900 explicit LDoubleToSmi(LOperand* value) {
1901 inputs_[0] = value;
1902 }
1903
1904 LOperand* value() { return inputs_[0]; }
1905
1906 DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi")
1907 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1908
1909 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1910};
1911
1912
1913// Sometimes truncating conversion from a tagged value to an int32.
1914class LDoubleToI final : public LTemplateInstruction<1, 1, 0> {
1915 public:
1916 explicit LDoubleToI(LOperand* value) {
1917 inputs_[0] = value;
1918 }
1919
1920 LOperand* value() { return inputs_[0]; }
1921
1922 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1923 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1924
1925 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1926};
1927
1928
1929// Truncating conversion from a tagged value to an int32.
1930class LTaggedToI final : public LTemplateInstruction<1, 1, 2> {
1931 public:
1932 LTaggedToI(LOperand* value,
1933 LOperand* temp,
1934 LOperand* temp2) {
1935 inputs_[0] = value;
1936 temps_[0] = temp;
1937 temps_[1] = temp2;
1938 }
1939
1940 LOperand* value() { return inputs_[0]; }
1941 LOperand* temp() { return temps_[0]; }
1942 LOperand* temp2() { return temps_[1]; }
1943
1944 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1945 DECLARE_HYDROGEN_ACCESSOR(Change)
1946
1947 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1948};
1949
1950
1951class LSmiTag final : public LTemplateInstruction<1, 1, 0> {
1952 public:
1953 explicit LSmiTag(LOperand* value) {
1954 inputs_[0] = value;
1955 }
1956
1957 LOperand* value() { return inputs_[0]; }
1958
1959 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1960 DECLARE_HYDROGEN_ACCESSOR(Change)
1961};
1962
1963
1964class LNumberUntagD final : public LTemplateInstruction<1, 1, 0> {
1965 public:
1966 explicit LNumberUntagD(LOperand* value) {
1967 inputs_[0] = value;
1968 }
1969
1970 LOperand* value() { return inputs_[0]; }
1971
1972 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1973 DECLARE_HYDROGEN_ACCESSOR(Change)
1974};
1975
1976
1977class LSmiUntag final : public LTemplateInstruction<1, 1, 0> {
1978 public:
1979 LSmiUntag(LOperand* value, bool needs_check)
1980 : needs_check_(needs_check) {
1981 inputs_[0] = value;
1982 }
1983
1984 LOperand* value() { return inputs_[0]; }
1985 bool needs_check() const { return needs_check_; }
1986
1987 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1988
1989 private:
1990 bool needs_check_;
1991};
1992
1993
1994class LStoreNamedField final : public LTemplateInstruction<0, 2, 1> {
1995 public:
1996 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
1997 inputs_[0] = object;
1998 inputs_[1] = value;
1999 temps_[0] = temp;
2000 }
2001
2002 LOperand* object() { return inputs_[0]; }
2003 LOperand* value() { return inputs_[1]; }
2004 LOperand* temp() { return temps_[0]; }
2005
2006 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2007 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2008
2009 void PrintDataTo(StringStream* stream) override;
2010
2011 Representation representation() const {
2012 return hydrogen()->field_representation();
2013 }
2014};
2015
2016
2017class LStoreNamedGeneric final : public LTemplateInstruction<0, 3, 2> {
2018 public:
2019 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value,
2020 LOperand* slot, LOperand* vector) {
2021 inputs_[0] = context;
2022 inputs_[1] = object;
2023 inputs_[2] = value;
2024 temps_[0] = slot;
2025 temps_[1] = vector;
2026 }
2027
2028 LOperand* context() { return inputs_[0]; }
2029 LOperand* object() { return inputs_[1]; }
2030 LOperand* value() { return inputs_[2]; }
2031 LOperand* temp_slot() { return temps_[0]; }
2032 LOperand* temp_vector() { return temps_[1]; }
2033
2034 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2035 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2036
2037 void PrintDataTo(StringStream* stream) override;
2038
2039 Handle<Object> name() const { return hydrogen()->name(); }
2040 LanguageMode language_mode() { return hydrogen()->language_mode(); }
2041};
2042
2043
2044class LStoreKeyed final : public LTemplateInstruction<0, 4, 0> {
2045 public:
2046 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value,
2047 LOperand* backing_store_owner) {
2048 inputs_[0] = object;
2049 inputs_[1] = key;
2050 inputs_[2] = value;
2051 inputs_[3] = backing_store_owner;
2052 }
2053
2054 bool is_fixed_typed_array() const {
2055 return hydrogen()->is_fixed_typed_array();
2056 }
2057 LOperand* elements() { return inputs_[0]; }
2058 LOperand* key() { return inputs_[1]; }
2059 LOperand* value() { return inputs_[2]; }
2060 LOperand* backing_store_owner() { return inputs_[3]; }
2061 ElementsKind elements_kind() const {
2062 return hydrogen()->elements_kind();
2063 }
2064
2065 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2066 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
2067
2068 void PrintDataTo(StringStream* stream) override;
2069 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
2070 uint32_t base_offset() const { return hydrogen()->base_offset(); }
2071};
2072
2073
2074class LStoreKeyedGeneric final : public LTemplateInstruction<0, 4, 2> {
2075 public:
2076 LStoreKeyedGeneric(LOperand* context, LOperand* object, LOperand* key,
2077 LOperand* value, LOperand* slot, LOperand* vector) {
2078 inputs_[0] = context;
2079 inputs_[1] = object;
2080 inputs_[2] = key;
2081 inputs_[3] = value;
2082 temps_[0] = slot;
2083 temps_[1] = vector;
2084 }
2085
2086 LOperand* context() { return inputs_[0]; }
2087 LOperand* object() { return inputs_[1]; }
2088 LOperand* key() { return inputs_[2]; }
2089 LOperand* value() { return inputs_[3]; }
2090 LOperand* temp_slot() { return temps_[0]; }
2091 LOperand* temp_vector() { return temps_[1]; }
2092
2093 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2094 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2095
2096 void PrintDataTo(StringStream* stream) override;
2097
2098 LanguageMode language_mode() { return hydrogen()->language_mode(); }
2099};
2100
2101
2102class LTransitionElementsKind final : public LTemplateInstruction<0, 2, 1> {
2103 public:
2104 LTransitionElementsKind(LOperand* object,
2105 LOperand* context,
2106 LOperand* new_map_temp) {
2107 inputs_[0] = object;
2108 inputs_[1] = context;
2109 temps_[0] = new_map_temp;
2110 }
2111
2112 LOperand* context() { return inputs_[1]; }
2113 LOperand* object() { return inputs_[0]; }
2114 LOperand* new_map_temp() { return temps_[0]; }
2115
2116 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2117 "transition-elements-kind")
2118 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2119
2120 void PrintDataTo(StringStream* stream) override;
2121
2122 Handle<Map> original_map() { return hydrogen()->original_map().handle(); }
2123 Handle<Map> transitioned_map() {
2124 return hydrogen()->transitioned_map().handle();
2125 }
2126 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2127 ElementsKind to_kind() { return hydrogen()->to_kind(); }
2128};
2129
2130
2131class LTrapAllocationMemento final : public LTemplateInstruction<0, 1, 1> {
2132 public:
2133 LTrapAllocationMemento(LOperand* object,
2134 LOperand* temp) {
2135 inputs_[0] = object;
2136 temps_[0] = temp;
2137 }
2138
2139 LOperand* object() { return inputs_[0]; }
2140 LOperand* temp() { return temps_[0]; }
2141
2142 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2143 "trap-allocation-memento")
2144};
2145
2146
2147class LMaybeGrowElements final : public LTemplateInstruction<1, 5, 0> {
2148 public:
2149 LMaybeGrowElements(LOperand* context, LOperand* object, LOperand* elements,
2150 LOperand* key, LOperand* current_capacity) {
2151 inputs_[0] = context;
2152 inputs_[1] = object;
2153 inputs_[2] = elements;
2154 inputs_[3] = key;
2155 inputs_[4] = current_capacity;
2156 }
2157
2158 LOperand* context() { return inputs_[0]; }
2159 LOperand* object() { return inputs_[1]; }
2160 LOperand* elements() { return inputs_[2]; }
2161 LOperand* key() { return inputs_[3]; }
2162 LOperand* current_capacity() { return inputs_[4]; }
2163
2164 DECLARE_HYDROGEN_ACCESSOR(MaybeGrowElements)
2165 DECLARE_CONCRETE_INSTRUCTION(MaybeGrowElements, "maybe-grow-elements")
2166};
2167
2168
2169class LStringAdd final : public LTemplateInstruction<1, 3, 0> {
2170 public:
2171 LStringAdd(LOperand* context, LOperand* left, LOperand* right) {
2172 inputs_[0] = context;
2173 inputs_[1] = left;
2174 inputs_[2] = right;
2175 }
2176
2177 LOperand* context() { return inputs_[0]; }
2178 LOperand* left() { return inputs_[1]; }
2179 LOperand* right() { return inputs_[2]; }
2180
2181 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2182 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
2183};
2184
2185
2186class LStringCharCodeAt final : public LTemplateInstruction<1, 3, 0> {
2187 public:
2188 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) {
2189 inputs_[0] = context;
2190 inputs_[1] = string;
2191 inputs_[2] = index;
2192 }
2193
2194 LOperand* context() { return inputs_[0]; }
2195 LOperand* string() { return inputs_[1]; }
2196 LOperand* index() { return inputs_[2]; }
2197
2198 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2199 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
2200};
2201
2202
2203class LStringCharFromCode final : public LTemplateInstruction<1, 2, 0> {
2204 public:
2205 explicit LStringCharFromCode(LOperand* context, LOperand* char_code) {
2206 inputs_[0] = context;
2207 inputs_[1] = char_code;
2208 }
2209
2210 LOperand* context() { return inputs_[0]; }
2211 LOperand* char_code() { return inputs_[1]; }
2212
2213 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2214 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
2215};
2216
2217
2218class LCheckValue final : public LTemplateInstruction<0, 1, 0> {
2219 public:
2220 explicit LCheckValue(LOperand* value) {
2221 inputs_[0] = value;
2222 }
2223
2224 LOperand* value() { return inputs_[0]; }
2225
2226 DECLARE_CONCRETE_INSTRUCTION(CheckValue, "check-value")
2227 DECLARE_HYDROGEN_ACCESSOR(CheckValue)
2228};
2229
2230
2231class LCheckArrayBufferNotNeutered final
2232 : public LTemplateInstruction<0, 1, 0> {
2233 public:
2234 explicit LCheckArrayBufferNotNeutered(LOperand* view) { inputs_[0] = view; }
2235
2236 LOperand* view() { return inputs_[0]; }
2237
2238 DECLARE_CONCRETE_INSTRUCTION(CheckArrayBufferNotNeutered,
2239 "check-array-buffer-not-neutered")
2240 DECLARE_HYDROGEN_ACCESSOR(CheckArrayBufferNotNeutered)
2241};
2242
2243
2244class LCheckInstanceType final : public LTemplateInstruction<0, 1, 0> {
2245 public:
2246 explicit LCheckInstanceType(LOperand* value) {
2247 inputs_[0] = value;
2248 }
2249
2250 LOperand* value() { return inputs_[0]; }
2251
2252 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2253 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2254};
2255
2256
2257class LCheckMaps final : public LTemplateInstruction<0, 1, 0> {
2258 public:
2259 explicit LCheckMaps(LOperand* value = NULL) {
2260 inputs_[0] = value;
2261 }
2262
2263 LOperand* value() { return inputs_[0]; }
2264
2265 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2266 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
2267};
2268
2269
2270class LCheckSmi final : public LTemplateInstruction<1, 1, 0> {
2271 public:
2272 explicit LCheckSmi(LOperand* value) {
2273 inputs_[0] = value;
2274 }
2275
2276 LOperand* value() { return inputs_[0]; }
2277
2278 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2279};
2280
2281
2282class LCheckNonSmi final : public LTemplateInstruction<0, 1, 0> {
2283 public:
2284 explicit LCheckNonSmi(LOperand* value) {
2285 inputs_[0] = value;
2286 }
2287
2288 LOperand* value() { return inputs_[0]; }
2289
2290 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2291 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject)
2292};
2293
2294
2295class LClampDToUint8 final : public LTemplateInstruction<1, 1, 1> {
2296 public:
2297 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2298 inputs_[0] = unclamped;
2299 temps_[0] = temp;
2300 }
2301
2302 LOperand* unclamped() { return inputs_[0]; }
2303 LOperand* temp() { return temps_[0]; }
2304
2305 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2306};
2307
2308
2309class LClampIToUint8 final : public LTemplateInstruction<1, 1, 0> {
2310 public:
2311 explicit LClampIToUint8(LOperand* unclamped) {
2312 inputs_[0] = unclamped;
2313 }
2314
2315 LOperand* unclamped() { return inputs_[0]; }
2316
2317 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2318};
2319
2320
2321class LClampTToUint8 final : public LTemplateInstruction<1, 1, 1> {
2322 public:
2323 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2324 inputs_[0] = unclamped;
2325 temps_[0] = temp;
2326 }
2327
2328 LOperand* unclamped() { return inputs_[0]; }
2329 LOperand* temp() { return temps_[0]; }
2330
2331 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2332};
2333
2334
2335class LDoubleBits final : public LTemplateInstruction<1, 1, 0> {
2336 public:
2337 explicit LDoubleBits(LOperand* value) {
2338 inputs_[0] = value;
2339 }
2340
2341 LOperand* value() { return inputs_[0]; }
2342
2343 DECLARE_CONCRETE_INSTRUCTION(DoubleBits, "double-bits")
2344 DECLARE_HYDROGEN_ACCESSOR(DoubleBits)
2345};
2346
2347
2348class LConstructDouble final : public LTemplateInstruction<1, 2, 0> {
2349 public:
2350 LConstructDouble(LOperand* hi, LOperand* lo) {
2351 inputs_[0] = hi;
2352 inputs_[1] = lo;
2353 }
2354
2355 LOperand* hi() { return inputs_[0]; }
2356 LOperand* lo() { return inputs_[1]; }
2357
2358 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble, "construct-double")
2359};
2360
2361
2362class LAllocate final : public LTemplateInstruction<1, 2, 2> {
2363 public:
2364 LAllocate(LOperand* context,
2365 LOperand* size,
2366 LOperand* temp1,
2367 LOperand* temp2) {
2368 inputs_[0] = context;
2369 inputs_[1] = size;
2370 temps_[0] = temp1;
2371 temps_[1] = temp2;
2372 }
2373
2374 LOperand* context() { return inputs_[0]; }
2375 LOperand* size() { return inputs_[1]; }
2376 LOperand* temp1() { return temps_[0]; }
2377 LOperand* temp2() { return temps_[1]; }
2378
2379 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2380 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2381};
2382
Ben Murdochc5610432016-08-08 18:44:38 +01002383class LFastAllocate final : public LTemplateInstruction<1, 1, 2> {
2384 public:
2385 LFastAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2386 inputs_[0] = size;
2387 temps_[0] = temp1;
2388 temps_[1] = temp2;
2389 }
2390
2391 LOperand* size() { return inputs_[0]; }
2392 LOperand* temp1() { return temps_[0]; }
2393 LOperand* temp2() { return temps_[1]; }
2394
2395 DECLARE_CONCRETE_INSTRUCTION(FastAllocate, "fast-allocate")
2396 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2397};
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00002398
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00002399class LTypeof final : public LTemplateInstruction<1, 2, 0> {
2400 public:
2401 LTypeof(LOperand* context, LOperand* value) {
2402 inputs_[0] = context;
2403 inputs_[1] = value;
2404 }
2405
2406 LOperand* context() { return inputs_[0]; }
2407 LOperand* value() { return inputs_[1]; }
2408
2409 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2410};
2411
2412
2413class LTypeofIsAndBranch final : public LControlInstruction<1, 0> {
2414 public:
2415 explicit LTypeofIsAndBranch(LOperand* value) {
2416 inputs_[0] = value;
2417 }
2418
2419 LOperand* value() { return inputs_[0]; }
2420
2421 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2422 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2423
2424 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2425
2426 void PrintDataTo(StringStream* stream) override;
2427};
2428
2429
2430class LOsrEntry final : public LTemplateInstruction<0, 0, 0> {
2431 public:
2432 LOsrEntry() {}
2433
2434 bool HasInterestingComment(LCodeGen* gen) const override { return false; }
2435 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2436};
2437
2438
2439class LStackCheck final : public LTemplateInstruction<0, 1, 0> {
2440 public:
2441 explicit LStackCheck(LOperand* context) {
2442 inputs_[0] = context;
2443 }
2444
2445 LOperand* context() { return inputs_[0]; }
2446
2447 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2448 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2449
2450 Label* done_label() { return &done_label_; }
2451
2452 private:
2453 Label done_label_;
2454};
2455
2456
2457class LForInPrepareMap final : public LTemplateInstruction<1, 2, 0> {
2458 public:
2459 LForInPrepareMap(LOperand* context, LOperand* object) {
2460 inputs_[0] = context;
2461 inputs_[1] = object;
2462 }
2463
2464 LOperand* context() { return inputs_[0]; }
2465 LOperand* object() { return inputs_[1]; }
2466
2467 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2468};
2469
2470
2471class LForInCacheArray final : public LTemplateInstruction<1, 1, 0> {
2472 public:
2473 explicit LForInCacheArray(LOperand* map) {
2474 inputs_[0] = map;
2475 }
2476
2477 LOperand* map() { return inputs_[0]; }
2478
2479 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2480
2481 int idx() {
2482 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2483 }
2484};
2485
2486
2487class LCheckMapValue final : public LTemplateInstruction<0, 2, 0> {
2488 public:
2489 LCheckMapValue(LOperand* value, LOperand* map) {
2490 inputs_[0] = value;
2491 inputs_[1] = map;
2492 }
2493
2494 LOperand* value() { return inputs_[0]; }
2495 LOperand* map() { return inputs_[1]; }
2496
2497 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2498};
2499
2500
2501class LLoadFieldByIndex final : public LTemplateInstruction<1, 2, 0> {
2502 public:
2503 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2504 inputs_[0] = object;
2505 inputs_[1] = index;
2506 }
2507
2508 LOperand* object() { return inputs_[0]; }
2509 LOperand* index() { return inputs_[1]; }
2510
2511 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2512};
2513
2514
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00002515class LChunkBuilder;
2516class LPlatformChunk final : public LChunk {
2517 public:
2518 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2519 : LChunk(info, graph) { }
2520
2521 int GetNextSpillIndex(RegisterKind kind);
2522 LOperand* GetNextSpillSlot(RegisterKind kind);
2523};
2524
2525
2526class LChunkBuilder final : public LChunkBuilderBase {
2527 public:
2528 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2529 : LChunkBuilderBase(info, graph),
2530 current_instruction_(NULL),
2531 current_block_(NULL),
2532 next_block_(NULL),
2533 allocator_(allocator) {}
2534
2535 // Build the sequence for the graph.
2536 LPlatformChunk* Build();
2537
2538 // Declare methods that deal with the individual node types.
2539#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2540 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2541#undef DECLARE_DO
2542
2543 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2544
2545 static bool HasMagicNumberForDivisor(int32_t divisor);
2546
2547 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2548 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2549 LInstruction* DoMathFround(HUnaryMathOperation* instr);
2550 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2551 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2552 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2553 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2554 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2555 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2556 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2557 LInstruction* DoDivByConstI(HDiv* instr);
2558 LInstruction* DoDivI(HDiv* instr);
2559 LInstruction* DoModByPowerOf2I(HMod* instr);
2560 LInstruction* DoModByConstI(HMod* instr);
2561 LInstruction* DoModI(HMod* instr);
2562 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2563 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2564 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr);
2565
2566 private:
2567 // Methods for getting operands for Use / Define / Temp.
2568 LUnallocated* ToUnallocated(Register reg);
2569 LUnallocated* ToUnallocated(DoubleRegister reg);
2570
2571 // Methods for setting up define-use relationships.
2572 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2573 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2574 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2575 DoubleRegister fixed_register);
2576
2577 // A value that is guaranteed to be allocated to a register.
2578 // Operand created by UseRegister is guaranteed to be live until the end of
2579 // instruction. This means that register allocator will not reuse it's
2580 // register for any other operand inside instruction.
2581 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2582 // instruction start. Register allocator is free to assign the same register
2583 // to some other operand used inside instruction (i.e. temporary or
2584 // output).
2585 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2586 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2587
2588 // An input operand in a register that may be trashed.
2589 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2590
2591 // An input operand in a register or stack slot.
2592 MUST_USE_RESULT LOperand* Use(HValue* value);
2593 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2594
2595 // An input operand in a register, stack slot or a constant operand.
2596 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2597 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2598
2599 // An input operand in a register or a constant operand.
2600 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2601 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2602
2603 // An input operand in a constant operand.
2604 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2605
2606 // An input operand in register, stack slot or a constant operand.
2607 // Will not be moved to a register even if one is freely available.
2608 MUST_USE_RESULT LOperand* UseAny(HValue* value) override;
2609
2610 // Temporary operand that must be in a register.
2611 MUST_USE_RESULT LUnallocated* TempRegister();
2612 MUST_USE_RESULT LUnallocated* TempDoubleRegister();
2613 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2614 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2615
2616 // Methods for setting up define-use relationships.
2617 // Return the same instruction that they are passed.
2618 LInstruction* Define(LTemplateResultInstruction<1>* instr,
2619 LUnallocated* result);
2620 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr);
2621 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr,
2622 int index);
2623 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr);
2624 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr,
2625 Register reg);
2626 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr,
2627 DoubleRegister reg);
2628 LInstruction* AssignEnvironment(LInstruction* instr);
2629 LInstruction* AssignPointerMap(LInstruction* instr);
2630
2631 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2632
2633 // By default we assume that instruction sequences generated for calls
2634 // cannot deoptimize eagerly and we do not attach environment to this
2635 // instruction.
2636 LInstruction* MarkAsCall(
2637 LInstruction* instr,
2638 HInstruction* hinstr,
2639 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2640
2641 void VisitInstruction(HInstruction* current);
2642 void AddInstruction(LInstruction* instr, HInstruction* current);
2643
2644 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2645 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2646 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2647 LInstruction* DoArithmeticD(Token::Value op,
2648 HArithmeticBinaryOperation* instr);
2649 LInstruction* DoArithmeticT(Token::Value op,
2650 HBinaryOperation* instr);
2651
2652 HInstruction* current_instruction_;
2653 HBasicBlock* current_block_;
2654 HBasicBlock* next_block_;
2655 LAllocator* allocator_;
2656
2657 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2658};
2659
2660#undef DECLARE_HYDROGEN_ACCESSOR
2661#undef DECLARE_CONCRETE_INSTRUCTION
2662
2663} // namespace internal
2664} // namespace v8
2665
2666#endif // V8_CRANKSHAFT_MIPS64_LITHIUM_MIPS_H_