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_IA32_LITHIUM_IA32_H_
29 #define V8_IA32_LITHIUM_IA32_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) \
57 V(CallConstantFunction) \
67 V(CheckInstanceType) \
70 V(CheckPrototypeMaps) \
75 V(ClassOfTestAndBranch) \
77 V(CmpObjectEqAndBranch) \
80 V(CmpConstantEqAndBranch) \
92 V(FixedArrayBaseLength) \
94 V(GetCachedArrayIndex) \
98 V(HasCachedArrayIndexAndBranch) \
99 V(HasInstanceTypeAndBranch) \
102 V(InstanceOfKnownGlobal) \
104 V(Integer32ToDouble) \
106 V(IsConstructCallAndBranch) \
108 V(IsObjectAndBranch) \
109 V(IsStringAndBranch) \
111 V(IsUndetectableAndBranch) \
112 V(StringCompareAndBranch) \
118 V(LoadExternalArrayPointer) \
119 V(LoadFunctionPrototype) \
121 V(LoadGlobalGeneric) \
122 V(LoadKeyedFastElement) \
123 V(LoadKeyedFastDoubleElement) \
124 V(LoadKeyedGeneric) \
125 V(LoadKeyedSpecializedArrayElement) \
127 V(LoadNamedFieldPolymorphic) \
128 V(LoadNamedGeneric) \
148 V(StoreContextSlot) \
150 V(StoreGlobalGeneric) \
151 V(StoreKeyedFastDoubleElement) \
152 V(StoreKeyedFastElement) \
153 V(StoreKeyedGeneric) \
154 V(StoreKeyedSpecializedArrayElement) \
156 V(StoreNamedGeneric) \
158 V(StringCharCodeAt) \
159 V(StringCharFromCode) \
165 V(ToFastProperties) \
166 V(TransitionElementsKind) \
168 V(TypeofIsAndBranch) \
169 V(UnaryMathOperation) \
175 V(LoadFieldByIndex) \
181 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
182 virtual Opcode opcode() const { return LInstruction::k##type; } \
183 virtual void CompileToNative(LCodeGen* generator); \
184 virtual const char* Mnemonic() const { return mnemonic; } \
185 static L##type* cast(LInstruction* instr) { \
186 ASSERT(instr->Is##type()); \
187 return reinterpret_cast<L##type*>(instr); \
191 #define DECLARE_HYDROGEN_ACCESSOR(type) \
192 H##type* hydrogen() const { \
193 return H##type::cast(hydrogen_value()); \
197 class LInstruction: public ZoneObject {
200 : environment_(NULL),
201 hydrogen_value_(NULL),
203 virtual ~LInstruction() { }
205 virtual void CompileToNative(LCodeGen* generator) = 0;
206 virtual const char* Mnemonic() const = 0;
207 virtual void PrintTo(StringStream* stream);
208 virtual void PrintDataTo(StringStream* stream);
209 virtual void PrintOutputOperandTo(StringStream* stream);
212 // Declare a unique enum value for each instruction.
213 #define DECLARE_OPCODE(type) k##type,
214 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
215 kNumberOfInstructions
216 #undef DECLARE_OPCODE
219 virtual Opcode opcode() const = 0;
221 // Declare non-virtual type testers for all leaf IR classes.
222 #define DECLARE_PREDICATE(type) \
223 bool Is##type() const { return opcode() == k##type; }
224 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
225 #undef DECLARE_PREDICATE
227 // Declare virtual predicates for instructions that don't have
229 virtual bool IsGap() const { return false; }
231 virtual bool IsControl() const { return false; }
233 void set_environment(LEnvironment* env) { environment_ = env; }
234 LEnvironment* environment() const { return environment_; }
235 bool HasEnvironment() const { return environment_ != NULL; }
237 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
238 LPointerMap* pointer_map() const { return pointer_map_.get(); }
239 bool HasPointerMap() const { return pointer_map_.is_set(); }
242 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
243 HValue* hydrogen_value() const { return hydrogen_value_; }
245 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
247 void MarkAsCall() { is_call_ = true; }
249 // Interface to the register allocator and iterators.
250 bool IsMarkedAsCall() const { return is_call_; }
252 virtual bool HasResult() const = 0;
253 virtual LOperand* result() = 0;
255 virtual int InputCount() = 0;
256 virtual LOperand* InputAt(int i) = 0;
257 virtual int TempCount() = 0;
258 virtual LOperand* TempAt(int i) = 0;
260 LOperand* FirstInput() { return InputAt(0); }
261 LOperand* Output() { return HasResult() ? result() : NULL; }
268 LEnvironment* environment_;
269 SetOncePointer<LPointerMap> pointer_map_;
270 HValue* hydrogen_value_;
275 // R = number of result operands (0 or 1).
276 // I = number of input operands.
277 // T = number of temporary operands.
278 template<int R, int I, int T>
279 class LTemplateInstruction: public LInstruction {
281 // Allow 0 or 1 output operands.
282 STATIC_ASSERT(R == 0 || R == 1);
283 virtual bool HasResult() const { return R != 0; }
284 void set_result(LOperand* operand) { results_[0] = operand; }
285 LOperand* result() { return results_[0]; }
287 int InputCount() { return I; }
288 LOperand* InputAt(int i) { return inputs_[i]; }
290 int TempCount() { return T; }
291 LOperand* TempAt(int i) { return temps_[i]; }
294 EmbeddedContainer<LOperand*, R> results_;
295 EmbeddedContainer<LOperand*, I> inputs_;
296 EmbeddedContainer<LOperand*, T> temps_;
300 class LGap: public LTemplateInstruction<0, 0, 0> {
302 explicit LGap(HBasicBlock* block) : block_(block) {
303 parallel_moves_[BEFORE] = NULL;
304 parallel_moves_[START] = NULL;
305 parallel_moves_[END] = NULL;
306 parallel_moves_[AFTER] = NULL;
309 // Can't use the DECLARE-macro here because of sub-classes.
310 virtual bool IsGap() const { return true; }
311 virtual void PrintDataTo(StringStream* stream);
312 static LGap* cast(LInstruction* instr) {
313 ASSERT(instr->IsGap());
314 return reinterpret_cast<LGap*>(instr);
317 bool IsRedundant() const;
319 HBasicBlock* block() const { return block_; }
326 FIRST_INNER_POSITION = BEFORE,
327 LAST_INNER_POSITION = AFTER
330 LParallelMove* GetOrCreateParallelMove(InnerPosition pos) {
331 if (parallel_moves_[pos] == NULL) parallel_moves_[pos] = new LParallelMove;
332 return parallel_moves_[pos];
335 LParallelMove* GetParallelMove(InnerPosition pos) {
336 return parallel_moves_[pos];
340 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
345 class LInstructionGap: public LGap {
347 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
349 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
353 class LGoto: public LTemplateInstruction<0, 0, 0> {
355 explicit LGoto(int block_id) : block_id_(block_id) { }
357 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
358 virtual void PrintDataTo(StringStream* stream);
359 virtual bool IsControl() const { return true; }
361 int block_id() const { return block_id_; }
368 class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
370 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
374 class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
376 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
380 class LLabel: public LGap {
382 explicit LLabel(HBasicBlock* block)
383 : LGap(block), replacement_(NULL) { }
385 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
387 virtual void PrintDataTo(StringStream* stream);
389 int block_id() const { return block()->block_id(); }
390 bool is_loop_header() const { return block()->IsLoopHeader(); }
391 Label* label() { return &label_; }
392 LLabel* replacement() const { return replacement_; }
393 void set_replacement(LLabel* label) { replacement_ = label; }
394 bool HasReplacement() const { return replacement_ != NULL; }
398 LLabel* replacement_;
402 class LParameter: public LTemplateInstruction<1, 0, 0> {
404 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
408 class LCallStub: public LTemplateInstruction<1, 1, 0> {
410 explicit LCallStub(LOperand* context) {
411 inputs_[0] = context;
414 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
415 DECLARE_HYDROGEN_ACCESSOR(CallStub)
417 LOperand* context() { return inputs_[0]; }
419 TranscendentalCache::Type transcendental_type() {
420 return hydrogen()->transcendental_type();
425 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
427 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
431 template<int I, int T>
432 class LControlInstruction: public LTemplateInstruction<0, I, T> {
434 virtual bool IsControl() const { return true; }
436 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
437 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
438 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
439 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
442 HControlInstruction* hydrogen() {
443 return HControlInstruction::cast(this->hydrogen_value());
448 class LWrapReceiver: public LTemplateInstruction<1, 2, 1> {
450 LWrapReceiver(LOperand* receiver,
453 inputs_[0] = receiver;
454 inputs_[1] = function;
458 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
460 LOperand* receiver() { return inputs_[0]; }
461 LOperand* function() { return inputs_[1]; }
465 class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
467 LApplyArguments(LOperand* function,
470 LOperand* elements) {
471 inputs_[0] = function;
472 inputs_[1] = receiver;
474 inputs_[3] = elements;
477 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
479 LOperand* function() { return inputs_[0]; }
480 LOperand* receiver() { return inputs_[1]; }
481 LOperand* length() { return inputs_[2]; }
482 LOperand* elements() { return inputs_[3]; }
486 class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
488 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
489 inputs_[0] = arguments;
494 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
496 LOperand* arguments() { return inputs_[0]; }
497 LOperand* length() { return inputs_[1]; }
498 LOperand* index() { return inputs_[2]; }
500 virtual void PrintDataTo(StringStream* stream);
504 class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
506 explicit LArgumentsLength(LOperand* elements) {
507 inputs_[0] = elements;
510 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
514 class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
516 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
517 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
521 class LModI: public LTemplateInstruction<1, 2, 1> {
523 LModI(LOperand* left, LOperand* right, LOperand* temp) {
529 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
530 DECLARE_HYDROGEN_ACCESSOR(Mod)
534 class LDivI: public LTemplateInstruction<1, 2, 1> {
536 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
542 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
543 DECLARE_HYDROGEN_ACCESSOR(Div)
547 class LMulI: public LTemplateInstruction<1, 2, 1> {
549 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
555 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
556 DECLARE_HYDROGEN_ACCESSOR(Mul)
560 class LCmpIDAndBranch: public LControlInstruction<2, 0> {
562 LCmpIDAndBranch(LOperand* left, LOperand* right) {
567 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
568 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
570 Token::Value op() const { return hydrogen()->token(); }
571 bool is_double() const {
572 return hydrogen()->GetInputRepresentation().IsDouble();
575 virtual void PrintDataTo(StringStream* stream);
579 class LUnaryMathOperation: public LTemplateInstruction<1, 2, 0> {
581 LUnaryMathOperation(LOperand* context, LOperand* value) {
582 inputs_[1] = context;
586 LOperand* context() { return inputs_[1]; }
587 LOperand* value() { return inputs_[0]; }
589 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
590 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
592 virtual void PrintDataTo(StringStream* stream);
593 BuiltinFunctionId op() const { return hydrogen()->op(); }
597 class LMathPowHalf: public LTemplateInstruction<1, 2, 1> {
599 LMathPowHalf(LOperand* context, LOperand* value, LOperand* temp) {
600 inputs_[1] = context;
605 LOperand* context() { return inputs_[1]; }
606 LOperand* value() { return inputs_[0]; }
607 LOperand* temp() { return temps_[0]; }
609 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
611 virtual void PrintDataTo(StringStream* stream);
615 class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
617 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
622 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
623 "cmp-object-eq-and-branch")
627 class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
629 explicit LCmpConstantEqAndBranch(LOperand* left) {
633 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
634 "cmp-constant-eq-and-branch")
635 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
639 class LIsNilAndBranch: public LControlInstruction<1, 1> {
641 LIsNilAndBranch(LOperand* value, LOperand* temp) {
646 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
647 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
649 EqualityKind kind() const { return hydrogen()->kind(); }
650 NilValue nil() const { return hydrogen()->nil(); }
652 virtual void PrintDataTo(StringStream* stream);
656 class LIsObjectAndBranch: public LControlInstruction<1, 1> {
658 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
663 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
665 virtual void PrintDataTo(StringStream* stream);
669 class LIsStringAndBranch: public LControlInstruction<1, 1> {
671 LIsStringAndBranch(LOperand* value, LOperand* temp) {
676 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
678 virtual void PrintDataTo(StringStream* stream);
682 class LIsSmiAndBranch: public LControlInstruction<1, 0> {
684 explicit LIsSmiAndBranch(LOperand* value) {
688 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
689 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
691 virtual void PrintDataTo(StringStream* stream);
695 class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
697 LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
702 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
703 "is-undetectable-and-branch")
705 virtual void PrintDataTo(StringStream* stream);
709 class LStringCompareAndBranch: public LControlInstruction<3, 0> {
711 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) {
712 inputs_[0] = context;
717 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
718 "string-compare-and-branch")
719 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
721 virtual void PrintDataTo(StringStream* stream);
723 Token::Value op() const { return hydrogen()->token(); }
727 class LHasInstanceTypeAndBranch: public LControlInstruction<1, 1> {
729 LHasInstanceTypeAndBranch(LOperand* value, LOperand* temp) {
734 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
735 "has-instance-type-and-branch")
736 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
738 virtual void PrintDataTo(StringStream* stream);
742 class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
744 explicit LGetCachedArrayIndex(LOperand* value) {
748 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
749 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
753 class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
755 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
759 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
760 "has-cached-array-index-and-branch")
761 virtual void PrintDataTo(StringStream* stream);
765 class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
767 explicit LIsConstructCallAndBranch(LOperand* temp) {
771 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
772 "is-construct-call-and-branch")
776 class LClassOfTestAndBranch: public LControlInstruction<1, 2> {
778 LClassOfTestAndBranch(LOperand* value, LOperand* temp, LOperand* temp2) {
784 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
785 "class-of-test-and-branch")
786 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
788 virtual void PrintDataTo(StringStream* stream);
792 class LCmpT: public LTemplateInstruction<1, 3, 0> {
794 LCmpT(LOperand* context, LOperand* left, LOperand* right) {
795 inputs_[0] = context;
800 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
801 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
803 Token::Value op() const { return hydrogen()->token(); }
807 class LInstanceOf: public LTemplateInstruction<1, 3, 0> {
809 LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
810 inputs_[0] = context;
815 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
817 LOperand* context() { return inputs_[0]; }
821 class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 2, 1> {
823 LInstanceOfKnownGlobal(LOperand* context, LOperand* value, LOperand* temp) {
824 inputs_[0] = context;
829 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
830 "instance-of-known-global")
831 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
833 Handle<JSFunction> function() const { return hydrogen()->function(); }
834 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
835 return lazy_deopt_env_;
837 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
838 lazy_deopt_env_ = env;
842 LEnvironment* lazy_deopt_env_;
846 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
848 LBoundsCheck(LOperand* index, LOperand* length) {
853 LOperand* index() { return inputs_[0]; }
854 LOperand* length() { return inputs_[1]; }
856 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
860 class LBitI: public LTemplateInstruction<1, 2, 0> {
862 LBitI(LOperand* left, LOperand* right) {
867 Token::Value op() const { return hydrogen()->op(); }
869 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
870 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
874 class LShiftI: public LTemplateInstruction<1, 2, 0> {
876 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
877 : op_(op), can_deopt_(can_deopt) {
882 Token::Value op() const { return op_; }
884 bool can_deopt() const { return can_deopt_; }
886 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
894 class LSubI: public LTemplateInstruction<1, 2, 0> {
896 LSubI(LOperand* left, LOperand* right) {
901 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
902 DECLARE_HYDROGEN_ACCESSOR(Sub)
906 class LConstantI: public LTemplateInstruction<1, 0, 0> {
908 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
909 DECLARE_HYDROGEN_ACCESSOR(Constant)
911 int32_t value() const { return hydrogen()->Integer32Value(); }
915 class LConstantD: public LTemplateInstruction<1, 0, 1> {
917 explicit LConstantD(LOperand* temp) {
921 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
922 DECLARE_HYDROGEN_ACCESSOR(Constant)
924 double value() const { return hydrogen()->DoubleValue(); }
928 class LConstantT: public LTemplateInstruction<1, 0, 0> {
930 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
931 DECLARE_HYDROGEN_ACCESSOR(Constant)
933 Handle<Object> value() const { return hydrogen()->handle(); }
937 class LBranch: public LControlInstruction<1, 1> {
939 explicit LBranch(LOperand* value, LOperand* temp) {
944 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
945 DECLARE_HYDROGEN_ACCESSOR(Branch)
947 virtual void PrintDataTo(StringStream* stream);
951 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 0> {
953 explicit LCmpMapAndBranch(LOperand* value) {
957 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
958 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
960 virtual bool IsControl() const { return true; }
962 Handle<Map> map() const { return hydrogen()->map(); }
963 int true_block_id() const {
964 return hydrogen()->FirstSuccessor()->block_id();
966 int false_block_id() const {
967 return hydrogen()->SecondSuccessor()->block_id();
972 class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
974 explicit LJSArrayLength(LOperand* value) {
978 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
979 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
983 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
985 explicit LFixedArrayBaseLength(LOperand* value) {
989 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
990 "fixed-array-base-length")
991 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
995 class LElementsKind: public LTemplateInstruction<1, 1, 0> {
997 explicit LElementsKind(LOperand* value) {
1001 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1002 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1006 class LValueOf: public LTemplateInstruction<1, 1, 1> {
1008 LValueOf(LOperand* value, LOperand* temp) {
1013 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1014 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1018 class LDateField: public LTemplateInstruction<1, 1, 1> {
1020 LDateField(LOperand* date, LOperand* temp, Smi* index)
1026 DECLARE_CONCRETE_INSTRUCTION(DateField, "date-field")
1027 DECLARE_HYDROGEN_ACCESSOR(DateField)
1029 Smi* index() const { return index_; }
1036 class LThrow: public LTemplateInstruction<0, 2, 0> {
1038 LThrow(LOperand* context, LOperand* value) {
1039 inputs_[0] = context;
1043 LOperand* context() { return inputs_[0]; }
1044 LOperand* value() { return inputs_[1]; }
1046 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1050 class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1052 explicit LBitNotI(LOperand* value) {
1056 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1060 class LAddI: public LTemplateInstruction<1, 2, 0> {
1062 LAddI(LOperand* left, LOperand* right) {
1067 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1068 DECLARE_HYDROGEN_ACCESSOR(Add)
1072 class LPower: public LTemplateInstruction<1, 2, 0> {
1074 LPower(LOperand* left, LOperand* right) {
1079 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1080 DECLARE_HYDROGEN_ACCESSOR(Power)
1084 class LRandom: public LTemplateInstruction<1, 1, 0> {
1086 explicit LRandom(LOperand* global_object) {
1087 inputs_[0] = global_object;
1090 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1091 DECLARE_HYDROGEN_ACCESSOR(Random)
1095 class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1097 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1103 Token::Value op() const { return op_; }
1105 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1106 virtual void CompileToNative(LCodeGen* generator);
1107 virtual const char* Mnemonic() const;
1114 class LArithmeticT: public LTemplateInstruction<1, 3, 0> {
1116 LArithmeticT(Token::Value op,
1121 inputs_[0] = context;
1126 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1127 virtual void CompileToNative(LCodeGen* generator);
1128 virtual const char* Mnemonic() const;
1130 Token::Value op() const { return op_; }
1131 LOperand* context() { return inputs_[0]; }
1132 LOperand* left() { return inputs_[1]; }
1133 LOperand* right() { return inputs_[2]; }
1140 class LReturn: public LTemplateInstruction<0, 1, 0> {
1142 explicit LReturn(LOperand* value) {
1146 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1150 class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1152 explicit LLoadNamedField(LOperand* object) {
1153 inputs_[0] = object;
1156 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1157 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1159 LOperand* object() { return inputs_[0]; }
1163 class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 2, 0> {
1165 LLoadNamedFieldPolymorphic(LOperand* context, LOperand* object) {
1166 inputs_[0] = context;
1167 inputs_[1] = object;
1170 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1171 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
1173 LOperand* context() { return inputs_[0]; }
1174 LOperand* object() { return inputs_[1]; }
1178 class LLoadNamedGeneric: public LTemplateInstruction<1, 2, 0> {
1180 LLoadNamedGeneric(LOperand* context, LOperand* object) {
1181 inputs_[0] = context;
1182 inputs_[1] = object;
1185 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1186 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1188 LOperand* context() { return inputs_[0]; }
1189 LOperand* object() { return inputs_[1]; }
1190 Handle<Object> name() const { return hydrogen()->name(); }
1194 class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 1> {
1196 LLoadFunctionPrototype(LOperand* function, LOperand* temp) {
1197 inputs_[0] = function;
1201 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1202 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1204 LOperand* function() { return inputs_[0]; }
1208 class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1210 explicit LLoadElements(LOperand* object) {
1211 inputs_[0] = object;
1214 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1218 class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1220 explicit LLoadExternalArrayPointer(LOperand* object) {
1221 inputs_[0] = object;
1224 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1225 "load-external-array-pointer")
1229 class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> {
1231 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1232 inputs_[0] = elements;
1236 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1237 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1239 LOperand* elements() { return inputs_[0]; }
1240 LOperand* key() { return inputs_[1]; }
1241 uint32_t additional_index() const { return hydrogen()->index_offset(); }
1245 class LLoadKeyedFastDoubleElement: public LTemplateInstruction<1, 2, 0> {
1247 LLoadKeyedFastDoubleElement(LOperand* elements, LOperand* key) {
1248 inputs_[0] = elements;
1252 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement,
1253 "load-keyed-fast-double-element")
1254 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastDoubleElement)
1256 LOperand* elements() { return inputs_[0]; }
1257 LOperand* key() { return inputs_[1]; }
1258 uint32_t additional_index() const { return hydrogen()->index_offset(); }
1262 class LLoadKeyedSpecializedArrayElement: public LTemplateInstruction<1, 2, 0> {
1264 LLoadKeyedSpecializedArrayElement(LOperand* external_pointer, LOperand* key) {
1265 inputs_[0] = external_pointer;
1269 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement,
1270 "load-keyed-specialized-array-element")
1271 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedSpecializedArrayElement)
1273 LOperand* external_pointer() { return inputs_[0]; }
1274 LOperand* key() { return inputs_[1]; }
1275 ElementsKind elements_kind() const {
1276 return hydrogen()->elements_kind();
1278 uint32_t additional_index() const { return hydrogen()->index_offset(); }
1282 class LLoadKeyedGeneric: public LTemplateInstruction<1, 3, 0> {
1284 LLoadKeyedGeneric(LOperand* context, LOperand* obj, LOperand* key) {
1285 inputs_[0] = context;
1290 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1292 LOperand* context() { return inputs_[0]; }
1293 LOperand* object() { return inputs_[1]; }
1294 LOperand* key() { return inputs_[2]; }
1298 class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1300 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1301 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1305 class LLoadGlobalGeneric: public LTemplateInstruction<1, 2, 0> {
1307 LLoadGlobalGeneric(LOperand* context, LOperand* global_object) {
1308 inputs_[0] = context;
1309 inputs_[1] = global_object;
1312 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1313 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1315 LOperand* context() { return inputs_[0]; }
1316 LOperand* global_object() { return inputs_[1]; }
1317 Handle<Object> name() const { return hydrogen()->name(); }
1318 bool for_typeof() const { return hydrogen()->for_typeof(); }
1322 class LStoreGlobalCell: public LTemplateInstruction<0, 1, 0> {
1324 explicit LStoreGlobalCell(LOperand* value) {
1328 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1329 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1331 LOperand* value() { return inputs_[0]; }
1335 class LStoreGlobalGeneric: public LTemplateInstruction<0, 3, 0> {
1337 LStoreGlobalGeneric(LOperand* context,
1338 LOperand* global_object,
1340 inputs_[0] = context;
1341 inputs_[1] = global_object;
1345 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1346 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1348 LOperand* context() { return InputAt(0); }
1349 LOperand* global_object() { return InputAt(1); }
1350 Handle<Object> name() const { return hydrogen()->name(); }
1351 LOperand* value() { return InputAt(2); }
1352 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
1356 class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1358 explicit LLoadContextSlot(LOperand* context) {
1359 inputs_[0] = context;
1362 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1363 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1365 LOperand* context() { return InputAt(0); }
1366 int slot_index() { return hydrogen()->slot_index(); }
1368 virtual void PrintDataTo(StringStream* stream);
1372 class LStoreContextSlot: public LTemplateInstruction<0, 2, 1> {
1374 LStoreContextSlot(LOperand* context, LOperand* value, LOperand* temp) {
1375 inputs_[0] = context;
1380 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1381 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1383 LOperand* context() { return InputAt(0); }
1384 LOperand* value() { return InputAt(1); }
1385 int slot_index() { return hydrogen()->slot_index(); }
1387 virtual void PrintDataTo(StringStream* stream);
1391 class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1393 explicit LPushArgument(LOperand* value) {
1397 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1401 class LDrop: public LTemplateInstruction<0, 0, 0> {
1403 explicit LDrop(int count) : count_(count) { }
1405 int count() const { return count_; }
1407 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1414 class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1416 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1417 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1421 class LContext: public LTemplateInstruction<1, 0, 0> {
1423 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1427 class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1429 explicit LOuterContext(LOperand* context) {
1430 inputs_[0] = context;
1433 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
1435 LOperand* context() { return InputAt(0); }
1439 class LDeclareGlobals: public LTemplateInstruction<0, 1, 0> {
1441 explicit LDeclareGlobals(LOperand* context) {
1442 inputs_[0] = context;
1445 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1446 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1450 class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1452 explicit LGlobalObject(LOperand* context, bool qml_global) {
1453 inputs_[0] = context;
1454 qml_global_ = qml_global;
1457 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1459 LOperand* context() { return InputAt(0); }
1460 bool qml_global() { return qml_global_; }
1466 class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1468 explicit LGlobalReceiver(LOperand* global_object) {
1469 inputs_[0] = global_object;
1472 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1474 LOperand* global() { return InputAt(0); }
1478 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1480 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1481 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1483 virtual void PrintDataTo(StringStream* stream);
1485 Handle<JSFunction> function() { return hydrogen()->function(); }
1486 int arity() const { return hydrogen()->argument_count() - 1; }
1490 class LInvokeFunction: public LTemplateInstruction<1, 2, 0> {
1492 LInvokeFunction(LOperand* context, LOperand* function) {
1493 inputs_[0] = context;
1494 inputs_[1] = function;
1497 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1498 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1500 LOperand* context() { return inputs_[0]; }
1501 LOperand* function() { return inputs_[1]; }
1503 virtual void PrintDataTo(StringStream* stream);
1505 int arity() const { return hydrogen()->argument_count() - 1; }
1506 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
1510 class LCallKeyed: public LTemplateInstruction<1, 2, 0> {
1512 LCallKeyed(LOperand* context, LOperand* key) {
1513 inputs_[0] = context;
1517 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1518 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1520 LOperand* context() { return inputs_[0]; }
1521 LOperand* key() { return inputs_[1]; }
1523 virtual void PrintDataTo(StringStream* stream);
1525 int arity() const { return hydrogen()->argument_count() - 1; }
1529 class LCallNamed: public LTemplateInstruction<1, 1, 0> {
1531 explicit LCallNamed(LOperand* context) {
1532 inputs_[0] = context;
1535 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1536 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1538 virtual void PrintDataTo(StringStream* stream);
1540 LOperand* context() { return inputs_[0]; }
1541 Handle<String> name() const { return hydrogen()->name(); }
1542 int arity() const { return hydrogen()->argument_count() - 1; }
1546 class LCallFunction: public LTemplateInstruction<1, 2, 0> {
1548 explicit LCallFunction(LOperand* context, LOperand* function) {
1549 inputs_[0] = context;
1550 inputs_[1] = function;
1553 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1554 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1556 LOperand* context() { return inputs_[0]; }
1557 LOperand* function() { return inputs_[1]; }
1558 int arity() const { return hydrogen()->argument_count() - 1; }
1562 class LCallGlobal: public LTemplateInstruction<1, 1, 0> {
1564 explicit LCallGlobal(LOperand* context, bool qml_global) : qml_global_(qml_global) {
1565 inputs_[0] = context;
1568 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1569 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1571 virtual void PrintDataTo(StringStream* stream);
1573 LOperand* context() { return inputs_[0]; }
1574 Handle<String> name() const {return hydrogen()->name(); }
1575 int arity() const { return hydrogen()->argument_count() - 1; }
1577 bool qml_global() { return qml_global_; }
1583 class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1585 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1586 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1588 virtual void PrintDataTo(StringStream* stream);
1590 Handle<JSFunction> target() const { return hydrogen()->target(); }
1591 int arity() const { return hydrogen()->argument_count() - 1; }
1595 class LCallNew: public LTemplateInstruction<1, 2, 0> {
1597 LCallNew(LOperand* context, LOperand* constructor) {
1598 inputs_[0] = context;
1599 inputs_[1] = constructor;
1602 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1603 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1605 virtual void PrintDataTo(StringStream* stream);
1607 LOperand* context() { return inputs_[0]; }
1608 LOperand* constructor() { return inputs_[1]; }
1609 int arity() const { return hydrogen()->argument_count() - 1; }
1613 class LCallRuntime: public LTemplateInstruction<1, 1, 0> {
1615 explicit LCallRuntime(LOperand* context) {
1616 inputs_[0] = context;
1618 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1619 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1621 LOperand* context() { return inputs_[0]; }
1622 const Runtime::Function* function() const { return hydrogen()->function(); }
1623 int arity() const { return hydrogen()->argument_count(); }
1627 class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1629 explicit LInteger32ToDouble(LOperand* value) {
1633 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1637 class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1639 explicit LNumberTagI(LOperand* value) {
1643 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1647 class LNumberTagD: public LTemplateInstruction<1, 1, 1> {
1649 LNumberTagD(LOperand* value, LOperand* temp) {
1654 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1658 // Sometimes truncating conversion from a tagged value to an int32.
1659 class LDoubleToI: public LTemplateInstruction<1, 1, 1> {
1661 LDoubleToI(LOperand* value, LOperand* temp) {
1666 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1667 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1669 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1673 // Truncating conversion from a tagged value to an int32.
1674 class LTaggedToI: public LTemplateInstruction<1, 1, 1> {
1676 LTaggedToI(LOperand* value, LOperand* temp) {
1681 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1682 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1684 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1688 class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1690 explicit LSmiTag(LOperand* value) {
1694 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1698 class LNumberUntagD: public LTemplateInstruction<1, 1, 1> {
1700 explicit LNumberUntagD(LOperand* value, LOperand* temp) {
1705 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1706 DECLARE_HYDROGEN_ACCESSOR(Change);
1710 class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1712 LSmiUntag(LOperand* value, bool needs_check)
1713 : needs_check_(needs_check) {
1717 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1719 bool needs_check() const { return needs_check_; }
1726 class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
1728 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) {
1734 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1735 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1737 virtual void PrintDataTo(StringStream* stream);
1739 LOperand* object() { return inputs_[0]; }
1740 LOperand* value() { return inputs_[1]; }
1742 Handle<Object> name() const { return hydrogen()->name(); }
1743 bool is_in_object() { return hydrogen()->is_in_object(); }
1744 int offset() { return hydrogen()->offset(); }
1745 Handle<Map> transition() const { return hydrogen()->transition(); }
1749 class LStoreNamedGeneric: public LTemplateInstruction<0, 3, 0> {
1751 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value) {
1752 inputs_[0] = context;
1753 inputs_[1] = object;
1757 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1758 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1760 virtual void PrintDataTo(StringStream* stream);
1762 LOperand* context() { return inputs_[0]; }
1763 LOperand* object() { return inputs_[1]; }
1764 LOperand* value() { return inputs_[2]; }
1765 Handle<Object> name() const { return hydrogen()->name(); }
1766 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
1770 class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
1772 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
1778 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1779 "store-keyed-fast-element")
1780 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1782 virtual void PrintDataTo(StringStream* stream);
1784 LOperand* object() { return inputs_[0]; }
1785 LOperand* key() { return inputs_[1]; }
1786 LOperand* value() { return inputs_[2]; }
1787 uint32_t additional_index() const { return hydrogen()->index_offset(); }
1791 class LStoreKeyedFastDoubleElement: public LTemplateInstruction<0, 3, 0> {
1793 LStoreKeyedFastDoubleElement(LOperand* elements,
1796 inputs_[0] = elements;
1801 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement,
1802 "store-keyed-fast-double-element")
1803 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastDoubleElement)
1805 virtual void PrintDataTo(StringStream* stream);
1807 LOperand* elements() { return inputs_[0]; }
1808 LOperand* key() { return inputs_[1]; }
1809 LOperand* value() { return inputs_[2]; }
1810 uint32_t additional_index() const { return hydrogen()->index_offset(); }
1812 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
1816 class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> {
1818 LStoreKeyedSpecializedArrayElement(LOperand* external_pointer,
1821 inputs_[0] = external_pointer;
1826 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
1827 "store-keyed-specialized-array-element")
1828 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement)
1830 LOperand* external_pointer() { return inputs_[0]; }
1831 LOperand* key() { return inputs_[1]; }
1832 LOperand* value() { return inputs_[2]; }
1833 ElementsKind elements_kind() const {
1834 return hydrogen()->elements_kind();
1836 uint32_t additional_index() const { return hydrogen()->index_offset(); }
1840 class LStoreKeyedGeneric: public LTemplateInstruction<0, 4, 0> {
1842 LStoreKeyedGeneric(LOperand* context,
1846 inputs_[0] = context;
1847 inputs_[1] = object;
1852 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1853 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1855 virtual void PrintDataTo(StringStream* stream);
1857 LOperand* context() { return inputs_[0]; }
1858 LOperand* object() { return inputs_[1]; }
1859 LOperand* key() { return inputs_[2]; }
1860 LOperand* value() { return inputs_[3]; }
1861 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
1865 class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1867 LTransitionElementsKind(LOperand* object,
1868 LOperand* new_map_temp,
1869 LOperand* temp_reg) {
1870 inputs_[0] = object;
1871 temps_[0] = new_map_temp;
1872 temps_[1] = temp_reg;
1875 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1876 "transition-elements-kind")
1877 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1879 virtual void PrintDataTo(StringStream* stream);
1881 LOperand* object() { return inputs_[0]; }
1882 LOperand* new_map_reg() { return temps_[0]; }
1883 LOperand* temp_reg() { return temps_[1]; }
1884 Handle<Map> original_map() { return hydrogen()->original_map(); }
1885 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
1889 class LStringAdd: public LTemplateInstruction<1, 3, 0> {
1891 LStringAdd(LOperand* context, LOperand* left, LOperand* right) {
1892 inputs_[0] = context;
1897 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1898 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
1900 LOperand* context() { return inputs_[0]; }
1901 LOperand* left() { return inputs_[1]; }
1902 LOperand* right() { return inputs_[2]; }
1906 class LStringCharCodeAt: public LTemplateInstruction<1, 3, 0> {
1908 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) {
1909 inputs_[0] = context;
1910 inputs_[1] = string;
1914 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1915 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
1917 LOperand* context() { return inputs_[0]; }
1918 LOperand* string() { return inputs_[1]; }
1919 LOperand* index() { return inputs_[2]; }
1923 class LStringCharFromCode: public LTemplateInstruction<1, 2, 0> {
1925 LStringCharFromCode(LOperand* context, LOperand* char_code) {
1926 inputs_[0] = context;
1927 inputs_[1] = char_code;
1930 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
1931 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
1933 LOperand* context() { return inputs_[0]; }
1934 LOperand* char_code() { return inputs_[1]; }
1938 class LStringLength: public LTemplateInstruction<1, 1, 0> {
1940 explicit LStringLength(LOperand* string) {
1941 inputs_[0] = string;
1944 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1945 DECLARE_HYDROGEN_ACCESSOR(StringLength)
1947 LOperand* string() { return inputs_[0]; }
1951 class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
1953 explicit LCheckFunction(LOperand* value) {
1957 LOperand* value() { return inputs_[0]; }
1959 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1960 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1964 class LCheckInstanceType: public LTemplateInstruction<0, 1, 1> {
1966 LCheckInstanceType(LOperand* value, LOperand* temp) {
1971 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1972 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
1976 class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
1978 explicit LCheckMaps(LOperand* value) {
1982 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
1983 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
1987 class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> {
1989 explicit LCheckPrototypeMaps(LOperand* temp) {
1993 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1994 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1996 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1997 Handle<JSObject> holder() const { return hydrogen()->holder(); }
2001 class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2003 explicit LCheckSmi(LOperand* value) {
2007 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2011 class LClampDToUint8: public LTemplateInstruction<1, 1, 0> {
2013 explicit LClampDToUint8(LOperand* value) {
2017 LOperand* unclamped() { return inputs_[0]; }
2019 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2023 class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2025 explicit LClampIToUint8(LOperand* value) {
2029 LOperand* unclamped() { return inputs_[0]; }
2031 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2035 class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2037 LClampTToUint8(LOperand* value, LOperand* temp) {
2042 LOperand* unclamped() { return inputs_[0]; }
2044 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2048 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2050 explicit LCheckNonSmi(LOperand* value) {
2054 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2058 class LAllocateObject: public LTemplateInstruction<1, 1, 1> {
2060 LAllocateObject(LOperand* context, LOperand* temp) {
2061 inputs_[0] = context;
2065 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2066 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2068 LOperand* context() { return inputs_[0]; }
2072 class LFastLiteral: public LTemplateInstruction<1, 1, 0> {
2074 explicit LFastLiteral(LOperand* context) {
2075 inputs_[0] = context;
2078 LOperand* context() { return inputs_[0]; }
2080 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2081 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2085 class LArrayLiteral: public LTemplateInstruction<1, 1, 0> {
2087 explicit LArrayLiteral(LOperand* context) {
2088 inputs_[0] = context;
2091 LOperand* context() { return inputs_[0]; }
2093 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2094 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2098 class LObjectLiteral: public LTemplateInstruction<1, 1, 0> {
2100 explicit LObjectLiteral(LOperand* context) {
2101 inputs_[0] = context;
2104 LOperand* context() { return inputs_[0]; }
2106 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2107 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
2111 class LRegExpLiteral: public LTemplateInstruction<1, 1, 0> {
2113 explicit LRegExpLiteral(LOperand* context) {
2114 inputs_[0] = context;
2117 LOperand* context() { return inputs_[0]; }
2119 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2120 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2124 class LFunctionLiteral: public LTemplateInstruction<1, 1, 0> {
2126 explicit LFunctionLiteral(LOperand* context) {
2127 inputs_[0] = context;
2130 LOperand* context() { return inputs_[0]; }
2132 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2133 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2135 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2139 class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2141 explicit LToFastProperties(LOperand* value) {
2145 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2146 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2150 class LTypeof: public LTemplateInstruction<1, 2, 0> {
2152 LTypeof(LOperand* context, LOperand* value) {
2153 inputs_[0] = context;
2157 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2161 class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2163 explicit LTypeofIsAndBranch(LOperand* value) {
2167 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2168 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2170 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2172 virtual void PrintDataTo(StringStream* stream);
2176 class LDeleteProperty: public LTemplateInstruction<1, 3, 0> {
2178 LDeleteProperty(LOperand* context, LOperand* obj, LOperand* key) {
2179 inputs_[0] = context;
2184 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
2186 LOperand* context() { return inputs_[0]; }
2187 LOperand* object() { return inputs_[1]; }
2188 LOperand* key() { return inputs_[2]; }
2192 class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2196 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2198 LOperand** SpilledRegisterArray() { return register_spills_; }
2199 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2201 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2202 void MarkSpilledDoubleRegister(int allocation_index,
2203 LOperand* spill_operand);
2206 // Arrays of spill slot operands for registers with an assigned spill
2207 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2208 // NULL if the register has no assigned spill slot. Indexed by allocation
2210 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2211 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2215 class LStackCheck: public LTemplateInstruction<0, 1, 0> {
2217 explicit LStackCheck(LOperand* context) {
2218 inputs_[0] = context;
2221 LOperand* context() { return inputs_[0]; }
2223 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2224 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2226 Label* done_label() { return &done_label_; }
2233 class LIn: public LTemplateInstruction<1, 3, 0> {
2235 LIn(LOperand* context, LOperand* key, LOperand* object) {
2236 inputs_[0] = context;
2238 inputs_[2] = object;
2241 LOperand* context() { return inputs_[0]; }
2242 LOperand* key() { return inputs_[1]; }
2243 LOperand* object() { return inputs_[2]; }
2245 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2249 class LForInPrepareMap: public LTemplateInstruction<1, 2, 0> {
2251 LForInPrepareMap(LOperand* context, LOperand* object) {
2252 inputs_[0] = context;
2253 inputs_[1] = object;
2256 LOperand* context() { return inputs_[0]; }
2257 LOperand* object() { return inputs_[1]; }
2259 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2263 class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
2265 explicit LForInCacheArray(LOperand* map) {
2269 LOperand* map() { return inputs_[0]; }
2271 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2274 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2279 class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2281 LCheckMapValue(LOperand* value, LOperand* map) {
2286 LOperand* value() { return inputs_[0]; }
2287 LOperand* map() { return inputs_[1]; }
2289 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2293 class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2295 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2296 inputs_[0] = object;
2300 LOperand* object() { return inputs_[0]; }
2301 LOperand* index() { return inputs_[1]; }
2303 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2307 class LChunkBuilder;
2308 class LChunk: public ZoneObject {
2310 LChunk(CompilationInfo* info, HGraph* graph)
2311 : spill_slot_count_(0),
2316 inlined_closures_(1) { }
2318 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
2319 LConstantOperand* DefineConstantOperand(HConstant* constant);
2320 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
2321 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
2323 int GetNextSpillIndex(bool is_double);
2324 LOperand* GetNextSpillSlot(bool is_double);
2326 int ParameterAt(int index);
2327 int GetParameterStackSlot(int index) const;
2328 int spill_slot_count() const { return spill_slot_count_; }
2329 CompilationInfo* info() const { return info_; }
2330 HGraph* graph() const { return graph_; }
2331 const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
2332 void AddGapMove(int index, LOperand* from, LOperand* to);
2333 LGap* GetGapAt(int index) const;
2334 bool IsGapAt(int index) const;
2335 int NearestGapPos(int index) const;
2336 void MarkEmptyBlocks();
2337 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; }
2338 LLabel* GetLabel(int block_id) const {
2339 HBasicBlock* block = graph_->blocks()->at(block_id);
2340 int first_instruction = block->first_instruction_index();
2341 return LLabel::cast(instructions_[first_instruction]);
2343 int LookupDestination(int block_id) const {
2344 LLabel* cur = GetLabel(block_id);
2345 while (cur->replacement() != NULL) {
2346 cur = cur->replacement();
2348 return cur->block_id();
2350 Label* GetAssemblyLabel(int block_id) const {
2351 LLabel* label = GetLabel(block_id);
2352 ASSERT(!label->HasReplacement());
2353 return label->label();
2356 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
2357 return &inlined_closures_;
2360 void AddInlinedClosure(Handle<JSFunction> closure) {
2361 inlined_closures_.Add(closure);
2365 int spill_slot_count_;
2366 CompilationInfo* info_;
2367 HGraph* const graph_;
2368 ZoneList<LInstruction*> instructions_;
2369 ZoneList<LPointerMap*> pointer_maps_;
2370 ZoneList<Handle<JSFunction> > inlined_closures_;
2374 class LChunkBuilder BASE_EMBEDDED {
2376 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2380 zone_(graph->isolate()->zone()),
2382 current_instruction_(NULL),
2383 current_block_(NULL),
2386 allocator_(allocator),
2387 position_(RelocInfo::kNoPosition),
2388 instruction_pending_deoptimization_environment_(NULL),
2389 pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
2391 // Build the sequence for the graph.
2394 // Declare methods that deal with the individual node types.
2395 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2396 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2407 LChunk* chunk() const { return chunk_; }
2408 CompilationInfo* info() const { return info_; }
2409 HGraph* graph() const { return graph_; }
2410 Zone* zone() { return zone_; }
2412 bool is_unused() const { return status_ == UNUSED; }
2413 bool is_building() const { return status_ == BUILDING; }
2414 bool is_done() const { return status_ == DONE; }
2415 bool is_aborted() const { return status_ == ABORTED; }
2417 void Abort(const char* format, ...);
2419 // Methods for getting operands for Use / Define / Temp.
2420 LUnallocated* ToUnallocated(Register reg);
2421 LUnallocated* ToUnallocated(XMMRegister reg);
2423 // Methods for setting up define-use relationships.
2424 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2425 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2426 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2427 XMMRegister fixed_register);
2429 // A value that is guaranteed to be allocated to a register.
2430 // Operand created by UseRegister is guaranteed to be live until the end of
2431 // instruction. This means that register allocator will not reuse it's
2432 // register for any other operand inside instruction.
2433 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2434 // instruction start. Register allocator is free to assign the same register
2435 // to some other operand used inside instruction (i.e. temporary or
2437 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2438 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2440 // An input operand in a register that may be trashed.
2441 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2443 // An input operand in a register or stack slot.
2444 MUST_USE_RESULT LOperand* Use(HValue* value);
2445 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2447 // An input operand in a register, stack slot or a constant operand.
2448 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2449 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2451 // An input operand in a register or a constant operand.
2452 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2453 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2455 // An input operand in register, stack slot or a constant operand.
2456 // Will not be moved to a register even if one is freely available.
2457 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2459 // Temporary operand that must be in a register.
2460 MUST_USE_RESULT LUnallocated* TempRegister();
2461 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2462 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg);
2464 // Methods for setting up define-use relationships.
2465 // Return the same instruction that they are passed.
2466 template<int I, int T>
2467 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2468 LUnallocated* result);
2469 template<int I, int T>
2470 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2471 template<int I, int T>
2472 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2474 template<int I, int T>
2475 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2476 template<int I, int T>
2477 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2479 template<int I, int T>
2480 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2482 // Assigns an environment to an instruction. An instruction which can
2483 // deoptimize must have an environment.
2484 LInstruction* AssignEnvironment(LInstruction* instr);
2485 // Assigns a pointer map to an instruction. An instruction which can
2486 // trigger a GC or a lazy deoptimization must have a pointer map.
2487 LInstruction* AssignPointerMap(LInstruction* instr);
2489 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2491 // Marks a call for the register allocator. Assigns a pointer map to
2492 // support GC and lazy deoptimization. Assigns an environment to support
2493 // eager deoptimization if CAN_DEOPTIMIZE_EAGERLY.
2494 LInstruction* MarkAsCall(
2495 LInstruction* instr,
2496 HInstruction* hinstr,
2497 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2499 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2500 int* argument_index_accumulator);
2502 void VisitInstruction(HInstruction* current);
2504 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2505 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2506 LInstruction* DoArithmeticD(Token::Value op,
2507 HArithmeticBinaryOperation* instr);
2508 LInstruction* DoArithmeticT(Token::Value op,
2509 HArithmeticBinaryOperation* instr);
2512 CompilationInfo* info_;
2513 HGraph* const graph_;
2516 HInstruction* current_instruction_;
2517 HBasicBlock* current_block_;
2518 HBasicBlock* next_block_;
2519 int argument_count_;
2520 LAllocator* allocator_;
2522 LInstruction* instruction_pending_deoptimization_environment_;
2523 int pending_deoptimization_ast_id_;
2525 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2528 #undef DECLARE_HYDROGEN_ACCESSOR
2529 #undef DECLARE_CONCRETE_INSTRUCTION
2531 } } // namespace v8::internal
2533 #endif // V8_IA32_LITHIUM_IA32_H_