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_X64_LITHIUM_X64_H_
29 #define V8_X64_LITHIUM_X64_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) \
55 V(CallConstantFunction) \
65 V(CheckInstanceType) \
74 V(ClassOfTestAndBranch) \
75 V(CompareNumericAndBranch) \
76 V(CmpObjectEqAndBranch) \
99 V(GetCachedArrayIndex) \
103 V(HasCachedArrayIndexAndBranch) \
104 V(HasInstanceTypeAndBranch) \
105 V(InnerAllocatedObject) \
107 V(InstanceOfKnownGlobal) \
109 V(Integer32ToDouble) \
112 V(IsConstructCallAndBranch) \
113 V(IsObjectAndBranch) \
114 V(IsStringAndBranch) \
116 V(IsUndetectableAndBranch) \
120 V(LoadExternalArrayPointer) \
122 V(LoadFieldByIndex) \
123 V(LoadFunctionPrototype) \
125 V(LoadGlobalGeneric) \
127 V(LoadKeyedGeneric) \
129 V(LoadNamedGeneric) \
157 V(SeqStringSetChar) \
163 V(StoreContextSlot) \
165 V(StoreGlobalGeneric) \
167 V(StoreKeyedGeneric) \
169 V(StoreNamedGeneric) \
171 V(StringCharCodeAt) \
172 V(StringCharFromCode) \
173 V(StringCompareAndBranch) \
178 V(ToFastProperties) \
179 V(TransitionElementsKind) \
180 V(TrapAllocationMemento) \
182 V(TypeofIsAndBranch) \
190 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
191 virtual Opcode opcode() const V8_FINAL V8_OVERRIDE { \
192 return LInstruction::k##type; \
194 virtual void CompileToNative(LCodeGen* generator) V8_FINAL V8_OVERRIDE; \
195 virtual const char* Mnemonic() const V8_FINAL V8_OVERRIDE { \
198 static L##type* cast(LInstruction* instr) { \
199 ASSERT(instr->Is##type()); \
200 return reinterpret_cast<L##type*>(instr); \
204 #define DECLARE_HYDROGEN_ACCESSOR(type) \
205 H##type* hydrogen() const { \
206 return H##type::cast(hydrogen_value()); \
210 class LInstruction : public ZoneObject {
213 : environment_(NULL),
214 hydrogen_value_(NULL),
215 bit_field_(IsCallBits::encode(false)) {
218 virtual ~LInstruction() {}
220 virtual void CompileToNative(LCodeGen* generator) = 0;
221 virtual const char* Mnemonic() const = 0;
222 virtual void PrintTo(StringStream* stream);
223 virtual void PrintDataTo(StringStream* stream);
224 virtual void PrintOutputOperandTo(StringStream* stream);
227 // Declare a unique enum value for each instruction.
228 #define DECLARE_OPCODE(type) k##type,
229 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
230 kNumberOfInstructions
231 #undef DECLARE_OPCODE
234 virtual Opcode opcode() const = 0;
236 // Declare non-virtual type testers for all leaf IR classes.
237 #define DECLARE_PREDICATE(type) \
238 bool Is##type() const { return opcode() == k##type; }
239 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
240 #undef DECLARE_PREDICATE
242 // Declare virtual predicates for instructions that don't have
244 virtual bool IsGap() const { return false; }
246 virtual bool IsControl() const { return false; }
248 void set_environment(LEnvironment* env) { environment_ = env; }
249 LEnvironment* environment() const { return environment_; }
250 bool HasEnvironment() const { return environment_ != NULL; }
252 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
253 LPointerMap* pointer_map() const { return pointer_map_.get(); }
254 bool HasPointerMap() const { return pointer_map_.is_set(); }
256 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
257 HValue* hydrogen_value() const { return hydrogen_value_; }
259 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); }
260 bool IsCall() const { return IsCallBits::decode(bit_field_); }
262 // Interface to the register allocator and iterators.
263 bool ClobbersTemps() const { return IsCall(); }
264 bool ClobbersRegisters() const { return IsCall(); }
265 virtual bool ClobbersDoubleRegisters() const { return IsCall(); }
267 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
269 // Interface to the register allocator and iterators.
270 bool IsMarkedAsCall() const { return IsCall(); }
272 virtual bool HasResult() const = 0;
273 virtual LOperand* result() const = 0;
275 LOperand* FirstInput() { return InputAt(0); }
276 LOperand* Output() { return HasResult() ? result() : NULL; }
278 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
286 friend class InputIterator;
287 virtual int InputCount() = 0;
288 virtual LOperand* InputAt(int i) = 0;
290 friend class TempIterator;
291 virtual int TempCount() = 0;
292 virtual LOperand* TempAt(int i) = 0;
294 class IsCallBits: public BitField<bool, 0, 1> {};
296 LEnvironment* environment_;
297 SetOncePointer<LPointerMap> pointer_map_;
298 HValue* hydrogen_value_;
303 // R = number of result operands (0 or 1).
304 // I = number of input operands.
305 // T = number of temporary operands.
306 template<int R, int I, int T>
307 class LTemplateInstruction : public LInstruction {
309 // Allow 0 or 1 output operands.
310 STATIC_ASSERT(R == 0 || R == 1);
311 virtual bool HasResult() const V8_FINAL V8_OVERRIDE {
312 return R != 0 && result() != NULL;
314 void set_result(LOperand* operand) { results_[0] = operand; }
315 LOperand* result() const { return results_[0]; }
318 EmbeddedContainer<LOperand*, R> results_;
319 EmbeddedContainer<LOperand*, I> inputs_;
320 EmbeddedContainer<LOperand*, T> temps_;
324 virtual int InputCount() V8_FINAL V8_OVERRIDE { return I; }
325 virtual LOperand* InputAt(int i) V8_FINAL V8_OVERRIDE { return inputs_[i]; }
327 virtual int TempCount() V8_FINAL V8_OVERRIDE { return T; }
328 virtual LOperand* TempAt(int i) V8_FINAL V8_OVERRIDE { return temps_[i]; }
332 class LGap : public LTemplateInstruction<0, 0, 0> {
334 explicit LGap(HBasicBlock* block)
336 parallel_moves_[BEFORE] = NULL;
337 parallel_moves_[START] = NULL;
338 parallel_moves_[END] = NULL;
339 parallel_moves_[AFTER] = NULL;
342 // Can't use the DECLARE-macro here because of sub-classes.
343 virtual bool IsGap() const V8_FINAL V8_OVERRIDE { return true; }
344 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
345 static LGap* cast(LInstruction* instr) {
346 ASSERT(instr->IsGap());
347 return reinterpret_cast<LGap*>(instr);
350 bool IsRedundant() const;
352 HBasicBlock* block() const { return block_; }
359 FIRST_INNER_POSITION = BEFORE,
360 LAST_INNER_POSITION = AFTER
363 LParallelMove* GetOrCreateParallelMove(InnerPosition pos,
365 if (parallel_moves_[pos] == NULL) {
366 parallel_moves_[pos] = new(zone) LParallelMove(zone);
368 return parallel_moves_[pos];
371 LParallelMove* GetParallelMove(InnerPosition pos) {
372 return parallel_moves_[pos];
376 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
381 class LInstructionGap V8_FINAL : public LGap {
383 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
385 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
386 return !IsRedundant();
389 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
393 class LGoto V8_FINAL : public LTemplateInstruction<0, 0, 0> {
395 explicit LGoto(HBasicBlock* block) : block_(block) { }
397 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE;
398 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
399 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
400 virtual bool IsControl() const V8_OVERRIDE { return true; }
402 int block_id() const { return block_->block_id(); }
409 class LLazyBailout V8_FINAL : public LTemplateInstruction<0, 0, 0> {
411 LLazyBailout() : gap_instructions_size_(0) { }
413 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
415 void set_gap_instructions_size(int gap_instructions_size) {
416 gap_instructions_size_ = gap_instructions_size;
418 int gap_instructions_size() { return gap_instructions_size_; }
421 int gap_instructions_size_;
425 class LDummyUse V8_FINAL : public LTemplateInstruction<1, 1, 0> {
427 explicit LDummyUse(LOperand* value) {
430 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
434 class LDeoptimize V8_FINAL : public LTemplateInstruction<0, 0, 0> {
436 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
437 DECLARE_HYDROGEN_ACCESSOR(Deoptimize)
441 class LLabel V8_FINAL : public LGap {
443 explicit LLabel(HBasicBlock* block)
444 : LGap(block), replacement_(NULL) { }
446 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
449 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
451 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
453 int block_id() const { return block()->block_id(); }
454 bool is_loop_header() const { return block()->IsLoopHeader(); }
455 bool is_osr_entry() const { return block()->is_osr_entry(); }
456 Label* label() { return &label_; }
457 LLabel* replacement() const { return replacement_; }
458 void set_replacement(LLabel* label) { replacement_ = label; }
459 bool HasReplacement() const { return replacement_ != NULL; }
463 LLabel* replacement_;
467 class LParameter V8_FINAL : public LTemplateInstruction<1, 0, 0> {
469 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
472 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
476 class LCallStub V8_FINAL : public LTemplateInstruction<1, 0, 0> {
478 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
479 DECLARE_HYDROGEN_ACCESSOR(CallStub)
481 TranscendentalCache::Type transcendental_type() {
482 return hydrogen()->transcendental_type();
487 class LUnknownOSRValue V8_FINAL : public LTemplateInstruction<1, 0, 0> {
489 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
492 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
496 template<int I, int T>
497 class LControlInstruction : public LTemplateInstruction<0, I, T> {
499 LControlInstruction() : false_label_(NULL), true_label_(NULL) { }
501 virtual bool IsControl() const V8_FINAL V8_OVERRIDE { return true; }
503 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
504 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
506 int TrueDestination(LChunk* chunk) {
507 return chunk->LookupDestination(true_block_id());
509 int FalseDestination(LChunk* chunk) {
510 return chunk->LookupDestination(false_block_id());
513 Label* TrueLabel(LChunk* chunk) {
514 if (true_label_ == NULL) {
515 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk));
519 Label* FalseLabel(LChunk* chunk) {
520 if (false_label_ == NULL) {
521 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk));
527 int true_block_id() { return SuccessorAt(0)->block_id(); }
528 int false_block_id() { return SuccessorAt(1)->block_id(); }
531 HControlInstruction* hydrogen() {
532 return HControlInstruction::cast(this->hydrogen_value());
540 class LWrapReceiver V8_FINAL : public LTemplateInstruction<1, 2, 0> {
542 LWrapReceiver(LOperand* receiver, LOperand* function) {
543 inputs_[0] = receiver;
544 inputs_[1] = function;
547 LOperand* receiver() { return inputs_[0]; }
548 LOperand* function() { return inputs_[1]; }
550 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
554 class LApplyArguments V8_FINAL : public LTemplateInstruction<1, 4, 0> {
556 LApplyArguments(LOperand* function,
559 LOperand* elements) {
560 inputs_[0] = function;
561 inputs_[1] = receiver;
563 inputs_[3] = elements;
566 LOperand* function() { return inputs_[0]; }
567 LOperand* receiver() { return inputs_[1]; }
568 LOperand* length() { return inputs_[2]; }
569 LOperand* elements() { return inputs_[3]; }
571 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
575 class LAccessArgumentsAt V8_FINAL : public LTemplateInstruction<1, 3, 0> {
577 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
578 inputs_[0] = arguments;
583 LOperand* arguments() { return inputs_[0]; }
584 LOperand* length() { return inputs_[1]; }
585 LOperand* index() { return inputs_[2]; }
587 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
589 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
593 class LArgumentsLength V8_FINAL : public LTemplateInstruction<1, 1, 0> {
595 explicit LArgumentsLength(LOperand* elements) {
596 inputs_[0] = elements;
599 LOperand* elements() { return inputs_[0]; }
601 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
605 class LArgumentsElements V8_FINAL : public LTemplateInstruction<1, 0, 0> {
607 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
608 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
612 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
614 LModI(LOperand* left, LOperand* right, LOperand* temp) {
620 LOperand* left() { return inputs_[0]; }
621 LOperand* right() { return inputs_[1]; }
622 LOperand* temp() { return temps_[0]; }
624 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
625 DECLARE_HYDROGEN_ACCESSOR(Mod)
629 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
631 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
637 LOperand* left() { return inputs_[0]; }
638 LOperand* right() { return inputs_[1]; }
639 LOperand* temp() { return temps_[0]; }
641 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); }
643 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
644 DECLARE_HYDROGEN_ACCESSOR(Div)
648 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> {
650 LMathFloorOfDiv(LOperand* left,
652 LOperand* temp = NULL) {
658 LOperand* left() { return inputs_[0]; }
659 LOperand* right() { return inputs_[1]; }
660 LOperand* temp() { return temps_[0]; }
662 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div")
663 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
667 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
669 LMulI(LOperand* left, LOperand* right) {
674 LOperand* left() { return inputs_[0]; }
675 LOperand* right() { return inputs_[1]; }
677 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
678 DECLARE_HYDROGEN_ACCESSOR(Mul)
682 class LCompareNumericAndBranch V8_FINAL : public LControlInstruction<2, 0> {
684 LCompareNumericAndBranch(LOperand* left, LOperand* right) {
689 LOperand* left() { return inputs_[0]; }
690 LOperand* right() { return inputs_[1]; }
692 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch,
693 "compare-numeric-and-branch")
694 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch)
696 Token::Value op() const { return hydrogen()->token(); }
697 bool is_double() const {
698 return hydrogen()->representation().IsDouble();
701 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
705 class LMathFloor V8_FINAL : public LTemplateInstruction<1, 1, 0> {
707 explicit LMathFloor(LOperand* value) {
711 LOperand* value() { return inputs_[0]; }
713 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
714 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
718 class LMathRound V8_FINAL : public LTemplateInstruction<1, 1, 0> {
720 explicit LMathRound(LOperand* value) {
724 LOperand* value() { return inputs_[0]; }
726 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
727 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
731 class LMathAbs V8_FINAL : public LTemplateInstruction<1, 1, 0> {
733 explicit LMathAbs(LOperand* value) {
737 LOperand* value() { return inputs_[0]; }
739 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
740 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
744 class LMathLog V8_FINAL : public LTemplateInstruction<1, 1, 0> {
746 explicit LMathLog(LOperand* value) {
750 LOperand* value() { return inputs_[0]; }
752 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
756 class LMathSin V8_FINAL : public LTemplateInstruction<1, 1, 0> {
758 explicit LMathSin(LOperand* value) {
762 LOperand* value() { return inputs_[0]; }
764 DECLARE_CONCRETE_INSTRUCTION(MathSin, "math-sin")
768 class LMathCos V8_FINAL : public LTemplateInstruction<1, 1, 0> {
770 explicit LMathCos(LOperand* value) {
774 LOperand* value() { return inputs_[0]; }
776 DECLARE_CONCRETE_INSTRUCTION(MathCos, "math-cos")
780 class LMathTan V8_FINAL : public LTemplateInstruction<1, 1, 0> {
782 explicit LMathTan(LOperand* value) {
786 LOperand* value() { return inputs_[0]; }
788 DECLARE_CONCRETE_INSTRUCTION(MathTan, "math-tan")
792 class LMathExp V8_FINAL : public LTemplateInstruction<1, 1, 2> {
794 LMathExp(LOperand* value, LOperand* temp1, LOperand* temp2) {
798 ExternalReference::InitializeMathExpData();
801 LOperand* value() { return inputs_[0]; }
802 LOperand* temp1() { return temps_[0]; }
803 LOperand* temp2() { return temps_[1]; }
805 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
809 class LMathSqrt V8_FINAL : public LTemplateInstruction<1, 1, 0> {
811 explicit LMathSqrt(LOperand* value) {
815 LOperand* value() { return inputs_[0]; }
817 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
821 class LMathPowHalf V8_FINAL : public LTemplateInstruction<1, 1, 0> {
823 explicit LMathPowHalf(LOperand* value) {
827 LOperand* value() { return inputs_[0]; }
829 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
833 class LCmpObjectEqAndBranch V8_FINAL : public LControlInstruction<2, 0> {
835 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
840 LOperand* left() { return inputs_[0]; }
841 LOperand* right() { return inputs_[1]; }
843 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch")
847 class LCmpHoleAndBranch V8_FINAL : public LControlInstruction<1, 0> {
849 explicit LCmpHoleAndBranch(LOperand* object) {
853 LOperand* object() { return inputs_[0]; }
855 DECLARE_CONCRETE_INSTRUCTION(CmpHoleAndBranch, "cmp-hole-and-branch")
856 DECLARE_HYDROGEN_ACCESSOR(CompareHoleAndBranch)
860 class LIsObjectAndBranch V8_FINAL : public LControlInstruction<1, 0> {
862 explicit LIsObjectAndBranch(LOperand* value) {
866 LOperand* value() { return inputs_[0]; }
868 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
869 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
871 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
875 class LIsStringAndBranch V8_FINAL : public LControlInstruction<1, 1> {
877 explicit LIsStringAndBranch(LOperand* value, LOperand* temp) {
882 LOperand* value() { return inputs_[0]; }
883 LOperand* temp() { return temps_[0]; }
885 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
886 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
888 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
892 class LIsSmiAndBranch V8_FINAL : public LControlInstruction<1, 0> {
894 explicit LIsSmiAndBranch(LOperand* value) {
898 LOperand* value() { return inputs_[0]; }
900 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
901 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
903 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
907 class LIsUndetectableAndBranch V8_FINAL : public LControlInstruction<1, 1> {
909 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
914 LOperand* value() { return inputs_[0]; }
915 LOperand* temp() { return temps_[0]; }
917 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
918 "is-undetectable-and-branch")
919 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
921 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
925 class LStringCompareAndBranch V8_FINAL : public LControlInstruction<2, 0> {
927 explicit LStringCompareAndBranch(LOperand* left, LOperand* right) {
932 LOperand* left() { return inputs_[0]; }
933 LOperand* right() { return inputs_[1]; }
935 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
936 "string-compare-and-branch")
937 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
939 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
941 Token::Value op() const { return hydrogen()->token(); }
945 class LHasInstanceTypeAndBranch V8_FINAL : public LControlInstruction<1, 0> {
947 explicit LHasInstanceTypeAndBranch(LOperand* value) {
951 LOperand* value() { return inputs_[0]; }
953 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
954 "has-instance-type-and-branch")
955 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
957 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
961 class LGetCachedArrayIndex V8_FINAL : public LTemplateInstruction<1, 1, 0> {
963 explicit LGetCachedArrayIndex(LOperand* value) {
967 LOperand* value() { return inputs_[0]; }
969 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
970 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
974 class LHasCachedArrayIndexAndBranch V8_FINAL
975 : public LControlInstruction<1, 0> {
977 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
981 LOperand* value() { return inputs_[0]; }
983 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
984 "has-cached-array-index-and-branch")
985 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
987 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
991 class LClassOfTestAndBranch V8_FINAL : public LControlInstruction<1, 2> {
993 LClassOfTestAndBranch(LOperand* value, LOperand* temp, LOperand* temp2) {
999 LOperand* value() { return inputs_[0]; }
1000 LOperand* temp() { return temps_[0]; }
1001 LOperand* temp2() { return temps_[1]; }
1003 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1004 "class-of-test-and-branch")
1005 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1007 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1011 class LCmpT V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1013 LCmpT(LOperand* left, LOperand* right) {
1018 LOperand* left() { return inputs_[0]; }
1019 LOperand* right() { return inputs_[1]; }
1021 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1022 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1024 Token::Value op() const { return hydrogen()->token(); }
1028 class LInstanceOf V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1030 LInstanceOf(LOperand* left, LOperand* right) {
1035 LOperand* left() { return inputs_[0]; }
1036 LOperand* right() { return inputs_[1]; }
1038 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1042 class LInstanceOfKnownGlobal V8_FINAL : public LTemplateInstruction<1, 1, 1> {
1044 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
1049 LOperand* value() { return inputs_[0]; }
1050 LOperand* temp() { return temps_[0]; }
1052 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1053 "instance-of-known-global")
1054 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1056 Handle<JSFunction> function() const { return hydrogen()->function(); }
1057 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
1058 return lazy_deopt_env_;
1060 virtual void SetDeferredLazyDeoptimizationEnvironment(
1061 LEnvironment* env) V8_OVERRIDE {
1062 lazy_deopt_env_ = env;
1066 LEnvironment* lazy_deopt_env_;
1070 class LBoundsCheck V8_FINAL : public LTemplateInstruction<0, 2, 0> {
1072 LBoundsCheck(LOperand* index, LOperand* length) {
1074 inputs_[1] = length;
1077 LOperand* index() { return inputs_[0]; }
1078 LOperand* length() { return inputs_[1]; }
1080 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
1081 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
1085 class LBitI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1087 LBitI(LOperand* left, LOperand* right) {
1092 LOperand* left() { return inputs_[0]; }
1093 LOperand* right() { return inputs_[1]; }
1095 Token::Value op() const { return hydrogen()->op(); }
1097 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1098 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1102 class LShiftI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1104 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1105 : op_(op), can_deopt_(can_deopt) {
1110 Token::Value op() const { return op_; }
1111 LOperand* left() { return inputs_[0]; }
1112 LOperand* right() { return inputs_[1]; }
1113 bool can_deopt() const { return can_deopt_; }
1115 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1123 class LSubI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1125 LSubI(LOperand* left, LOperand* right) {
1130 LOperand* left() { return inputs_[0]; }
1131 LOperand* right() { return inputs_[1]; }
1133 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1134 DECLARE_HYDROGEN_ACCESSOR(Sub)
1138 class LConstantI V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1140 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1141 DECLARE_HYDROGEN_ACCESSOR(Constant)
1143 int32_t value() const { return hydrogen()->Integer32Value(); }
1147 class LConstantS V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1149 DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s")
1150 DECLARE_HYDROGEN_ACCESSOR(Constant)
1152 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); }
1156 class LConstantD V8_FINAL : public LTemplateInstruction<1, 0, 1> {
1158 explicit LConstantD(LOperand* temp) {
1162 LOperand* temp() { return temps_[0]; }
1164 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1165 DECLARE_HYDROGEN_ACCESSOR(Constant)
1167 double value() const { return hydrogen()->DoubleValue(); }
1171 class LConstantE V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1173 DECLARE_CONCRETE_INSTRUCTION(ConstantE, "constant-e")
1174 DECLARE_HYDROGEN_ACCESSOR(Constant)
1176 ExternalReference value() const {
1177 return hydrogen()->ExternalReferenceValue();
1182 class LConstantT V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1184 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1185 DECLARE_HYDROGEN_ACCESSOR(Constant)
1187 Handle<Object> value(Isolate* isolate) const {
1188 return hydrogen()->handle(isolate);
1193 class LBranch V8_FINAL : public LControlInstruction<1, 0> {
1195 explicit LBranch(LOperand* value) {
1199 LOperand* value() { return inputs_[0]; }
1201 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1202 DECLARE_HYDROGEN_ACCESSOR(Branch)
1204 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1208 class LDebugBreak V8_FINAL : public LTemplateInstruction<0, 0, 0> {
1210 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
1214 class LCmpMapAndBranch V8_FINAL : public LControlInstruction<1, 0> {
1216 explicit LCmpMapAndBranch(LOperand* value) {
1220 LOperand* value() { return inputs_[0]; }
1222 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1223 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1225 Handle<Map> map() const { return hydrogen()->map().handle(); }
1229 class LMapEnumLength V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1231 explicit LMapEnumLength(LOperand* value) {
1235 LOperand* value() { return inputs_[0]; }
1237 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1241 class LElementsKind V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1243 explicit LElementsKind(LOperand* value) {
1247 LOperand* value() { return inputs_[0]; }
1249 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1250 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1254 class LValueOf V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1256 explicit LValueOf(LOperand* value) {
1260 LOperand* value() { return inputs_[0]; }
1262 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1263 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1267 class LDateField V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1269 LDateField(LOperand* date, Smi* index) : index_(index) {
1273 LOperand* date() { return inputs_[0]; }
1274 Smi* index() const { return index_; }
1276 DECLARE_CONCRETE_INSTRUCTION(DateField, "date-field")
1277 DECLARE_HYDROGEN_ACCESSOR(DateField)
1284 class LSeqStringSetChar V8_FINAL : public LTemplateInstruction<1, 3, 0> {
1286 LSeqStringSetChar(String::Encoding encoding,
1289 LOperand* value) : encoding_(encoding) {
1290 inputs_[0] = string;
1295 String::Encoding encoding() { return encoding_; }
1296 LOperand* string() { return inputs_[0]; }
1297 LOperand* index() { return inputs_[1]; }
1298 LOperand* value() { return inputs_[2]; }
1300 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1301 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1304 String::Encoding encoding_;
1308 class LThrow V8_FINAL : public LTemplateInstruction<0, 1, 0> {
1310 explicit LThrow(LOperand* value) {
1314 LOperand* value() { return inputs_[0]; }
1316 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1320 class LAddI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1322 LAddI(LOperand* left, LOperand* right) {
1327 LOperand* left() { return inputs_[0]; }
1328 LOperand* right() { return inputs_[1]; }
1330 static bool UseLea(HAdd* add) {
1331 return !add->CheckFlag(HValue::kCanOverflow) &&
1332 add->BetterLeftOperand()->UseCount() > 1;
1335 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1336 DECLARE_HYDROGEN_ACCESSOR(Add)
1340 class LMathMinMax V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1342 LMathMinMax(LOperand* left, LOperand* right) {
1347 LOperand* left() { return inputs_[0]; }
1348 LOperand* right() { return inputs_[1]; }
1350 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
1351 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1355 class LPower V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1357 LPower(LOperand* left, LOperand* right) {
1362 LOperand* left() { return inputs_[0]; }
1363 LOperand* right() { return inputs_[1]; }
1365 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1366 DECLARE_HYDROGEN_ACCESSOR(Power)
1370 class LRandom V8_FINAL : public LTemplateInstruction<1, 1, 3> {
1372 LRandom(LOperand* global_object,
1375 LOperand* scratch3) {
1376 inputs_[0] = global_object;
1377 temps_[0] = scratch;
1378 temps_[1] = scratch2;
1379 temps_[2] = scratch3;
1382 LOperand* global_object() { return inputs_[0]; }
1383 LOperand* scratch() const { return temps_[0]; }
1384 LOperand* scratch2() const { return temps_[1]; }
1385 LOperand* scratch3() const { return temps_[2]; }
1387 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1388 DECLARE_HYDROGEN_ACCESSOR(Random)
1392 class LArithmeticD V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1394 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1400 Token::Value op() const { return op_; }
1401 LOperand* left() { return inputs_[0]; }
1402 LOperand* right() { return inputs_[1]; }
1404 virtual Opcode opcode() const V8_OVERRIDE {
1405 return LInstruction::kArithmeticD;
1407 virtual void CompileToNative(LCodeGen* generator) V8_OVERRIDE;
1408 virtual const char* Mnemonic() const V8_OVERRIDE;
1415 class LArithmeticT V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1417 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1423 Token::Value op() const { return op_; }
1424 LOperand* left() { return inputs_[0]; }
1425 LOperand* right() { return inputs_[1]; }
1427 virtual Opcode opcode() const V8_OVERRIDE {
1428 return LInstruction::kArithmeticT;
1430 virtual void CompileToNative(LCodeGen* generator) V8_OVERRIDE;
1431 virtual const char* Mnemonic() const V8_OVERRIDE;
1438 class LReturn V8_FINAL : public LTemplateInstruction<0, 2, 0> {
1440 explicit LReturn(LOperand* value, LOperand* parameter_count) {
1442 inputs_[1] = parameter_count;
1445 LOperand* value() { return inputs_[0]; }
1447 bool has_constant_parameter_count() {
1448 return parameter_count()->IsConstantOperand();
1450 LConstantOperand* constant_parameter_count() {
1451 ASSERT(has_constant_parameter_count());
1452 return LConstantOperand::cast(parameter_count());
1454 LOperand* parameter_count() { return inputs_[1]; }
1456 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1457 DECLARE_HYDROGEN_ACCESSOR(Return)
1461 class LLoadNamedField V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1463 explicit LLoadNamedField(LOperand* object) {
1464 inputs_[0] = object;
1467 LOperand* object() { return inputs_[0]; }
1469 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1470 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1474 class LLoadNamedGeneric V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1476 explicit LLoadNamedGeneric(LOperand* object) {
1477 inputs_[0] = object;
1480 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1481 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1483 LOperand* object() { return inputs_[0]; }
1484 Handle<Object> name() const { return hydrogen()->name(); }
1488 class LLoadFunctionPrototype V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1490 explicit LLoadFunctionPrototype(LOperand* function) {
1491 inputs_[0] = function;
1494 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1495 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1497 LOperand* function() { return inputs_[0]; }
1501 class LLoadRoot V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1503 DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
1504 DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
1506 Heap::RootListIndex index() const { return hydrogen()->index(); }
1510 class LLoadExternalArrayPointer V8_FINAL
1511 : public LTemplateInstruction<1, 1, 0> {
1513 explicit LLoadExternalArrayPointer(LOperand* object) {
1514 inputs_[0] = object;
1517 LOperand* object() { return inputs_[0]; }
1519 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1520 "load-external-array-pointer")
1524 class LLoadKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1526 LLoadKeyed(LOperand* elements, LOperand* key) {
1527 inputs_[0] = elements;
1531 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1532 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1534 bool is_external() const {
1535 return hydrogen()->is_external();
1537 LOperand* elements() { return inputs_[0]; }
1538 LOperand* key() { return inputs_[1]; }
1539 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1540 uint32_t additional_index() const { return hydrogen()->index_offset(); }
1541 ElementsKind elements_kind() const {
1542 return hydrogen()->elements_kind();
1547 class LLoadKeyedGeneric V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1549 LLoadKeyedGeneric(LOperand* obj, LOperand* key) {
1554 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1556 LOperand* object() { return inputs_[0]; }
1557 LOperand* key() { return inputs_[1]; }
1561 class LLoadGlobalCell V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1563 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1564 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1568 class LLoadGlobalGeneric V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1570 explicit LLoadGlobalGeneric(LOperand* global_object) {
1571 inputs_[0] = global_object;
1574 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1575 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1577 LOperand* global_object() { return inputs_[0]; }
1578 Handle<Object> name() const { return hydrogen()->name(); }
1579 bool for_typeof() const { return hydrogen()->for_typeof(); }
1583 class LStoreGlobalCell V8_FINAL : public LTemplateInstruction<0, 1, 1> {
1585 explicit LStoreGlobalCell(LOperand* value, LOperand* temp) {
1590 LOperand* value() { return inputs_[0]; }
1591 LOperand* temp() { return temps_[0]; }
1593 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1594 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1598 class LStoreGlobalGeneric V8_FINAL : public LTemplateInstruction<0, 2, 0> {
1600 explicit LStoreGlobalGeneric(LOperand* global_object,
1602 inputs_[0] = global_object;
1606 LOperand* global_object() { return inputs_[0]; }
1607 LOperand* value() { return inputs_[1]; }
1609 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1610 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1612 Handle<Object> name() const { return hydrogen()->name(); }
1613 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
1617 class LLoadContextSlot V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1619 explicit LLoadContextSlot(LOperand* context) {
1620 inputs_[0] = context;
1623 LOperand* context() { return inputs_[0]; }
1625 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1626 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1628 int slot_index() { return hydrogen()->slot_index(); }
1630 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1634 class LStoreContextSlot V8_FINAL : public LTemplateInstruction<0, 2, 1> {
1636 LStoreContextSlot(LOperand* context, LOperand* value, LOperand* temp) {
1637 inputs_[0] = context;
1642 LOperand* context() { return inputs_[0]; }
1643 LOperand* value() { return inputs_[1]; }
1644 LOperand* temp() { return temps_[0]; }
1646 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1647 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1649 int slot_index() { return hydrogen()->slot_index(); }
1651 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1655 class LPushArgument V8_FINAL : public LTemplateInstruction<0, 1, 0> {
1657 explicit LPushArgument(LOperand* value) {
1661 LOperand* value() { return inputs_[0]; }
1663 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1667 class LDrop V8_FINAL : public LTemplateInstruction<0, 0, 0> {
1669 explicit LDrop(int count) : count_(count) { }
1671 int count() const { return count_; }
1673 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1680 class LStoreCodeEntry V8_FINAL: public LTemplateInstruction<0, 1, 1> {
1682 LStoreCodeEntry(LOperand* function, LOperand* code_object) {
1683 inputs_[0] = function;
1684 temps_[0] = code_object;
1687 LOperand* function() { return inputs_[0]; }
1688 LOperand* code_object() { return temps_[0]; }
1690 virtual void PrintDataTo(StringStream* stream);
1692 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry, "store-code-entry")
1693 DECLARE_HYDROGEN_ACCESSOR(StoreCodeEntry)
1697 class LInnerAllocatedObject V8_FINAL: public LTemplateInstruction<1, 1, 0> {
1699 explicit LInnerAllocatedObject(LOperand* base_object) {
1700 inputs_[0] = base_object;
1703 LOperand* base_object() { return inputs_[0]; }
1704 int offset() { return hydrogen()->offset(); }
1706 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1708 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "sub-allocated-object")
1709 DECLARE_HYDROGEN_ACCESSOR(InnerAllocatedObject)
1713 class LThisFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1715 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1716 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1720 class LContext V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1722 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1723 DECLARE_HYDROGEN_ACCESSOR(Context)
1727 class LOuterContext V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1729 explicit LOuterContext(LOperand* context) {
1730 inputs_[0] = context;
1733 LOperand* context() { return inputs_[0]; }
1735 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
1739 class LDeclareGlobals V8_FINAL : public LTemplateInstruction<0, 0, 0> {
1741 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1742 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1746 class LGlobalObject V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1748 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1752 class LGlobalReceiver V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1754 explicit LGlobalReceiver(LOperand* global_object) {
1755 inputs_[0] = global_object;
1758 LOperand* global() { return inputs_[0]; }
1760 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1764 class LCallConstantFunction V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1766 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1767 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1769 virtual void PrintDataTo(StringStream* stream);
1771 Handle<JSFunction> function() { return hydrogen()->function(); }
1772 int arity() const { return hydrogen()->argument_count() - 1; }
1776 class LInvokeFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1778 explicit LInvokeFunction(LOperand* function) {
1779 inputs_[0] = function;
1782 LOperand* function() { return inputs_[0]; }
1784 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1785 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1787 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1789 int arity() const { return hydrogen()->argument_count() - 1; }
1793 class LCallKeyed V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1795 explicit LCallKeyed(LOperand* key) {
1799 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1800 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1802 LOperand* key() { return inputs_[0]; }
1804 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1806 int arity() const { return hydrogen()->argument_count() - 1; }
1810 class LCallNamed V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1812 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1813 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1815 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1817 Handle<String> name() const { return hydrogen()->name(); }
1818 int arity() const { return hydrogen()->argument_count() - 1; }
1822 class LCallFunction V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1824 explicit LCallFunction(LOperand* function) {
1825 inputs_[0] = function;
1828 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1829 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1831 LOperand* function() { return inputs_[0]; }
1832 int arity() const { return hydrogen()->argument_count() - 1; }
1836 class LCallGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1838 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1839 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1841 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1843 Handle<String> name() const {return hydrogen()->name(); }
1844 int arity() const { return hydrogen()->argument_count() - 1; }
1848 class LCallKnownGlobal V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1850 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1851 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1853 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1855 int arity() const { return hydrogen()->argument_count() - 1; }
1859 class LCallNew V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1861 explicit LCallNew(LOperand* constructor) {
1862 inputs_[0] = constructor;
1865 LOperand* constructor() { return inputs_[0]; }
1867 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1868 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1870 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1872 int arity() const { return hydrogen()->argument_count() - 1; }
1876 class LCallNewArray V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1878 explicit LCallNewArray(LOperand* constructor) {
1879 inputs_[0] = constructor;
1882 LOperand* constructor() { return inputs_[0]; }
1884 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1885 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1887 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1889 int arity() const { return hydrogen()->argument_count() - 1; }
1893 class LCallRuntime V8_FINAL : public LTemplateInstruction<1, 0, 0> {
1895 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1896 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1898 virtual bool ClobbersDoubleRegisters() const V8_OVERRIDE {
1899 return save_doubles() == kDontSaveFPRegs;
1902 const Runtime::Function* function() const { return hydrogen()->function(); }
1903 int arity() const { return hydrogen()->argument_count(); }
1904 SaveFPRegsMode save_doubles() const { return hydrogen()->save_doubles(); }
1908 class LInteger32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1910 explicit LInteger32ToDouble(LOperand* value) {
1914 LOperand* value() { return inputs_[0]; }
1916 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1920 class LInteger32ToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1922 explicit LInteger32ToSmi(LOperand* value) {
1926 LOperand* value() { return inputs_[0]; }
1928 DECLARE_CONCRETE_INSTRUCTION(Integer32ToSmi, "int32-to-smi")
1929 DECLARE_HYDROGEN_ACCESSOR(Change)
1933 class LUint32ToDouble V8_FINAL : public LTemplateInstruction<1, 1, 1> {
1935 explicit LUint32ToDouble(LOperand* value, LOperand* temp) {
1940 LOperand* value() { return inputs_[0]; }
1941 LOperand* temp() { return temps_[0]; }
1943 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1947 class LUint32ToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1949 explicit LUint32ToSmi(LOperand* value) {
1953 LOperand* value() { return inputs_[0]; }
1955 DECLARE_CONCRETE_INSTRUCTION(Uint32ToSmi, "uint32-to-smi")
1956 DECLARE_HYDROGEN_ACCESSOR(Change)
1960 class LNumberTagI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1962 explicit LNumberTagI(LOperand* value) {
1966 LOperand* value() { return inputs_[0]; }
1968 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1972 class LNumberTagU V8_FINAL : public LTemplateInstruction<1, 1, 1> {
1974 explicit LNumberTagU(LOperand* value, LOperand* temp) {
1979 LOperand* value() { return inputs_[0]; }
1980 LOperand* temp() { return temps_[0]; }
1982 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1986 class LNumberTagD V8_FINAL : public LTemplateInstruction<1, 1, 1> {
1988 explicit LNumberTagD(LOperand* value, LOperand* temp) {
1993 LOperand* value() { return inputs_[0]; }
1994 LOperand* temp() { return temps_[0]; }
1996 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1997 DECLARE_HYDROGEN_ACCESSOR(Change)
2001 // Sometimes truncating conversion from a tagged value to an int32.
2002 class LDoubleToI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2004 explicit LDoubleToI(LOperand* value) {
2008 LOperand* value() { return inputs_[0]; }
2010 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
2011 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2013 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2017 class LDoubleToSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2019 explicit LDoubleToSmi(LOperand* value) {
2023 LOperand* value() { return inputs_[0]; }
2025 DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi")
2026 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2030 // Truncating conversion from a tagged value to an int32.
2031 class LTaggedToI V8_FINAL : public LTemplateInstruction<1, 1, 1> {
2033 LTaggedToI(LOperand* value, LOperand* temp) {
2038 LOperand* value() { return inputs_[0]; }
2039 LOperand* temp() { return temps_[0]; }
2041 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
2042 DECLARE_HYDROGEN_ACCESSOR(Change)
2044 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2048 class LSmiTag V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2050 explicit LSmiTag(LOperand* value) {
2054 LOperand* value() { return inputs_[0]; }
2056 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2060 class LNumberUntagD V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2062 explicit LNumberUntagD(LOperand* value) {
2066 LOperand* value() { return inputs_[0]; }
2068 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2069 DECLARE_HYDROGEN_ACCESSOR(Change);
2073 class LSmiUntag V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2075 LSmiUntag(LOperand* value, bool needs_check)
2076 : needs_check_(needs_check) {
2080 LOperand* value() { return inputs_[0]; }
2081 bool needs_check() const { return needs_check_; }
2083 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2090 class LStoreNamedField V8_FINAL : public LTemplateInstruction<0, 2, 1> {
2092 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2093 inputs_[0] = object;
2098 LOperand* object() { return inputs_[0]; }
2099 LOperand* value() { return inputs_[1]; }
2100 LOperand* temp() { return temps_[0]; }
2102 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2103 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2105 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2107 Handle<Map> transition() const { return hydrogen()->transition_map(); }
2108 Representation representation() const {
2109 return hydrogen()->field_representation();
2114 class LStoreNamedGeneric V8_FINAL : public LTemplateInstruction<0, 2, 0> {
2116 LStoreNamedGeneric(LOperand* object, LOperand* value) {
2117 inputs_[0] = object;
2121 LOperand* object() { return inputs_[0]; }
2122 LOperand* value() { return inputs_[1]; }
2124 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2125 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2127 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2129 Handle<Object> name() const { return hydrogen()->name(); }
2130 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
2134 class LStoreKeyed V8_FINAL : public LTemplateInstruction<0, 3, 0> {
2136 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
2137 inputs_[0] = object;
2142 bool is_external() const { return hydrogen()->is_external(); }
2143 LOperand* elements() { return inputs_[0]; }
2144 LOperand* key() { return inputs_[1]; }
2145 LOperand* value() { return inputs_[2]; }
2146 ElementsKind elements_kind() const { return hydrogen()->elements_kind(); }
2148 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2149 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
2151 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2152 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
2153 uint32_t additional_index() const { return hydrogen()->index_offset(); }
2157 class LStoreKeyedGeneric V8_FINAL : public LTemplateInstruction<0, 3, 0> {
2159 LStoreKeyedGeneric(LOperand* object, LOperand* key, LOperand* value) {
2160 inputs_[0] = object;
2165 LOperand* object() { return inputs_[0]; }
2166 LOperand* key() { return inputs_[1]; }
2167 LOperand* value() { return inputs_[2]; }
2169 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2170 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2172 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2174 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
2178 class LTransitionElementsKind V8_FINAL : public LTemplateInstruction<0, 1, 2> {
2180 LTransitionElementsKind(LOperand* object,
2181 LOperand* new_map_temp,
2183 inputs_[0] = object;
2184 temps_[0] = new_map_temp;
2188 LOperand* object() { return inputs_[0]; }
2189 LOperand* new_map_temp() { return temps_[0]; }
2190 LOperand* temp() { return temps_[1]; }
2192 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2193 "transition-elements-kind")
2194 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2196 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2198 Handle<Map> original_map() { return hydrogen()->original_map().handle(); }
2199 Handle<Map> transitioned_map() {
2200 return hydrogen()->transitioned_map().handle();
2202 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2203 ElementsKind to_kind() { return hydrogen()->to_kind(); }
2207 class LTrapAllocationMemento V8_FINAL : public LTemplateInstruction<0, 1, 1> {
2209 LTrapAllocationMemento(LOperand* object,
2211 inputs_[0] = object;
2215 LOperand* object() { return inputs_[0]; }
2216 LOperand* temp() { return temps_[0]; }
2218 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2219 "trap-allocation-memento")
2223 class LStringAdd V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2225 LStringAdd(LOperand* left, LOperand* right) {
2230 LOperand* left() { return inputs_[0]; }
2231 LOperand* right() { return inputs_[1]; }
2233 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2234 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
2238 class LStringCharCodeAt V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2240 LStringCharCodeAt(LOperand* string, LOperand* index) {
2241 inputs_[0] = string;
2245 LOperand* string() { return inputs_[0]; }
2246 LOperand* index() { return inputs_[1]; }
2248 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2249 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
2253 class LStringCharFromCode V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2255 explicit LStringCharFromCode(LOperand* char_code) {
2256 inputs_[0] = char_code;
2259 LOperand* char_code() { return inputs_[0]; }
2261 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2262 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
2266 class LCheckValue V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2268 explicit LCheckValue(LOperand* value) {
2272 LOperand* value() { return inputs_[0]; }
2274 DECLARE_CONCRETE_INSTRUCTION(CheckValue, "check-value")
2275 DECLARE_HYDROGEN_ACCESSOR(CheckValue)
2279 class LCheckInstanceType V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2281 explicit LCheckInstanceType(LOperand* value) {
2285 LOperand* value() { return inputs_[0]; }
2287 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2288 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2292 class LCheckMaps V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2294 explicit LCheckMaps(LOperand* value) {
2298 LOperand* value() { return inputs_[0]; }
2300 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2301 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
2305 class LCheckSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2307 explicit LCheckSmi(LOperand* value) {
2311 LOperand* value() { return inputs_[0]; }
2313 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2317 class LClampDToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2319 explicit LClampDToUint8(LOperand* unclamped) {
2320 inputs_[0] = unclamped;
2323 LOperand* unclamped() { return inputs_[0]; }
2325 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2329 class LClampIToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2331 explicit LClampIToUint8(LOperand* unclamped) {
2332 inputs_[0] = unclamped;
2335 LOperand* unclamped() { return inputs_[0]; }
2337 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2341 class LClampTToUint8 V8_FINAL : public LTemplateInstruction<1, 1, 1> {
2343 LClampTToUint8(LOperand* unclamped,
2344 LOperand* temp_xmm) {
2345 inputs_[0] = unclamped;
2346 temps_[0] = temp_xmm;
2349 LOperand* unclamped() { return inputs_[0]; }
2350 LOperand* temp_xmm() { return temps_[0]; }
2352 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2356 class LCheckNonSmi V8_FINAL : public LTemplateInstruction<0, 1, 0> {
2358 explicit LCheckNonSmi(LOperand* value) {
2362 LOperand* value() { return inputs_[0]; }
2364 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2365 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject)
2369 class LAllocate V8_FINAL : public LTemplateInstruction<1, 1, 1> {
2371 LAllocate(LOperand* size, LOperand* temp) {
2376 LOperand* size() { return inputs_[0]; }
2377 LOperand* temp() { return temps_[0]; }
2379 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2380 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2384 class LRegExpLiteral V8_FINAL : public LTemplateInstruction<1, 0, 0> {
2386 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2387 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2391 class LFunctionLiteral V8_FINAL : public LTemplateInstruction<1, 0, 0> {
2393 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2394 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2398 class LToFastProperties V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2400 explicit LToFastProperties(LOperand* value) {
2404 LOperand* value() { return inputs_[0]; }
2406 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2407 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2411 class LTypeof V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2413 explicit LTypeof(LOperand* value) {
2417 LOperand* value() { return inputs_[0]; }
2419 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2423 class LTypeofIsAndBranch V8_FINAL : public LControlInstruction<1, 0> {
2425 explicit LTypeofIsAndBranch(LOperand* value) {
2429 LOperand* value() { return inputs_[0]; }
2431 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2432 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2434 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2436 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2440 class LIsConstructCallAndBranch V8_FINAL : public LControlInstruction<0, 1> {
2442 explicit LIsConstructCallAndBranch(LOperand* temp) {
2446 LOperand* temp() { return temps_[0]; }
2448 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2449 "is-construct-call-and-branch")
2450 DECLARE_HYDROGEN_ACCESSOR(IsConstructCallAndBranch)
2454 class LOsrEntry V8_FINAL : public LTemplateInstruction<0, 0, 0> {
2458 virtual bool HasInterestingComment(LCodeGen* gen) const V8_OVERRIDE {
2461 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2465 class LStackCheck V8_FINAL : public LTemplateInstruction<0, 0, 0> {
2467 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2468 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2470 Label* done_label() { return &done_label_; }
2477 class LForInPrepareMap V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2479 explicit LForInPrepareMap(LOperand* object) {
2480 inputs_[0] = object;
2483 LOperand* object() { return inputs_[0]; }
2485 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2489 class LForInCacheArray V8_FINAL : public LTemplateInstruction<1, 1, 0> {
2491 explicit LForInCacheArray(LOperand* map) {
2495 LOperand* map() { return inputs_[0]; }
2497 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2500 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2505 class LCheckMapValue V8_FINAL : public LTemplateInstruction<0, 2, 0> {
2507 LCheckMapValue(LOperand* value, LOperand* map) {
2512 LOperand* value() { return inputs_[0]; }
2513 LOperand* map() { return inputs_[1]; }
2515 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2519 class LLoadFieldByIndex V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2521 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2522 inputs_[0] = object;
2526 LOperand* object() { return inputs_[0]; }
2527 LOperand* index() { return inputs_[1]; }
2529 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2533 class LChunkBuilder;
2534 class LPlatformChunk V8_FINAL : public LChunk {
2536 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2537 : LChunk(info, graph) { }
2539 int GetNextSpillIndex(RegisterKind kind);
2540 LOperand* GetNextSpillSlot(RegisterKind kind);
2544 class LChunkBuilder V8_FINAL BASE_EMBEDDED {
2546 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2550 zone_(graph->zone()),
2552 current_instruction_(NULL),
2553 current_block_(NULL),
2556 allocator_(allocator),
2557 instruction_pending_deoptimization_environment_(NULL),
2558 pending_deoptimization_ast_id_(BailoutId::None()) { }
2560 // Build the sequence for the graph.
2561 LPlatformChunk* Build();
2563 LInstruction* CheckElideControlInstruction(HControlInstruction* instr);
2565 // Declare methods that deal with the individual node types.
2566 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2567 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2570 static HValue* SimplifiedDivisorForMathFloorOfDiv(HValue* val);
2572 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2573 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2574 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2575 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2576 LInstruction* DoMathSin(HUnaryMathOperation* instr);
2577 LInstruction* DoMathCos(HUnaryMathOperation* instr);
2578 LInstruction* DoMathTan(HUnaryMathOperation* instr);
2579 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2580 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2581 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2591 LPlatformChunk* chunk() const { return chunk_; }
2592 CompilationInfo* info() const { return info_; }
2593 HGraph* graph() const { return graph_; }
2594 Zone* zone() const { return zone_; }
2596 bool is_unused() const { return status_ == UNUSED; }
2597 bool is_building() const { return status_ == BUILDING; }
2598 bool is_done() const { return status_ == DONE; }
2599 bool is_aborted() const { return status_ == ABORTED; }
2601 void Abort(BailoutReason reason);
2603 // Methods for getting operands for Use / Define / Temp.
2604 LUnallocated* ToUnallocated(Register reg);
2605 LUnallocated* ToUnallocated(XMMRegister reg);
2607 // Methods for setting up define-use relationships.
2608 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2609 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2610 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2611 XMMRegister fixed_register);
2613 // A value that is guaranteed to be allocated to a register.
2614 // Operand created by UseRegister is guaranteed to be live until the end of
2615 // instruction. This means that register allocator will not reuse it's
2616 // register for any other operand inside instruction.
2617 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2618 // instruction start. Register allocator is free to assign the same register
2619 // to some other operand used inside instruction (i.e. temporary or
2621 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2622 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2624 // An input operand in a register that may be trashed.
2625 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2627 // An input operand in a register or stack slot.
2628 MUST_USE_RESULT LOperand* Use(HValue* value);
2629 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2631 // An input operand in a register, stack slot or a constant operand.
2632 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2633 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2635 // An input operand in a register or a constant operand.
2636 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2637 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2639 // An input operand in a constant operand.
2640 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2642 // An input operand in register, stack slot or a constant operand.
2643 // Will not be moved to a register even if one is freely available.
2644 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2646 // Temporary operand that must be in a register.
2647 MUST_USE_RESULT LUnallocated* TempRegister();
2648 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2649 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg);
2651 // Methods for setting up define-use relationships.
2652 // Return the same instruction that they are passed.
2653 template<int I, int T>
2654 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2655 LUnallocated* result);
2656 template<int I, int T>
2657 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2658 template<int I, int T>
2659 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2661 template<int I, int T>
2662 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2663 template<int I, int T>
2664 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2666 template<int I, int T>
2667 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2669 // Assigns an environment to an instruction. An instruction which can
2670 // deoptimize must have an environment.
2671 LInstruction* AssignEnvironment(LInstruction* instr);
2672 // Assigns a pointer map to an instruction. An instruction which can
2673 // trigger a GC or a lazy deoptimization must have a pointer map.
2674 LInstruction* AssignPointerMap(LInstruction* instr);
2676 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2678 // Marks a call for the register allocator. Assigns a pointer map to
2679 // support GC and lazy deoptimization. Assigns an environment to support
2680 // eager deoptimization if CAN_DEOPTIMIZE_EAGERLY.
2681 LInstruction* MarkAsCall(
2682 LInstruction* instr,
2683 HInstruction* hinstr,
2684 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2686 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2687 int* argument_index_accumulator,
2688 ZoneList<HValue*>* objects_to_materialize);
2690 void VisitInstruction(HInstruction* current);
2692 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2693 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2694 LInstruction* DoArithmeticD(Token::Value op,
2695 HArithmeticBinaryOperation* instr);
2696 LInstruction* DoArithmeticT(Token::Value op,
2697 HBinaryOperation* instr);
2699 LPlatformChunk* chunk_;
2700 CompilationInfo* info_;
2701 HGraph* const graph_;
2704 HInstruction* current_instruction_;
2705 HBasicBlock* current_block_;
2706 HBasicBlock* next_block_;
2707 int argument_count_;
2708 LAllocator* allocator_;
2709 LInstruction* instruction_pending_deoptimization_environment_;
2710 BailoutId pending_deoptimization_ast_id_;
2712 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2715 #undef DECLARE_HYDROGEN_ACCESSOR
2716 #undef DECLARE_CONCRETE_INSTRUCTION
2718 } } // namespace v8::int
2720 #endif // V8_X64_LITHIUM_X64_H_