1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef V8_ARM_LITHIUM_ARM_H_
29 #define V8_ARM_LITHIUM_ARM_H_
32 #include "lithium-allocator.h"
34 #include "safepoint-table.h"
40 // Forward declarations.
43 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
44 V(AccessArgumentsAt) \
48 V(ArgumentsElements) \
56 V(CallWithDescriptor) \
62 V(CheckInstanceType) \
71 V(ClassOfTestAndBranch) \
72 V(CompareMinusZeroAndBranch) \
73 V(CompareNumericAndBranch) \
74 V(CmpObjectEqAndBranch) \
97 V(GetCachedArrayIndex) \
99 V(HasCachedArrayIndexAndBranch) \
100 V(HasInstanceTypeAndBranch) \
101 V(InnerAllocatedObject) \
103 V(InstanceOfKnownGlobal) \
105 V(Integer32ToDouble) \
108 V(IsConstructCallAndBranch) \
109 V(IsObjectAndBranch) \
110 V(IsStringAndBranch) \
112 V(IsUndetectableAndBranch) \
117 V(LoadFieldByIndex) \
118 V(LoadFunctionPrototype) \
120 V(LoadGlobalGeneric) \
122 V(LoadKeyedGeneric) \
124 V(LoadNamedGeneric) \
149 V(SeqStringGetChar) \
150 V(SeqStringSetChar) \
156 V(StoreContextSlot) \
159 V(StoreKeyedGeneric) \
161 V(StoreNamedGeneric) \
163 V(StringCharCodeAt) \
164 V(StringCharFromCode) \
165 V(StringCompareAndBranch) \
170 V(ToFastProperties) \
171 V(TransitionElementsKind) \
172 V(TrapAllocationMemento) \
174 V(TypeofIsAndBranch) \
181 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
182 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \
183 return LInstruction::k##type; \
185 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \
186 virtual const char* Mnemonic() const V8_FINAL V8_OVERRIDE { \
189 static L##type* cast(LInstruction* instr) { \
190 ASSERT(instr->Is##type()); \
191 return reinterpret_cast<L##type*>(instr); \
195 #define DECLARE_HYDROGEN_ACCESSOR(type) \
196 H##type* hydrogen() const { \
197 return H##type::cast(hydrogen_value()); \
201 class LInstruction : public ZoneObject {
204 : environment_(NULL),
205 hydrogen_value_(NULL),
206 bit_field_(IsCallBits::encode(false)) {
209 virtual ~LInstruction() {}
211 virtual void CompileToNative(LCodeGen* generator) = 0;
212 virtual const char* Mnemonic() const = 0;
213 virtual void PrintTo(StringStream* stream);
214 virtual void PrintDataTo(StringStream* stream);
215 virtual void PrintOutputOperandTo(StringStream* stream);
218 // Declare a unique enum value for each instruction.
219 #define DECLARE_OPCODE(type) k##type,
220 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
221 kNumberOfInstructions
222 #undef DECLARE_OPCODE
225 virtual Opcode opcode() const = 0;
227 // Declare non-virtual type testers for all leaf IR classes.
228 #define DECLARE_PREDICATE(type) \
229 bool Is##type() const { return opcode() == k##type; }
230 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
231 #undef DECLARE_PREDICATE
233 // Declare virtual predicates for instructions that don't have
235 virtual bool IsGap() const { return false; }
237 virtual bool IsControl() const { return false; }
239 void set_environment(LEnvironment* env) { environment_ = env; }
240 LEnvironment* environment() const { return environment_; }
241 bool HasEnvironment() const { return environment_ != NULL; }
243 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
244 LPointerMap* pointer_map() const { return pointer_map_.get(); }
245 bool HasPointerMap() const { return pointer_map_.is_set(); }
247 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
248 HValue* hydrogen_value() const { return hydrogen_value_; }
250 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
252 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); }
253 bool IsCall() const { return IsCallBits::decode(bit_field_); }
255 // Interface to the register allocator and iterators.
256 bool ClobbersTemps() const { return IsCall(); }
257 bool ClobbersRegisters() const { return IsCall(); }
258 virtual bool ClobbersDoubleRegisters() const { return IsCall(); }
260 // Interface to the register allocator and iterators.
261 bool IsMarkedAsCall() const { return IsCall(); }
263 virtual bool HasResult() const = 0;
264 virtual LOperand* result() const = 0;
266 LOperand* FirstInput() { return InputAt(0); }
267 LOperand* Output() { return HasResult() ? result() : NULL; }
269 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
277 friend class InputIterator;
278 virtual int InputCount() = 0;
279 virtual LOperand* InputAt(int i) = 0;
281 friend class TempIterator;
282 virtual int TempCount() = 0;
283 virtual LOperand* TempAt(int i) = 0;
285 class IsCallBits: public BitField<bool, 0, 1> {};
287 LEnvironment* environment_;
288 SetOncePointer<LPointerMap> pointer_map_;
289 HValue* hydrogen_value_;
294 // R = number of result operands (0 or 1).
296 class LTemplateResultInstruction : public LInstruction {
298 // Allow 0 or 1 output operands.
299 STATIC_ASSERT(R == 0 || R == 1);
300 virtual bool HasResult() const V8_FINAL V8_OVERRIDE {
301 return R != 0 && result() != NULL;
303 void set_result(LOperand* operand) { results_[0] = operand; }
304 LOperand* result() const { return results_[0]; }
307 EmbeddedContainer<LOperand*, R> results_;
311 // R = number of result operands (0 or 1).
312 // I = number of input operands.
313 // T = number of temporary operands.
314 template<int R, int I, int T>
315 class LTemplateInstruction : public LTemplateResultInstruction<R> {
317 EmbeddedContainer<LOperand*, I> inputs_;
318 EmbeddedContainer<LOperand*, T> temps_;
322 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; }
323 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
325 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; }
326 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; }
330 class LGap : public LTemplateInstruction<0, 0, 0> {
332 explicit LGap(HBasicBlock* block)
334 parallel_moves_[BEFORE] = NULL;
335 parallel_moves_[START] = NULL;
336 parallel_moves_[END] = NULL;
337 parallel_moves_[AFTER] = NULL;
340 // Can't use the DECLARE-macro here because of sub-classes.
341 virtual bool IsGap() const V8_OVERRIDE { return true; }
342 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
343 static LGap* cast(LInstruction* instr) {
344 ASSERT(instr->IsGap());
345 return reinterpret_cast<LGap*>(instr);
348 bool IsRedundant() const;
350 HBasicBlock* block() const { return block_; }
357 FIRST_INNER_POSITION = BEFORE,
358 LAST_INNER_POSITION = AFTER
361 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
362 if (parallel_moves_[pos] == NULL) {
363 parallel_moves_[pos] = new(zone) LParallelMove(zone);
365 return parallel_moves_[pos];
368 LParallelMove* GetParallelMove(InnerPosition pos) {
369 return parallel_moves_[pos];
373 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
378 class LInstructionGap V8_FINAL : public LGap {
380 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
382 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
383 return !IsRedundant();
386 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
390 class LGoto V8_FINAL : public LTemplateInstruction<0, 0, 0> {
392 explicit LGoto(HBasicBlock* block) : block_(block) { }
394 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE;
395 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
396 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
397 virtual bool IsControl() const V8_OVERRIDE { return true; }
399 int block_id() const { return block_->block_id(); }
406 class LLazyBailout V8_FINAL : public LTemplateInstruction<0, 0, 0> {
408 LLazyBailout() : gap_instructions_size_(0) { }
410 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
412 void set_gap_instructions_size(int gap_instructions_size) {
413 gap_instructions_size_ = gap_instructions_size;
415 int gap_instructions_size() { return gap_instructions_size_; }
418 int gap_instructions_size_;
422 class LDummy V8_FINAL : public LTemplateInstruction<1, 0, 0> {
424 explicit LDummy() { }
425 DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
429 class LDummyUse V8_FINAL : public LTemplateInstruction<1, 1, 0> {
431 explicit LDummyUse(LOperand* value) {
434 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
438 class LDeoptimize V8_FINAL : public LTemplateInstruction<0, 0, 0> {
440 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
441 DECLARE_HYDROGEN_ACCESSOR(Deoptimize)
445 class LLabel V8_FINAL : public LGap {
447 explicit LLabel(HBasicBlock* block)
448 : LGap(block), replacement_(NULL) { }
450 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
453 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
455 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
457 int block_id() const { return block()->block_id(); }
458 bool is_loop_header() const { return block()->IsLoopHeader(); }
459 bool is_osr_entry() const { return block()->is_osr_entry(); }
460 Label* label() { return &label_; }
461 LLabel* replacement() const { return replacement_; }
462 void set_replacement(LLabel* label) { replacement_ = label; }
463 bool HasReplacement() const { return replacement_ != NULL; }
467 LLabel* replacement_;
471 class LParameter V8_FINAL : public LTemplateInstruction<1, 0, 0> {
473 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
474 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
478 class LCallStub V8_FINAL : public LTemplateInstruction<1, 1, 0> {
480 explicit LCallStub(LOperand* context) {
481 inputs_[0] = context;
484 LOperand* context() { return inputs_[0]; }
486 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
487 DECLARE_HYDROGEN_ACCESSOR(CallStub)
491 class LUnknownOSRValue V8_FINAL : public LTemplateInstruction<1, 0, 0> {
493 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
496 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
500 template<int I, int T>
501 class LControlInstruction : public LTemplateInstruction<0, I, T> {
503 LControlInstruction() : false_label_(NULL), true_label_(NULL) { }
505 virtual bool IsControl() const V8_FINAL V8_OVERRIDE { return true; }
507 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
508 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
510 int TrueDestination(LChunk* chunk) {
511 return chunk->LookupDestination(true_block_id());
513 int FalseDestination(LChunk* chunk) {
514 return chunk->LookupDestination(false_block_id());
517 Label* TrueLabel(LChunk* chunk) {
518 if (true_label_ == NULL) {
519 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk));
523 Label* FalseLabel(LChunk* chunk) {
524 if (false_label_ == NULL) {
525 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk));
531 int true_block_id() { return SuccessorAt(0)->block_id(); }
532 int false_block_id() { return SuccessorAt(1)->block_id(); }
535 HControlInstruction* hydrogen() {
536 return HControlInstruction::cast(this->hydrogen_value());
544 class LWrapReceiver V8_FINAL : public LTemplateInstruction<1, 2, 0> {
546 LWrapReceiver(LOperand* receiver, LOperand* function) {
547 inputs_[0] = receiver;
548 inputs_[1] = function;
551 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
552 DECLARE_HYDROGEN_ACCESSOR(WrapReceiver)
554 LOperand* receiver() { return inputs_[0]; }
555 LOperand* function() { return inputs_[1]; }
559 class LApplyArguments V8_FINAL : public LTemplateInstruction<1, 4, 0> {
561 LApplyArguments(LOperand* function,
564 LOperand* elements) {
565 inputs_[0] = function;
566 inputs_[1] = receiver;
568 inputs_[3] = elements;
571 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
573 LOperand* function() { return inputs_[0]; }
574 LOperand* receiver() { return inputs_[1]; }
575 LOperand* length() { return inputs_[2]; }
576 LOperand* elements() { return inputs_[3]; }
580 class LAccessArgumentsAt V8_FINAL : public LTemplateInstruction<1, 3, 0> {
582 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
583 inputs_[0] = arguments;
588 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
590 LOperand* arguments() { return inputs_[0]; }
591 LOperand* length() { return inputs_[1]; }
592 LOperand* index() { return inputs_[2]; }
594 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
598 class LArgumentsLength V8_FINAL : public LTemplateInstruction<1, 1, 0> {
600 explicit LArgumentsLength(LOperand* elements) {
601 inputs_[0] = elements;
604 LOperand* elements() { return inputs_[0]; }
606 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
610 class LArgumentsElements V8_FINAL : public LTemplateInstruction<1, 0, 0> {
612 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
613 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
617 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 2> {
619 LModI(LOperand* left,
621 LOperand* temp = NULL,
622 LOperand* temp2 = NULL) {
629 LOperand* left() { return inputs_[0]; }
630 LOperand* right() { return inputs_[1]; }
631 LOperand* temp() { return temps_[0]; }
632 LOperand* temp2() { return temps_[1]; }
634 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
635 DECLARE_HYDROGEN_ACCESSOR(Mod)
639 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
641 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
647 LOperand* left() { return inputs_[0]; }
648 LOperand* right() { return inputs_[1]; }
649 LOperand* temp() { return temps_[0]; }
651 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); }
653 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
654 DECLARE_HYDROGEN_ACCESSOR(Div)
658 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> {
660 LMathFloorOfDiv(LOperand* left,
662 LOperand* temp = NULL) {
668 LOperand* left() { return inputs_[0]; }
669 LOperand* right() { return inputs_[1]; }
670 LOperand* temp() { return temps_[0]; }
672 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div")
673 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
677 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
679 LMulI(LOperand* left, LOperand* right) {
684 LOperand* left() { return inputs_[0]; }
685 LOperand* right() { return inputs_[1]; }
687 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
688 DECLARE_HYDROGEN_ACCESSOR(Mul)
692 // Instruction for computing multiplier * multiplicand + addend.
693 class LMultiplyAddD V8_FINAL : public LTemplateInstruction<1, 3, 0> {
695 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
696 LOperand* multiplicand) {
698 inputs_[1] = multiplier;
699 inputs_[2] = multiplicand;
702 LOperand* addend() { return inputs_[0]; }
703 LOperand* multiplier() { return inputs_[1]; }
704 LOperand* multiplicand() { return inputs_[2]; }
706 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
710 // Instruction for computing minuend - multiplier * multiplicand.
711 class LMultiplySubD V8_FINAL : public LTemplateInstruction<1, 3, 0> {
713 LMultiplySubD(LOperand* minuend, LOperand* multiplier,
714 LOperand* multiplicand) {
715 inputs_[0] = minuend;
716 inputs_[1] = multiplier;
717 inputs_[2] = multiplicand;
720 LOperand* minuend() { return inputs_[0]; }
721 LOperand* multiplier() { return inputs_[1]; }
722 LOperand* multiplicand() { return inputs_[2]; }
724 DECLARE_CONCRETE_INSTRUCTION(MultiplySubD, "multiply-sub-d")
728 class LDebugBreak V8_FINAL : public LTemplateInstruction<0, 0, 0> {
730 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
734 class LCompareNumericAndBranch V8_FINAL : public LControlInstruction<2, 0> {
736 LCompareNumericAndBranch(LOperand* left, LOperand* right) {
741 LOperand* left() { return inputs_[0]; }
742 LOperand* right() { return inputs_[1]; }
744 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch,
745 "compare-numeric-and-branch")
746 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch)
748 Token::Value op() const { return hydrogen()->token(); }
749 bool is_double() const {
750 return hydrogen()->representation().IsDouble();
753 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
757 class LMathFloor V8_FINAL : public LTemplateInstruction<1, 1, 0> {
759 explicit LMathFloor(LOperand* value) {
763 LOperand* value() { return inputs_[0]; }
765 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
766 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
770 class LMathRound V8_FINAL : public LTemplateInstruction<1, 1, 1> {
772 LMathRound(LOperand* value, LOperand* temp) {
777 LOperand* value() { return inputs_[0]; }
778 LOperand* temp() { return temps_[0]; }
780 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
781 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
785 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 2, 0> {
787 LMathAbs(LOperand* context, LOperand* value) {
788 inputs_[1] = context;
792 LOperand* context() { return inputs_[1]; }
793 LOperand* value() { return inputs_[0]; }
795 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
796 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
800 class LMathLog V8_FINAL : public LTemplateInstruction<1, 1, 0> {
802 explicit LMathLog(LOperand* value) {
806 LOperand* value() { return inputs_[0]; }
808 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
812 class LMathExp V8_FINAL : public LTemplateInstruction<1, 1, 3> {
814 LMathExp(LOperand* value,
815 LOperand* double_temp,
821 temps_[2] = double_temp;
822 ExternalReference::InitializeMathExpData();
825 LOperand* value() { return inputs_[0]; }
826 LOperand* temp1() { return temps_[0]; }
827 LOperand* temp2() { return temps_[1]; }
828 LOperand* double_temp() { return temps_[2]; }
830 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
834 class LMathSqrt V8_FINAL : public LTemplateInstruction<1, 1, 0> {
836 explicit LMathSqrt(LOperand* value) {
840 LOperand* value() { return inputs_[0]; }
842 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
846 class LMathPowHalf V8_FINAL : public LTemplateInstruction<1, 1, 0> {
848 explicit LMathPowHalf(LOperand* value) {
852 LOperand* value() { return inputs_[0]; }
854 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
858 class LCmpObjectEqAndBranch V8_FINAL : public LControlInstruction<2, 0> {
860 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
865 LOperand* left() { return inputs_[0]; }
866 LOperand* right() { return inputs_[1]; }
868 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch")
869 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
873 class LCmpHoleAndBranch V8_FINAL : public LControlInstruction<1, 0> {
875 explicit LCmpHoleAndBranch(LOperand* object) {
879 LOperand* object() { return inputs_[0]; }
881 DECLARE_CONCRETE_INSTRUCTION(CmpHoleAndBranch, "cmp-hole-and-branch")
882 DECLARE_HYDROGEN_ACCESSOR(CompareHoleAndBranch)
886 class LCompareMinusZeroAndBranch V8_FINAL : public LControlInstruction<1, 1> {
888 LCompareMinusZeroAndBranch(LOperand* value, LOperand* temp) {
893 LOperand* value() { return inputs_[0]; }
894 LOperand* temp() { return temps_[0]; }
896 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch,
897 "cmp-minus-zero-and-branch")
898 DECLARE_HYDROGEN_ACCESSOR(CompareMinusZeroAndBranch)
902 class LIsObjectAndBranch V8_FINAL : public LControlInstruction<1, 1> {
904 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
909 LOperand* value() { return inputs_[0]; }
910 LOperand* temp() { return temps_[0]; }
912 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
913 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
915 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
919 class LIsStringAndBranch V8_FINAL : public LControlInstruction<1, 1> {
921 LIsStringAndBranch(LOperand* value, LOperand* temp) {
926 LOperand* value() { return inputs_[0]; }
927 LOperand* temp() { return temps_[0]; }
929 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
930 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
932 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
936 class LIsSmiAndBranch V8_FINAL : public LControlInstruction<1, 0> {
938 explicit LIsSmiAndBranch(LOperand* value) {
942 LOperand* value() { return inputs_[0]; }
944 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
945 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
947 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
951 class LIsUndetectableAndBranch V8_FINAL : public LControlInstruction<1, 1> {
953 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
958 LOperand* value() { return inputs_[0]; }
959 LOperand* temp() { return temps_[0]; }
961 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
962 "is-undetectable-and-branch")
963 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
965 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
969 class LStringCompareAndBranch V8_FINAL : public LControlInstruction<3, 0> {
971 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) {
972 inputs_[0] = context;
977 LOperand* context() { return inputs_[0]; }
978 LOperand* left() { return inputs_[1]; }
979 LOperand* right() { return inputs_[2]; }
981 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
982 "string-compare-and-branch")
983 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
985 Token::Value op() const { return hydrogen()->token(); }
987 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
991 class LHasInstanceTypeAndBranch V8_FINAL : public LControlInstruction<1, 0> {
993 explicit LHasInstanceTypeAndBranch(LOperand* value) {
997 LOperand* value() { return inputs_[0]; }
999 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
1000 "has-instance-type-and-branch")
1001 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
1003 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1007 class LGetCachedArrayIndex V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1009 explicit LGetCachedArrayIndex(LOperand* value) {
1013 LOperand* value() { return inputs_[0]; }
1015 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
1016 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
1020 class LHasCachedArrayIndexAndBranch V8_FINAL
1021 : public LControlInstruction<1, 0> {
1023 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
1027 LOperand* value() { return inputs_[0]; }
1029 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
1030 "has-cached-array-index-and-branch")
1031 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
1033 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1037 class LClassOfTestAndBranch V8_FINAL : public LControlInstruction<1, 1> {
1039 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
1044 LOperand* value() { return inputs_[0]; }
1045 LOperand* temp() { return temps_[0]; }
1047 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1048 "class-of-test-and-branch")
1049 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1051 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1055 class LCmpT V8_FINAL : public LTemplateInstruction<1, 3, 0> {
1057 LCmpT(LOperand* context, LOperand* left, LOperand* right) {
1058 inputs_[0] = context;
1063 LOperand* context() { return inputs_[0]; }
1064 LOperand* left() { return inputs_[1]; }
1065 LOperand* right() { return inputs_[2]; }
1067 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1068 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1070 Token::Value op() const { return hydrogen()->token(); }
1074 class LInstanceOf V8_FINAL : public LTemplateInstruction<1, 3, 0> {
1076 LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
1077 inputs_[0] = context;
1082 LOperand* context() { return inputs_[0]; }
1083 LOperand* left() { return inputs_[1]; }
1084 LOperand* right() { return inputs_[2]; }
1086 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1090 class LInstanceOfKnownGlobal V8_FINAL : public LTemplateInstruction<1, 2, 1> {
1092 LInstanceOfKnownGlobal(LOperand* context, LOperand* value, LOperand* temp) {
1093 inputs_[0] = context;
1098 LOperand* context() { return inputs_[0]; }
1099 LOperand* value() { return inputs_[1]; }
1100 LOperand* temp() { return temps_[0]; }
1102 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1103 "instance-of-known-global")
1104 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1106 Handle<JSFunction> function() const { return hydrogen()->function(); }
1107 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
1108 return lazy_deopt_env_;
1110 virtual void SetDeferredLazyDeoptimizationEnvironment(
1111 LEnvironment* env) V8_OVERRIDE {
1112 lazy_deopt_env_ = env;
1116 LEnvironment* lazy_deopt_env_;
1120 class LBoundsCheck V8_FINAL : public LTemplateInstruction<0, 2, 0> {
1122 LBoundsCheck(LOperand* index, LOperand* length) {
1124 inputs_[1] = length;
1127 LOperand* index() { return inputs_[0]; }
1128 LOperand* length() { return inputs_[1]; }
1130 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
1131 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
1135 class LBitI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1137 LBitI(LOperand* left, LOperand* right) {
1142 LOperand* left() { return inputs_[0]; }
1143 LOperand* right() { return inputs_[1]; }
1145 Token::Value op() const { return hydrogen()->op(); }
1147 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1148 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1152 class LShiftI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1154 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1155 : op_(op), can_deopt_(can_deopt) {
1160 Token::Value op() const { return op_; }
1161 LOperand* left() { return inputs_[0]; }
1162 LOperand* right() { return inputs_[1]; }
1163 bool can_deopt() const { return can_deopt_; }
1165 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1173 class LSubI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1175 LSubI(LOperand* left, LOperand* right) {
1180 LOperand* left() { return inputs_[0]; }
1181 LOperand* right() { return inputs_[1]; }
1183 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1184 DECLARE_HYDROGEN_ACCESSOR(Sub)
1188 class LRSubI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1190 LRSubI(LOperand* left, LOperand* right) {
1195 LOperand* left() { return inputs_[0]; }
1196 LOperand* right() { return inputs_[1]; }
1198 DECLARE_CONCRETE_INSTRUCTION(RSubI, "rsub-i")
1199 DECLARE_HYDROGEN_ACCESSOR(Sub)
1203 class LConstantI V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1205 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1206 DECLARE_HYDROGEN_ACCESSOR(Constant)
1208 int32_t value() const { return hydrogen()->Integer32Value(); }
1212 class LConstantS V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1214 DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s")
1215 DECLARE_HYDROGEN_ACCESSOR(Constant)
1217 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); }
1221 class LConstantD V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1223 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1224 DECLARE_HYDROGEN_ACCESSOR(Constant)
1226 double value() const { return hydrogen()->DoubleValue(); }
1230 class LConstantE V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1232 DECLARE_CONCRETE_INSTRUCTION(ConstantE, "constant-e")
1233 DECLARE_HYDROGEN_ACCESSOR(Constant)
1235 ExternalReference value() const {
1236 return hydrogen()->ExternalReferenceValue();
1241 class LConstantT V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1243 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1244 DECLARE_HYDROGEN_ACCESSOR(Constant)
1246 Handle<Object> value(Isolate* isolate) const {
1247 return hydrogen()->handle(isolate);
1252 class LBranch V8_FINAL : public LControlInstruction<1, 0> {
1254 explicit LBranch(LOperand* value) {
1258 LOperand* value() { return inputs_[0]; }
1260 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1261 DECLARE_HYDROGEN_ACCESSOR(Branch)
1263 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1267 class LCmpMapAndBranch V8_FINAL : public LControlInstruction<1, 1> {
1269 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1274 LOperand* value() { return inputs_[0]; }
1275 LOperand* temp() { return temps_[0]; }
1277 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1278 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1280 Handle<Map> map() const { return hydrogen()->map().handle(); }
1284 class LMapEnumLength V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1286 explicit LMapEnumLength(LOperand* value) {
1290 LOperand* value() { return inputs_[0]; }
1292 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1296 class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 1> {
1298 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1303 LOperand* date() { return inputs_[0]; }
1304 LOperand* temp() { return temps_[0]; }
1305 Smi* index() const { return index_; }
1307 DECLARE_CONCRETE_INSTRUCTION(DateField, "date-field")
1308 DECLARE_HYDROGEN_ACCESSOR(DateField)
1315 class LSeqStringGetChar V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1317 LSeqStringGetChar(LOperand* string, LOperand* index) {
1318 inputs_[0] = string;
1322 LOperand* string() const { return inputs_[0]; }
1323 LOperand* index() const { return inputs_[1]; }
1325 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar, "seq-string-get-char")
1326 DECLARE_HYDROGEN_ACCESSOR(SeqStringGetChar)
1330 class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 4, 0> {
1332 LSeqStringSetChar(LOperand* context,
1336 inputs_[0] = context;
1337 inputs_[1] = string;
1342 LOperand* string() { return inputs_[1]; }
1343 LOperand* index() { return inputs_[2]; }
1344 LOperand* value() { return inputs_[3]; }
1346 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1347 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1351 class LAddI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1353 LAddI(LOperand* left, LOperand* right) {
1358 LOperand* left() { return inputs_[0]; }
1359 LOperand* right() { return inputs_[1]; }
1361 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1362 DECLARE_HYDROGEN_ACCESSOR(Add)
1366 class LMathMinMax V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1368 LMathMinMax(LOperand* left, LOperand* right) {
1373 LOperand* left() { return inputs_[0]; }
1374 LOperand* right() { return inputs_[1]; }
1376 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
1377 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1381 class LPower V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1383 LPower(LOperand* left, LOperand* right) {
1388 LOperand* left() { return inputs_[0]; }
1389 LOperand* right() { return inputs_[1]; }
1391 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1392 DECLARE_HYDROGEN_ACCESSOR(Power)
1396 class LArithmeticD V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1398 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1404 Token::Value op() const { return op_; }
1405 LOperand* left() { return inputs_[0]; }
1406 LOperand* right() { return inputs_[1]; }
1408 virtual Opcode opcode() const V8_OVERRIDE {
1409 return LInstruction::kArithmeticD;
1411 virtual void CompileToNative(LCodeGen* generator) V8_OVERRIDE;
1412 virtual const char* Mnemonic() const V8_OVERRIDE;
1419 class LArithmeticT V8_FINAL : public LTemplateInstruction<1, 3, 0> {
1421 LArithmeticT(Token::Value op,
1426 inputs_[0] = context;
1431 LOperand* context() { return inputs_[0]; }
1432 LOperand* left() { return inputs_[1]; }
1433 LOperand* right() { return inputs_[2]; }
1434 Token::Value op() const { return op_; }
1436 virtual Opcode opcode() const V8_OVERRIDE {
1437 return LInstruction::kArithmeticT;
1439 virtual void CompileToNative(LCodeGen* generator) V8_OVERRIDE;
1440 virtual const char* Mnemonic() const V8_OVERRIDE;
1447 class LReturn V8_FINAL : public LTemplateInstruction<0, 3, 0> {
1449 LReturn(LOperand* value, LOperand* context, LOperand* parameter_count) {
1451 inputs_[1] = context;
1452 inputs_[2] = parameter_count;
1455 LOperand* value() { return inputs_[0]; }
1457 bool has_constant_parameter_count() {
1458 return parameter_count()->IsConstantOperand();
1460 LConstantOperand* constant_parameter_count() {
1461 ASSERT(has_constant_parameter_count());
1462 return LConstantOperand::cast(parameter_count());
1464 LOperand* parameter_count() { return inputs_[2]; }
1466 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1470 class LLoadNamedField V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1472 explicit LLoadNamedField(LOperand* object) {
1473 inputs_[0] = object;
1476 LOperand* object() { return inputs_[0]; }
1478 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1479 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1483 class LLoadNamedGeneric V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1485 LLoadNamedGeneric(LOperand* context, LOperand* object) {
1486 inputs_[0] = context;
1487 inputs_[1] = object;
1490 LOperand* context() { return inputs_[0]; }
1491 LOperand* object() { return inputs_[1]; }
1493 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1494 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1496 Handle<Object> name() const { return hydrogen()->name(); }
1500 class LLoadFunctionPrototype V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1502 explicit LLoadFunctionPrototype(LOperand* function) {
1503 inputs_[0] = function;
1506 LOperand* function() { return inputs_[0]; }
1508 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1509 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1513 class LLoadRoot V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1515 DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
1516 DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
1518 Heap::RootListIndex index() const { return hydrogen()->index(); }
1522 class LLoadKeyed V8_FINAL : public LTemplateInstruction<1, 2, 2> {
1524 LLoadKeyed(LOperand* elements, LOperand* key,
1525 LOperand* temp, LOperand* temp2) {
1526 inputs_[0] = elements;
1532 LOperand* elements() { return inputs_[0]; }
1533 LOperand* key() { return inputs_[1]; }
1534 LOperand* temp() { return temps_[0]; }
1535 LOperand* temp2() { return temps_[1]; }
1536 ElementsKind elements_kind() const {
1537 return hydrogen()->elements_kind();
1539 bool is_external() const {
1540 return hydrogen()->is_external();
1542 bool is_fixed_typed_array() const {
1543 return hydrogen()->is_fixed_typed_array();
1545 bool is_typed_elements() const {
1546 return is_external() || is_fixed_typed_array();
1549 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1550 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1552 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1553 uint32_t additional_index() const { return hydrogen()->index_offset(); }
1557 class LLoadKeyedGeneric V8_FINAL : public LTemplateInstruction<1, 3, 0> {
1559 LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key) {
1560 inputs_[0] = context;
1561 inputs_[1] = object;
1565 LOperand* context() { return inputs_[0]; }
1566 LOperand* object() { return inputs_[1]; }
1567 LOperand* key() { return inputs_[2]; }
1569 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1573 class LLoadGlobalCell V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1575 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1576 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1580 class LLoadGlobalGeneric V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1582 LLoadGlobalGeneric(LOperand* context, LOperand* global_object) {
1583 inputs_[0] = context;
1584 inputs_[1] = global_object;
1587 LOperand* context() { return inputs_[0]; }
1588 LOperand* global_object() { return inputs_[1]; }
1590 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1591 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1593 Handle<Object> name() const { return hydrogen()->name(); }
1594 bool for_typeof() const { return hydrogen()->for_typeof(); }
1598 class LStoreGlobalCell V8_FINAL : public LTemplateInstruction<0, 1, 1> {
1600 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1605 LOperand* value() { return inputs_[0]; }
1606 LOperand* temp() { return temps_[0]; }
1608 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1609 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1613 class LLoadContextSlot V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1615 explicit LLoadContextSlot(LOperand* context) {
1616 inputs_[0] = context;
1619 LOperand* context() { return inputs_[0]; }
1621 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1622 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1624 int slot_index() { return hydrogen()->slot_index(); }
1626 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1630 class LStoreContextSlot V8_FINAL : public LTemplateInstruction<0, 2, 0> {
1632 LStoreContextSlot(LOperand* context, LOperand* value) {
1633 inputs_[0] = context;
1637 LOperand* context() { return inputs_[0]; }
1638 LOperand* value() { return inputs_[1]; }
1640 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1641 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1643 int slot_index() { return hydrogen()->slot_index(); }
1645 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1649 class LPushArgument V8_FINAL : public LTemplateInstruction<0, 1, 0> {
1651 explicit LPushArgument(LOperand* value) {
1655 LOperand* value() { return inputs_[0]; }
1657 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1661 class LDrop V8_FINAL : public LTemplateInstruction<0, 0, 0> {
1663 explicit LDrop(int count) : count_(count) { }
1665 int count() const { return count_; }
1667 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1674 class LStoreCodeEntry V8_FINAL: public LTemplateInstruction<0, 1, 1> {
1676 LStoreCodeEntry(LOperand* function, LOperand* code_object) {
1677 inputs_[0] = function;
1678 temps_[0] = code_object;
1681 LOperand* function() { return inputs_[0]; }
1682 LOperand* code_object() { return temps_[0]; }
1684 virtual void PrintDataTo(StringStream* stream);
1686 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry, "store-code-entry")
1687 DECLARE_HYDROGEN_ACCESSOR(StoreCodeEntry)
1691 class LInnerAllocatedObject V8_FINAL: public LTemplateInstruction<1, 2, 0> {
1693 LInnerAllocatedObject(LOperand* base_object, LOperand* offset) {
1694 inputs_[0] = base_object;
1695 inputs_[1] = offset;
1698 LOperand* base_object() const { return inputs_[0]; }
1699 LOperand* offset() const { return inputs_[1]; }
1701 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1703 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "inner-allocated-object")
1707 class LThisFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1709 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1710 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1714 class LContext V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1716 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1717 DECLARE_HYDROGEN_ACCESSOR(Context)
1721 class LDeclareGlobals V8_FINAL : public LTemplateInstruction<0, 1, 0> {
1723 explicit LDeclareGlobals(LOperand* context) {
1724 inputs_[0] = context;
1727 LOperand* context() { return inputs_[0]; }
1729 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1730 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1734 class LCallJSFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1736 explicit LCallJSFunction(LOperand* function) {
1737 inputs_[0] = function;
1740 LOperand* function() { return inputs_[0]; }
1742 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function")
1743 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction)
1745 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1747 int arity() const { return hydrogen()->argument_count() - 1; }
1751 class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> {
1753 LCallWithDescriptor(const CallInterfaceDescriptor* descriptor,
1754 ZoneList<LOperand*>& operands,
1756 : descriptor_(descriptor),
1757 inputs_(descriptor->environment_length() + 1, zone) {
1758 ASSERT(descriptor->environment_length() + 1 == operands.length());
1759 inputs_.AddAll(operands, zone);
1762 LOperand* target() const { return inputs_[0]; }
1764 const CallInterfaceDescriptor* descriptor() { return descriptor_; }
1767 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1768 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1770 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1772 int arity() const { return hydrogen()->argument_count() - 1; }
1774 const CallInterfaceDescriptor* descriptor_;
1775 ZoneList<LOperand*> inputs_;
1777 // Iterator support.
1778 virtual int InputCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); }
1779 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
1781 virtual int TempCount() V8_FINAL V8_OVERRIDE { return 0; }
1782 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return NULL; }
1786 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1788 LInvokeFunction(LOperand* context, LOperand* function) {
1789 inputs_[0] = context;
1790 inputs_[1] = function;
1793 LOperand* context() { return inputs_[0]; }
1794 LOperand* function() { return inputs_[1]; }
1796 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1797 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1799 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1801 int arity() const { return hydrogen()->argument_count() - 1; }
1805 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1807 LCallFunction(LOperand* context, LOperand* function) {
1808 inputs_[0] = context;
1809 inputs_[1] = function;
1812 LOperand* context() { return inputs_[0]; }
1813 LOperand* function() { return inputs_[1]; }
1815 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1816 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1818 int arity() const { return hydrogen()->argument_count() - 1; }
1822 class LCallNew V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1824 LCallNew(LOperand* context, LOperand* constructor) {
1825 inputs_[0] = context;
1826 inputs_[1] = constructor;
1829 LOperand* context() { return inputs_[0]; }
1830 LOperand* constructor() { return inputs_[1]; }
1832 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1833 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1835 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1837 int arity() const { return hydrogen()->argument_count() - 1; }
1841 class LCallNewArray V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1843 LCallNewArray(LOperand* context, LOperand* constructor) {
1844 inputs_[0] = context;
1845 inputs_[1] = constructor;
1848 LOperand* context() { return inputs_[0]; }
1849 LOperand* constructor() { return inputs_[1]; }
1851 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1852 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1854 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1856 int arity() const { return hydrogen()->argument_count() - 1; }
1860 class LCallRuntime V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1862 explicit LCallRuntime(LOperand* context) {
1863 inputs_[0] = context;
1866 LOperand* context() { return inputs_[0]; }
1868 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1869 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1871 virtual bool ClobbersDoubleRegisters() const V8_OVERRIDE {
1872 return save_doubles() == kDontSaveFPRegs;
1875 const Runtime::Function* function() const { return hydrogen()->function(); }
1876 int arity() const { return hydrogen()->argument_count(); }
1877 SaveFPRegsMode save_doubles() const { return hydrogen()->save_doubles(); }
1881 class LInteger32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1883 explicit LInteger32ToDouble(LOperand* value) {
1887 LOperand* value() { return inputs_[0]; }
1889 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1893 class LInteger32ToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1895 explicit LInteger32ToSmi(LOperand* value) {
1899 LOperand* value() { return inputs_[0]; }
1901 DECLARE_CONCRETE_INSTRUCTION(Integer32ToSmi, "int32-to-smi")
1902 DECLARE_HYDROGEN_ACCESSOR(Change)
1906 class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1908 explicit LUint32ToDouble(LOperand* value) {
1912 LOperand* value() { return inputs_[0]; }
1914 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1918 class LUint32ToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1920 explicit LUint32ToSmi(LOperand* value) {
1924 LOperand* value() { return inputs_[0]; }
1926 DECLARE_CONCRETE_INSTRUCTION(Uint32ToSmi, "uint32-to-smi")
1927 DECLARE_HYDROGEN_ACCESSOR(Change)
1931 class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1933 explicit LNumberTagI(LOperand* value) {
1937 LOperand* value() { return inputs_[0]; }
1939 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1943 class LNumberTagU V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1945 explicit LNumberTagU(LOperand* value) {
1949 LOperand* value() { return inputs_[0]; }
1951 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1955 class LNumberTagD V8_FINAL : public LTemplateInstruction<1, 1, 2> {
1957 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
1963 LOperand* value() { return inputs_[0]; }
1964 LOperand* temp() { return temps_[0]; }
1965 LOperand* temp2() { return temps_[1]; }
1967 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1968 DECLARE_HYDROGEN_ACCESSOR(Change)
1972 class LDoubleToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1974 explicit LDoubleToSmi(LOperand* value) {
1978 LOperand* value() { return inputs_[0]; }
1980 DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi")
1981 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1983 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1987 // Sometimes truncating conversion from a tagged value to an int32.
1988 class LDoubleToI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1990 explicit LDoubleToI(LOperand* value) {
1994 LOperand* value() { return inputs_[0]; }
1996 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1997 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1999 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2003 // Truncating conversion from a tagged value to an int32.
2004 class LTaggedToI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
2006 LTaggedToI(LOperand* value,
2014 LOperand* value() { return inputs_[0]; }
2015 LOperand* temp() { return temps_[0]; }
2016 LOperand* temp2() { return temps_[1]; }
2018 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
2019 DECLARE_HYDROGEN_ACCESSOR(Change)
2021 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2025 class LSmiTag V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2027 explicit LSmiTag(LOperand* value) {
2031 LOperand* value() { return inputs_[0]; }
2033 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2037 class LNumberUntagD V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2039 explicit LNumberUntagD(LOperand* value) {
2043 LOperand* value() { return inputs_[0]; }
2045 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2046 DECLARE_HYDROGEN_ACCESSOR(Change)
2050 class LSmiUntag V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2052 LSmiUntag(LOperand* value, bool needs_check)
2053 : needs_check_(needs_check) {
2057 LOperand* value() { return inputs_[0]; }
2058 bool needs_check() const { return needs_check_; }
2060 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2067 class LStoreNamedField V8_FINAL : public LTemplateInstruction<0, 2, 1> {
2069 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2070 inputs_[0] = object;
2075 LOperand* object() { return inputs_[0]; }
2076 LOperand* value() { return inputs_[1]; }
2077 LOperand* temp() { return temps_[0]; }
2079 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2080 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2082 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2084 Handle<Map> transition() const { return hydrogen()->transition_map(); }
2085 Representation representation() const {
2086 return hydrogen()->field_representation();
2091 class LStoreNamedGeneric V8_FINAL : public LTemplateInstruction<0, 3, 0> {
2093 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value) {
2094 inputs_[0] = context;
2095 inputs_[1] = object;
2099 LOperand* context() { return inputs_[0]; }
2100 LOperand* object() { return inputs_[1]; }
2101 LOperand* value() { return inputs_[2]; }
2103 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2104 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2106 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2108 Handle<Object> name() const { return hydrogen()->name(); }
2109 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
2113 class LStoreKeyed V8_FINAL : public LTemplateInstruction<0, 3, 1> {
2115 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value,
2117 inputs_[0] = object;
2123 bool is_external() const { return hydrogen()->is_external(); }
2124 bool is_fixed_typed_array() const {
2125 return hydrogen()->is_fixed_typed_array();
2127 bool is_typed_elements() const {
2128 return is_external() || is_fixed_typed_array();
2130 LOperand* elements() { return inputs_[0]; }
2131 LOperand* key() { return inputs_[1]; }
2132 LOperand* value() { return inputs_[2]; }
2133 LOperand* temp() { return temps_[0]; }
2134 ElementsKind elements_kind() const {
2135 return hydrogen()->elements_kind();
2138 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2139 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
2141 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2142 bool NeedsCanonicalization() {
2143 if (hydrogen()->value()->IsAdd() || hydrogen()->value()->IsSub() ||
2144 hydrogen()->value()->IsMul() || hydrogen()->value()->IsDiv()) {
2147 return hydrogen()->NeedsCanonicalization();
2149 uint32_t additional_index() const { return hydrogen()->index_offset(); }
2153 class LStoreKeyedGeneric V8_FINAL : public LTemplateInstruction<0, 4, 0> {
2155 LStoreKeyedGeneric(LOperand* context,
2159 inputs_[0] = context;
2165 LOperand* context() { return inputs_[0]; }
2166 LOperand* object() { return inputs_[1]; }
2167 LOperand* key() { return inputs_[2]; }
2168 LOperand* value() { return inputs_[3]; }
2170 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2171 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2173 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2175 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
2179 class LTransitionElementsKind V8_FINAL : public LTemplateInstruction<0, 2, 1> {
2181 LTransitionElementsKind(LOperand* object,
2183 LOperand* new_map_temp) {
2184 inputs_[0] = object;
2185 inputs_[1] = context;
2186 temps_[0] = new_map_temp;
2189 LOperand* context() { return inputs_[1]; }
2190 LOperand* object() { return inputs_[0]; }
2191 LOperand* new_map_temp() { return temps_[0]; }
2193 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2194 "transition-elements-kind")
2195 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2197 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2199 Handle<Map> original_map() { return hydrogen()->original_map().handle(); }
2200 Handle<Map> transitioned_map() {
2201 return hydrogen()->transitioned_map().handle();
2203 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2204 ElementsKind to_kind() { return hydrogen()->to_kind(); }
2208 class LTrapAllocationMemento V8_FINAL : public LTemplateInstruction<0, 1, 1> {
2210 LTrapAllocationMemento(LOperand* object,
2212 inputs_[0] = object;
2216 LOperand* object() { return inputs_[0]; }
2217 LOperand* temp() { return temps_[0]; }
2219 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2220 "trap-allocation-memento")
2224 class LStringAdd V8_FINAL : public LTemplateInstruction<1, 3, 0> {
2226 LStringAdd(LOperand* context, LOperand* left, LOperand* right) {
2227 inputs_[0] = context;
2232 LOperand* context() { return inputs_[0]; }
2233 LOperand* left() { return inputs_[1]; }
2234 LOperand* right() { return inputs_[2]; }
2236 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2237 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
2242 class LStringCharCodeAt V8_FINAL : public LTemplateInstruction<1, 3, 0> {
2244 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) {
2245 inputs_[0] = context;
2246 inputs_[1] = string;
2250 LOperand* context() { return inputs_[0]; }
2251 LOperand* string() { return inputs_[1]; }
2252 LOperand* index() { return inputs_[2]; }
2254 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2255 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
2259 class LStringCharFromCode V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2261 explicit LStringCharFromCode(LOperand* context, LOperand* char_code) {
2262 inputs_[0] = context;
2263 inputs_[1] = char_code;
2266 LOperand* context() { return inputs_[0]; }
2267 LOperand* char_code() { return inputs_[1]; }
2269 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2270 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
2274 class LCheckValue V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2276 explicit LCheckValue(LOperand* value) {
2280 LOperand* value() { return inputs_[0]; }
2282 DECLARE_CONCRETE_INSTRUCTION(CheckValue, "check-value")
2283 DECLARE_HYDROGEN_ACCESSOR(CheckValue)
2287 class LCheckInstanceType V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2289 explicit LCheckInstanceType(LOperand* value) {
2293 LOperand* value() { return inputs_[0]; }
2295 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2296 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2300 class LCheckMaps V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2302 explicit LCheckMaps(LOperand* value) {
2306 LOperand* value() { return inputs_[0]; }
2308 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2309 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
2313 class LCheckSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2315 explicit LCheckSmi(LOperand* value) {
2319 LOperand* value() { return inputs_[0]; }
2321 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2325 class LCheckNonSmi V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2327 explicit LCheckNonSmi(LOperand* value) {
2331 LOperand* value() { return inputs_[0]; }
2333 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2334 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject)
2338 class LClampDToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2340 explicit LClampDToUint8(LOperand* unclamped) {
2341 inputs_[0] = unclamped;
2344 LOperand* unclamped() { return inputs_[0]; }
2346 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2350 class LClampIToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2352 explicit LClampIToUint8(LOperand* unclamped) {
2353 inputs_[0] = unclamped;
2356 LOperand* unclamped() { return inputs_[0]; }
2358 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2362 class LClampTToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 1> {
2364 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2365 inputs_[0] = unclamped;
2369 LOperand* unclamped() { return inputs_[0]; }
2370 LOperand* temp() { return temps_[0]; }
2372 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2376 class LAllocate V8_FINAL : public LTemplateInstruction<1, 2, 2> {
2378 LAllocate(LOperand* context,
2382 inputs_[0] = context;
2388 LOperand* context() { return inputs_[0]; }
2389 LOperand* size() { return inputs_[1]; }
2390 LOperand* temp1() { return temps_[0]; }
2391 LOperand* temp2() { return temps_[1]; }
2393 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2394 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2398 class LRegExpLiteral V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2400 explicit LRegExpLiteral(LOperand* context) {
2401 inputs_[0] = context;
2404 LOperand* context() { return inputs_[0]; }
2406 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2407 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2411 class LFunctionLiteral V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2413 explicit LFunctionLiteral(LOperand* context) {
2414 inputs_[0] = context;
2417 LOperand* context() { return inputs_[0]; }
2419 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2420 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2424 class LToFastProperties V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2426 explicit LToFastProperties(LOperand* value) {
2430 LOperand* value() { return inputs_[0]; }
2432 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2433 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2437 class LTypeof V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2439 LTypeof(LOperand* context, LOperand* value) {
2440 inputs_[0] = context;
2444 LOperand* context() { return inputs_[0]; }
2445 LOperand* value() { return inputs_[1]; }
2447 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2451 class LTypeofIsAndBranch V8_FINAL : public LControlInstruction<1, 0> {
2453 explicit LTypeofIsAndBranch(LOperand* value) {
2457 LOperand* value() { return inputs_[0]; }
2459 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2460 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2462 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2464 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2468 class LIsConstructCallAndBranch V8_FINAL : public LControlInstruction<0, 1> {
2470 explicit LIsConstructCallAndBranch(LOperand* temp) {
2474 LOperand* temp() { return temps_[0]; }
2476 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2477 "is-construct-call-and-branch")
2481 class LOsrEntry V8_FINAL : public LTemplateInstruction<0, 0, 0> {
2485 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
2488 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2492 class LStackCheck V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2494 explicit LStackCheck(LOperand* context) {
2495 inputs_[0] = context;
2498 LOperand* context() { return inputs_[0]; }
2500 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2501 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2503 Label* done_label() { return &done_label_; }
2510 class LForInPrepareMap V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2512 LForInPrepareMap(LOperand* context, LOperand* object) {
2513 inputs_[0] = context;
2514 inputs_[1] = object;
2517 LOperand* context() { return inputs_[0]; }
2518 LOperand* object() { return inputs_[1]; }
2520 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2524 class LForInCacheArray V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2526 explicit LForInCacheArray(LOperand* map) {
2530 LOperand* map() { return inputs_[0]; }
2532 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2535 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2540 class LCheckMapValue V8_FINAL : public LTemplateInstruction<0, 2, 0> {
2542 LCheckMapValue(LOperand* value, LOperand* map) {
2547 LOperand* value() { return inputs_[0]; }
2548 LOperand* map() { return inputs_[1]; }
2550 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2554 class LLoadFieldByIndex V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2556 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2557 inputs_[0] = object;
2561 LOperand* object() { return inputs_[0]; }
2562 LOperand* index() { return inputs_[1]; }
2564 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2568 class LChunkBuilder;
2569 class LPlatformChunk V8_FINAL : public LChunk {
2571 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2572 : LChunk(info, graph) { }
2574 int GetNextSpillIndex(RegisterKind kind);
2575 LOperand* GetNextSpillSlot(RegisterKind kind);
2579 class LChunkBuilder V8_FINAL : public LChunkBuilderBase {
2581 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2582 : LChunkBuilderBase(graph->zone()),
2587 current_instruction_(NULL),
2588 current_block_(NULL),
2590 allocator_(allocator),
2591 position_(RelocInfo::kNoPosition),
2592 instruction_pending_deoptimization_environment_(NULL),
2593 pending_deoptimization_ast_id_(BailoutId::None()) { }
2595 // Build the sequence for the graph.
2596 LPlatformChunk* Build();
2598 LInstruction* CheckElideControlInstruction(HControlInstruction* instr);
2600 // Declare methods that deal with the individual node types.
2601 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2602 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2605 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2606 LInstruction* DoMultiplySub(HValue* minuend, HMul* mul);
2607 LInstruction* DoRSub(HSub* instr);
2609 static bool HasMagicNumberForDivisor(int32_t divisor);
2611 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2612 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2613 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2614 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2615 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2616 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2617 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2627 LPlatformChunk* chunk() const { return chunk_; }
2628 CompilationInfo* info() const { return info_; }
2629 HGraph* graph() const { return graph_; }
2631 bool is_unused() const { return status_ == UNUSED; }
2632 bool is_building() const { return status_ == BUILDING; }
2633 bool is_done() const { return status_ == DONE; }
2634 bool is_aborted() const { return status_ == ABORTED; }
2636 void Abort(BailoutReason reason);
2638 // Methods for getting operands for Use / Define / Temp.
2639 LUnallocated* ToUnallocated(Register reg);
2640 LUnallocated* ToUnallocated(DoubleRegister reg);
2642 // Methods for setting up define-use relationships.
2643 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2644 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2645 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2646 DoubleRegister fixed_register);
2648 // A value that is guaranteed to be allocated to a register.
2649 // Operand created by UseRegister is guaranteed to be live until the end of
2650 // instruction. This means that register allocator will not reuse it's
2651 // register for any other operand inside instruction.
2652 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2653 // instruction start. Register allocator is free to assign the same register
2654 // to some other operand used inside instruction (i.e. temporary or
2656 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2657 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2659 // An input operand in a register that may be trashed.
2660 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2662 // An input operand in a register or stack slot.
2663 MUST_USE_RESULT LOperand* Use(HValue* value);
2664 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2666 // An input operand in a register, stack slot or a constant operand.
2667 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2668 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2670 // An input operand in a register or a constant operand.
2671 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2672 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2674 // An input operand in a constant operand.
2675 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2677 // An input operand in register, stack slot or a constant operand.
2678 // Will not be moved to a register even if one is freely available.
2679 virtual MUST_USE_RESULT LOperand* UseAny(HValue* value) V8_OVERRIDE;
2681 // Temporary operand that must be in a register.
2682 MUST_USE_RESULT LUnallocated* TempRegister();
2683 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2684 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2686 // Methods for setting up define-use relationships.
2687 // Return the same instruction that they are passed.
2688 LInstruction* Define(LTemplateResultInstruction<1>* instr,
2689 LUnallocated* result);
2690 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr);
2691 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr,
2693 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr);
2694 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr,
2696 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr,
2697 DoubleRegister reg);
2698 LInstruction* AssignEnvironment(LInstruction* instr);
2699 LInstruction* AssignPointerMap(LInstruction* instr);
2701 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2703 // By default we assume that instruction sequences generated for calls
2704 // cannot deoptimize eagerly and we do not attach environment to this
2706 LInstruction* MarkAsCall(
2707 LInstruction* instr,
2708 HInstruction* hinstr,
2709 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2711 void VisitInstruction(HInstruction* current);
2713 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2714 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2715 LInstruction* DoArithmeticD(Token::Value op,
2716 HArithmeticBinaryOperation* instr);
2717 LInstruction* DoArithmeticT(Token::Value op,
2718 HBinaryOperation* instr);
2720 LPlatformChunk* chunk_;
2721 CompilationInfo* info_;
2722 HGraph* const graph_;
2724 HInstruction* current_instruction_;
2725 HBasicBlock* current_block_;
2726 HBasicBlock* next_block_;
2727 LAllocator* allocator_;
2729 LInstruction* instruction_pending_deoptimization_environment_;
2730 BailoutId pending_deoptimization_ast_id_;
2732 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2735 #undef DECLARE_HYDROGEN_ACCESSOR
2736 #undef DECLARE_CONCRETE_INSTRUCTION
2738 } } // namespace v8::internal
2740 #endif // V8_ARM_LITHIUM_ARM_H_