Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: src/x64/lithium-x64.h

Issue 6321012: Version 3.0.9... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 25 matching lines...) Expand all
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 // Forward declarations. 39 // Forward declarations.
40 class LCodeGen; 40 class LCodeGen;
41 41
42 42
43 // Type hierarchy: 43 // Type hierarchy:
44 // 44 //
45 // LInstruction 45 // LInstruction
46 // LAccessArgumentsAt 46 // LTemplateInstruction
47 // LArgumentsElements 47 // LControlInstruction
48 // LArgumentsLength 48 // LBranch
49 // LBinaryOperation 49 // LClassOfTestAndBranch
50 // LCmpJSObjectEqAndBranch
51 // LCmpIDAndBranch
52 // LHasCachedArrayIndexAndBranch
53 // LHasInstanceTypeAndBranch
54 // LInstanceOfAndBranch
55 // LIsNullAndBranch
56 // LIsObjectAndBranch
57 // LIsSmiAndBranch
58 // LTypeofIsAndBranch
59 // LAccessArgumentsAt
60 // LArgumentsElements
61 // LArgumentsLength
50 // LAddI 62 // LAddI
51 // LApplyArguments 63 // LApplyArguments
52 // LArithmeticD 64 // LArithmeticD
53 // LArithmeticT 65 // LArithmeticT
54 // LBitI 66 // LBitI
55 // LBoundsCheck 67 // LBoundsCheck
56 // LCmpID 68 // LCmpID
57 // LCmpIDAndBranch
58 // LCmpJSObjectEq 69 // LCmpJSObjectEq
59 // LCmpJSObjectEqAndBranch
60 // LCmpT 70 // LCmpT
61 // LDivI 71 // LDivI
62 // LInstanceOf 72 // LInstanceOf
63 // LInstanceOfAndBranch
64 // LInstanceOfKnownGlobal 73 // LInstanceOfKnownGlobal
65 // LLoadKeyedFastElement 74 // LLoadKeyedFastElement
66 // LLoadKeyedGeneric 75 // LLoadKeyedGeneric
67 // LModI 76 // LModI
68 // LMulI 77 // LMulI
69 // LPower 78 // LPower
70 // LShiftI 79 // LShiftI
71 // LSubI 80 // LSubI
72 // LCallConstantFunction 81 // LCallConstantFunction
73 // LCallFunction 82 // LCallFunction
74 // LCallGlobal 83 // LCallGlobal
75 // LCallKeyed 84 // LCallKeyed
76 // LCallKnownGlobal 85 // LCallKnownGlobal
77 // LCallNamed 86 // LCallNamed
78 // LCallRuntime 87 // LCallRuntime
79 // LCallStub 88 // LCallStub
80 // LCheckPrototypeMaps 89 // LConstant
81 // LConstant 90 // LConstantD
82 // LConstantD 91 // LConstantI
83 // LConstantI 92 // LConstantT
84 // LConstantT 93 // LDeoptimize
85 // LDeoptimize 94 // LFunctionLiteral
86 // LFunctionLiteral 95 // LGap
87 // LGap 96 // LLabel
88 // LLabel 97 // LGlobalObject
89 // LGlobalObject 98 // LGlobalReceiver
90 // LGlobalReceiver 99 // LGoto
91 // LGoto 100 // LLazyBailout
92 // LLazyBailout 101 // LLoadGlobal
93 // LLoadContextSlot 102 // LCheckPrototypeMaps
94 // LLoadGlobal 103 // LLoadContextSlot
95 // LMaterializedLiteral
96 // LArrayLiteral 104 // LArrayLiteral
97 // LObjectLiteral 105 // LObjectLiteral
98 // LRegExpLiteral 106 // LRegExpLiteral
99 // LOsrEntry 107 // LOsrEntry
100 // LParameter 108 // LParameter
101 // LRegExpConstructResult 109 // LRegExpConstructResult
102 // LStackCheck 110 // LStackCheck
103 // LStoreKeyed 111 // LStoreKeyed
104 // LStoreKeyedFastElement 112 // LStoreKeyedFastElement
105 // LStoreKeyedGeneric 113 // LStoreKeyedGeneric
106 // LStoreNamed 114 // LStoreNamed
107 // LStoreNamedField 115 // LStoreNamedField
108 // LStoreNamedGeneric 116 // LStoreNamedGeneric
109 // LUnaryOperation
110 // LBitNotI 117 // LBitNotI
111 // LBranch
112 // LCallNew 118 // LCallNew
113 // LCheckFunction 119 // LCheckFunction
120 // LCheckPrototypeMaps
114 // LCheckInstanceType 121 // LCheckInstanceType
115 // LCheckMap 122 // LCheckMap
116 // LCheckSmi 123 // LCheckSmi
117 // LClassOfTest 124 // LClassOfTest
118 // LClassOfTestAndBranch
119 // LDeleteProperty 125 // LDeleteProperty
120 // LDoubleToI 126 // LDoubleToI
121 // LFixedArrayLength 127 // LFixedArrayLength
122 // LHasCachedArrayIndex 128 // LHasCachedArrayIndex
123 // LHasCachedArrayIndexAndBranch
124 // LHasInstanceType 129 // LHasInstanceType
125 // LHasInstanceTypeAndBranch
126 // LInteger32ToDouble 130 // LInteger32ToDouble
127 // LIsNull 131 // LIsNull
128 // LIsNullAndBranch
129 // LIsObject 132 // LIsObject
130 // LIsObjectAndBranch
131 // LIsSmi 133 // LIsSmi
132 // LIsSmiAndBranch
133 // LJSArrayLength 134 // LJSArrayLength
134 // LLoadNamedField 135 // LLoadNamedField
135 // LLoadNamedGeneric 136 // LLoadNamedGeneric
136 // LLoadFunctionPrototype 137 // LLoadFunctionPrototype
137 // LNumberTagD 138 // LNumberTagD
138 // LNumberTagI 139 // LNumberTagI
139 // LPushArgument 140 // LPushArgument
140 // LReturn 141 // LReturn
141 // LSmiTag 142 // LSmiTag
142 // LStoreGlobal 143 // LStoreGlobal
143 // LTaggedToI 144 // LTaggedToI
144 // LThrow 145 // LThrow
145 // LTypeof 146 // LTypeof
146 // LTypeofIs 147 // LTypeofIs
147 // LTypeofIsAndBranch
148 // LUnaryMathOperation 148 // LUnaryMathOperation
149 // LValueOf 149 // LValueOf
150 // LUnknownOSRValue 150 // LUnknownOSRValue
151 151
152 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ 152 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
153 V(BinaryOperation) \ 153 V(ControlInstruction) \
154 V(Constant) \ 154 V(Constant) \
155 V(Call) \ 155 V(Call) \
156 V(MaterializedLiteral) \
157 V(StoreKeyed) \ 156 V(StoreKeyed) \
158 V(StoreNamed) \ 157 V(StoreNamed) \
159 V(UnaryOperation) \
160 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) 158 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
161 159
162 160
163 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ 161 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
164 V(AccessArgumentsAt) \ 162 V(AccessArgumentsAt) \
165 V(AddI) \ 163 V(AddI) \
166 V(ApplyArguments) \ 164 V(ApplyArguments) \
167 V(ArgumentsElements) \ 165 V(ArgumentsElements) \
168 V(ArgumentsLength) \ 166 V(ArgumentsLength) \
169 V(ArithmeticD) \ 167 V(ArithmeticD) \
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 virtual void CompileToNative(LCodeGen* generator) = 0; 293 virtual void CompileToNative(LCodeGen* generator) = 0;
296 virtual const char* Mnemonic() const = 0; 294 virtual const char* Mnemonic() const = 0;
297 virtual void PrintTo(StringStream* stream); 295 virtual void PrintTo(StringStream* stream);
298 virtual void PrintDataTo(StringStream* stream) = 0; 296 virtual void PrintDataTo(StringStream* stream) = 0;
299 virtual void PrintOutputOperandTo(StringStream* stream) = 0; 297 virtual void PrintOutputOperandTo(StringStream* stream) = 0;
300 298
301 // Declare virtual type testers. 299 // Declare virtual type testers.
302 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } 300 #define DECLARE_DO(type) virtual bool Is##type() const { return false; }
303 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO) 301 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
304 #undef DECLARE_DO 302 #undef DECLARE_DO
303
305 virtual bool IsControl() const { return false; } 304 virtual bool IsControl() const { return false; }
305 virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
306 306
307 void set_environment(LEnvironment* env) { environment_.set(env); } 307 void set_environment(LEnvironment* env) { environment_.set(env); }
308 LEnvironment* environment() const { return environment_.get(); } 308 LEnvironment* environment() const { return environment_.get(); }
309 bool HasEnvironment() const { return environment_.is_set(); } 309 bool HasEnvironment() const { return environment_.is_set(); }
310 310
311 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } 311 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
312 LPointerMap* pointer_map() const { return pointer_map_.get(); } 312 LPointerMap* pointer_map() const { return pointer_map_.get(); }
313 bool HasPointerMap() const { return pointer_map_.is_set(); } 313 bool HasPointerMap() const { return pointer_map_.is_set(); }
314 314
315 virtual bool HasResult() const = 0; 315 virtual bool HasResult() const = 0;
(...skipping 18 matching lines...) Expand all
334 SetOncePointer<LEnvironment> deoptimization_environment_; 334 SetOncePointer<LEnvironment> deoptimization_environment_;
335 }; 335 };
336 336
337 337
338 template<typename T, int N> 338 template<typename T, int N>
339 class OperandContainer { 339 class OperandContainer {
340 public: 340 public:
341 OperandContainer() { 341 OperandContainer() {
342 for (int i = 0; i < N; i++) elems_[i] = NULL; 342 for (int i = 0; i < N; i++) elems_[i] = NULL;
343 } 343 }
344 int length() const { return N; } 344 int length() { return N; }
345 T at(int i) const { return elems_[i]; } 345 T& operator[](int i) {
346 void set_at(int i, T value) { elems_[i] = value; } 346 ASSERT(i < length());
347 return elems_[i];
348 }
349 void PrintOperandsTo(StringStream* stream);
350
347 private: 351 private:
348 T elems_[N]; 352 T elems_[N];
349 }; 353 };
350 354
351 355
352 template<typename T> 356 template<typename T>
353 class OperandContainer<T, 0> { 357 class OperandContainer<T, 0> {
354 public: 358 public:
355 int length() const { return 0; } 359 int length() { return 0; }
356 T at(int i) const { 360 void PrintOperandsTo(StringStream* stream) { }
357 UNREACHABLE();
358 return NULL;
359 }
360 void set_at(int i, T value) {
361 UNREACHABLE();
362 }
363 }; 361 };
364 362
365 363
366 template<int R, int I, int T> 364 template<int R, int I, int T = 0>
367 class LTemplateInstruction: public LInstruction { 365 class LTemplateInstruction: public LInstruction {
368 public: 366 public:
369 // Allow 0 or 1 output operands. 367 // Allow 0 or 1 output operands.
370 STATIC_ASSERT(R == 0 || R == 1); 368 STATIC_ASSERT(R == 0 || R == 1);
371 virtual bool HasResult() const { return R != 0; } 369 virtual bool HasResult() const { return R != 0; }
372 void set_result(LOperand* operand) { outputs_.set_at(0, operand); } 370 void set_result(LOperand* operand) { results_[0] = operand; }
373 LOperand* result() const { return outputs_.at(0); } 371 LOperand* result() { return results_[0]; }
374 372
375 int InputCount() const { return inputs_.length(); } 373 int InputCount() { return I; }
376 LOperand* InputAt(int i) const { return inputs_.at(i); } 374 LOperand* InputAt(int i) { return inputs_[i]; }
377 void SetInputAt(int i, LOperand* operand) { inputs_.set_at(i, operand); }
378 375
379 int TempCount() const { return temps_.length(); } 376 int TempCount() { return T; }
380 LOperand* TempAt(int i) const { return temps_.at(i); } 377 LOperand* TempAt(int i) { return temps_[i]; }
381 378
382 virtual void PrintDataTo(StringStream* stream); 379 virtual void PrintDataTo(StringStream* stream);
383 virtual void PrintOutputOperandTo(StringStream* stream); 380 virtual void PrintOutputOperandTo(StringStream* stream);
384 381
385 private: 382 protected:
386 OperandContainer<LOperand*, R> outputs_; 383 OperandContainer<LOperand*, R> results_;
387 OperandContainer<LOperand*, I> inputs_; 384 OperandContainer<LOperand*, I> inputs_;
388 OperandContainer<LOperand*, T> temps_; 385 OperandContainer<LOperand*, T> temps_;
389 }; 386 };
390 387
391 388
392 class LGap: public LTemplateInstruction<0, 0, 0> { 389 class LGap: public LTemplateInstruction<0, 0, 0> {
393 public: 390 public:
394 explicit LGap(HBasicBlock* block) 391 explicit LGap(HBasicBlock* block)
395 : block_(block) { 392 : block_(block) {
396 parallel_moves_[BEFORE] = NULL; 393 parallel_moves_[BEFORE] = NULL;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 } 505 }
509 }; 506 };
510 507
511 508
512 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { 509 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
513 public: 510 public:
514 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") 511 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
515 }; 512 };
516 513
517 514
518 template<int R> 515 template<int I, int T = 0>
519 class LUnaryOperation: public LTemplateInstruction<R, 1, 0> { 516 class LControlInstruction: public LTemplateInstruction<0, I, T> {
520 public: 517 public:
521 explicit LUnaryOperation<R>(LOperand* input) { 518 DECLARE_INSTRUCTION(ControlInstruction)
522 this->SetInputAt(0, input); 519 virtual bool IsControl() const { return true; }
520
521 int true_block_id() const { return true_block_id_; }
522 int false_block_id() const { return false_block_id_; }
523 void SetBranchTargets(int true_block_id, int false_block_id) {
524 true_block_id_ = true_block_id;
525 false_block_id_ = false_block_id;
523 } 526 }
524 527
525 LOperand* input() const { return this->InputAt(0); } 528 private:
526 529 int true_block_id_;
527 DECLARE_INSTRUCTION(UnaryOperation) 530 int false_block_id_;
528 }; 531 };
529 532
530 533
531 template<int R>
532 class LBinaryOperation: public LTemplateInstruction<R, 2, 0> {
533 public:
534 LBinaryOperation(LOperand* left, LOperand* right) {
535 this->SetInputAt(0, left);
536 this->SetInputAt(1, right);
537 }
538
539 DECLARE_INSTRUCTION(BinaryOperation)
540
541 LOperand* left() const { return this->InputAt(0); }
542 LOperand* right() const { return this->InputAt(1); }
543 };
544
545
546 class LApplyArguments: public LTemplateInstruction<1, 4, 0> { 534 class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
547 public: 535 public:
548 LApplyArguments(LOperand* function, 536 LApplyArguments(LOperand* function,
549 LOperand* receiver, 537 LOperand* receiver,
550 LOperand* length, 538 LOperand* length,
551 LOperand* elements) { 539 LOperand* elements) {
552 this->SetInputAt(0, function); 540 inputs_[0] = function;
553 this->SetInputAt(1, receiver); 541 inputs_[1] = receiver;
554 this->SetInputAt(2, length); 542 inputs_[2] = length;
555 this->SetInputAt(3, elements); 543 inputs_[3] = elements;
556 } 544 }
557 545
558 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments") 546 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
559 547
560 LOperand* function() const { return InputAt(0); } 548 LOperand* function() { return inputs_[0]; }
561 LOperand* receiver() const { return InputAt(1); } 549 LOperand* receiver() { return inputs_[1]; }
562 LOperand* length() const { return InputAt(2); } 550 LOperand* length() { return inputs_[2]; }
563 LOperand* elements() const { return InputAt(3); } 551 LOperand* elements() { return inputs_[3]; }
564 }; 552 };
565 553
566 554
567 class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> { 555 class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
568 public: 556 public:
569 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) { 557 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
570 this->SetInputAt(0, arguments); 558 inputs_[0] = arguments;
571 this->SetInputAt(1, length); 559 inputs_[1] = length;
572 this->SetInputAt(2, index); 560 inputs_[2] = index;
573 } 561 }
574 562
575 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at") 563 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
576 564
577 LOperand* arguments() const { return this->InputAt(0); } 565 LOperand* arguments() { return inputs_[0]; }
578 LOperand* length() const { return this->InputAt(1); } 566 LOperand* length() { return inputs_[1]; }
579 LOperand* index() const { return this->InputAt(2); } 567 LOperand* index() { return inputs_[2]; }
580 568
581 virtual void PrintDataTo(StringStream* stream); 569 virtual void PrintDataTo(StringStream* stream);
582 }; 570 };
583 571
584 572
585 class LArgumentsLength: public LUnaryOperation<1> { 573 class LArgumentsLength: public LTemplateInstruction<1, 1> {
586 public: 574 public:
587 explicit LArgumentsLength(LOperand* elements) 575 explicit LArgumentsLength(LOperand* elements) {
588 : LUnaryOperation<1>(elements) {} 576 inputs_[0] = elements;
577 }
589 578
590 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length") 579 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
591 }; 580 };
592 581
593 582
594 class LArgumentsElements: public LTemplateInstruction<1, 0, 0> { 583 class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
595 public: 584 public:
596 LArgumentsElements() { } 585 LArgumentsElements() { }
597 586
598 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements") 587 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
599 }; 588 };
600 589
601 590
602 class LModI: public LBinaryOperation<1> { 591 class LModI: public LTemplateInstruction<1, 2, 1> {
603 public: 592 public:
604 LModI(LOperand* left, LOperand* right) : LBinaryOperation<1>(left, right) { } 593 LModI(LOperand* left, LOperand* right, LOperand* temp) {
594 inputs_[0] = left;
595 inputs_[1] = right;
596 temps_[0] = temp;
597 }
605 598
606 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") 599 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
607 DECLARE_HYDROGEN_ACCESSOR(Mod) 600 DECLARE_HYDROGEN_ACCESSOR(Mod)
608 }; 601 };
609 602
610 603
611 class LDivI: public LBinaryOperation<1> { 604 class LDivI: public LTemplateInstruction<1, 2, 1> {
612 public: 605 public:
613 LDivI(LOperand* left, LOperand* right) 606 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
614 : LBinaryOperation<1>(left, right) { } 607 inputs_[0] = left;
608 inputs_[1] = right;
609 temps_[0] = temp;
610 }
615 611
616 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") 612 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
617 DECLARE_HYDROGEN_ACCESSOR(Div) 613 DECLARE_HYDROGEN_ACCESSOR(Div)
618 }; 614 };
619 615
620 616
621 class LMulI: public LBinaryOperation<1> { 617 class LMulI: public LTemplateInstruction<1, 2, 1> {
622 public: 618 public:
623 LMulI(LOperand* left, LOperand* right, LOperand* temp) 619 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
624 : LBinaryOperation<1>(left, right), temp_(temp) { } 620 inputs_[0] = left;
621 inputs_[1] = right;
622 temps_[0] = temp;
623 }
625 624
626 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") 625 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
627 DECLARE_HYDROGEN_ACCESSOR(Mul) 626 DECLARE_HYDROGEN_ACCESSOR(Mul)
628
629 LOperand* temp() const { return temp_; }
630
631 private:
632 LOperand* temp_;
633 }; 627 };
634 628
635 629
636 class LCmpID: public LBinaryOperation<1> { 630 class LCmpID: public LTemplateInstruction<1, 2> {
637 public: 631 public:
638 LCmpID(LOperand* left, LOperand* right) 632 LCmpID(LOperand* left, LOperand* right) {
639 : LBinaryOperation<1>(left, right) { } 633 inputs_[0] = left;
634 inputs_[1] = right;
635 }
636
637 DECLARE_CONCRETE_INSTRUCTION(CmpID, "cmp-id")
638 DECLARE_HYDROGEN_ACCESSOR(Compare)
639
640 Token::Value op() const { return hydrogen()->token(); }
641 bool is_double() const {
642 return hydrogen()->GetInputRepresentation().IsDouble();
643 }
644 };
645
646
647 class LCmpIDAndBranch: public LControlInstruction<2> {
648 public:
649 LCmpIDAndBranch(LOperand* left, LOperand* right) {
650 inputs_[0] = left;
651 inputs_[1] = right;
652 }
653
654 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
655 DECLARE_HYDROGEN_ACCESSOR(Compare)
640 656
641 Token::Value op() const { return hydrogen()->token(); } 657 Token::Value op() const { return hydrogen()->token(); }
642 bool is_double() const { 658 bool is_double() const {
643 return hydrogen()->GetInputRepresentation().IsDouble(); 659 return hydrogen()->GetInputRepresentation().IsDouble();
644 } 660 }
645 661
646 DECLARE_CONCRETE_INSTRUCTION(CmpID, "cmp-id") 662 virtual void PrintDataTo(StringStream* stream);
647 DECLARE_HYDROGEN_ACCESSOR(Compare)
648 }; 663 };
649 664
650 665
651 class LCmpIDAndBranch: public LCmpID { 666 class LUnaryMathOperation: public LTemplateInstruction<1, 1> {
652 public: 667 public:
653 LCmpIDAndBranch(LOperand* left, 668 explicit LUnaryMathOperation(LOperand* value) {
654 LOperand* right, 669 inputs_[0] = value;
655 int true_block_id, 670 }
656 int false_block_id)
657 : LCmpID(left, right),
658 true_block_id_(true_block_id),
659 false_block_id_(false_block_id) { }
660
661 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
662 virtual void PrintDataTo(StringStream* stream);
663 virtual bool IsControl() const { return true; }
664
665 int true_block_id() const { return true_block_id_; }
666 int false_block_id() const { return false_block_id_; }
667
668 private:
669 int true_block_id_;
670 int false_block_id_;
671 };
672
673
674 class LUnaryMathOperation: public LUnaryOperation<1> {
675 public:
676 explicit LUnaryMathOperation(LOperand* value)
677 : LUnaryOperation<1>(value) { }
678 671
679 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation") 672 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
680 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) 673 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
681 674
682 virtual void PrintDataTo(StringStream* stream); 675 virtual void PrintDataTo(StringStream* stream);
683 BuiltinFunctionId op() const { return hydrogen()->op(); } 676 BuiltinFunctionId op() const { return hydrogen()->op(); }
684 }; 677 };
685 678
686 679
687 class LCmpJSObjectEq: public LBinaryOperation<1> { 680 class LCmpJSObjectEq: public LTemplateInstruction<1, 2> {
688 public: 681 public:
689 LCmpJSObjectEq(LOperand* left, LOperand* right) 682 LCmpJSObjectEq(LOperand* left, LOperand* right) {
690 : LBinaryOperation<1>(left, right) {} 683 inputs_[0] = left;
684 inputs_[1] = right;
685 }
691 686
692 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEq, "cmp-jsobject-eq") 687 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEq, "cmp-jsobject-eq")
693 }; 688 };
694 689
695 690
696 class LCmpJSObjectEqAndBranch: public LCmpJSObjectEq { 691 class LCmpJSObjectEqAndBranch: public LControlInstruction<2> {
697 public: 692 public:
698 LCmpJSObjectEqAndBranch(LOperand* left, 693 LCmpJSObjectEqAndBranch(LOperand* left, LOperand* right) {
699 LOperand* right, 694 inputs_[0] = left;
700 int true_block_id, 695 inputs_[1] = right;
701 int false_block_id) 696 }
702 : LCmpJSObjectEq(left, right),
703 true_block_id_(true_block_id),
704 false_block_id_(false_block_id) { }
705 697
706 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEqAndBranch, 698 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEqAndBranch,
707 "cmp-jsobject-eq-and-branch") 699 "cmp-jsobject-eq-and-branch")
708
709 int true_block_id() const { return true_block_id_; }
710 int false_block_id() const { return false_block_id_; }
711
712 private:
713 int true_block_id_;
714 int false_block_id_;
715 }; 700 };
716 701
717 702
718 class LIsNull: public LUnaryOperation<1> { 703 class LIsNull: public LTemplateInstruction<1, 1> {
719 public: 704 public:
720 explicit LIsNull(LOperand* value) : LUnaryOperation<1>(value) { } 705 explicit LIsNull(LOperand* value) {
706 inputs_[0] = value;
707 }
721 708
722 DECLARE_CONCRETE_INSTRUCTION(IsNull, "is-null") 709 DECLARE_CONCRETE_INSTRUCTION(IsNull, "is-null")
723 DECLARE_HYDROGEN_ACCESSOR(IsNull) 710 DECLARE_HYDROGEN_ACCESSOR(IsNull)
724 711
725 bool is_strict() const { return hydrogen()->is_strict(); } 712 bool is_strict() const { return hydrogen()->is_strict(); }
726 }; 713 };
727 714
728 715
729 class LIsNullAndBranch: public LIsNull { 716 class LIsNullAndBranch: public LControlInstruction<1, 1> {
730 public: 717 public:
731 LIsNullAndBranch(LOperand* value, 718 LIsNullAndBranch(LOperand* value, LOperand* temp) {
732 LOperand* temp, 719 inputs_[0] = value;
733 int true_block_id, 720 temps_[0] = temp;
734 int false_block_id) 721 }
735 : LIsNull(value),
736 temp_(temp),
737 true_block_id_(true_block_id),
738 false_block_id_(false_block_id) { }
739 722
740 DECLARE_CONCRETE_INSTRUCTION(IsNullAndBranch, "is-null-and-branch") 723 DECLARE_CONCRETE_INSTRUCTION(IsNullAndBranch, "is-null-and-branch")
724 DECLARE_HYDROGEN_ACCESSOR(IsNull)
725
726 bool is_strict() const { return hydrogen()->is_strict(); }
727
741 virtual void PrintDataTo(StringStream* stream); 728 virtual void PrintDataTo(StringStream* stream);
742 virtual bool IsControl() const { return true; }
743
744 int true_block_id() const { return true_block_id_; }
745 int false_block_id() const { return false_block_id_; }
746
747 LOperand* temp() const { return temp_; }
748
749 private:
750 LOperand* temp_;
751 int true_block_id_;
752 int false_block_id_;
753 }; 729 };
754 730
755 731
756 class LIsObject: public LUnaryOperation<1> { 732 class LIsObject: public LTemplateInstruction<1, 1, 1> {
757 public: 733 public:
758 LIsObject(LOperand* value, LOperand* temp) 734 LIsObject(LOperand* value, LOperand* temp) {
759 : LUnaryOperation<1>(value), temp_(temp) {} 735 inputs_[0] = value;
736 temps_[0] = temp;
737 }
760 738
761 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is-object") 739 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is-object")
762
763 LOperand* temp() const { return temp_; }
764
765 private:
766 LOperand* temp_;
767 }; 740 };
768 741
769 742
770 class LIsObjectAndBranch: public LIsObject { 743 class LIsObjectAndBranch: public LControlInstruction<1, 2> {
771 public: 744 public:
772 LIsObjectAndBranch(LOperand* value, 745 LIsObjectAndBranch(LOperand* value, LOperand* temp, LOperand* temp2) {
773 LOperand* temp, 746 inputs_[0] = value;
774 LOperand* temp2, 747 temps_[0] = temp;
775 int true_block_id, 748 temps_[1] = temp2;
776 int false_block_id) 749 }
777 : LIsObject(value, temp),
778 temp2_(temp2),
779 true_block_id_(true_block_id),
780 false_block_id_(false_block_id) { }
781 750
782 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch") 751 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
752
783 virtual void PrintDataTo(StringStream* stream); 753 virtual void PrintDataTo(StringStream* stream);
784 virtual bool IsControl() const { return true; }
785
786 int true_block_id() const { return true_block_id_; }
787 int false_block_id() const { return false_block_id_; }
788
789 LOperand* temp2() const { return temp2_; }
790
791 private:
792 LOperand* temp2_;
793 int true_block_id_;
794 int false_block_id_;
795 }; 754 };
796 755
797 756
798 class LIsSmi: public LUnaryOperation<1> { 757 class LIsSmi: public LTemplateInstruction<1, 1> {
799 public: 758 public:
800 explicit LIsSmi(LOperand* value) : LUnaryOperation<1>(value) {} 759 explicit LIsSmi(LOperand* value) {
760 inputs_[0] = value;
761 }
801 762
802 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is-smi") 763 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is-smi")
803 DECLARE_HYDROGEN_ACCESSOR(IsSmi) 764 DECLARE_HYDROGEN_ACCESSOR(IsSmi)
804 }; 765 };
805 766
806 767
807 class LIsSmiAndBranch: public LIsSmi { 768 class LIsSmiAndBranch: public LControlInstruction<1> {
808 public: 769 public:
809 LIsSmiAndBranch(LOperand* value, 770 explicit LIsSmiAndBranch(LOperand* value) {
810 int true_block_id, 771 inputs_[0] = value;
811 int false_block_id) 772 }
812 : LIsSmi(value),
813 true_block_id_(true_block_id),
814 false_block_id_(false_block_id) { }
815 773
816 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch") 774 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
775
817 virtual void PrintDataTo(StringStream* stream); 776 virtual void PrintDataTo(StringStream* stream);
818 virtual bool IsControl() const { return true; }
819
820 int true_block_id() const { return true_block_id_; }
821 int false_block_id() const { return false_block_id_; }
822
823 private:
824 int true_block_id_;
825 int false_block_id_;
826 }; 777 };
827 778
828 779
829 class LHasInstanceType: public LUnaryOperation<1> { 780 class LHasInstanceType: public LTemplateInstruction<1, 1> {
830 public: 781 public:
831 explicit LHasInstanceType(LOperand* value) 782 explicit LHasInstanceType(LOperand* value) {
832 : LUnaryOperation<1>(value) { } 783 inputs_[0] = value;
784 }
833 785
834 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has-instance-type") 786 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has-instance-type")
835 DECLARE_HYDROGEN_ACCESSOR(HasInstanceType) 787 DECLARE_HYDROGEN_ACCESSOR(HasInstanceType)
836
837 InstanceType TestType(); // The type to test against when generating code.
838 Condition BranchCondition(); // The branch condition for 'true'.
839 }; 788 };
840 789
841 790
842 class LHasInstanceTypeAndBranch: public LHasInstanceType { 791 class LHasInstanceTypeAndBranch: public LControlInstruction<1, 1> {
843 public: 792 public:
844 LHasInstanceTypeAndBranch(LOperand* value, 793 LHasInstanceTypeAndBranch(LOperand* value, LOperand* temp) {
845 LOperand* temporary, 794 inputs_[0] = value;
846 int true_block_id, 795 temps_[0] = temp;
847 int false_block_id) 796 }
848 : LHasInstanceType(value),
849 temp_(temporary),
850 true_block_id_(true_block_id),
851 false_block_id_(false_block_id) { }
852 797
853 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch, 798 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
854 "has-instance-type-and-branch") 799 "has-instance-type-and-branch")
800 DECLARE_HYDROGEN_ACCESSOR(HasInstanceType)
801
855 virtual void PrintDataTo(StringStream* stream); 802 virtual void PrintDataTo(StringStream* stream);
856 virtual bool IsControl() const { return true; }
857
858 int true_block_id() const { return true_block_id_; }
859 int false_block_id() const { return false_block_id_; }
860
861 LOperand* temp() { return temp_; }
862
863 private:
864 LOperand* temp_;
865 int true_block_id_;
866 int false_block_id_;
867 }; 803 };
868 804
869 805
870 class LHasCachedArrayIndex: public LUnaryOperation<1> { 806 class LHasCachedArrayIndex: public LTemplateInstruction<1, 1> {
871 public: 807 public:
872 explicit LHasCachedArrayIndex(LOperand* value) : LUnaryOperation<1>(value) {} 808 explicit LHasCachedArrayIndex(LOperand* value) {
809 inputs_[0] = value;
810 }
873 811
874 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has-cached-array-index") 812 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has-cached-array-index")
875 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndex) 813 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndex)
876 }; 814 };
877 815
878 816
879 class LHasCachedArrayIndexAndBranch: public LHasCachedArrayIndex { 817 class LHasCachedArrayIndexAndBranch: public LControlInstruction<1> {
880 public: 818 public:
881 LHasCachedArrayIndexAndBranch(LOperand* value, 819 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
882 int true_block_id, 820 inputs_[0] = value;
883 int false_block_id) 821 }
884 : LHasCachedArrayIndex(value),
885 true_block_id_(true_block_id),
886 false_block_id_(false_block_id) { }
887 822
888 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch, 823 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
889 "has-cached-array-index-and-branch") 824 "has-cached-array-index-and-branch")
890 virtual void PrintDataTo(StringStream* stream); 825 virtual void PrintDataTo(StringStream* stream);
891 virtual bool IsControl() const { return true; }
892
893 int true_block_id() const { return true_block_id_; }
894 int false_block_id() const { return false_block_id_; }
895
896 private:
897 int true_block_id_;
898 int false_block_id_;
899 }; 826 };
900 827
901 828
902 class LClassOfTest: public LUnaryOperation<1> { 829 class LClassOfTest: public LTemplateInstruction<1, 1, 1> {
903 public: 830 public:
904 LClassOfTest(LOperand* value, LOperand* temp) 831 LClassOfTest(LOperand* value, LOperand* temp) {
905 : LUnaryOperation<1>(value), temporary_(temp) {} 832 inputs_[0] = value;
833 temps_[0] = temp;
834 }
906 835
907 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class-of-test") 836 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class-of-test")
908 DECLARE_HYDROGEN_ACCESSOR(ClassOfTest) 837 DECLARE_HYDROGEN_ACCESSOR(ClassOfTest)
909 838
910 virtual void PrintDataTo(StringStream* stream); 839 virtual void PrintDataTo(StringStream* stream);
911
912 LOperand* temporary() { return temporary_; }
913
914 private:
915 LOperand* temporary_;
916 }; 840 };
917 841
918 842
919 class LClassOfTestAndBranch: public LClassOfTest { 843 class LClassOfTestAndBranch: public LControlInstruction<1, 2> {
920 public: 844 public:
921 LClassOfTestAndBranch(LOperand* value, 845 LClassOfTestAndBranch(LOperand* value, LOperand* temp, LOperand* temp2) {
922 LOperand* temporary, 846 inputs_[0] = value;
923 LOperand* temporary2, 847 temps_[0] = temp;
924 int true_block_id, 848 temps_[1] = temp2;
925 int false_block_id) 849 }
926 : LClassOfTest(value, temporary),
927 temporary2_(temporary2),
928 true_block_id_(true_block_id),
929 false_block_id_(false_block_id) { }
930 850
931 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch, 851 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
932 "class-of-test-and-branch") 852 "class-of-test-and-branch")
853 DECLARE_HYDROGEN_ACCESSOR(ClassOfTest)
854
933 virtual void PrintDataTo(StringStream* stream); 855 virtual void PrintDataTo(StringStream* stream);
934 virtual bool IsControl() const { return true; }
935
936 int true_block_id() const { return true_block_id_; }
937 int false_block_id() const { return false_block_id_; }
938 LOperand* temporary2() { return temporary2_; }
939
940 private:
941 LOperand* temporary2_;
942 int true_block_id_;
943 int false_block_id_;
944 }; 856 };
945 857
946 858
947 class LCmpT: public LBinaryOperation<1> { 859 class LCmpT: public LTemplateInstruction<1, 2> {
948 public: 860 public:
949 LCmpT(LOperand* left, LOperand* right) : LBinaryOperation<1>(left, right) {} 861 LCmpT(LOperand* left, LOperand* right) {
862 inputs_[0] = left;
863 inputs_[1] = right;
864 }
950 865
951 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") 866 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
952 DECLARE_HYDROGEN_ACCESSOR(Compare) 867 DECLARE_HYDROGEN_ACCESSOR(Compare)
953 868
954 Token::Value op() const { return hydrogen()->token(); } 869 Token::Value op() const { return hydrogen()->token(); }
955 }; 870 };
956 871
957 872
958 class LCmpTAndBranch: public LCmpT { 873 class LCmpTAndBranch: public LControlInstruction<2> {
959 public: 874 public:
960 LCmpTAndBranch(LOperand* left, 875 LCmpTAndBranch(LOperand* left, LOperand* right) {
961 LOperand* right, 876 inputs_[0] = left;
962 int true_block_id, 877 inputs_[1] = right;
963 int false_block_id) 878 }
964 : LCmpT(left, right),
965 true_block_id_(true_block_id),
966 false_block_id_(false_block_id) { }
967 879
968 DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch") 880 DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch")
881 DECLARE_HYDROGEN_ACCESSOR(Compare)
969 882
970 int true_block_id() const { return true_block_id_; } 883 Token::Value op() const { return hydrogen()->token(); }
971 int false_block_id() const { return false_block_id_; }
972
973 private:
974 int true_block_id_;
975 int false_block_id_;
976 }; 884 };
977 885
978 886
979 class LInstanceOf: public LBinaryOperation<1> { 887 class LInstanceOf: public LTemplateInstruction<1, 2> {
980 public: 888 public:
981 LInstanceOf(LOperand* left, LOperand* right) 889 LInstanceOf(LOperand* left, LOperand* right) {
982 : LBinaryOperation<1>(left, right) { } 890 inputs_[0] = left;
891 inputs_[1] = right;
892 }
983 893
984 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of") 894 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
985 }; 895 };
986 896
987 897
988 class LInstanceOfAndBranch: public LInstanceOf { 898 class LInstanceOfAndBranch: public LControlInstruction<2> {
989 public: 899 public:
990 LInstanceOfAndBranch(LOperand* left, 900 LInstanceOfAndBranch(LOperand* left, LOperand* right) {
991 LOperand* right, 901 inputs_[0] = left;
992 int true_block_id, 902 inputs_[1] = right;
993 int false_block_id) 903 }
994 : LInstanceOf(left, right),
995 true_block_id_(true_block_id),
996 false_block_id_(false_block_id) { }
997 904
998 DECLARE_CONCRETE_INSTRUCTION(InstanceOfAndBranch, "instance-of-and-branch") 905 DECLARE_CONCRETE_INSTRUCTION(InstanceOfAndBranch, "instance-of-and-branch")
999
1000 int true_block_id() const { return true_block_id_; }
1001 int false_block_id() const { return false_block_id_; }
1002
1003 private:
1004 int true_block_id_;
1005 int false_block_id_;
1006 }; 906 };
1007 907
1008 908
1009 class LInstanceOfKnownGlobal: public LUnaryOperation<1> { 909 class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
1010 public: 910 public:
1011 LInstanceOfKnownGlobal(LOperand* left, LOperand* temp) 911 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
1012 : LUnaryOperation<1>(left), temp_(temp) { } 912 inputs_[0] = value;
913 temps_[0] = temp;
914 }
1013 915
1014 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, 916 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1015 "instance-of-known-global") 917 "instance-of-known-global")
1016 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) 918 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1017 919
1018 Handle<JSFunction> function() const { return hydrogen()->function(); } 920 Handle<JSFunction> function() const { return hydrogen()->function(); }
1019 LOperand* temp() const { return temp_; }
1020
1021 private:
1022 LOperand* temp_;
1023 }; 921 };
1024 922
1025 923
1026 class LBoundsCheck: public LBinaryOperation<0> { 924 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
1027 public: 925 public:
1028 LBoundsCheck(LOperand* index, LOperand* length) 926 LBoundsCheck(LOperand* index, LOperand* length) {
1029 : LBinaryOperation<0>(index, length) { } 927 inputs_[0] = index;
928 inputs_[1] = length;
929 }
1030 930
1031 LOperand* index() const { return left(); } 931 LOperand* index() { return inputs_[0]; }
1032 LOperand* length() const { return right(); } 932 LOperand* length() { return inputs_[1]; }
1033 933
1034 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check") 934 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
1035 }; 935 };
1036 936
1037 937
1038 class LBitI: public LBinaryOperation<1> { 938 class LBitI: public LTemplateInstruction<1, 2> {
1039 public: 939 public:
1040 LBitI(Token::Value op, LOperand* left, LOperand* right) 940 LBitI(Token::Value op, LOperand* left, LOperand* right)
1041 : LBinaryOperation<1>(left, right), op_(op) { } 941 : op_(op) {
942 inputs_[0] = left;
943 inputs_[1] = right;
944 }
1042 945
1043 Token::Value op() const { return op_; } 946 Token::Value op() const { return op_; }
1044 947
1045 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i") 948 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1046 949
1047 private: 950 private:
1048 Token::Value op_; 951 Token::Value op_;
1049 }; 952 };
1050 953
1051 954
1052 class LShiftI: public LBinaryOperation<1> { 955 class LShiftI: public LTemplateInstruction<1, 2> {
1053 public: 956 public:
1054 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt) 957 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1055 : LBinaryOperation<1>(left, right), op_(op), can_deopt_(can_deopt) { } 958 : op_(op), can_deopt_(can_deopt) {
959 inputs_[0] = left;
960 inputs_[1] = right;
961 }
1056 962
1057 Token::Value op() const { return op_; } 963 Token::Value op() const { return op_; }
1058 964
1059 bool can_deopt() const { return can_deopt_; } 965 bool can_deopt() const { return can_deopt_; }
1060 966
1061 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i") 967 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1062 968
1063 private: 969 private:
1064 Token::Value op_; 970 Token::Value op_;
1065 bool can_deopt_; 971 bool can_deopt_;
1066 }; 972 };
1067 973
1068 974
1069 class LSubI: public LBinaryOperation<1> { 975 class LSubI: public LTemplateInstruction<1, 2> {
1070 public: 976 public:
1071 LSubI(LOperand* left, LOperand* right) 977 LSubI(LOperand* left, LOperand* right) {
1072 : LBinaryOperation<1>(left, right) { } 978 inputs_[0] = left;
979 inputs_[1] = right;
980 }
1073 981
1074 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") 982 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1075 DECLARE_HYDROGEN_ACCESSOR(Sub) 983 DECLARE_HYDROGEN_ACCESSOR(Sub)
1076 }; 984 };
1077 985
1078 986
1079 class LConstant: public LTemplateInstruction<1, 0, 0> { 987 template <int temp_count>
988 class LConstant: public LTemplateInstruction<1, 0, temp_count> {
1080 DECLARE_INSTRUCTION(Constant) 989 DECLARE_INSTRUCTION(Constant)
1081 }; 990 };
1082 991
1083 992
1084 class LConstantI: public LConstant { 993 class LConstantI: public LConstant<0> {
1085 public: 994 public:
1086 explicit LConstantI(int32_t value) : value_(value) { } 995 explicit LConstantI(int32_t value) : value_(value) { }
1087 int32_t value() const { return value_; } 996 int32_t value() const { return value_; }
1088 997
1089 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") 998 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1090 999
1091 private: 1000 private:
1092 int32_t value_; 1001 int32_t value_;
1093 }; 1002 };
1094 1003
1095 1004
1096 class LConstantD: public LConstant { 1005 class LConstantD: public LConstant<1> {
1097 public: 1006 public:
1098 explicit LConstantD(double value) : value_(value) { } 1007 explicit LConstantD(double value, LOperand* temp) : value_(value) {
1008 temps_[0] = temp;
1009 }
1099 double value() const { return value_; } 1010 double value() const { return value_; }
1100 1011
1101 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") 1012 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1102 1013
1103 private: 1014 private:
1104 double value_; 1015 double value_;
1105 }; 1016 };
1106 1017
1107 1018
1108 class LConstantT: public LConstant { 1019 class LConstantT: public LConstant<0> {
1109 public: 1020 public:
1110 explicit LConstantT(Handle<Object> value) : value_(value) { } 1021 explicit LConstantT(Handle<Object> value) : value_(value) { }
1111 Handle<Object> value() const { return value_; } 1022 Handle<Object> value() const { return value_; }
1112 1023
1113 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") 1024 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1114 1025
1115 private: 1026 private:
1116 Handle<Object> value_; 1027 Handle<Object> value_;
1117 }; 1028 };
1118 1029
1119 1030
1120 class LBranch: public LUnaryOperation<0> { 1031 class LBranch: public LControlInstruction<1> {
1121 public: 1032 public:
1122 LBranch(LOperand* input, int true_block_id, int false_block_id) 1033 explicit LBranch(LOperand* value) {
1123 : LUnaryOperation<0>(input), 1034 inputs_[0] = value;
1124 true_block_id_(true_block_id), 1035 }
1125 false_block_id_(false_block_id) { }
1126 1036
1127 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") 1037 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1128 DECLARE_HYDROGEN_ACCESSOR(Value) 1038 DECLARE_HYDROGEN_ACCESSOR(Value)
1129 1039
1130 virtual void PrintDataTo(StringStream* stream); 1040 virtual void PrintDataTo(StringStream* stream);
1131 virtual bool IsControl() const { return true; }
1132
1133 int true_block_id() const { return true_block_id_; }
1134 int false_block_id() const { return false_block_id_; }
1135
1136 private:
1137 int true_block_id_;
1138 int false_block_id_;
1139 }; 1041 };
1140 1042
1141 1043
1142 class LCmpMapAndBranch: public LUnaryOperation<0> { 1044 class LCmpMapAndBranch: public LTemplateInstruction<0, 1> {
1143 public: 1045 public:
1144 explicit LCmpMapAndBranch(LOperand* value) : LUnaryOperation<0>(value) { } 1046 explicit LCmpMapAndBranch(LOperand* value) {
1047 inputs_[0] = value;
1048 }
1145 1049
1146 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") 1050 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1147 DECLARE_HYDROGEN_ACCESSOR(CompareMapAndBranch) 1051 DECLARE_HYDROGEN_ACCESSOR(CompareMapAndBranch)
1148 1052
1149 virtual bool IsControl() const { return true; } 1053 virtual bool IsControl() const { return true; }
1150 1054
1151 Handle<Map> map() const { return hydrogen()->map(); } 1055 Handle<Map> map() const { return hydrogen()->map(); }
1152 int true_block_id() const { 1056 int true_block_id() const {
1153 return hydrogen()->true_destination()->block_id(); 1057 return hydrogen()->true_destination()->block_id();
1154 } 1058 }
1155 int false_block_id() const { 1059 int false_block_id() const {
1156 return hydrogen()->false_destination()->block_id(); 1060 return hydrogen()->false_destination()->block_id();
1157 } 1061 }
1158 }; 1062 };
1159 1063
1160 1064
1161 class LJSArrayLength: public LUnaryOperation<1> { 1065 class LJSArrayLength: public LTemplateInstruction<1, 1> {
1162 public: 1066 public:
1163 explicit LJSArrayLength(LOperand* input) : LUnaryOperation<1>(input) { } 1067 explicit LJSArrayLength(LOperand* value) {
1068 inputs_[0] = value;
1069 }
1164 1070
1165 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length") 1071 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
1166 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength) 1072 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
1167 }; 1073 };
1168 1074
1169 1075
1170 class LFixedArrayLength: public LUnaryOperation<1> { 1076 class LFixedArrayLength: public LTemplateInstruction<1, 1> {
1171 public: 1077 public:
1172 explicit LFixedArrayLength(LOperand* input) : LUnaryOperation<1>(input) { } 1078 explicit LFixedArrayLength(LOperand* value) {
1079 inputs_[0] = value;
1080 }
1173 1081
1174 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed-array-length") 1082 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed-array-length")
1175 DECLARE_HYDROGEN_ACCESSOR(FixedArrayLength) 1083 DECLARE_HYDROGEN_ACCESSOR(FixedArrayLength)
1176 }; 1084 };
1177 1085
1178 1086
1179 class LValueOf: public LUnaryOperation<1> { 1087 class LValueOf: public LTemplateInstruction<1, 1, 1> {
1180 public: 1088 public:
1181 LValueOf(LOperand* input, LOperand* temporary) 1089 LValueOf(LOperand* value, LOperand* temp) {
1182 : LUnaryOperation<1>(input), temporary_(temporary) { } 1090 inputs_[0] = value;
1183 1091 temps_[0] = temp;
1184 LOperand* temporary() const { return temporary_; } 1092 }
1185 1093
1186 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of") 1094 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1187 DECLARE_HYDROGEN_ACCESSOR(ValueOf) 1095 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1188
1189 private:
1190 LOperand* temporary_;
1191 }; 1096 };
1192 1097
1193 1098
1194 class LThrow: public LUnaryOperation<0> { 1099 class LThrow: public LTemplateInstruction<0, 1> {
1195 public: 1100 public:
1196 explicit LThrow(LOperand* value) : LUnaryOperation<0>(value) { } 1101 explicit LThrow(LOperand* value) {
1102 inputs_[0] = value;
1103 }
1197 1104
1198 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 1105 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1199 }; 1106 };
1200 1107
1201 1108
1202 class LBitNotI: public LUnaryOperation<1> { 1109 class LBitNotI: public LTemplateInstruction<1, 1> {
1203 public: 1110 public:
1204 explicit LBitNotI(LOperand* input) : LUnaryOperation<1>(input) { } 1111 explicit LBitNotI(LOperand* value) {
1112 inputs_[0] = value;
1113 }
1205 1114
1206 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i") 1115 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1207 }; 1116 };
1208 1117
1209 1118
1210 class LAddI: public LBinaryOperation<1> { 1119 class LAddI: public LTemplateInstruction<1, 2> {
1211 public: 1120 public:
1212 LAddI(LOperand* left, LOperand* right) 1121 LAddI(LOperand* left, LOperand* right) {
1213 : LBinaryOperation<1>(left, right) { } 1122 inputs_[0] = left;
1123 inputs_[1] = right;
1124 }
1214 1125
1215 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i") 1126 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1216 DECLARE_HYDROGEN_ACCESSOR(Add) 1127 DECLARE_HYDROGEN_ACCESSOR(Add)
1217 }; 1128 };
1218 1129
1219 1130
1220 class LPower: public LBinaryOperation<1> { 1131 class LPower: public LTemplateInstruction<1, 2> {
1221 public: 1132 public:
1222 LPower(LOperand* left, LOperand* right) 1133 LPower(LOperand* left, LOperand* right) {
1223 : LBinaryOperation<1>(left, right) { } 1134 inputs_[0] = left;
1135 inputs_[1] = right;
1136 }
1224 1137
1225 DECLARE_CONCRETE_INSTRUCTION(Power, "power") 1138 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1226 DECLARE_HYDROGEN_ACCESSOR(Power) 1139 DECLARE_HYDROGEN_ACCESSOR(Power)
1227 }; 1140 };
1228 1141
1229 1142
1230 class LArithmeticD: public LBinaryOperation<1> { 1143 class LArithmeticD: public LTemplateInstruction<1, 2> {
1231 public: 1144 public:
1232 LArithmeticD(Token::Value op, LOperand* left, LOperand* right) 1145 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1233 : LBinaryOperation<1>(left, right), op_(op) { } 1146 : op_(op) {
1147 inputs_[0] = left;
1148 inputs_[1] = right;
1149 }
1234 1150
1235 Token::Value op() const { return op_; } 1151 Token::Value op() const { return op_; }
1236 1152
1237 virtual void CompileToNative(LCodeGen* generator); 1153 virtual void CompileToNative(LCodeGen* generator);
1238 virtual const char* Mnemonic() const; 1154 virtual const char* Mnemonic() const;
1239 1155
1240 private: 1156 private:
1241 Token::Value op_; 1157 Token::Value op_;
1242 }; 1158 };
1243 1159
1244 1160
1245 class LArithmeticT: public LBinaryOperation<1> { 1161 class LArithmeticT: public LTemplateInstruction<1, 2> {
1246 public: 1162 public:
1247 LArithmeticT(Token::Value op, LOperand* left, LOperand* right) 1163 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1248 : LBinaryOperation<1>(left, right), op_(op) { } 1164 : op_(op) {
1165 inputs_[0] = left;
1166 inputs_[1] = right;
1167 }
1249 1168
1250 virtual void CompileToNative(LCodeGen* generator); 1169 virtual void CompileToNative(LCodeGen* generator);
1251 virtual const char* Mnemonic() const; 1170 virtual const char* Mnemonic() const;
1252 1171
1253 Token::Value op() const { return op_; } 1172 Token::Value op() const { return op_; }
1254 1173
1255 private: 1174 private:
1256 Token::Value op_; 1175 Token::Value op_;
1257 }; 1176 };
1258 1177
1259 1178
1260 class LReturn: public LUnaryOperation<0> { 1179 class LReturn: public LTemplateInstruction<0, 1> {
1261 public: 1180 public:
1262 explicit LReturn(LOperand* use) : LUnaryOperation<0>(use) { } 1181 explicit LReturn(LOperand* value) {
1182 inputs_[0] = value;
1183 }
1263 1184
1264 DECLARE_CONCRETE_INSTRUCTION(Return, "return") 1185 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1265 }; 1186 };
1266 1187
1267 1188
1268 class LLoadNamedField: public LUnaryOperation<1> { 1189 class LLoadNamedField: public LTemplateInstruction<1, 1> {
1269 public: 1190 public:
1270 explicit LLoadNamedField(LOperand* object) : LUnaryOperation<1>(object) { } 1191 explicit LLoadNamedField(LOperand* object) {
1192 inputs_[0] = object;
1193 }
1271 1194
1272 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field") 1195 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1273 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField) 1196 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1274 }; 1197 };
1275 1198
1276 1199
1277 class LLoadNamedGeneric: public LUnaryOperation<1> { 1200 class LLoadNamedGeneric: public LTemplateInstruction<1, 1> {
1278 public: 1201 public:
1279 explicit LLoadNamedGeneric(LOperand* object) : LUnaryOperation<1>(object) { } 1202 explicit LLoadNamedGeneric(LOperand* object) {
1203 inputs_[0] = object;
1204 }
1280 1205
1281 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic") 1206 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1282 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric) 1207 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1283 1208
1284 LOperand* object() const { return input(); } 1209 LOperand* object() { return inputs_[0]; }
1285 Handle<Object> name() const { return hydrogen()->name(); } 1210 Handle<Object> name() const { return hydrogen()->name(); }
1286 }; 1211 };
1287 1212
1288 1213
1289 class LLoadFunctionPrototype: public LUnaryOperation<1> { 1214 class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 1> {
1290 public: 1215 public:
1291 LLoadFunctionPrototype(LOperand* function, LOperand* temporary) 1216 LLoadFunctionPrototype(LOperand* function, LOperand* temp) {
1292 : LUnaryOperation<1>(function), temporary_(temporary) { } 1217 inputs_[0] = function;
1218 temps_[0] = temp;
1219 }
1293 1220
1294 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype") 1221 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1295 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype) 1222 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1296 1223
1297 LOperand* function() const { return input(); } 1224 LOperand* function() { return inputs_[0]; }
1298 LOperand* temporary() const { return temporary_; }
1299
1300 private:
1301 LOperand* temporary_;
1302 }; 1225 };
1303 1226
1304 1227
1305 class LLoadElements: public LUnaryOperation<1> { 1228 class LLoadElements: public LTemplateInstruction<1, 1> {
1306 public: 1229 public:
1307 explicit LLoadElements(LOperand* obj) : LUnaryOperation<1>(obj) { } 1230 explicit LLoadElements(LOperand* object) {
1231 inputs_[0] = object;
1232 }
1308 1233
1309 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") 1234 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1310 }; 1235 };
1311 1236
1312 1237
1313 class LLoadKeyedFastElement: public LBinaryOperation<1> { 1238 class LLoadKeyedFastElement: public LTemplateInstruction<1, 2> {
1314 public: 1239 public:
1315 LLoadKeyedFastElement(LOperand* elements, LOperand* key) 1240 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1316 : LBinaryOperation<1>(elements, key) { } 1241 inputs_[0] = elements;
1242 inputs_[1] = key;
1243 }
1317 1244
1318 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element") 1245 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1319 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement) 1246 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1320 1247
1321 LOperand* elements() const { return left(); } 1248 LOperand* elements() { return inputs_[0]; }
1322 LOperand* key() const { return right(); } 1249 LOperand* key() { return inputs_[1]; }
1323 }; 1250 };
1324 1251
1325 1252
1326 class LLoadKeyedGeneric: public LBinaryOperation<1> { 1253 class LLoadKeyedGeneric: public LTemplateInstruction<1, 2> {
1327 public: 1254 public:
1328 LLoadKeyedGeneric(LOperand* obj, LOperand* key) 1255 LLoadKeyedGeneric(LOperand* obj, LOperand* key) {
1329 : LBinaryOperation<1>(obj, key) { } 1256 inputs_[0] = obj;
1257 inputs_[1] = key;
1258 }
1330 1259
1331 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") 1260 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1332 1261
1333 LOperand* object() const { return left(); } 1262 LOperand* object() { return inputs_[0]; }
1334 LOperand* key() const { return right(); } 1263 LOperand* key() { return inputs_[1]; }
1335 }; 1264 };
1336 1265
1337 1266
1338 class LLoadGlobal: public LTemplateInstruction<1, 0, 0> { 1267 class LLoadGlobal: public LTemplateInstruction<1, 0, 0> {
1339 public: 1268 public:
1340 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global") 1269 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global")
1341 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal) 1270 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal)
1342 }; 1271 };
1343 1272
1344 1273
1345 class LStoreGlobal: public LUnaryOperation<0> { 1274 class LStoreGlobal: public LTemplateInstruction<0, 1> {
1346 public: 1275 public:
1347 explicit LStoreGlobal(LOperand* value) : LUnaryOperation<0>(value) {} 1276 explicit LStoreGlobal(LOperand* value) {
1277 inputs_[0] = value;
1278 }
1348 1279
1349 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global") 1280 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global")
1350 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal) 1281 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal)
1351 }; 1282 };
1352 1283
1353 1284
1354 class LLoadContextSlot: public LTemplateInstruction<1, 0, 0> { 1285 class LLoadContextSlot: public LTemplateInstruction<1, 0, 0> {
1355 public: 1286 public:
1356 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") 1287 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1357 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) 1288 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1358 1289
1359 int context_chain_length() const { 1290 int context_chain_length() { return hydrogen()->context_chain_length(); }
1360 return hydrogen()->context_chain_length(); 1291 int slot_index() { return hydrogen()->slot_index(); }
1361 }
1362 int slot_index() const { return hydrogen()->slot_index(); }
1363 1292
1364 virtual void PrintDataTo(StringStream* stream); 1293 virtual void PrintDataTo(StringStream* stream);
1365 }; 1294 };
1366 1295
1367 1296
1368 class LPushArgument: public LUnaryOperation<0> { 1297 class LPushArgument: public LTemplateInstruction<0, 1> {
1369 public: 1298 public:
1370 explicit LPushArgument(LOperand* argument) : LUnaryOperation<0>(argument) {} 1299 explicit LPushArgument(LOperand* value) {
1300 inputs_[0] = value;
1301 }
1371 1302
1372 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") 1303 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1373 }; 1304 };
1374 1305
1375 1306
1376 class LGlobalObject: public LTemplateInstruction<1, 0, 0> { 1307 class LGlobalObject: public LTemplateInstruction<1, 0, 0> {
1377 public: 1308 public:
1378 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object") 1309 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1379 }; 1310 };
1380 1311
1381 1312
1382 class LGlobalReceiver: public LTemplateInstruction<1, 0, 0> { 1313 class LGlobalReceiver: public LTemplateInstruction<1, 0, 0> {
1383 public: 1314 public:
1384 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") 1315 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1385 }; 1316 };
1386 1317
1387 1318
1388 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> { 1319 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1389 public: 1320 public:
1390 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") 1321 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1391 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) 1322 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1392 1323
1393 virtual void PrintDataTo(StringStream* stream); 1324 virtual void PrintDataTo(StringStream* stream);
1394 1325
1395 Handle<JSFunction> function() { return hydrogen()->function(); } 1326 Handle<JSFunction> function() { return hydrogen()->function(); }
1396 int arity() const { return hydrogen()->argument_count() - 1; } 1327 int arity() const { return hydrogen()->argument_count() - 1; }
1397 }; 1328 };
1398 1329
1399 1330
1400 class LCallKeyed: public LTemplateInstruction<1, 0, 0> { 1331 class LCallKeyed: public LTemplateInstruction<1, 0, 1> {
1401 public: 1332 public:
1333 explicit LCallKeyed(LOperand* temp) {
1334 temps_[0] = temp;
1335 }
1336
1402 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") 1337 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1403 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) 1338 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1404 1339
1405 virtual void PrintDataTo(StringStream* stream); 1340 virtual void PrintDataTo(StringStream* stream);
1406 1341
1407 int arity() const { return hydrogen()->argument_count() - 1; } 1342 int arity() const { return hydrogen()->argument_count() - 1; }
1408 }; 1343 };
1409 1344
1410 1345
1411 class LCallNamed: public LTemplateInstruction<1, 0, 0> { 1346 class LCallNamed: public LTemplateInstruction<1, 0, 0> {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") 1381 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1447 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) 1382 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1448 1383
1449 virtual void PrintDataTo(StringStream* stream); 1384 virtual void PrintDataTo(StringStream* stream);
1450 1385
1451 Handle<JSFunction> target() const { return hydrogen()->target(); } 1386 Handle<JSFunction> target() const { return hydrogen()->target(); }
1452 int arity() const { return hydrogen()->argument_count() - 1; } 1387 int arity() const { return hydrogen()->argument_count() - 1; }
1453 }; 1388 };
1454 1389
1455 1390
1456 class LCallNew: public LUnaryOperation<1> { 1391 class LCallNew: public LTemplateInstruction<1, 1> {
1457 public: 1392 public:
1458 explicit LCallNew(LOperand* constructor) : LUnaryOperation<1>(constructor) { } 1393 explicit LCallNew(LOperand* constructor) {
1394 inputs_[0] = constructor;
1395 }
1459 1396
1460 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") 1397 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1461 DECLARE_HYDROGEN_ACCESSOR(CallNew) 1398 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1462 1399
1463 virtual void PrintDataTo(StringStream* stream); 1400 virtual void PrintDataTo(StringStream* stream);
1464 1401
1465 int arity() const { return hydrogen()->argument_count() - 1; } 1402 int arity() const { return hydrogen()->argument_count() - 1; }
1466 }; 1403 };
1467 1404
1468 1405
1469 class LCallRuntime: public LTemplateInstruction<1, 0, 0> { 1406 class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1470 public: 1407 public:
1471 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime") 1408 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1472 DECLARE_HYDROGEN_ACCESSOR(CallRuntime) 1409 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1473 1410
1474 Runtime::Function* function() const { return hydrogen()->function(); } 1411 Runtime::Function* function() const { return hydrogen()->function(); }
1475 int arity() const { return hydrogen()->argument_count(); } 1412 int arity() const { return hydrogen()->argument_count(); }
1476 }; 1413 };
1477 1414
1478 1415
1479 class LInteger32ToDouble: public LUnaryOperation<1> { 1416 class LInteger32ToDouble: public LTemplateInstruction<1, 1> {
1480 public: 1417 public:
1481 explicit LInteger32ToDouble(LOperand* use) : LUnaryOperation<1>(use) { } 1418 explicit LInteger32ToDouble(LOperand* value) {
1419 inputs_[0] = value;
1420 }
1482 1421
1483 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double") 1422 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1484 }; 1423 };
1485 1424
1486 1425
1487 class LNumberTagI: public LUnaryOperation<1> { 1426 class LNumberTagI: public LTemplateInstruction<1, 1> {
1488 public: 1427 public:
1489 explicit LNumberTagI(LOperand* use) : LUnaryOperation<1>(use) { } 1428 explicit LNumberTagI(LOperand* value) {
1429 inputs_[0] = value;
1430 }
1490 1431
1491 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") 1432 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1492 }; 1433 };
1493 1434
1494 1435
1495 class LNumberTagD: public LUnaryOperation<1> { 1436 class LNumberTagD: public LTemplateInstruction<1, 1, 1> {
1496 public: 1437 public:
1497 explicit LNumberTagD(LOperand* value, LOperand* temp) 1438 explicit LNumberTagD(LOperand* value, LOperand* temp) {
1498 : LUnaryOperation<1>(value), temp_(temp) { } 1439 inputs_[0] = value;
1440 temps_[0] = temp;
1441 }
1499 1442
1500 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d") 1443 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1501
1502 LOperand* temp() const { return temp_; }
1503
1504 private:
1505 LOperand* temp_;
1506 }; 1444 };
1507 1445
1508 1446
1509 // Sometimes truncating conversion from a tagged value to an int32. 1447 // Sometimes truncating conversion from a tagged value to an int32.
1510 class LDoubleToI: public LUnaryOperation<1> { 1448 class LDoubleToI: public LTemplateInstruction<1, 1, 1> {
1511 public: 1449 public:
1512 LDoubleToI(LOperand* value, LOperand* temporary) 1450 LDoubleToI(LOperand* value, LOperand* temp) {
1513 : LUnaryOperation<1>(value), temporary_(temporary) { } 1451 inputs_[0] = value;
1452 temps_[0] = temp;
1453 }
1514 1454
1515 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i") 1455 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1516 DECLARE_HYDROGEN_ACCESSOR(Change) 1456 DECLARE_HYDROGEN_ACCESSOR(Change)
1517 1457
1518 bool truncating() { return hydrogen()->CanTruncateToInt32(); } 1458 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1519 LOperand* temporary() const { return temporary_; }
1520
1521 private:
1522 LOperand* temporary_;
1523 }; 1459 };
1524 1460
1525 1461
1526 // Truncating conversion from a tagged value to an int32. 1462 // Truncating conversion from a tagged value to an int32.
1527 class LTaggedToI: public LUnaryOperation<1> { 1463 class LTaggedToI: public LTemplateInstruction<1, 1, 1> {
1528 public: 1464 public:
1529 LTaggedToI(LOperand* value, LOperand* temp) 1465 LTaggedToI(LOperand* value, LOperand* temp) {
1530 : LUnaryOperation<1>(value), temp_(temp) { } 1466 inputs_[0] = value;
1467 temps_[0] = temp;
1468 }
1531 1469
1532 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i") 1470 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1533 DECLARE_HYDROGEN_ACCESSOR(Change) 1471 DECLARE_HYDROGEN_ACCESSOR(Change)
1534 1472
1535 bool truncating() { return hydrogen()->CanTruncateToInt32(); } 1473 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1536 LOperand* temp() const { return temp_; }
1537
1538 private:
1539 LOperand* temp_;
1540 }; 1474 };
1541 1475
1542 1476
1543 class LSmiTag: public LUnaryOperation<1> { 1477 class LSmiTag: public LTemplateInstruction<1, 1> {
1544 public: 1478 public:
1545 explicit LSmiTag(LOperand* use) : LUnaryOperation<1>(use) { } 1479 explicit LSmiTag(LOperand* value) {
1480 inputs_[0] = value;
1481 }
1546 1482
1547 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag") 1483 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1548 }; 1484 };
1549 1485
1550 1486
1551 class LNumberUntagD: public LUnaryOperation<1> { 1487 class LNumberUntagD: public LTemplateInstruction<1, 1> {
1552 public: 1488 public:
1553 explicit LNumberUntagD(LOperand* value) : LUnaryOperation<1>(value) { } 1489 explicit LNumberUntagD(LOperand* value) {
1490 inputs_[0] = value;
1491 }
1554 1492
1555 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") 1493 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1556 }; 1494 };
1557 1495
1558 1496
1559 class LSmiUntag: public LUnaryOperation<1> { 1497 class LSmiUntag: public LTemplateInstruction<1, 1> {
1560 public: 1498 public:
1561 LSmiUntag(LOperand* use, bool needs_check) 1499 LSmiUntag(LOperand* value, bool needs_check)
1562 : LUnaryOperation<1>(use), needs_check_(needs_check) { } 1500 : needs_check_(needs_check) {
1501 inputs_[0] = value;
1502 }
1563 1503
1564 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") 1504 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1565 1505
1566 bool needs_check() const { return needs_check_; } 1506 bool needs_check() const { return needs_check_; }
1567 1507
1568 private: 1508 private:
1569 bool needs_check_; 1509 bool needs_check_;
1570 }; 1510 };
1571 1511
1572 1512
1573 class LStoreNamed: public LTemplateInstruction<0, 2, 0> { 1513 class LStoreNamed: public LTemplateInstruction<0, 2, 1> {
1574 public: 1514 public:
1575 LStoreNamed(LOperand* obj, LOperand* val) { 1515 LStoreNamed(LOperand* obj, LOperand* val) {
1576 this->SetInputAt(0, obj); 1516 inputs_[0] = obj;
1577 this->SetInputAt(1, val); 1517 inputs_[1] = val;
1578 } 1518 }
1579 1519
1580 DECLARE_INSTRUCTION(StoreNamed) 1520 DECLARE_INSTRUCTION(StoreNamed)
1581 DECLARE_HYDROGEN_ACCESSOR(StoreNamed) 1521 DECLARE_HYDROGEN_ACCESSOR(StoreNamed)
1582 1522
1583 virtual void PrintDataTo(StringStream* stream); 1523 virtual void PrintDataTo(StringStream* stream);
1584 1524
1585 LOperand* object() const { return this->InputAt(0); } 1525 LOperand* object() { return inputs_[0]; }
1586 LOperand* value() const { return this->InputAt(1); } 1526 LOperand* value() { return inputs_[1]; }
1587 Handle<Object> name() const { return hydrogen()->name(); } 1527 Handle<Object> name() const { return hydrogen()->name(); }
1588 }; 1528 };
1589 1529
1590 1530
1591 class LStoreNamedField: public LStoreNamed { 1531 class LStoreNamedField: public LStoreNamed {
1592 public: 1532 public:
1593 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) 1533 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp)
1594 : LStoreNamed(obj, val), temp_(temp) { } 1534 : LStoreNamed(obj, val) {
1535 temps_[0] = temp;
1536 }
1595 1537
1596 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field") 1538 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1597 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField) 1539 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1598 1540
1599 bool is_in_object() { return hydrogen()->is_in_object(); } 1541 bool is_in_object() { return hydrogen()->is_in_object(); }
1600 int offset() { return hydrogen()->offset(); } 1542 int offset() { return hydrogen()->offset(); }
1601 bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } 1543 bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
1602 Handle<Map> transition() const { return hydrogen()->transition(); } 1544 Handle<Map> transition() const { return hydrogen()->transition(); }
1603
1604 LOperand* temp() { return temp_; }
1605
1606 private:
1607 LOperand* temp_;
1608 }; 1545 };
1609 1546
1610 1547
1611 class LStoreNamedGeneric: public LStoreNamed { 1548 class LStoreNamedGeneric: public LStoreNamed {
1612 public: 1549 public:
1613 LStoreNamedGeneric(LOperand* obj, LOperand* val) 1550 LStoreNamedGeneric(LOperand* obj, LOperand* val)
1614 : LStoreNamed(obj, val) { } 1551 : LStoreNamed(obj, val) { }
1615 1552
1616 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") 1553 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1617 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) 1554 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1618 }; 1555 };
1619 1556
1620 1557
1621 class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { 1558 class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
1622 public: 1559 public:
1623 LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) { 1560 LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) {
1624 this->SetInputAt(0, obj); 1561 inputs_[0] = obj;
1625 this->SetInputAt(1, key); 1562 inputs_[1] = key;
1626 this->SetInputAt(2, val); 1563 inputs_[2] = val;
1627 } 1564 }
1628 1565
1629 DECLARE_INSTRUCTION(StoreKeyed) 1566 DECLARE_INSTRUCTION(StoreKeyed)
1630 1567
1631 virtual void PrintDataTo(StringStream* stream); 1568 virtual void PrintDataTo(StringStream* stream);
1632 1569
1633 LOperand* object() const { return this->InputAt(0); } 1570 LOperand* object() { return inputs_[0]; }
1634 LOperand* key() const { return this->InputAt(1); } 1571 LOperand* key() { return inputs_[1]; }
1635 LOperand* value() const { return this->InputAt(2); } 1572 LOperand* value() { return inputs_[2]; }
1636 }; 1573 };
1637 1574
1638 1575
1639 class LStoreKeyedFastElement: public LStoreKeyed { 1576 class LStoreKeyedFastElement: public LStoreKeyed {
1640 public: 1577 public:
1641 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) 1578 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val)
1642 : LStoreKeyed(obj, key, val) {} 1579 : LStoreKeyed(obj, key, val) {}
1643 1580
1644 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, 1581 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1645 "store-keyed-fast-element") 1582 "store-keyed-fast-element")
1646 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement) 1583 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1647 }; 1584 };
1648 1585
1649 1586
1650 class LStoreKeyedGeneric: public LStoreKeyed { 1587 class LStoreKeyedGeneric: public LStoreKeyed {
1651 public: 1588 public:
1652 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) 1589 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val)
1653 : LStoreKeyed(obj, key, val) { } 1590 : LStoreKeyed(obj, key, val) { }
1654 1591
1655 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") 1592 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1656 }; 1593 };
1657 1594
1658 1595
1659 class LCheckFunction: public LUnaryOperation<0> { 1596 class LCheckFunction: public LTemplateInstruction<0, 1> {
1660 public: 1597 public:
1661 explicit LCheckFunction(LOperand* use) : LUnaryOperation<0>(use) { } 1598 explicit LCheckFunction(LOperand* value) {
1599 inputs_[0] = value;
1600 }
1662 1601
1663 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") 1602 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1664 DECLARE_HYDROGEN_ACCESSOR(CheckFunction) 1603 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1665 }; 1604 };
1666 1605
1667 1606
1668 class LCheckInstanceType: public LUnaryOperation<0> { 1607 class LCheckInstanceType: public LTemplateInstruction<0, 1, 1> {
1669 public: 1608 public:
1670 LCheckInstanceType(LOperand* use, LOperand* temp) 1609 LCheckInstanceType(LOperand* value, LOperand* temp) {
1671 : LUnaryOperation<0>(use), temp_(temp) { } 1610 inputs_[0] = value;
1611 temps_[0] = temp;
1612 }
1672 1613
1673 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") 1614 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1674 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) 1615 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
1675
1676 LOperand* temp() const { return temp_; }
1677
1678 private:
1679 LOperand* temp_;
1680 }; 1616 };
1681 1617
1682 1618
1683 class LCheckMap: public LUnaryOperation<0> { 1619 class LCheckMap: public LTemplateInstruction<0, 1> {
1684 public: 1620 public:
1685 explicit LCheckMap(LOperand* use) : LUnaryOperation<0>(use) { } 1621 explicit LCheckMap(LOperand* value) {
1622 inputs_[0] = value;
1623 }
1686 1624
1687 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map") 1625 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map")
1688 DECLARE_HYDROGEN_ACCESSOR(CheckMap) 1626 DECLARE_HYDROGEN_ACCESSOR(CheckMap)
1689 }; 1627 };
1690 1628
1691 1629
1692 class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 0> { 1630 class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> {
1693 public: 1631 public:
1694 explicit LCheckPrototypeMaps(LOperand* temp) : temp_(temp) { } 1632 explicit LCheckPrototypeMaps(LOperand* temp) {
1633 temps_[0] = temp;
1634 }
1695 1635
1696 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps") 1636 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1697 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps) 1637 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1698 1638
1699 Handle<JSObject> prototype() const { return hydrogen()->prototype(); } 1639 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1700 Handle<JSObject> holder() const { return hydrogen()->holder(); } 1640 Handle<JSObject> holder() const { return hydrogen()->holder(); }
1701
1702 LOperand* temp() const { return temp_; }
1703
1704 private:
1705 LOperand* temp_;
1706 }; 1641 };
1707 1642
1708 1643
1709 class LCheckSmi: public LUnaryOperation<0> { 1644 class LCheckSmi: public LTemplateInstruction<0, 1> {
1710 public: 1645 public:
1711 LCheckSmi(LOperand* use, Condition condition) 1646 LCheckSmi(LOperand* value, Condition condition)
1712 : LUnaryOperation<0>(use), condition_(condition) { } 1647 : condition_(condition) {
1648 inputs_[0] = value;
1649 }
1713 1650
1714 Condition condition() const { return condition_; } 1651 Condition condition() const { return condition_; }
1715 1652
1716 virtual void CompileToNative(LCodeGen* generator); 1653 virtual void CompileToNative(LCodeGen* generator);
1717 virtual const char* Mnemonic() const { 1654 virtual const char* Mnemonic() const {
1718 return (condition_ == zero) ? "check-non-smi" : "check-smi"; 1655 return (condition_ == zero) ? "check-non-smi" : "check-smi";
1719 } 1656 }
1720 1657
1721 private: 1658 private:
1722 Condition condition_; 1659 Condition condition_;
1723 }; 1660 };
1724 1661
1725 1662
1726 class LMaterializedLiteral: public LTemplateInstruction<1, 0, 0> { 1663 class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
1727 public:
1728 DECLARE_INSTRUCTION(MaterializedLiteral)
1729 };
1730
1731
1732 class LArrayLiteral: public LMaterializedLiteral {
1733 public: 1664 public:
1734 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal") 1665 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
1735 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral) 1666 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
1736 }; 1667 };
1737 1668
1738 1669
1739 class LObjectLiteral: public LMaterializedLiteral { 1670 class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
1740 public: 1671 public:
1741 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal") 1672 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
1742 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral) 1673 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
1743 }; 1674 };
1744 1675
1745 1676
1746 class LRegExpLiteral: public LMaterializedLiteral { 1677 class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
1747 public: 1678 public:
1748 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal") 1679 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
1749 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral) 1680 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
1750 }; 1681 };
1751 1682
1752 1683
1753 class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> { 1684 class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
1754 public: 1685 public:
1755 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") 1686 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
1756 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) 1687 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
1757 1688
1758 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); } 1689 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
1759 }; 1690 };
1760 1691
1761 1692
1762 class LTypeof: public LUnaryOperation<1> { 1693 class LTypeof: public LTemplateInstruction<1, 1> {
1763 public: 1694 public:
1764 explicit LTypeof(LOperand* input) : LUnaryOperation<1>(input) { } 1695 explicit LTypeof(LOperand* value) {
1696 inputs_[0] = value;
1697 }
1765 1698
1766 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") 1699 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
1767 }; 1700 };
1768 1701
1769 1702
1770 class LTypeofIs: public LUnaryOperation<1> { 1703 class LTypeofIs: public LTemplateInstruction<1, 1> {
1771 public: 1704 public:
1772 explicit LTypeofIs(LOperand* input) : LUnaryOperation<1>(input) { } 1705 explicit LTypeofIs(LOperand* value) {
1773 virtual void PrintDataTo(StringStream* stream); 1706 inputs_[0] = value;
1707 }
1774 1708
1775 DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof-is") 1709 DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof-is")
1776 DECLARE_HYDROGEN_ACCESSOR(TypeofIs) 1710 DECLARE_HYDROGEN_ACCESSOR(TypeofIs)
1777 1711
1778 Handle<String> type_literal() { return hydrogen()->type_literal(); } 1712 Handle<String> type_literal() { return hydrogen()->type_literal(); }
1713
1714 virtual void PrintDataTo(StringStream* stream);
1779 }; 1715 };
1780 1716
1781 1717
1782 class LTypeofIsAndBranch: public LTypeofIs { 1718 class LTypeofIsAndBranch: public LControlInstruction<1> {
1783 public: 1719 public:
1784 LTypeofIsAndBranch(LOperand* value, 1720 explicit LTypeofIsAndBranch(LOperand* value) {
1785 int true_block_id, 1721 inputs_[0] = value;
1786 int false_block_id) 1722 }
1787 : LTypeofIs(value),
1788 true_block_id_(true_block_id),
1789 false_block_id_(false_block_id) { }
1790 1723
1791 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") 1724 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
1725 DECLARE_HYDROGEN_ACCESSOR(TypeofIs)
1726
1727 Handle<String> type_literal() { return hydrogen()->type_literal(); }
1792 1728
1793 virtual void PrintDataTo(StringStream* stream); 1729 virtual void PrintDataTo(StringStream* stream);
1794 virtual bool IsControl() const { return true; }
1795
1796 int true_block_id() const { return true_block_id_; }
1797 int false_block_id() const { return false_block_id_; }
1798
1799 private:
1800 int true_block_id_;
1801 int false_block_id_;
1802 }; 1730 };
1803 1731
1804 1732
1805 class LDeleteProperty: public LBinaryOperation<1> { 1733 class LDeleteProperty: public LTemplateInstruction<1, 2> {
1806 public: 1734 public:
1807 LDeleteProperty(LOperand* obj, LOperand* key) 1735 LDeleteProperty(LOperand* obj, LOperand* key) {
1808 : LBinaryOperation<1>(obj, key) { } 1736 inputs_[0] = obj;
1737 inputs_[1] = key;
1738 }
1809 1739
1810 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") 1740 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
1811 1741
1812 LOperand* object() const { return left(); } 1742 LOperand* object() { return inputs_[0]; }
1813 LOperand* key() const { return right(); } 1743 LOperand* key() { return inputs_[1]; }
1814 }; 1744 };
1815 1745
1816 1746
1817 class LOsrEntry: public LTemplateInstruction<0, 0, 0> { 1747 class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
1818 public: 1748 public:
1819 LOsrEntry(); 1749 LOsrEntry();
1820 1750
1821 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") 1751 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
1822 1752
1823 LOperand** SpilledRegisterArray() { return register_spills_; } 1753 LOperand** SpilledRegisterArray() { return register_spills_; }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1947 bool is_aborted() const { return status_ == ABORTED; } 1877 bool is_aborted() const { return status_ == ABORTED; }
1948 1878
1949 void Abort(const char* format, ...); 1879 void Abort(const char* format, ...);
1950 1880
1951 // Methods for getting operands for Use / Define / Temp. 1881 // Methods for getting operands for Use / Define / Temp.
1952 LRegister* ToOperand(Register reg); 1882 LRegister* ToOperand(Register reg);
1953 LUnallocated* ToUnallocated(Register reg); 1883 LUnallocated* ToUnallocated(Register reg);
1954 LUnallocated* ToUnallocated(XMMRegister reg); 1884 LUnallocated* ToUnallocated(XMMRegister reg);
1955 1885
1956 // Methods for setting up define-use relationships. 1886 // Methods for setting up define-use relationships.
1957 LOperand* Use(HValue* value, LUnallocated* operand); 1887 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
1958 LOperand* UseFixed(HValue* value, Register fixed_register); 1888 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
1959 LOperand* UseFixedDouble(HValue* value, XMMRegister fixed_register); 1889 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
1890 XMMRegister fixed_register);
1960 1891
1961 // A value that is guaranteed to be allocated to a register. 1892 // A value that is guaranteed to be allocated to a register.
1962 // Operand created by UseRegister is guaranteed to be live until the end of 1893 // Operand created by UseRegister is guaranteed to be live until the end of
1963 // instruction. This means that register allocator will not reuse it's 1894 // instruction. This means that register allocator will not reuse it's
1964 // register for any other operand inside instruction. 1895 // register for any other operand inside instruction.
1965 // Operand created by UseRegisterAtStart is guaranteed to be live only at 1896 // Operand created by UseRegisterAtStart is guaranteed to be live only at
1966 // instruction start. Register allocator is free to assign the same register 1897 // instruction start. Register allocator is free to assign the same register
1967 // to some other operand used inside instruction (i.e. temporary or 1898 // to some other operand used inside instruction (i.e. temporary or
1968 // output). 1899 // output).
1969 LOperand* UseRegister(HValue* value); 1900 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
1970 LOperand* UseRegisterAtStart(HValue* value); 1901 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
1971 1902
1972 // A value in a register that may be trashed. 1903 // A value in a register that may be trashed.
1973 LOperand* UseTempRegister(HValue* value); 1904 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
1974 LOperand* Use(HValue* value); 1905
1975 LOperand* UseAtStart(HValue* value); 1906 // An operand value in a register or stack slot.
1976 LOperand* UseOrConstant(HValue* value); 1907 MUST_USE_RESULT LOperand* Use(HValue* value);
1977 LOperand* UseOrConstantAtStart(HValue* value); 1908 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
1978 LOperand* UseRegisterOrConstant(HValue* value); 1909
1979 LOperand* UseRegisterOrConstantAtStart(HValue* value); 1910 // An operand value in a register, stack slot or a constant operand.
1911 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
1912 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
1913
1914 // An operand value in a register or a constant operand.
1915 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
1916 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
1917
1918 // Temporary operand that must be in a register.
1919 MUST_USE_RESULT LUnallocated* TempRegister();
1920 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
1921 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg);
1922
1923 // An operand value in register, stack slot or a constant operand.
1924 // Will not be moved to a register even if one is freely available.
1925 LOperand* UseAny(HValue* value);
1980 1926
1981 // Methods for setting up define-use relationships. 1927 // Methods for setting up define-use relationships.
1982 // Return the same instruction that they are passed. 1928 // Return the same instruction that they are passed.
1983 template<int I, int T> 1929 template<int I, int T>
1984 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, 1930 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
1985 LUnallocated* result); 1931 LUnallocated* result);
1986 template<int I, int T> 1932 template<int I, int T>
1987 LInstruction* Define(LTemplateInstruction<1, I, T>* instr); 1933 LInstruction* Define(LTemplateInstruction<1, I, T>* instr);
1988 template<int I, int T> 1934 template<int I, int T>
1989 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); 1935 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
(...skipping 21 matching lines...) Expand all
2011 HInstruction* hinstr, 1957 HInstruction* hinstr,
2012 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); 1958 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2013 LInstruction* MarkAsSaveDoubles(LInstruction* instr); 1959 LInstruction* MarkAsSaveDoubles(LInstruction* instr);
2014 1960
2015 LInstruction* SetInstructionPendingDeoptimizationEnvironment( 1961 LInstruction* SetInstructionPendingDeoptimizationEnvironment(
2016 LInstruction* instr, int ast_id); 1962 LInstruction* instr, int ast_id);
2017 void ClearInstructionPendingDeoptimizationEnvironment(); 1963 void ClearInstructionPendingDeoptimizationEnvironment();
2018 1964
2019 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env); 1965 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env);
2020 1966
2021 // Temporary operand that must be in a register.
2022 LUnallocated* TempRegister();
2023 LOperand* FixedTemp(Register reg);
2024 LOperand* FixedTemp(XMMRegister reg);
2025
2026 void VisitInstruction(HInstruction* current); 1967 void VisitInstruction(HInstruction* current);
2027 1968
2028 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); 1969 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2029 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); 1970 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2030 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); 1971 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2031 LInstruction* DoArithmeticD(Token::Value op, 1972 LInstruction* DoArithmeticD(Token::Value op,
2032 HArithmeticBinaryOperation* instr); 1973 HArithmeticBinaryOperation* instr);
2033 LInstruction* DoArithmeticT(Token::Value op, 1974 LInstruction* DoArithmeticT(Token::Value op,
2034 HArithmeticBinaryOperation* instr); 1975 HArithmeticBinaryOperation* instr);
2035 1976
2036 LChunk* chunk_; 1977 LChunk* chunk_;
2037 HGraph* const graph_; 1978 HGraph* const graph_;
2038 Status status_; 1979 Status status_;
2039 HInstruction* current_instruction_; 1980 HInstruction* current_instruction_;
2040 HBasicBlock* current_block_; 1981 HBasicBlock* current_block_;
2041 HBasicBlock* next_block_; 1982 HBasicBlock* next_block_;
2042 int argument_count_; 1983 int argument_count_;
2043 LAllocator* allocator_; 1984 LAllocator* allocator_;
2044 int position_; 1985 int position_;
2045 LInstruction* instructions_pending_deoptimization_environment_; 1986 LInstruction* instructions_pending_deoptimization_environment_;
2046 int pending_deoptimization_ast_id_; 1987 int pending_deoptimization_ast_id_;
2047 1988
2048 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 1989 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2049 }; 1990 };
2050 1991
2051 #undef DECLARE_HYDROGEN_ACCESSOR 1992 #undef DECLARE_HYDROGEN_ACCESSOR
2052 #undef DECLARE_INSTRUCTION 1993 #undef DECLARE_INSTRUCTION
2053 #undef DECLARE_CONCRETE_INSTRUCTION 1994 #undef DECLARE_CONCRETE_INSTRUCTION
2054 1995
2055 } } // namespace v8::internal 1996 } } // namespace v8::int
2056 1997
2057 #endif // V8_X64_LITHIUM_X64_H_ 1998 #endif // V8_X64_LITHIUM_X64_H_
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698