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