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

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

Issue 7934002: MIPS: crankshaft implementation (Closed)
Patch Set: rebased on r9823. Created 9 years, 1 month 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
« no previous file with comments | « src/mips/lithium-gap-resolver-mips.cc ('k') | src/mips/lithium-mips.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 14 matching lines...) Expand all
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_MIPS_LITHIUM_MIPS_H_ 28 #ifndef V8_MIPS_LITHIUM_MIPS_H_
29 #define V8_MIPS_LITHIUM_MIPS_H_ 29 #define V8_MIPS_LITHIUM_MIPS_H_
30 30
31 #include "hydrogen.h" 31 #include "hydrogen.h"
32 #include "lithium-allocator.h" 32 #include "lithium-allocator.h"
33 #include "lithium.h" 33 #include "lithium.h"
34 #include "safepoint-table.h" 34 #include "safepoint-table.h"
35 35 #include "utils.h"
36 // Note: this file was taken from the X64 version. ARM has a partially working
37 // lithium implementation, but for now it is not ported to mips.
38 36
39 namespace v8 { 37 namespace v8 {
40 namespace internal { 38 namespace internal {
41 39
42 // Forward declarations. 40 // Forward declarations.
43 class LCodeGen; 41 class LCodeGen;
44 class LEnvironment; 42
45 class Translation; 43 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
44 V(ControlInstruction) \
45 V(Call) \
46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
47
48
49 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
50 V(AccessArgumentsAt) \
51 V(AddI) \
52 V(ApplyArguments) \
53 V(ArgumentsElements) \
54 V(ArgumentsLength) \
55 V(ArithmeticD) \
56 V(ArithmeticT) \
57 V(ArrayLiteral) \
58 V(BitI) \
59 V(BitNotI) \
60 V(BoundsCheck) \
61 V(Branch) \
62 V(CallConstantFunction) \
63 V(CallFunction) \
64 V(CallGlobal) \
65 V(CallKeyed) \
66 V(CallKnownGlobal) \
67 V(CallNamed) \
68 V(CallNew) \
69 V(CallRuntime) \
70 V(CallStub) \
71 V(CheckFunction) \
72 V(CheckInstanceType) \
73 V(CheckMap) \
74 V(CheckNonSmi) \
75 V(CheckPrototypeMaps) \
76 V(CheckSmi) \
77 V(ClampDToUint8) \
78 V(ClampIToUint8) \
79 V(ClampTToUint8) \
80 V(ClassOfTestAndBranch) \
81 V(CmpConstantEqAndBranch) \
82 V(CmpIDAndBranch) \
83 V(CmpObjectEqAndBranch) \
84 V(CmpMapAndBranch) \
85 V(CmpT) \
86 V(ConstantD) \
87 V(ConstantI) \
88 V(ConstantT) \
89 V(Context) \
90 V(DeleteProperty) \
91 V(Deoptimize) \
92 V(DivI) \
93 V(DoubleToI) \
94 V(ElementsKind) \
95 V(FixedArrayBaseLength) \
96 V(FunctionLiteral) \
97 V(GetCachedArrayIndex) \
98 V(GlobalObject) \
99 V(GlobalReceiver) \
100 V(Goto) \
101 V(HasCachedArrayIndexAndBranch) \
102 V(HasInstanceTypeAndBranch) \
103 V(In) \
104 V(InstanceOf) \
105 V(InstanceOfKnownGlobal) \
106 V(InstructionGap) \
107 V(Integer32ToDouble) \
108 V(InvokeFunction) \
109 V(IsConstructCallAndBranch) \
110 V(IsNilAndBranch) \
111 V(IsObjectAndBranch) \
112 V(IsSmiAndBranch) \
113 V(IsUndetectableAndBranch) \
114 V(JSArrayLength) \
115 V(Label) \
116 V(LazyBailout) \
117 V(LoadContextSlot) \
118 V(LoadElements) \
119 V(LoadExternalArrayPointer) \
120 V(LoadFunctionPrototype) \
121 V(LoadGlobalCell) \
122 V(LoadGlobalGeneric) \
123 V(LoadKeyedFastDoubleElement) \
124 V(LoadKeyedFastElement) \
125 V(LoadKeyedGeneric) \
126 V(LoadKeyedSpecializedArrayElement) \
127 V(LoadNamedField) \
128 V(LoadNamedFieldPolymorphic) \
129 V(LoadNamedGeneric) \
130 V(ModI) \
131 V(MulI) \
132 V(NumberTagD) \
133 V(NumberTagI) \
134 V(NumberUntagD) \
135 V(ObjectLiteral) \
136 V(OsrEntry) \
137 V(OuterContext) \
138 V(Parameter) \
139 V(Power) \
140 V(PushArgument) \
141 V(RegExpLiteral) \
142 V(Return) \
143 V(ShiftI) \
144 V(SmiTag) \
145 V(SmiUntag) \
146 V(StackCheck) \
147 V(StoreContextSlot) \
148 V(StoreGlobalCell) \
149 V(StoreGlobalGeneric) \
150 V(StoreKeyedFastDoubleElement) \
151 V(StoreKeyedFastElement) \
152 V(StoreKeyedGeneric) \
153 V(StoreKeyedSpecializedArrayElement) \
154 V(StoreNamedField) \
155 V(StoreNamedGeneric) \
156 V(StringAdd) \
157 V(StringCharCodeAt) \
158 V(StringCharFromCode) \
159 V(StringLength) \
160 V(SubI) \
161 V(TaggedToI) \
162 V(ThisFunction) \
163 V(Throw) \
164 V(ToFastProperties) \
165 V(TransitionElementsKind) \
166 V(Typeof) \
167 V(TypeofIsAndBranch) \
168 V(UnaryMathOperation) \
169 V(UnknownOSRValue) \
170 V(ValueOf)
171
172
173 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
174 virtual Opcode opcode() const { return LInstruction::k##type; } \
175 virtual void CompileToNative(LCodeGen* generator); \
176 virtual const char* Mnemonic() const { return mnemonic; } \
177 static L##type* cast(LInstruction* instr) { \
178 ASSERT(instr->Is##type()); \
179 return reinterpret_cast<L##type*>(instr); \
180 }
181
182
183 #define DECLARE_HYDROGEN_ACCESSOR(type) \
184 H##type* hydrogen() const { \
185 return H##type::cast(hydrogen_value()); \
186 }
187
46 188
47 class LInstruction: public ZoneObject { 189 class LInstruction: public ZoneObject {
48 public: 190 public:
49 LInstruction() { } 191 LInstruction()
192 : environment_(NULL),
193 hydrogen_value_(NULL),
194 is_call_(false),
195 is_save_doubles_(false) { }
50 virtual ~LInstruction() { } 196 virtual ~LInstruction() { }
51 197
52 // Predicates should be generated by macro as in lithium-ia32.h. 198 virtual void CompileToNative(LCodeGen* generator) = 0;
53 virtual bool IsLabel() const { 199 virtual const char* Mnemonic() const = 0;
54 UNIMPLEMENTED(); 200 virtual void PrintTo(StringStream* stream);
55 return false; 201 virtual void PrintDataTo(StringStream* stream) = 0;
56 } 202 virtual void PrintOutputOperandTo(StringStream* stream) = 0;
57 virtual bool IsOsrEntry() const { 203
58 UNIMPLEMENTED(); 204 enum Opcode {
59 return false; 205 // Declare a unique enum value for each instruction.
60 } 206 #define DECLARE_OPCODE(type) k##type,
61 207 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
62 LPointerMap* pointer_map() const { 208 kNumberOfInstructions
63 UNIMPLEMENTED(); 209 #undef DECLARE_OPCODE
64 return NULL; 210 };
65 } 211
66 212 virtual Opcode opcode() const = 0;
67 bool HasPointerMap() const { 213
68 UNIMPLEMENTED(); 214 // Declare non-virtual type testers for all leaf IR classes.
69 return false; 215 #define DECLARE_PREDICATE(type) \
70 } 216 bool Is##type() const { return opcode() == k##type; }
71 217 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
72 void set_environment(LEnvironment* env) { UNIMPLEMENTED(); } 218 #undef DECLARE_PREDICATE
73 219
74 LEnvironment* environment() const { 220 // Declare virtual predicates for instructions that don't have
75 UNIMPLEMENTED(); 221 // an opcode.
76 return NULL; 222 virtual bool IsGap() const { return false; }
77 } 223
78 224 virtual bool IsControl() const { return false; }
79 bool HasEnvironment() const { 225
80 UNIMPLEMENTED(); 226 void set_environment(LEnvironment* env) { environment_ = env; }
81 return false; 227 LEnvironment* environment() const { return environment_; }
82 } 228 bool HasEnvironment() const { return environment_ != NULL; }
83 229
84 virtual void PrintTo(StringStream* stream) const { UNIMPLEMENTED(); } 230 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
85 231 LPointerMap* pointer_map() const { return pointer_map_.get(); }
86 virtual bool IsControl() const { 232 bool HasPointerMap() const { return pointer_map_.is_set(); }
87 UNIMPLEMENTED(); 233
88 return false; 234 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
89 } 235 HValue* hydrogen_value() const { return hydrogen_value_; }
90 236
91 void MarkAsCall() { UNIMPLEMENTED(); } 237 void set_deoptimization_environment(LEnvironment* env) {
92 void MarkAsSaveDoubles() { UNIMPLEMENTED(); } 238 deoptimization_environment_.set(env);
239 }
240 LEnvironment* deoptimization_environment() const {
241 return deoptimization_environment_.get();
242 }
243 bool HasDeoptimizationEnvironment() const {
244 return deoptimization_environment_.is_set();
245 }
246
247 void MarkAsCall() { is_call_ = true; }
248 void MarkAsSaveDoubles() { is_save_doubles_ = true; }
93 249
94 // Interface to the register allocator and iterators. 250 // Interface to the register allocator and iterators.
95 bool IsMarkedAsCall() const { 251 bool IsMarkedAsCall() const { return is_call_; }
96 UNIMPLEMENTED(); 252 bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; }
97 return false; 253
98 } 254 virtual bool HasResult() const = 0;
99 255 virtual LOperand* result() = 0;
100 bool IsMarkedAsSaveDoubles() const { 256
101 UNIMPLEMENTED(); 257 virtual int InputCount() = 0;
102 return false; 258 virtual LOperand* InputAt(int i) = 0;
103 } 259 virtual int TempCount() = 0;
104 260 virtual LOperand* TempAt(int i) = 0;
105 virtual bool HasResult() const { 261
106 UNIMPLEMENTED(); 262 LOperand* FirstInput() { return InputAt(0); }
107 return false; 263 LOperand* Output() { return HasResult() ? result() : NULL; }
108 }
109
110 virtual LOperand* result() {
111 UNIMPLEMENTED();
112 return NULL;
113 }
114
115 virtual int InputCount() {
116 UNIMPLEMENTED();
117 return 0;
118 }
119
120 virtual LOperand* InputAt(int i) {
121 UNIMPLEMENTED();
122 return NULL;
123 }
124
125 virtual int TempCount() {
126 UNIMPLEMENTED();
127 return 0;
128 }
129
130 virtual LOperand* TempAt(int i) {
131 UNIMPLEMENTED();
132 return NULL;
133 }
134
135 LOperand* FirstInput() {
136 UNIMPLEMENTED();
137 return NULL;
138 }
139
140 LOperand* Output() {
141 UNIMPLEMENTED();
142 return NULL;
143 }
144 264
145 #ifdef DEBUG 265 #ifdef DEBUG
146 void VerifyCall() { UNIMPLEMENTED(); } 266 void VerifyCall();
147 #endif 267 #endif
148 }; 268
149 269 private:
150 270 LEnvironment* environment_;
151 class LGap: public LInstruction { 271 SetOncePointer<LPointerMap> pointer_map_;
152 public: 272 HValue* hydrogen_value_;
153 explicit LGap(HBasicBlock* block) { } 273 SetOncePointer<LEnvironment> deoptimization_environment_;
154 274 bool is_call_;
155 HBasicBlock* block() const { 275 bool is_save_doubles_;
156 UNIMPLEMENTED(); 276 };
157 return NULL; 277
158 } 278
279 // R = number of result operands (0 or 1).
280 // I = number of input operands.
281 // T = number of temporary operands.
282 template<int R, int I, int T>
283 class LTemplateInstruction: public LInstruction {
284 public:
285 // Allow 0 or 1 output operands.
286 STATIC_ASSERT(R == 0 || R == 1);
287 virtual bool HasResult() const { return R != 0; }
288 void set_result(LOperand* operand) { results_[0] = operand; }
289 LOperand* result() { return results_[0]; }
290
291 int InputCount() { return I; }
292 LOperand* InputAt(int i) { return inputs_[i]; }
293
294 int TempCount() { return T; }
295 LOperand* TempAt(int i) { return temps_[i]; }
296
297 virtual void PrintDataTo(StringStream* stream);
298 virtual void PrintOutputOperandTo(StringStream* stream);
299
300 protected:
301 EmbeddedContainer<LOperand*, R> results_;
302 EmbeddedContainer<LOperand*, I> inputs_;
303 EmbeddedContainer<LOperand*, T> temps_;
304 };
305
306
307 class LGap: public LTemplateInstruction<0, 0, 0> {
308 public:
309 explicit LGap(HBasicBlock* block)
310 : block_(block) {
311 parallel_moves_[BEFORE] = NULL;
312 parallel_moves_[START] = NULL;
313 parallel_moves_[END] = NULL;
314 parallel_moves_[AFTER] = NULL;
315 }
316
317 // Can't use the DECLARE-macro here because of sub-classes.
318 virtual bool IsGap() const { return true; }
319 virtual void PrintDataTo(StringStream* stream);
320 static LGap* cast(LInstruction* instr) {
321 ASSERT(instr->IsGap());
322 return reinterpret_cast<LGap*>(instr);
323 }
324
325 bool IsRedundant() const;
326
327 HBasicBlock* block() const { return block_; }
159 328
160 enum InnerPosition { 329 enum InnerPosition {
161 BEFORE, 330 BEFORE,
162 START, 331 START,
163 END, 332 END,
164 AFTER, 333 AFTER,
165 FIRST_INNER_POSITION = BEFORE, 334 FIRST_INNER_POSITION = BEFORE,
166 LAST_INNER_POSITION = AFTER 335 LAST_INNER_POSITION = AFTER
167 }; 336 };
168 337
169 LParallelMove* GetOrCreateParallelMove(InnerPosition pos) { 338 LParallelMove* GetOrCreateParallelMove(InnerPosition pos) {
170 UNIMPLEMENTED(); 339 if (parallel_moves_[pos] == NULL) parallel_moves_[pos] = new LParallelMove;
171 return NULL; 340 return parallel_moves_[pos];
172 } 341 }
173 342
174 LParallelMove* GetParallelMove(InnerPosition pos) { 343 LParallelMove* GetParallelMove(InnerPosition pos) {
175 UNIMPLEMENTED(); 344 return parallel_moves_[pos];
176 return NULL; 345 }
177 } 346
347 private:
348 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
349 HBasicBlock* block_;
350 };
351
352
353 class LInstructionGap: public LGap {
354 public:
355 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
356
357 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
358 };
359
360
361 class LGoto: public LTemplateInstruction<0, 0, 0> {
362 public:
363 explicit LGoto(int block_id) : block_id_(block_id) { }
364
365 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
366 virtual void PrintDataTo(StringStream* stream);
367 virtual bool IsControl() const { return true; }
368
369 int block_id() const { return block_id_; }
370
371 private:
372 int block_id_;
373 };
374
375
376 class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
377 public:
378 LLazyBailout() : gap_instructions_size_(0) { }
379
380 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
381
382 void set_gap_instructions_size(int gap_instructions_size) {
383 gap_instructions_size_ = gap_instructions_size;
384 }
385 int gap_instructions_size() { return gap_instructions_size_; }
386
387 private:
388 int gap_instructions_size_;
389 };
390
391
392 class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
393 public:
394 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
178 }; 395 };
179 396
180 397
181 class LLabel: public LGap { 398 class LLabel: public LGap {
182 public: 399 public:
183 explicit LLabel(HBasicBlock* block) : LGap(block) { } 400 explicit LLabel(HBasicBlock* block)
184 }; 401 : LGap(block), replacement_(NULL) { }
185 402
186 403 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
187 class LOsrEntry: public LInstruction { 404
188 public: 405 virtual void PrintDataTo(StringStream* stream);
189 // Function could be generated by a macro as in lithium-ia32.h. 406
190 static LOsrEntry* cast(LInstruction* instr) { 407 int block_id() const { return block()->block_id(); }
191 UNIMPLEMENTED(); 408 bool is_loop_header() const { return block()->IsLoopHeader(); }
192 return NULL; 409 Label* label() { return &label_; }
193 } 410 LLabel* replacement() const { return replacement_; }
194 411 void set_replacement(LLabel* label) { replacement_ = label; }
195 LOperand** SpilledRegisterArray() { 412 bool HasReplacement() const { return replacement_ != NULL; }
196 UNIMPLEMENTED(); 413
197 return NULL; 414 private:
198 } 415 Label label_;
199 LOperand** SpilledDoubleRegisterArray() { 416 LLabel* replacement_;
200 UNIMPLEMENTED(); 417 };
201 return NULL; 418
202 } 419
203 420 class LParameter: public LTemplateInstruction<1, 0, 0> {
204 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand) { 421 public:
205 UNIMPLEMENTED(); 422 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
206 } 423 };
424
425
426 class LCallStub: public LTemplateInstruction<1, 0, 0> {
427 public:
428 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
429 DECLARE_HYDROGEN_ACCESSOR(CallStub)
430
431 TranscendentalCache::Type transcendental_type() {
432 return hydrogen()->transcendental_type();
433 }
434 };
435
436
437 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
438 public:
439 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
440 };
441
442
443 template<int I, int T>
444 class LControlInstruction: public LTemplateInstruction<0, I, T> {
445 public:
446 virtual bool IsControl() const { return true; }
447
448 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
449 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
450 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
451 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
452
453 private:
454 HControlInstruction* hydrogen() {
455 return HControlInstruction::cast(this->hydrogen_value());
456 }
457 };
458
459
460 class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
461 public:
462 LApplyArguments(LOperand* function,
463 LOperand* receiver,
464 LOperand* length,
465 LOperand* elements) {
466 inputs_[0] = function;
467 inputs_[1] = receiver;
468 inputs_[2] = length;
469 inputs_[3] = elements;
470 }
471
472 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
473
474 LOperand* function() { return inputs_[0]; }
475 LOperand* receiver() { return inputs_[1]; }
476 LOperand* length() { return inputs_[2]; }
477 LOperand* elements() { return inputs_[3]; }
478 };
479
480
481 class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
482 public:
483 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
484 inputs_[0] = arguments;
485 inputs_[1] = length;
486 inputs_[2] = index;
487 }
488
489 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
490
491 LOperand* arguments() { return inputs_[0]; }
492 LOperand* length() { return inputs_[1]; }
493 LOperand* index() { return inputs_[2]; }
494
495 virtual void PrintDataTo(StringStream* stream);
496 };
497
498
499 class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
500 public:
501 explicit LArgumentsLength(LOperand* elements) {
502 inputs_[0] = elements;
503 }
504
505 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
506 };
507
508
509 class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
510 public:
511 LArgumentsElements() { }
512
513 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
514 };
515
516
517 class LModI: public LTemplateInstruction<1, 2, 3> {
518 public:
519 // Used when the right hand is a constant power of 2.
520 LModI(LOperand* left,
521 LOperand* right) {
522 inputs_[0] = left;
523 inputs_[1] = right;
524 temps_[0] = NULL;
525 temps_[1] = NULL;
526 temps_[2] = NULL;
527 }
528
529 // Used for the standard case.
530 LModI(LOperand* left,
531 LOperand* right,
532 LOperand* temp1,
533 LOperand* temp2,
534 LOperand* temp3) {
535 inputs_[0] = left;
536 inputs_[1] = right;
537 temps_[0] = temp1;
538 temps_[1] = temp2;
539 temps_[2] = temp3;
540 }
541
542 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
543 DECLARE_HYDROGEN_ACCESSOR(Mod)
544 };
545
546
547 class LDivI: public LTemplateInstruction<1, 2, 0> {
548 public:
549 LDivI(LOperand* left, LOperand* right) {
550 inputs_[0] = left;
551 inputs_[1] = right;
552 }
553
554 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
555 DECLARE_HYDROGEN_ACCESSOR(Div)
556 };
557
558
559 class LMulI: public LTemplateInstruction<1, 2, 1> {
560 public:
561 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
562 inputs_[0] = left;
563 inputs_[1] = right;
564 temps_[0] = temp;
565 }
566
567 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
568 DECLARE_HYDROGEN_ACCESSOR(Mul)
569 };
570
571
572 class LCmpIDAndBranch: public LControlInstruction<2, 0> {
573 public:
574 LCmpIDAndBranch(LOperand* left, LOperand* right) {
575 inputs_[0] = left;
576 inputs_[1] = right;
577 }
578
579 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
580 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
581
582 Token::Value op() const { return hydrogen()->token(); }
583 bool is_double() const {
584 return hydrogen()->GetInputRepresentation().IsDouble();
585 }
586
587 virtual void PrintDataTo(StringStream* stream);
588 };
589
590
591 class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
592 public:
593 LUnaryMathOperation(LOperand* value, LOperand* temp) {
594 inputs_[0] = value;
595 temps_[0] = temp;
596 }
597
598 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
599 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
600
601 virtual void PrintDataTo(StringStream* stream);
602 BuiltinFunctionId op() const { return hydrogen()->op(); }
603 };
604
605
606 class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
607 public:
608 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
609 inputs_[0] = left;
610 inputs_[1] = right;
611 }
612
613 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
614 "cmp-object-eq-and-branch")
615 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
616 };
617
618
619 class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
620 public:
621 explicit LCmpConstantEqAndBranch(LOperand* left) {
622 inputs_[0] = left;
623 }
624
625 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
626 "cmp-constant-eq-and-branch")
627 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
628 };
629
630
631 class LIsNilAndBranch: public LControlInstruction<1, 0> {
632 public:
633 explicit LIsNilAndBranch(LOperand* value) {
634 inputs_[0] = value;
635 }
636
637 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
638 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
639
640 EqualityKind kind() const { return hydrogen()->kind(); }
641 NilValue nil() const { return hydrogen()->nil(); }
642
643 virtual void PrintDataTo(StringStream* stream);
644 };
645
646
647 class LIsObjectAndBranch: public LControlInstruction<1, 1> {
648 public:
649 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
650 inputs_[0] = value;
651 temps_[0] = temp;
652 }
653
654 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
655 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
656
657 virtual void PrintDataTo(StringStream* stream);
658 };
659
660
661 class LIsSmiAndBranch: public LControlInstruction<1, 0> {
662 public:
663 explicit LIsSmiAndBranch(LOperand* value) {
664 inputs_[0] = value;
665 }
666
667 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
668 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
669
670 virtual void PrintDataTo(StringStream* stream);
671 };
672
673
674 class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
675 public:
676 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
677 inputs_[0] = value;
678 temps_[0] = temp;
679 }
680
681 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
682 "is-undetectable-and-branch")
683 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
684
685 virtual void PrintDataTo(StringStream* stream);
686 };
687
688
689 class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
690 public:
691 explicit LHasInstanceTypeAndBranch(LOperand* value) {
692 inputs_[0] = value;
693 }
694
695 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
696 "has-instance-type-and-branch")
697 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
698
699 virtual void PrintDataTo(StringStream* stream);
700 };
701
702
703 class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
704 public:
705 explicit LGetCachedArrayIndex(LOperand* value) {
706 inputs_[0] = value;
707 }
708
709 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
710 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
711 };
712
713
714 class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
715 public:
716 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
717 inputs_[0] = value;
718 }
719
720 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
721 "has-cached-array-index-and-branch")
722 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
723
724 virtual void PrintDataTo(StringStream* stream);
725 };
726
727
728 class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
729 public:
730 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
731 inputs_[0] = value;
732 temps_[0] = temp;
733 }
734
735 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
736 "class-of-test-and-branch")
737 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
738
739 virtual void PrintDataTo(StringStream* stream);
740 };
741
742
743 class LCmpT: public LTemplateInstruction<1, 2, 0> {
744 public:
745 LCmpT(LOperand* left, LOperand* right) {
746 inputs_[0] = left;
747 inputs_[1] = right;
748 }
749
750 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
751 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
752
753 Token::Value op() const { return hydrogen()->token(); }
754 };
755
756
757 class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
758 public:
759 LInstanceOf(LOperand* left, LOperand* right) {
760 inputs_[0] = left;
761 inputs_[1] = right;
762 }
763
764 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
765 };
766
767
768 class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
769 public:
770 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
771 inputs_[0] = value;
772 temps_[0] = temp;
773 }
774
775 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
776 "instance-of-known-global")
777 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
778
779 Handle<JSFunction> function() const { return hydrogen()->function(); }
780 };
781
782
783 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
784 public:
785 LBoundsCheck(LOperand* index, LOperand* length) {
786 inputs_[0] = index;
787 inputs_[1] = length;
788 }
789
790 LOperand* index() { return inputs_[0]; }
791 LOperand* length() { return inputs_[1]; }
792
793 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
794 };
795
796
797 class LBitI: public LTemplateInstruction<1, 2, 0> {
798 public:
799 LBitI(Token::Value op, LOperand* left, LOperand* right)
800 : op_(op) {
801 inputs_[0] = left;
802 inputs_[1] = right;
803 }
804
805 Token::Value op() const { return op_; }
806
807 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
808
809 private:
810 Token::Value op_;
811 };
812
813
814 class LShiftI: public LTemplateInstruction<1, 2, 0> {
815 public:
816 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
817 : op_(op), can_deopt_(can_deopt) {
818 inputs_[0] = left;
819 inputs_[1] = right;
820 }
821
822 Token::Value op() const { return op_; }
823
824 bool can_deopt() const { return can_deopt_; }
825
826 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
827
828 private:
829 Token::Value op_;
830 bool can_deopt_;
831 };
832
833
834 class LSubI: public LTemplateInstruction<1, 2, 0> {
835 public:
836 LSubI(LOperand* left, LOperand* right) {
837 inputs_[0] = left;
838 inputs_[1] = right;
839 }
840
841 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
842 DECLARE_HYDROGEN_ACCESSOR(Sub)
843 };
844
845
846 class LConstantI: public LTemplateInstruction<1, 0, 0> {
847 public:
848 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
849 DECLARE_HYDROGEN_ACCESSOR(Constant)
850
851 int32_t value() const { return hydrogen()->Integer32Value(); }
852 };
853
854
855 class LConstantD: public LTemplateInstruction<1, 0, 0> {
856 public:
857 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
858 DECLARE_HYDROGEN_ACCESSOR(Constant)
859
860 double value() const { return hydrogen()->DoubleValue(); }
861 };
862
863
864 class LConstantT: public LTemplateInstruction<1, 0, 0> {
865 public:
866 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
867 DECLARE_HYDROGEN_ACCESSOR(Constant)
868
869 Handle<Object> value() const { return hydrogen()->handle(); }
870 };
871
872
873 class LBranch: public LControlInstruction<1, 0> {
874 public:
875 explicit LBranch(LOperand* value) {
876 inputs_[0] = value;
877 }
878
879 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
880 DECLARE_HYDROGEN_ACCESSOR(Branch)
881
882 virtual void PrintDataTo(StringStream* stream);
883 };
884
885
886 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
887 public:
888 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
889 inputs_[0] = value;
890 temps_[0] = temp;
891 }
892
893 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
894 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
895
896 virtual bool IsControl() const { return true; }
897
898 Handle<Map> map() const { return hydrogen()->map(); }
899 int true_block_id() const {
900 return hydrogen()->FirstSuccessor()->block_id();
901 }
902 int false_block_id() const {
903 return hydrogen()->SecondSuccessor()->block_id();
904 }
905 };
906
907
908 class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
909 public:
910 explicit LJSArrayLength(LOperand* value) {
911 inputs_[0] = value;
912 }
913
914 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
915 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
916 };
917
918
919 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
920 public:
921 explicit LFixedArrayBaseLength(LOperand* value) {
922 inputs_[0] = value;
923 }
924
925 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
926 "fixed-array-base-length")
927 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
928 };
929
930
931 class LElementsKind: public LTemplateInstruction<1, 1, 0> {
932 public:
933 explicit LElementsKind(LOperand* value) {
934 inputs_[0] = value;
935 }
936
937 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
938 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
939 };
940
941
942 class LValueOf: public LTemplateInstruction<1, 1, 1> {
943 public:
944 LValueOf(LOperand* value, LOperand* temp) {
945 inputs_[0] = value;
946 temps_[0] = temp;
947 }
948
949 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
950 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
951 };
952
953
954 class LThrow: public LTemplateInstruction<0, 1, 0> {
955 public:
956 explicit LThrow(LOperand* value) {
957 inputs_[0] = value;
958 }
959
960 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
961 };
962
963
964 class LBitNotI: public LTemplateInstruction<1, 1, 0> {
965 public:
966 explicit LBitNotI(LOperand* value) {
967 inputs_[0] = value;
968 }
969
970 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
971 };
972
973
974 class LAddI: public LTemplateInstruction<1, 2, 0> {
975 public:
976 LAddI(LOperand* left, LOperand* right) {
977 inputs_[0] = left;
978 inputs_[1] = right;
979 }
980
981 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
982 DECLARE_HYDROGEN_ACCESSOR(Add)
983 };
984
985
986 class LPower: public LTemplateInstruction<1, 2, 0> {
987 public:
988 LPower(LOperand* left, LOperand* right) {
989 inputs_[0] = left;
990 inputs_[1] = right;
991 }
992
993 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
994 DECLARE_HYDROGEN_ACCESSOR(Power)
995 };
996
997
998 class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
999 public:
1000 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1001 : op_(op) {
1002 inputs_[0] = left;
1003 inputs_[1] = right;
1004 }
1005
1006 Token::Value op() const { return op_; }
1007
1008 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1009 virtual void CompileToNative(LCodeGen* generator);
1010 virtual const char* Mnemonic() const;
1011
1012 private:
1013 Token::Value op_;
1014 };
1015
1016
1017 class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1018 public:
1019 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1020 : op_(op) {
1021 inputs_[0] = left;
1022 inputs_[1] = right;
1023 }
1024
1025 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1026 virtual void CompileToNative(LCodeGen* generator);
1027 virtual const char* Mnemonic() const;
1028
1029 Token::Value op() const { return op_; }
1030
1031 private:
1032 Token::Value op_;
1033 };
1034
1035
1036 class LReturn: public LTemplateInstruction<0, 1, 0> {
1037 public:
1038 explicit LReturn(LOperand* value) {
1039 inputs_[0] = value;
1040 }
1041
1042 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1043 };
1044
1045
1046 class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1047 public:
1048 explicit LLoadNamedField(LOperand* object) {
1049 inputs_[0] = object;
1050 }
1051
1052 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1053 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1054 };
1055
1056
1057 class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1058 public:
1059 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1060 inputs_[0] = object;
1061 }
1062
1063 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1064 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
1065
1066 LOperand* object() { return inputs_[0]; }
1067 };
1068
1069
1070 class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1071 public:
1072 explicit LLoadNamedGeneric(LOperand* object) {
1073 inputs_[0] = object;
1074 }
1075
1076 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1077 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1078
1079 LOperand* object() { return inputs_[0]; }
1080 Handle<Object> name() const { return hydrogen()->name(); }
1081 };
1082
1083
1084 class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1085 public:
1086 explicit LLoadFunctionPrototype(LOperand* function) {
1087 inputs_[0] = function;
1088 }
1089
1090 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1091 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1092
1093 LOperand* function() { return inputs_[0]; }
1094 };
1095
1096
1097 class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1098 public:
1099 explicit LLoadElements(LOperand* object) {
1100 inputs_[0] = object;
1101 }
1102
1103 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1104 };
1105
1106
1107 class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1108 public:
1109 explicit LLoadExternalArrayPointer(LOperand* object) {
1110 inputs_[0] = object;
1111 }
1112
1113 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1114 "load-external-array-pointer")
1115 };
1116
1117
1118 class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> {
1119 public:
1120 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1121 inputs_[0] = elements;
1122 inputs_[1] = key;
1123 }
1124
1125 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1126 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1127
1128 LOperand* elements() { return inputs_[0]; }
1129 LOperand* key() { return inputs_[1]; }
1130 };
1131
1132
1133 class LLoadKeyedFastDoubleElement: public LTemplateInstruction<1, 2, 0> {
1134 public:
1135 LLoadKeyedFastDoubleElement(LOperand* elements, LOperand* key) {
1136 inputs_[0] = elements;
1137 inputs_[1] = key;
1138 }
1139
1140 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement,
1141 "load-keyed-fast-double-element")
1142 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastDoubleElement)
1143
1144 LOperand* elements() { return inputs_[0]; }
1145 LOperand* key() { return inputs_[1]; }
1146 };
1147
1148
1149 class LLoadKeyedSpecializedArrayElement: public LTemplateInstruction<1, 2, 0> {
1150 public:
1151 LLoadKeyedSpecializedArrayElement(LOperand* external_pointer,
1152 LOperand* key) {
1153 inputs_[0] = external_pointer;
1154 inputs_[1] = key;
1155 }
1156
1157 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement,
1158 "load-keyed-specialized-array-element")
1159 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedSpecializedArrayElement)
1160
1161 LOperand* external_pointer() { return inputs_[0]; }
1162 LOperand* key() { return inputs_[1]; }
1163 ElementsKind elements_kind() const {
1164 return hydrogen()->elements_kind();
1165 }
1166 };
1167
1168
1169 class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1170 public:
1171 LLoadKeyedGeneric(LOperand* obj, LOperand* key) {
1172 inputs_[0] = obj;
1173 inputs_[1] = key;
1174 }
1175
1176 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1177
1178 LOperand* object() { return inputs_[0]; }
1179 LOperand* key() { return inputs_[1]; }
1180 };
1181
1182
1183 class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1184 public:
1185 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1186 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1187 };
1188
1189
1190 class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1191 public:
1192 explicit LLoadGlobalGeneric(LOperand* global_object) {
1193 inputs_[0] = global_object;
1194 }
1195
1196 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1197 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1198
1199 LOperand* global_object() { return inputs_[0]; }
1200 Handle<Object> name() const { return hydrogen()->name(); }
1201 bool for_typeof() const { return hydrogen()->for_typeof(); }
1202 };
1203
1204
1205 class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1206 public:
1207 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1208 inputs_[0] = value;
1209 temps_[0] = temp;
1210 }
1211
1212 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1213 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1214 };
1215
1216
1217 class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1218 public:
1219 explicit LStoreGlobalGeneric(LOperand* global_object,
1220 LOperand* value) {
1221 inputs_[0] = global_object;
1222 inputs_[1] = value;
1223 }
1224
1225 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1226 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1227
1228 LOperand* global_object() { return InputAt(0); }
1229 Handle<Object> name() const { return hydrogen()->name(); }
1230 LOperand* value() { return InputAt(1); }
1231 bool strict_mode() { return hydrogen()->strict_mode(); }
1232 };
1233
1234
1235 class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1236 public:
1237 explicit LLoadContextSlot(LOperand* context) {
1238 inputs_[0] = context;
1239 }
1240
1241 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1242 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1243
1244 LOperand* context() { return InputAt(0); }
1245 int slot_index() { return hydrogen()->slot_index(); }
1246
1247 virtual void PrintDataTo(StringStream* stream);
1248 };
1249
1250
1251 class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1252 public:
1253 LStoreContextSlot(LOperand* context, LOperand* value) {
1254 inputs_[0] = context;
1255 inputs_[1] = value;
1256 }
1257
1258 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1259 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1260
1261 LOperand* context() { return InputAt(0); }
1262 LOperand* value() { return InputAt(1); }
1263 int slot_index() { return hydrogen()->slot_index(); }
1264
1265 virtual void PrintDataTo(StringStream* stream);
1266 };
1267
1268
1269 class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1270 public:
1271 explicit LPushArgument(LOperand* value) {
1272 inputs_[0] = value;
1273 }
1274
1275 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1276 };
1277
1278
1279 class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1280 public:
1281 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1282 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1283 };
1284
1285
1286 class LContext: public LTemplateInstruction<1, 0, 0> {
1287 public:
1288 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1289 };
1290
1291
1292 class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1293 public:
1294 explicit LOuterContext(LOperand* context) {
1295 inputs_[0] = context;
1296 }
1297
1298 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
1299
1300 LOperand* context() { return InputAt(0); }
1301 };
1302
1303
1304 class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1305 public:
1306 explicit LGlobalObject(LOperand* context) {
1307 inputs_[0] = context;
1308 }
1309
1310 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1311
1312 LOperand* context() { return InputAt(0); }
1313 };
1314
1315
1316 class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1317 public:
1318 explicit LGlobalReceiver(LOperand* global_object) {
1319 inputs_[0] = global_object;
1320 }
1321
1322 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1323
1324 LOperand* global() { return InputAt(0); }
1325 };
1326
1327
1328 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1329 public:
1330 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1331 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1332
1333 virtual void PrintDataTo(StringStream* stream);
1334
1335 Handle<JSFunction> function() { return hydrogen()->function(); }
1336 int arity() const { return hydrogen()->argument_count() - 1; }
1337 };
1338
1339
1340 class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1341 public:
1342 explicit LInvokeFunction(LOperand* function) {
1343 inputs_[0] = function;
1344 }
1345
1346 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1347 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1348
1349 LOperand* function() { return inputs_[0]; }
1350
1351 virtual void PrintDataTo(StringStream* stream);
1352
1353 int arity() const { return hydrogen()->argument_count() - 1; }
1354 };
1355
1356
1357 class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1358 public:
1359 explicit LCallKeyed(LOperand* key) {
1360 inputs_[0] = key;
1361 }
1362
1363 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1364 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1365
1366 virtual void PrintDataTo(StringStream* stream);
1367
1368 int arity() const { return hydrogen()->argument_count() - 1; }
1369 };
1370
1371
1372
1373 class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1374 public:
1375 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1376 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1377
1378 virtual void PrintDataTo(StringStream* stream);
1379
1380 Handle<String> name() const { return hydrogen()->name(); }
1381 int arity() const { return hydrogen()->argument_count() - 1; }
1382 };
1383
1384
1385 class LCallFunction: public LTemplateInstruction<1, 0, 0> {
1386 public:
1387 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1388 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1389
1390 int arity() const { return hydrogen()->argument_count() - 2; }
1391 };
1392
1393
1394 class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1395 public:
1396 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1397 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1398
1399 virtual void PrintDataTo(StringStream* stream);
1400
1401 Handle<String> name() const {return hydrogen()->name(); }
1402 int arity() const { return hydrogen()->argument_count() - 1; }
1403 };
1404
1405
1406 class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1407 public:
1408 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1409 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1410
1411 virtual void PrintDataTo(StringStream* stream);
1412
1413 Handle<JSFunction> target() const { return hydrogen()->target(); }
1414 int arity() const { return hydrogen()->argument_count() - 1; }
1415 };
1416
1417
1418 class LCallNew: public LTemplateInstruction<1, 1, 0> {
1419 public:
1420 explicit LCallNew(LOperand* constructor) {
1421 inputs_[0] = constructor;
1422 }
1423
1424 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1425 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1426
1427 virtual void PrintDataTo(StringStream* stream);
1428
1429 int arity() const { return hydrogen()->argument_count() - 1; }
1430 };
1431
1432
1433 class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1434 public:
1435 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1436 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1437
1438 const Runtime::Function* function() const { return hydrogen()->function(); }
1439 int arity() const { return hydrogen()->argument_count(); }
1440 };
1441
1442
1443 class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1444 public:
1445 explicit LInteger32ToDouble(LOperand* value) {
1446 inputs_[0] = value;
1447 }
1448
1449 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1450 };
1451
1452
1453 class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1454 public:
1455 explicit LNumberTagI(LOperand* value) {
1456 inputs_[0] = value;
1457 }
1458
1459 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1460 };
1461
1462
1463 class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1464 public:
1465 LNumberTagD(LOperand* value, LOperand* temp1, LOperand* temp2) {
1466 inputs_[0] = value;
1467 temps_[0] = temp1;
1468 temps_[1] = temp2;
1469 }
1470
1471 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1472 };
1473
1474
1475 // Sometimes truncating conversion from a tagged value to an int32.
1476 class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1477 public:
1478 LDoubleToI(LOperand* value, LOperand* temp1, LOperand* temp2) {
1479 inputs_[0] = value;
1480 temps_[0] = temp1;
1481 temps_[1] = temp2;
1482 }
1483
1484 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1485 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1486
1487 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1488 };
1489
1490
1491 // Truncating conversion from a tagged value to an int32.
1492 class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1493 public:
1494 LTaggedToI(LOperand* value,
1495 LOperand* temp1,
1496 LOperand* temp2,
1497 LOperand* temp3) {
1498 inputs_[0] = value;
1499 temps_[0] = temp1;
1500 temps_[1] = temp2;
1501 temps_[2] = temp3;
1502 }
1503
1504 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1505 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1506
1507 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1508 };
1509
1510
1511 class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1512 public:
1513 explicit LSmiTag(LOperand* value) {
1514 inputs_[0] = value;
1515 }
1516
1517 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1518 };
1519
1520
1521 class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1522 public:
1523 explicit LNumberUntagD(LOperand* value) {
1524 inputs_[0] = value;
1525 }
1526
1527 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1528 DECLARE_HYDROGEN_ACCESSOR(Change)
1529 };
1530
1531
1532 class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1533 public:
1534 LSmiUntag(LOperand* value, bool needs_check)
1535 : needs_check_(needs_check) {
1536 inputs_[0] = value;
1537 }
1538
1539 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1540
1541 bool needs_check() const { return needs_check_; }
1542
1543 private:
1544 bool needs_check_;
1545 };
1546
1547
1548 class LStoreNamedField: public LTemplateInstruction<0, 2, 0> {
1549 public:
1550 LStoreNamedField(LOperand* obj, LOperand* val) {
1551 inputs_[0] = obj;
1552 inputs_[1] = val;
1553 }
1554
1555 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1556 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1557
1558 virtual void PrintDataTo(StringStream* stream);
1559
1560 LOperand* object() { return inputs_[0]; }
1561 LOperand* value() { return inputs_[1]; }
1562
1563 Handle<Object> name() const { return hydrogen()->name(); }
1564 bool is_in_object() { return hydrogen()->is_in_object(); }
1565 int offset() { return hydrogen()->offset(); }
1566 Handle<Map> transition() const { return hydrogen()->transition(); }
1567 };
1568
1569
1570 class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1571 public:
1572 LStoreNamedGeneric(LOperand* obj, LOperand* val) {
1573 inputs_[0] = obj;
1574 inputs_[1] = val;
1575 }
1576
1577 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1578 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1579
1580 virtual void PrintDataTo(StringStream* stream);
1581
1582 LOperand* object() { return inputs_[0]; }
1583 LOperand* value() { return inputs_[1]; }
1584 Handle<Object> name() const { return hydrogen()->name(); }
1585 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
1586 bool strict_mode() { return strict_mode_flag() == kStrictMode; }
1587 };
1588
1589
1590 class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
1591 public:
1592 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
1593 inputs_[0] = obj;
1594 inputs_[1] = key;
1595 inputs_[2] = val;
1596 }
1597
1598 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1599 "store-keyed-fast-element")
1600 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1601
1602 virtual void PrintDataTo(StringStream* stream);
1603
1604 LOperand* object() { return inputs_[0]; }
1605 LOperand* key() { return inputs_[1]; }
1606 LOperand* value() { return inputs_[2]; }
1607 };
1608
1609
1610 class LStoreKeyedFastDoubleElement: public LTemplateInstruction<0, 3, 0> {
1611 public:
1612 LStoreKeyedFastDoubleElement(LOperand* elements,
1613 LOperand* key,
1614 LOperand* val) {
1615 inputs_[0] = elements;
1616 inputs_[1] = key;
1617 inputs_[2] = val;
1618 }
1619
1620 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement,
1621 "store-keyed-fast-double-element")
1622 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastDoubleElement)
1623
1624 virtual void PrintDataTo(StringStream* stream);
1625
1626 LOperand* elements() { return inputs_[0]; }
1627 LOperand* key() { return inputs_[1]; }
1628 LOperand* value() { return inputs_[2]; }
1629 };
1630
1631
1632 class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1633 public:
1634 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) {
1635 inputs_[0] = obj;
1636 inputs_[1] = key;
1637 inputs_[2] = val;
1638 }
1639
1640 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1641 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1642
1643 virtual void PrintDataTo(StringStream* stream);
1644
1645 LOperand* object() { return inputs_[0]; }
1646 LOperand* key() { return inputs_[1]; }
1647 LOperand* value() { return inputs_[2]; }
1648 bool strict_mode() { return hydrogen()->strict_mode(); }
1649 };
1650
1651 class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> {
1652 public:
1653 LStoreKeyedSpecializedArrayElement(LOperand* external_pointer,
1654 LOperand* key,
1655 LOperand* val) {
1656 inputs_[0] = external_pointer;
1657 inputs_[1] = key;
1658 inputs_[2] = val;
1659 }
1660
1661 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
1662 "store-keyed-specialized-array-element")
1663 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement)
1664
1665 LOperand* external_pointer() { return inputs_[0]; }
1666 LOperand* key() { return inputs_[1]; }
1667 LOperand* value() { return inputs_[2]; }
1668 ElementsKind elements_kind() const {
1669 return hydrogen()->elements_kind();
1670 }
1671 };
1672
1673
1674 class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1675 public:
1676 LTransitionElementsKind(LOperand* object,
1677 LOperand* new_map_temp,
1678 LOperand* temp_reg) {
1679 inputs_[0] = object;
1680 temps_[0] = new_map_temp;
1681 temps_[1] = temp_reg;
1682 }
1683
1684 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1685 "transition-elements-kind")
1686 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1687
1688 virtual void PrintDataTo(StringStream* stream);
1689
1690 LOperand* object() { return inputs_[0]; }
1691 LOperand* new_map_reg() { return temps_[0]; }
1692 LOperand* temp_reg() { return temps_[1]; }
1693 Handle<Map> original_map() { return hydrogen()->original_map(); }
1694 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
1695 };
1696
1697
1698 class LStringAdd: public LTemplateInstruction<1, 2, 0> {
1699 public:
1700 LStringAdd(LOperand* left, LOperand* right) {
1701 inputs_[0] = left;
1702 inputs_[1] = right;
1703 }
1704
1705 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1706 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
1707
1708 LOperand* left() { return inputs_[0]; }
1709 LOperand* right() { return inputs_[1]; }
1710 };
1711
1712
1713
1714 class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
1715 public:
1716 LStringCharCodeAt(LOperand* string, LOperand* index) {
1717 inputs_[0] = string;
1718 inputs_[1] = index;
1719 }
1720
1721 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1722 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
1723
1724 LOperand* string() { return inputs_[0]; }
1725 LOperand* index() { return inputs_[1]; }
1726 };
1727
1728
1729 class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
1730 public:
1731 explicit LStringCharFromCode(LOperand* char_code) {
1732 inputs_[0] = char_code;
1733 }
1734
1735 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
1736 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
1737
1738 LOperand* char_code() { return inputs_[0]; }
1739 };
1740
1741
1742 class LStringLength: public LTemplateInstruction<1, 1, 0> {
1743 public:
1744 explicit LStringLength(LOperand* string) {
1745 inputs_[0] = string;
1746 }
1747
1748 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1749 DECLARE_HYDROGEN_ACCESSOR(StringLength)
1750
1751 LOperand* string() { return inputs_[0]; }
1752 };
1753
1754
1755 class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
1756 public:
1757 explicit LCheckFunction(LOperand* value) {
1758 inputs_[0] = value;
1759 }
1760
1761 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1762 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1763 };
1764
1765
1766 class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
1767 public:
1768 explicit LCheckInstanceType(LOperand* value) {
1769 inputs_[0] = value;
1770 }
1771
1772 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1773 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
1774 };
1775
1776
1777 class LCheckMap: public LTemplateInstruction<0, 1, 0> {
1778 public:
1779 explicit LCheckMap(LOperand* value) {
1780 inputs_[0] = value;
1781 }
1782
1783 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map")
1784 DECLARE_HYDROGEN_ACCESSOR(CheckMap)
1785 };
1786
1787
1788 class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
1789 public:
1790 LCheckPrototypeMaps(LOperand* temp1, LOperand* temp2) {
1791 temps_[0] = temp1;
1792 temps_[1] = temp2;
1793 }
1794
1795 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1796 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1797
1798 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1799 Handle<JSObject> holder() const { return hydrogen()->holder(); }
1800 };
1801
1802
1803 class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
1804 public:
1805 explicit LCheckSmi(LOperand* value) {
1806 inputs_[0] = value;
1807 }
1808
1809 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
1810 };
1811
1812
1813 class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
1814 public:
1815 explicit LCheckNonSmi(LOperand* value) {
1816 inputs_[0] = value;
1817 }
1818
1819 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
1820 };
1821
1822
1823 class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
1824 public:
1825 LClampDToUint8(LOperand* value, LOperand* temp) {
1826 inputs_[0] = value;
1827 temps_[0] = temp;
1828 }
1829
1830 LOperand* unclamped() { return inputs_[0]; }
1831
1832 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
1833 };
1834
1835
1836 class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
1837 public:
1838 explicit LClampIToUint8(LOperand* value) {
1839 inputs_[0] = value;
1840 }
1841
1842 LOperand* unclamped() { return inputs_[0]; }
1843
1844 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
1845 };
1846
1847
1848 class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
1849 public:
1850 LClampTToUint8(LOperand* value, LOperand* temp) {
1851 inputs_[0] = value;
1852 temps_[0] = temp;
1853 }
1854
1855 LOperand* unclamped() { return inputs_[0]; }
1856
1857 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
1858 };
1859
1860
1861 class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
1862 public:
1863 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
1864 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
1865 };
1866
1867
1868 class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
1869 public:
1870 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
1871 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
1872 };
1873
1874
1875 class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
1876 public:
1877 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
1878 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
1879 };
1880
1881
1882 class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
1883 public:
1884 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
1885 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
1886
1887 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
1888 };
1889
1890
1891 class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
1892 public:
1893 explicit LToFastProperties(LOperand* value) {
1894 inputs_[0] = value;
1895 }
1896
1897 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
1898 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
1899 };
1900
1901
1902 class LTypeof: public LTemplateInstruction<1, 1, 0> {
1903 public:
1904 explicit LTypeof(LOperand* value) {
1905 inputs_[0] = value;
1906 }
1907
1908 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
1909 };
1910
1911
1912 class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
1913 public:
1914 explicit LTypeofIsAndBranch(LOperand* value) {
1915 inputs_[0] = value;
1916 }
1917
1918 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
1919 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
1920
1921 Handle<String> type_literal() { return hydrogen()->type_literal(); }
1922
1923 virtual void PrintDataTo(StringStream* stream);
1924 };
1925
1926
1927 class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
1928 public:
1929 explicit LIsConstructCallAndBranch(LOperand* temp) {
1930 temps_[0] = temp;
1931 }
1932
1933 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
1934 "is-construct-call-and-branch")
1935 };
1936
1937
1938 class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
1939 public:
1940 LDeleteProperty(LOperand* obj, LOperand* key) {
1941 inputs_[0] = obj;
1942 inputs_[1] = key;
1943 }
1944
1945 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
1946
1947 LOperand* object() { return inputs_[0]; }
1948 LOperand* key() { return inputs_[1]; }
1949 };
1950
1951
1952 class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
1953 public:
1954 LOsrEntry();
1955
1956 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
1957
1958 LOperand** SpilledRegisterArray() { return register_spills_; }
1959 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
1960
1961 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
207 void MarkSpilledDoubleRegister(int allocation_index, 1962 void MarkSpilledDoubleRegister(int allocation_index,
208 LOperand* spill_operand) { 1963 LOperand* spill_operand);
209 UNIMPLEMENTED(); 1964
210 } 1965 private:
211 }; 1966 // Arrays of spill slot operands for registers with an assigned spill
212 1967 // slot, i.e., that must also be restored to the spill slot on OSR entry.
213 1968 // NULL if the register has no assigned spill slot. Indexed by allocation
1969 // index.
1970 LOperand* register_spills_[Register::kNumAllocatableRegisters];
1971 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
1972 };
1973
1974
1975 class LStackCheck: public LTemplateInstruction<0, 0, 0> {
1976 public:
1977 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
1978 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
1979
1980 Label* done_label() { return &done_label_; }
1981
1982 private:
1983 Label done_label_;
1984 };
1985
1986
1987 class LIn: public LTemplateInstruction<1, 2, 0> {
1988 public:
1989 LIn(LOperand* key, LOperand* object) {
1990 inputs_[0] = key;
1991 inputs_[1] = object;
1992 }
1993
1994 LOperand* key() { return inputs_[0]; }
1995 LOperand* object() { return inputs_[1]; }
1996
1997 DECLARE_CONCRETE_INSTRUCTION(In, "in")
1998 };
1999
2000
2001 class LChunkBuilder;
214 class LChunk: public ZoneObject { 2002 class LChunk: public ZoneObject {
215 public: 2003 public:
216 explicit LChunk(HGraph* graph) { } 2004 explicit LChunk(CompilationInfo* info, HGraph* graph);
217 2005
218 HGraph* graph() const { 2006 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
219 UNIMPLEMENTED(); 2007 LConstantOperand* DefineConstantOperand(HConstant* constant);
220 return NULL; 2008 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
221 } 2009 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
222 2010
223 const ZoneList<LPointerMap*>* pointer_maps() const { 2011 int GetNextSpillIndex(bool is_double);
224 UNIMPLEMENTED(); 2012 LOperand* GetNextSpillSlot(bool is_double);
225 return NULL; 2013
226 } 2014 int ParameterAt(int index);
227 2015 int GetParameterStackSlot(int index) const;
228 LOperand* GetNextSpillSlot(bool double_slot) { 2016 int spill_slot_count() const { return spill_slot_count_; }
229 UNIMPLEMENTED(); 2017 CompilationInfo* info() const { return info_; }
230 return NULL; 2018 HGraph* graph() const { return graph_; }
231 } 2019 const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
232 2020 void AddGapMove(int index, LOperand* from, LOperand* to);
233 LConstantOperand* DefineConstantOperand(HConstant* constant) { 2021 LGap* GetGapAt(int index) const;
234 UNIMPLEMENTED(); 2022 bool IsGapAt(int index) const;
235 return NULL; 2023 int NearestGapPos(int index) const;
236 } 2024 void MarkEmptyBlocks();
237 2025 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; }
238 LLabel* GetLabel(int block_id) const { 2026 LLabel* GetLabel(int block_id) const {
239 UNIMPLEMENTED(); 2027 HBasicBlock* block = graph_->blocks()->at(block_id);
240 return NULL; 2028 int first_instruction = block->first_instruction_index();
241 } 2029 return LLabel::cast(instructions_[first_instruction]);
242 2030 }
243 const ZoneList<LInstruction*>* instructions() const { 2031 int LookupDestination(int block_id) const {
244 UNIMPLEMENTED(); 2032 LLabel* cur = GetLabel(block_id);
245 return NULL; 2033 while (cur->replacement() != NULL) {
246 } 2034 cur = cur->replacement();
247 2035 }
248 int GetParameterStackSlot(int index) const { 2036 return cur->block_id();
249 UNIMPLEMENTED(); 2037 }
250 return 0; 2038 Label* GetAssemblyLabel(int block_id) const {
251 } 2039 LLabel* label = GetLabel(block_id);
252 2040 ASSERT(!label->HasReplacement());
253 void AddGapMove(int index, LOperand* from, LOperand* to) { UNIMPLEMENTED(); } 2041 return label->label();
254 2042 }
255 LGap* GetGapAt(int index) const { 2043
256 UNIMPLEMENTED(); 2044 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
257 return NULL; 2045 return &inlined_closures_;
258 } 2046 }
259 2047
260 bool IsGapAt(int index) const { 2048 void AddInlinedClosure(Handle<JSFunction> closure) {
261 UNIMPLEMENTED(); 2049 inlined_closures_.Add(closure);
262 return false; 2050 }
263 } 2051
264 2052 private:
265 int NearestGapPos(int index) const { 2053 int spill_slot_count_;
266 UNIMPLEMENTED(); 2054 CompilationInfo* info_;
267 return 0; 2055 HGraph* const graph_;
268 } 2056 ZoneList<LInstruction*> instructions_;
269 2057 ZoneList<LPointerMap*> pointer_maps_;
270 void MarkEmptyBlocks() { UNIMPLEMENTED(); } 2058 ZoneList<Handle<JSFunction> > inlined_closures_;
271
272 CompilationInfo* info() const {
273 UNIMPLEMENTED();
274 return NULL;
275 }
276
277 #ifdef DEBUG
278 void Verify() { UNIMPLEMENTED(); }
279 #endif
280 }; 2059 };
281 2060
282 2061
283 class LChunkBuilder BASE_EMBEDDED { 2062 class LChunkBuilder BASE_EMBEDDED {
284 public: 2063 public:
285 LChunkBuilder(CompilationInfo*&, HGraph* graph, LAllocator* allocator) { } 2064 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2065 : chunk_(NULL),
2066 info_(info),
2067 graph_(graph),
2068 status_(UNUSED),
2069 current_instruction_(NULL),
2070 current_block_(NULL),
2071 next_block_(NULL),
2072 argument_count_(0),
2073 allocator_(allocator),
2074 position_(RelocInfo::kNoPosition),
2075 instruction_pending_deoptimization_environment_(NULL),
2076 pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
286 2077
287 // Build the sequence for the graph. 2078 // Build the sequence for the graph.
288 LChunk* Build() { 2079 LChunk* Build();
289 UNIMPLEMENTED();
290 return NULL;
291 };
292 2080
293 // Declare methods that deal with the individual node types. 2081 // Declare methods that deal with the individual node types.
294 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node) { \ 2082 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
295 UNIMPLEMENTED(); \
296 return NULL; \
297 }
298 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 2083 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
299 #undef DECLARE_DO 2084 #undef DECLARE_DO
300 2085
2086 private:
2087 enum Status {
2088 UNUSED,
2089 BUILDING,
2090 DONE,
2091 ABORTED
2092 };
2093
2094 LChunk* chunk() const { return chunk_; }
2095 CompilationInfo* info() const { return info_; }
2096 HGraph* graph() const { return graph_; }
2097
2098 bool is_unused() const { return status_ == UNUSED; }
2099 bool is_building() const { return status_ == BUILDING; }
2100 bool is_done() const { return status_ == DONE; }
2101 bool is_aborted() const { return status_ == ABORTED; }
2102
2103 void Abort(const char* format, ...);
2104
2105 // Methods for getting operands for Use / Define / Temp.
2106 LRegister* ToOperand(Register reg);
2107 LUnallocated* ToUnallocated(Register reg);
2108 LUnallocated* ToUnallocated(DoubleRegister reg);
2109
2110 // Methods for setting up define-use relationships.
2111 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2112 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2113 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2114 DoubleRegister fixed_register);
2115
2116 // A value that is guaranteed to be allocated to a register.
2117 // Operand created by UseRegister is guaranteed to be live until the end of
2118 // instruction. This means that register allocator will not reuse it's
2119 // register for any other operand inside instruction.
2120 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2121 // instruction start. Register allocator is free to assign the same register
2122 // to some other operand used inside instruction (i.e. temporary or
2123 // output).
2124 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2125 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2126
2127 // An input operand in a register that may be trashed.
2128 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2129
2130 // An input operand in a register or stack slot.
2131 MUST_USE_RESULT LOperand* Use(HValue* value);
2132 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2133
2134 // An input operand in a register, stack slot or a constant operand.
2135 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2136 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2137
2138 // An input operand in a register or a constant operand.
2139 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2140 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2141
2142 // An input operand in register, stack slot or a constant operand.
2143 // Will not be moved to a register even if one is freely available.
2144 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2145
2146 // Temporary operand that must be in a register.
2147 MUST_USE_RESULT LUnallocated* TempRegister();
2148 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2149 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2150
2151 // Methods for setting up define-use relationships.
2152 // Return the same instruction that they are passed.
2153 template<int I, int T>
2154 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2155 LUnallocated* result);
2156 template<int I, int T>
2157 LInstruction* Define(LTemplateInstruction<1, I, T>* instr);
2158 template<int I, int T>
2159 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2160 template<int I, int T>
2161 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2162 int index);
2163 template<int I, int T>
2164 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2165 template<int I, int T>
2166 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2167 Register reg);
2168 template<int I, int T>
2169 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2170 DoubleRegister reg);
2171 LInstruction* AssignEnvironment(LInstruction* instr);
2172 LInstruction* AssignPointerMap(LInstruction* instr);
2173
2174 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2175
2176 // By default we assume that instruction sequences generated for calls
2177 // cannot deoptimize eagerly and we do not attach environment to this
2178 // instruction.
2179 LInstruction* MarkAsCall(
2180 LInstruction* instr,
2181 HInstruction* hinstr,
2182 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2183 LInstruction* MarkAsSaveDoubles(LInstruction* instr);
2184
2185 LInstruction* SetInstructionPendingDeoptimizationEnvironment(
2186 LInstruction* instr, int ast_id);
2187 void ClearInstructionPendingDeoptimizationEnvironment();
2188
2189 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2190 int* argument_index_accumulator);
2191
2192 void VisitInstruction(HInstruction* current);
2193
2194 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2195 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2196 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2197 LInstruction* DoArithmeticD(Token::Value op,
2198 HArithmeticBinaryOperation* instr);
2199 LInstruction* DoArithmeticT(Token::Value op,
2200 HArithmeticBinaryOperation* instr);
2201
2202 LChunk* chunk_;
2203 CompilationInfo* info_;
2204 HGraph* const graph_;
2205 Status status_;
2206 HInstruction* current_instruction_;
2207 HBasicBlock* current_block_;
2208 HBasicBlock* next_block_;
2209 int argument_count_;
2210 LAllocator* allocator_;
2211 int position_;
2212 LInstruction* instruction_pending_deoptimization_environment_;
2213 int pending_deoptimization_ast_id_;
2214
301 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2215 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
302 }; 2216 };
303 2217
2218 #undef DECLARE_HYDROGEN_ACCESSOR
2219 #undef DECLARE_CONCRETE_INSTRUCTION
304 2220
305 } } // namespace v8::internal 2221 } } // namespace v8::internal
306 2222
307 #endif // V8_MIPS_LITHIUM_MIPS_H_ 2223 #endif // V8_MIPS_LITHIUM_MIPS_H_
OLDNEW
« no previous file with comments | « src/mips/lithium-gap-resolver-mips.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698