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