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

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

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

Powered by Google App Engine
This is Rietveld 408576698