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

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

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

Powered by Google App Engine
This is Rietveld 408576698