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