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