1 // 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.
5 #ifndef V8_MIPS_LITHIUM_MIPS_H_
6 #define V8_MIPS_LITHIUM_MIPS_H_
8 #include "src/hydrogen.h"
9 #include "src/lithium.h"
10 #include "src/lithium-allocator.h"
11 #include "src/safepoint-table.h"
12 #include "src/utils.h"
17 // Forward declarations.
20 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
21 V(AccessArgumentsAt) \
26 V(AllocateBlockContext) \
28 V(ArgumentsElements) \
36 V(CallWithDescriptor) \
42 V(CheckArrayBufferNotNeutered) \
43 V(CheckInstanceType) \
52 V(ClassOfTestAndBranch) \
53 V(CompareMinusZeroAndBranch) \
54 V(CompareNumericAndBranch) \
55 V(CmpObjectEqAndBranch) \
79 V(FlooringDivByConstI) \
80 V(FlooringDivByPowerOf2I) \
85 V(GetCachedArrayIndex) \
87 V(HasCachedArrayIndexAndBranch) \
88 V(HasInPrototypeChainAndBranch) \
89 V(HasInstanceTypeAndBranch) \
90 V(InnerAllocatedObject) \
93 V(Integer32ToDouble) \
95 V(IsConstructCallAndBranch) \
96 V(IsStringAndBranch) \
98 V(IsUndetectableAndBranch) \
103 V(LoadFieldByIndex) \
104 V(LoadFunctionPrototype) \
105 V(LoadGlobalGeneric) \
106 V(LoadGlobalViaContext) \
108 V(LoadKeyedGeneric) \
110 V(LoadNamedGeneric) \
122 V(MaybeGrowElements) \
138 V(SeqStringGetChar) \
139 V(SeqStringSetChar) \
145 V(StoreContextSlot) \
146 V(StoreFrameContext) \
147 V(StoreGlobalViaContext) \
149 V(StoreKeyedGeneric) \
151 V(StoreNamedGeneric) \
153 V(StringCharCodeAt) \
154 V(StringCharFromCode) \
155 V(StringCompareAndBranch) \
160 V(ToFastProperties) \
161 V(TransitionElementsKind) \
162 V(TrapAllocationMemento) \
164 V(TypeofIsAndBranch) \
169 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
170 Opcode opcode() const final { return LInstruction::k##type; } \
171 void CompileToNative(LCodeGen* generator) final; \
172 const char* Mnemonic() const final { return mnemonic; } \
173 static L##type* cast(LInstruction* instr) { \
174 DCHECK(instr->Is##type()); \
175 return reinterpret_cast<L##type*>(instr); \
179 #define DECLARE_HYDROGEN_ACCESSOR(type) \
180 H##type* hydrogen() const { \
181 return H##type::cast(hydrogen_value()); \
185 class LInstruction : public ZoneObject {
188 : environment_(NULL),
189 hydrogen_value_(NULL),
190 bit_field_(IsCallBits::encode(false)) {
193 virtual ~LInstruction() {}
195 virtual void CompileToNative(LCodeGen* generator) = 0;
196 virtual const char* Mnemonic() const = 0;
197 virtual void PrintTo(StringStream* stream);
198 virtual void PrintDataTo(StringStream* stream);
199 virtual void PrintOutputOperandTo(StringStream* stream);
202 // Declare a unique enum value for each instruction.
203 #define DECLARE_OPCODE(type) k##type,
204 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
205 kNumberOfInstructions
206 #undef DECLARE_OPCODE
209 virtual Opcode opcode() const = 0;
211 // Declare non-virtual type testers for all leaf IR classes.
212 #define DECLARE_PREDICATE(type) \
213 bool Is##type() const { return opcode() == k##type; }
214 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
215 #undef DECLARE_PREDICATE
217 // Declare virtual predicates for instructions that don't have
219 virtual bool IsGap() const { return false; }
221 virtual bool IsControl() const { return false; }
223 // Try deleting this instruction if possible.
224 virtual bool TryDelete() { return false; }
226 void set_environment(LEnvironment* env) { environment_ = env; }
227 LEnvironment* environment() const { return environment_; }
228 bool HasEnvironment() const { return environment_ != NULL; }
230 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
231 LPointerMap* pointer_map() const { return pointer_map_.get(); }
232 bool HasPointerMap() const { return pointer_map_.is_set(); }
234 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
235 HValue* hydrogen_value() const { return hydrogen_value_; }
237 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); }
238 bool IsCall() const { return IsCallBits::decode(bit_field_); }
240 // Interface to the register allocator and iterators.
241 bool ClobbersTemps() const { return IsCall(); }
242 bool ClobbersRegisters() const { return IsCall(); }
243 virtual bool ClobbersDoubleRegisters(Isolate* isolate) const {
247 // Interface to the register allocator and iterators.
248 bool IsMarkedAsCall() const { return IsCall(); }
250 virtual bool HasResult() const = 0;
251 virtual LOperand* result() const = 0;
253 LOperand* FirstInput() { return InputAt(0); }
254 LOperand* Output() { return HasResult() ? result() : NULL; }
256 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
262 virtual int InputCount() = 0;
263 virtual LOperand* InputAt(int i) = 0;
266 // Iterator interface.
267 friend class InputIterator;
269 friend class TempIterator;
270 virtual int TempCount() = 0;
271 virtual LOperand* TempAt(int i) = 0;
273 class IsCallBits: public BitField<bool, 0, 1> {};
275 LEnvironment* environment_;
276 SetOncePointer<LPointerMap> pointer_map_;
277 HValue* hydrogen_value_;
282 // R = number of result operands (0 or 1).
284 class LTemplateResultInstruction : public LInstruction {
286 // Allow 0 or 1 output operands.
287 STATIC_ASSERT(R == 0 || R == 1);
288 bool HasResult() const final { return R != 0 && result() != NULL; }
289 void set_result(LOperand* operand) { results_[0] = operand; }
290 LOperand* result() const override { return results_[0]; }
293 EmbeddedContainer<LOperand*, R> results_;
297 // R = number of result operands (0 or 1).
298 // I = number of input operands.
299 // T = number of temporary operands.
300 template<int R, int I, int T>
301 class LTemplateInstruction : public LTemplateResultInstruction<R> {
303 EmbeddedContainer<LOperand*, I> inputs_;
304 EmbeddedContainer<LOperand*, T> temps_;
308 int InputCount() final { return I; }
309 LOperand* InputAt(int i) final { return inputs_[i]; }
311 int TempCount() final { return T; }
312 LOperand* TempAt(int i) final { return temps_[i]; }
316 class LGap : public LTemplateInstruction<0, 0, 0> {
318 explicit LGap(HBasicBlock* block)
320 parallel_moves_[BEFORE] = NULL;
321 parallel_moves_[START] = NULL;
322 parallel_moves_[END] = NULL;
323 parallel_moves_[AFTER] = NULL;
326 // Can't use the DECLARE-macro here because of sub-classes.
327 bool IsGap() const final { return true; }
328 void PrintDataTo(StringStream* stream) override;
329 static LGap* cast(LInstruction* instr) {
330 DCHECK(instr->IsGap());
331 return reinterpret_cast<LGap*>(instr);
334 bool IsRedundant() const;
336 HBasicBlock* block() const { return block_; }
343 FIRST_INNER_POSITION = BEFORE,
344 LAST_INNER_POSITION = AFTER
347 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
348 if (parallel_moves_[pos] == NULL) {
349 parallel_moves_[pos] = new(zone) LParallelMove(zone);
351 return parallel_moves_[pos];
354 LParallelMove* GetParallelMove(InnerPosition pos) {
355 return parallel_moves_[pos];
359 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
364 class LInstructionGap final : public LGap {
366 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
368 bool HasInterestingComment(LCodeGen* gen) const override {
369 return !IsRedundant();
372 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
376 class LGoto final : public LTemplateInstruction<0, 0, 0> {
378 explicit LGoto(HBasicBlock* block) : block_(block) { }
380 bool HasInterestingComment(LCodeGen* gen) const override;
381 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
382 void PrintDataTo(StringStream* stream) override;
383 bool IsControl() const override { return true; }
385 int block_id() const { return block_->block_id(); }
392 class LLazyBailout final : public LTemplateInstruction<0, 0, 0> {
394 LLazyBailout() : gap_instructions_size_(0) { }
396 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
398 void set_gap_instructions_size(int gap_instructions_size) {
399 gap_instructions_size_ = gap_instructions_size;
401 int gap_instructions_size() { return gap_instructions_size_; }
404 int gap_instructions_size_;
408 class LDummy final : public LTemplateInstruction<1, 0, 0> {
411 DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
415 class LDummyUse final : public LTemplateInstruction<1, 1, 0> {
417 explicit LDummyUse(LOperand* value) {
420 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
424 class LDeoptimize final : public LTemplateInstruction<0, 0, 0> {
426 bool IsControl() const override { return true; }
427 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
428 DECLARE_HYDROGEN_ACCESSOR(Deoptimize)
432 class LLabel final : public LGap {
434 explicit LLabel(HBasicBlock* block)
435 : LGap(block), replacement_(NULL) { }
437 bool HasInterestingComment(LCodeGen* gen) const override { return false; }
438 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
440 void PrintDataTo(StringStream* stream) override;
442 int block_id() const { return block()->block_id(); }
443 bool is_loop_header() const { return block()->IsLoopHeader(); }
444 bool is_osr_entry() const { return block()->is_osr_entry(); }
445 Label* label() { return &label_; }
446 LLabel* replacement() const { return replacement_; }
447 void set_replacement(LLabel* label) { replacement_ = label; }
448 bool HasReplacement() const { return replacement_ != NULL; }
452 LLabel* replacement_;
456 class LParameter final : public LTemplateInstruction<1, 0, 0> {
458 bool HasInterestingComment(LCodeGen* gen) const override { return false; }
459 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
463 class LCallStub final : public LTemplateInstruction<1, 1, 0> {
465 explicit LCallStub(LOperand* context) {
466 inputs_[0] = context;
469 LOperand* context() { return inputs_[0]; }
471 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
472 DECLARE_HYDROGEN_ACCESSOR(CallStub)
476 class LUnknownOSRValue final : public LTemplateInstruction<1, 0, 0> {
478 bool HasInterestingComment(LCodeGen* gen) const override { return false; }
479 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
483 template<int I, int T>
484 class LControlInstruction : public LTemplateInstruction<0, I, T> {
486 LControlInstruction() : false_label_(NULL), true_label_(NULL) { }
488 bool IsControl() const final { return true; }
490 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
491 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
493 int TrueDestination(LChunk* chunk) {
494 return chunk->LookupDestination(true_block_id());
496 int FalseDestination(LChunk* chunk) {
497 return chunk->LookupDestination(false_block_id());
500 Label* TrueLabel(LChunk* chunk) {
501 if (true_label_ == NULL) {
502 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk));
506 Label* FalseLabel(LChunk* chunk) {
507 if (false_label_ == NULL) {
508 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk));
514 int true_block_id() { return SuccessorAt(0)->block_id(); }
515 int false_block_id() { return SuccessorAt(1)->block_id(); }
518 HControlInstruction* hydrogen() {
519 return HControlInstruction::cast(this->hydrogen_value());
527 class LWrapReceiver final : public LTemplateInstruction<1, 2, 0> {
529 LWrapReceiver(LOperand* receiver, LOperand* function) {
530 inputs_[0] = receiver;
531 inputs_[1] = function;
534 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
535 DECLARE_HYDROGEN_ACCESSOR(WrapReceiver)
537 LOperand* receiver() { return inputs_[0]; }
538 LOperand* function() { return inputs_[1]; }
542 class LApplyArguments final : public LTemplateInstruction<1, 4, 0> {
544 LApplyArguments(LOperand* function,
547 LOperand* elements) {
548 inputs_[0] = function;
549 inputs_[1] = receiver;
551 inputs_[3] = elements;
554 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
556 LOperand* function() { return inputs_[0]; }
557 LOperand* receiver() { return inputs_[1]; }
558 LOperand* length() { return inputs_[2]; }
559 LOperand* elements() { return inputs_[3]; }
563 class LAccessArgumentsAt final : public LTemplateInstruction<1, 3, 0> {
565 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
566 inputs_[0] = arguments;
571 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
573 LOperand* arguments() { return inputs_[0]; }
574 LOperand* length() { return inputs_[1]; }
575 LOperand* index() { return inputs_[2]; }
577 void PrintDataTo(StringStream* stream) override;
581 class LArgumentsLength final : public LTemplateInstruction<1, 1, 0> {
583 explicit LArgumentsLength(LOperand* elements) {
584 inputs_[0] = elements;
587 LOperand* elements() { return inputs_[0]; }
589 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
593 class LArgumentsElements final : public LTemplateInstruction<1, 0, 0> {
595 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
596 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
600 class LModByPowerOf2I final : public LTemplateInstruction<1, 1, 0> {
602 LModByPowerOf2I(LOperand* dividend, int32_t divisor) {
603 inputs_[0] = dividend;
607 LOperand* dividend() { return inputs_[0]; }
608 int32_t divisor() const { return divisor_; }
610 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
611 DECLARE_HYDROGEN_ACCESSOR(Mod)
618 class LModByConstI final : public LTemplateInstruction<1, 1, 0> {
620 LModByConstI(LOperand* dividend, int32_t divisor) {
621 inputs_[0] = dividend;
625 LOperand* dividend() { return inputs_[0]; }
626 int32_t divisor() const { return divisor_; }
628 DECLARE_CONCRETE_INSTRUCTION(ModByConstI, "mod-by-const-i")
629 DECLARE_HYDROGEN_ACCESSOR(Mod)
636 class LModI final : public LTemplateInstruction<1, 2, 3> {
638 LModI(LOperand* left,
644 LOperand* left() { return inputs_[0]; }
645 LOperand* right() { return inputs_[1]; }
647 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
648 DECLARE_HYDROGEN_ACCESSOR(Mod)
652 class LDivByPowerOf2I final : public LTemplateInstruction<1, 1, 0> {
654 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
655 inputs_[0] = dividend;
659 LOperand* dividend() { return inputs_[0]; }
660 int32_t divisor() const { return divisor_; }
662 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
663 DECLARE_HYDROGEN_ACCESSOR(Div)
670 class LDivByConstI final : public LTemplateInstruction<1, 1, 0> {
672 LDivByConstI(LOperand* dividend, int32_t divisor) {
673 inputs_[0] = dividend;
677 LOperand* dividend() { return inputs_[0]; }
678 int32_t divisor() const { return divisor_; }
680 DECLARE_CONCRETE_INSTRUCTION(DivByConstI, "div-by-const-i")
681 DECLARE_HYDROGEN_ACCESSOR(Div)
688 class LDivI final : public LTemplateInstruction<1, 2, 1> {
690 LDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
691 inputs_[0] = dividend;
692 inputs_[1] = divisor;
696 LOperand* dividend() { return inputs_[0]; }
697 LOperand* divisor() { return inputs_[1]; }
698 LOperand* temp() { return temps_[0]; }
700 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
701 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
705 class LFlooringDivByPowerOf2I final : public LTemplateInstruction<1, 1, 0> {
707 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
708 inputs_[0] = dividend;
712 LOperand* dividend() { return inputs_[0]; }
713 int32_t divisor() { return divisor_; }
715 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
716 "flooring-div-by-power-of-2-i")
717 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
724 class LFlooringDivByConstI final : public LTemplateInstruction<1, 1, 2> {
726 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) {
727 inputs_[0] = dividend;
732 LOperand* dividend() { return inputs_[0]; }
733 int32_t divisor() const { return divisor_; }
734 LOperand* temp() { return temps_[0]; }
736 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
737 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
744 class LFlooringDivI final : public LTemplateInstruction<1, 2, 0> {
746 LFlooringDivI(LOperand* dividend, LOperand* divisor) {
747 inputs_[0] = dividend;
748 inputs_[1] = divisor;
751 LOperand* dividend() { return inputs_[0]; }
752 LOperand* divisor() { return inputs_[1]; }
754 DECLARE_CONCRETE_INSTRUCTION(FlooringDivI, "flooring-div-i")
755 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
759 class LMulS final : public LTemplateInstruction<1, 2, 0> {
761 LMulS(LOperand* left, LOperand* right) {
766 LOperand* left() { return inputs_[0]; }
767 LOperand* right() { return inputs_[1]; }
769 DECLARE_CONCRETE_INSTRUCTION(MulS, "mul-s")
770 DECLARE_HYDROGEN_ACCESSOR(Mul)
774 class LMulI final : public LTemplateInstruction<1, 2, 0> {
776 LMulI(LOperand* left, LOperand* right) {
781 LOperand* left() { return inputs_[0]; }
782 LOperand* right() { return inputs_[1]; }
784 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
785 DECLARE_HYDROGEN_ACCESSOR(Mul)
789 // Instruction for computing multiplier * multiplicand + addend.
790 class LMultiplyAddD final : public LTemplateInstruction<1, 3, 0> {
792 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
793 LOperand* multiplicand) {
795 inputs_[1] = multiplier;
796 inputs_[2] = multiplicand;
799 LOperand* addend() { return inputs_[0]; }
800 LOperand* multiplier() { return inputs_[1]; }
801 LOperand* multiplicand() { return inputs_[2]; }
803 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
807 class LDebugBreak final : public LTemplateInstruction<0, 0, 0> {
809 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
813 class LCompareNumericAndBranch final : public LControlInstruction<2, 0> {
815 LCompareNumericAndBranch(LOperand* left, LOperand* right) {
820 LOperand* left() { return inputs_[0]; }
821 LOperand* right() { return inputs_[1]; }
823 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch,
824 "compare-numeric-and-branch")
825 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch)
827 Token::Value op() const { return hydrogen()->token(); }
828 bool is_double() const {
829 return hydrogen()->representation().IsDouble();
832 void PrintDataTo(StringStream* stream) override;
836 class LMathFloor final : public LTemplateInstruction<1, 1, 1> {
838 LMathFloor(LOperand* value, LOperand* temp) {
843 LOperand* value() { return inputs_[0]; }
844 LOperand* temp() { return temps_[0]; }
846 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
847 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
851 class LMathRound final : public LTemplateInstruction<1, 1, 1> {
853 LMathRound(LOperand* value, LOperand* temp) {
858 LOperand* value() { return inputs_[0]; }
859 LOperand* temp() { return temps_[0]; }
861 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
862 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
866 class LMathFround final : public LTemplateInstruction<1, 1, 0> {
868 explicit LMathFround(LOperand* value) { inputs_[0] = value; }
870 LOperand* value() { return inputs_[0]; }
872 DECLARE_CONCRETE_INSTRUCTION(MathFround, "math-fround")
876 class LMathAbs final : public LTemplateInstruction<1, 2, 0> {
878 LMathAbs(LOperand* context, LOperand* value) {
879 inputs_[1] = context;
883 LOperand* context() { return inputs_[1]; }
884 LOperand* value() { return inputs_[0]; }
886 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
887 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
891 class LMathLog final : public LTemplateInstruction<1, 1, 0> {
893 explicit LMathLog(LOperand* value) {
897 LOperand* value() { return inputs_[0]; }
899 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
903 class LMathClz32 final : public LTemplateInstruction<1, 1, 0> {
905 explicit LMathClz32(LOperand* value) {
909 LOperand* value() { return inputs_[0]; }
911 DECLARE_CONCRETE_INSTRUCTION(MathClz32, "math-clz32")
915 class LMathExp final : public LTemplateInstruction<1, 1, 3> {
917 LMathExp(LOperand* value,
918 LOperand* double_temp,
924 temps_[2] = double_temp;
925 ExternalReference::InitializeMathExpData();
928 LOperand* value() { return inputs_[0]; }
929 LOperand* temp1() { return temps_[0]; }
930 LOperand* temp2() { return temps_[1]; }
931 LOperand* double_temp() { return temps_[2]; }
933 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
937 class LMathSqrt final : public LTemplateInstruction<1, 1, 0> {
939 explicit LMathSqrt(LOperand* value) {
943 LOperand* value() { return inputs_[0]; }
945 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
949 class LMathPowHalf final : public LTemplateInstruction<1, 1, 1> {
951 LMathPowHalf(LOperand* value, LOperand* temp) {
956 LOperand* value() { return inputs_[0]; }
957 LOperand* temp() { return temps_[0]; }
959 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
963 class LCmpObjectEqAndBranch final : public LControlInstruction<2, 0> {
965 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
970 LOperand* left() { return inputs_[0]; }
971 LOperand* right() { return inputs_[1]; }
973 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch")
974 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
978 class LCmpHoleAndBranch final : public LControlInstruction<1, 0> {
980 explicit LCmpHoleAndBranch(LOperand* object) {
984 LOperand* object() { return inputs_[0]; }
986 DECLARE_CONCRETE_INSTRUCTION(CmpHoleAndBranch, "cmp-hole-and-branch")
987 DECLARE_HYDROGEN_ACCESSOR(CompareHoleAndBranch)
991 class LCompareMinusZeroAndBranch final : public LControlInstruction<1, 1> {
993 LCompareMinusZeroAndBranch(LOperand* value, LOperand* temp) {
998 LOperand* value() { return inputs_[0]; }
999 LOperand* temp() { return temps_[0]; }
1001 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch,
1002 "cmp-minus-zero-and-branch")
1003 DECLARE_HYDROGEN_ACCESSOR(CompareMinusZeroAndBranch)
1007 class LIsStringAndBranch final : public LControlInstruction<1, 1> {
1009 LIsStringAndBranch(LOperand* value, LOperand* temp) {
1014 LOperand* value() { return inputs_[0]; }
1015 LOperand* temp() { return temps_[0]; }
1017 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
1018 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
1020 void PrintDataTo(StringStream* stream) override;
1024 class LIsSmiAndBranch final : public LControlInstruction<1, 0> {
1026 explicit LIsSmiAndBranch(LOperand* value) {
1030 LOperand* value() { return inputs_[0]; }
1032 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
1033 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
1035 void PrintDataTo(StringStream* stream) override;
1039 class LIsUndetectableAndBranch final : public LControlInstruction<1, 1> {
1041 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
1046 LOperand* value() { return inputs_[0]; }
1047 LOperand* temp() { return temps_[0]; }
1049 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
1050 "is-undetectable-and-branch")
1051 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
1053 void PrintDataTo(StringStream* stream) override;
1057 class LStringCompareAndBranch final : public LControlInstruction<3, 0> {
1059 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) {
1060 inputs_[0] = context;
1065 LOperand* context() { return inputs_[0]; }
1066 LOperand* left() { return inputs_[1]; }
1067 LOperand* right() { return inputs_[2]; }
1069 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
1070 "string-compare-and-branch")
1071 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
1073 Token::Value op() const { return hydrogen()->token(); }
1075 void PrintDataTo(StringStream* stream) override;
1079 class LHasInstanceTypeAndBranch final : public LControlInstruction<1, 0> {
1081 explicit LHasInstanceTypeAndBranch(LOperand* value) {
1085 LOperand* value() { return inputs_[0]; }
1087 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
1088 "has-instance-type-and-branch")
1089 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
1091 void PrintDataTo(StringStream* stream) override;
1095 class LGetCachedArrayIndex final : public LTemplateInstruction<1, 1, 0> {
1097 explicit LGetCachedArrayIndex(LOperand* value) {
1101 LOperand* value() { return inputs_[0]; }
1103 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
1104 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
1108 class LHasCachedArrayIndexAndBranch final : public LControlInstruction<1, 0> {
1110 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
1114 LOperand* value() { return inputs_[0]; }
1116 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
1117 "has-cached-array-index-and-branch")
1118 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
1120 void PrintDataTo(StringStream* stream) override;
1124 class LClassOfTestAndBranch final : public LControlInstruction<1, 1> {
1126 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
1131 LOperand* value() { return inputs_[0]; }
1132 LOperand* temp() { return temps_[0]; }
1134 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1135 "class-of-test-and-branch")
1136 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1138 void PrintDataTo(StringStream* stream) override;
1142 class LCmpT final : public LTemplateInstruction<1, 3, 0> {
1144 LCmpT(LOperand* context, LOperand* left, LOperand* right) {
1145 inputs_[0] = context;
1150 LOperand* context() { return inputs_[0]; }
1151 LOperand* left() { return inputs_[1]; }
1152 LOperand* right() { return inputs_[2]; }
1154 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1155 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1157 Strength strength() { return hydrogen()->strength(); }
1159 Token::Value op() const { return hydrogen()->token(); }
1163 class LInstanceOf final : public LTemplateInstruction<1, 3, 0> {
1165 LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
1166 inputs_[0] = context;
1171 LOperand* context() const { return inputs_[0]; }
1172 LOperand* left() const { return inputs_[1]; }
1173 LOperand* right() const { return inputs_[2]; }
1175 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1179 class LHasInPrototypeChainAndBranch final : public LControlInstruction<2, 0> {
1181 LHasInPrototypeChainAndBranch(LOperand* object, LOperand* prototype) {
1182 inputs_[0] = object;
1183 inputs_[1] = prototype;
1186 LOperand* object() const { return inputs_[0]; }
1187 LOperand* prototype() const { return inputs_[1]; }
1189 DECLARE_CONCRETE_INSTRUCTION(HasInPrototypeChainAndBranch,
1190 "has-in-prototype-chain-and-branch")
1191 DECLARE_HYDROGEN_ACCESSOR(HasInPrototypeChainAndBranch)
1195 class LBoundsCheck final : public LTemplateInstruction<0, 2, 0> {
1197 LBoundsCheck(LOperand* index, LOperand* length) {
1199 inputs_[1] = length;
1202 LOperand* index() { return inputs_[0]; }
1203 LOperand* length() { return inputs_[1]; }
1205 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
1206 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
1210 class LBitI final : public LTemplateInstruction<1, 2, 0> {
1212 LBitI(LOperand* left, LOperand* right) {
1217 LOperand* left() { return inputs_[0]; }
1218 LOperand* right() { return inputs_[1]; }
1220 Token::Value op() const { return hydrogen()->op(); }
1222 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1223 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1227 class LShiftI final : public LTemplateInstruction<1, 2, 0> {
1229 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1230 : op_(op), can_deopt_(can_deopt) {
1235 Token::Value op() const { return op_; }
1236 LOperand* left() { return inputs_[0]; }
1237 LOperand* right() { return inputs_[1]; }
1238 bool can_deopt() const { return can_deopt_; }
1240 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1248 class LSubI final : public LTemplateInstruction<1, 2, 0> {
1250 LSubI(LOperand* left, LOperand* right) {
1255 LOperand* left() { return inputs_[0]; }
1256 LOperand* right() { return inputs_[1]; }
1258 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1259 DECLARE_HYDROGEN_ACCESSOR(Sub)
1263 class LSubS final : public LTemplateInstruction<1, 2, 0> {
1265 LSubS(LOperand* left, LOperand* right) {
1270 LOperand* left() { return inputs_[0]; }
1271 LOperand* right() { return inputs_[1]; }
1273 DECLARE_CONCRETE_INSTRUCTION(SubS, "sub-s")
1274 DECLARE_HYDROGEN_ACCESSOR(Sub)
1278 class LConstantI final : public LTemplateInstruction<1, 0, 0> {
1280 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1281 DECLARE_HYDROGEN_ACCESSOR(Constant)
1283 int32_t value() const { return hydrogen()->Integer32Value(); }
1287 class LConstantS final : public LTemplateInstruction<1, 0, 0> {
1289 DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s")
1290 DECLARE_HYDROGEN_ACCESSOR(Constant)
1292 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); }
1296 class LConstantD final : public LTemplateInstruction<1, 0, 0> {
1298 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1299 DECLARE_HYDROGEN_ACCESSOR(Constant)
1301 double value() const { return hydrogen()->DoubleValue(); }
1305 class LConstantE final : public LTemplateInstruction<1, 0, 0> {
1307 DECLARE_CONCRETE_INSTRUCTION(ConstantE, "constant-e")
1308 DECLARE_HYDROGEN_ACCESSOR(Constant)
1310 ExternalReference value() const {
1311 return hydrogen()->ExternalReferenceValue();
1316 class LConstantT final : public LTemplateInstruction<1, 0, 0> {
1318 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1319 DECLARE_HYDROGEN_ACCESSOR(Constant)
1321 Handle<Object> value(Isolate* isolate) const {
1322 return hydrogen()->handle(isolate);
1327 class LBranch final : public LControlInstruction<1, 0> {
1329 explicit LBranch(LOperand* value) {
1333 LOperand* value() { return inputs_[0]; }
1335 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1336 DECLARE_HYDROGEN_ACCESSOR(Branch)
1338 void PrintDataTo(StringStream* stream) override;
1342 class LCmpMapAndBranch final : public LControlInstruction<1, 1> {
1344 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1349 LOperand* value() { return inputs_[0]; }
1350 LOperand* temp() { return temps_[0]; }
1352 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1353 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1355 Handle<Map> map() const { return hydrogen()->map().handle(); }
1359 class LMapEnumLength final : public LTemplateInstruction<1, 1, 0> {
1361 explicit LMapEnumLength(LOperand* value) {
1365 LOperand* value() { return inputs_[0]; }
1367 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1371 class LDateField final : public LTemplateInstruction<1, 1, 1> {
1373 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1378 LOperand* date() { return inputs_[0]; }
1379 LOperand* temp() { return temps_[0]; }
1380 Smi* index() const { return index_; }
1382 DECLARE_CONCRETE_INSTRUCTION(DateField, "date-field")
1383 DECLARE_HYDROGEN_ACCESSOR(DateField)
1390 class LSeqStringGetChar final : public LTemplateInstruction<1, 2, 0> {
1392 LSeqStringGetChar(LOperand* string, LOperand* index) {
1393 inputs_[0] = string;
1397 LOperand* string() const { return inputs_[0]; }
1398 LOperand* index() const { return inputs_[1]; }
1400 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar, "seq-string-get-char")
1401 DECLARE_HYDROGEN_ACCESSOR(SeqStringGetChar)
1405 class LSeqStringSetChar final : public LTemplateInstruction<1, 4, 0> {
1407 LSeqStringSetChar(LOperand* context,
1411 inputs_[0] = context;
1412 inputs_[1] = string;
1417 LOperand* string() { return inputs_[1]; }
1418 LOperand* index() { return inputs_[2]; }
1419 LOperand* value() { return inputs_[3]; }
1421 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1422 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1426 class LAddE final : public LTemplateInstruction<1, 2, 0> {
1428 LAddE(LOperand* left, LOperand* right) {
1433 LOperand* left() { return inputs_[0]; }
1434 LOperand* right() { return inputs_[1]; }
1436 DECLARE_CONCRETE_INSTRUCTION(AddE, "add-e")
1437 DECLARE_HYDROGEN_ACCESSOR(Add)
1441 class LAddI final : public LTemplateInstruction<1, 2, 0> {
1443 LAddI(LOperand* left, LOperand* right) {
1448 LOperand* left() { return inputs_[0]; }
1449 LOperand* right() { return inputs_[1]; }
1451 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1452 DECLARE_HYDROGEN_ACCESSOR(Add)
1456 class LAddS final : public LTemplateInstruction<1, 2, 0> {
1458 LAddS(LOperand* left, LOperand* right) {
1463 LOperand* left() { return inputs_[0]; }
1464 LOperand* right() { return inputs_[1]; }
1466 DECLARE_CONCRETE_INSTRUCTION(AddS, "add-s")
1467 DECLARE_HYDROGEN_ACCESSOR(Add)
1471 class LMathMinMax final : public LTemplateInstruction<1, 2, 0> {
1473 LMathMinMax(LOperand* left, LOperand* right) {
1478 LOperand* left() { return inputs_[0]; }
1479 LOperand* right() { return inputs_[1]; }
1481 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
1482 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1486 class LPower final : public LTemplateInstruction<1, 2, 0> {
1488 LPower(LOperand* left, LOperand* right) {
1493 LOperand* left() { return inputs_[0]; }
1494 LOperand* right() { return inputs_[1]; }
1496 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1497 DECLARE_HYDROGEN_ACCESSOR(Power)
1501 class LArithmeticD final : public LTemplateInstruction<1, 2, 0> {
1503 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1509 Token::Value op() const { return op_; }
1510 LOperand* left() { return inputs_[0]; }
1511 LOperand* right() { return inputs_[1]; }
1513 Opcode opcode() const override { return LInstruction::kArithmeticD; }
1514 void CompileToNative(LCodeGen* generator) override;
1515 const char* Mnemonic() const override;
1522 class LArithmeticT final : public LTemplateInstruction<1, 3, 0> {
1524 LArithmeticT(Token::Value op,
1529 inputs_[0] = context;
1534 LOperand* context() { return inputs_[0]; }
1535 LOperand* left() { return inputs_[1]; }
1536 LOperand* right() { return inputs_[2]; }
1537 Token::Value op() const { return op_; }
1539 Opcode opcode() const final { return LInstruction::kArithmeticT; }
1540 void CompileToNative(LCodeGen* generator) override;
1541 const char* Mnemonic() const override;
1543 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
1545 Strength strength() { return hydrogen()->strength(); }
1552 class LReturn final : public LTemplateInstruction<0, 3, 0> {
1554 LReturn(LOperand* value, LOperand* context, LOperand* parameter_count) {
1556 inputs_[1] = context;
1557 inputs_[2] = parameter_count;
1560 LOperand* value() { return inputs_[0]; }
1562 bool has_constant_parameter_count() {
1563 return parameter_count()->IsConstantOperand();
1565 LConstantOperand* constant_parameter_count() {
1566 DCHECK(has_constant_parameter_count());
1567 return LConstantOperand::cast(parameter_count());
1569 LOperand* parameter_count() { return inputs_[2]; }
1571 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1575 class LLoadNamedField final : public LTemplateInstruction<1, 1, 0> {
1577 explicit LLoadNamedField(LOperand* object) {
1578 inputs_[0] = object;
1581 LOperand* object() { return inputs_[0]; }
1583 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1584 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1588 class LLoadNamedGeneric final : public LTemplateInstruction<1, 2, 1> {
1590 LLoadNamedGeneric(LOperand* context, LOperand* object, LOperand* vector) {
1591 inputs_[0] = context;
1592 inputs_[1] = object;
1596 LOperand* context() { return inputs_[0]; }
1597 LOperand* object() { return inputs_[1]; }
1598 LOperand* temp_vector() { return temps_[0]; }
1600 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1601 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1603 Handle<Object> name() const { return hydrogen()->name(); }
1607 class LLoadFunctionPrototype final : public LTemplateInstruction<1, 1, 0> {
1609 explicit LLoadFunctionPrototype(LOperand* function) {
1610 inputs_[0] = function;
1613 LOperand* function() { return inputs_[0]; }
1615 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1616 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1620 class LLoadRoot final : public LTemplateInstruction<1, 0, 0> {
1622 DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
1623 DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
1625 Heap::RootListIndex index() const { return hydrogen()->index(); }
1629 class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> {
1631 LLoadKeyed(LOperand* elements, LOperand* key) {
1632 inputs_[0] = elements;
1636 LOperand* elements() { return inputs_[0]; }
1637 LOperand* key() { return inputs_[1]; }
1638 ElementsKind elements_kind() const {
1639 return hydrogen()->elements_kind();
1641 bool is_fixed_typed_array() const {
1642 return hydrogen()->is_fixed_typed_array();
1645 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1646 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1648 void PrintDataTo(StringStream* stream) override;
1649 uint32_t base_offset() const { return hydrogen()->base_offset(); }
1653 class LLoadKeyedGeneric final : public LTemplateInstruction<1, 3, 1> {
1655 LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key,
1657 inputs_[0] = context;
1658 inputs_[1] = object;
1663 LOperand* context() { return inputs_[0]; }
1664 LOperand* object() { return inputs_[1]; }
1665 LOperand* key() { return inputs_[2]; }
1666 LOperand* temp_vector() { return temps_[0]; }
1668 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1669 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedGeneric)
1673 class LLoadGlobalGeneric final : public LTemplateInstruction<1, 2, 1> {
1675 LLoadGlobalGeneric(LOperand* context, LOperand* global_object,
1677 inputs_[0] = context;
1678 inputs_[1] = global_object;
1682 LOperand* context() { return inputs_[0]; }
1683 LOperand* global_object() { return inputs_[1]; }
1684 LOperand* temp_vector() { return temps_[0]; }
1686 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1687 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1689 Handle<Object> name() const { return hydrogen()->name(); }
1690 TypeofMode typeof_mode() const { return hydrogen()->typeof_mode(); }
1694 class LLoadGlobalViaContext final : public LTemplateInstruction<1, 1, 1> {
1696 explicit LLoadGlobalViaContext(LOperand* context) { inputs_[0] = context; }
1698 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalViaContext, "load-global-via-context")
1699 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalViaContext)
1701 void PrintDataTo(StringStream* stream) override;
1703 LOperand* context() { return inputs_[0]; }
1705 int depth() const { return hydrogen()->depth(); }
1706 int slot_index() const { return hydrogen()->slot_index(); }
1710 class LLoadContextSlot final : public LTemplateInstruction<1, 1, 0> {
1712 explicit LLoadContextSlot(LOperand* context) {
1713 inputs_[0] = context;
1716 LOperand* context() { return inputs_[0]; }
1718 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1719 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1721 int slot_index() { return hydrogen()->slot_index(); }
1723 void PrintDataTo(StringStream* stream) override;
1727 class LStoreContextSlot final : public LTemplateInstruction<0, 2, 0> {
1729 LStoreContextSlot(LOperand* context, LOperand* value) {
1730 inputs_[0] = context;
1734 LOperand* context() { return inputs_[0]; }
1735 LOperand* value() { return inputs_[1]; }
1737 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1738 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1740 int slot_index() { return hydrogen()->slot_index(); }
1742 void PrintDataTo(StringStream* stream) override;
1746 class LPushArgument final : public LTemplateInstruction<0, 1, 0> {
1748 explicit LPushArgument(LOperand* value) {
1752 LOperand* value() { return inputs_[0]; }
1754 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1758 class LDrop final : public LTemplateInstruction<0, 0, 0> {
1760 explicit LDrop(int count) : count_(count) { }
1762 int count() const { return count_; }
1764 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1771 class LStoreCodeEntry final : public LTemplateInstruction<0, 2, 0> {
1773 LStoreCodeEntry(LOperand* function, LOperand* code_object) {
1774 inputs_[0] = function;
1775 inputs_[1] = code_object;
1778 LOperand* function() { return inputs_[0]; }
1779 LOperand* code_object() { return inputs_[1]; }
1781 void PrintDataTo(StringStream* stream) override;
1783 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry, "store-code-entry")
1784 DECLARE_HYDROGEN_ACCESSOR(StoreCodeEntry)
1788 class LInnerAllocatedObject final : public LTemplateInstruction<1, 2, 0> {
1790 LInnerAllocatedObject(LOperand* base_object, LOperand* offset) {
1791 inputs_[0] = base_object;
1792 inputs_[1] = offset;
1795 LOperand* base_object() const { return inputs_[0]; }
1796 LOperand* offset() const { return inputs_[1]; }
1798 void PrintDataTo(StringStream* stream) override;
1800 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "inner-allocated-object")
1804 class LThisFunction final : public LTemplateInstruction<1, 0, 0> {
1806 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1807 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1811 class LContext final : public LTemplateInstruction<1, 0, 0> {
1813 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1814 DECLARE_HYDROGEN_ACCESSOR(Context)
1818 class LDeclareGlobals final : public LTemplateInstruction<0, 1, 0> {
1820 explicit LDeclareGlobals(LOperand* context) {
1821 inputs_[0] = context;
1824 LOperand* context() { return inputs_[0]; }
1826 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1827 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1831 class LCallJSFunction final : public LTemplateInstruction<1, 1, 0> {
1833 explicit LCallJSFunction(LOperand* function) {
1834 inputs_[0] = function;
1837 LOperand* function() { return inputs_[0]; }
1839 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function")
1840 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction)
1842 void PrintDataTo(StringStream* stream) override;
1844 int arity() const { return hydrogen()->argument_count() - 1; }
1848 class LCallWithDescriptor final : public LTemplateResultInstruction<1> {
1850 LCallWithDescriptor(CallInterfaceDescriptor descriptor,
1851 const ZoneList<LOperand*>& operands, Zone* zone)
1852 : descriptor_(descriptor),
1853 inputs_(descriptor.GetRegisterParameterCount() +
1854 kImplicitRegisterParameterCount,
1856 DCHECK(descriptor.GetRegisterParameterCount() +
1857 kImplicitRegisterParameterCount ==
1859 inputs_.AddAll(operands, zone);
1862 LOperand* target() const { return inputs_[0]; }
1864 const CallInterfaceDescriptor descriptor() { return descriptor_; }
1866 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1868 // The target and context are passed as implicit parameters that are not
1869 // explicitly listed in the descriptor.
1870 static const int kImplicitRegisterParameterCount = 2;
1873 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1875 void PrintDataTo(StringStream* stream) override;
1877 int arity() const { return hydrogen()->argument_count() - 1; }
1879 CallInterfaceDescriptor descriptor_;
1880 ZoneList<LOperand*> inputs_;
1882 // Iterator support.
1883 int InputCount() final { return inputs_.length(); }
1884 LOperand* InputAt(int i) final { return inputs_[i]; }
1886 int TempCount() final { return 0; }
1887 LOperand* TempAt(int i) final { return NULL; }
1891 class LInvokeFunction final : public LTemplateInstruction<1, 2, 0> {
1893 LInvokeFunction(LOperand* context, LOperand* function) {
1894 inputs_[0] = context;
1895 inputs_[1] = function;
1898 LOperand* context() { return inputs_[0]; }
1899 LOperand* function() { return inputs_[1]; }
1901 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1902 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1904 void PrintDataTo(StringStream* stream) override;
1906 int arity() const { return hydrogen()->argument_count() - 1; }
1910 class LCallFunction final : public LTemplateInstruction<1, 2, 2> {
1912 LCallFunction(LOperand* context, LOperand* function, LOperand* slot,
1914 inputs_[0] = context;
1915 inputs_[1] = function;
1920 LOperand* context() { return inputs_[0]; }
1921 LOperand* function() { return inputs_[1]; }
1922 LOperand* temp_slot() { return temps_[0]; }
1923 LOperand* temp_vector() { return temps_[1]; }
1925 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1926 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1928 int arity() const { return hydrogen()->argument_count() - 1; }
1929 void PrintDataTo(StringStream* stream) override;
1933 class LCallNew final : public LTemplateInstruction<1, 2, 0> {
1935 LCallNew(LOperand* context, LOperand* constructor) {
1936 inputs_[0] = context;
1937 inputs_[1] = constructor;
1940 LOperand* context() { return inputs_[0]; }
1941 LOperand* constructor() { return inputs_[1]; }
1943 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1944 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1946 void PrintDataTo(StringStream* stream) override;
1948 int arity() const { return hydrogen()->argument_count() - 1; }
1952 class LCallNewArray final : public LTemplateInstruction<1, 2, 0> {
1954 LCallNewArray(LOperand* context, LOperand* constructor) {
1955 inputs_[0] = context;
1956 inputs_[1] = constructor;
1959 LOperand* context() { return inputs_[0]; }
1960 LOperand* constructor() { return inputs_[1]; }
1962 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1963 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1965 void PrintDataTo(StringStream* stream) override;
1967 int arity() const { return hydrogen()->argument_count() - 1; }
1971 class LCallRuntime final : public LTemplateInstruction<1, 1, 0> {
1973 explicit LCallRuntime(LOperand* context) {
1974 inputs_[0] = context;
1977 LOperand* context() { return inputs_[0]; }
1979 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1980 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1982 bool ClobbersDoubleRegisters(Isolate* isolate) const override {
1983 return save_doubles() == kDontSaveFPRegs;
1986 const Runtime::Function* function() const { return hydrogen()->function(); }
1987 int arity() const { return hydrogen()->argument_count(); }
1988 SaveFPRegsMode save_doubles() const { return hydrogen()->save_doubles(); }
1992 class LInteger32ToDouble final : public LTemplateInstruction<1, 1, 0> {
1994 explicit LInteger32ToDouble(LOperand* value) {
1998 LOperand* value() { return inputs_[0]; }
2000 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
2004 class LUint32ToDouble final : public LTemplateInstruction<1, 1, 0> {
2006 explicit LUint32ToDouble(LOperand* value) {
2010 LOperand* value() { return inputs_[0]; }
2012 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
2016 class LNumberTagU final : public LTemplateInstruction<1, 1, 2> {
2018 LNumberTagU(LOperand* value, LOperand* temp1, LOperand* temp2) {
2024 LOperand* value() { return inputs_[0]; }
2025 LOperand* temp1() { return temps_[0]; }
2026 LOperand* temp2() { return temps_[1]; }
2028 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
2032 class LNumberTagD final : public LTemplateInstruction<1, 1, 2> {
2034 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
2040 LOperand* value() { return inputs_[0]; }
2041 LOperand* temp() { return temps_[0]; }
2042 LOperand* temp2() { return temps_[1]; }
2044 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
2045 DECLARE_HYDROGEN_ACCESSOR(Change)
2049 class LDoubleToSmi final : public LTemplateInstruction<1, 1, 0> {
2051 explicit LDoubleToSmi(LOperand* value) {
2055 LOperand* value() { return inputs_[0]; }
2057 DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi")
2058 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2060 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2064 // Sometimes truncating conversion from a tagged value to an int32.
2065 class LDoubleToI final : public LTemplateInstruction<1, 1, 0> {
2067 explicit LDoubleToI(LOperand* value) {
2071 LOperand* value() { return inputs_[0]; }
2073 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
2074 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2076 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2080 // Truncating conversion from a tagged value to an int32.
2081 class LTaggedToI final : public LTemplateInstruction<1, 1, 2> {
2083 LTaggedToI(LOperand* value,
2091 LOperand* value() { return inputs_[0]; }
2092 LOperand* temp() { return temps_[0]; }
2093 LOperand* temp2() { return temps_[1]; }
2095 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
2096 DECLARE_HYDROGEN_ACCESSOR(Change)
2098 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2102 class LSmiTag final : public LTemplateInstruction<1, 1, 0> {
2104 explicit LSmiTag(LOperand* value) {
2108 LOperand* value() { return inputs_[0]; }
2110 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2111 DECLARE_HYDROGEN_ACCESSOR(Change)
2115 class LNumberUntagD final : public LTemplateInstruction<1, 1, 0> {
2117 explicit LNumberUntagD(LOperand* value) {
2121 LOperand* value() { return inputs_[0]; }
2123 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2124 DECLARE_HYDROGEN_ACCESSOR(Change)
2128 class LSmiUntag final : public LTemplateInstruction<1, 1, 0> {
2130 LSmiUntag(LOperand* value, bool needs_check)
2131 : needs_check_(needs_check) {
2135 LOperand* value() { return inputs_[0]; }
2136 bool needs_check() const { return needs_check_; }
2138 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2145 class LStoreNamedField final : public LTemplateInstruction<0, 2, 1> {
2147 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2148 inputs_[0] = object;
2153 LOperand* object() { return inputs_[0]; }
2154 LOperand* value() { return inputs_[1]; }
2155 LOperand* temp() { return temps_[0]; }
2157 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2158 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2160 void PrintDataTo(StringStream* stream) override;
2162 Representation representation() const {
2163 return hydrogen()->field_representation();
2168 class LStoreNamedGeneric final : public LTemplateInstruction<0, 3, 2> {
2170 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value,
2171 LOperand* slot, LOperand* vector) {
2172 inputs_[0] = context;
2173 inputs_[1] = object;
2179 LOperand* context() { return inputs_[0]; }
2180 LOperand* object() { return inputs_[1]; }
2181 LOperand* value() { return inputs_[2]; }
2182 LOperand* temp_slot() { return temps_[0]; }
2183 LOperand* temp_vector() { return temps_[1]; }
2185 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2186 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2188 void PrintDataTo(StringStream* stream) override;
2190 Handle<Object> name() const { return hydrogen()->name(); }
2191 LanguageMode language_mode() { return hydrogen()->language_mode(); }
2195 class LStoreGlobalViaContext final : public LTemplateInstruction<0, 2, 0> {
2197 LStoreGlobalViaContext(LOperand* context, LOperand* value) {
2198 inputs_[0] = context;
2202 LOperand* context() { return inputs_[0]; }
2203 LOperand* value() { return inputs_[1]; }
2205 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalViaContext,
2206 "store-global-via-context")
2207 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalViaContext)
2209 void PrintDataTo(StringStream* stream) override;
2211 int depth() { return hydrogen()->depth(); }
2212 int slot_index() { return hydrogen()->slot_index(); }
2213 LanguageMode language_mode() { return hydrogen()->language_mode(); }
2217 class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> {
2219 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
2220 inputs_[0] = object;
2225 bool is_fixed_typed_array() const {
2226 return hydrogen()->is_fixed_typed_array();
2228 LOperand* elements() { return inputs_[0]; }
2229 LOperand* key() { return inputs_[1]; }
2230 LOperand* value() { return inputs_[2]; }
2231 ElementsKind elements_kind() const {
2232 return hydrogen()->elements_kind();
2235 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2236 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
2238 void PrintDataTo(StringStream* stream) override;
2239 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
2240 uint32_t base_offset() const { return hydrogen()->base_offset(); }
2244 class LStoreKeyedGeneric final : public LTemplateInstruction<0, 4, 2> {
2246 LStoreKeyedGeneric(LOperand* context, LOperand* object, LOperand* key,
2247 LOperand* value, LOperand* slot, LOperand* vector) {
2248 inputs_[0] = context;
2249 inputs_[1] = object;
2256 LOperand* context() { return inputs_[0]; }
2257 LOperand* object() { return inputs_[1]; }
2258 LOperand* key() { return inputs_[2]; }
2259 LOperand* value() { return inputs_[3]; }
2260 LOperand* temp_slot() { return temps_[0]; }
2261 LOperand* temp_vector() { return temps_[1]; }
2263 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2264 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2266 void PrintDataTo(StringStream* stream) override;
2268 LanguageMode language_mode() { return hydrogen()->language_mode(); }
2272 class LTransitionElementsKind final : public LTemplateInstruction<0, 2, 1> {
2274 LTransitionElementsKind(LOperand* object,
2276 LOperand* new_map_temp) {
2277 inputs_[0] = object;
2278 inputs_[1] = context;
2279 temps_[0] = new_map_temp;
2282 LOperand* context() { return inputs_[1]; }
2283 LOperand* object() { return inputs_[0]; }
2284 LOperand* new_map_temp() { return temps_[0]; }
2286 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2287 "transition-elements-kind")
2288 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2290 void PrintDataTo(StringStream* stream) override;
2292 Handle<Map> original_map() { return hydrogen()->original_map().handle(); }
2293 Handle<Map> transitioned_map() {
2294 return hydrogen()->transitioned_map().handle();
2296 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2297 ElementsKind to_kind() { return hydrogen()->to_kind(); }
2301 class LTrapAllocationMemento final : public LTemplateInstruction<0, 1, 1> {
2303 LTrapAllocationMemento(LOperand* object,
2305 inputs_[0] = object;
2309 LOperand* object() { return inputs_[0]; }
2310 LOperand* temp() { return temps_[0]; }
2312 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2313 "trap-allocation-memento")
2317 class LMaybeGrowElements final : public LTemplateInstruction<1, 5, 0> {
2319 LMaybeGrowElements(LOperand* context, LOperand* object, LOperand* elements,
2320 LOperand* key, LOperand* current_capacity) {
2321 inputs_[0] = context;
2322 inputs_[1] = object;
2323 inputs_[2] = elements;
2325 inputs_[4] = current_capacity;
2328 LOperand* context() { return inputs_[0]; }
2329 LOperand* object() { return inputs_[1]; }
2330 LOperand* elements() { return inputs_[2]; }
2331 LOperand* key() { return inputs_[3]; }
2332 LOperand* current_capacity() { return inputs_[4]; }
2334 DECLARE_HYDROGEN_ACCESSOR(MaybeGrowElements)
2335 DECLARE_CONCRETE_INSTRUCTION(MaybeGrowElements, "maybe-grow-elements")
2339 class LStringAdd final : public LTemplateInstruction<1, 3, 0> {
2341 LStringAdd(LOperand* context, LOperand* left, LOperand* right) {
2342 inputs_[0] = context;
2347 LOperand* context() { return inputs_[0]; }
2348 LOperand* left() { return inputs_[1]; }
2349 LOperand* right() { return inputs_[2]; }
2351 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2352 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
2356 class LStringCharCodeAt final : public LTemplateInstruction<1, 3, 0> {
2358 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) {
2359 inputs_[0] = context;
2360 inputs_[1] = string;
2364 LOperand* context() { return inputs_[0]; }
2365 LOperand* string() { return inputs_[1]; }
2366 LOperand* index() { return inputs_[2]; }
2368 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2369 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
2373 class LStringCharFromCode final : public LTemplateInstruction<1, 2, 0> {
2375 explicit LStringCharFromCode(LOperand* context, LOperand* char_code) {
2376 inputs_[0] = context;
2377 inputs_[1] = char_code;
2380 LOperand* context() { return inputs_[0]; }
2381 LOperand* char_code() { return inputs_[1]; }
2383 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2384 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
2388 class LCheckValue final : public LTemplateInstruction<0, 1, 0> {
2390 explicit LCheckValue(LOperand* value) {
2394 LOperand* value() { return inputs_[0]; }
2396 DECLARE_CONCRETE_INSTRUCTION(CheckValue, "check-value")
2397 DECLARE_HYDROGEN_ACCESSOR(CheckValue)
2401 class LCheckArrayBufferNotNeutered final
2402 : public LTemplateInstruction<0, 1, 0> {
2404 explicit LCheckArrayBufferNotNeutered(LOperand* view) { inputs_[0] = view; }
2406 LOperand* view() { return inputs_[0]; }
2408 DECLARE_CONCRETE_INSTRUCTION(CheckArrayBufferNotNeutered,
2409 "check-array-buffer-not-neutered")
2410 DECLARE_HYDROGEN_ACCESSOR(CheckArrayBufferNotNeutered)
2414 class LCheckInstanceType final : public LTemplateInstruction<0, 1, 0> {
2416 explicit LCheckInstanceType(LOperand* value) {
2420 LOperand* value() { return inputs_[0]; }
2422 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2423 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2427 class LCheckMaps final : public LTemplateInstruction<0, 1, 0> {
2429 explicit LCheckMaps(LOperand* value = NULL) {
2433 LOperand* value() { return inputs_[0]; }
2435 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2436 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
2440 class LCheckSmi final : public LTemplateInstruction<1, 1, 0> {
2442 explicit LCheckSmi(LOperand* value) {
2446 LOperand* value() { return inputs_[0]; }
2448 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2452 class LCheckNonSmi final : public LTemplateInstruction<0, 1, 0> {
2454 explicit LCheckNonSmi(LOperand* value) {
2458 LOperand* value() { return inputs_[0]; }
2460 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2461 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject)
2465 class LClampDToUint8 final : public LTemplateInstruction<1, 1, 1> {
2467 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2468 inputs_[0] = unclamped;
2472 LOperand* unclamped() { return inputs_[0]; }
2473 LOperand* temp() { return temps_[0]; }
2475 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2479 class LClampIToUint8 final : public LTemplateInstruction<1, 1, 0> {
2481 explicit LClampIToUint8(LOperand* unclamped) {
2482 inputs_[0] = unclamped;
2485 LOperand* unclamped() { return inputs_[0]; }
2487 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2491 class LClampTToUint8 final : public LTemplateInstruction<1, 1, 1> {
2493 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2494 inputs_[0] = unclamped;
2498 LOperand* unclamped() { return inputs_[0]; }
2499 LOperand* temp() { return temps_[0]; }
2501 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2505 class LDoubleBits final : public LTemplateInstruction<1, 1, 0> {
2507 explicit LDoubleBits(LOperand* value) {
2511 LOperand* value() { return inputs_[0]; }
2513 DECLARE_CONCRETE_INSTRUCTION(DoubleBits, "double-bits")
2514 DECLARE_HYDROGEN_ACCESSOR(DoubleBits)
2518 class LConstructDouble final : public LTemplateInstruction<1, 2, 0> {
2520 LConstructDouble(LOperand* hi, LOperand* lo) {
2525 LOperand* hi() { return inputs_[0]; }
2526 LOperand* lo() { return inputs_[1]; }
2528 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble, "construct-double")
2532 class LAllocate final : public LTemplateInstruction<1, 2, 2> {
2534 LAllocate(LOperand* context,
2538 inputs_[0] = context;
2544 LOperand* context() { return inputs_[0]; }
2545 LOperand* size() { return inputs_[1]; }
2546 LOperand* temp1() { return temps_[0]; }
2547 LOperand* temp2() { return temps_[1]; }
2549 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2550 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2554 class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> {
2556 explicit LRegExpLiteral(LOperand* context) {
2557 inputs_[0] = context;
2560 LOperand* context() { return inputs_[0]; }
2562 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2563 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2567 class LFunctionLiteral final : public LTemplateInstruction<1, 1, 0> {
2569 explicit LFunctionLiteral(LOperand* context) {
2570 inputs_[0] = context;
2573 LOperand* context() { return inputs_[0]; }
2575 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2576 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2580 class LToFastProperties final : public LTemplateInstruction<1, 1, 0> {
2582 explicit LToFastProperties(LOperand* value) {
2586 LOperand* value() { return inputs_[0]; }
2588 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2589 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2593 class LTypeof final : public LTemplateInstruction<1, 2, 0> {
2595 LTypeof(LOperand* context, LOperand* value) {
2596 inputs_[0] = context;
2600 LOperand* context() { return inputs_[0]; }
2601 LOperand* value() { return inputs_[1]; }
2603 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2607 class LTypeofIsAndBranch final : public LControlInstruction<1, 0> {
2609 explicit LTypeofIsAndBranch(LOperand* value) {
2613 LOperand* value() { return inputs_[0]; }
2615 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2616 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2618 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2620 void PrintDataTo(StringStream* stream) override;
2624 class LIsConstructCallAndBranch final : public LControlInstruction<0, 1> {
2626 explicit LIsConstructCallAndBranch(LOperand* temp) {
2630 LOperand* temp() { return temps_[0]; }
2632 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2633 "is-construct-call-and-branch")
2637 class LOsrEntry final : public LTemplateInstruction<0, 0, 0> {
2641 bool HasInterestingComment(LCodeGen* gen) const override { return false; }
2642 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2646 class LStackCheck final : public LTemplateInstruction<0, 1, 0> {
2648 explicit LStackCheck(LOperand* context) {
2649 inputs_[0] = context;
2652 LOperand* context() { return inputs_[0]; }
2654 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2655 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2657 Label* done_label() { return &done_label_; }
2664 class LForInPrepareMap final : public LTemplateInstruction<1, 2, 0> {
2666 LForInPrepareMap(LOperand* context, LOperand* object) {
2667 inputs_[0] = context;
2668 inputs_[1] = object;
2671 LOperand* context() { return inputs_[0]; }
2672 LOperand* object() { return inputs_[1]; }
2674 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2678 class LForInCacheArray final : public LTemplateInstruction<1, 1, 0> {
2680 explicit LForInCacheArray(LOperand* map) {
2684 LOperand* map() { return inputs_[0]; }
2686 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2689 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2694 class LCheckMapValue final : public LTemplateInstruction<0, 2, 0> {
2696 LCheckMapValue(LOperand* value, LOperand* map) {
2701 LOperand* value() { return inputs_[0]; }
2702 LOperand* map() { return inputs_[1]; }
2704 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2708 class LLoadFieldByIndex final : public LTemplateInstruction<1, 2, 0> {
2710 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2711 inputs_[0] = object;
2715 LOperand* object() { return inputs_[0]; }
2716 LOperand* index() { return inputs_[1]; }
2718 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2722 class LStoreFrameContext: public LTemplateInstruction<0, 1, 0> {
2724 explicit LStoreFrameContext(LOperand* context) {
2725 inputs_[0] = context;
2728 LOperand* context() { return inputs_[0]; }
2730 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext, "store-frame-context")
2734 class LAllocateBlockContext: public LTemplateInstruction<1, 2, 0> {
2736 LAllocateBlockContext(LOperand* context, LOperand* function) {
2737 inputs_[0] = context;
2738 inputs_[1] = function;
2741 LOperand* context() { return inputs_[0]; }
2742 LOperand* function() { return inputs_[1]; }
2744 Handle<ScopeInfo> scope_info() { return hydrogen()->scope_info(); }
2746 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext, "allocate-block-context")
2747 DECLARE_HYDROGEN_ACCESSOR(AllocateBlockContext)
2751 class LChunkBuilder;
2752 class LPlatformChunk final : public LChunk {
2754 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2755 : LChunk(info, graph) { }
2757 int GetNextSpillIndex(RegisterKind kind);
2758 LOperand* GetNextSpillSlot(RegisterKind kind);
2762 class LChunkBuilder final : public LChunkBuilderBase {
2764 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2765 : LChunkBuilderBase(info, graph),
2766 current_instruction_(NULL),
2767 current_block_(NULL),
2769 allocator_(allocator) {}
2771 // Build the sequence for the graph.
2772 LPlatformChunk* Build();
2774 // Declare methods that deal with the individual node types.
2775 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2776 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2779 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2781 static bool HasMagicNumberForDivisor(int32_t divisor);
2783 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2784 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2785 LInstruction* DoMathFround(HUnaryMathOperation* instr);
2786 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2787 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2788 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2789 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2790 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2791 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2792 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2793 LInstruction* DoDivByConstI(HDiv* instr);
2794 LInstruction* DoDivI(HDiv* instr);
2795 LInstruction* DoModByPowerOf2I(HMod* instr);
2796 LInstruction* DoModByConstI(HMod* instr);
2797 LInstruction* DoModI(HMod* instr);
2798 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2799 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2800 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr);
2803 // Methods for getting operands for Use / Define / Temp.
2804 LUnallocated* ToUnallocated(Register reg);
2805 LUnallocated* ToUnallocated(DoubleRegister reg);
2807 // Methods for setting up define-use relationships.
2808 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2809 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2810 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2811 DoubleRegister fixed_register);
2813 // A value that is guaranteed to be allocated to a register.
2814 // Operand created by UseRegister is guaranteed to be live until the end of
2815 // instruction. This means that register allocator will not reuse it's
2816 // register for any other operand inside instruction.
2817 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2818 // instruction start. Register allocator is free to assign the same register
2819 // to some other operand used inside instruction (i.e. temporary or
2821 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2822 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2824 // An input operand in a register that may be trashed.
2825 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2827 // An input operand in a register or stack slot.
2828 MUST_USE_RESULT LOperand* Use(HValue* value);
2829 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2831 // An input operand in a register, stack slot or a constant operand.
2832 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2833 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2835 // An input operand in a register or a constant operand.
2836 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2837 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2839 // An input operand in a constant operand.
2840 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2842 // An input operand in register, stack slot or a constant operand.
2843 // Will not be moved to a register even if one is freely available.
2844 MUST_USE_RESULT LOperand* UseAny(HValue* value) override;
2846 // Temporary operand that must be in a register.
2847 MUST_USE_RESULT LUnallocated* TempRegister();
2848 MUST_USE_RESULT LUnallocated* TempDoubleRegister();
2849 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2850 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2852 // Methods for setting up define-use relationships.
2853 // Return the same instruction that they are passed.
2854 LInstruction* Define(LTemplateResultInstruction<1>* instr,
2855 LUnallocated* result);
2856 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr);
2857 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr,
2859 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr);
2860 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr,
2862 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr,
2863 DoubleRegister reg);
2864 LInstruction* AssignEnvironment(LInstruction* instr);
2865 LInstruction* AssignPointerMap(LInstruction* instr);
2867 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2869 // By default we assume that instruction sequences generated for calls
2870 // cannot deoptimize eagerly and we do not attach environment to this
2872 LInstruction* MarkAsCall(
2873 LInstruction* instr,
2874 HInstruction* hinstr,
2875 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2877 void VisitInstruction(HInstruction* current);
2878 void AddInstruction(LInstruction* instr, HInstruction* current);
2880 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2881 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2882 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2883 LInstruction* DoArithmeticD(Token::Value op,
2884 HArithmeticBinaryOperation* instr);
2885 LInstruction* DoArithmeticT(Token::Value op,
2886 HBinaryOperation* instr);
2888 HInstruction* current_instruction_;
2889 HBasicBlock* current_block_;
2890 HBasicBlock* next_block_;
2891 LAllocator* allocator_;
2893 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2896 #undef DECLARE_HYDROGEN_ACCESSOR
2897 #undef DECLARE_CONCRETE_INSTRUCTION
2899 } } // namespace v8::internal
2901 #endif // V8_MIPS_LITHIUM_MIPS_H_