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

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

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

Powered by Google App Engine
This is Rietveld 408576698