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

Side by Side Diff: src/ia32/lithium-ia32.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/ia32/lithium-gap-resolver-ia32.cc ('k') | src/ia32/lithium-ia32.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 class LConstant: public LTemplateInstruction<1, 0, 0> {
1080 DECLARE_INSTRUCTION(Constant) 988 DECLARE_INSTRUCTION(Constant)
1081 }; 989 };
1082 990
(...skipping 27 matching lines...) Expand all
1110 explicit LConstantT(Handle<Object> value) : value_(value) { } 1018 explicit LConstantT(Handle<Object> value) : value_(value) { }
1111 Handle<Object> value() const { return value_; } 1019 Handle<Object> value() const { return value_; }
1112 1020
1113 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") 1021 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1114 1022
1115 private: 1023 private:
1116 Handle<Object> value_; 1024 Handle<Object> value_;
1117 }; 1025 };
1118 1026
1119 1027
1120 class LBranch: public LUnaryOperation<0> { 1028 class LBranch: public LControlInstruction<1> {
1121 public: 1029 public:
1122 LBranch(LOperand* input, int true_block_id, int false_block_id) 1030 explicit LBranch(LOperand* value) {
1123 : LUnaryOperation<0>(input), 1031 inputs_[0] = value;
1124 true_block_id_(true_block_id), 1032 }
1125 false_block_id_(false_block_id) { }
1126 1033
1127 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") 1034 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1128 DECLARE_HYDROGEN_ACCESSOR(Value) 1035 DECLARE_HYDROGEN_ACCESSOR(Value)
1129 1036
1130 virtual void PrintDataTo(StringStream* stream); 1037 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 }; 1038 };
1140 1039
1141 1040
1142 class LCmpMapAndBranch: public LUnaryOperation<0> { 1041 class LCmpMapAndBranch: public LTemplateInstruction<0, 1> {
1143 public: 1042 public:
1144 explicit LCmpMapAndBranch(LOperand* value) : LUnaryOperation<0>(value) { } 1043 explicit LCmpMapAndBranch(LOperand* value) {
1044 inputs_[0] = value;
1045 }
1145 1046
1146 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") 1047 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1147 DECLARE_HYDROGEN_ACCESSOR(CompareMapAndBranch) 1048 DECLARE_HYDROGEN_ACCESSOR(CompareMapAndBranch)
1148 1049
1149 virtual bool IsControl() const { return true; } 1050 virtual bool IsControl() const { return true; }
1150 1051
1151 Handle<Map> map() const { return hydrogen()->map(); } 1052 Handle<Map> map() const { return hydrogen()->map(); }
1152 int true_block_id() const { 1053 int true_block_id() const {
1153 return hydrogen()->true_destination()->block_id(); 1054 return hydrogen()->true_destination()->block_id();
1154 } 1055 }
1155 int false_block_id() const { 1056 int false_block_id() const {
1156 return hydrogen()->false_destination()->block_id(); 1057 return hydrogen()->false_destination()->block_id();
1157 } 1058 }
1158 }; 1059 };
1159 1060
1160 1061
1161 class LJSArrayLength: public LUnaryOperation<1> { 1062 class LJSArrayLength: public LTemplateInstruction<1, 1> {
1162 public: 1063 public:
1163 explicit LJSArrayLength(LOperand* input) : LUnaryOperation<1>(input) { } 1064 explicit LJSArrayLength(LOperand* value) {
1065 inputs_[0] = value;
1066 }
1164 1067
1165 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length") 1068 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
1166 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength) 1069 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
1167 }; 1070 };
1168 1071
1169 1072
1170 class LFixedArrayLength: public LUnaryOperation<1> { 1073 class LFixedArrayLength: public LTemplateInstruction<1, 1> {
1171 public: 1074 public:
1172 explicit LFixedArrayLength(LOperand* input) : LUnaryOperation<1>(input) { } 1075 explicit LFixedArrayLength(LOperand* value) {
1076 inputs_[0] = value;
1077 }
1173 1078
1174 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed-array-length") 1079 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed-array-length")
1175 DECLARE_HYDROGEN_ACCESSOR(FixedArrayLength) 1080 DECLARE_HYDROGEN_ACCESSOR(FixedArrayLength)
1176 }; 1081 };
1177 1082
1178 1083
1179 class LValueOf: public LUnaryOperation<1> { 1084 class LValueOf: public LTemplateInstruction<1, 1, 1> {
1180 public: 1085 public:
1181 LValueOf(LOperand* input, LOperand* temporary) 1086 LValueOf(LOperand* value, LOperand* temp) {
1182 : LUnaryOperation<1>(input), temporary_(temporary) { } 1087 inputs_[0] = value;
1183 1088 temps_[0] = temp;
1184 LOperand* temporary() const { return temporary_; } 1089 }
1185 1090
1186 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of") 1091 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1187 DECLARE_HYDROGEN_ACCESSOR(ValueOf) 1092 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1188
1189 private:
1190 LOperand* temporary_;
1191 }; 1093 };
1192 1094
1193 1095
1194 class LThrow: public LUnaryOperation<0> { 1096 class LThrow: public LTemplateInstruction<0, 1> {
1195 public: 1097 public:
1196 explicit LThrow(LOperand* value) : LUnaryOperation<0>(value) { } 1098 explicit LThrow(LOperand* value) {
1099 inputs_[0] = value;
1100 }
1197 1101
1198 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 1102 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1199 }; 1103 };
1200 1104
1201 1105
1202 class LBitNotI: public LUnaryOperation<1> { 1106 class LBitNotI: public LTemplateInstruction<1, 1> {
1203 public: 1107 public:
1204 explicit LBitNotI(LOperand* input) : LUnaryOperation<1>(input) { } 1108 explicit LBitNotI(LOperand* value) {
1109 inputs_[0] = value;
1110 }
1205 1111
1206 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i") 1112 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1207 }; 1113 };
1208 1114
1209 1115
1210 class LAddI: public LBinaryOperation<1> { 1116 class LAddI: public LTemplateInstruction<1, 2> {
1211 public: 1117 public:
1212 LAddI(LOperand* left, LOperand* right) 1118 LAddI(LOperand* left, LOperand* right) {
1213 : LBinaryOperation<1>(left, right) { } 1119 inputs_[0] = left;
1120 inputs_[1] = right;
1121 }
1214 1122
1215 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i") 1123 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1216 DECLARE_HYDROGEN_ACCESSOR(Add) 1124 DECLARE_HYDROGEN_ACCESSOR(Add)
1217 }; 1125 };
1218 1126
1219 1127
1220 class LPower: public LBinaryOperation<1> { 1128 class LPower: public LTemplateInstruction<1, 2> {
1221 public: 1129 public:
1222 LPower(LOperand* left, LOperand* right) 1130 LPower(LOperand* left, LOperand* right) {
1223 : LBinaryOperation<1>(left, right) { } 1131 inputs_[0] = left;
1132 inputs_[1] = right;
1133 }
1224 1134
1225 DECLARE_CONCRETE_INSTRUCTION(Power, "power") 1135 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1226 DECLARE_HYDROGEN_ACCESSOR(Power) 1136 DECLARE_HYDROGEN_ACCESSOR(Power)
1227 }; 1137 };
1228 1138
1229 1139
1230 class LArithmeticD: public LBinaryOperation<1> { 1140 class LArithmeticD: public LTemplateInstruction<1, 2> {
1231 public: 1141 public:
1232 LArithmeticD(Token::Value op, LOperand* left, LOperand* right) 1142 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1233 : LBinaryOperation<1>(left, right), op_(op) { } 1143 : op_(op) {
1144 inputs_[0] = left;
1145 inputs_[1] = right;
1146 }
1234 1147
1235 Token::Value op() const { return op_; } 1148 Token::Value op() const { return op_; }
1236 1149
1237 virtual void CompileToNative(LCodeGen* generator); 1150 virtual void CompileToNative(LCodeGen* generator);
1238 virtual const char* Mnemonic() const; 1151 virtual const char* Mnemonic() const;
1239 1152
1240 private: 1153 private:
1241 Token::Value op_; 1154 Token::Value op_;
1242 }; 1155 };
1243 1156
1244 1157
1245 class LArithmeticT: public LBinaryOperation<1> { 1158 class LArithmeticT: public LTemplateInstruction<1, 2> {
1246 public: 1159 public:
1247 LArithmeticT(Token::Value op, LOperand* left, LOperand* right) 1160 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1248 : LBinaryOperation<1>(left, right), op_(op) { } 1161 : op_(op) {
1162 inputs_[0] = left;
1163 inputs_[1] = right;
1164 }
1249 1165
1250 virtual void CompileToNative(LCodeGen* generator); 1166 virtual void CompileToNative(LCodeGen* generator);
1251 virtual const char* Mnemonic() const; 1167 virtual const char* Mnemonic() const;
1252 1168
1253 Token::Value op() const { return op_; } 1169 Token::Value op() const { return op_; }
1254 1170
1255 private: 1171 private:
1256 Token::Value op_; 1172 Token::Value op_;
1257 }; 1173 };
1258 1174
1259 1175
1260 class LReturn: public LUnaryOperation<0> { 1176 class LReturn: public LTemplateInstruction<0, 1> {
1261 public: 1177 public:
1262 explicit LReturn(LOperand* use) : LUnaryOperation<0>(use) { } 1178 explicit LReturn(LOperand* value) {
1179 inputs_[0] = value;
1180 }
1263 1181
1264 DECLARE_CONCRETE_INSTRUCTION(Return, "return") 1182 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1265 }; 1183 };
1266 1184
1267 1185
1268 class LLoadNamedField: public LUnaryOperation<1> { 1186 class LLoadNamedField: public LTemplateInstruction<1, 1> {
1269 public: 1187 public:
1270 explicit LLoadNamedField(LOperand* object) : LUnaryOperation<1>(object) { } 1188 explicit LLoadNamedField(LOperand* object) {
1189 inputs_[0] = object;
1190 }
1271 1191
1272 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field") 1192 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1273 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField) 1193 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1274 }; 1194 };
1275 1195
1276 1196
1277 class LLoadNamedGeneric: public LUnaryOperation<1> { 1197 class LLoadNamedGeneric: public LTemplateInstruction<1, 1> {
1278 public: 1198 public:
1279 explicit LLoadNamedGeneric(LOperand* object) : LUnaryOperation<1>(object) { } 1199 explicit LLoadNamedGeneric(LOperand* object) {
1200 inputs_[0] = object;
1201 }
1280 1202
1281 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic") 1203 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1282 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric) 1204 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1283 1205
1284 LOperand* object() const { return input(); } 1206 LOperand* object() { return inputs_[0]; }
1285 Handle<Object> name() const { return hydrogen()->name(); } 1207 Handle<Object> name() const { return hydrogen()->name(); }
1286 }; 1208 };
1287 1209
1288 1210
1289 class LLoadFunctionPrototype: public LUnaryOperation<1> { 1211 class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 1> {
1290 public: 1212 public:
1291 LLoadFunctionPrototype(LOperand* function, LOperand* temporary) 1213 LLoadFunctionPrototype(LOperand* function, LOperand* temp) {
1292 : LUnaryOperation<1>(function), temporary_(temporary) { } 1214 inputs_[0] = function;
1215 temps_[0] = temp;
1216 }
1293 1217
1294 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype") 1218 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1295 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype) 1219 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1296 1220
1297 LOperand* function() const { return input(); } 1221 LOperand* function() { return inputs_[0]; }
1298 LOperand* temporary() const { return temporary_; }
1299
1300 private:
1301 LOperand* temporary_;
1302 }; 1222 };
1303 1223
1304 1224
1305 class LLoadElements: public LUnaryOperation<1> { 1225 class LLoadElements: public LTemplateInstruction<1, 1> {
1306 public: 1226 public:
1307 explicit LLoadElements(LOperand* obj) : LUnaryOperation<1>(obj) { } 1227 explicit LLoadElements(LOperand* object) {
1228 inputs_[0] = object;
1229 }
1308 1230
1309 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") 1231 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1310 }; 1232 };
1311 1233
1312 1234
1313 class LLoadKeyedFastElement: public LBinaryOperation<1> { 1235 class LLoadKeyedFastElement: public LTemplateInstruction<1, 2> {
1314 public: 1236 public:
1315 LLoadKeyedFastElement(LOperand* elements, LOperand* key) 1237 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1316 : LBinaryOperation<1>(elements, key) { } 1238 inputs_[0] = elements;
1239 inputs_[1] = key;
1240 }
1317 1241
1318 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element") 1242 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1319 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement) 1243 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1320 1244
1321 LOperand* elements() const { return left(); } 1245 LOperand* elements() { return inputs_[0]; }
1322 LOperand* key() const { return right(); } 1246 LOperand* key() { return inputs_[1]; }
1323 }; 1247 };
1324 1248
1325 1249
1326 class LLoadKeyedGeneric: public LBinaryOperation<1> { 1250 class LLoadKeyedGeneric: public LTemplateInstruction<1, 2> {
1327 public: 1251 public:
1328 LLoadKeyedGeneric(LOperand* obj, LOperand* key) 1252 LLoadKeyedGeneric(LOperand* obj, LOperand* key) {
1329 : LBinaryOperation<1>(obj, key) { } 1253 inputs_[0] = obj;
1254 inputs_[1] = key;
1255 }
1330 1256
1331 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") 1257 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1332 1258
1333 LOperand* object() const { return left(); } 1259 LOperand* object() { return inputs_[0]; }
1334 LOperand* key() const { return right(); } 1260 LOperand* key() { return inputs_[1]; }
1335 }; 1261 };
1336 1262
1337 1263
1338 class LLoadGlobal: public LTemplateInstruction<1, 0, 0> { 1264 class LLoadGlobal: public LTemplateInstruction<1, 0, 0> {
1339 public: 1265 public:
1340 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global") 1266 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global")
1341 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal) 1267 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal)
1342 }; 1268 };
1343 1269
1344 1270
1345 class LStoreGlobal: public LUnaryOperation<0> { 1271 class LStoreGlobal: public LTemplateInstruction<0, 1> {
1346 public: 1272 public:
1347 explicit LStoreGlobal(LOperand* value) : LUnaryOperation<0>(value) {} 1273 explicit LStoreGlobal(LOperand* value) {
1274 inputs_[0] = value;
1275 }
1348 1276
1349 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global") 1277 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global")
1350 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal) 1278 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal)
1351 }; 1279 };
1352 1280
1353 1281
1354 class LLoadContextSlot: public LTemplateInstruction<1, 0, 0> { 1282 class LLoadContextSlot: public LTemplateInstruction<1, 0, 0> {
1355 public: 1283 public:
1356 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") 1284 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1357 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) 1285 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1358 1286
1359 int context_chain_length() const { 1287 int context_chain_length() { return hydrogen()->context_chain_length(); }
1360 return hydrogen()->context_chain_length(); 1288 int slot_index() { return hydrogen()->slot_index(); }
1361 }
1362 int slot_index() const { return hydrogen()->slot_index(); }
1363 1289
1364 virtual void PrintDataTo(StringStream* stream); 1290 virtual void PrintDataTo(StringStream* stream);
1365 }; 1291 };
1366 1292
1367 1293
1368 class LPushArgument: public LUnaryOperation<0> { 1294 class LPushArgument: public LTemplateInstruction<0, 1> {
1369 public: 1295 public:
1370 explicit LPushArgument(LOperand* argument) : LUnaryOperation<0>(argument) {} 1296 explicit LPushArgument(LOperand* value) {
1297 inputs_[0] = value;
1298 }
1371 1299
1372 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") 1300 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1373 }; 1301 };
1374 1302
1375 1303
1376 class LGlobalObject: public LTemplateInstruction<1, 0, 0> { 1304 class LGlobalObject: public LTemplateInstruction<1, 0, 0> {
1377 public: 1305 public:
1378 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object") 1306 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1379 }; 1307 };
1380 1308
1381 1309
1382 class LGlobalReceiver: public LTemplateInstruction<1, 0, 0> { 1310 class LGlobalReceiver: public LTemplateInstruction<1, 0, 0> {
1383 public: 1311 public:
1384 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") 1312 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1385 }; 1313 };
1386 1314
1387 1315
1388 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> { 1316 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1389 public: 1317 public:
1390 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") 1318 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1391 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) 1319 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1392 1320
1393 virtual void PrintDataTo(StringStream* stream); 1321 virtual void PrintDataTo(StringStream* stream);
1394 1322
1395 Handle<JSFunction> function() { return hydrogen()->function(); } 1323 Handle<JSFunction> function() { return hydrogen()->function(); }
1396 int arity() const { return hydrogen()->argument_count() - 1; } 1324 int arity() const { return hydrogen()->argument_count() - 1; }
1397 }; 1325 };
1398 1326
1399 1327
1400 class LCallKeyed: public LTemplateInstruction<1, 0, 0> { 1328 class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1401 public: 1329 public:
1330 explicit LCallKeyed(LOperand* key) {
1331 inputs_[0] = key;
1332 }
1333
1402 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") 1334 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1403 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) 1335 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1404 1336
1405 virtual void PrintDataTo(StringStream* stream); 1337 virtual void PrintDataTo(StringStream* stream);
1406 1338
1407 int arity() const { return hydrogen()->argument_count() - 1; } 1339 int arity() const { return hydrogen()->argument_count() - 1; }
1408 }; 1340 };
1409 1341
1410 1342
1411 class LCallNamed: public LTemplateInstruction<1, 0, 0> { 1343 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") 1378 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1447 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) 1379 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1448 1380
1449 virtual void PrintDataTo(StringStream* stream); 1381 virtual void PrintDataTo(StringStream* stream);
1450 1382
1451 Handle<JSFunction> target() const { return hydrogen()->target(); } 1383 Handle<JSFunction> target() const { return hydrogen()->target(); }
1452 int arity() const { return hydrogen()->argument_count() - 1; } 1384 int arity() const { return hydrogen()->argument_count() - 1; }
1453 }; 1385 };
1454 1386
1455 1387
1456 class LCallNew: public LUnaryOperation<1> { 1388 class LCallNew: public LTemplateInstruction<1, 1> {
1457 public: 1389 public:
1458 explicit LCallNew(LOperand* constructor) : LUnaryOperation<1>(constructor) { } 1390 explicit LCallNew(LOperand* constructor) {
1391 inputs_[0] = constructor;
1392 }
1459 1393
1460 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") 1394 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1461 DECLARE_HYDROGEN_ACCESSOR(CallNew) 1395 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1462 1396
1463 virtual void PrintDataTo(StringStream* stream); 1397 virtual void PrintDataTo(StringStream* stream);
1464 1398
1465 int arity() const { return hydrogen()->argument_count() - 1; } 1399 int arity() const { return hydrogen()->argument_count() - 1; }
1466 }; 1400 };
1467 1401
1468 1402
1469 class LCallRuntime: public LTemplateInstruction<1, 0, 0> { 1403 class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1470 public: 1404 public:
1471 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime") 1405 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1472 DECLARE_HYDROGEN_ACCESSOR(CallRuntime) 1406 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1473 1407
1474 Runtime::Function* function() const { return hydrogen()->function(); } 1408 Runtime::Function* function() const { return hydrogen()->function(); }
1475 int arity() const { return hydrogen()->argument_count(); } 1409 int arity() const { return hydrogen()->argument_count(); }
1476 }; 1410 };
1477 1411
1478 1412
1479 class LInteger32ToDouble: public LUnaryOperation<1> { 1413 class LInteger32ToDouble: public LTemplateInstruction<1, 1> {
1480 public: 1414 public:
1481 explicit LInteger32ToDouble(LOperand* use) : LUnaryOperation<1>(use) { } 1415 explicit LInteger32ToDouble(LOperand* value) {
1416 inputs_[0] = value;
1417 }
1482 1418
1483 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double") 1419 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1484 }; 1420 };
1485 1421
1486 1422
1487 class LNumberTagI: public LUnaryOperation<1> { 1423 class LNumberTagI: public LTemplateInstruction<1, 1> {
1488 public: 1424 public:
1489 explicit LNumberTagI(LOperand* use) : LUnaryOperation<1>(use) { } 1425 explicit LNumberTagI(LOperand* value) {
1426 inputs_[0] = value;
1427 }
1490 1428
1491 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") 1429 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1492 }; 1430 };
1493 1431
1494 1432
1495 class LNumberTagD: public LUnaryOperation<1> { 1433 class LNumberTagD: public LTemplateInstruction<1, 1, 1> {
1496 public: 1434 public:
1497 explicit LNumberTagD(LOperand* value, LOperand* temp) 1435 explicit LNumberTagD(LOperand* value, LOperand* temp) {
1498 : LUnaryOperation<1>(value), temp_(temp) { } 1436 inputs_[0] = value;
1437 temps_[0] = temp;
1438 }
1499 1439
1500 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d") 1440 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1501
1502 LOperand* temp() const { return temp_; }
1503
1504 private:
1505 LOperand* temp_;
1506 }; 1441 };
1507 1442
1508 1443
1509 // Sometimes truncating conversion from a tagged value to an int32. 1444 // Sometimes truncating conversion from a tagged value to an int32.
1510 class LDoubleToI: public LUnaryOperation<1> { 1445 class LDoubleToI: public LTemplateInstruction<1, 1, 1> {
1511 public: 1446 public:
1512 LDoubleToI(LOperand* value, LOperand* temporary) 1447 LDoubleToI(LOperand* value, LOperand* temp) {
1513 : LUnaryOperation<1>(value), temporary_(temporary) { } 1448 inputs_[0] = value;
1449 temps_[0] = temp;
1450 }
1514 1451
1515 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i") 1452 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1516 DECLARE_HYDROGEN_ACCESSOR(Change) 1453 DECLARE_HYDROGEN_ACCESSOR(Change)
1517 1454
1518 bool truncating() { return hydrogen()->CanTruncateToInt32(); } 1455 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1519 LOperand* temporary() const { return temporary_; }
1520
1521 private:
1522 LOperand* temporary_;
1523 }; 1456 };
1524 1457
1525 1458
1526 // Truncating conversion from a tagged value to an int32. 1459 // Truncating conversion from a tagged value to an int32.
1527 class LTaggedToI: public LUnaryOperation<1> { 1460 class LTaggedToI: public LTemplateInstruction<1, 1, 1> {
1528 public: 1461 public:
1529 LTaggedToI(LOperand* value, LOperand* temp) 1462 LTaggedToI(LOperand* value, LOperand* temp) {
1530 : LUnaryOperation<1>(value), temp_(temp) { } 1463 inputs_[0] = value;
1464 temps_[0] = temp;
1465 }
1531 1466
1532 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i") 1467 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1533 DECLARE_HYDROGEN_ACCESSOR(Change) 1468 DECLARE_HYDROGEN_ACCESSOR(Change)
1534 1469
1535 bool truncating() { return hydrogen()->CanTruncateToInt32(); } 1470 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1536 LOperand* temp() const { return temp_; }
1537
1538 private:
1539 LOperand* temp_;
1540 }; 1471 };
1541 1472
1542 1473
1543 class LSmiTag: public LUnaryOperation<1> { 1474 class LSmiTag: public LTemplateInstruction<1, 1> {
1544 public: 1475 public:
1545 explicit LSmiTag(LOperand* use) : LUnaryOperation<1>(use) { } 1476 explicit LSmiTag(LOperand* value) {
1477 inputs_[0] = value;
1478 }
1546 1479
1547 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag") 1480 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1548 }; 1481 };
1549 1482
1550 1483
1551 class LNumberUntagD: public LUnaryOperation<1> { 1484 class LNumberUntagD: public LTemplateInstruction<1, 1> {
1552 public: 1485 public:
1553 explicit LNumberUntagD(LOperand* value) : LUnaryOperation<1>(value) { } 1486 explicit LNumberUntagD(LOperand* value) {
1487 inputs_[0] = value;
1488 }
1554 1489
1555 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") 1490 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1556 }; 1491 };
1557 1492
1558 1493
1559 class LSmiUntag: public LUnaryOperation<1> { 1494 class LSmiUntag: public LTemplateInstruction<1, 1> {
1560 public: 1495 public:
1561 LSmiUntag(LOperand* use, bool needs_check) 1496 LSmiUntag(LOperand* value, bool needs_check)
1562 : LUnaryOperation<1>(use), needs_check_(needs_check) { } 1497 : needs_check_(needs_check) {
1498 inputs_[0] = value;
1499 }
1563 1500
1564 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") 1501 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1565 1502
1566 bool needs_check() const { return needs_check_; } 1503 bool needs_check() const { return needs_check_; }
1567 1504
1568 private: 1505 private:
1569 bool needs_check_; 1506 bool needs_check_;
1570 }; 1507 };
1571 1508
1572 1509
1573 class LStoreNamed: public LTemplateInstruction<0, 2, 0> { 1510 class LStoreNamed: public LTemplateInstruction<0, 2, 1> {
1574 public: 1511 public:
1575 LStoreNamed(LOperand* obj, LOperand* val) { 1512 LStoreNamed(LOperand* obj, LOperand* val) {
1576 this->SetInputAt(0, obj); 1513 inputs_[0] = obj;
1577 this->SetInputAt(1, val); 1514 inputs_[1] = val;
1578 } 1515 }
1579 1516
1580 DECLARE_INSTRUCTION(StoreNamed) 1517 DECLARE_INSTRUCTION(StoreNamed)
1581 DECLARE_HYDROGEN_ACCESSOR(StoreNamed) 1518 DECLARE_HYDROGEN_ACCESSOR(StoreNamed)
1582 1519
1583 virtual void PrintDataTo(StringStream* stream); 1520 virtual void PrintDataTo(StringStream* stream);
1584 1521
1585 LOperand* object() const { return this->InputAt(0); } 1522 LOperand* object() { return inputs_[0]; }
1586 LOperand* value() const { return this->InputAt(1); } 1523 LOperand* value() { return inputs_[1]; }
1587 Handle<Object> name() const { return hydrogen()->name(); } 1524 Handle<Object> name() const { return hydrogen()->name(); }
1588 }; 1525 };
1589 1526
1590 1527
1591 class LStoreNamedField: public LStoreNamed { 1528 class LStoreNamedField: public LStoreNamed {
1592 public: 1529 public:
1593 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) 1530 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp)
1594 : LStoreNamed(obj, val), temp_(temp) { } 1531 : LStoreNamed(obj, val) {
1532 temps_[0] = temp;
1533 }
1595 1534
1596 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field") 1535 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1597 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField) 1536 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1598 1537
1599 bool is_in_object() { return hydrogen()->is_in_object(); } 1538 bool is_in_object() { return hydrogen()->is_in_object(); }
1600 int offset() { return hydrogen()->offset(); } 1539 int offset() { return hydrogen()->offset(); }
1601 bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } 1540 bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
1602 Handle<Map> transition() const { return hydrogen()->transition(); } 1541 Handle<Map> transition() const { return hydrogen()->transition(); }
1603
1604 LOperand* temp() { return temp_; }
1605
1606 private:
1607 LOperand* temp_;
1608 }; 1542 };
1609 1543
1610 1544
1611 class LStoreNamedGeneric: public LStoreNamed { 1545 class LStoreNamedGeneric: public LStoreNamed {
1612 public: 1546 public:
1613 LStoreNamedGeneric(LOperand* obj, LOperand* val) 1547 LStoreNamedGeneric(LOperand* obj, LOperand* val)
1614 : LStoreNamed(obj, val) { } 1548 : LStoreNamed(obj, val) { }
1615 1549
1616 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") 1550 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1617 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) 1551 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1618 }; 1552 };
1619 1553
1620 1554
1621 class LStoreKeyed: public LTemplateInstruction<0, 3, 0> { 1555 class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
1622 public: 1556 public:
1623 LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) { 1557 LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) {
1624 this->SetInputAt(0, obj); 1558 inputs_[0] = obj;
1625 this->SetInputAt(1, key); 1559 inputs_[1] = key;
1626 this->SetInputAt(2, val); 1560 inputs_[2] = val;
1627 } 1561 }
1628 1562
1629 DECLARE_INSTRUCTION(StoreKeyed) 1563 DECLARE_INSTRUCTION(StoreKeyed)
1630 1564
1631 virtual void PrintDataTo(StringStream* stream); 1565 virtual void PrintDataTo(StringStream* stream);
1632 1566
1633 LOperand* object() const { return this->InputAt(0); } 1567 LOperand* object() { return inputs_[0]; }
1634 LOperand* key() const { return this->InputAt(1); } 1568 LOperand* key() { return inputs_[1]; }
1635 LOperand* value() const { return this->InputAt(2); } 1569 LOperand* value() { return inputs_[2]; }
1636 }; 1570 };
1637 1571
1638 1572
1639 class LStoreKeyedFastElement: public LStoreKeyed { 1573 class LStoreKeyedFastElement: public LStoreKeyed {
1640 public: 1574 public:
1641 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) 1575 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val)
1642 : LStoreKeyed(obj, key, val) {} 1576 : LStoreKeyed(obj, key, val) {}
1643 1577
1644 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, 1578 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1645 "store-keyed-fast-element") 1579 "store-keyed-fast-element")
1646 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement) 1580 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1647 }; 1581 };
1648 1582
1649 1583
1650 class LStoreKeyedGeneric: public LStoreKeyed { 1584 class LStoreKeyedGeneric: public LStoreKeyed {
1651 public: 1585 public:
1652 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) 1586 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val)
1653 : LStoreKeyed(obj, key, val) { } 1587 : LStoreKeyed(obj, key, val) { }
1654 1588
1655 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") 1589 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1656 }; 1590 };
1657 1591
1658 1592
1659 class LCheckFunction: public LUnaryOperation<0> { 1593 class LCheckFunction: public LTemplateInstruction<0, 1> {
1660 public: 1594 public:
1661 explicit LCheckFunction(LOperand* use) : LUnaryOperation<0>(use) { } 1595 explicit LCheckFunction(LOperand* value) {
1596 inputs_[0] = value;
1597 }
1662 1598
1663 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") 1599 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1664 DECLARE_HYDROGEN_ACCESSOR(CheckFunction) 1600 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1665 }; 1601 };
1666 1602
1667 1603
1668 class LCheckInstanceType: public LUnaryOperation<0> { 1604 class LCheckInstanceType: public LTemplateInstruction<0, 1, 1> {
1669 public: 1605 public:
1670 LCheckInstanceType(LOperand* use, LOperand* temp) 1606 LCheckInstanceType(LOperand* value, LOperand* temp) {
1671 : LUnaryOperation<0>(use), temp_(temp) { } 1607 inputs_[0] = value;
1608 temps_[0] = temp;
1609 }
1672 1610
1673 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") 1611 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1674 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) 1612 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
1675
1676 LOperand* temp() const { return temp_; }
1677
1678 private:
1679 LOperand* temp_;
1680 }; 1613 };
1681 1614
1682 1615
1683 class LCheckMap: public LUnaryOperation<0> { 1616 class LCheckMap: public LTemplateInstruction<0, 1> {
1684 public: 1617 public:
1685 explicit LCheckMap(LOperand* use) : LUnaryOperation<0>(use) { } 1618 explicit LCheckMap(LOperand* value) {
1619 inputs_[0] = value;
1620 }
1686 1621
1687 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map") 1622 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map")
1688 DECLARE_HYDROGEN_ACCESSOR(CheckMap) 1623 DECLARE_HYDROGEN_ACCESSOR(CheckMap)
1689 }; 1624 };
1690 1625
1691 1626
1692 class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 0> { 1627 class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> {
1693 public: 1628 public:
1694 explicit LCheckPrototypeMaps(LOperand* temp) : temp_(temp) { } 1629 explicit LCheckPrototypeMaps(LOperand* temp) {
1630 temps_[0] = temp;
1631 }
1695 1632
1696 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps") 1633 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1697 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps) 1634 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1698 1635
1699 Handle<JSObject> prototype() const { return hydrogen()->prototype(); } 1636 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1700 Handle<JSObject> holder() const { return hydrogen()->holder(); } 1637 Handle<JSObject> holder() const { return hydrogen()->holder(); }
1701
1702 LOperand* temp() const { return temp_; }
1703
1704 private:
1705 LOperand* temp_;
1706 }; 1638 };
1707 1639
1708 1640
1709 class LCheckSmi: public LUnaryOperation<0> { 1641 class LCheckSmi: public LTemplateInstruction<0, 1> {
1710 public: 1642 public:
1711 LCheckSmi(LOperand* use, Condition condition) 1643 LCheckSmi(LOperand* value, Condition condition)
1712 : LUnaryOperation<0>(use), condition_(condition) { } 1644 : condition_(condition) {
1645 inputs_[0] = value;
1646 }
1713 1647
1714 Condition condition() const { return condition_; } 1648 Condition condition() const { return condition_; }
1715 1649
1716 virtual void CompileToNative(LCodeGen* generator); 1650 virtual void CompileToNative(LCodeGen* generator);
1717 virtual const char* Mnemonic() const { 1651 virtual const char* Mnemonic() const {
1718 return (condition_ == zero) ? "check-non-smi" : "check-smi"; 1652 return (condition_ == zero) ? "check-non-smi" : "check-smi";
1719 } 1653 }
1720 1654
1721 private: 1655 private:
1722 Condition condition_; 1656 Condition condition_;
1723 }; 1657 };
1724 1658
1725 1659
1726 class LMaterializedLiteral: public LTemplateInstruction<1, 0, 0> { 1660 class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
1727 public:
1728 DECLARE_INSTRUCTION(MaterializedLiteral)
1729 };
1730
1731
1732 class LArrayLiteral: public LMaterializedLiteral {
1733 public: 1661 public:
1734 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal") 1662 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
1735 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral) 1663 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
1736 }; 1664 };
1737 1665
1738 1666
1739 class LObjectLiteral: public LMaterializedLiteral { 1667 class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
1740 public: 1668 public:
1741 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal") 1669 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
1742 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral) 1670 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
1743 }; 1671 };
1744 1672
1745 1673
1746 class LRegExpLiteral: public LMaterializedLiteral { 1674 class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
1747 public: 1675 public:
1748 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal") 1676 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
1749 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral) 1677 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
1750 }; 1678 };
1751 1679
1752 1680
1753 class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> { 1681 class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
1754 public: 1682 public:
1755 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") 1683 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
1756 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) 1684 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
1757 1685
1758 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); } 1686 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
1759 }; 1687 };
1760 1688
1761 1689
1762 class LTypeof: public LUnaryOperation<1> { 1690 class LTypeof: public LTemplateInstruction<1, 1> {
1763 public: 1691 public:
1764 explicit LTypeof(LOperand* input) : LUnaryOperation<1>(input) { } 1692 explicit LTypeof(LOperand* value) {
1693 inputs_[0] = value;
1694 }
1765 1695
1766 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") 1696 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
1767 }; 1697 };
1768 1698
1769 1699
1770 class LTypeofIs: public LUnaryOperation<1> { 1700 class LTypeofIs: public LTemplateInstruction<1, 1> {
1771 public: 1701 public:
1772 explicit LTypeofIs(LOperand* input) : LUnaryOperation<1>(input) { } 1702 explicit LTypeofIs(LOperand* value) {
1773 virtual void PrintDataTo(StringStream* stream); 1703 inputs_[0] = value;
1704 }
1774 1705
1775 DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof-is") 1706 DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof-is")
1776 DECLARE_HYDROGEN_ACCESSOR(TypeofIs) 1707 DECLARE_HYDROGEN_ACCESSOR(TypeofIs)
1777 1708
1778 Handle<String> type_literal() { return hydrogen()->type_literal(); } 1709 Handle<String> type_literal() { return hydrogen()->type_literal(); }
1710
1711 virtual void PrintDataTo(StringStream* stream);
1779 }; 1712 };
1780 1713
1781 1714
1782 class LTypeofIsAndBranch: public LTypeofIs { 1715 class LTypeofIsAndBranch: public LControlInstruction<1> {
1783 public: 1716 public:
1784 LTypeofIsAndBranch(LOperand* value, 1717 explicit LTypeofIsAndBranch(LOperand* value) {
1785 int true_block_id, 1718 inputs_[0] = value;
1786 int false_block_id) 1719 }
1787 : LTypeofIs(value),
1788 true_block_id_(true_block_id),
1789 false_block_id_(false_block_id) { }
1790 1720
1791 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") 1721 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
1722 DECLARE_HYDROGEN_ACCESSOR(TypeofIs)
1723
1724 Handle<String> type_literal() { return hydrogen()->type_literal(); }
1792 1725
1793 virtual void PrintDataTo(StringStream* stream); 1726 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 }; 1727 };
1803 1728
1804 1729
1805 class LDeleteProperty: public LBinaryOperation<1> { 1730 class LDeleteProperty: public LTemplateInstruction<1, 2> {
1806 public: 1731 public:
1807 LDeleteProperty(LOperand* obj, LOperand* key) 1732 LDeleteProperty(LOperand* obj, LOperand* key) {
1808 : LBinaryOperation<1>(obj, key) { } 1733 inputs_[0] = obj;
1734 inputs_[1] = key;
1735 }
1809 1736
1810 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") 1737 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
1811 1738
1812 LOperand* object() const { return left(); } 1739 LOperand* object() { return inputs_[0]; }
1813 LOperand* key() const { return right(); } 1740 LOperand* key() { return inputs_[1]; }
1814 }; 1741 };
1815 1742
1816 1743
1817 class LOsrEntry: public LTemplateInstruction<0, 0, 0> { 1744 class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
1818 public: 1745 public:
1819 LOsrEntry(); 1746 LOsrEntry();
1820 1747
1821 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") 1748 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
1822 1749
1823 LOperand** SpilledRegisterArray() { return register_spills_; } 1750 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; } 1874 bool is_aborted() const { return status_ == ABORTED; }
1948 1875
1949 void Abort(const char* format, ...); 1876 void Abort(const char* format, ...);
1950 1877
1951 // Methods for getting operands for Use / Define / Temp. 1878 // Methods for getting operands for Use / Define / Temp.
1952 LRegister* ToOperand(Register reg); 1879 LRegister* ToOperand(Register reg);
1953 LUnallocated* ToUnallocated(Register reg); 1880 LUnallocated* ToUnallocated(Register reg);
1954 LUnallocated* ToUnallocated(XMMRegister reg); 1881 LUnallocated* ToUnallocated(XMMRegister reg);
1955 1882
1956 // Methods for setting up define-use relationships. 1883 // Methods for setting up define-use relationships.
1957 LOperand* Use(HValue* value, LUnallocated* operand); 1884 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
1958 LOperand* UseFixed(HValue* value, Register fixed_register); 1885 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
1959 LOperand* UseFixedDouble(HValue* value, XMMRegister fixed_register); 1886 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
1887 XMMRegister fixed_register);
1960 1888
1961 // A value that is guaranteed to be allocated to a register. 1889 // 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 1890 // 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 1891 // instruction. This means that register allocator will not reuse it's
1964 // register for any other operand inside instruction. 1892 // register for any other operand inside instruction.
1965 // Operand created by UseRegisterAtStart is guaranteed to be live only at 1893 // Operand created by UseRegisterAtStart is guaranteed to be live only at
1966 // instruction start. Register allocator is free to assign the same register 1894 // instruction start. Register allocator is free to assign the same register
1967 // to some other operand used inside instruction (i.e. temporary or 1895 // to some other operand used inside instruction (i.e. temporary or
1968 // output). 1896 // output).
1969 LOperand* UseRegister(HValue* value); 1897 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
1970 LOperand* UseRegisterAtStart(HValue* value); 1898 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
1971 1899
1972 // A value in a register that may be trashed. 1900 // An input operand in a register that may be trashed.
1973 LOperand* UseTempRegister(HValue* value); 1901 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
1974 LOperand* Use(HValue* value); 1902
1975 LOperand* UseAtStart(HValue* value); 1903 // An input operand in a register or stack slot.
1976 LOperand* UseOrConstant(HValue* value); 1904 MUST_USE_RESULT LOperand* Use(HValue* value);
1977 LOperand* UseOrConstantAtStart(HValue* value); 1905 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
1978 LOperand* UseRegisterOrConstant(HValue* value); 1906
1979 LOperand* UseRegisterOrConstantAtStart(HValue* value); 1907 // An input operand in a register, stack slot or a constant operand.
1908 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
1909 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
1910
1911 // An input operand in a register or a constant operand.
1912 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
1913 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
1914
1915 // An input operand in register, stack slot or a constant operand.
1916 // Will not be moved to a register even if one is freely available.
1917 MUST_USE_RESULT LOperand* UseAny(HValue* value);
1918
1919 // Temporary operand that must be in a register.
1920 MUST_USE_RESULT LUnallocated* TempRegister();
1921 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
1922 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg);
1980 1923
1981 // Methods for setting up define-use relationships. 1924 // Methods for setting up define-use relationships.
1982 // Return the same instruction that they are passed. 1925 // Return the same instruction that they are passed.
1983 template<int I, int T> 1926 template<int I, int T>
1984 LInstruction* Define(LTemplateInstruction<1, I, T>* instr, 1927 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
1985 LUnallocated* result); 1928 LUnallocated* result);
1986 template<int I, int T> 1929 template<int I, int T>
1987 LInstruction* Define(LTemplateInstruction<1, I, T>* instr); 1930 LInstruction* Define(LTemplateInstruction<1, I, T>* instr);
1988 template<int I, int T> 1931 template<int I, int T>
1989 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr); 1932 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
(...skipping 21 matching lines...) Expand all
2011 HInstruction* hinstr, 1954 HInstruction* hinstr,
2012 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); 1955 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2013 LInstruction* MarkAsSaveDoubles(LInstruction* instr); 1956 LInstruction* MarkAsSaveDoubles(LInstruction* instr);
2014 1957
2015 LInstruction* SetInstructionPendingDeoptimizationEnvironment( 1958 LInstruction* SetInstructionPendingDeoptimizationEnvironment(
2016 LInstruction* instr, int ast_id); 1959 LInstruction* instr, int ast_id);
2017 void ClearInstructionPendingDeoptimizationEnvironment(); 1960 void ClearInstructionPendingDeoptimizationEnvironment();
2018 1961
2019 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env); 1962 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env);
2020 1963
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); 1964 void VisitInstruction(HInstruction* current);
2027 1965
2028 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); 1966 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2029 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); 1967 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2030 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); 1968 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2031 LInstruction* DoArithmeticD(Token::Value op, 1969 LInstruction* DoArithmeticD(Token::Value op,
2032 HArithmeticBinaryOperation* instr); 1970 HArithmeticBinaryOperation* instr);
2033 LInstruction* DoArithmeticT(Token::Value op, 1971 LInstruction* DoArithmeticT(Token::Value op,
2034 HArithmeticBinaryOperation* instr); 1972 HArithmeticBinaryOperation* instr);
2035 1973
(...skipping 12 matching lines...) Expand all
2048 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 1986 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2049 }; 1987 };
2050 1988
2051 #undef DECLARE_HYDROGEN_ACCESSOR 1989 #undef DECLARE_HYDROGEN_ACCESSOR
2052 #undef DECLARE_INSTRUCTION 1990 #undef DECLARE_INSTRUCTION
2053 #undef DECLARE_CONCRETE_INSTRUCTION 1991 #undef DECLARE_CONCRETE_INSTRUCTION
2054 1992
2055 } } // namespace v8::internal 1993 } } // namespace v8::internal
2056 1994
2057 #endif // V8_IA32_LITHIUM_IA32_H_ 1995 #endif // V8_IA32_LITHIUM_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/lithium-gap-resolver-ia32.cc ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698