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_ARM_LITHIUM_ARM_H_
6 #define V8_ARM_LITHIUM_ARM_H_
9 #include "lithium-allocator.h"
11 #include "safepoint-table.h"
17 // Forward declarations.
20 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
21 V(AccessArgumentsAt) \
25 V(ArgumentsElements) \
33 V(CallWithDescriptor) \
39 V(CheckInstanceType) \
48 V(ClassOfTestAndBranch) \
49 V(CompareMinusZeroAndBranch) \
50 V(CompareNumericAndBranch) \
51 V(CmpObjectEqAndBranch) \
75 V(FlooringDivByConstI) \
76 V(FlooringDivByPowerOf2I) \
81 V(GetCachedArrayIndex) \
83 V(HasCachedArrayIndexAndBranch) \
84 V(HasInstanceTypeAndBranch) \
85 V(InnerAllocatedObject) \
87 V(InstanceOfKnownGlobal) \
89 V(Integer32ToDouble) \
91 V(IsConstructCallAndBranch) \
92 V(IsObjectAndBranch) \
93 V(IsStringAndBranch) \
95 V(IsUndetectableAndBranch) \
100 V(LoadFieldByIndex) \
101 V(LoadFunctionPrototype) \
103 V(LoadGlobalGeneric) \
105 V(LoadKeyedGeneric) \
107 V(LoadNamedGeneric) \
134 V(SeqStringGetChar) \
135 V(SeqStringSetChar) \
141 V(StoreContextSlot) \
144 V(StoreKeyedGeneric) \
146 V(StoreNamedGeneric) \
148 V(StringCharCodeAt) \
149 V(StringCharFromCode) \
150 V(StringCompareAndBranch) \
155 V(ToFastProperties) \
156 V(TransitionElementsKind) \
157 V(TrapAllocationMemento) \
159 V(TypeofIsAndBranch) \
165 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
166 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \
167 return LInstruction::k##type; \
169 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \
170 virtual const char* Mnemonic() const V8_FINAL V8_OVERRIDE { \
173 static L##type* cast(LInstruction* instr) { \
174 ASSERT(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 void set_environment(LEnvironment* env) { environment_ = env; }
224 LEnvironment* environment() const { return environment_; }
225 bool HasEnvironment() const { return environment_ != NULL; }
227 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
228 LPointerMap* pointer_map() const { return pointer_map_.get(); }
229 bool HasPointerMap() const { return pointer_map_.is_set(); }
231 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
232 HValue* hydrogen_value() const { return hydrogen_value_; }
234 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
236 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); }
237 bool IsCall() const { return IsCallBits::decode(bit_field_); }
239 // Interface to the register allocator and iterators.
240 bool ClobbersTemps() const { return IsCall(); }
241 bool ClobbersRegisters() const { return IsCall(); }
242 virtual bool ClobbersDoubleRegisters(Isolate* isolate) const {
246 // Interface to the register allocator and iterators.
247 bool IsMarkedAsCall() const { return IsCall(); }
249 virtual bool HasResult() const = 0;
250 virtual LOperand* result() const = 0;
252 LOperand* FirstInput() { return InputAt(0); }
253 LOperand* Output() { return HasResult() ? result() : NULL; }
255 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
263 friend class InputIterator;
264 virtual int InputCount() = 0;
265 virtual LOperand* InputAt(int i) = 0;
267 friend class TempIterator;
268 virtual int TempCount() = 0;
269 virtual LOperand* TempAt(int i) = 0;
271 class IsCallBits: public BitField<bool, 0, 1> {};
273 LEnvironment* environment_;
274 SetOncePointer<LPointerMap> pointer_map_;
275 HValue* hydrogen_value_;
280 // R = number of result operands (0 or 1).
282 class LTemplateResultInstruction : public LInstruction {
284 // Allow 0 or 1 output operands.
285 STATIC_ASSERT(R == 0 || R == 1);
286 virtual bool HasResult() const V8_FINAL V8_OVERRIDE {
287 return R != 0 && result() != NULL;
289 void set_result(LOperand* operand) { results_[0] = operand; }
290 LOperand* result() const { 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 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; }
309 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
311 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; }
312 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { 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 virtual bool IsGap() const V8_OVERRIDE { return true; }
328 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
329 static LGap* cast(LInstruction* instr) {
330 ASSERT(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 V8_FINAL : public LGap {
366 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
368 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
369 return !IsRedundant();
372 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
376 class LGoto V8_FINAL : public LTemplateInstruction<0, 0, 0> {
378 explicit LGoto(HBasicBlock* block) : block_(block) { }
380 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE;
381 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
382 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
383 virtual bool IsControl() const V8_OVERRIDE { return true; }
385 int block_id() const { return block_->block_id(); }
392 class LLazyBailout V8_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 V8_FINAL : public LTemplateInstruction<1, 0, 0> {
410 explicit LDummy() { }
411 DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
415 class LDummyUse V8_FINAL : public LTemplateInstruction<1, 1, 0> {
417 explicit LDummyUse(LOperand* value) {
420 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
424 class LDeoptimize V8_FINAL : public LTemplateInstruction<0, 0, 0> {
426 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
427 DECLARE_HYDROGEN_ACCESSOR(Deoptimize)
431 class LLabel V8_FINAL : public LGap {
433 explicit LLabel(HBasicBlock* block)
434 : LGap(block), replacement_(NULL) { }
436 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
439 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
441 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
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; }
453 LLabel* replacement_;
457 class LParameter V8_FINAL : public LTemplateInstruction<1, 0, 0> {
459 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
460 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
464 class LCallStub V8_FINAL : public LTemplateInstruction<1, 1, 0> {
466 explicit LCallStub(LOperand* context) {
467 inputs_[0] = context;
470 LOperand* context() { return inputs_[0]; }
472 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
473 DECLARE_HYDROGEN_ACCESSOR(CallStub)
477 class LUnknownOSRValue V8_FINAL : public LTemplateInstruction<1, 0, 0> {
479 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
482 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
486 template<int I, int T>
487 class LControlInstruction : public LTemplateInstruction<0, I, T> {
489 LControlInstruction() : false_label_(NULL), true_label_(NULL) { }
491 virtual bool IsControl() const V8_FINAL V8_OVERRIDE { return true; }
493 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
494 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
496 int TrueDestination(LChunk* chunk) {
497 return chunk->LookupDestination(true_block_id());
499 int FalseDestination(LChunk* chunk) {
500 return chunk->LookupDestination(false_block_id());
503 Label* TrueLabel(LChunk* chunk) {
504 if (true_label_ == NULL) {
505 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk));
509 Label* FalseLabel(LChunk* chunk) {
510 if (false_label_ == NULL) {
511 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk));
517 int true_block_id() { return SuccessorAt(0)->block_id(); }
518 int false_block_id() { return SuccessorAt(1)->block_id(); }
521 HControlInstruction* hydrogen() {
522 return HControlInstruction::cast(this->hydrogen_value());
530 class LWrapReceiver V8_FINAL : public LTemplateInstruction<1, 2, 0> {
532 LWrapReceiver(LOperand* receiver, LOperand* function) {
533 inputs_[0] = receiver;
534 inputs_[1] = function;
537 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
538 DECLARE_HYDROGEN_ACCESSOR(WrapReceiver)
540 LOperand* receiver() { return inputs_[0]; }
541 LOperand* function() { return inputs_[1]; }
545 class LApplyArguments V8_FINAL : public LTemplateInstruction<1, 4, 0> {
547 LApplyArguments(LOperand* function,
550 LOperand* elements) {
551 inputs_[0] = function;
552 inputs_[1] = receiver;
554 inputs_[3] = elements;
557 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
559 LOperand* function() { return inputs_[0]; }
560 LOperand* receiver() { return inputs_[1]; }
561 LOperand* length() { return inputs_[2]; }
562 LOperand* elements() { return inputs_[3]; }
566 class LAccessArgumentsAt V8_FINAL : public LTemplateInstruction<1, 3, 0> {
568 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
569 inputs_[0] = arguments;
574 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
576 LOperand* arguments() { return inputs_[0]; }
577 LOperand* length() { return inputs_[1]; }
578 LOperand* index() { return inputs_[2]; }
580 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
584 class LArgumentsLength V8_FINAL : public LTemplateInstruction<1, 1, 0> {
586 explicit LArgumentsLength(LOperand* elements) {
587 inputs_[0] = elements;
590 LOperand* elements() { return inputs_[0]; }
592 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
596 class LArgumentsElements V8_FINAL : public LTemplateInstruction<1, 0, 0> {
598 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
599 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
603 class LModByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
605 LModByPowerOf2I(LOperand* dividend, int32_t divisor) {
606 inputs_[0] = dividend;
610 LOperand* dividend() { return inputs_[0]; }
611 int32_t divisor() const { return divisor_; }
613 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
614 DECLARE_HYDROGEN_ACCESSOR(Mod)
621 class LModByConstI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
623 LModByConstI(LOperand* dividend, int32_t divisor) {
624 inputs_[0] = dividend;
628 LOperand* dividend() { return inputs_[0]; }
629 int32_t divisor() const { return divisor_; }
631 DECLARE_CONCRETE_INSTRUCTION(ModByConstI, "mod-by-const-i")
632 DECLARE_HYDROGEN_ACCESSOR(Mod)
639 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 2> {
641 LModI(LOperand* left, LOperand* right, LOperand* temp, LOperand* temp2) {
648 LOperand* left() { return inputs_[0]; }
649 LOperand* right() { return inputs_[1]; }
650 LOperand* temp() { return temps_[0]; }
651 LOperand* temp2() { return temps_[1]; }
653 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
654 DECLARE_HYDROGEN_ACCESSOR(Mod)
658 class LDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
660 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
661 inputs_[0] = dividend;
665 LOperand* dividend() { return inputs_[0]; }
666 int32_t divisor() const { return divisor_; }
668 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
669 DECLARE_HYDROGEN_ACCESSOR(Div)
676 class LDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
678 LDivByConstI(LOperand* dividend, int32_t divisor) {
679 inputs_[0] = dividend;
683 LOperand* dividend() { return inputs_[0]; }
684 int32_t divisor() const { return divisor_; }
686 DECLARE_CONCRETE_INSTRUCTION(DivByConstI, "div-by-const-i")
687 DECLARE_HYDROGEN_ACCESSOR(Div)
694 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
696 LDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
697 inputs_[0] = dividend;
698 inputs_[1] = divisor;
702 LOperand* dividend() { return inputs_[0]; }
703 LOperand* divisor() { return inputs_[1]; }
704 LOperand* temp() { return temps_[0]; }
706 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
707 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
711 class LFlooringDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
713 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
714 inputs_[0] = dividend;
718 LOperand* dividend() { return inputs_[0]; }
719 int32_t divisor() { return divisor_; }
721 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
722 "flooring-div-by-power-of-2-i")
723 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
730 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
732 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) {
733 inputs_[0] = dividend;
738 LOperand* dividend() { return inputs_[0]; }
739 int32_t divisor() const { return divisor_; }
740 LOperand* temp() { return temps_[0]; }
742 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
743 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
750 class LFlooringDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
752 LFlooringDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
753 inputs_[0] = dividend;
754 inputs_[1] = divisor;
758 LOperand* dividend() { return inputs_[0]; }
759 LOperand* divisor() { return inputs_[1]; }
760 LOperand* temp() { return temps_[0]; }
762 DECLARE_CONCRETE_INSTRUCTION(FlooringDivI, "flooring-div-i")
763 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
767 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
769 LMulI(LOperand* left, LOperand* right) {
774 LOperand* left() { return inputs_[0]; }
775 LOperand* right() { return inputs_[1]; }
777 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
778 DECLARE_HYDROGEN_ACCESSOR(Mul)
782 // Instruction for computing multiplier * multiplicand + addend.
783 class LMultiplyAddD V8_FINAL : public LTemplateInstruction<1, 3, 0> {
785 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
786 LOperand* multiplicand) {
788 inputs_[1] = multiplier;
789 inputs_[2] = multiplicand;
792 LOperand* addend() { return inputs_[0]; }
793 LOperand* multiplier() { return inputs_[1]; }
794 LOperand* multiplicand() { return inputs_[2]; }
796 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
800 // Instruction for computing minuend - multiplier * multiplicand.
801 class LMultiplySubD V8_FINAL : public LTemplateInstruction<1, 3, 0> {
803 LMultiplySubD(LOperand* minuend, LOperand* multiplier,
804 LOperand* multiplicand) {
805 inputs_[0] = minuend;
806 inputs_[1] = multiplier;
807 inputs_[2] = multiplicand;
810 LOperand* minuend() { return inputs_[0]; }
811 LOperand* multiplier() { return inputs_[1]; }
812 LOperand* multiplicand() { return inputs_[2]; }
814 DECLARE_CONCRETE_INSTRUCTION(MultiplySubD, "multiply-sub-d")
818 class LDebugBreak V8_FINAL : public LTemplateInstruction<0, 0, 0> {
820 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
824 class LCompareNumericAndBranch V8_FINAL : public LControlInstruction<2, 0> {
826 LCompareNumericAndBranch(LOperand* left, LOperand* right) {
831 LOperand* left() { return inputs_[0]; }
832 LOperand* right() { return inputs_[1]; }
834 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch,
835 "compare-numeric-and-branch")
836 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch)
838 Token::Value op() const { return hydrogen()->token(); }
839 bool is_double() const {
840 return hydrogen()->representation().IsDouble();
843 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
847 class LMathFloor V8_FINAL : public LTemplateInstruction<1, 1, 0> {
849 explicit LMathFloor(LOperand* value) {
853 LOperand* value() { return inputs_[0]; }
855 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
856 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
860 class LMathRound V8_FINAL : public LTemplateInstruction<1, 1, 1> {
862 LMathRound(LOperand* value, LOperand* temp) {
867 LOperand* value() { return inputs_[0]; }
868 LOperand* temp() { return temps_[0]; }
870 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
871 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
875 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> {
877 LMathAbs(LOperand* context, LOperand* value) {
878 inputs_[1] = context;
882 LOperand* context() { return inputs_[1]; }
883 LOperand* value() { return inputs_[0]; }
885 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
886 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
890 class LMathLog V8_FINAL : public LTemplateInstruction<1, 1, 0> {
892 explicit LMathLog(LOperand* value) {
896 LOperand* value() { return inputs_[0]; }
898 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
902 class LMathClz32 V8_FINAL : public LTemplateInstruction<1, 1, 0> {
904 explicit LMathClz32(LOperand* value) {
908 LOperand* value() { return inputs_[0]; }
910 DECLARE_CONCRETE_INSTRUCTION(MathClz32, "math-clz32")
914 class LMathExp V8_FINAL : public LTemplateInstruction<1, 1, 3> {
916 LMathExp(LOperand* value,
917 LOperand* double_temp,
923 temps_[2] = double_temp;
924 ExternalReference::InitializeMathExpData();
927 LOperand* value() { return inputs_[0]; }
928 LOperand* temp1() { return temps_[0]; }
929 LOperand* temp2() { return temps_[1]; }
930 LOperand* double_temp() { return temps_[2]; }
932 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
936 class LMathSqrt V8_FINAL : public LTemplateInstruction<1, 1, 0> {
938 explicit LMathSqrt(LOperand* value) {
942 LOperand* value() { return inputs_[0]; }
944 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
948 class LMathPowHalf V8_FINAL : public LTemplateInstruction<1, 1, 0> {
950 explicit LMathPowHalf(LOperand* value) {
954 LOperand* value() { return inputs_[0]; }
956 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
960 class LCmpObjectEqAndBranch V8_FINAL : public LControlInstruction<2, 0> {
962 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
967 LOperand* left() { return inputs_[0]; }
968 LOperand* right() { return inputs_[1]; }
970 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch")
971 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
975 class LCmpHoleAndBranch V8_FINAL : public LControlInstruction<1, 0> {
977 explicit LCmpHoleAndBranch(LOperand* object) {
981 LOperand* object() { return inputs_[0]; }
983 DECLARE_CONCRETE_INSTRUCTION(CmpHoleAndBranch, "cmp-hole-and-branch")
984 DECLARE_HYDROGEN_ACCESSOR(CompareHoleAndBranch)
988 class LCompareMinusZeroAndBranch V8_FINAL : public LControlInstruction<1, 1> {
990 LCompareMinusZeroAndBranch(LOperand* value, LOperand* temp) {
995 LOperand* value() { return inputs_[0]; }
996 LOperand* temp() { return temps_[0]; }
998 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch,
999 "cmp-minus-zero-and-branch")
1000 DECLARE_HYDROGEN_ACCESSOR(CompareMinusZeroAndBranch)
1004 class LIsObjectAndBranch V8_FINAL : public LControlInstruction<1, 1> {
1006 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
1011 LOperand* value() { return inputs_[0]; }
1012 LOperand* temp() { return temps_[0]; }
1014 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
1015 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
1017 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1021 class LIsStringAndBranch V8_FINAL : public LControlInstruction<1, 1> {
1023 LIsStringAndBranch(LOperand* value, LOperand* temp) {
1028 LOperand* value() { return inputs_[0]; }
1029 LOperand* temp() { return temps_[0]; }
1031 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
1032 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
1034 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1038 class LIsSmiAndBranch V8_FINAL : public LControlInstruction<1, 0> {
1040 explicit LIsSmiAndBranch(LOperand* value) {
1044 LOperand* value() { return inputs_[0]; }
1046 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
1047 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
1049 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1053 class LIsUndetectableAndBranch V8_FINAL : public LControlInstruction<1, 1> {
1055 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
1060 LOperand* value() { return inputs_[0]; }
1061 LOperand* temp() { return temps_[0]; }
1063 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
1064 "is-undetectable-and-branch")
1065 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
1067 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1071 class LStringCompareAndBranch V8_FINAL : public LControlInstruction<3, 0> {
1073 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) {
1074 inputs_[0] = context;
1079 LOperand* context() { return inputs_[0]; }
1080 LOperand* left() { return inputs_[1]; }
1081 LOperand* right() { return inputs_[2]; }
1083 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
1084 "string-compare-and-branch")
1085 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
1087 Token::Value op() const { return hydrogen()->token(); }
1089 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1093 class LHasInstanceTypeAndBranch V8_FINAL : public LControlInstruction<1, 0> {
1095 explicit LHasInstanceTypeAndBranch(LOperand* value) {
1099 LOperand* value() { return inputs_[0]; }
1101 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
1102 "has-instance-type-and-branch")
1103 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
1105 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1109 class LGetCachedArrayIndex V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1111 explicit LGetCachedArrayIndex(LOperand* value) {
1115 LOperand* value() { return inputs_[0]; }
1117 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
1118 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
1122 class LHasCachedArrayIndexAndBranch V8_FINAL
1123 : public LControlInstruction<1, 0> {
1125 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
1129 LOperand* value() { return inputs_[0]; }
1131 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
1132 "has-cached-array-index-and-branch")
1133 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
1135 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1139 class LClassOfTestAndBranch V8_FINAL : public LControlInstruction<1, 1> {
1141 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
1146 LOperand* value() { return inputs_[0]; }
1147 LOperand* temp() { return temps_[0]; }
1149 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1150 "class-of-test-and-branch")
1151 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1153 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1157 class LCmpT V8_FINAL : public LTemplateInstruction<1, 3, 0> {
1159 LCmpT(LOperand* context, LOperand* left, LOperand* right) {
1160 inputs_[0] = context;
1165 LOperand* context() { return inputs_[0]; }
1166 LOperand* left() { return inputs_[1]; }
1167 LOperand* right() { return inputs_[2]; }
1169 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1170 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1172 Token::Value op() const { return hydrogen()->token(); }
1176 class LInstanceOf V8_FINAL : public LTemplateInstruction<1, 3, 0> {
1178 LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
1179 inputs_[0] = context;
1184 LOperand* context() { return inputs_[0]; }
1185 LOperand* left() { return inputs_[1]; }
1186 LOperand* right() { return inputs_[2]; }
1188 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1192 class LInstanceOfKnownGlobal V8_FINAL : public LTemplateInstruction<1, 2, 1> {
1194 LInstanceOfKnownGlobal(LOperand* context, LOperand* value, LOperand* temp) {
1195 inputs_[0] = context;
1200 LOperand* context() { return inputs_[0]; }
1201 LOperand* value() { return inputs_[1]; }
1202 LOperand* temp() { return temps_[0]; }
1204 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1205 "instance-of-known-global")
1206 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1208 Handle<JSFunction> function() const { return hydrogen()->function(); }
1209 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
1210 return lazy_deopt_env_;
1212 virtual void SetDeferredLazyDeoptimizationEnvironment(
1213 LEnvironment* env) V8_OVERRIDE {
1214 lazy_deopt_env_ = env;
1218 LEnvironment* lazy_deopt_env_;
1222 class LBoundsCheck V8_FINAL : public LTemplateInstruction<0, 2, 0> {
1224 LBoundsCheck(LOperand* index, LOperand* length) {
1226 inputs_[1] = length;
1229 LOperand* index() { return inputs_[0]; }
1230 LOperand* length() { return inputs_[1]; }
1232 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
1233 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
1237 class LBitI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1239 LBitI(LOperand* left, LOperand* right) {
1244 LOperand* left() { return inputs_[0]; }
1245 LOperand* right() { return inputs_[1]; }
1247 Token::Value op() const { return hydrogen()->op(); }
1249 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1250 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1254 class LShiftI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1256 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1257 : op_(op), can_deopt_(can_deopt) {
1262 Token::Value op() const { return op_; }
1263 LOperand* left() { return inputs_[0]; }
1264 LOperand* right() { return inputs_[1]; }
1265 bool can_deopt() const { return can_deopt_; }
1267 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1275 class LSubI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1277 LSubI(LOperand* left, LOperand* right) {
1282 LOperand* left() { return inputs_[0]; }
1283 LOperand* right() { return inputs_[1]; }
1285 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1286 DECLARE_HYDROGEN_ACCESSOR(Sub)
1290 class LRSubI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1292 LRSubI(LOperand* left, LOperand* right) {
1297 LOperand* left() { return inputs_[0]; }
1298 LOperand* right() { return inputs_[1]; }
1300 DECLARE_CONCRETE_INSTRUCTION(RSubI, "rsub-i")
1301 DECLARE_HYDROGEN_ACCESSOR(Sub)
1305 class LConstantI V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1307 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1308 DECLARE_HYDROGEN_ACCESSOR(Constant)
1310 int32_t value() const { return hydrogen()->Integer32Value(); }
1314 class LConstantS V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1316 DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s")
1317 DECLARE_HYDROGEN_ACCESSOR(Constant)
1319 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); }
1323 class LConstantD V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1325 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1326 DECLARE_HYDROGEN_ACCESSOR(Constant)
1328 double value() const { return hydrogen()->DoubleValue(); }
1332 class LConstantE V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1334 DECLARE_CONCRETE_INSTRUCTION(ConstantE, "constant-e")
1335 DECLARE_HYDROGEN_ACCESSOR(Constant)
1337 ExternalReference value() const {
1338 return hydrogen()->ExternalReferenceValue();
1343 class LConstantT V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1345 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1346 DECLARE_HYDROGEN_ACCESSOR(Constant)
1348 Handle<Object> value(Isolate* isolate) const {
1349 return hydrogen()->handle(isolate);
1354 class LBranch V8_FINAL : public LControlInstruction<1, 0> {
1356 explicit LBranch(LOperand* value) {
1360 LOperand* value() { return inputs_[0]; }
1362 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1363 DECLARE_HYDROGEN_ACCESSOR(Branch)
1365 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1369 class LCmpMapAndBranch V8_FINAL : public LControlInstruction<1, 1> {
1371 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1376 LOperand* value() { return inputs_[0]; }
1377 LOperand* temp() { return temps_[0]; }
1379 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1380 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1382 Handle<Map> map() const { return hydrogen()->map().handle(); }
1386 class LMapEnumLength V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1388 explicit LMapEnumLength(LOperand* value) {
1392 LOperand* value() { return inputs_[0]; }
1394 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1398 class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 1> {
1400 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1405 LOperand* date() { return inputs_[0]; }
1406 LOperand* temp() { return temps_[0]; }
1407 Smi* index() const { return index_; }
1409 DECLARE_CONCRETE_INSTRUCTION(DateField, "date-field")
1410 DECLARE_HYDROGEN_ACCESSOR(DateField)
1417 class LSeqStringGetChar V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1419 LSeqStringGetChar(LOperand* string, LOperand* index) {
1420 inputs_[0] = string;
1424 LOperand* string() const { return inputs_[0]; }
1425 LOperand* index() const { return inputs_[1]; }
1427 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar, "seq-string-get-char")
1428 DECLARE_HYDROGEN_ACCESSOR(SeqStringGetChar)
1432 class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 4, 0> {
1434 LSeqStringSetChar(LOperand* context,
1438 inputs_[0] = context;
1439 inputs_[1] = string;
1444 LOperand* string() { return inputs_[1]; }
1445 LOperand* index() { return inputs_[2]; }
1446 LOperand* value() { return inputs_[3]; }
1448 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1449 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1453 class LAddI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1455 LAddI(LOperand* left, LOperand* right) {
1460 LOperand* left() { return inputs_[0]; }
1461 LOperand* right() { return inputs_[1]; }
1463 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1464 DECLARE_HYDROGEN_ACCESSOR(Add)
1468 class LMathMinMax V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1470 LMathMinMax(LOperand* left, LOperand* right) {
1475 LOperand* left() { return inputs_[0]; }
1476 LOperand* right() { return inputs_[1]; }
1478 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
1479 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1483 class LPower V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1485 LPower(LOperand* left, LOperand* right) {
1490 LOperand* left() { return inputs_[0]; }
1491 LOperand* right() { return inputs_[1]; }
1493 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1494 DECLARE_HYDROGEN_ACCESSOR(Power)
1498 class LArithmeticD V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1500 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1506 Token::Value op() const { return op_; }
1507 LOperand* left() { return inputs_[0]; }
1508 LOperand* right() { return inputs_[1]; }
1510 virtual Opcode opcode() const V8_OVERRIDE {
1511 return LInstruction::kArithmeticD;
1513 virtual void CompileToNative(LCodeGen* generator) V8_OVERRIDE;
1514 virtual const char* Mnemonic() const V8_OVERRIDE;
1521 class LArithmeticT V8_FINAL : public LTemplateInstruction<1, 3, 0> {
1523 LArithmeticT(Token::Value op,
1528 inputs_[0] = context;
1533 LOperand* context() { return inputs_[0]; }
1534 LOperand* left() { return inputs_[1]; }
1535 LOperand* right() { return inputs_[2]; }
1536 Token::Value op() const { return op_; }
1538 virtual Opcode opcode() const V8_OVERRIDE {
1539 return LInstruction::kArithmeticT;
1541 virtual void CompileToNative(LCodeGen* generator) V8_OVERRIDE;
1542 virtual const char* Mnemonic() const V8_OVERRIDE;
1549 class LReturn V8_FINAL : public LTemplateInstruction<0, 3, 0> {
1551 LReturn(LOperand* value, LOperand* context, LOperand* parameter_count) {
1553 inputs_[1] = context;
1554 inputs_[2] = parameter_count;
1557 LOperand* value() { return inputs_[0]; }
1559 bool has_constant_parameter_count() {
1560 return parameter_count()->IsConstantOperand();
1562 LConstantOperand* constant_parameter_count() {
1563 ASSERT(has_constant_parameter_count());
1564 return LConstantOperand::cast(parameter_count());
1566 LOperand* parameter_count() { return inputs_[2]; }
1568 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1572 class LLoadNamedField V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1574 explicit LLoadNamedField(LOperand* object) {
1575 inputs_[0] = object;
1578 LOperand* object() { return inputs_[0]; }
1580 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1581 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1585 class LLoadNamedGeneric V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1587 LLoadNamedGeneric(LOperand* context, LOperand* object) {
1588 inputs_[0] = context;
1589 inputs_[1] = object;
1592 LOperand* context() { return inputs_[0]; }
1593 LOperand* object() { return inputs_[1]; }
1595 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1596 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1598 Handle<Object> name() const { return hydrogen()->name(); }
1602 class LLoadFunctionPrototype V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1604 explicit LLoadFunctionPrototype(LOperand* function) {
1605 inputs_[0] = function;
1608 LOperand* function() { return inputs_[0]; }
1610 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1611 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1615 class LLoadRoot V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1617 DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
1618 DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
1620 Heap::RootListIndex index() const { return hydrogen()->index(); }
1624 class LLoadKeyed V8_FINAL : public LTemplateInstruction<1, 2, 2> {
1626 LLoadKeyed(LOperand* elements, LOperand* key,
1627 LOperand* temp, LOperand* temp2) {
1628 inputs_[0] = elements;
1634 LOperand* elements() { return inputs_[0]; }
1635 LOperand* key() { return inputs_[1]; }
1636 LOperand* temp() { return temps_[0]; }
1637 LOperand* temp2() { return temps_[1]; }
1638 ElementsKind elements_kind() const {
1639 return hydrogen()->elements_kind();
1641 bool is_external() const {
1642 return hydrogen()->is_external();
1644 bool is_fixed_typed_array() const {
1645 return hydrogen()->is_fixed_typed_array();
1647 bool is_typed_elements() const {
1648 return is_external() || is_fixed_typed_array();
1651 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1652 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1654 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1655 uint32_t additional_index() const { return hydrogen()->index_offset(); }
1659 class LLoadKeyedGeneric V8_FINAL : public LTemplateInstruction<1, 3, 0> {
1661 LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key) {
1662 inputs_[0] = context;
1663 inputs_[1] = object;
1667 LOperand* context() { return inputs_[0]; }
1668 LOperand* object() { return inputs_[1]; }
1669 LOperand* key() { return inputs_[2]; }
1671 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1675 class LLoadGlobalCell V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1677 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1678 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1682 class LLoadGlobalGeneric V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1684 LLoadGlobalGeneric(LOperand* context, LOperand* global_object) {
1685 inputs_[0] = context;
1686 inputs_[1] = global_object;
1689 LOperand* context() { return inputs_[0]; }
1690 LOperand* global_object() { return inputs_[1]; }
1692 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1693 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1695 Handle<Object> name() const { return hydrogen()->name(); }
1696 bool for_typeof() const { return hydrogen()->for_typeof(); }
1700 class LStoreGlobalCell V8_FINAL : public LTemplateInstruction<0, 1, 1> {
1702 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1707 LOperand* value() { return inputs_[0]; }
1708 LOperand* temp() { return temps_[0]; }
1710 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1711 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1715 class LLoadContextSlot V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1717 explicit LLoadContextSlot(LOperand* context) {
1718 inputs_[0] = context;
1721 LOperand* context() { return inputs_[0]; }
1723 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1724 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1726 int slot_index() { return hydrogen()->slot_index(); }
1728 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1732 class LStoreContextSlot V8_FINAL : public LTemplateInstruction<0, 2, 0> {
1734 LStoreContextSlot(LOperand* context, LOperand* value) {
1735 inputs_[0] = context;
1739 LOperand* context() { return inputs_[0]; }
1740 LOperand* value() { return inputs_[1]; }
1742 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1743 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1745 int slot_index() { return hydrogen()->slot_index(); }
1747 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1751 class LPushArgument V8_FINAL : public LTemplateInstruction<0, 1, 0> {
1753 explicit LPushArgument(LOperand* value) {
1757 LOperand* value() { return inputs_[0]; }
1759 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1763 class LDrop V8_FINAL : public LTemplateInstruction<0, 0, 0> {
1765 explicit LDrop(int count) : count_(count) { }
1767 int count() const { return count_; }
1769 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1776 class LStoreCodeEntry V8_FINAL: public LTemplateInstruction<0, 1, 1> {
1778 LStoreCodeEntry(LOperand* function, LOperand* code_object) {
1779 inputs_[0] = function;
1780 temps_[0] = code_object;
1783 LOperand* function() { return inputs_[0]; }
1784 LOperand* code_object() { return temps_[0]; }
1786 virtual void PrintDataTo(StringStream* stream);
1788 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry, "store-code-entry")
1789 DECLARE_HYDROGEN_ACCESSOR(StoreCodeEntry)
1793 class LInnerAllocatedObject V8_FINAL: public LTemplateInstruction<1, 2, 0> {
1795 LInnerAllocatedObject(LOperand* base_object, LOperand* offset) {
1796 inputs_[0] = base_object;
1797 inputs_[1] = offset;
1800 LOperand* base_object() const { return inputs_[0]; }
1801 LOperand* offset() const { return inputs_[1]; }
1803 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1805 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "inner-allocated-object")
1809 class LThisFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1811 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1812 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1816 class LContext V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1818 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1819 DECLARE_HYDROGEN_ACCESSOR(Context)
1823 class LDeclareGlobals V8_FINAL : public LTemplateInstruction<0, 1, 0> {
1825 explicit LDeclareGlobals(LOperand* context) {
1826 inputs_[0] = context;
1829 LOperand* context() { return inputs_[0]; }
1831 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1832 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1836 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1838 explicit LCallJSFunction(LOperand* function) {
1839 inputs_[0] = function;
1842 LOperand* function() { return inputs_[0]; }
1844 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function")
1845 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction)
1847 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1849 int arity() const { return hydrogen()->argument_count() - 1; }
1853 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> {
1855 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor,
1856 ZoneList<LOperand*>& operands,
1858 : descriptor_(descriptor),
1859 inputs_(descriptor->environment_length() + 1, zone) {
1860 ASSERT(descriptor->environment_length() + 1 == operands.length());
1861 inputs_.AddAll(operands, zone);
1864 LOperand* target() const { return inputs_[0]; }
1866 const CallInterfaceDescriptor* descriptor() { return descriptor_; }
1869 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1870 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1872 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1874 int arity() const { return hydrogen()->argument_count() - 1; }
1876 const CallInterfaceDescriptor* descriptor_;
1877 ZoneList<LOperand*> inputs_;
1879 // Iterator support.
1880 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); }
1881 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
1883 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; }
1884 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; }
1888 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1890 LInvokeFunction(LOperand* context, LOperand* function) {
1891 inputs_[0] = context;
1892 inputs_[1] = function;
1895 LOperand* context() { return inputs_[0]; }
1896 LOperand* function() { return inputs_[1]; }
1898 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1899 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1901 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1903 int arity() const { return hydrogen()->argument_count() - 1; }
1907 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1909 LCallFunction(LOperand* context, LOperand* function) {
1910 inputs_[0] = context;
1911 inputs_[1] = function;
1914 LOperand* context() { return inputs_[0]; }
1915 LOperand* function() { return inputs_[1]; }
1917 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1918 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1920 int arity() const { return hydrogen()->argument_count() - 1; }
1924 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1926 LCallNew(LOperand* context, LOperand* constructor) {
1927 inputs_[0] = context;
1928 inputs_[1] = constructor;
1931 LOperand* context() { return inputs_[0]; }
1932 LOperand* constructor() { return inputs_[1]; }
1934 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1935 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1937 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1939 int arity() const { return hydrogen()->argument_count() - 1; }
1943 class LCallNewArray V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1945 LCallNewArray(LOperand* context, LOperand* constructor) {
1946 inputs_[0] = context;
1947 inputs_[1] = constructor;
1950 LOperand* context() { return inputs_[0]; }
1951 LOperand* constructor() { return inputs_[1]; }
1953 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1954 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1956 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1958 int arity() const { return hydrogen()->argument_count() - 1; }
1962 class LCallRuntime V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1964 explicit LCallRuntime(LOperand* context) {
1965 inputs_[0] = context;
1968 LOperand* context() { return inputs_[0]; }
1970 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1971 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1973 virtual bool ClobbersDoubleRegisters(Isolate* isolate) const V8_OVERRIDE {
1974 return save_doubles() == kDontSaveFPRegs;
1977 const Runtime::Function* function() const { return hydrogen()->function(); }
1978 int arity() const { return hydrogen()->argument_count(); }
1979 SaveFPRegsMode save_doubles() const { return hydrogen()->save_doubles(); }
1983 class LInteger32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1985 explicit LInteger32ToDouble(LOperand* value) {
1989 LOperand* value() { return inputs_[0]; }
1991 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1995 class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1997 explicit LUint32ToDouble(LOperand* value) {
2001 LOperand* value() { return inputs_[0]; }
2003 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
2007 class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
2009 LNumberTagI(LOperand* value, LOperand* temp1, LOperand* temp2) {
2015 LOperand* value() { return inputs_[0]; }
2016 LOperand* temp1() { return temps_[0]; }
2017 LOperand* temp2() { return temps_[1]; }
2019 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
2023 class LNumberTagU V8_FINAL : public LTemplateInstruction<1, 1, 2> {
2025 LNumberTagU(LOperand* value, LOperand* temp1, LOperand* temp2) {
2031 LOperand* value() { return inputs_[0]; }
2032 LOperand* temp1() { return temps_[0]; }
2033 LOperand* temp2() { return temps_[1]; }
2035 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
2039 class LNumberTagD V8_FINAL : public LTemplateInstruction<1, 1, 2> {
2041 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
2047 LOperand* value() { return inputs_[0]; }
2048 LOperand* temp() { return temps_[0]; }
2049 LOperand* temp2() { return temps_[1]; }
2051 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
2052 DECLARE_HYDROGEN_ACCESSOR(Change)
2056 class LDoubleToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2058 explicit LDoubleToSmi(LOperand* value) {
2062 LOperand* value() { return inputs_[0]; }
2064 DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi")
2065 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2067 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2071 // Sometimes truncating conversion from a tagged value to an int32.
2072 class LDoubleToI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2074 explicit LDoubleToI(LOperand* value) {
2078 LOperand* value() { return inputs_[0]; }
2080 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
2081 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2083 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2087 // Truncating conversion from a tagged value to an int32.
2088 class LTaggedToI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
2090 LTaggedToI(LOperand* value,
2098 LOperand* value() { return inputs_[0]; }
2099 LOperand* temp() { return temps_[0]; }
2100 LOperand* temp2() { return temps_[1]; }
2102 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
2103 DECLARE_HYDROGEN_ACCESSOR(Change)
2105 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2109 class LSmiTag V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2111 explicit LSmiTag(LOperand* value) {
2115 LOperand* value() { return inputs_[0]; }
2117 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2118 DECLARE_HYDROGEN_ACCESSOR(Change)
2122 class LNumberUntagD V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2124 explicit LNumberUntagD(LOperand* value) {
2128 LOperand* value() { return inputs_[0]; }
2130 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2131 DECLARE_HYDROGEN_ACCESSOR(Change)
2135 class LSmiUntag V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2137 LSmiUntag(LOperand* value, bool needs_check)
2138 : needs_check_(needs_check) {
2142 LOperand* value() { return inputs_[0]; }
2143 bool needs_check() const { return needs_check_; }
2145 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2152 class LStoreNamedField V8_FINAL : public LTemplateInstruction<0, 2, 1> {
2154 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2155 inputs_[0] = object;
2160 LOperand* object() { return inputs_[0]; }
2161 LOperand* value() { return inputs_[1]; }
2162 LOperand* temp() { return temps_[0]; }
2164 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2165 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2167 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2169 Representation representation() const {
2170 return hydrogen()->field_representation();
2175 class LStoreNamedGeneric V8_FINAL : public LTemplateInstruction<0, 3, 0> {
2177 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value) {
2178 inputs_[0] = context;
2179 inputs_[1] = object;
2183 LOperand* context() { return inputs_[0]; }
2184 LOperand* object() { return inputs_[1]; }
2185 LOperand* value() { return inputs_[2]; }
2187 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2188 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2190 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2192 Handle<Object> name() const { return hydrogen()->name(); }
2193 StrictMode strict_mode() { return hydrogen()->strict_mode(); }
2197 class LStoreKeyed V8_FINAL : public LTemplateInstruction<0, 3, 1> {
2199 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value,
2201 inputs_[0] = object;
2207 bool is_external() const { return hydrogen()->is_external(); }
2208 bool is_fixed_typed_array() const {
2209 return hydrogen()->is_fixed_typed_array();
2211 bool is_typed_elements() const {
2212 return is_external() || is_fixed_typed_array();
2214 LOperand* elements() { return inputs_[0]; }
2215 LOperand* key() { return inputs_[1]; }
2216 LOperand* value() { return inputs_[2]; }
2217 LOperand* temp() { return temps_[0]; }
2218 ElementsKind elements_kind() const {
2219 return hydrogen()->elements_kind();
2222 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2223 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
2225 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2226 bool NeedsCanonicalization() {
2227 if (hydrogen()->value()->IsAdd() || hydrogen()->value()->IsSub() ||
2228 hydrogen()->value()->IsMul() || hydrogen()->value()->IsDiv()) {
2231 return hydrogen()->NeedsCanonicalization();
2233 uint32_t additional_index() const { return hydrogen()->index_offset(); }
2237 class LStoreKeyedGeneric V8_FINAL : public LTemplateInstruction<0, 4, 0> {
2239 LStoreKeyedGeneric(LOperand* context,
2243 inputs_[0] = context;
2249 LOperand* context() { return inputs_[0]; }
2250 LOperand* object() { return inputs_[1]; }
2251 LOperand* key() { return inputs_[2]; }
2252 LOperand* value() { return inputs_[3]; }
2254 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2255 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2257 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2259 StrictMode strict_mode() { return hydrogen()->strict_mode(); }
2263 class LTransitionElementsKind V8_FINAL : public LTemplateInstruction<0, 2, 1> {
2265 LTransitionElementsKind(LOperand* object,
2267 LOperand* new_map_temp) {
2268 inputs_[0] = object;
2269 inputs_[1] = context;
2270 temps_[0] = new_map_temp;
2273 LOperand* context() { return inputs_[1]; }
2274 LOperand* object() { return inputs_[0]; }
2275 LOperand* new_map_temp() { return temps_[0]; }
2277 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2278 "transition-elements-kind")
2279 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2281 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2283 Handle<Map> original_map() { return hydrogen()->original_map().handle(); }
2284 Handle<Map> transitioned_map() {
2285 return hydrogen()->transitioned_map().handle();
2287 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2288 ElementsKind to_kind() { return hydrogen()->to_kind(); }
2292 class LTrapAllocationMemento V8_FINAL : public LTemplateInstruction<0, 1, 1> {
2294 LTrapAllocationMemento(LOperand* object,
2296 inputs_[0] = object;
2300 LOperand* object() { return inputs_[0]; }
2301 LOperand* temp() { return temps_[0]; }
2303 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2304 "trap-allocation-memento")
2308 class LStringAdd V8_FINAL : public LTemplateInstruction<1, 3, 0> {
2310 LStringAdd(LOperand* context, LOperand* left, LOperand* right) {
2311 inputs_[0] = context;
2316 LOperand* context() { return inputs_[0]; }
2317 LOperand* left() { return inputs_[1]; }
2318 LOperand* right() { return inputs_[2]; }
2320 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2321 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
2326 class LStringCharCodeAt V8_FINAL : public LTemplateInstruction<1, 3, 0> {
2328 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) {
2329 inputs_[0] = context;
2330 inputs_[1] = string;
2334 LOperand* context() { return inputs_[0]; }
2335 LOperand* string() { return inputs_[1]; }
2336 LOperand* index() { return inputs_[2]; }
2338 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2339 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
2343 class LStringCharFromCode V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2345 explicit LStringCharFromCode(LOperand* context, LOperand* char_code) {
2346 inputs_[0] = context;
2347 inputs_[1] = char_code;
2350 LOperand* context() { return inputs_[0]; }
2351 LOperand* char_code() { return inputs_[1]; }
2353 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2354 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
2358 class LCheckValue V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2360 explicit LCheckValue(LOperand* value) {
2364 LOperand* value() { return inputs_[0]; }
2366 DECLARE_CONCRETE_INSTRUCTION(CheckValue, "check-value")
2367 DECLARE_HYDROGEN_ACCESSOR(CheckValue)
2371 class LCheckInstanceType V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2373 explicit LCheckInstanceType(LOperand* value) {
2377 LOperand* value() { return inputs_[0]; }
2379 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2380 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2384 class LCheckMaps V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2386 explicit LCheckMaps(LOperand* value = NULL) {
2390 LOperand* value() { return inputs_[0]; }
2392 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2393 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
2397 class LCheckSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2399 explicit LCheckSmi(LOperand* value) {
2403 LOperand* value() { return inputs_[0]; }
2405 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2409 class LCheckNonSmi V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2411 explicit LCheckNonSmi(LOperand* value) {
2415 LOperand* value() { return inputs_[0]; }
2417 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2418 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject)
2422 class LClampDToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2424 explicit LClampDToUint8(LOperand* unclamped) {
2425 inputs_[0] = unclamped;
2428 LOperand* unclamped() { return inputs_[0]; }
2430 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2434 class LClampIToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2436 explicit LClampIToUint8(LOperand* unclamped) {
2437 inputs_[0] = unclamped;
2440 LOperand* unclamped() { return inputs_[0]; }
2442 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2446 class LClampTToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 1> {
2448 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2449 inputs_[0] = unclamped;
2453 LOperand* unclamped() { return inputs_[0]; }
2454 LOperand* temp() { return temps_[0]; }
2456 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2460 class LDoubleBits V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2462 explicit LDoubleBits(LOperand* value) {
2466 LOperand* value() { return inputs_[0]; }
2468 DECLARE_CONCRETE_INSTRUCTION(DoubleBits, "double-bits")
2469 DECLARE_HYDROGEN_ACCESSOR(DoubleBits)
2473 class LConstructDouble V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2475 LConstructDouble(LOperand* hi, LOperand* lo) {
2480 LOperand* hi() { return inputs_[0]; }
2481 LOperand* lo() { return inputs_[1]; }
2483 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble, "construct-double")
2487 class LAllocate V8_FINAL : public LTemplateInstruction<1, 2, 2> {
2489 LAllocate(LOperand* context,
2493 inputs_[0] = context;
2499 LOperand* context() { return inputs_[0]; }
2500 LOperand* size() { return inputs_[1]; }
2501 LOperand* temp1() { return temps_[0]; }
2502 LOperand* temp2() { return temps_[1]; }
2504 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2505 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2509 class LRegExpLiteral V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2511 explicit LRegExpLiteral(LOperand* context) {
2512 inputs_[0] = context;
2515 LOperand* context() { return inputs_[0]; }
2517 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2518 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2522 class LFunctionLiteral V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2524 explicit LFunctionLiteral(LOperand* context) {
2525 inputs_[0] = context;
2528 LOperand* context() { return inputs_[0]; }
2530 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2531 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2535 class LToFastProperties V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2537 explicit LToFastProperties(LOperand* value) {
2541 LOperand* value() { return inputs_[0]; }
2543 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2544 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2548 class LTypeof V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2550 LTypeof(LOperand* context, LOperand* value) {
2551 inputs_[0] = context;
2555 LOperand* context() { return inputs_[0]; }
2556 LOperand* value() { return inputs_[1]; }
2558 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2562 class LTypeofIsAndBranch V8_FINAL : public LControlInstruction<1, 0> {
2564 explicit LTypeofIsAndBranch(LOperand* value) {
2568 LOperand* value() { return inputs_[0]; }
2570 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2571 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2573 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2575 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2579 class LIsConstructCallAndBranch V8_FINAL : public LControlInstruction<0, 1> {
2581 explicit LIsConstructCallAndBranch(LOperand* temp) {
2585 LOperand* temp() { return temps_[0]; }
2587 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2588 "is-construct-call-and-branch")
2592 class LOsrEntry V8_FINAL : public LTemplateInstruction<0, 0, 0> {
2596 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
2599 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2603 class LStackCheck V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2605 explicit LStackCheck(LOperand* context) {
2606 inputs_[0] = context;
2609 LOperand* context() { return inputs_[0]; }
2611 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2612 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2614 Label* done_label() { return &done_label_; }
2621 class LForInPrepareMap V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2623 LForInPrepareMap(LOperand* context, LOperand* object) {
2624 inputs_[0] = context;
2625 inputs_[1] = object;
2628 LOperand* context() { return inputs_[0]; }
2629 LOperand* object() { return inputs_[1]; }
2631 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2635 class LForInCacheArray V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2637 explicit LForInCacheArray(LOperand* map) {
2641 LOperand* map() { return inputs_[0]; }
2643 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2646 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2651 class LCheckMapValue V8_FINAL : public LTemplateInstruction<0, 2, 0> {
2653 LCheckMapValue(LOperand* value, LOperand* map) {
2658 LOperand* value() { return inputs_[0]; }
2659 LOperand* map() { return inputs_[1]; }
2661 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2665 class LLoadFieldByIndex V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2667 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2668 inputs_[0] = object;
2672 LOperand* object() { return inputs_[0]; }
2673 LOperand* index() { return inputs_[1]; }
2675 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2679 class LChunkBuilder;
2680 class LPlatformChunk V8_FINAL : public LChunk {
2682 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2683 : LChunk(info, graph) { }
2685 int GetNextSpillIndex(RegisterKind kind);
2686 LOperand* GetNextSpillSlot(RegisterKind kind);
2690 class LChunkBuilder V8_FINAL : public LChunkBuilderBase {
2692 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2693 : LChunkBuilderBase(graph->zone()),
2698 current_instruction_(NULL),
2699 current_block_(NULL),
2701 allocator_(allocator) { }
2703 Isolate* isolate() const { return graph_->isolate(); }
2705 // Build the sequence for the graph.
2706 LPlatformChunk* Build();
2708 LInstruction* CheckElideControlInstruction(HControlInstruction* instr);
2710 // Declare methods that deal with the individual node types.
2711 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2712 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2715 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2716 LInstruction* DoMultiplySub(HValue* minuend, HMul* mul);
2717 LInstruction* DoRSub(HSub* instr);
2719 static bool HasMagicNumberForDivisor(int32_t divisor);
2721 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2722 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2723 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2724 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2725 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2726 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2727 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2728 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2729 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2730 LInstruction* DoDivByConstI(HDiv* instr);
2731 LInstruction* DoDivI(HDiv* instr);
2732 LInstruction* DoModByPowerOf2I(HMod* instr);
2733 LInstruction* DoModByConstI(HMod* instr);
2734 LInstruction* DoModI(HMod* instr);
2735 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2736 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2737 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr);
2747 LPlatformChunk* chunk() const { return chunk_; }
2748 CompilationInfo* info() const { return info_; }
2749 HGraph* graph() const { return graph_; }
2751 bool is_unused() const { return status_ == UNUSED; }
2752 bool is_building() const { return status_ == BUILDING; }
2753 bool is_done() const { return status_ == DONE; }
2754 bool is_aborted() const { return status_ == ABORTED; }
2756 void Abort(BailoutReason reason);
2758 // Methods for getting operands for Use / Define / Temp.
2759 LUnallocated* ToUnallocated(Register reg);
2760 LUnallocated* ToUnallocated(DoubleRegister reg);
2762 // Methods for setting up define-use relationships.
2763 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2764 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2765 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2766 DoubleRegister fixed_register);
2768 // A value that is guaranteed to be allocated to a register.
2769 // Operand created by UseRegister is guaranteed to be live until the end of
2770 // instruction. This means that register allocator will not reuse it's
2771 // register for any other operand inside instruction.
2772 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2773 // instruction start. Register allocator is free to assign the same register
2774 // to some other operand used inside instruction (i.e. temporary or
2776 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2777 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2779 // An input operand in a register that may be trashed.
2780 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2782 // An input operand in a register or stack slot.
2783 MUST_USE_RESULT LOperand* Use(HValue* value);
2784 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2786 // An input operand in a register, stack slot or a constant operand.
2787 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2788 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2790 // An input operand in a register or a constant operand.
2791 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2792 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2794 // An input operand in a constant operand.
2795 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2797 // An input operand in register, stack slot or a constant operand.
2798 // Will not be moved to a register even if one is freely available.
2799 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE;
2801 // Temporary operand that must be in a register.
2802 MUST_USE_RESULT LUnallocated* TempRegister();
2803 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2804 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2806 // Methods for setting up define-use relationships.
2807 // Return the same instruction that they are passed.
2808 LInstruction* Define(LTemplateResultInstruction<1>* instr,
2809 LUnallocated* result);
2810 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr);
2811 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr,
2813 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr);
2814 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr,
2816 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr,
2817 DoubleRegister reg);
2818 LInstruction* AssignEnvironment(LInstruction* instr);
2819 LInstruction* AssignPointerMap(LInstruction* instr);
2821 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2823 // By default we assume that instruction sequences generated for calls
2824 // cannot deoptimize eagerly and we do not attach environment to this
2826 LInstruction* MarkAsCall(
2827 LInstruction* instr,
2828 HInstruction* hinstr,
2829 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2831 void VisitInstruction(HInstruction* current);
2833 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2834 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2835 LInstruction* DoArithmeticD(Token::Value op,
2836 HArithmeticBinaryOperation* instr);
2837 LInstruction* DoArithmeticT(Token::Value op,
2838 HBinaryOperation* instr);
2840 LPlatformChunk* chunk_;
2841 CompilationInfo* info_;
2842 HGraph* const graph_;
2844 HInstruction* current_instruction_;
2845 HBasicBlock* current_block_;
2846 HBasicBlock* next_block_;
2847 LAllocator* allocator_;
2849 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2852 #undef DECLARE_HYDROGEN_ACCESSOR
2853 #undef DECLARE_CONCRETE_INSTRUCTION
2855 } } // namespace v8::internal
2857 #endif // V8_ARM_LITHIUM_ARM_H_