OLD | NEW |
| (Empty) |
1 // Copyright 2012 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_MIPS_LITHIUM_MIPS_H_ | |
6 #define V8_MIPS_LITHIUM_MIPS_H_ | |
7 | |
8 #include "src/hydrogen.h" | |
9 #include "src/lithium.h" | |
10 #include "src/lithium-allocator.h" | |
11 #include "src/safepoint-table.h" | |
12 #include "src/utils.h" | |
13 | |
14 namespace v8 { | |
15 namespace internal { | |
16 | |
17 // Forward declarations. | |
18 class LCodeGen; | |
19 | |
20 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ | |
21 V(AccessArgumentsAt) \ | |
22 V(AddI) \ | |
23 V(Allocate) \ | |
24 V(AllocateBlockContext) \ | |
25 V(ApplyArguments) \ | |
26 V(ArgumentsElements) \ | |
27 V(ArgumentsLength) \ | |
28 V(ArithmeticD) \ | |
29 V(ArithmeticT) \ | |
30 V(BitI) \ | |
31 V(BoundsCheck) \ | |
32 V(Branch) \ | |
33 V(CallJSFunction) \ | |
34 V(CallWithDescriptor) \ | |
35 V(CallFunction) \ | |
36 V(CallNew) \ | |
37 V(CallNewArray) \ | |
38 V(CallRuntime) \ | |
39 V(CallStub) \ | |
40 V(CheckArrayBufferNotNeutered) \ | |
41 V(CheckInstanceType) \ | |
42 V(CheckMaps) \ | |
43 V(CheckMapValue) \ | |
44 V(CheckNonSmi) \ | |
45 V(CheckSmi) \ | |
46 V(CheckValue) \ | |
47 V(ClampDToUint8) \ | |
48 V(ClampIToUint8) \ | |
49 V(ClampTToUint8) \ | |
50 V(ClassOfTestAndBranch) \ | |
51 V(CompareMinusZeroAndBranch) \ | |
52 V(CompareNumericAndBranch) \ | |
53 V(CmpObjectEqAndBranch) \ | |
54 V(CmpHoleAndBranch) \ | |
55 V(CmpMapAndBranch) \ | |
56 V(CmpT) \ | |
57 V(ConstantD) \ | |
58 V(ConstantE) \ | |
59 V(ConstantI) \ | |
60 V(ConstantS) \ | |
61 V(ConstantT) \ | |
62 V(ConstructDouble) \ | |
63 V(Context) \ | |
64 V(DateField) \ | |
65 V(DebugBreak) \ | |
66 V(DeclareGlobals) \ | |
67 V(Deoptimize) \ | |
68 V(DivByConstI) \ | |
69 V(DivByPowerOf2I) \ | |
70 V(DivI) \ | |
71 V(DoubleToI) \ | |
72 V(DoubleBits) \ | |
73 V(DoubleToSmi) \ | |
74 V(Drop) \ | |
75 V(Dummy) \ | |
76 V(DummyUse) \ | |
77 V(FlooringDivByConstI) \ | |
78 V(FlooringDivByPowerOf2I) \ | |
79 V(FlooringDivI) \ | |
80 V(ForInCacheArray) \ | |
81 V(ForInPrepareMap) \ | |
82 V(GetCachedArrayIndex) \ | |
83 V(Goto) \ | |
84 V(HasCachedArrayIndexAndBranch) \ | |
85 V(HasInPrototypeChainAndBranch) \ | |
86 V(HasInstanceTypeAndBranch) \ | |
87 V(InnerAllocatedObject) \ | |
88 V(InstanceOf) \ | |
89 V(InstructionGap) \ | |
90 V(Integer32ToDouble) \ | |
91 V(InvokeFunction) \ | |
92 V(IsConstructCallAndBranch) \ | |
93 V(IsStringAndBranch) \ | |
94 V(IsSmiAndBranch) \ | |
95 V(IsUndetectableAndBranch) \ | |
96 V(Label) \ | |
97 V(LazyBailout) \ | |
98 V(LoadContextSlot) \ | |
99 V(LoadRoot) \ | |
100 V(LoadFieldByIndex) \ | |
101 V(LoadFunctionPrototype) \ | |
102 V(LoadGlobalGeneric) \ | |
103 V(LoadGlobalViaContext) \ | |
104 V(LoadKeyed) \ | |
105 V(LoadKeyedGeneric) \ | |
106 V(LoadNamedField) \ | |
107 V(LoadNamedGeneric) \ | |
108 V(MapEnumLength) \ | |
109 V(MathAbs) \ | |
110 V(MathExp) \ | |
111 V(MathClz32) \ | |
112 V(MathFloor) \ | |
113 V(MathFround) \ | |
114 V(MathLog) \ | |
115 V(MathMinMax) \ | |
116 V(MathPowHalf) \ | |
117 V(MathRound) \ | |
118 V(MathSqrt) \ | |
119 V(MaybeGrowElements) \ | |
120 V(ModByConstI) \ | |
121 V(ModByPowerOf2I) \ | |
122 V(ModI) \ | |
123 V(MulI) \ | |
124 V(MultiplyAddD) \ | |
125 V(NumberTagD) \ | |
126 V(NumberTagI) \ | |
127 V(NumberTagU) \ | |
128 V(NumberUntagD) \ | |
129 V(OsrEntry) \ | |
130 V(Parameter) \ | |
131 V(Power) \ | |
132 V(Prologue) \ | |
133 V(PushArgument) \ | |
134 V(RegExpLiteral) \ | |
135 V(Return) \ | |
136 V(SeqStringGetChar) \ | |
137 V(SeqStringSetChar) \ | |
138 V(ShiftI) \ | |
139 V(SmiTag) \ | |
140 V(SmiUntag) \ | |
141 V(StackCheck) \ | |
142 V(StoreCodeEntry) \ | |
143 V(StoreContextSlot) \ | |
144 V(StoreFrameContext) \ | |
145 V(StoreGlobalViaContext) \ | |
146 V(StoreKeyed) \ | |
147 V(StoreKeyedGeneric) \ | |
148 V(StoreNamedField) \ | |
149 V(StoreNamedGeneric) \ | |
150 V(StringAdd) \ | |
151 V(StringCharCodeAt) \ | |
152 V(StringCharFromCode) \ | |
153 V(StringCompareAndBranch) \ | |
154 V(SubI) \ | |
155 V(TaggedToI) \ | |
156 V(ThisFunction) \ | |
157 V(ToFastProperties) \ | |
158 V(TransitionElementsKind) \ | |
159 V(TrapAllocationMemento) \ | |
160 V(Typeof) \ | |
161 V(TypeofIsAndBranch) \ | |
162 V(Uint32ToDouble) \ | |
163 V(UnknownOSRValue) \ | |
164 V(WrapReceiver) | |
165 | |
166 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ | |
167 Opcode opcode() const final { return LInstruction::k##type; } \ | |
168 void CompileToNative(LCodeGen* generator) final; \ | |
169 const char* Mnemonic() const final { return mnemonic; } \ | |
170 static L##type* cast(LInstruction* instr) { \ | |
171 DCHECK(instr->Is##type()); \ | |
172 return reinterpret_cast<L##type*>(instr); \ | |
173 } | |
174 | |
175 | |
176 #define DECLARE_HYDROGEN_ACCESSOR(type) \ | |
177 H##type* hydrogen() const { \ | |
178 return H##type::cast(hydrogen_value()); \ | |
179 } | |
180 | |
181 | |
182 class LInstruction : public ZoneObject { | |
183 public: | |
184 LInstruction() | |
185 : environment_(NULL), | |
186 hydrogen_value_(NULL), | |
187 bit_field_(IsCallBits::encode(false)) { | |
188 } | |
189 | |
190 virtual ~LInstruction() {} | |
191 | |
192 virtual void CompileToNative(LCodeGen* generator) = 0; | |
193 virtual const char* Mnemonic() const = 0; | |
194 virtual void PrintTo(StringStream* stream); | |
195 virtual void PrintDataTo(StringStream* stream); | |
196 virtual void PrintOutputOperandTo(StringStream* stream); | |
197 | |
198 enum Opcode { | |
199 // Declare a unique enum value for each instruction. | |
200 #define DECLARE_OPCODE(type) k##type, | |
201 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) | |
202 kNumberOfInstructions | |
203 #undef DECLARE_OPCODE | |
204 }; | |
205 | |
206 virtual Opcode opcode() const = 0; | |
207 | |
208 // Declare non-virtual type testers for all leaf IR classes. | |
209 #define DECLARE_PREDICATE(type) \ | |
210 bool Is##type() const { return opcode() == k##type; } | |
211 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE) | |
212 #undef DECLARE_PREDICATE | |
213 | |
214 // Declare virtual predicates for instructions that don't have | |
215 // an opcode. | |
216 virtual bool IsGap() const { return false; } | |
217 | |
218 virtual bool IsControl() const { return false; } | |
219 | |
220 // Try deleting this instruction if possible. | |
221 virtual bool TryDelete() { return false; } | |
222 | |
223 void set_environment(LEnvironment* env) { environment_ = env; } | |
224 LEnvironment* environment() const { return environment_; } | |
225 bool HasEnvironment() const { return environment_ != NULL; } | |
226 | |
227 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } | |
228 LPointerMap* pointer_map() const { return pointer_map_.get(); } | |
229 bool HasPointerMap() const { return pointer_map_.is_set(); } | |
230 | |
231 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } | |
232 HValue* hydrogen_value() const { return hydrogen_value_; } | |
233 | |
234 void MarkAsCall() { bit_field_ = IsCallBits::update(bit_field_, true); } | |
235 bool IsCall() const { return IsCallBits::decode(bit_field_); } | |
236 | |
237 // Interface to the register allocator and iterators. | |
238 bool ClobbersTemps() const { return IsCall(); } | |
239 bool ClobbersRegisters() const { return IsCall(); } | |
240 virtual bool ClobbersDoubleRegisters(Isolate* isolate) const { | |
241 return IsCall(); | |
242 } | |
243 | |
244 // Interface to the register allocator and iterators. | |
245 bool IsMarkedAsCall() const { return IsCall(); } | |
246 | |
247 virtual bool HasResult() const = 0; | |
248 virtual LOperand* result() const = 0; | |
249 | |
250 LOperand* FirstInput() { return InputAt(0); } | |
251 LOperand* Output() { return HasResult() ? result() : NULL; } | |
252 | |
253 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | |
254 | |
255 #ifdef DEBUG | |
256 void VerifyCall(); | |
257 #endif | |
258 | |
259 virtual int InputCount() = 0; | |
260 virtual LOperand* InputAt(int i) = 0; | |
261 | |
262 private: | |
263 // Iterator interface. | |
264 friend class InputIterator; | |
265 | |
266 friend class TempIterator; | |
267 virtual int TempCount() = 0; | |
268 virtual LOperand* TempAt(int i) = 0; | |
269 | |
270 class IsCallBits: public BitField<bool, 0, 1> {}; | |
271 | |
272 LEnvironment* environment_; | |
273 SetOncePointer<LPointerMap> pointer_map_; | |
274 HValue* hydrogen_value_; | |
275 int bit_field_; | |
276 }; | |
277 | |
278 | |
279 // R = number of result operands (0 or 1). | |
280 template<int R> | |
281 class LTemplateResultInstruction : public LInstruction { | |
282 public: | |
283 // Allow 0 or 1 output operands. | |
284 STATIC_ASSERT(R == 0 || R == 1); | |
285 bool HasResult() const final { return R != 0 && result() != NULL; } | |
286 void set_result(LOperand* operand) { results_[0] = operand; } | |
287 LOperand* result() const override { return results_[0]; } | |
288 | |
289 protected: | |
290 EmbeddedContainer<LOperand*, R> results_; | |
291 }; | |
292 | |
293 | |
294 // R = number of result operands (0 or 1). | |
295 // I = number of input operands. | |
296 // T = number of temporary operands. | |
297 template<int R, int I, int T> | |
298 class LTemplateInstruction : public LTemplateResultInstruction<R> { | |
299 protected: | |
300 EmbeddedContainer<LOperand*, I> inputs_; | |
301 EmbeddedContainer<LOperand*, T> temps_; | |
302 | |
303 private: | |
304 // Iterator support. | |
305 int InputCount() final { return I; } | |
306 LOperand* InputAt(int i) final { return inputs_[i]; } | |
307 | |
308 int TempCount() final { return T; } | |
309 LOperand* TempAt(int i) final { return temps_[i]; } | |
310 }; | |
311 | |
312 | |
313 class LGap : public LTemplateInstruction<0, 0, 0> { | |
314 public: | |
315 explicit LGap(HBasicBlock* block) | |
316 : block_(block) { | |
317 parallel_moves_[BEFORE] = NULL; | |
318 parallel_moves_[START] = NULL; | |
319 parallel_moves_[END] = NULL; | |
320 parallel_moves_[AFTER] = NULL; | |
321 } | |
322 | |
323 // Can't use the DECLARE-macro here because of sub-classes. | |
324 bool IsGap() const final { return true; } | |
325 void PrintDataTo(StringStream* stream) override; | |
326 static LGap* cast(LInstruction* instr) { | |
327 DCHECK(instr->IsGap()); | |
328 return reinterpret_cast<LGap*>(instr); | |
329 } | |
330 | |
331 bool IsRedundant() const; | |
332 | |
333 HBasicBlock* block() const { return block_; } | |
334 | |
335 enum InnerPosition { | |
336 BEFORE, | |
337 START, | |
338 END, | |
339 AFTER, | |
340 FIRST_INNER_POSITION = BEFORE, | |
341 LAST_INNER_POSITION = AFTER | |
342 }; | |
343 | |
344 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) { | |
345 if (parallel_moves_[pos] == NULL) { | |
346 parallel_moves_[pos] = new(zone) LParallelMove(zone); | |
347 } | |
348 return parallel_moves_[pos]; | |
349 } | |
350 | |
351 LParallelMove* GetParallelMove(InnerPosition pos) { | |
352 return parallel_moves_[pos]; | |
353 } | |
354 | |
355 private: | |
356 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; | |
357 HBasicBlock* block_; | |
358 }; | |
359 | |
360 | |
361 class LInstructionGap final : public LGap { | |
362 public: | |
363 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { } | |
364 | |
365 bool HasInterestingComment(LCodeGen* gen) const override { | |
366 return !IsRedundant(); | |
367 } | |
368 | |
369 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap") | |
370 }; | |
371 | |
372 | |
373 class LGoto final : public LTemplateInstruction<0, 0, 0> { | |
374 public: | |
375 explicit LGoto(HBasicBlock* block) : block_(block) { } | |
376 | |
377 bool HasInterestingComment(LCodeGen* gen) const override; | |
378 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") | |
379 void PrintDataTo(StringStream* stream) override; | |
380 bool IsControl() const override { return true; } | |
381 | |
382 int block_id() const { return block_->block_id(); } | |
383 | |
384 private: | |
385 HBasicBlock* block_; | |
386 }; | |
387 | |
388 | |
389 class LPrologue final : public LTemplateInstruction<0, 0, 0> { | |
390 public: | |
391 DECLARE_CONCRETE_INSTRUCTION(Prologue, "prologue") | |
392 }; | |
393 | |
394 | |
395 class LLazyBailout final : public LTemplateInstruction<0, 0, 0> { | |
396 public: | |
397 LLazyBailout() : gap_instructions_size_(0) { } | |
398 | |
399 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout") | |
400 | |
401 void set_gap_instructions_size(int gap_instructions_size) { | |
402 gap_instructions_size_ = gap_instructions_size; | |
403 } | |
404 int gap_instructions_size() { return gap_instructions_size_; } | |
405 | |
406 private: | |
407 int gap_instructions_size_; | |
408 }; | |
409 | |
410 | |
411 class LDummy final : public LTemplateInstruction<1, 0, 0> { | |
412 public: | |
413 LDummy() {} | |
414 DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy") | |
415 }; | |
416 | |
417 | |
418 class LDummyUse final : public LTemplateInstruction<1, 1, 0> { | |
419 public: | |
420 explicit LDummyUse(LOperand* value) { | |
421 inputs_[0] = value; | |
422 } | |
423 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use") | |
424 }; | |
425 | |
426 | |
427 class LDeoptimize final : public LTemplateInstruction<0, 0, 0> { | |
428 public: | |
429 bool IsControl() const override { return true; } | |
430 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") | |
431 DECLARE_HYDROGEN_ACCESSOR(Deoptimize) | |
432 }; | |
433 | |
434 | |
435 class LLabel final : public LGap { | |
436 public: | |
437 explicit LLabel(HBasicBlock* block) | |
438 : LGap(block), replacement_(NULL) { } | |
439 | |
440 bool HasInterestingComment(LCodeGen* gen) const override { return false; } | |
441 DECLARE_CONCRETE_INSTRUCTION(Label, "label") | |
442 | |
443 void PrintDataTo(StringStream* stream) override; | |
444 | |
445 int block_id() const { return block()->block_id(); } | |
446 bool is_loop_header() const { return block()->IsLoopHeader(); } | |
447 bool is_osr_entry() const { return block()->is_osr_entry(); } | |
448 Label* label() { return &label_; } | |
449 LLabel* replacement() const { return replacement_; } | |
450 void set_replacement(LLabel* label) { replacement_ = label; } | |
451 bool HasReplacement() const { return replacement_ != NULL; } | |
452 | |
453 private: | |
454 Label label_; | |
455 LLabel* replacement_; | |
456 }; | |
457 | |
458 | |
459 class LParameter final : public LTemplateInstruction<1, 0, 0> { | |
460 public: | |
461 bool HasInterestingComment(LCodeGen* gen) const override { return false; } | |
462 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter") | |
463 }; | |
464 | |
465 | |
466 class LCallStub final : public LTemplateInstruction<1, 1, 0> { | |
467 public: | |
468 explicit LCallStub(LOperand* context) { | |
469 inputs_[0] = context; | |
470 } | |
471 | |
472 LOperand* context() { return inputs_[0]; } | |
473 | |
474 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub") | |
475 DECLARE_HYDROGEN_ACCESSOR(CallStub) | |
476 }; | |
477 | |
478 | |
479 class LUnknownOSRValue final : public LTemplateInstruction<1, 0, 0> { | |
480 public: | |
481 bool HasInterestingComment(LCodeGen* gen) const override { return false; } | |
482 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") | |
483 }; | |
484 | |
485 | |
486 template<int I, int T> | |
487 class LControlInstruction : public LTemplateInstruction<0, I, T> { | |
488 public: | |
489 LControlInstruction() : false_label_(NULL), true_label_(NULL) { } | |
490 | |
491 bool IsControl() const final { return true; } | |
492 | |
493 int SuccessorCount() { return hydrogen()->SuccessorCount(); } | |
494 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } | |
495 | |
496 int TrueDestination(LChunk* chunk) { | |
497 return chunk->LookupDestination(true_block_id()); | |
498 } | |
499 int FalseDestination(LChunk* chunk) { | |
500 return chunk->LookupDestination(false_block_id()); | |
501 } | |
502 | |
503 Label* TrueLabel(LChunk* chunk) { | |
504 if (true_label_ == NULL) { | |
505 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk)); | |
506 } | |
507 return true_label_; | |
508 } | |
509 Label* FalseLabel(LChunk* chunk) { | |
510 if (false_label_ == NULL) { | |
511 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk)); | |
512 } | |
513 return false_label_; | |
514 } | |
515 | |
516 protected: | |
517 int true_block_id() { return SuccessorAt(0)->block_id(); } | |
518 int false_block_id() { return SuccessorAt(1)->block_id(); } | |
519 | |
520 private: | |
521 HControlInstruction* hydrogen() { | |
522 return HControlInstruction::cast(this->hydrogen_value()); | |
523 } | |
524 | |
525 Label* false_label_; | |
526 Label* true_label_; | |
527 }; | |
528 | |
529 | |
530 class LWrapReceiver final : public LTemplateInstruction<1, 2, 0> { | |
531 public: | |
532 LWrapReceiver(LOperand* receiver, LOperand* function) { | |
533 inputs_[0] = receiver; | |
534 inputs_[1] = function; | |
535 } | |
536 | |
537 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver") | |
538 DECLARE_HYDROGEN_ACCESSOR(WrapReceiver) | |
539 | |
540 LOperand* receiver() { return inputs_[0]; } | |
541 LOperand* function() { return inputs_[1]; } | |
542 }; | |
543 | |
544 | |
545 class LApplyArguments final : public LTemplateInstruction<1, 4, 0> { | |
546 public: | |
547 LApplyArguments(LOperand* function, | |
548 LOperand* receiver, | |
549 LOperand* length, | |
550 LOperand* elements) { | |
551 inputs_[0] = function; | |
552 inputs_[1] = receiver; | |
553 inputs_[2] = length; | |
554 inputs_[3] = elements; | |
555 } | |
556 | |
557 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments") | |
558 | |
559 LOperand* function() { return inputs_[0]; } | |
560 LOperand* receiver() { return inputs_[1]; } | |
561 LOperand* length() { return inputs_[2]; } | |
562 LOperand* elements() { return inputs_[3]; } | |
563 }; | |
564 | |
565 | |
566 class LAccessArgumentsAt final : public LTemplateInstruction<1, 3, 0> { | |
567 public: | |
568 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) { | |
569 inputs_[0] = arguments; | |
570 inputs_[1] = length; | |
571 inputs_[2] = index; | |
572 } | |
573 | |
574 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at") | |
575 | |
576 LOperand* arguments() { return inputs_[0]; } | |
577 LOperand* length() { return inputs_[1]; } | |
578 LOperand* index() { return inputs_[2]; } | |
579 | |
580 void PrintDataTo(StringStream* stream) override; | |
581 }; | |
582 | |
583 | |
584 class LArgumentsLength final : public LTemplateInstruction<1, 1, 0> { | |
585 public: | |
586 explicit LArgumentsLength(LOperand* elements) { | |
587 inputs_[0] = elements; | |
588 } | |
589 | |
590 LOperand* elements() { return inputs_[0]; } | |
591 | |
592 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length") | |
593 }; | |
594 | |
595 | |
596 class LArgumentsElements final : public LTemplateInstruction<1, 0, 0> { | |
597 public: | |
598 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements") | |
599 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements) | |
600 }; | |
601 | |
602 | |
603 class LModByPowerOf2I final : public LTemplateInstruction<1, 1, 0> { | |
604 public: | |
605 LModByPowerOf2I(LOperand* dividend, int32_t divisor) { | |
606 inputs_[0] = dividend; | |
607 divisor_ = divisor; | |
608 } | |
609 | |
610 LOperand* dividend() { return inputs_[0]; } | |
611 int32_t divisor() const { return divisor_; } | |
612 | |
613 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i") | |
614 DECLARE_HYDROGEN_ACCESSOR(Mod) | |
615 | |
616 private: | |
617 int32_t divisor_; | |
618 }; | |
619 | |
620 | |
621 class LModByConstI final : public LTemplateInstruction<1, 1, 0> { | |
622 public: | |
623 LModByConstI(LOperand* dividend, int32_t divisor) { | |
624 inputs_[0] = dividend; | |
625 divisor_ = divisor; | |
626 } | |
627 | |
628 LOperand* dividend() { return inputs_[0]; } | |
629 int32_t divisor() const { return divisor_; } | |
630 | |
631 DECLARE_CONCRETE_INSTRUCTION(ModByConstI, "mod-by-const-i") | |
632 DECLARE_HYDROGEN_ACCESSOR(Mod) | |
633 | |
634 private: | |
635 int32_t divisor_; | |
636 }; | |
637 | |
638 | |
639 class LModI final : public LTemplateInstruction<1, 2, 3> { | |
640 public: | |
641 LModI(LOperand* left, | |
642 LOperand* right) { | |
643 inputs_[0] = left; | |
644 inputs_[1] = right; | |
645 } | |
646 | |
647 LOperand* left() { return inputs_[0]; } | |
648 LOperand* right() { return inputs_[1]; } | |
649 | |
650 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") | |
651 DECLARE_HYDROGEN_ACCESSOR(Mod) | |
652 }; | |
653 | |
654 | |
655 class LDivByPowerOf2I final : public LTemplateInstruction<1, 1, 0> { | |
656 public: | |
657 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) { | |
658 inputs_[0] = dividend; | |
659 divisor_ = divisor; | |
660 } | |
661 | |
662 LOperand* dividend() { return inputs_[0]; } | |
663 int32_t divisor() const { return divisor_; } | |
664 | |
665 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i") | |
666 DECLARE_HYDROGEN_ACCESSOR(Div) | |
667 | |
668 private: | |
669 int32_t divisor_; | |
670 }; | |
671 | |
672 | |
673 class LDivByConstI final : public LTemplateInstruction<1, 1, 0> { | |
674 public: | |
675 LDivByConstI(LOperand* dividend, int32_t divisor) { | |
676 inputs_[0] = dividend; | |
677 divisor_ = divisor; | |
678 } | |
679 | |
680 LOperand* dividend() { return inputs_[0]; } | |
681 int32_t divisor() const { return divisor_; } | |
682 | |
683 DECLARE_CONCRETE_INSTRUCTION(DivByConstI, "div-by-const-i") | |
684 DECLARE_HYDROGEN_ACCESSOR(Div) | |
685 | |
686 private: | |
687 int32_t divisor_; | |
688 }; | |
689 | |
690 | |
691 class LDivI final : public LTemplateInstruction<1, 2, 1> { | |
692 public: | |
693 LDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) { | |
694 inputs_[0] = dividend; | |
695 inputs_[1] = divisor; | |
696 temps_[0] = temp; | |
697 } | |
698 | |
699 LOperand* dividend() { return inputs_[0]; } | |
700 LOperand* divisor() { return inputs_[1]; } | |
701 LOperand* temp() { return temps_[0]; } | |
702 | |
703 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") | |
704 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) | |
705 }; | |
706 | |
707 | |
708 class LFlooringDivByPowerOf2I final : public LTemplateInstruction<1, 1, 0> { | |
709 public: | |
710 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) { | |
711 inputs_[0] = dividend; | |
712 divisor_ = divisor; | |
713 } | |
714 | |
715 LOperand* dividend() { return inputs_[0]; } | |
716 int32_t divisor() { return divisor_; } | |
717 | |
718 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I, | |
719 "flooring-div-by-power-of-2-i") | |
720 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) | |
721 | |
722 private: | |
723 int32_t divisor_; | |
724 }; | |
725 | |
726 | |
727 class LFlooringDivByConstI final : public LTemplateInstruction<1, 1, 2> { | |
728 public: | |
729 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) { | |
730 inputs_[0] = dividend; | |
731 divisor_ = divisor; | |
732 temps_[0] = temp; | |
733 } | |
734 | |
735 LOperand* dividend() { return inputs_[0]; } | |
736 int32_t divisor() const { return divisor_; } | |
737 LOperand* temp() { return temps_[0]; } | |
738 | |
739 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i") | |
740 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) | |
741 | |
742 private: | |
743 int32_t divisor_; | |
744 }; | |
745 | |
746 | |
747 class LFlooringDivI final : public LTemplateInstruction<1, 2, 0> { | |
748 public: | |
749 LFlooringDivI(LOperand* dividend, LOperand* divisor) { | |
750 inputs_[0] = dividend; | |
751 inputs_[1] = divisor; | |
752 } | |
753 | |
754 LOperand* dividend() { return inputs_[0]; } | |
755 LOperand* divisor() { return inputs_[1]; } | |
756 | |
757 DECLARE_CONCRETE_INSTRUCTION(FlooringDivI, "flooring-div-i") | |
758 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) | |
759 }; | |
760 | |
761 | |
762 class LMulI final : public LTemplateInstruction<1, 2, 0> { | |
763 public: | |
764 LMulI(LOperand* left, LOperand* right) { | |
765 inputs_[0] = left; | |
766 inputs_[1] = right; | |
767 } | |
768 | |
769 LOperand* left() { return inputs_[0]; } | |
770 LOperand* right() { return inputs_[1]; } | |
771 | |
772 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") | |
773 DECLARE_HYDROGEN_ACCESSOR(Mul) | |
774 }; | |
775 | |
776 | |
777 // Instruction for computing multiplier * multiplicand + addend. | |
778 class LMultiplyAddD final : public LTemplateInstruction<1, 3, 0> { | |
779 public: | |
780 LMultiplyAddD(LOperand* addend, LOperand* multiplier, | |
781 LOperand* multiplicand) { | |
782 inputs_[0] = addend; | |
783 inputs_[1] = multiplier; | |
784 inputs_[2] = multiplicand; | |
785 } | |
786 | |
787 LOperand* addend() { return inputs_[0]; } | |
788 LOperand* multiplier() { return inputs_[1]; } | |
789 LOperand* multiplicand() { return inputs_[2]; } | |
790 | |
791 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d") | |
792 }; | |
793 | |
794 | |
795 class LDebugBreak final : public LTemplateInstruction<0, 0, 0> { | |
796 public: | |
797 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break") | |
798 }; | |
799 | |
800 | |
801 class LCompareNumericAndBranch final : public LControlInstruction<2, 0> { | |
802 public: | |
803 LCompareNumericAndBranch(LOperand* left, LOperand* right) { | |
804 inputs_[0] = left; | |
805 inputs_[1] = right; | |
806 } | |
807 | |
808 LOperand* left() { return inputs_[0]; } | |
809 LOperand* right() { return inputs_[1]; } | |
810 | |
811 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch, | |
812 "compare-numeric-and-branch") | |
813 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch) | |
814 | |
815 Token::Value op() const { return hydrogen()->token(); } | |
816 bool is_double() const { | |
817 return hydrogen()->representation().IsDouble(); | |
818 } | |
819 | |
820 void PrintDataTo(StringStream* stream) override; | |
821 }; | |
822 | |
823 | |
824 class LMathFloor final : public LTemplateInstruction<1, 1, 1> { | |
825 public: | |
826 LMathFloor(LOperand* value, LOperand* temp) { | |
827 inputs_[0] = value; | |
828 temps_[0] = temp; | |
829 } | |
830 | |
831 LOperand* value() { return inputs_[0]; } | |
832 LOperand* temp() { return temps_[0]; } | |
833 | |
834 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor") | |
835 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) | |
836 }; | |
837 | |
838 | |
839 class LMathRound final : public LTemplateInstruction<1, 1, 1> { | |
840 public: | |
841 LMathRound(LOperand* value, LOperand* temp) { | |
842 inputs_[0] = value; | |
843 temps_[0] = temp; | |
844 } | |
845 | |
846 LOperand* value() { return inputs_[0]; } | |
847 LOperand* temp() { return temps_[0]; } | |
848 | |
849 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") | |
850 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) | |
851 }; | |
852 | |
853 | |
854 class LMathFround final : public LTemplateInstruction<1, 1, 0> { | |
855 public: | |
856 explicit LMathFround(LOperand* value) { inputs_[0] = value; } | |
857 | |
858 LOperand* value() { return inputs_[0]; } | |
859 | |
860 DECLARE_CONCRETE_INSTRUCTION(MathFround, "math-fround") | |
861 }; | |
862 | |
863 | |
864 class LMathAbs final : public LTemplateInstruction<1, 2, 0> { | |
865 public: | |
866 LMathAbs(LOperand* context, LOperand* value) { | |
867 inputs_[1] = context; | |
868 inputs_[0] = value; | |
869 } | |
870 | |
871 LOperand* context() { return inputs_[1]; } | |
872 LOperand* value() { return inputs_[0]; } | |
873 | |
874 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs") | |
875 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) | |
876 }; | |
877 | |
878 | |
879 class LMathLog final : public LTemplateInstruction<1, 1, 0> { | |
880 public: | |
881 explicit LMathLog(LOperand* value) { | |
882 inputs_[0] = value; | |
883 } | |
884 | |
885 LOperand* value() { return inputs_[0]; } | |
886 | |
887 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log") | |
888 }; | |
889 | |
890 | |
891 class LMathClz32 final : public LTemplateInstruction<1, 1, 0> { | |
892 public: | |
893 explicit LMathClz32(LOperand* value) { | |
894 inputs_[0] = value; | |
895 } | |
896 | |
897 LOperand* value() { return inputs_[0]; } | |
898 | |
899 DECLARE_CONCRETE_INSTRUCTION(MathClz32, "math-clz32") | |
900 }; | |
901 | |
902 | |
903 class LMathExp final : public LTemplateInstruction<1, 1, 3> { | |
904 public: | |
905 LMathExp(LOperand* value, | |
906 LOperand* double_temp, | |
907 LOperand* temp1, | |
908 LOperand* temp2) { | |
909 inputs_[0] = value; | |
910 temps_[0] = temp1; | |
911 temps_[1] = temp2; | |
912 temps_[2] = double_temp; | |
913 ExternalReference::InitializeMathExpData(); | |
914 } | |
915 | |
916 LOperand* value() { return inputs_[0]; } | |
917 LOperand* temp1() { return temps_[0]; } | |
918 LOperand* temp2() { return temps_[1]; } | |
919 LOperand* double_temp() { return temps_[2]; } | |
920 | |
921 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp") | |
922 }; | |
923 | |
924 | |
925 class LMathSqrt final : public LTemplateInstruction<1, 1, 0> { | |
926 public: | |
927 explicit LMathSqrt(LOperand* value) { | |
928 inputs_[0] = value; | |
929 } | |
930 | |
931 LOperand* value() { return inputs_[0]; } | |
932 | |
933 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt") | |
934 }; | |
935 | |
936 | |
937 class LMathPowHalf final : public LTemplateInstruction<1, 1, 1> { | |
938 public: | |
939 LMathPowHalf(LOperand* value, LOperand* temp) { | |
940 inputs_[0] = value; | |
941 temps_[0] = temp; | |
942 } | |
943 | |
944 LOperand* value() { return inputs_[0]; } | |
945 LOperand* temp() { return temps_[0]; } | |
946 | |
947 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half") | |
948 }; | |
949 | |
950 | |
951 class LCmpObjectEqAndBranch final : public LControlInstruction<2, 0> { | |
952 public: | |
953 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) { | |
954 inputs_[0] = left; | |
955 inputs_[1] = right; | |
956 } | |
957 | |
958 LOperand* left() { return inputs_[0]; } | |
959 LOperand* right() { return inputs_[1]; } | |
960 | |
961 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch") | |
962 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch) | |
963 }; | |
964 | |
965 | |
966 class LCmpHoleAndBranch final : public LControlInstruction<1, 0> { | |
967 public: | |
968 explicit LCmpHoleAndBranch(LOperand* object) { | |
969 inputs_[0] = object; | |
970 } | |
971 | |
972 LOperand* object() { return inputs_[0]; } | |
973 | |
974 DECLARE_CONCRETE_INSTRUCTION(CmpHoleAndBranch, "cmp-hole-and-branch") | |
975 DECLARE_HYDROGEN_ACCESSOR(CompareHoleAndBranch) | |
976 }; | |
977 | |
978 | |
979 class LCompareMinusZeroAndBranch final : public LControlInstruction<1, 1> { | |
980 public: | |
981 LCompareMinusZeroAndBranch(LOperand* value, LOperand* temp) { | |
982 inputs_[0] = value; | |
983 temps_[0] = temp; | |
984 } | |
985 | |
986 LOperand* value() { return inputs_[0]; } | |
987 LOperand* temp() { return temps_[0]; } | |
988 | |
989 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch, | |
990 "cmp-minus-zero-and-branch") | |
991 DECLARE_HYDROGEN_ACCESSOR(CompareMinusZeroAndBranch) | |
992 }; | |
993 | |
994 | |
995 class LIsStringAndBranch final : public LControlInstruction<1, 1> { | |
996 public: | |
997 LIsStringAndBranch(LOperand* value, LOperand* temp) { | |
998 inputs_[0] = value; | |
999 temps_[0] = temp; | |
1000 } | |
1001 | |
1002 LOperand* value() { return inputs_[0]; } | |
1003 LOperand* temp() { return temps_[0]; } | |
1004 | |
1005 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch") | |
1006 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch) | |
1007 | |
1008 void PrintDataTo(StringStream* stream) override; | |
1009 }; | |
1010 | |
1011 | |
1012 class LIsSmiAndBranch final : public LControlInstruction<1, 0> { | |
1013 public: | |
1014 explicit LIsSmiAndBranch(LOperand* value) { | |
1015 inputs_[0] = value; | |
1016 } | |
1017 | |
1018 LOperand* value() { return inputs_[0]; } | |
1019 | |
1020 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch") | |
1021 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch) | |
1022 | |
1023 void PrintDataTo(StringStream* stream) override; | |
1024 }; | |
1025 | |
1026 | |
1027 class LIsUndetectableAndBranch final : public LControlInstruction<1, 1> { | |
1028 public: | |
1029 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) { | |
1030 inputs_[0] = value; | |
1031 temps_[0] = temp; | |
1032 } | |
1033 | |
1034 LOperand* value() { return inputs_[0]; } | |
1035 LOperand* temp() { return temps_[0]; } | |
1036 | |
1037 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch, | |
1038 "is-undetectable-and-branch") | |
1039 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch) | |
1040 | |
1041 void PrintDataTo(StringStream* stream) override; | |
1042 }; | |
1043 | |
1044 | |
1045 class LStringCompareAndBranch final : public LControlInstruction<3, 0> { | |
1046 public: | |
1047 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) { | |
1048 inputs_[0] = context; | |
1049 inputs_[1] = left; | |
1050 inputs_[2] = right; | |
1051 } | |
1052 | |
1053 LOperand* context() { return inputs_[0]; } | |
1054 LOperand* left() { return inputs_[1]; } | |
1055 LOperand* right() { return inputs_[2]; } | |
1056 | |
1057 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch, | |
1058 "string-compare-and-branch") | |
1059 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch) | |
1060 | |
1061 Token::Value op() const { return hydrogen()->token(); } | |
1062 | |
1063 void PrintDataTo(StringStream* stream) override; | |
1064 }; | |
1065 | |
1066 | |
1067 class LHasInstanceTypeAndBranch final : public LControlInstruction<1, 0> { | |
1068 public: | |
1069 explicit LHasInstanceTypeAndBranch(LOperand* value) { | |
1070 inputs_[0] = value; | |
1071 } | |
1072 | |
1073 LOperand* value() { return inputs_[0]; } | |
1074 | |
1075 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch, | |
1076 "has-instance-type-and-branch") | |
1077 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch) | |
1078 | |
1079 void PrintDataTo(StringStream* stream) override; | |
1080 }; | |
1081 | |
1082 | |
1083 class LGetCachedArrayIndex final : public LTemplateInstruction<1, 1, 0> { | |
1084 public: | |
1085 explicit LGetCachedArrayIndex(LOperand* value) { | |
1086 inputs_[0] = value; | |
1087 } | |
1088 | |
1089 LOperand* value() { return inputs_[0]; } | |
1090 | |
1091 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index") | |
1092 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex) | |
1093 }; | |
1094 | |
1095 | |
1096 class LHasCachedArrayIndexAndBranch final : public LControlInstruction<1, 0> { | |
1097 public: | |
1098 explicit LHasCachedArrayIndexAndBranch(LOperand* value) { | |
1099 inputs_[0] = value; | |
1100 } | |
1101 | |
1102 LOperand* value() { return inputs_[0]; } | |
1103 | |
1104 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch, | |
1105 "has-cached-array-index-and-branch") | |
1106 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch) | |
1107 | |
1108 void PrintDataTo(StringStream* stream) override; | |
1109 }; | |
1110 | |
1111 | |
1112 class LClassOfTestAndBranch final : public LControlInstruction<1, 1> { | |
1113 public: | |
1114 LClassOfTestAndBranch(LOperand* value, LOperand* temp) { | |
1115 inputs_[0] = value; | |
1116 temps_[0] = temp; | |
1117 } | |
1118 | |
1119 LOperand* value() { return inputs_[0]; } | |
1120 LOperand* temp() { return temps_[0]; } | |
1121 | |
1122 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch, | |
1123 "class-of-test-and-branch") | |
1124 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch) | |
1125 | |
1126 void PrintDataTo(StringStream* stream) override; | |
1127 }; | |
1128 | |
1129 | |
1130 class LCmpT final : public LTemplateInstruction<1, 3, 0> { | |
1131 public: | |
1132 LCmpT(LOperand* context, LOperand* left, LOperand* right) { | |
1133 inputs_[0] = context; | |
1134 inputs_[1] = left; | |
1135 inputs_[2] = right; | |
1136 } | |
1137 | |
1138 LOperand* context() { return inputs_[0]; } | |
1139 LOperand* left() { return inputs_[1]; } | |
1140 LOperand* right() { return inputs_[2]; } | |
1141 | |
1142 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") | |
1143 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) | |
1144 | |
1145 Strength strength() { return hydrogen()->strength(); } | |
1146 | |
1147 Token::Value op() const { return hydrogen()->token(); } | |
1148 }; | |
1149 | |
1150 | |
1151 class LInstanceOf final : public LTemplateInstruction<1, 3, 0> { | |
1152 public: | |
1153 LInstanceOf(LOperand* context, LOperand* left, LOperand* right) { | |
1154 inputs_[0] = context; | |
1155 inputs_[1] = left; | |
1156 inputs_[2] = right; | |
1157 } | |
1158 | |
1159 LOperand* context() const { return inputs_[0]; } | |
1160 LOperand* left() const { return inputs_[1]; } | |
1161 LOperand* right() const { return inputs_[2]; } | |
1162 | |
1163 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of") | |
1164 }; | |
1165 | |
1166 | |
1167 class LHasInPrototypeChainAndBranch final : public LControlInstruction<2, 0> { | |
1168 public: | |
1169 LHasInPrototypeChainAndBranch(LOperand* object, LOperand* prototype) { | |
1170 inputs_[0] = object; | |
1171 inputs_[1] = prototype; | |
1172 } | |
1173 | |
1174 LOperand* object() const { return inputs_[0]; } | |
1175 LOperand* prototype() const { return inputs_[1]; } | |
1176 | |
1177 DECLARE_CONCRETE_INSTRUCTION(HasInPrototypeChainAndBranch, | |
1178 "has-in-prototype-chain-and-branch") | |
1179 DECLARE_HYDROGEN_ACCESSOR(HasInPrototypeChainAndBranch) | |
1180 }; | |
1181 | |
1182 | |
1183 class LBoundsCheck final : public LTemplateInstruction<0, 2, 0> { | |
1184 public: | |
1185 LBoundsCheck(LOperand* index, LOperand* length) { | |
1186 inputs_[0] = index; | |
1187 inputs_[1] = length; | |
1188 } | |
1189 | |
1190 LOperand* index() { return inputs_[0]; } | |
1191 LOperand* length() { return inputs_[1]; } | |
1192 | |
1193 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check") | |
1194 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck) | |
1195 }; | |
1196 | |
1197 | |
1198 class LBitI final : public LTemplateInstruction<1, 2, 0> { | |
1199 public: | |
1200 LBitI(LOperand* left, LOperand* right) { | |
1201 inputs_[0] = left; | |
1202 inputs_[1] = right; | |
1203 } | |
1204 | |
1205 LOperand* left() { return inputs_[0]; } | |
1206 LOperand* right() { return inputs_[1]; } | |
1207 | |
1208 Token::Value op() const { return hydrogen()->op(); } | |
1209 | |
1210 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i") | |
1211 DECLARE_HYDROGEN_ACCESSOR(Bitwise) | |
1212 }; | |
1213 | |
1214 | |
1215 class LShiftI final : public LTemplateInstruction<1, 2, 0> { | |
1216 public: | |
1217 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt) | |
1218 : op_(op), can_deopt_(can_deopt) { | |
1219 inputs_[0] = left; | |
1220 inputs_[1] = right; | |
1221 } | |
1222 | |
1223 Token::Value op() const { return op_; } | |
1224 LOperand* left() { return inputs_[0]; } | |
1225 LOperand* right() { return inputs_[1]; } | |
1226 bool can_deopt() const { return can_deopt_; } | |
1227 | |
1228 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i") | |
1229 | |
1230 private: | |
1231 Token::Value op_; | |
1232 bool can_deopt_; | |
1233 }; | |
1234 | |
1235 | |
1236 class LSubI final : public LTemplateInstruction<1, 2, 0> { | |
1237 public: | |
1238 LSubI(LOperand* left, LOperand* right) { | |
1239 inputs_[0] = left; | |
1240 inputs_[1] = right; | |
1241 } | |
1242 | |
1243 LOperand* left() { return inputs_[0]; } | |
1244 LOperand* right() { return inputs_[1]; } | |
1245 | |
1246 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") | |
1247 DECLARE_HYDROGEN_ACCESSOR(Sub) | |
1248 }; | |
1249 | |
1250 | |
1251 class LConstantI final : public LTemplateInstruction<1, 0, 0> { | |
1252 public: | |
1253 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") | |
1254 DECLARE_HYDROGEN_ACCESSOR(Constant) | |
1255 | |
1256 int32_t value() const { return hydrogen()->Integer32Value(); } | |
1257 }; | |
1258 | |
1259 | |
1260 class LConstantS final : public LTemplateInstruction<1, 0, 0> { | |
1261 public: | |
1262 DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s") | |
1263 DECLARE_HYDROGEN_ACCESSOR(Constant) | |
1264 | |
1265 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); } | |
1266 }; | |
1267 | |
1268 | |
1269 class LConstantD final : public LTemplateInstruction<1, 0, 0> { | |
1270 public: | |
1271 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") | |
1272 DECLARE_HYDROGEN_ACCESSOR(Constant) | |
1273 | |
1274 double value() const { return hydrogen()->DoubleValue(); } | |
1275 uint64_t bits() const { return hydrogen()->DoubleValueAsBits(); } | |
1276 }; | |
1277 | |
1278 | |
1279 class LConstantE final : public LTemplateInstruction<1, 0, 0> { | |
1280 public: | |
1281 DECLARE_CONCRETE_INSTRUCTION(ConstantE, "constant-e") | |
1282 DECLARE_HYDROGEN_ACCESSOR(Constant) | |
1283 | |
1284 ExternalReference value() const { | |
1285 return hydrogen()->ExternalReferenceValue(); | |
1286 } | |
1287 }; | |
1288 | |
1289 | |
1290 class LConstantT final : public LTemplateInstruction<1, 0, 0> { | |
1291 public: | |
1292 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") | |
1293 DECLARE_HYDROGEN_ACCESSOR(Constant) | |
1294 | |
1295 Handle<Object> value(Isolate* isolate) const { | |
1296 return hydrogen()->handle(isolate); | |
1297 } | |
1298 }; | |
1299 | |
1300 | |
1301 class LBranch final : public LControlInstruction<1, 0> { | |
1302 public: | |
1303 explicit LBranch(LOperand* value) { | |
1304 inputs_[0] = value; | |
1305 } | |
1306 | |
1307 LOperand* value() { return inputs_[0]; } | |
1308 | |
1309 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") | |
1310 DECLARE_HYDROGEN_ACCESSOR(Branch) | |
1311 | |
1312 void PrintDataTo(StringStream* stream) override; | |
1313 }; | |
1314 | |
1315 | |
1316 class LCmpMapAndBranch final : public LControlInstruction<1, 1> { | |
1317 public: | |
1318 LCmpMapAndBranch(LOperand* value, LOperand* temp) { | |
1319 inputs_[0] = value; | |
1320 temps_[0] = temp; | |
1321 } | |
1322 | |
1323 LOperand* value() { return inputs_[0]; } | |
1324 LOperand* temp() { return temps_[0]; } | |
1325 | |
1326 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") | |
1327 DECLARE_HYDROGEN_ACCESSOR(CompareMap) | |
1328 | |
1329 Handle<Map> map() const { return hydrogen()->map().handle(); } | |
1330 }; | |
1331 | |
1332 | |
1333 class LMapEnumLength final : public LTemplateInstruction<1, 1, 0> { | |
1334 public: | |
1335 explicit LMapEnumLength(LOperand* value) { | |
1336 inputs_[0] = value; | |
1337 } | |
1338 | |
1339 LOperand* value() { return inputs_[0]; } | |
1340 | |
1341 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length") | |
1342 }; | |
1343 | |
1344 | |
1345 class LDateField final : public LTemplateInstruction<1, 1, 1> { | |
1346 public: | |
1347 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) { | |
1348 inputs_[0] = date; | |
1349 temps_[0] = temp; | |
1350 } | |
1351 | |
1352 LOperand* date() { return inputs_[0]; } | |
1353 LOperand* temp() { return temps_[0]; } | |
1354 Smi* index() const { return index_; } | |
1355 | |
1356 DECLARE_CONCRETE_INSTRUCTION(DateField, "date-field") | |
1357 DECLARE_HYDROGEN_ACCESSOR(DateField) | |
1358 | |
1359 private: | |
1360 Smi* index_; | |
1361 }; | |
1362 | |
1363 | |
1364 class LSeqStringGetChar final : public LTemplateInstruction<1, 2, 0> { | |
1365 public: | |
1366 LSeqStringGetChar(LOperand* string, LOperand* index) { | |
1367 inputs_[0] = string; | |
1368 inputs_[1] = index; | |
1369 } | |
1370 | |
1371 LOperand* string() const { return inputs_[0]; } | |
1372 LOperand* index() const { return inputs_[1]; } | |
1373 | |
1374 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar, "seq-string-get-char") | |
1375 DECLARE_HYDROGEN_ACCESSOR(SeqStringGetChar) | |
1376 }; | |
1377 | |
1378 | |
1379 class LSeqStringSetChar final : public LTemplateInstruction<1, 4, 0> { | |
1380 public: | |
1381 LSeqStringSetChar(LOperand* context, | |
1382 LOperand* string, | |
1383 LOperand* index, | |
1384 LOperand* value) { | |
1385 inputs_[0] = context; | |
1386 inputs_[1] = string; | |
1387 inputs_[2] = index; | |
1388 inputs_[3] = value; | |
1389 } | |
1390 | |
1391 LOperand* string() { return inputs_[1]; } | |
1392 LOperand* index() { return inputs_[2]; } | |
1393 LOperand* value() { return inputs_[3]; } | |
1394 | |
1395 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char") | |
1396 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar) | |
1397 }; | |
1398 | |
1399 | |
1400 class LAddI final : public LTemplateInstruction<1, 2, 0> { | |
1401 public: | |
1402 LAddI(LOperand* left, LOperand* right) { | |
1403 inputs_[0] = left; | |
1404 inputs_[1] = right; | |
1405 } | |
1406 | |
1407 LOperand* left() { return inputs_[0]; } | |
1408 LOperand* right() { return inputs_[1]; } | |
1409 | |
1410 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i") | |
1411 DECLARE_HYDROGEN_ACCESSOR(Add) | |
1412 }; | |
1413 | |
1414 | |
1415 class LMathMinMax final : public LTemplateInstruction<1, 2, 0> { | |
1416 public: | |
1417 LMathMinMax(LOperand* left, LOperand* right) { | |
1418 inputs_[0] = left; | |
1419 inputs_[1] = right; | |
1420 } | |
1421 | |
1422 LOperand* left() { return inputs_[0]; } | |
1423 LOperand* right() { return inputs_[1]; } | |
1424 | |
1425 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max") | |
1426 DECLARE_HYDROGEN_ACCESSOR(MathMinMax) | |
1427 }; | |
1428 | |
1429 | |
1430 class LPower final : public LTemplateInstruction<1, 2, 0> { | |
1431 public: | |
1432 LPower(LOperand* left, LOperand* right) { | |
1433 inputs_[0] = left; | |
1434 inputs_[1] = right; | |
1435 } | |
1436 | |
1437 LOperand* left() { return inputs_[0]; } | |
1438 LOperand* right() { return inputs_[1]; } | |
1439 | |
1440 DECLARE_CONCRETE_INSTRUCTION(Power, "power") | |
1441 DECLARE_HYDROGEN_ACCESSOR(Power) | |
1442 }; | |
1443 | |
1444 | |
1445 class LArithmeticD final : public LTemplateInstruction<1, 2, 0> { | |
1446 public: | |
1447 LArithmeticD(Token::Value op, LOperand* left, LOperand* right) | |
1448 : op_(op) { | |
1449 inputs_[0] = left; | |
1450 inputs_[1] = right; | |
1451 } | |
1452 | |
1453 Token::Value op() const { return op_; } | |
1454 LOperand* left() { return inputs_[0]; } | |
1455 LOperand* right() { return inputs_[1]; } | |
1456 | |
1457 Opcode opcode() const override { return LInstruction::kArithmeticD; } | |
1458 void CompileToNative(LCodeGen* generator) override; | |
1459 const char* Mnemonic() const override; | |
1460 | |
1461 private: | |
1462 Token::Value op_; | |
1463 }; | |
1464 | |
1465 | |
1466 class LArithmeticT final : public LTemplateInstruction<1, 3, 0> { | |
1467 public: | |
1468 LArithmeticT(Token::Value op, | |
1469 LOperand* context, | |
1470 LOperand* left, | |
1471 LOperand* right) | |
1472 : op_(op) { | |
1473 inputs_[0] = context; | |
1474 inputs_[1] = left; | |
1475 inputs_[2] = right; | |
1476 } | |
1477 | |
1478 LOperand* context() { return inputs_[0]; } | |
1479 LOperand* left() { return inputs_[1]; } | |
1480 LOperand* right() { return inputs_[2]; } | |
1481 Token::Value op() const { return op_; } | |
1482 | |
1483 Opcode opcode() const final { return LInstruction::kArithmeticT; } | |
1484 void CompileToNative(LCodeGen* generator) override; | |
1485 const char* Mnemonic() const override; | |
1486 | |
1487 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) | |
1488 | |
1489 Strength strength() { return hydrogen()->strength(); } | |
1490 | |
1491 private: | |
1492 Token::Value op_; | |
1493 }; | |
1494 | |
1495 | |
1496 class LReturn final : public LTemplateInstruction<0, 3, 0> { | |
1497 public: | |
1498 LReturn(LOperand* value, LOperand* context, LOperand* parameter_count) { | |
1499 inputs_[0] = value; | |
1500 inputs_[1] = context; | |
1501 inputs_[2] = parameter_count; | |
1502 } | |
1503 | |
1504 LOperand* value() { return inputs_[0]; } | |
1505 | |
1506 bool has_constant_parameter_count() { | |
1507 return parameter_count()->IsConstantOperand(); | |
1508 } | |
1509 LConstantOperand* constant_parameter_count() { | |
1510 DCHECK(has_constant_parameter_count()); | |
1511 return LConstantOperand::cast(parameter_count()); | |
1512 } | |
1513 LOperand* parameter_count() { return inputs_[2]; } | |
1514 | |
1515 DECLARE_CONCRETE_INSTRUCTION(Return, "return") | |
1516 }; | |
1517 | |
1518 | |
1519 class LLoadNamedField final : public LTemplateInstruction<1, 1, 0> { | |
1520 public: | |
1521 explicit LLoadNamedField(LOperand* object) { | |
1522 inputs_[0] = object; | |
1523 } | |
1524 | |
1525 LOperand* object() { return inputs_[0]; } | |
1526 | |
1527 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field") | |
1528 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField) | |
1529 }; | |
1530 | |
1531 | |
1532 class LLoadNamedGeneric final : public LTemplateInstruction<1, 2, 1> { | |
1533 public: | |
1534 LLoadNamedGeneric(LOperand* context, LOperand* object, LOperand* vector) { | |
1535 inputs_[0] = context; | |
1536 inputs_[1] = object; | |
1537 temps_[0] = vector; | |
1538 } | |
1539 | |
1540 LOperand* context() { return inputs_[0]; } | |
1541 LOperand* object() { return inputs_[1]; } | |
1542 LOperand* temp_vector() { return temps_[0]; } | |
1543 | |
1544 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic") | |
1545 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric) | |
1546 | |
1547 Handle<Object> name() const { return hydrogen()->name(); } | |
1548 }; | |
1549 | |
1550 | |
1551 class LLoadFunctionPrototype final : public LTemplateInstruction<1, 1, 0> { | |
1552 public: | |
1553 explicit LLoadFunctionPrototype(LOperand* function) { | |
1554 inputs_[0] = function; | |
1555 } | |
1556 | |
1557 LOperand* function() { return inputs_[0]; } | |
1558 | |
1559 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype") | |
1560 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype) | |
1561 }; | |
1562 | |
1563 | |
1564 class LLoadRoot final : public LTemplateInstruction<1, 0, 0> { | |
1565 public: | |
1566 DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root") | |
1567 DECLARE_HYDROGEN_ACCESSOR(LoadRoot) | |
1568 | |
1569 Heap::RootListIndex index() const { return hydrogen()->index(); } | |
1570 }; | |
1571 | |
1572 | |
1573 class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> { | |
1574 public: | |
1575 LLoadKeyed(LOperand* elements, LOperand* key) { | |
1576 inputs_[0] = elements; | |
1577 inputs_[1] = key; | |
1578 } | |
1579 | |
1580 LOperand* elements() { return inputs_[0]; } | |
1581 LOperand* key() { return inputs_[1]; } | |
1582 ElementsKind elements_kind() const { | |
1583 return hydrogen()->elements_kind(); | |
1584 } | |
1585 bool is_fixed_typed_array() const { | |
1586 return hydrogen()->is_fixed_typed_array(); | |
1587 } | |
1588 | |
1589 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed") | |
1590 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed) | |
1591 | |
1592 void PrintDataTo(StringStream* stream) override; | |
1593 uint32_t base_offset() const { return hydrogen()->base_offset(); } | |
1594 }; | |
1595 | |
1596 | |
1597 class LLoadKeyedGeneric final : public LTemplateInstruction<1, 3, 1> { | |
1598 public: | |
1599 LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key, | |
1600 LOperand* vector) { | |
1601 inputs_[0] = context; | |
1602 inputs_[1] = object; | |
1603 inputs_[2] = key; | |
1604 temps_[0] = vector; | |
1605 } | |
1606 | |
1607 LOperand* context() { return inputs_[0]; } | |
1608 LOperand* object() { return inputs_[1]; } | |
1609 LOperand* key() { return inputs_[2]; } | |
1610 LOperand* temp_vector() { return temps_[0]; } | |
1611 | |
1612 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") | |
1613 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedGeneric) | |
1614 }; | |
1615 | |
1616 | |
1617 class LLoadGlobalGeneric final : public LTemplateInstruction<1, 2, 1> { | |
1618 public: | |
1619 LLoadGlobalGeneric(LOperand* context, LOperand* global_object, | |
1620 LOperand* vector) { | |
1621 inputs_[0] = context; | |
1622 inputs_[1] = global_object; | |
1623 temps_[0] = vector; | |
1624 } | |
1625 | |
1626 LOperand* context() { return inputs_[0]; } | |
1627 LOperand* global_object() { return inputs_[1]; } | |
1628 LOperand* temp_vector() { return temps_[0]; } | |
1629 | |
1630 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic") | |
1631 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric) | |
1632 | |
1633 Handle<Object> name() const { return hydrogen()->name(); } | |
1634 TypeofMode typeof_mode() const { return hydrogen()->typeof_mode(); } | |
1635 }; | |
1636 | |
1637 | |
1638 class LLoadGlobalViaContext final : public LTemplateInstruction<1, 1, 1> { | |
1639 public: | |
1640 explicit LLoadGlobalViaContext(LOperand* context) { inputs_[0] = context; } | |
1641 | |
1642 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalViaContext, "load-global-via-context") | |
1643 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalViaContext) | |
1644 | |
1645 void PrintDataTo(StringStream* stream) override; | |
1646 | |
1647 LOperand* context() { return inputs_[0]; } | |
1648 | |
1649 int depth() const { return hydrogen()->depth(); } | |
1650 int slot_index() const { return hydrogen()->slot_index(); } | |
1651 }; | |
1652 | |
1653 | |
1654 class LLoadContextSlot final : public LTemplateInstruction<1, 1, 0> { | |
1655 public: | |
1656 explicit LLoadContextSlot(LOperand* context) { | |
1657 inputs_[0] = context; | |
1658 } | |
1659 | |
1660 LOperand* context() { return inputs_[0]; } | |
1661 | |
1662 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") | |
1663 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) | |
1664 | |
1665 int slot_index() { return hydrogen()->slot_index(); } | |
1666 | |
1667 void PrintDataTo(StringStream* stream) override; | |
1668 }; | |
1669 | |
1670 | |
1671 class LStoreContextSlot final : public LTemplateInstruction<0, 2, 0> { | |
1672 public: | |
1673 LStoreContextSlot(LOperand* context, LOperand* value) { | |
1674 inputs_[0] = context; | |
1675 inputs_[1] = value; | |
1676 } | |
1677 | |
1678 LOperand* context() { return inputs_[0]; } | |
1679 LOperand* value() { return inputs_[1]; } | |
1680 | |
1681 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot") | |
1682 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot) | |
1683 | |
1684 int slot_index() { return hydrogen()->slot_index(); } | |
1685 | |
1686 void PrintDataTo(StringStream* stream) override; | |
1687 }; | |
1688 | |
1689 | |
1690 class LPushArgument final : public LTemplateInstruction<0, 1, 0> { | |
1691 public: | |
1692 explicit LPushArgument(LOperand* value) { | |
1693 inputs_[0] = value; | |
1694 } | |
1695 | |
1696 LOperand* value() { return inputs_[0]; } | |
1697 | |
1698 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") | |
1699 }; | |
1700 | |
1701 | |
1702 class LDrop final : public LTemplateInstruction<0, 0, 0> { | |
1703 public: | |
1704 explicit LDrop(int count) : count_(count) { } | |
1705 | |
1706 int count() const { return count_; } | |
1707 | |
1708 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop") | |
1709 | |
1710 private: | |
1711 int count_; | |
1712 }; | |
1713 | |
1714 | |
1715 class LStoreCodeEntry final : public LTemplateInstruction<0, 2, 0> { | |
1716 public: | |
1717 LStoreCodeEntry(LOperand* function, LOperand* code_object) { | |
1718 inputs_[0] = function; | |
1719 inputs_[1] = code_object; | |
1720 } | |
1721 | |
1722 LOperand* function() { return inputs_[0]; } | |
1723 LOperand* code_object() { return inputs_[1]; } | |
1724 | |
1725 void PrintDataTo(StringStream* stream) override; | |
1726 | |
1727 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry, "store-code-entry") | |
1728 DECLARE_HYDROGEN_ACCESSOR(StoreCodeEntry) | |
1729 }; | |
1730 | |
1731 | |
1732 class LInnerAllocatedObject final : public LTemplateInstruction<1, 2, 0> { | |
1733 public: | |
1734 LInnerAllocatedObject(LOperand* base_object, LOperand* offset) { | |
1735 inputs_[0] = base_object; | |
1736 inputs_[1] = offset; | |
1737 } | |
1738 | |
1739 LOperand* base_object() const { return inputs_[0]; } | |
1740 LOperand* offset() const { return inputs_[1]; } | |
1741 | |
1742 void PrintDataTo(StringStream* stream) override; | |
1743 | |
1744 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "inner-allocated-object") | |
1745 }; | |
1746 | |
1747 | |
1748 class LThisFunction final : public LTemplateInstruction<1, 0, 0> { | |
1749 public: | |
1750 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function") | |
1751 DECLARE_HYDROGEN_ACCESSOR(ThisFunction) | |
1752 }; | |
1753 | |
1754 | |
1755 class LContext final : public LTemplateInstruction<1, 0, 0> { | |
1756 public: | |
1757 DECLARE_CONCRETE_INSTRUCTION(Context, "context") | |
1758 DECLARE_HYDROGEN_ACCESSOR(Context) | |
1759 }; | |
1760 | |
1761 | |
1762 class LDeclareGlobals final : public LTemplateInstruction<0, 1, 0> { | |
1763 public: | |
1764 explicit LDeclareGlobals(LOperand* context) { | |
1765 inputs_[0] = context; | |
1766 } | |
1767 | |
1768 LOperand* context() { return inputs_[0]; } | |
1769 | |
1770 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals") | |
1771 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals) | |
1772 }; | |
1773 | |
1774 | |
1775 class LCallJSFunction final : public LTemplateInstruction<1, 1, 0> { | |
1776 public: | |
1777 explicit LCallJSFunction(LOperand* function) { | |
1778 inputs_[0] = function; | |
1779 } | |
1780 | |
1781 LOperand* function() { return inputs_[0]; } | |
1782 | |
1783 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function") | |
1784 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction) | |
1785 | |
1786 void PrintDataTo(StringStream* stream) override; | |
1787 | |
1788 int arity() const { return hydrogen()->argument_count() - 1; } | |
1789 }; | |
1790 | |
1791 | |
1792 class LCallWithDescriptor final : public LTemplateResultInstruction<1> { | |
1793 public: | |
1794 LCallWithDescriptor(CallInterfaceDescriptor descriptor, | |
1795 const ZoneList<LOperand*>& operands, Zone* zone) | |
1796 : descriptor_(descriptor), | |
1797 inputs_(descriptor.GetRegisterParameterCount() + | |
1798 kImplicitRegisterParameterCount, | |
1799 zone) { | |
1800 DCHECK(descriptor.GetRegisterParameterCount() + | |
1801 kImplicitRegisterParameterCount == | |
1802 operands.length()); | |
1803 inputs_.AddAll(operands, zone); | |
1804 } | |
1805 | |
1806 LOperand* target() const { return inputs_[0]; } | |
1807 | |
1808 const CallInterfaceDescriptor descriptor() { return descriptor_; } | |
1809 | |
1810 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor) | |
1811 | |
1812 // The target and context are passed as implicit parameters that are not | |
1813 // explicitly listed in the descriptor. | |
1814 static const int kImplicitRegisterParameterCount = 2; | |
1815 | |
1816 private: | |
1817 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor") | |
1818 | |
1819 void PrintDataTo(StringStream* stream) override; | |
1820 | |
1821 int arity() const { return hydrogen()->argument_count() - 1; } | |
1822 | |
1823 CallInterfaceDescriptor descriptor_; | |
1824 ZoneList<LOperand*> inputs_; | |
1825 | |
1826 // Iterator support. | |
1827 int InputCount() final { return inputs_.length(); } | |
1828 LOperand* InputAt(int i) final { return inputs_[i]; } | |
1829 | |
1830 int TempCount() final { return 0; } | |
1831 LOperand* TempAt(int i) final { return NULL; } | |
1832 }; | |
1833 | |
1834 | |
1835 class LInvokeFunction final : public LTemplateInstruction<1, 2, 0> { | |
1836 public: | |
1837 LInvokeFunction(LOperand* context, LOperand* function) { | |
1838 inputs_[0] = context; | |
1839 inputs_[1] = function; | |
1840 } | |
1841 | |
1842 LOperand* context() { return inputs_[0]; } | |
1843 LOperand* function() { return inputs_[1]; } | |
1844 | |
1845 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function") | |
1846 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction) | |
1847 | |
1848 void PrintDataTo(StringStream* stream) override; | |
1849 | |
1850 int arity() const { return hydrogen()->argument_count() - 1; } | |
1851 }; | |
1852 | |
1853 | |
1854 class LCallFunction final : public LTemplateInstruction<1, 2, 2> { | |
1855 public: | |
1856 LCallFunction(LOperand* context, LOperand* function, LOperand* slot, | |
1857 LOperand* vector) { | |
1858 inputs_[0] = context; | |
1859 inputs_[1] = function; | |
1860 temps_[0] = slot; | |
1861 temps_[1] = vector; | |
1862 } | |
1863 | |
1864 LOperand* context() { return inputs_[0]; } | |
1865 LOperand* function() { return inputs_[1]; } | |
1866 LOperand* temp_slot() { return temps_[0]; } | |
1867 LOperand* temp_vector() { return temps_[1]; } | |
1868 | |
1869 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") | |
1870 DECLARE_HYDROGEN_ACCESSOR(CallFunction) | |
1871 | |
1872 int arity() const { return hydrogen()->argument_count() - 1; } | |
1873 void PrintDataTo(StringStream* stream) override; | |
1874 }; | |
1875 | |
1876 | |
1877 class LCallNew final : public LTemplateInstruction<1, 2, 0> { | |
1878 public: | |
1879 LCallNew(LOperand* context, LOperand* constructor) { | |
1880 inputs_[0] = context; | |
1881 inputs_[1] = constructor; | |
1882 } | |
1883 | |
1884 LOperand* context() { return inputs_[0]; } | |
1885 LOperand* constructor() { return inputs_[1]; } | |
1886 | |
1887 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") | |
1888 DECLARE_HYDROGEN_ACCESSOR(CallNew) | |
1889 | |
1890 void PrintDataTo(StringStream* stream) override; | |
1891 | |
1892 int arity() const { return hydrogen()->argument_count() - 1; } | |
1893 }; | |
1894 | |
1895 | |
1896 class LCallNewArray final : public LTemplateInstruction<1, 2, 0> { | |
1897 public: | |
1898 LCallNewArray(LOperand* context, LOperand* constructor) { | |
1899 inputs_[0] = context; | |
1900 inputs_[1] = constructor; | |
1901 } | |
1902 | |
1903 LOperand* context() { return inputs_[0]; } | |
1904 LOperand* constructor() { return inputs_[1]; } | |
1905 | |
1906 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array") | |
1907 DECLARE_HYDROGEN_ACCESSOR(CallNewArray) | |
1908 | |
1909 void PrintDataTo(StringStream* stream) override; | |
1910 | |
1911 int arity() const { return hydrogen()->argument_count() - 1; } | |
1912 }; | |
1913 | |
1914 | |
1915 class LCallRuntime final : public LTemplateInstruction<1, 1, 0> { | |
1916 public: | |
1917 explicit LCallRuntime(LOperand* context) { | |
1918 inputs_[0] = context; | |
1919 } | |
1920 | |
1921 LOperand* context() { return inputs_[0]; } | |
1922 | |
1923 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime") | |
1924 DECLARE_HYDROGEN_ACCESSOR(CallRuntime) | |
1925 | |
1926 bool ClobbersDoubleRegisters(Isolate* isolate) const override { | |
1927 return save_doubles() == kDontSaveFPRegs; | |
1928 } | |
1929 | |
1930 const Runtime::Function* function() const { return hydrogen()->function(); } | |
1931 int arity() const { return hydrogen()->argument_count(); } | |
1932 SaveFPRegsMode save_doubles() const { return hydrogen()->save_doubles(); } | |
1933 }; | |
1934 | |
1935 | |
1936 class LInteger32ToDouble final : public LTemplateInstruction<1, 1, 0> { | |
1937 public: | |
1938 explicit LInteger32ToDouble(LOperand* value) { | |
1939 inputs_[0] = value; | |
1940 } | |
1941 | |
1942 LOperand* value() { return inputs_[0]; } | |
1943 | |
1944 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double") | |
1945 }; | |
1946 | |
1947 | |
1948 class LUint32ToDouble final : public LTemplateInstruction<1, 1, 0> { | |
1949 public: | |
1950 explicit LUint32ToDouble(LOperand* value) { | |
1951 inputs_[0] = value; | |
1952 } | |
1953 | |
1954 LOperand* value() { return inputs_[0]; } | |
1955 | |
1956 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double") | |
1957 }; | |
1958 | |
1959 | |
1960 class LNumberTagI final : public LTemplateInstruction<1, 1, 2> { | |
1961 public: | |
1962 LNumberTagI(LOperand* value, LOperand* temp1, LOperand* temp2) { | |
1963 inputs_[0] = value; | |
1964 temps_[0] = temp1; | |
1965 temps_[1] = temp2; | |
1966 } | |
1967 | |
1968 LOperand* value() { return inputs_[0]; } | |
1969 LOperand* temp1() { return temps_[0]; } | |
1970 LOperand* temp2() { return temps_[1]; } | |
1971 | |
1972 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") | |
1973 }; | |
1974 | |
1975 | |
1976 class LNumberTagU final : public LTemplateInstruction<1, 1, 2> { | |
1977 public: | |
1978 LNumberTagU(LOperand* value, LOperand* temp1, LOperand* temp2) { | |
1979 inputs_[0] = value; | |
1980 temps_[0] = temp1; | |
1981 temps_[1] = temp2; | |
1982 } | |
1983 | |
1984 LOperand* value() { return inputs_[0]; } | |
1985 LOperand* temp1() { return temps_[0]; } | |
1986 LOperand* temp2() { return temps_[1]; } | |
1987 | |
1988 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u") | |
1989 }; | |
1990 | |
1991 | |
1992 class LNumberTagD final : public LTemplateInstruction<1, 1, 2> { | |
1993 public: | |
1994 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) { | |
1995 inputs_[0] = value; | |
1996 temps_[0] = temp; | |
1997 temps_[1] = temp2; | |
1998 } | |
1999 | |
2000 LOperand* value() { return inputs_[0]; } | |
2001 LOperand* temp() { return temps_[0]; } | |
2002 LOperand* temp2() { return temps_[1]; } | |
2003 | |
2004 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d") | |
2005 DECLARE_HYDROGEN_ACCESSOR(Change) | |
2006 }; | |
2007 | |
2008 | |
2009 class LDoubleToSmi final : public LTemplateInstruction<1, 1, 0> { | |
2010 public: | |
2011 explicit LDoubleToSmi(LOperand* value) { | |
2012 inputs_[0] = value; | |
2013 } | |
2014 | |
2015 LOperand* value() { return inputs_[0]; } | |
2016 | |
2017 DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi") | |
2018 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) | |
2019 | |
2020 bool truncating() { return hydrogen()->CanTruncateToInt32(); } | |
2021 }; | |
2022 | |
2023 | |
2024 // Sometimes truncating conversion from a tagged value to an int32. | |
2025 class LDoubleToI final : public LTemplateInstruction<1, 1, 0> { | |
2026 public: | |
2027 explicit LDoubleToI(LOperand* value) { | |
2028 inputs_[0] = value; | |
2029 } | |
2030 | |
2031 LOperand* value() { return inputs_[0]; } | |
2032 | |
2033 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i") | |
2034 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation) | |
2035 | |
2036 bool truncating() { return hydrogen()->CanTruncateToInt32(); } | |
2037 }; | |
2038 | |
2039 | |
2040 // Truncating conversion from a tagged value to an int32. | |
2041 class LTaggedToI final : public LTemplateInstruction<1, 1, 2> { | |
2042 public: | |
2043 LTaggedToI(LOperand* value, | |
2044 LOperand* temp, | |
2045 LOperand* temp2) { | |
2046 inputs_[0] = value; | |
2047 temps_[0] = temp; | |
2048 temps_[1] = temp2; | |
2049 } | |
2050 | |
2051 LOperand* value() { return inputs_[0]; } | |
2052 LOperand* temp() { return temps_[0]; } | |
2053 LOperand* temp2() { return temps_[1]; } | |
2054 | |
2055 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i") | |
2056 DECLARE_HYDROGEN_ACCESSOR(Change) | |
2057 | |
2058 bool truncating() { return hydrogen()->CanTruncateToInt32(); } | |
2059 }; | |
2060 | |
2061 | |
2062 class LSmiTag final : public LTemplateInstruction<1, 1, 0> { | |
2063 public: | |
2064 explicit LSmiTag(LOperand* value) { | |
2065 inputs_[0] = value; | |
2066 } | |
2067 | |
2068 LOperand* value() { return inputs_[0]; } | |
2069 | |
2070 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag") | |
2071 DECLARE_HYDROGEN_ACCESSOR(Change) | |
2072 }; | |
2073 | |
2074 | |
2075 class LNumberUntagD final : public LTemplateInstruction<1, 1, 0> { | |
2076 public: | |
2077 explicit LNumberUntagD(LOperand* value) { | |
2078 inputs_[0] = value; | |
2079 } | |
2080 | |
2081 LOperand* value() { return inputs_[0]; } | |
2082 | |
2083 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") | |
2084 DECLARE_HYDROGEN_ACCESSOR(Change) | |
2085 }; | |
2086 | |
2087 | |
2088 class LSmiUntag final : public LTemplateInstruction<1, 1, 0> { | |
2089 public: | |
2090 LSmiUntag(LOperand* value, bool needs_check) | |
2091 : needs_check_(needs_check) { | |
2092 inputs_[0] = value; | |
2093 } | |
2094 | |
2095 LOperand* value() { return inputs_[0]; } | |
2096 bool needs_check() const { return needs_check_; } | |
2097 | |
2098 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") | |
2099 | |
2100 private: | |
2101 bool needs_check_; | |
2102 }; | |
2103 | |
2104 | |
2105 class LStoreNamedField final : public LTemplateInstruction<0, 2, 1> { | |
2106 public: | |
2107 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) { | |
2108 inputs_[0] = object; | |
2109 inputs_[1] = value; | |
2110 temps_[0] = temp; | |
2111 } | |
2112 | |
2113 LOperand* object() { return inputs_[0]; } | |
2114 LOperand* value() { return inputs_[1]; } | |
2115 LOperand* temp() { return temps_[0]; } | |
2116 | |
2117 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field") | |
2118 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField) | |
2119 | |
2120 void PrintDataTo(StringStream* stream) override; | |
2121 | |
2122 Representation representation() const { | |
2123 return hydrogen()->field_representation(); | |
2124 } | |
2125 }; | |
2126 | |
2127 | |
2128 class LStoreNamedGeneric final : public LTemplateInstruction<0, 3, 2> { | |
2129 public: | |
2130 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value, | |
2131 LOperand* slot, LOperand* vector) { | |
2132 inputs_[0] = context; | |
2133 inputs_[1] = object; | |
2134 inputs_[2] = value; | |
2135 temps_[0] = slot; | |
2136 temps_[1] = vector; | |
2137 } | |
2138 | |
2139 LOperand* context() { return inputs_[0]; } | |
2140 LOperand* object() { return inputs_[1]; } | |
2141 LOperand* value() { return inputs_[2]; } | |
2142 LOperand* temp_slot() { return temps_[0]; } | |
2143 LOperand* temp_vector() { return temps_[1]; } | |
2144 | |
2145 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") | |
2146 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) | |
2147 | |
2148 void PrintDataTo(StringStream* stream) override; | |
2149 | |
2150 Handle<Object> name() const { return hydrogen()->name(); } | |
2151 LanguageMode language_mode() { return hydrogen()->language_mode(); } | |
2152 }; | |
2153 | |
2154 | |
2155 class LStoreGlobalViaContext final : public LTemplateInstruction<0, 2, 0> { | |
2156 public: | |
2157 LStoreGlobalViaContext(LOperand* context, LOperand* value) { | |
2158 inputs_[0] = context; | |
2159 inputs_[1] = value; | |
2160 } | |
2161 | |
2162 LOperand* context() { return inputs_[0]; } | |
2163 LOperand* value() { return inputs_[1]; } | |
2164 | |
2165 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalViaContext, | |
2166 "store-global-via-context") | |
2167 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalViaContext) | |
2168 | |
2169 void PrintDataTo(StringStream* stream) override; | |
2170 | |
2171 int depth() { return hydrogen()->depth(); } | |
2172 int slot_index() { return hydrogen()->slot_index(); } | |
2173 LanguageMode language_mode() { return hydrogen()->language_mode(); } | |
2174 }; | |
2175 | |
2176 | |
2177 class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> { | |
2178 public: | |
2179 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) { | |
2180 inputs_[0] = object; | |
2181 inputs_[1] = key; | |
2182 inputs_[2] = value; | |
2183 } | |
2184 | |
2185 bool is_fixed_typed_array() const { | |
2186 return hydrogen()->is_fixed_typed_array(); | |
2187 } | |
2188 LOperand* elements() { return inputs_[0]; } | |
2189 LOperand* key() { return inputs_[1]; } | |
2190 LOperand* value() { return inputs_[2]; } | |
2191 ElementsKind elements_kind() const { | |
2192 return hydrogen()->elements_kind(); | |
2193 } | |
2194 | |
2195 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed") | |
2196 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed) | |
2197 | |
2198 void PrintDataTo(StringStream* stream) override; | |
2199 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); } | |
2200 uint32_t base_offset() const { return hydrogen()->base_offset(); } | |
2201 }; | |
2202 | |
2203 | |
2204 class LStoreKeyedGeneric final : public LTemplateInstruction<0, 4, 2> { | |
2205 public: | |
2206 LStoreKeyedGeneric(LOperand* context, LOperand* object, LOperand* key, | |
2207 LOperand* value, LOperand* slot, LOperand* vector) { | |
2208 inputs_[0] = context; | |
2209 inputs_[1] = object; | |
2210 inputs_[2] = key; | |
2211 inputs_[3] = value; | |
2212 temps_[0] = slot; | |
2213 temps_[1] = vector; | |
2214 } | |
2215 | |
2216 LOperand* context() { return inputs_[0]; } | |
2217 LOperand* object() { return inputs_[1]; } | |
2218 LOperand* key() { return inputs_[2]; } | |
2219 LOperand* value() { return inputs_[3]; } | |
2220 LOperand* temp_slot() { return temps_[0]; } | |
2221 LOperand* temp_vector() { return temps_[1]; } | |
2222 | |
2223 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") | |
2224 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric) | |
2225 | |
2226 void PrintDataTo(StringStream* stream) override; | |
2227 | |
2228 LanguageMode language_mode() { return hydrogen()->language_mode(); } | |
2229 }; | |
2230 | |
2231 | |
2232 class LTransitionElementsKind final : public LTemplateInstruction<0, 2, 1> { | |
2233 public: | |
2234 LTransitionElementsKind(LOperand* object, | |
2235 LOperand* context, | |
2236 LOperand* new_map_temp) { | |
2237 inputs_[0] = object; | |
2238 inputs_[1] = context; | |
2239 temps_[0] = new_map_temp; | |
2240 } | |
2241 | |
2242 LOperand* context() { return inputs_[1]; } | |
2243 LOperand* object() { return inputs_[0]; } | |
2244 LOperand* new_map_temp() { return temps_[0]; } | |
2245 | |
2246 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind, | |
2247 "transition-elements-kind") | |
2248 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind) | |
2249 | |
2250 void PrintDataTo(StringStream* stream) override; | |
2251 | |
2252 Handle<Map> original_map() { return hydrogen()->original_map().handle(); } | |
2253 Handle<Map> transitioned_map() { | |
2254 return hydrogen()->transitioned_map().handle(); | |
2255 } | |
2256 ElementsKind from_kind() { return hydrogen()->from_kind(); } | |
2257 ElementsKind to_kind() { return hydrogen()->to_kind(); } | |
2258 }; | |
2259 | |
2260 | |
2261 class LTrapAllocationMemento final : public LTemplateInstruction<0, 1, 1> { | |
2262 public: | |
2263 LTrapAllocationMemento(LOperand* object, | |
2264 LOperand* temp) { | |
2265 inputs_[0] = object; | |
2266 temps_[0] = temp; | |
2267 } | |
2268 | |
2269 LOperand* object() { return inputs_[0]; } | |
2270 LOperand* temp() { return temps_[0]; } | |
2271 | |
2272 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento, | |
2273 "trap-allocation-memento") | |
2274 }; | |
2275 | |
2276 | |
2277 class LMaybeGrowElements final : public LTemplateInstruction<1, 5, 0> { | |
2278 public: | |
2279 LMaybeGrowElements(LOperand* context, LOperand* object, LOperand* elements, | |
2280 LOperand* key, LOperand* current_capacity) { | |
2281 inputs_[0] = context; | |
2282 inputs_[1] = object; | |
2283 inputs_[2] = elements; | |
2284 inputs_[3] = key; | |
2285 inputs_[4] = current_capacity; | |
2286 } | |
2287 | |
2288 LOperand* context() { return inputs_[0]; } | |
2289 LOperand* object() { return inputs_[1]; } | |
2290 LOperand* elements() { return inputs_[2]; } | |
2291 LOperand* key() { return inputs_[3]; } | |
2292 LOperand* current_capacity() { return inputs_[4]; } | |
2293 | |
2294 DECLARE_HYDROGEN_ACCESSOR(MaybeGrowElements) | |
2295 DECLARE_CONCRETE_INSTRUCTION(MaybeGrowElements, "maybe-grow-elements") | |
2296 }; | |
2297 | |
2298 | |
2299 class LStringAdd final : public LTemplateInstruction<1, 3, 0> { | |
2300 public: | |
2301 LStringAdd(LOperand* context, LOperand* left, LOperand* right) { | |
2302 inputs_[0] = context; | |
2303 inputs_[1] = left; | |
2304 inputs_[2] = right; | |
2305 } | |
2306 | |
2307 LOperand* context() { return inputs_[0]; } | |
2308 LOperand* left() { return inputs_[1]; } | |
2309 LOperand* right() { return inputs_[2]; } | |
2310 | |
2311 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add") | |
2312 DECLARE_HYDROGEN_ACCESSOR(StringAdd) | |
2313 }; | |
2314 | |
2315 | |
2316 class LStringCharCodeAt final : public LTemplateInstruction<1, 3, 0> { | |
2317 public: | |
2318 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) { | |
2319 inputs_[0] = context; | |
2320 inputs_[1] = string; | |
2321 inputs_[2] = index; | |
2322 } | |
2323 | |
2324 LOperand* context() { return inputs_[0]; } | |
2325 LOperand* string() { return inputs_[1]; } | |
2326 LOperand* index() { return inputs_[2]; } | |
2327 | |
2328 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at") | |
2329 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt) | |
2330 }; | |
2331 | |
2332 | |
2333 class LStringCharFromCode final : public LTemplateInstruction<1, 2, 0> { | |
2334 public: | |
2335 explicit LStringCharFromCode(LOperand* context, LOperand* char_code) { | |
2336 inputs_[0] = context; | |
2337 inputs_[1] = char_code; | |
2338 } | |
2339 | |
2340 LOperand* context() { return inputs_[0]; } | |
2341 LOperand* char_code() { return inputs_[1]; } | |
2342 | |
2343 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code") | |
2344 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode) | |
2345 }; | |
2346 | |
2347 | |
2348 class LCheckValue final : public LTemplateInstruction<0, 1, 0> { | |
2349 public: | |
2350 explicit LCheckValue(LOperand* value) { | |
2351 inputs_[0] = value; | |
2352 } | |
2353 | |
2354 LOperand* value() { return inputs_[0]; } | |
2355 | |
2356 DECLARE_CONCRETE_INSTRUCTION(CheckValue, "check-value") | |
2357 DECLARE_HYDROGEN_ACCESSOR(CheckValue) | |
2358 }; | |
2359 | |
2360 | |
2361 class LCheckArrayBufferNotNeutered final | |
2362 : public LTemplateInstruction<0, 1, 0> { | |
2363 public: | |
2364 explicit LCheckArrayBufferNotNeutered(LOperand* view) { inputs_[0] = view; } | |
2365 | |
2366 LOperand* view() { return inputs_[0]; } | |
2367 | |
2368 DECLARE_CONCRETE_INSTRUCTION(CheckArrayBufferNotNeutered, | |
2369 "check-array-buffer-not-neutered") | |
2370 DECLARE_HYDROGEN_ACCESSOR(CheckArrayBufferNotNeutered) | |
2371 }; | |
2372 | |
2373 | |
2374 class LCheckInstanceType final : public LTemplateInstruction<0, 1, 0> { | |
2375 public: | |
2376 explicit LCheckInstanceType(LOperand* value) { | |
2377 inputs_[0] = value; | |
2378 } | |
2379 | |
2380 LOperand* value() { return inputs_[0]; } | |
2381 | |
2382 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") | |
2383 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) | |
2384 }; | |
2385 | |
2386 | |
2387 class LCheckMaps final : public LTemplateInstruction<0, 1, 0> { | |
2388 public: | |
2389 explicit LCheckMaps(LOperand* value = NULL) { | |
2390 inputs_[0] = value; | |
2391 } | |
2392 | |
2393 LOperand* value() { return inputs_[0]; } | |
2394 | |
2395 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps") | |
2396 DECLARE_HYDROGEN_ACCESSOR(CheckMaps) | |
2397 }; | |
2398 | |
2399 | |
2400 class LCheckSmi final : public LTemplateInstruction<1, 1, 0> { | |
2401 public: | |
2402 explicit LCheckSmi(LOperand* value) { | |
2403 inputs_[0] = value; | |
2404 } | |
2405 | |
2406 LOperand* value() { return inputs_[0]; } | |
2407 | |
2408 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi") | |
2409 }; | |
2410 | |
2411 | |
2412 class LCheckNonSmi final : public LTemplateInstruction<0, 1, 0> { | |
2413 public: | |
2414 explicit LCheckNonSmi(LOperand* value) { | |
2415 inputs_[0] = value; | |
2416 } | |
2417 | |
2418 LOperand* value() { return inputs_[0]; } | |
2419 | |
2420 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") | |
2421 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) | |
2422 }; | |
2423 | |
2424 | |
2425 class LClampDToUint8 final : public LTemplateInstruction<1, 1, 1> { | |
2426 public: | |
2427 LClampDToUint8(LOperand* unclamped, LOperand* temp) { | |
2428 inputs_[0] = unclamped; | |
2429 temps_[0] = temp; | |
2430 } | |
2431 | |
2432 LOperand* unclamped() { return inputs_[0]; } | |
2433 LOperand* temp() { return temps_[0]; } | |
2434 | |
2435 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8") | |
2436 }; | |
2437 | |
2438 | |
2439 class LClampIToUint8 final : public LTemplateInstruction<1, 1, 0> { | |
2440 public: | |
2441 explicit LClampIToUint8(LOperand* unclamped) { | |
2442 inputs_[0] = unclamped; | |
2443 } | |
2444 | |
2445 LOperand* unclamped() { return inputs_[0]; } | |
2446 | |
2447 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8") | |
2448 }; | |
2449 | |
2450 | |
2451 class LClampTToUint8 final : public LTemplateInstruction<1, 1, 1> { | |
2452 public: | |
2453 LClampTToUint8(LOperand* unclamped, LOperand* temp) { | |
2454 inputs_[0] = unclamped; | |
2455 temps_[0] = temp; | |
2456 } | |
2457 | |
2458 LOperand* unclamped() { return inputs_[0]; } | |
2459 LOperand* temp() { return temps_[0]; } | |
2460 | |
2461 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8") | |
2462 }; | |
2463 | |
2464 | |
2465 class LDoubleBits final : public LTemplateInstruction<1, 1, 0> { | |
2466 public: | |
2467 explicit LDoubleBits(LOperand* value) { | |
2468 inputs_[0] = value; | |
2469 } | |
2470 | |
2471 LOperand* value() { return inputs_[0]; } | |
2472 | |
2473 DECLARE_CONCRETE_INSTRUCTION(DoubleBits, "double-bits") | |
2474 DECLARE_HYDROGEN_ACCESSOR(DoubleBits) | |
2475 }; | |
2476 | |
2477 | |
2478 class LConstructDouble final : public LTemplateInstruction<1, 2, 0> { | |
2479 public: | |
2480 LConstructDouble(LOperand* hi, LOperand* lo) { | |
2481 inputs_[0] = hi; | |
2482 inputs_[1] = lo; | |
2483 } | |
2484 | |
2485 LOperand* hi() { return inputs_[0]; } | |
2486 LOperand* lo() { return inputs_[1]; } | |
2487 | |
2488 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble, "construct-double") | |
2489 }; | |
2490 | |
2491 | |
2492 class LAllocate final : public LTemplateInstruction<1, 2, 2> { | |
2493 public: | |
2494 LAllocate(LOperand* context, | |
2495 LOperand* size, | |
2496 LOperand* temp1, | |
2497 LOperand* temp2) { | |
2498 inputs_[0] = context; | |
2499 inputs_[1] = size; | |
2500 temps_[0] = temp1; | |
2501 temps_[1] = temp2; | |
2502 } | |
2503 | |
2504 LOperand* context() { return inputs_[0]; } | |
2505 LOperand* size() { return inputs_[1]; } | |
2506 LOperand* temp1() { return temps_[0]; } | |
2507 LOperand* temp2() { return temps_[1]; } | |
2508 | |
2509 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate") | |
2510 DECLARE_HYDROGEN_ACCESSOR(Allocate) | |
2511 }; | |
2512 | |
2513 | |
2514 class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> { | |
2515 public: | |
2516 explicit LRegExpLiteral(LOperand* context) { | |
2517 inputs_[0] = context; | |
2518 } | |
2519 | |
2520 LOperand* context() { return inputs_[0]; } | |
2521 | |
2522 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal") | |
2523 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral) | |
2524 }; | |
2525 | |
2526 | |
2527 class LToFastProperties final : public LTemplateInstruction<1, 1, 0> { | |
2528 public: | |
2529 explicit LToFastProperties(LOperand* value) { | |
2530 inputs_[0] = value; | |
2531 } | |
2532 | |
2533 LOperand* value() { return inputs_[0]; } | |
2534 | |
2535 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties") | |
2536 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties) | |
2537 }; | |
2538 | |
2539 | |
2540 class LTypeof final : public LTemplateInstruction<1, 2, 0> { | |
2541 public: | |
2542 LTypeof(LOperand* context, LOperand* value) { | |
2543 inputs_[0] = context; | |
2544 inputs_[1] = value; | |
2545 } | |
2546 | |
2547 LOperand* context() { return inputs_[0]; } | |
2548 LOperand* value() { return inputs_[1]; } | |
2549 | |
2550 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") | |
2551 }; | |
2552 | |
2553 | |
2554 class LTypeofIsAndBranch final : public LControlInstruction<1, 0> { | |
2555 public: | |
2556 explicit LTypeofIsAndBranch(LOperand* value) { | |
2557 inputs_[0] = value; | |
2558 } | |
2559 | |
2560 LOperand* value() { return inputs_[0]; } | |
2561 | |
2562 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") | |
2563 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch) | |
2564 | |
2565 Handle<String> type_literal() { return hydrogen()->type_literal(); } | |
2566 | |
2567 void PrintDataTo(StringStream* stream) override; | |
2568 }; | |
2569 | |
2570 | |
2571 class LIsConstructCallAndBranch final : public LControlInstruction<0, 1> { | |
2572 public: | |
2573 explicit LIsConstructCallAndBranch(LOperand* temp) { | |
2574 temps_[0] = temp; | |
2575 } | |
2576 | |
2577 LOperand* temp() { return temps_[0]; } | |
2578 | |
2579 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch, | |
2580 "is-construct-call-and-branch") | |
2581 }; | |
2582 | |
2583 | |
2584 class LOsrEntry final : public LTemplateInstruction<0, 0, 0> { | |
2585 public: | |
2586 LOsrEntry() {} | |
2587 | |
2588 bool HasInterestingComment(LCodeGen* gen) const override { return false; } | |
2589 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") | |
2590 }; | |
2591 | |
2592 | |
2593 class LStackCheck final : public LTemplateInstruction<0, 1, 0> { | |
2594 public: | |
2595 explicit LStackCheck(LOperand* context) { | |
2596 inputs_[0] = context; | |
2597 } | |
2598 | |
2599 LOperand* context() { return inputs_[0]; } | |
2600 | |
2601 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") | |
2602 DECLARE_HYDROGEN_ACCESSOR(StackCheck) | |
2603 | |
2604 Label* done_label() { return &done_label_; } | |
2605 | |
2606 private: | |
2607 Label done_label_; | |
2608 }; | |
2609 | |
2610 | |
2611 class LForInPrepareMap final : public LTemplateInstruction<1, 2, 0> { | |
2612 public: | |
2613 LForInPrepareMap(LOperand* context, LOperand* object) { | |
2614 inputs_[0] = context; | |
2615 inputs_[1] = object; | |
2616 } | |
2617 | |
2618 LOperand* context() { return inputs_[0]; } | |
2619 LOperand* object() { return inputs_[1]; } | |
2620 | |
2621 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map") | |
2622 }; | |
2623 | |
2624 | |
2625 class LForInCacheArray final : public LTemplateInstruction<1, 1, 0> { | |
2626 public: | |
2627 explicit LForInCacheArray(LOperand* map) { | |
2628 inputs_[0] = map; | |
2629 } | |
2630 | |
2631 LOperand* map() { return inputs_[0]; } | |
2632 | |
2633 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array") | |
2634 | |
2635 int idx() { | |
2636 return HForInCacheArray::cast(this->hydrogen_value())->idx(); | |
2637 } | |
2638 }; | |
2639 | |
2640 | |
2641 class LCheckMapValue final : public LTemplateInstruction<0, 2, 0> { | |
2642 public: | |
2643 LCheckMapValue(LOperand* value, LOperand* map) { | |
2644 inputs_[0] = value; | |
2645 inputs_[1] = map; | |
2646 } | |
2647 | |
2648 LOperand* value() { return inputs_[0]; } | |
2649 LOperand* map() { return inputs_[1]; } | |
2650 | |
2651 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value") | |
2652 }; | |
2653 | |
2654 | |
2655 class LLoadFieldByIndex final : public LTemplateInstruction<1, 2, 0> { | |
2656 public: | |
2657 LLoadFieldByIndex(LOperand* object, LOperand* index) { | |
2658 inputs_[0] = object; | |
2659 inputs_[1] = index; | |
2660 } | |
2661 | |
2662 LOperand* object() { return inputs_[0]; } | |
2663 LOperand* index() { return inputs_[1]; } | |
2664 | |
2665 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") | |
2666 }; | |
2667 | |
2668 | |
2669 class LStoreFrameContext: public LTemplateInstruction<0, 1, 0> { | |
2670 public: | |
2671 explicit LStoreFrameContext(LOperand* context) { | |
2672 inputs_[0] = context; | |
2673 } | |
2674 | |
2675 LOperand* context() { return inputs_[0]; } | |
2676 | |
2677 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext, "store-frame-context") | |
2678 }; | |
2679 | |
2680 | |
2681 class LAllocateBlockContext: public LTemplateInstruction<1, 2, 0> { | |
2682 public: | |
2683 LAllocateBlockContext(LOperand* context, LOperand* function) { | |
2684 inputs_[0] = context; | |
2685 inputs_[1] = function; | |
2686 } | |
2687 | |
2688 LOperand* context() { return inputs_[0]; } | |
2689 LOperand* function() { return inputs_[1]; } | |
2690 | |
2691 Handle<ScopeInfo> scope_info() { return hydrogen()->scope_info(); } | |
2692 | |
2693 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext, "allocate-block-context") | |
2694 DECLARE_HYDROGEN_ACCESSOR(AllocateBlockContext) | |
2695 }; | |
2696 | |
2697 | |
2698 class LChunkBuilder; | |
2699 class LPlatformChunk final : public LChunk { | |
2700 public: | |
2701 LPlatformChunk(CompilationInfo* info, HGraph* graph) | |
2702 : LChunk(info, graph) { } | |
2703 | |
2704 int GetNextSpillIndex(RegisterKind kind); | |
2705 LOperand* GetNextSpillSlot(RegisterKind kind); | |
2706 }; | |
2707 | |
2708 | |
2709 class LChunkBuilder final : public LChunkBuilderBase { | |
2710 public: | |
2711 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) | |
2712 : LChunkBuilderBase(info, graph), | |
2713 current_instruction_(NULL), | |
2714 current_block_(NULL), | |
2715 next_block_(NULL), | |
2716 allocator_(allocator) {} | |
2717 | |
2718 // Build the sequence for the graph. | |
2719 LPlatformChunk* Build(); | |
2720 | |
2721 // Declare methods that deal with the individual node types. | |
2722 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); | |
2723 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) | |
2724 #undef DECLARE_DO | |
2725 | |
2726 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend); | |
2727 | |
2728 static bool HasMagicNumberForDivisor(int32_t divisor); | |
2729 | |
2730 LInstruction* DoMathFloor(HUnaryMathOperation* instr); | |
2731 LInstruction* DoMathRound(HUnaryMathOperation* instr); | |
2732 LInstruction* DoMathFround(HUnaryMathOperation* instr); | |
2733 LInstruction* DoMathAbs(HUnaryMathOperation* instr); | |
2734 LInstruction* DoMathLog(HUnaryMathOperation* instr); | |
2735 LInstruction* DoMathExp(HUnaryMathOperation* instr); | |
2736 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); | |
2737 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); | |
2738 LInstruction* DoMathClz32(HUnaryMathOperation* instr); | |
2739 LInstruction* DoDivByPowerOf2I(HDiv* instr); | |
2740 LInstruction* DoDivByConstI(HDiv* instr); | |
2741 LInstruction* DoDivI(HDiv* instr); | |
2742 LInstruction* DoModByPowerOf2I(HMod* instr); | |
2743 LInstruction* DoModByConstI(HMod* instr); | |
2744 LInstruction* DoModI(HMod* instr); | |
2745 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr); | |
2746 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr); | |
2747 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr); | |
2748 | |
2749 private: | |
2750 // Methods for getting operands for Use / Define / Temp. | |
2751 LUnallocated* ToUnallocated(Register reg); | |
2752 LUnallocated* ToUnallocated(DoubleRegister reg); | |
2753 | |
2754 // Methods for setting up define-use relationships. | |
2755 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); | |
2756 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); | |
2757 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, | |
2758 DoubleRegister fixed_register); | |
2759 | |
2760 // A value that is guaranteed to be allocated to a register. | |
2761 // Operand created by UseRegister is guaranteed to be live until the end of | |
2762 // instruction. This means that register allocator will not reuse it's | |
2763 // register for any other operand inside instruction. | |
2764 // Operand created by UseRegisterAtStart is guaranteed to be live only at | |
2765 // instruction start. Register allocator is free to assign the same register | |
2766 // to some other operand used inside instruction (i.e. temporary or | |
2767 // output). | |
2768 MUST_USE_RESULT LOperand* UseRegister(HValue* value); | |
2769 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value); | |
2770 | |
2771 // An input operand in a register that may be trashed. | |
2772 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value); | |
2773 | |
2774 // An input operand in a register or stack slot. | |
2775 MUST_USE_RESULT LOperand* Use(HValue* value); | |
2776 MUST_USE_RESULT LOperand* UseAtStart(HValue* value); | |
2777 | |
2778 // An input operand in a register, stack slot or a constant operand. | |
2779 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value); | |
2780 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value); | |
2781 | |
2782 // An input operand in a register or a constant operand. | |
2783 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value); | |
2784 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value); | |
2785 | |
2786 // An input operand in a constant operand. | |
2787 MUST_USE_RESULT LOperand* UseConstant(HValue* value); | |
2788 | |
2789 // An input operand in register, stack slot or a constant operand. | |
2790 // Will not be moved to a register even if one is freely available. | |
2791 MUST_USE_RESULT LOperand* UseAny(HValue* value) override; | |
2792 | |
2793 // Temporary operand that must be in a register. | |
2794 MUST_USE_RESULT LUnallocated* TempRegister(); | |
2795 MUST_USE_RESULT LUnallocated* TempDoubleRegister(); | |
2796 MUST_USE_RESULT LOperand* FixedTemp(Register reg); | |
2797 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg); | |
2798 | |
2799 // Methods for setting up define-use relationships. | |
2800 // Return the same instruction that they are passed. | |
2801 LInstruction* Define(LTemplateResultInstruction<1>* instr, | |
2802 LUnallocated* result); | |
2803 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr); | |
2804 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr, | |
2805 int index); | |
2806 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr); | |
2807 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr, | |
2808 Register reg); | |
2809 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr, | |
2810 DoubleRegister reg); | |
2811 LInstruction* AssignEnvironment(LInstruction* instr); | |
2812 LInstruction* AssignPointerMap(LInstruction* instr); | |
2813 | |
2814 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; | |
2815 | |
2816 // By default we assume that instruction sequences generated for calls | |
2817 // cannot deoptimize eagerly and we do not attach environment to this | |
2818 // instruction. | |
2819 LInstruction* MarkAsCall( | |
2820 LInstruction* instr, | |
2821 HInstruction* hinstr, | |
2822 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); | |
2823 | |
2824 void VisitInstruction(HInstruction* current); | |
2825 void AddInstruction(LInstruction* instr, HInstruction* current); | |
2826 | |
2827 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); | |
2828 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); | |
2829 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); | |
2830 LInstruction* DoArithmeticD(Token::Value op, | |
2831 HArithmeticBinaryOperation* instr); | |
2832 LInstruction* DoArithmeticT(Token::Value op, | |
2833 HBinaryOperation* instr); | |
2834 | |
2835 HInstruction* current_instruction_; | |
2836 HBasicBlock* current_block_; | |
2837 HBasicBlock* next_block_; | |
2838 LAllocator* allocator_; | |
2839 | |
2840 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | |
2841 }; | |
2842 | |
2843 #undef DECLARE_HYDROGEN_ACCESSOR | |
2844 #undef DECLARE_CONCRETE_INSTRUCTION | |
2845 | |
2846 } // namespace internal | |
2847 } // namespace v8 | |
2848 | |
2849 #endif // V8_MIPS_LITHIUM_MIPS_H_ | |
OLD | NEW |