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