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

Side by Side Diff: src/arm/lithium-arm.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 | « BUILD.gn ('k') | src/arm/lithium-arm.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_ARM_LITHIUM_ARM_H_
6 #define V8_ARM_LITHIUM_ARM_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(CheckNonSmi) \
43 V(CheckMaps) \
44 V(CheckMapValue) \
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(DoubleBits) \
72 V(DoubleToI) \
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(MathClz32) \
111 V(MathExp) \
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(MultiplySubD) \
126 V(NumberTagD) \
127 V(NumberTagI) \
128 V(NumberTagU) \
129 V(NumberUntagD) \
130 V(OsrEntry) \
131 V(Parameter) \
132 V(Power) \
133 V(Prologue) \
134 V(PushArgument) \
135 V(RegExpLiteral) \
136 V(Return) \
137 V(SeqStringGetChar) \
138 V(SeqStringSetChar) \
139 V(ShiftI) \
140 V(SmiTag) \
141 V(SmiUntag) \
142 V(StackCheck) \
143 V(StoreCodeEntry) \
144 V(StoreContextSlot) \
145 V(StoreFrameContext) \
146 V(StoreGlobalViaContext) \
147 V(StoreKeyed) \
148 V(StoreKeyedGeneric) \
149 V(StoreNamedField) \
150 V(StoreNamedGeneric) \
151 V(StringAdd) \
152 V(StringCharCodeAt) \
153 V(StringCharFromCode) \
154 V(StringCompareAndBranch) \
155 V(SubI) \
156 V(RSubI) \
157 V(TaggedToI) \
158 V(ThisFunction) \
159 V(ToFastProperties) \
160 V(TransitionElementsKind) \
161 V(TrapAllocationMemento) \
162 V(Typeof) \
163 V(TypeofIsAndBranch) \
164 V(Uint32ToDouble) \
165 V(UnknownOSRValue) \
166 V(WrapReceiver)
167
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 support.
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 override { 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, 2> {
643 public:
644 LModI(LOperand* left, LOperand* right, LOperand* temp, LOperand* temp2) {
645 inputs_[0] = left;
646 inputs_[1] = right;
647 temps_[0] = temp;
648 temps_[1] = temp2;
649 }
650
651 LOperand* left() { return inputs_[0]; }
652 LOperand* right() { return inputs_[1]; }
653 LOperand* temp() { return temps_[0]; }
654 LOperand* temp2() { return temps_[1]; }
655
656 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
657 DECLARE_HYDROGEN_ACCESSOR(Mod)
658 };
659
660
661 class LDivByPowerOf2I final : public LTemplateInstruction<1, 1, 0> {
662 public:
663 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
664 inputs_[0] = dividend;
665 divisor_ = divisor;
666 }
667
668 LOperand* dividend() { return inputs_[0]; }
669 int32_t divisor() const { return divisor_; }
670
671 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
672 DECLARE_HYDROGEN_ACCESSOR(Div)
673
674 private:
675 int32_t divisor_;
676 };
677
678
679 class LDivByConstI final : public LTemplateInstruction<1, 1, 0> {
680 public:
681 LDivByConstI(LOperand* dividend, int32_t divisor) {
682 inputs_[0] = dividend;
683 divisor_ = divisor;
684 }
685
686 LOperand* dividend() { return inputs_[0]; }
687 int32_t divisor() const { return divisor_; }
688
689 DECLARE_CONCRETE_INSTRUCTION(DivByConstI, "div-by-const-i")
690 DECLARE_HYDROGEN_ACCESSOR(Div)
691
692 private:
693 int32_t divisor_;
694 };
695
696
697 class LDivI final : public LTemplateInstruction<1, 2, 1> {
698 public:
699 LDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
700 inputs_[0] = dividend;
701 inputs_[1] = divisor;
702 temps_[0] = temp;
703 }
704
705 LOperand* dividend() { return inputs_[0]; }
706 LOperand* divisor() { return inputs_[1]; }
707 LOperand* temp() { return temps_[0]; }
708
709 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
710 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
711 };
712
713
714 class LFlooringDivByPowerOf2I final : public LTemplateInstruction<1, 1, 0> {
715 public:
716 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
717 inputs_[0] = dividend;
718 divisor_ = divisor;
719 }
720
721 LOperand* dividend() { return inputs_[0]; }
722 int32_t divisor() { return divisor_; }
723
724 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
725 "flooring-div-by-power-of-2-i")
726 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
727
728 private:
729 int32_t divisor_;
730 };
731
732
733 class LFlooringDivByConstI final : public LTemplateInstruction<1, 1, 2> {
734 public:
735 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) {
736 inputs_[0] = dividend;
737 divisor_ = divisor;
738 temps_[0] = temp;
739 }
740
741 LOperand* dividend() { return inputs_[0]; }
742 int32_t divisor() const { return divisor_; }
743 LOperand* temp() { return temps_[0]; }
744
745 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
746 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
747
748 private:
749 int32_t divisor_;
750 };
751
752
753 class LFlooringDivI final : public LTemplateInstruction<1, 2, 1> {
754 public:
755 LFlooringDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
756 inputs_[0] = dividend;
757 inputs_[1] = divisor;
758 temps_[0] = temp;
759 }
760
761 LOperand* dividend() { return inputs_[0]; }
762 LOperand* divisor() { return inputs_[1]; }
763 LOperand* temp() { return temps_[0]; }
764
765 DECLARE_CONCRETE_INSTRUCTION(FlooringDivI, "flooring-div-i")
766 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
767 };
768
769
770 class LMulI final : public LTemplateInstruction<1, 2, 0> {
771 public:
772 LMulI(LOperand* left, LOperand* right) {
773 inputs_[0] = left;
774 inputs_[1] = right;
775 }
776
777 LOperand* left() { return inputs_[0]; }
778 LOperand* right() { return inputs_[1]; }
779
780 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
781 DECLARE_HYDROGEN_ACCESSOR(Mul)
782 };
783
784
785 // Instruction for computing multiplier * multiplicand + addend.
786 class LMultiplyAddD final : public LTemplateInstruction<1, 3, 0> {
787 public:
788 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
789 LOperand* multiplicand) {
790 inputs_[0] = addend;
791 inputs_[1] = multiplier;
792 inputs_[2] = multiplicand;
793 }
794
795 LOperand* addend() { return inputs_[0]; }
796 LOperand* multiplier() { return inputs_[1]; }
797 LOperand* multiplicand() { return inputs_[2]; }
798
799 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
800 };
801
802
803 // Instruction for computing minuend - multiplier * multiplicand.
804 class LMultiplySubD final : public LTemplateInstruction<1, 3, 0> {
805 public:
806 LMultiplySubD(LOperand* minuend, LOperand* multiplier,
807 LOperand* multiplicand) {
808 inputs_[0] = minuend;
809 inputs_[1] = multiplier;
810 inputs_[2] = multiplicand;
811 }
812
813 LOperand* minuend() { return inputs_[0]; }
814 LOperand* multiplier() { return inputs_[1]; }
815 LOperand* multiplicand() { return inputs_[2]; }
816
817 DECLARE_CONCRETE_INSTRUCTION(MultiplySubD, "multiply-sub-d")
818 };
819
820
821 class LDebugBreak final : public LTemplateInstruction<0, 0, 0> {
822 public:
823 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
824 };
825
826
827 class LCompareNumericAndBranch final : public LControlInstruction<2, 0> {
828 public:
829 LCompareNumericAndBranch(LOperand* left, LOperand* right) {
830 inputs_[0] = left;
831 inputs_[1] = right;
832 }
833
834 LOperand* left() { return inputs_[0]; }
835 LOperand* right() { return inputs_[1]; }
836
837 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch,
838 "compare-numeric-and-branch")
839 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch)
840
841 Token::Value op() const { return hydrogen()->token(); }
842 bool is_double() const {
843 return hydrogen()->representation().IsDouble();
844 }
845
846 void PrintDataTo(StringStream* stream) override;
847 };
848
849
850 class LMathFloor final : public LTemplateInstruction<1, 1, 0> {
851 public:
852 explicit LMathFloor(LOperand* value) {
853 inputs_[0] = value;
854 }
855
856 LOperand* value() { return inputs_[0]; }
857
858 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
859 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
860 };
861
862
863 class LMathRound final : public LTemplateInstruction<1, 1, 1> {
864 public:
865 LMathRound(LOperand* value, LOperand* temp) {
866 inputs_[0] = value;
867 temps_[0] = temp;
868 }
869
870 LOperand* value() { return inputs_[0]; }
871 LOperand* temp() { return temps_[0]; }
872
873 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
874 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
875 };
876
877
878 class LMathFround final : public LTemplateInstruction<1, 1, 0> {
879 public:
880 explicit LMathFround(LOperand* value) { inputs_[0] = value; }
881
882 LOperand* value() { return inputs_[0]; }
883
884 DECLARE_CONCRETE_INSTRUCTION(MathFround, "math-fround")
885 };
886
887
888 class LMathAbs final : public LTemplateInstruction<1, 2, 0> {
889 public:
890 LMathAbs(LOperand* context, LOperand* value) {
891 inputs_[1] = context;
892 inputs_[0] = value;
893 }
894
895 LOperand* context() { return inputs_[1]; }
896 LOperand* value() { return inputs_[0]; }
897
898 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
899 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
900 };
901
902
903 class LMathLog final : public LTemplateInstruction<1, 1, 0> {
904 public:
905 explicit LMathLog(LOperand* value) {
906 inputs_[0] = value;
907 }
908
909 LOperand* value() { return inputs_[0]; }
910
911 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
912 };
913
914
915 class LMathClz32 final : public LTemplateInstruction<1, 1, 0> {
916 public:
917 explicit LMathClz32(LOperand* value) {
918 inputs_[0] = value;
919 }
920
921 LOperand* value() { return inputs_[0]; }
922
923 DECLARE_CONCRETE_INSTRUCTION(MathClz32, "math-clz32")
924 };
925
926
927 class LMathExp final : public LTemplateInstruction<1, 1, 3> {
928 public:
929 LMathExp(LOperand* value,
930 LOperand* double_temp,
931 LOperand* temp1,
932 LOperand* temp2) {
933 inputs_[0] = value;
934 temps_[0] = temp1;
935 temps_[1] = temp2;
936 temps_[2] = double_temp;
937 ExternalReference::InitializeMathExpData();
938 }
939
940 LOperand* value() { return inputs_[0]; }
941 LOperand* temp1() { return temps_[0]; }
942 LOperand* temp2() { return temps_[1]; }
943 LOperand* double_temp() { return temps_[2]; }
944
945 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
946 };
947
948
949 class LMathSqrt final : public LTemplateInstruction<1, 1, 0> {
950 public:
951 explicit LMathSqrt(LOperand* value) {
952 inputs_[0] = value;
953 }
954
955 LOperand* value() { return inputs_[0]; }
956
957 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
958 };
959
960
961 class LMathPowHalf final : public LTemplateInstruction<1, 1, 0> {
962 public:
963 explicit LMathPowHalf(LOperand* value) {
964 inputs_[0] = value;
965 }
966
967 LOperand* value() { return inputs_[0]; }
968
969 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
970 };
971
972
973 class LCmpObjectEqAndBranch final : public LControlInstruction<2, 0> {
974 public:
975 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
976 inputs_[0] = left;
977 inputs_[1] = right;
978 }
979
980 LOperand* left() { return inputs_[0]; }
981 LOperand* right() { return inputs_[1]; }
982
983 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch, "cmp-object-eq-and-branch")
984 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
985 };
986
987
988 class LCmpHoleAndBranch final : public LControlInstruction<1, 0> {
989 public:
990 explicit LCmpHoleAndBranch(LOperand* object) {
991 inputs_[0] = object;
992 }
993
994 LOperand* object() { return inputs_[0]; }
995
996 DECLARE_CONCRETE_INSTRUCTION(CmpHoleAndBranch, "cmp-hole-and-branch")
997 DECLARE_HYDROGEN_ACCESSOR(CompareHoleAndBranch)
998 };
999
1000
1001 class LCompareMinusZeroAndBranch final : public LControlInstruction<1, 1> {
1002 public:
1003 LCompareMinusZeroAndBranch(LOperand* value, LOperand* temp) {
1004 inputs_[0] = value;
1005 temps_[0] = temp;
1006 }
1007
1008 LOperand* value() { return inputs_[0]; }
1009 LOperand* temp() { return temps_[0]; }
1010
1011 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch,
1012 "cmp-minus-zero-and-branch")
1013 DECLARE_HYDROGEN_ACCESSOR(CompareMinusZeroAndBranch)
1014 };
1015
1016
1017 class LIsStringAndBranch final : public LControlInstruction<1, 1> {
1018 public:
1019 LIsStringAndBranch(LOperand* value, LOperand* temp) {
1020 inputs_[0] = value;
1021 temps_[0] = temp;
1022 }
1023
1024 LOperand* value() { return inputs_[0]; }
1025 LOperand* temp() { return temps_[0]; }
1026
1027 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
1028 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
1029
1030 void PrintDataTo(StringStream* stream) override;
1031 };
1032
1033
1034 class LIsSmiAndBranch final : public LControlInstruction<1, 0> {
1035 public:
1036 explicit LIsSmiAndBranch(LOperand* value) {
1037 inputs_[0] = value;
1038 }
1039
1040 LOperand* value() { return inputs_[0]; }
1041
1042 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
1043 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
1044
1045 void PrintDataTo(StringStream* stream) override;
1046 };
1047
1048
1049 class LIsUndetectableAndBranch final : public LControlInstruction<1, 1> {
1050 public:
1051 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
1052 inputs_[0] = value;
1053 temps_[0] = temp;
1054 }
1055
1056 LOperand* value() { return inputs_[0]; }
1057 LOperand* temp() { return temps_[0]; }
1058
1059 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
1060 "is-undetectable-and-branch")
1061 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
1062
1063 void PrintDataTo(StringStream* stream) override;
1064 };
1065
1066
1067 class LStringCompareAndBranch final : public LControlInstruction<3, 0> {
1068 public:
1069 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) {
1070 inputs_[0] = context;
1071 inputs_[1] = left;
1072 inputs_[2] = right;
1073 }
1074
1075 LOperand* context() { return inputs_[0]; }
1076 LOperand* left() { return inputs_[1]; }
1077 LOperand* right() { return inputs_[2]; }
1078
1079 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
1080 "string-compare-and-branch")
1081 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
1082
1083 Token::Value op() const { return hydrogen()->token(); }
1084
1085 void PrintDataTo(StringStream* stream) override;
1086 };
1087
1088
1089 class LHasInstanceTypeAndBranch final : public LControlInstruction<1, 0> {
1090 public:
1091 explicit LHasInstanceTypeAndBranch(LOperand* value) {
1092 inputs_[0] = value;
1093 }
1094
1095 LOperand* value() { return inputs_[0]; }
1096
1097 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
1098 "has-instance-type-and-branch")
1099 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
1100
1101 void PrintDataTo(StringStream* stream) override;
1102 };
1103
1104
1105 class LGetCachedArrayIndex final : public LTemplateInstruction<1, 1, 0> {
1106 public:
1107 explicit LGetCachedArrayIndex(LOperand* value) {
1108 inputs_[0] = value;
1109 }
1110
1111 LOperand* value() { return inputs_[0]; }
1112
1113 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
1114 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
1115 };
1116
1117
1118 class LHasCachedArrayIndexAndBranch final : public LControlInstruction<1, 0> {
1119 public:
1120 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
1121 inputs_[0] = value;
1122 }
1123
1124 LOperand* value() { return inputs_[0]; }
1125
1126 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
1127 "has-cached-array-index-and-branch")
1128 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
1129
1130 void PrintDataTo(StringStream* stream) override;
1131 };
1132
1133
1134 class LClassOfTestAndBranch final : public LControlInstruction<1, 1> {
1135 public:
1136 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
1137 inputs_[0] = value;
1138 temps_[0] = temp;
1139 }
1140
1141 LOperand* value() { return inputs_[0]; }
1142 LOperand* temp() { return temps_[0]; }
1143
1144 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1145 "class-of-test-and-branch")
1146 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1147
1148 void PrintDataTo(StringStream* stream) override;
1149 };
1150
1151
1152 class LCmpT final : public LTemplateInstruction<1, 3, 0> {
1153 public:
1154 LCmpT(LOperand* context, LOperand* left, LOperand* right) {
1155 inputs_[0] = context;
1156 inputs_[1] = left;
1157 inputs_[2] = right;
1158 }
1159
1160 LOperand* context() { return inputs_[0]; }
1161 LOperand* left() { return inputs_[1]; }
1162 LOperand* right() { return inputs_[2]; }
1163
1164 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1165 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1166
1167 Strength strength() { return hydrogen()->strength(); }
1168
1169 Token::Value op() const { return hydrogen()->token(); }
1170 };
1171
1172
1173 class LInstanceOf final : public LTemplateInstruction<1, 3, 0> {
1174 public:
1175 LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
1176 inputs_[0] = context;
1177 inputs_[1] = left;
1178 inputs_[2] = right;
1179 }
1180
1181 LOperand* context() const { return inputs_[0]; }
1182 LOperand* left() const { return inputs_[1]; }
1183 LOperand* right() const { return inputs_[2]; }
1184
1185 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1186 };
1187
1188
1189 class LHasInPrototypeChainAndBranch final : public LControlInstruction<2, 0> {
1190 public:
1191 LHasInPrototypeChainAndBranch(LOperand* object, LOperand* prototype) {
1192 inputs_[0] = object;
1193 inputs_[1] = prototype;
1194 }
1195
1196 LOperand* object() const { return inputs_[0]; }
1197 LOperand* prototype() const { return inputs_[1]; }
1198
1199 DECLARE_CONCRETE_INSTRUCTION(HasInPrototypeChainAndBranch,
1200 "has-in-prototype-chain-and-branch")
1201 DECLARE_HYDROGEN_ACCESSOR(HasInPrototypeChainAndBranch)
1202 };
1203
1204
1205 class LBoundsCheck final : public LTemplateInstruction<0, 2, 0> {
1206 public:
1207 LBoundsCheck(LOperand* index, LOperand* length) {
1208 inputs_[0] = index;
1209 inputs_[1] = length;
1210 }
1211
1212 LOperand* index() { return inputs_[0]; }
1213 LOperand* length() { return inputs_[1]; }
1214
1215 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
1216 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
1217 };
1218
1219
1220 class LBitI final : public LTemplateInstruction<1, 2, 0> {
1221 public:
1222 LBitI(LOperand* left, LOperand* right) {
1223 inputs_[0] = left;
1224 inputs_[1] = right;
1225 }
1226
1227 LOperand* left() { return inputs_[0]; }
1228 LOperand* right() { return inputs_[1]; }
1229
1230 Token::Value op() const { return hydrogen()->op(); }
1231
1232 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1233 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1234 };
1235
1236
1237 class LShiftI final : public LTemplateInstruction<1, 2, 0> {
1238 public:
1239 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1240 : op_(op), can_deopt_(can_deopt) {
1241 inputs_[0] = left;
1242 inputs_[1] = right;
1243 }
1244
1245 Token::Value op() const { return op_; }
1246 LOperand* left() { return inputs_[0]; }
1247 LOperand* right() { return inputs_[1]; }
1248 bool can_deopt() const { return can_deopt_; }
1249
1250 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1251
1252 private:
1253 Token::Value op_;
1254 bool can_deopt_;
1255 };
1256
1257
1258 class LSubI final : public LTemplateInstruction<1, 2, 0> {
1259 public:
1260 LSubI(LOperand* left, LOperand* right) {
1261 inputs_[0] = left;
1262 inputs_[1] = right;
1263 }
1264
1265 LOperand* left() { return inputs_[0]; }
1266 LOperand* right() { return inputs_[1]; }
1267
1268 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1269 DECLARE_HYDROGEN_ACCESSOR(Sub)
1270 };
1271
1272
1273 class LRSubI final : public LTemplateInstruction<1, 2, 0> {
1274 public:
1275 LRSubI(LOperand* left, LOperand* right) {
1276 inputs_[0] = left;
1277 inputs_[1] = right;
1278 }
1279
1280 LOperand* left() { return inputs_[0]; }
1281 LOperand* right() { return inputs_[1]; }
1282
1283 DECLARE_CONCRETE_INSTRUCTION(RSubI, "rsub-i")
1284 DECLARE_HYDROGEN_ACCESSOR(Sub)
1285 };
1286
1287
1288 class LConstantI final : public LTemplateInstruction<1, 0, 0> {
1289 public:
1290 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1291 DECLARE_HYDROGEN_ACCESSOR(Constant)
1292
1293 int32_t value() const { return hydrogen()->Integer32Value(); }
1294 };
1295
1296
1297 class LConstantS final : public LTemplateInstruction<1, 0, 0> {
1298 public:
1299 DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s")
1300 DECLARE_HYDROGEN_ACCESSOR(Constant)
1301
1302 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); }
1303 };
1304
1305
1306 class LConstantD final : public LTemplateInstruction<1, 0, 0> {
1307 public:
1308 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1309 DECLARE_HYDROGEN_ACCESSOR(Constant)
1310
1311 double value() const { return hydrogen()->DoubleValue(); }
1312 uint64_t bits() const { return hydrogen()->DoubleValueAsBits(); }
1313 };
1314
1315
1316 class LConstantE final : public LTemplateInstruction<1, 0, 0> {
1317 public:
1318 DECLARE_CONCRETE_INSTRUCTION(ConstantE, "constant-e")
1319 DECLARE_HYDROGEN_ACCESSOR(Constant)
1320
1321 ExternalReference value() const {
1322 return hydrogen()->ExternalReferenceValue();
1323 }
1324 };
1325
1326
1327 class LConstantT final : public LTemplateInstruction<1, 0, 0> {
1328 public:
1329 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1330 DECLARE_HYDROGEN_ACCESSOR(Constant)
1331
1332 Handle<Object> value(Isolate* isolate) const {
1333 return hydrogen()->handle(isolate);
1334 }
1335 };
1336
1337
1338 class LBranch final : public LControlInstruction<1, 0> {
1339 public:
1340 explicit LBranch(LOperand* value) {
1341 inputs_[0] = value;
1342 }
1343
1344 LOperand* value() { return inputs_[0]; }
1345
1346 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1347 DECLARE_HYDROGEN_ACCESSOR(Branch)
1348
1349 void PrintDataTo(StringStream* stream) override;
1350 };
1351
1352
1353 class LCmpMapAndBranch final : public LControlInstruction<1, 1> {
1354 public:
1355 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1356 inputs_[0] = value;
1357 temps_[0] = temp;
1358 }
1359
1360 LOperand* value() { return inputs_[0]; }
1361 LOperand* temp() { return temps_[0]; }
1362
1363 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1364 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1365
1366 Handle<Map> map() const { return hydrogen()->map().handle(); }
1367 };
1368
1369
1370 class LMapEnumLength final : public LTemplateInstruction<1, 1, 0> {
1371 public:
1372 explicit LMapEnumLength(LOperand* value) {
1373 inputs_[0] = value;
1374 }
1375
1376 LOperand* value() { return inputs_[0]; }
1377
1378 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1379 };
1380
1381
1382 class LDateField final : public LTemplateInstruction<1, 1, 1> {
1383 public:
1384 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1385 inputs_[0] = date;
1386 temps_[0] = temp;
1387 }
1388
1389 LOperand* date() { return inputs_[0]; }
1390 LOperand* temp() { return temps_[0]; }
1391 Smi* index() const { return index_; }
1392
1393 DECLARE_CONCRETE_INSTRUCTION(DateField, "date-field")
1394 DECLARE_HYDROGEN_ACCESSOR(DateField)
1395
1396 private:
1397 Smi* index_;
1398 };
1399
1400
1401 class LSeqStringGetChar final : public LTemplateInstruction<1, 2, 0> {
1402 public:
1403 LSeqStringGetChar(LOperand* string, LOperand* index) {
1404 inputs_[0] = string;
1405 inputs_[1] = index;
1406 }
1407
1408 LOperand* string() const { return inputs_[0]; }
1409 LOperand* index() const { return inputs_[1]; }
1410
1411 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar, "seq-string-get-char")
1412 DECLARE_HYDROGEN_ACCESSOR(SeqStringGetChar)
1413 };
1414
1415
1416 class LSeqStringSetChar final : public LTemplateInstruction<1, 4, 0> {
1417 public:
1418 LSeqStringSetChar(LOperand* context,
1419 LOperand* string,
1420 LOperand* index,
1421 LOperand* value) {
1422 inputs_[0] = context;
1423 inputs_[1] = string;
1424 inputs_[2] = index;
1425 inputs_[3] = value;
1426 }
1427
1428 LOperand* string() { return inputs_[1]; }
1429 LOperand* index() { return inputs_[2]; }
1430 LOperand* value() { return inputs_[3]; }
1431
1432 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1433 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1434 };
1435
1436
1437 class LAddI final : public LTemplateInstruction<1, 2, 0> {
1438 public:
1439 LAddI(LOperand* left, LOperand* right) {
1440 inputs_[0] = left;
1441 inputs_[1] = right;
1442 }
1443
1444 LOperand* left() { return inputs_[0]; }
1445 LOperand* right() { return inputs_[1]; }
1446
1447 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1448 DECLARE_HYDROGEN_ACCESSOR(Add)
1449 };
1450
1451
1452 class LMathMinMax final : public LTemplateInstruction<1, 2, 0> {
1453 public:
1454 LMathMinMax(LOperand* left, LOperand* right) {
1455 inputs_[0] = left;
1456 inputs_[1] = right;
1457 }
1458
1459 LOperand* left() { return inputs_[0]; }
1460 LOperand* right() { return inputs_[1]; }
1461
1462 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
1463 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1464 };
1465
1466
1467 class LPower final : public LTemplateInstruction<1, 2, 0> {
1468 public:
1469 LPower(LOperand* left, LOperand* right) {
1470 inputs_[0] = left;
1471 inputs_[1] = right;
1472 }
1473
1474 LOperand* left() { return inputs_[0]; }
1475 LOperand* right() { return inputs_[1]; }
1476
1477 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1478 DECLARE_HYDROGEN_ACCESSOR(Power)
1479 };
1480
1481
1482 class LArithmeticD final : public LTemplateInstruction<1, 2, 0> {
1483 public:
1484 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1485 : op_(op) {
1486 inputs_[0] = left;
1487 inputs_[1] = right;
1488 }
1489
1490 Token::Value op() const { return op_; }
1491 LOperand* left() { return inputs_[0]; }
1492 LOperand* right() { return inputs_[1]; }
1493
1494 Opcode opcode() const override { return LInstruction::kArithmeticD; }
1495 void CompileToNative(LCodeGen* generator) override;
1496 const char* Mnemonic() const override;
1497
1498 private:
1499 Token::Value op_;
1500 };
1501
1502
1503 class LArithmeticT final : public LTemplateInstruction<1, 3, 0> {
1504 public:
1505 LArithmeticT(Token::Value op,
1506 LOperand* context,
1507 LOperand* left,
1508 LOperand* right)
1509 : op_(op) {
1510 inputs_[0] = context;
1511 inputs_[1] = left;
1512 inputs_[2] = right;
1513 }
1514
1515 LOperand* context() { return inputs_[0]; }
1516 LOperand* left() { return inputs_[1]; }
1517 LOperand* right() { return inputs_[2]; }
1518 Token::Value op() const { return op_; }
1519
1520 Opcode opcode() const override { return LInstruction::kArithmeticT; }
1521 void CompileToNative(LCodeGen* generator) override;
1522 const char* Mnemonic() const override;
1523
1524 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
1525
1526 Strength strength() { return hydrogen()->strength(); }
1527
1528 private:
1529 Token::Value op_;
1530 };
1531
1532
1533 class LReturn final : public LTemplateInstruction<0, 3, 0> {
1534 public:
1535 LReturn(LOperand* value, LOperand* context, LOperand* parameter_count) {
1536 inputs_[0] = value;
1537 inputs_[1] = context;
1538 inputs_[2] = parameter_count;
1539 }
1540
1541 LOperand* value() { return inputs_[0]; }
1542
1543 bool has_constant_parameter_count() {
1544 return parameter_count()->IsConstantOperand();
1545 }
1546 LConstantOperand* constant_parameter_count() {
1547 DCHECK(has_constant_parameter_count());
1548 return LConstantOperand::cast(parameter_count());
1549 }
1550 LOperand* parameter_count() { return inputs_[2]; }
1551
1552 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1553 };
1554
1555
1556 class LLoadNamedField final : public LTemplateInstruction<1, 1, 0> {
1557 public:
1558 explicit LLoadNamedField(LOperand* object) {
1559 inputs_[0] = object;
1560 }
1561
1562 LOperand* object() { return inputs_[0]; }
1563
1564 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1565 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1566 };
1567
1568
1569 class LLoadNamedGeneric final : public LTemplateInstruction<1, 2, 1> {
1570 public:
1571 LLoadNamedGeneric(LOperand* context, LOperand* object, LOperand* vector) {
1572 inputs_[0] = context;
1573 inputs_[1] = object;
1574 temps_[0] = vector;
1575 }
1576
1577 LOperand* context() { return inputs_[0]; }
1578 LOperand* object() { return inputs_[1]; }
1579 LOperand* temp_vector() { return temps_[0]; }
1580
1581 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1582 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1583
1584 Handle<Object> name() const { return hydrogen()->name(); }
1585 };
1586
1587
1588 class LLoadFunctionPrototype final : public LTemplateInstruction<1, 1, 0> {
1589 public:
1590 explicit LLoadFunctionPrototype(LOperand* function) {
1591 inputs_[0] = function;
1592 }
1593
1594 LOperand* function() { return inputs_[0]; }
1595
1596 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1597 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1598 };
1599
1600
1601 class LLoadRoot final : public LTemplateInstruction<1, 0, 0> {
1602 public:
1603 DECLARE_CONCRETE_INSTRUCTION(LoadRoot, "load-root")
1604 DECLARE_HYDROGEN_ACCESSOR(LoadRoot)
1605
1606 Heap::RootListIndex index() const { return hydrogen()->index(); }
1607 };
1608
1609
1610 class LLoadKeyed final : public LTemplateInstruction<1, 2, 0> {
1611 public:
1612 LLoadKeyed(LOperand* elements, LOperand* key) {
1613 inputs_[0] = elements;
1614 inputs_[1] = key;
1615 }
1616
1617 LOperand* elements() { return inputs_[0]; }
1618 LOperand* key() { return inputs_[1]; }
1619 ElementsKind elements_kind() const {
1620 return hydrogen()->elements_kind();
1621 }
1622 bool is_fixed_typed_array() const {
1623 return hydrogen()->is_fixed_typed_array();
1624 }
1625
1626 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1627 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1628
1629 void PrintDataTo(StringStream* stream) override;
1630 uint32_t base_offset() const { return hydrogen()->base_offset(); }
1631 };
1632
1633
1634 class LLoadKeyedGeneric final : public LTemplateInstruction<1, 3, 1> {
1635 public:
1636 LLoadKeyedGeneric(LOperand* context, LOperand* object, LOperand* key,
1637 LOperand* vector) {
1638 inputs_[0] = context;
1639 inputs_[1] = object;
1640 inputs_[2] = key;
1641 temps_[0] = vector;
1642 }
1643
1644 LOperand* context() { return inputs_[0]; }
1645 LOperand* object() { return inputs_[1]; }
1646 LOperand* key() { return inputs_[2]; }
1647 LOperand* temp_vector() { return temps_[0]; }
1648
1649 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1650 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedGeneric)
1651 };
1652
1653
1654 class LLoadGlobalGeneric final : public LTemplateInstruction<1, 2, 1> {
1655 public:
1656 LLoadGlobalGeneric(LOperand* context, LOperand* global_object,
1657 LOperand* vector) {
1658 inputs_[0] = context;
1659 inputs_[1] = global_object;
1660 temps_[0] = vector;
1661 }
1662
1663 LOperand* context() { return inputs_[0]; }
1664 LOperand* global_object() { return inputs_[1]; }
1665 LOperand* temp_vector() { return temps_[0]; }
1666
1667 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1668 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1669
1670 Handle<Object> name() const { return hydrogen()->name(); }
1671 TypeofMode typeof_mode() const { return hydrogen()->typeof_mode(); }
1672 };
1673
1674
1675 class LLoadGlobalViaContext final : public LTemplateInstruction<1, 1, 1> {
1676 public:
1677 explicit LLoadGlobalViaContext(LOperand* context) { inputs_[0] = context; }
1678
1679 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalViaContext, "load-global-via-context")
1680 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalViaContext)
1681
1682 void PrintDataTo(StringStream* stream) override;
1683
1684 LOperand* context() { return inputs_[0]; }
1685
1686 int depth() const { return hydrogen()->depth(); }
1687 int slot_index() const { return hydrogen()->slot_index(); }
1688 };
1689
1690
1691 class LLoadContextSlot final : public LTemplateInstruction<1, 1, 0> {
1692 public:
1693 explicit LLoadContextSlot(LOperand* context) {
1694 inputs_[0] = context;
1695 }
1696
1697 LOperand* context() { return inputs_[0]; }
1698
1699 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1700 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1701
1702 int slot_index() { return hydrogen()->slot_index(); }
1703
1704 void PrintDataTo(StringStream* stream) override;
1705 };
1706
1707
1708 class LStoreContextSlot final : public LTemplateInstruction<0, 2, 0> {
1709 public:
1710 LStoreContextSlot(LOperand* context, LOperand* value) {
1711 inputs_[0] = context;
1712 inputs_[1] = value;
1713 }
1714
1715 LOperand* context() { return inputs_[0]; }
1716 LOperand* value() { return inputs_[1]; }
1717
1718 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1719 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1720
1721 int slot_index() { return hydrogen()->slot_index(); }
1722
1723 void PrintDataTo(StringStream* stream) override;
1724 };
1725
1726
1727 class LPushArgument final : public LTemplateInstruction<0, 1, 0> {
1728 public:
1729 explicit LPushArgument(LOperand* value) {
1730 inputs_[0] = value;
1731 }
1732
1733 LOperand* value() { return inputs_[0]; }
1734
1735 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1736 };
1737
1738
1739 class LDrop final : public LTemplateInstruction<0, 0, 0> {
1740 public:
1741 explicit LDrop(int count) : count_(count) { }
1742
1743 int count() const { return count_; }
1744
1745 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1746
1747 private:
1748 int count_;
1749 };
1750
1751
1752 class LStoreCodeEntry final : public LTemplateInstruction<0, 2, 0> {
1753 public:
1754 LStoreCodeEntry(LOperand* function, LOperand* code_object) {
1755 inputs_[0] = function;
1756 inputs_[1] = code_object;
1757 }
1758
1759 LOperand* function() { return inputs_[0]; }
1760 LOperand* code_object() { return inputs_[1]; }
1761
1762 void PrintDataTo(StringStream* stream) override;
1763
1764 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry, "store-code-entry")
1765 DECLARE_HYDROGEN_ACCESSOR(StoreCodeEntry)
1766 };
1767
1768
1769 class LInnerAllocatedObject final : public LTemplateInstruction<1, 2, 0> {
1770 public:
1771 LInnerAllocatedObject(LOperand* base_object, LOperand* offset) {
1772 inputs_[0] = base_object;
1773 inputs_[1] = offset;
1774 }
1775
1776 LOperand* base_object() const { return inputs_[0]; }
1777 LOperand* offset() const { return inputs_[1]; }
1778
1779 void PrintDataTo(StringStream* stream) override;
1780
1781 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "inner-allocated-object")
1782 };
1783
1784
1785 class LThisFunction final : public LTemplateInstruction<1, 0, 0> {
1786 public:
1787 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1788 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1789 };
1790
1791
1792 class LContext final : public LTemplateInstruction<1, 0, 0> {
1793 public:
1794 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1795 DECLARE_HYDROGEN_ACCESSOR(Context)
1796 };
1797
1798
1799 class LDeclareGlobals final : public LTemplateInstruction<0, 1, 0> {
1800 public:
1801 explicit LDeclareGlobals(LOperand* context) {
1802 inputs_[0] = context;
1803 }
1804
1805 LOperand* context() { return inputs_[0]; }
1806
1807 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1808 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1809 };
1810
1811
1812 class LCallJSFunction final : public LTemplateInstruction<1, 1, 0> {
1813 public:
1814 explicit LCallJSFunction(LOperand* function) {
1815 inputs_[0] = function;
1816 }
1817
1818 LOperand* function() { return inputs_[0]; }
1819
1820 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction, "call-js-function")
1821 DECLARE_HYDROGEN_ACCESSOR(CallJSFunction)
1822
1823 void PrintDataTo(StringStream* stream) override;
1824
1825 int arity() const { return hydrogen()->argument_count() - 1; }
1826 };
1827
1828
1829 class LCallWithDescriptor final : public LTemplateResultInstruction<1> {
1830 public:
1831 LCallWithDescriptor(CallInterfaceDescriptor descriptor,
1832 const ZoneList<LOperand*>& operands, Zone* zone)
1833 : descriptor_(descriptor),
1834 inputs_(descriptor.GetRegisterParameterCount() +
1835 kImplicitRegisterParameterCount,
1836 zone) {
1837 DCHECK(descriptor.GetRegisterParameterCount() +
1838 kImplicitRegisterParameterCount ==
1839 operands.length());
1840 inputs_.AddAll(operands, zone);
1841 }
1842
1843 LOperand* target() const { return inputs_[0]; }
1844
1845 const CallInterfaceDescriptor descriptor() { return descriptor_; }
1846
1847 DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
1848
1849 // The target and context are passed as implicit parameters that are not
1850 // explicitly listed in the descriptor.
1851 static const int kImplicitRegisterParameterCount = 2;
1852
1853 private:
1854 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
1855
1856 void PrintDataTo(StringStream* stream) override;
1857
1858 int arity() const { return hydrogen()->argument_count() - 1; }
1859
1860 CallInterfaceDescriptor descriptor_;
1861 ZoneList<LOperand*> inputs_;
1862
1863 // Iterator support.
1864 int InputCount() final { return inputs_.length(); }
1865 LOperand* InputAt(int i) final { return inputs_[i]; }
1866
1867 int TempCount() final { return 0; }
1868 LOperand* TempAt(int i) final { return NULL; }
1869 };
1870
1871
1872 class LInvokeFunction final : public LTemplateInstruction<1, 2, 0> {
1873 public:
1874 LInvokeFunction(LOperand* context, LOperand* function) {
1875 inputs_[0] = context;
1876 inputs_[1] = function;
1877 }
1878
1879 LOperand* context() { return inputs_[0]; }
1880 LOperand* function() { return inputs_[1]; }
1881
1882 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1883 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1884
1885 void PrintDataTo(StringStream* stream) override;
1886
1887 int arity() const { return hydrogen()->argument_count() - 1; }
1888 };
1889
1890
1891 class LCallFunction final : public LTemplateInstruction<1, 2, 2> {
1892 public:
1893 LCallFunction(LOperand* context, LOperand* function, LOperand* slot,
1894 LOperand* vector) {
1895 inputs_[0] = context;
1896 inputs_[1] = function;
1897 temps_[0] = slot;
1898 temps_[1] = vector;
1899 }
1900
1901 LOperand* context() { return inputs_[0]; }
1902 LOperand* function() { return inputs_[1]; }
1903 LOperand* temp_slot() { return temps_[0]; }
1904 LOperand* temp_vector() { return temps_[1]; }
1905
1906 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1907 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1908
1909 int arity() const { return hydrogen()->argument_count() - 1; }
1910 void PrintDataTo(StringStream* stream) override;
1911 };
1912
1913
1914 class LCallNew final : public LTemplateInstruction<1, 2, 0> {
1915 public:
1916 LCallNew(LOperand* context, LOperand* constructor) {
1917 inputs_[0] = context;
1918 inputs_[1] = constructor;
1919 }
1920
1921 LOperand* context() { return inputs_[0]; }
1922 LOperand* constructor() { return inputs_[1]; }
1923
1924 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1925 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1926
1927 void PrintDataTo(StringStream* stream) override;
1928
1929 int arity() const { return hydrogen()->argument_count() - 1; }
1930 };
1931
1932
1933 class LCallNewArray final : public LTemplateInstruction<1, 2, 0> {
1934 public:
1935 LCallNewArray(LOperand* context, LOperand* constructor) {
1936 inputs_[0] = context;
1937 inputs_[1] = constructor;
1938 }
1939
1940 LOperand* context() { return inputs_[0]; }
1941 LOperand* constructor() { return inputs_[1]; }
1942
1943 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1944 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1945
1946 void PrintDataTo(StringStream* stream) override;
1947
1948 int arity() const { return hydrogen()->argument_count() - 1; }
1949 };
1950
1951
1952 class LCallRuntime final : public LTemplateInstruction<1, 1, 0> {
1953 public:
1954 explicit LCallRuntime(LOperand* context) {
1955 inputs_[0] = context;
1956 }
1957
1958 LOperand* context() { return inputs_[0]; }
1959
1960 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1961 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1962
1963 bool ClobbersDoubleRegisters(Isolate* isolate) const override {
1964 return save_doubles() == kDontSaveFPRegs;
1965 }
1966
1967 const Runtime::Function* function() const { return hydrogen()->function(); }
1968 int arity() const { return hydrogen()->argument_count(); }
1969 SaveFPRegsMode save_doubles() const { return hydrogen()->save_doubles(); }
1970 };
1971
1972
1973 class LInteger32ToDouble final : public LTemplateInstruction<1, 1, 0> {
1974 public:
1975 explicit LInteger32ToDouble(LOperand* value) {
1976 inputs_[0] = value;
1977 }
1978
1979 LOperand* value() { return inputs_[0]; }
1980
1981 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1982 };
1983
1984
1985 class LUint32ToDouble final : public LTemplateInstruction<1, 1, 0> {
1986 public:
1987 explicit LUint32ToDouble(LOperand* value) {
1988 inputs_[0] = value;
1989 }
1990
1991 LOperand* value() { return inputs_[0]; }
1992
1993 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1994 };
1995
1996
1997 class LNumberTagI final : public LTemplateInstruction<1, 1, 2> {
1998 public:
1999 LNumberTagI(LOperand* value, LOperand* temp1, LOperand* temp2) {
2000 inputs_[0] = value;
2001 temps_[0] = temp1;
2002 temps_[1] = temp2;
2003 }
2004
2005 LOperand* value() { return inputs_[0]; }
2006 LOperand* temp1() { return temps_[0]; }
2007 LOperand* temp2() { return temps_[1]; }
2008
2009 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
2010 };
2011
2012
2013 class LNumberTagU final : public LTemplateInstruction<1, 1, 2> {
2014 public:
2015 LNumberTagU(LOperand* value, LOperand* temp1, LOperand* temp2) {
2016 inputs_[0] = value;
2017 temps_[0] = temp1;
2018 temps_[1] = temp2;
2019 }
2020
2021 LOperand* value() { return inputs_[0]; }
2022 LOperand* temp1() { return temps_[0]; }
2023 LOperand* temp2() { return temps_[1]; }
2024
2025 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
2026 };
2027
2028
2029 class LNumberTagD final : public LTemplateInstruction<1, 1, 2> {
2030 public:
2031 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
2032 inputs_[0] = value;
2033 temps_[0] = temp;
2034 temps_[1] = temp2;
2035 }
2036
2037 LOperand* value() { return inputs_[0]; }
2038 LOperand* temp() { return temps_[0]; }
2039 LOperand* temp2() { return temps_[1]; }
2040
2041 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
2042 DECLARE_HYDROGEN_ACCESSOR(Change)
2043 };
2044
2045
2046 class LDoubleToSmi final : public LTemplateInstruction<1, 1, 0> {
2047 public:
2048 explicit LDoubleToSmi(LOperand* value) {
2049 inputs_[0] = value;
2050 }
2051
2052 LOperand* value() { return inputs_[0]; }
2053
2054 DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi")
2055 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2056
2057 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2058 };
2059
2060
2061 // Sometimes truncating conversion from a tagged value to an int32.
2062 class LDoubleToI final : public LTemplateInstruction<1, 1, 0> {
2063 public:
2064 explicit LDoubleToI(LOperand* value) {
2065 inputs_[0] = value;
2066 }
2067
2068 LOperand* value() { return inputs_[0]; }
2069
2070 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
2071 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2072
2073 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2074 };
2075
2076
2077 // Truncating conversion from a tagged value to an int32.
2078 class LTaggedToI final : public LTemplateInstruction<1, 1, 2> {
2079 public:
2080 LTaggedToI(LOperand* value,
2081 LOperand* temp,
2082 LOperand* temp2) {
2083 inputs_[0] = value;
2084 temps_[0] = temp;
2085 temps_[1] = temp2;
2086 }
2087
2088 LOperand* value() { return inputs_[0]; }
2089 LOperand* temp() { return temps_[0]; }
2090 LOperand* temp2() { return temps_[1]; }
2091
2092 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
2093 DECLARE_HYDROGEN_ACCESSOR(Change)
2094
2095 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2096 };
2097
2098
2099 class LSmiTag final : public LTemplateInstruction<1, 1, 0> {
2100 public:
2101 explicit LSmiTag(LOperand* value) {
2102 inputs_[0] = value;
2103 }
2104
2105 LOperand* value() { return inputs_[0]; }
2106
2107 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2108 DECLARE_HYDROGEN_ACCESSOR(Change)
2109 };
2110
2111
2112 class LNumberUntagD final : public LTemplateInstruction<1, 1, 0> {
2113 public:
2114 explicit LNumberUntagD(LOperand* value) {
2115 inputs_[0] = value;
2116 }
2117
2118 LOperand* value() { return inputs_[0]; }
2119
2120 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2121 DECLARE_HYDROGEN_ACCESSOR(Change)
2122 };
2123
2124
2125 class LSmiUntag final : public LTemplateInstruction<1, 1, 0> {
2126 public:
2127 LSmiUntag(LOperand* value, bool needs_check)
2128 : needs_check_(needs_check) {
2129 inputs_[0] = value;
2130 }
2131
2132 LOperand* value() { return inputs_[0]; }
2133 bool needs_check() const { return needs_check_; }
2134
2135 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2136
2137 private:
2138 bool needs_check_;
2139 };
2140
2141
2142 class LStoreNamedField final : public LTemplateInstruction<0, 2, 1> {
2143 public:
2144 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2145 inputs_[0] = object;
2146 inputs_[1] = value;
2147 temps_[0] = temp;
2148 }
2149
2150 LOperand* object() { return inputs_[0]; }
2151 LOperand* value() { return inputs_[1]; }
2152 LOperand* temp() { return temps_[0]; }
2153
2154 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2155 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2156
2157 void PrintDataTo(StringStream* stream) override;
2158
2159 Representation representation() const {
2160 return hydrogen()->field_representation();
2161 }
2162 };
2163
2164
2165 class LStoreNamedGeneric final : public LTemplateInstruction<0, 3, 2> {
2166 public:
2167 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value,
2168 LOperand* slot, LOperand* vector) {
2169 inputs_[0] = context;
2170 inputs_[1] = object;
2171 inputs_[2] = value;
2172 temps_[0] = slot;
2173 temps_[1] = vector;
2174 }
2175
2176 LOperand* context() { return inputs_[0]; }
2177 LOperand* object() { return inputs_[1]; }
2178 LOperand* value() { return inputs_[2]; }
2179 LOperand* temp_slot() { return temps_[0]; }
2180 LOperand* temp_vector() { return temps_[1]; }
2181
2182 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2183 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2184
2185 void PrintDataTo(StringStream* stream) override;
2186
2187 Handle<Object> name() const { return hydrogen()->name(); }
2188 LanguageMode language_mode() { return hydrogen()->language_mode(); }
2189 };
2190
2191
2192 class LStoreGlobalViaContext final : public LTemplateInstruction<0, 2, 0> {
2193 public:
2194 LStoreGlobalViaContext(LOperand* context, LOperand* value) {
2195 inputs_[0] = context;
2196 inputs_[1] = value;
2197 }
2198
2199 LOperand* context() { return inputs_[0]; }
2200 LOperand* value() { return inputs_[1]; }
2201
2202 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalViaContext,
2203 "store-global-via-context")
2204 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalViaContext)
2205
2206 void PrintDataTo(StringStream* stream) override;
2207
2208 int depth() { return hydrogen()->depth(); }
2209 int slot_index() { return hydrogen()->slot_index(); }
2210 LanguageMode language_mode() { return hydrogen()->language_mode(); }
2211 };
2212
2213
2214 class LStoreKeyed final : public LTemplateInstruction<0, 3, 0> {
2215 public:
2216 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
2217 inputs_[0] = object;
2218 inputs_[1] = key;
2219 inputs_[2] = value;
2220 }
2221
2222 bool is_fixed_typed_array() const {
2223 return hydrogen()->is_fixed_typed_array();
2224 }
2225 LOperand* elements() { return inputs_[0]; }
2226 LOperand* key() { return inputs_[1]; }
2227 LOperand* value() { return inputs_[2]; }
2228 ElementsKind elements_kind() const {
2229 return hydrogen()->elements_kind();
2230 }
2231
2232 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2233 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
2234
2235 void PrintDataTo(StringStream* stream) override;
2236 bool NeedsCanonicalization() {
2237 if (hydrogen()->value()->IsAdd() || hydrogen()->value()->IsSub() ||
2238 hydrogen()->value()->IsMul() || hydrogen()->value()->IsDiv()) {
2239 return false;
2240 }
2241 return hydrogen()->NeedsCanonicalization();
2242 }
2243 uint32_t base_offset() const { return hydrogen()->base_offset(); }
2244 };
2245
2246
2247 class LStoreKeyedGeneric final : public LTemplateInstruction<0, 4, 2> {
2248 public:
2249 LStoreKeyedGeneric(LOperand* context, LOperand* object, LOperand* key,
2250 LOperand* value, LOperand* slot, LOperand* vector) {
2251 inputs_[0] = context;
2252 inputs_[1] = object;
2253 inputs_[2] = key;
2254 inputs_[3] = value;
2255 temps_[0] = slot;
2256 temps_[1] = vector;
2257 }
2258
2259 LOperand* context() { return inputs_[0]; }
2260 LOperand* object() { return inputs_[1]; }
2261 LOperand* key() { return inputs_[2]; }
2262 LOperand* value() { return inputs_[3]; }
2263 LOperand* temp_slot() { return temps_[0]; }
2264 LOperand* temp_vector() { return temps_[1]; }
2265
2266 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2267 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2268
2269 void PrintDataTo(StringStream* stream) override;
2270
2271 LanguageMode language_mode() { return hydrogen()->language_mode(); }
2272 };
2273
2274
2275 class LTransitionElementsKind final : public LTemplateInstruction<0, 2, 1> {
2276 public:
2277 LTransitionElementsKind(LOperand* object,
2278 LOperand* context,
2279 LOperand* new_map_temp) {
2280 inputs_[0] = object;
2281 inputs_[1] = context;
2282 temps_[0] = new_map_temp;
2283 }
2284
2285 LOperand* context() { return inputs_[1]; }
2286 LOperand* object() { return inputs_[0]; }
2287 LOperand* new_map_temp() { return temps_[0]; }
2288
2289 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2290 "transition-elements-kind")
2291 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2292
2293 void PrintDataTo(StringStream* stream) override;
2294
2295 Handle<Map> original_map() { return hydrogen()->original_map().handle(); }
2296 Handle<Map> transitioned_map() {
2297 return hydrogen()->transitioned_map().handle();
2298 }
2299 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2300 ElementsKind to_kind() { return hydrogen()->to_kind(); }
2301 };
2302
2303
2304 class LTrapAllocationMemento final : public LTemplateInstruction<0, 1, 1> {
2305 public:
2306 LTrapAllocationMemento(LOperand* object,
2307 LOperand* temp) {
2308 inputs_[0] = object;
2309 temps_[0] = temp;
2310 }
2311
2312 LOperand* object() { return inputs_[0]; }
2313 LOperand* temp() { return temps_[0]; }
2314
2315 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2316 "trap-allocation-memento")
2317 };
2318
2319
2320 class LMaybeGrowElements final : public LTemplateInstruction<1, 5, 0> {
2321 public:
2322 LMaybeGrowElements(LOperand* context, LOperand* object, LOperand* elements,
2323 LOperand* key, LOperand* current_capacity) {
2324 inputs_[0] = context;
2325 inputs_[1] = object;
2326 inputs_[2] = elements;
2327 inputs_[3] = key;
2328 inputs_[4] = current_capacity;
2329 }
2330
2331 LOperand* context() { return inputs_[0]; }
2332 LOperand* object() { return inputs_[1]; }
2333 LOperand* elements() { return inputs_[2]; }
2334 LOperand* key() { return inputs_[3]; }
2335 LOperand* current_capacity() { return inputs_[4]; }
2336
2337 DECLARE_HYDROGEN_ACCESSOR(MaybeGrowElements)
2338 DECLARE_CONCRETE_INSTRUCTION(MaybeGrowElements, "maybe-grow-elements")
2339 };
2340
2341
2342 class LStringAdd final : public LTemplateInstruction<1, 3, 0> {
2343 public:
2344 LStringAdd(LOperand* context, LOperand* left, LOperand* right) {
2345 inputs_[0] = context;
2346 inputs_[1] = left;
2347 inputs_[2] = right;
2348 }
2349
2350 LOperand* context() { return inputs_[0]; }
2351 LOperand* left() { return inputs_[1]; }
2352 LOperand* right() { return inputs_[2]; }
2353
2354 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2355 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
2356 };
2357
2358
2359 class LStringCharCodeAt final : public LTemplateInstruction<1, 3, 0> {
2360 public:
2361 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) {
2362 inputs_[0] = context;
2363 inputs_[1] = string;
2364 inputs_[2] = index;
2365 }
2366
2367 LOperand* context() { return inputs_[0]; }
2368 LOperand* string() { return inputs_[1]; }
2369 LOperand* index() { return inputs_[2]; }
2370
2371 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2372 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
2373 };
2374
2375
2376 class LStringCharFromCode final : public LTemplateInstruction<1, 2, 0> {
2377 public:
2378 explicit LStringCharFromCode(LOperand* context, LOperand* char_code) {
2379 inputs_[0] = context;
2380 inputs_[1] = char_code;
2381 }
2382
2383 LOperand* context() { return inputs_[0]; }
2384 LOperand* char_code() { return inputs_[1]; }
2385
2386 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2387 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
2388 };
2389
2390
2391 class LCheckValue final : public LTemplateInstruction<0, 1, 0> {
2392 public:
2393 explicit LCheckValue(LOperand* value) {
2394 inputs_[0] = value;
2395 }
2396
2397 LOperand* value() { return inputs_[0]; }
2398
2399 DECLARE_CONCRETE_INSTRUCTION(CheckValue, "check-value")
2400 DECLARE_HYDROGEN_ACCESSOR(CheckValue)
2401 };
2402
2403
2404 class LCheckArrayBufferNotNeutered final
2405 : public LTemplateInstruction<0, 1, 0> {
2406 public:
2407 explicit LCheckArrayBufferNotNeutered(LOperand* view) { inputs_[0] = view; }
2408
2409 LOperand* view() { return inputs_[0]; }
2410
2411 DECLARE_CONCRETE_INSTRUCTION(CheckArrayBufferNotNeutered,
2412 "check-array-buffer-not-neutered")
2413 DECLARE_HYDROGEN_ACCESSOR(CheckArrayBufferNotNeutered)
2414 };
2415
2416
2417 class LCheckInstanceType final : public LTemplateInstruction<0, 1, 0> {
2418 public:
2419 explicit LCheckInstanceType(LOperand* value) {
2420 inputs_[0] = value;
2421 }
2422
2423 LOperand* value() { return inputs_[0]; }
2424
2425 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2426 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2427 };
2428
2429
2430 class LCheckMaps final : public LTemplateInstruction<0, 1, 0> {
2431 public:
2432 explicit LCheckMaps(LOperand* value = NULL) {
2433 inputs_[0] = value;
2434 }
2435
2436 LOperand* value() { return inputs_[0]; }
2437
2438 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2439 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
2440 };
2441
2442
2443 class LCheckSmi final : public LTemplateInstruction<1, 1, 0> {
2444 public:
2445 explicit LCheckSmi(LOperand* value) {
2446 inputs_[0] = value;
2447 }
2448
2449 LOperand* value() { return inputs_[0]; }
2450
2451 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2452 };
2453
2454
2455 class LCheckNonSmi final : public LTemplateInstruction<0, 1, 0> {
2456 public:
2457 explicit LCheckNonSmi(LOperand* value) {
2458 inputs_[0] = value;
2459 }
2460
2461 LOperand* value() { return inputs_[0]; }
2462
2463 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2464 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject)
2465 };
2466
2467
2468 class LClampDToUint8 final : public LTemplateInstruction<1, 1, 0> {
2469 public:
2470 explicit LClampDToUint8(LOperand* unclamped) {
2471 inputs_[0] = unclamped;
2472 }
2473
2474 LOperand* unclamped() { return inputs_[0]; }
2475
2476 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2477 };
2478
2479
2480 class LClampIToUint8 final : public LTemplateInstruction<1, 1, 0> {
2481 public:
2482 explicit LClampIToUint8(LOperand* unclamped) {
2483 inputs_[0] = unclamped;
2484 }
2485
2486 LOperand* unclamped() { return inputs_[0]; }
2487
2488 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2489 };
2490
2491
2492 class LClampTToUint8 final : public LTemplateInstruction<1, 1, 1> {
2493 public:
2494 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2495 inputs_[0] = unclamped;
2496 temps_[0] = temp;
2497 }
2498
2499 LOperand* unclamped() { return inputs_[0]; }
2500 LOperand* temp() { return temps_[0]; }
2501
2502 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2503 };
2504
2505
2506 class LDoubleBits final : public LTemplateInstruction<1, 1, 0> {
2507 public:
2508 explicit LDoubleBits(LOperand* value) {
2509 inputs_[0] = value;
2510 }
2511
2512 LOperand* value() { return inputs_[0]; }
2513
2514 DECLARE_CONCRETE_INSTRUCTION(DoubleBits, "double-bits")
2515 DECLARE_HYDROGEN_ACCESSOR(DoubleBits)
2516 };
2517
2518
2519 class LConstructDouble final : public LTemplateInstruction<1, 2, 0> {
2520 public:
2521 LConstructDouble(LOperand* hi, LOperand* lo) {
2522 inputs_[0] = hi;
2523 inputs_[1] = lo;
2524 }
2525
2526 LOperand* hi() { return inputs_[0]; }
2527 LOperand* lo() { return inputs_[1]; }
2528
2529 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble, "construct-double")
2530 };
2531
2532
2533 class LAllocate final : public LTemplateInstruction<1, 2, 2> {
2534 public:
2535 LAllocate(LOperand* context,
2536 LOperand* size,
2537 LOperand* temp1,
2538 LOperand* temp2) {
2539 inputs_[0] = context;
2540 inputs_[1] = size;
2541 temps_[0] = temp1;
2542 temps_[1] = temp2;
2543 }
2544
2545 LOperand* context() { return inputs_[0]; }
2546 LOperand* size() { return inputs_[1]; }
2547 LOperand* temp1() { return temps_[0]; }
2548 LOperand* temp2() { return temps_[1]; }
2549
2550 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2551 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2552 };
2553
2554
2555 class LRegExpLiteral final : public LTemplateInstruction<1, 1, 0> {
2556 public:
2557 explicit LRegExpLiteral(LOperand* context) {
2558 inputs_[0] = context;
2559 }
2560
2561 LOperand* context() { return inputs_[0]; }
2562
2563 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2564 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2565 };
2566
2567
2568 class LToFastProperties final : public LTemplateInstruction<1, 1, 0> {
2569 public:
2570 explicit LToFastProperties(LOperand* value) {
2571 inputs_[0] = value;
2572 }
2573
2574 LOperand* value() { return inputs_[0]; }
2575
2576 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2577 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2578 };
2579
2580
2581 class LTypeof final : public LTemplateInstruction<1, 2, 0> {
2582 public:
2583 LTypeof(LOperand* context, LOperand* value) {
2584 inputs_[0] = context;
2585 inputs_[1] = value;
2586 }
2587
2588 LOperand* context() { return inputs_[0]; }
2589 LOperand* value() { return inputs_[1]; }
2590
2591 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2592 };
2593
2594
2595 class LTypeofIsAndBranch final : public LControlInstruction<1, 0> {
2596 public:
2597 explicit LTypeofIsAndBranch(LOperand* value) {
2598 inputs_[0] = value;
2599 }
2600
2601 LOperand* value() { return inputs_[0]; }
2602
2603 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2604 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2605
2606 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2607
2608 void PrintDataTo(StringStream* stream) override;
2609 };
2610
2611
2612 class LIsConstructCallAndBranch final : public LControlInstruction<0, 1> {
2613 public:
2614 explicit LIsConstructCallAndBranch(LOperand* temp) {
2615 temps_[0] = temp;
2616 }
2617
2618 LOperand* temp() { return temps_[0]; }
2619
2620 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2621 "is-construct-call-and-branch")
2622 };
2623
2624
2625 class LOsrEntry final : public LTemplateInstruction<0, 0, 0> {
2626 public:
2627 LOsrEntry() {}
2628
2629 bool HasInterestingComment(LCodeGen* gen) const override { return false; }
2630 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2631 };
2632
2633
2634 class LStackCheck final : public LTemplateInstruction<0, 1, 0> {
2635 public:
2636 explicit LStackCheck(LOperand* context) {
2637 inputs_[0] = context;
2638 }
2639
2640 LOperand* context() { return inputs_[0]; }
2641
2642 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2643 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2644
2645 Label* done_label() { return &done_label_; }
2646
2647 private:
2648 Label done_label_;
2649 };
2650
2651
2652 class LForInPrepareMap final : public LTemplateInstruction<1, 2, 0> {
2653 public:
2654 LForInPrepareMap(LOperand* context, LOperand* object) {
2655 inputs_[0] = context;
2656 inputs_[1] = object;
2657 }
2658
2659 LOperand* context() { return inputs_[0]; }
2660 LOperand* object() { return inputs_[1]; }
2661
2662 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2663 };
2664
2665
2666 class LForInCacheArray final : public LTemplateInstruction<1, 1, 0> {
2667 public:
2668 explicit LForInCacheArray(LOperand* map) {
2669 inputs_[0] = map;
2670 }
2671
2672 LOperand* map() { return inputs_[0]; }
2673
2674 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2675
2676 int idx() {
2677 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2678 }
2679 };
2680
2681
2682 class LCheckMapValue final : public LTemplateInstruction<0, 2, 0> {
2683 public:
2684 LCheckMapValue(LOperand* value, LOperand* map) {
2685 inputs_[0] = value;
2686 inputs_[1] = map;
2687 }
2688
2689 LOperand* value() { return inputs_[0]; }
2690 LOperand* map() { return inputs_[1]; }
2691
2692 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2693 };
2694
2695
2696 class LLoadFieldByIndex final : public LTemplateInstruction<1, 2, 0> {
2697 public:
2698 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2699 inputs_[0] = object;
2700 inputs_[1] = index;
2701 }
2702
2703 LOperand* object() { return inputs_[0]; }
2704 LOperand* index() { return inputs_[1]; }
2705
2706 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2707 };
2708
2709
2710 class LStoreFrameContext: public LTemplateInstruction<0, 1, 0> {
2711 public:
2712 explicit LStoreFrameContext(LOperand* context) {
2713 inputs_[0] = context;
2714 }
2715
2716 LOperand* context() { return inputs_[0]; }
2717
2718 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext, "store-frame-context")
2719 };
2720
2721
2722 class LAllocateBlockContext: public LTemplateInstruction<1, 2, 0> {
2723 public:
2724 LAllocateBlockContext(LOperand* context, LOperand* function) {
2725 inputs_[0] = context;
2726 inputs_[1] = function;
2727 }
2728
2729 LOperand* context() { return inputs_[0]; }
2730 LOperand* function() { return inputs_[1]; }
2731
2732 Handle<ScopeInfo> scope_info() { return hydrogen()->scope_info(); }
2733
2734 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext, "allocate-block-context")
2735 DECLARE_HYDROGEN_ACCESSOR(AllocateBlockContext)
2736 };
2737
2738
2739 class LChunkBuilder;
2740 class LPlatformChunk final : public LChunk {
2741 public:
2742 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2743 : LChunk(info, graph) { }
2744
2745 int GetNextSpillIndex(RegisterKind kind);
2746 LOperand* GetNextSpillSlot(RegisterKind kind);
2747 };
2748
2749
2750 class LChunkBuilder final : public LChunkBuilderBase {
2751 public:
2752 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2753 : LChunkBuilderBase(info, graph),
2754 current_instruction_(NULL),
2755 current_block_(NULL),
2756 next_block_(NULL),
2757 allocator_(allocator) {}
2758
2759 // Build the sequence for the graph.
2760 LPlatformChunk* Build();
2761
2762 // Declare methods that deal with the individual node types.
2763 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2764 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2765 #undef DECLARE_DO
2766
2767 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2768 LInstruction* DoMultiplySub(HValue* minuend, HMul* mul);
2769 LInstruction* DoRSub(HSub* instr);
2770
2771 static bool HasMagicNumberForDivisor(int32_t divisor);
2772
2773 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2774 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2775 LInstruction* DoMathFround(HUnaryMathOperation* instr);
2776 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2777 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2778 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2779 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2780 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2781 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2782 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2783 LInstruction* DoDivByConstI(HDiv* instr);
2784 LInstruction* DoDivI(HDiv* instr);
2785 LInstruction* DoModByPowerOf2I(HMod* instr);
2786 LInstruction* DoModByConstI(HMod* instr);
2787 LInstruction* DoModI(HMod* instr);
2788 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2789 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2790 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr);
2791
2792 private:
2793 // Methods for getting operands for Use / Define / Temp.
2794 LUnallocated* ToUnallocated(Register reg);
2795 LUnallocated* ToUnallocated(DoubleRegister reg);
2796
2797 // Methods for setting up define-use relationships.
2798 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2799 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2800 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2801 DoubleRegister fixed_register);
2802
2803 // A value that is guaranteed to be allocated to a register.
2804 // Operand created by UseRegister is guaranteed to be live until the end of
2805 // instruction. This means that register allocator will not reuse it's
2806 // register for any other operand inside instruction.
2807 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2808 // instruction start. Register allocator is free to assign the same register
2809 // to some other operand used inside instruction (i.e. temporary or
2810 // output).
2811 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2812 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2813
2814 // An input operand in a register that may be trashed.
2815 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2816
2817 // An input operand in a register or stack slot.
2818 MUST_USE_RESULT LOperand* Use(HValue* value);
2819 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2820
2821 // An input operand in a register, stack slot or a constant operand.
2822 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2823 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2824
2825 // An input operand in a register or a constant operand.
2826 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2827 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2828
2829 // An input operand in a constant operand.
2830 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2831
2832 // An input operand in register, stack slot or a constant operand.
2833 // Will not be moved to a register even if one is freely available.
2834 MUST_USE_RESULT LOperand* UseAny(HValue* value) override;
2835
2836 // Temporary operand that must be in a register.
2837 MUST_USE_RESULT LUnallocated* TempRegister();
2838 MUST_USE_RESULT LUnallocated* TempDoubleRegister();
2839 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2840 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2841
2842 // Methods for setting up define-use relationships.
2843 // Return the same instruction that they are passed.
2844 LInstruction* Define(LTemplateResultInstruction<1>* instr,
2845 LUnallocated* result);
2846 LInstruction* DefineAsRegister(LTemplateResultInstruction<1>* instr);
2847 LInstruction* DefineAsSpilled(LTemplateResultInstruction<1>* instr,
2848 int index);
2849 LInstruction* DefineSameAsFirst(LTemplateResultInstruction<1>* instr);
2850 LInstruction* DefineFixed(LTemplateResultInstruction<1>* instr,
2851 Register reg);
2852 LInstruction* DefineFixedDouble(LTemplateResultInstruction<1>* instr,
2853 DoubleRegister reg);
2854 LInstruction* AssignEnvironment(LInstruction* instr);
2855 LInstruction* AssignPointerMap(LInstruction* instr);
2856
2857 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2858
2859 // By default we assume that instruction sequences generated for calls
2860 // cannot deoptimize eagerly and we do not attach environment to this
2861 // instruction.
2862 LInstruction* MarkAsCall(
2863 LInstruction* instr,
2864 HInstruction* hinstr,
2865 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2866
2867 void VisitInstruction(HInstruction* current);
2868 void AddInstruction(LInstruction* instr, HInstruction* current);
2869
2870 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2871 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2872 LInstruction* DoArithmeticD(Token::Value op,
2873 HArithmeticBinaryOperation* instr);
2874 LInstruction* DoArithmeticT(Token::Value op,
2875 HBinaryOperation* instr);
2876
2877 HInstruction* current_instruction_;
2878 HBasicBlock* current_block_;
2879 HBasicBlock* next_block_;
2880 LAllocator* allocator_;
2881
2882 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2883 };
2884
2885 #undef DECLARE_HYDROGEN_ACCESSOR
2886 #undef DECLARE_CONCRETE_INSTRUCTION
2887
2888 } // namespace internal
2889 } // namespace v8
2890
2891 #endif // V8_ARM_LITHIUM_ARM_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/arm/lithium-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698