blob: 8ea8da4cc5386a552d569d5016308aeebd6ac5e8 [file] [log] [blame]
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001// Copyright 2012 the V8 project authors. All rights reserved.
lrn@chromium.org7516f052011-03-30 08:52:27 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef V8_MIPS_LITHIUM_MIPS_H_
29#define V8_MIPS_LITHIUM_MIPS_H_
30
31#include "hydrogen.h"
32#include "lithium-allocator.h"
33#include "lithium.h"
34#include "safepoint-table.h"
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000035#include "utils.h"
lrn@chromium.org7516f052011-03-30 08:52:27 +000036
37namespace v8 {
38namespace internal {
39
40// Forward declarations.
41class LCodeGen;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000042
43#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
44 V(ControlInstruction) \
45 V(Call) \
46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
47
48
49#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
50 V(AccessArgumentsAt) \
51 V(AddI) \
ulan@chromium.org967e2702012-02-28 09:49:15 +000052 V(AllocateObject) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000053 V(ApplyArguments) \
54 V(ArgumentsElements) \
55 V(ArgumentsLength) \
56 V(ArithmeticD) \
57 V(ArithmeticT) \
58 V(ArrayLiteral) \
59 V(BitI) \
60 V(BitNotI) \
61 V(BoundsCheck) \
62 V(Branch) \
63 V(CallConstantFunction) \
64 V(CallFunction) \
65 V(CallGlobal) \
66 V(CallKeyed) \
67 V(CallKnownGlobal) \
68 V(CallNamed) \
69 V(CallNew) \
70 V(CallRuntime) \
71 V(CallStub) \
72 V(CheckFunction) \
73 V(CheckInstanceType) \
jkummerow@chromium.org1456e702012-03-30 08:38:13 +000074 V(CheckMaps) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000075 V(CheckNonSmi) \
76 V(CheckPrototypeMaps) \
77 V(CheckSmi) \
78 V(ClampDToUint8) \
79 V(ClampIToUint8) \
80 V(ClampTToUint8) \
81 V(ClassOfTestAndBranch) \
82 V(CmpConstantEqAndBranch) \
83 V(CmpIDAndBranch) \
84 V(CmpObjectEqAndBranch) \
85 V(CmpMapAndBranch) \
86 V(CmpT) \
87 V(ConstantD) \
88 V(ConstantI) \
89 V(ConstantT) \
90 V(Context) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000091 V(DeclareGlobals) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000092 V(DeleteProperty) \
93 V(Deoptimize) \
94 V(DivI) \
95 V(DoubleToI) \
96 V(ElementsKind) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000097 V(FastLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000098 V(FixedArrayBaseLength) \
99 V(FunctionLiteral) \
100 V(GetCachedArrayIndex) \
101 V(GlobalObject) \
102 V(GlobalReceiver) \
103 V(Goto) \
104 V(HasCachedArrayIndexAndBranch) \
105 V(HasInstanceTypeAndBranch) \
106 V(In) \
107 V(InstanceOf) \
108 V(InstanceOfKnownGlobal) \
109 V(InstructionGap) \
110 V(Integer32ToDouble) \
111 V(InvokeFunction) \
112 V(IsConstructCallAndBranch) \
113 V(IsNilAndBranch) \
114 V(IsObjectAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000115 V(IsStringAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000116 V(IsSmiAndBranch) \
117 V(IsUndetectableAndBranch) \
118 V(JSArrayLength) \
119 V(Label) \
120 V(LazyBailout) \
121 V(LoadContextSlot) \
122 V(LoadElements) \
123 V(LoadExternalArrayPointer) \
124 V(LoadFunctionPrototype) \
125 V(LoadGlobalCell) \
126 V(LoadGlobalGeneric) \
127 V(LoadKeyedFastDoubleElement) \
128 V(LoadKeyedFastElement) \
129 V(LoadKeyedGeneric) \
130 V(LoadKeyedSpecializedArrayElement) \
131 V(LoadNamedField) \
132 V(LoadNamedFieldPolymorphic) \
133 V(LoadNamedGeneric) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000134 V(MathMinMax) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000135 V(ModI) \
136 V(MulI) \
137 V(NumberTagD) \
138 V(NumberTagI) \
139 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000140 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000141 V(OsrEntry) \
142 V(OuterContext) \
143 V(Parameter) \
144 V(Power) \
145 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000146 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000147 V(RegExpLiteral) \
148 V(Return) \
149 V(ShiftI) \
150 V(SmiTag) \
151 V(SmiUntag) \
152 V(StackCheck) \
153 V(StoreContextSlot) \
154 V(StoreGlobalCell) \
155 V(StoreGlobalGeneric) \
156 V(StoreKeyedFastDoubleElement) \
157 V(StoreKeyedFastElement) \
158 V(StoreKeyedGeneric) \
159 V(StoreKeyedSpecializedArrayElement) \
160 V(StoreNamedField) \
161 V(StoreNamedGeneric) \
162 V(StringAdd) \
163 V(StringCharCodeAt) \
164 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000165 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000166 V(StringLength) \
167 V(SubI) \
168 V(TaggedToI) \
169 V(ThisFunction) \
170 V(Throw) \
171 V(ToFastProperties) \
172 V(TransitionElementsKind) \
173 V(Typeof) \
174 V(TypeofIsAndBranch) \
175 V(UnaryMathOperation) \
176 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000177 V(ValueOf) \
178 V(ForInPrepareMap) \
179 V(ForInCacheArray) \
180 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000181 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000182 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000183 V(WrapReceiver) \
184 V(Drop)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000185
186#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
187 virtual Opcode opcode() const { return LInstruction::k##type; } \
188 virtual void CompileToNative(LCodeGen* generator); \
189 virtual const char* Mnemonic() const { return mnemonic; } \
190 static L##type* cast(LInstruction* instr) { \
191 ASSERT(instr->Is##type()); \
192 return reinterpret_cast<L##type*>(instr); \
193 }
194
195
196#define DECLARE_HYDROGEN_ACCESSOR(type) \
197 H##type* hydrogen() const { \
198 return H##type::cast(hydrogen_value()); \
199 }
200
lrn@chromium.org7516f052011-03-30 08:52:27 +0000201
202class LInstruction: public ZoneObject {
203 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000204 LInstruction()
205 : environment_(NULL),
206 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000207 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000208 virtual ~LInstruction() { }
209
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000210 virtual void CompileToNative(LCodeGen* generator) = 0;
211 virtual const char* Mnemonic() const = 0;
212 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000213 virtual void PrintDataTo(StringStream* stream);
214 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000215
216 enum Opcode {
217 // Declare a unique enum value for each instruction.
218#define DECLARE_OPCODE(type) k##type,
219 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
220 kNumberOfInstructions
221#undef DECLARE_OPCODE
222 };
223
224 virtual Opcode opcode() const = 0;
225
226 // Declare non-virtual type testers for all leaf IR classes.
227#define DECLARE_PREDICATE(type) \
228 bool Is##type() const { return opcode() == k##type; }
229 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
230#undef DECLARE_PREDICATE
231
232 // Declare virtual predicates for instructions that don't have
233 // an opcode.
234 virtual bool IsGap() const { return false; }
235
236 virtual bool IsControl() const { return false; }
237
238 void set_environment(LEnvironment* env) { environment_ = env; }
239 LEnvironment* environment() const { return environment_; }
240 bool HasEnvironment() const { return environment_ != NULL; }
241
242 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
243 LPointerMap* pointer_map() const { return pointer_map_.get(); }
244 bool HasPointerMap() const { return pointer_map_.is_set(); }
245
246 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
247 HValue* hydrogen_value() const { return hydrogen_value_; }
248
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000249 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000250
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000251 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000252
253 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000254 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000255
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000256 virtual bool HasResult() const = 0;
257 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000258
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000259 virtual int TempCount() = 0;
260 virtual LOperand* TempAt(int i) = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000261
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000262 LOperand* FirstInput() { return InputAt(0); }
263 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000264
265#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000266 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000267#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000268
269 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000270 // Iterator interface.
271 friend class InputIterator;
272 virtual int InputCount() = 0;
273 virtual LOperand* InputAt(int i) = 0;
274
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000275 LEnvironment* environment_;
276 SetOncePointer<LPointerMap> pointer_map_;
277 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000278 bool is_call_;
279 bool is_save_doubles_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000280};
281
282
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000283// R = number of result operands (0 or 1).
284// I = number of input operands.
285// T = number of temporary operands.
286template<int R, int I, int T>
287class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000288 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000289 // Allow 0 or 1 output operands.
290 STATIC_ASSERT(R == 0 || R == 1);
291 virtual bool HasResult() const { return R != 0; }
292 void set_result(LOperand* operand) { results_[0] = operand; }
293 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000294
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000295 LOperand* InputAt(int i) { return inputs_[i]; }
296
297 int TempCount() { return T; }
298 LOperand* TempAt(int i) { return temps_[i]; }
299
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000300 protected:
301 EmbeddedContainer<LOperand*, R> results_;
302 EmbeddedContainer<LOperand*, I> inputs_;
303 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000304
305 private:
306 virtual int InputCount() { return I; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000307};
308
309
310class LGap: public LTemplateInstruction<0, 0, 0> {
311 public:
312 explicit LGap(HBasicBlock* block)
313 : block_(block) {
314 parallel_moves_[BEFORE] = NULL;
315 parallel_moves_[START] = NULL;
316 parallel_moves_[END] = NULL;
317 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000318 }
319
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000320 // Can't use the DECLARE-macro here because of sub-classes.
321 virtual bool IsGap() const { return true; }
322 virtual void PrintDataTo(StringStream* stream);
323 static LGap* cast(LInstruction* instr) {
324 ASSERT(instr->IsGap());
325 return reinterpret_cast<LGap*>(instr);
326 }
327
328 bool IsRedundant() const;
329
330 HBasicBlock* block() const { return block_; }
331
lrn@chromium.org7516f052011-03-30 08:52:27 +0000332 enum InnerPosition {
333 BEFORE,
334 START,
335 END,
336 AFTER,
337 FIRST_INNER_POSITION = BEFORE,
338 LAST_INNER_POSITION = AFTER
339 };
340
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000341 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
342 if (parallel_moves_[pos] == NULL) {
343 parallel_moves_[pos] = new(zone) LParallelMove(zone);
344 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000345 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000346 }
347
348 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000349 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000350 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000351
352 private:
353 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
354 HBasicBlock* block_;
355};
356
357
358class LInstructionGap: public LGap {
359 public:
360 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
361
362 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
363};
364
365
366class LGoto: public LTemplateInstruction<0, 0, 0> {
367 public:
368 explicit LGoto(int block_id) : block_id_(block_id) { }
369
370 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
371 virtual void PrintDataTo(StringStream* stream);
372 virtual bool IsControl() const { return true; }
373
374 int block_id() const { return block_id_; }
375
376 private:
377 int block_id_;
378};
379
380
381class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
382 public:
383 LLazyBailout() : gap_instructions_size_(0) { }
384
385 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
386
387 void set_gap_instructions_size(int gap_instructions_size) {
388 gap_instructions_size_ = gap_instructions_size;
389 }
390 int gap_instructions_size() { return gap_instructions_size_; }
391
392 private:
393 int gap_instructions_size_;
394};
395
396
397class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
398 public:
399 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000400};
401
402
403class LLabel: public LGap {
404 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000405 explicit LLabel(HBasicBlock* block)
406 : LGap(block), replacement_(NULL) { }
407
408 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
409
410 virtual void PrintDataTo(StringStream* stream);
411
412 int block_id() const { return block()->block_id(); }
413 bool is_loop_header() const { return block()->IsLoopHeader(); }
414 Label* label() { return &label_; }
415 LLabel* replacement() const { return replacement_; }
416 void set_replacement(LLabel* label) { replacement_ = label; }
417 bool HasReplacement() const { return replacement_ != NULL; }
418
419 private:
420 Label label_;
421 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000422};
423
424
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000425class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000426 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000427 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
428};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000429
lrn@chromium.org7516f052011-03-30 08:52:27 +0000430
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000431class LCallStub: public LTemplateInstruction<1, 0, 0> {
432 public:
433 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
434 DECLARE_HYDROGEN_ACCESSOR(CallStub)
435
436 TranscendentalCache::Type transcendental_type() {
437 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000438 }
439};
440
441
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000442class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
443 public:
444 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
445};
446
447
448template<int I, int T>
449class LControlInstruction: public LTemplateInstruction<0, I, T> {
450 public:
451 virtual bool IsControl() const { return true; }
452
453 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
454 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
455 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
456 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
457
458 private:
459 HControlInstruction* hydrogen() {
460 return HControlInstruction::cast(this->hydrogen_value());
461 }
462};
463
464
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000465class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
466 public:
467 LWrapReceiver(LOperand* receiver, LOperand* function) {
468 inputs_[0] = receiver;
469 inputs_[1] = function;
470 }
471
472 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
473
474 LOperand* receiver() { return inputs_[0]; }
475 LOperand* function() { return inputs_[1]; }
476};
477
478
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000479class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
480 public:
481 LApplyArguments(LOperand* function,
482 LOperand* receiver,
483 LOperand* length,
484 LOperand* elements) {
485 inputs_[0] = function;
486 inputs_[1] = receiver;
487 inputs_[2] = length;
488 inputs_[3] = elements;
489 }
490
491 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
492
493 LOperand* function() { return inputs_[0]; }
494 LOperand* receiver() { return inputs_[1]; }
495 LOperand* length() { return inputs_[2]; }
496 LOperand* elements() { return inputs_[3]; }
497};
498
499
500class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
501 public:
502 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
503 inputs_[0] = arguments;
504 inputs_[1] = length;
505 inputs_[2] = index;
506 }
507
508 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
509
510 LOperand* arguments() { return inputs_[0]; }
511 LOperand* length() { return inputs_[1]; }
512 LOperand* index() { return inputs_[2]; }
513
514 virtual void PrintDataTo(StringStream* stream);
515};
516
517
518class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
519 public:
520 explicit LArgumentsLength(LOperand* elements) {
521 inputs_[0] = elements;
522 }
523
524 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
525};
526
527
528class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
529 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000530 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000531 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000532};
533
534
535class LModI: public LTemplateInstruction<1, 2, 3> {
536 public:
537 // Used when the right hand is a constant power of 2.
538 LModI(LOperand* left,
539 LOperand* right) {
540 inputs_[0] = left;
541 inputs_[1] = right;
542 temps_[0] = NULL;
543 temps_[1] = NULL;
544 temps_[2] = NULL;
545 }
546
547 // Used for the standard case.
548 LModI(LOperand* left,
549 LOperand* right,
550 LOperand* temp1,
551 LOperand* temp2,
552 LOperand* temp3) {
553 inputs_[0] = left;
554 inputs_[1] = right;
555 temps_[0] = temp1;
556 temps_[1] = temp2;
557 temps_[2] = temp3;
558 }
559
560 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
561 DECLARE_HYDROGEN_ACCESSOR(Mod)
562};
563
564
565class LDivI: public LTemplateInstruction<1, 2, 0> {
566 public:
567 LDivI(LOperand* left, LOperand* right) {
568 inputs_[0] = left;
569 inputs_[1] = right;
570 }
571
572 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
573 DECLARE_HYDROGEN_ACCESSOR(Div)
574};
575
576
577class LMulI: public LTemplateInstruction<1, 2, 1> {
578 public:
579 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
580 inputs_[0] = left;
581 inputs_[1] = right;
582 temps_[0] = temp;
583 }
584
585 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
586 DECLARE_HYDROGEN_ACCESSOR(Mul)
587};
588
589
590class LCmpIDAndBranch: public LControlInstruction<2, 0> {
591 public:
592 LCmpIDAndBranch(LOperand* left, LOperand* right) {
593 inputs_[0] = left;
594 inputs_[1] = right;
595 }
596
597 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
598 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
599
600 Token::Value op() const { return hydrogen()->token(); }
601 bool is_double() const {
602 return hydrogen()->GetInputRepresentation().IsDouble();
603 }
604
605 virtual void PrintDataTo(StringStream* stream);
606};
607
608
609class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
610 public:
611 LUnaryMathOperation(LOperand* value, LOperand* temp) {
612 inputs_[0] = value;
613 temps_[0] = temp;
614 }
615
616 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
617 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
618
619 virtual void PrintDataTo(StringStream* stream);
620 BuiltinFunctionId op() const { return hydrogen()->op(); }
621};
622
623
624class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
625 public:
626 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
627 inputs_[0] = left;
628 inputs_[1] = right;
629 }
630
631 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
632 "cmp-object-eq-and-branch")
633 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
634};
635
636
637class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
638 public:
639 explicit LCmpConstantEqAndBranch(LOperand* left) {
640 inputs_[0] = left;
641 }
642
643 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
644 "cmp-constant-eq-and-branch")
645 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
646};
647
648
649class LIsNilAndBranch: public LControlInstruction<1, 0> {
650 public:
651 explicit LIsNilAndBranch(LOperand* value) {
652 inputs_[0] = value;
653 }
654
655 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
656 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
657
658 EqualityKind kind() const { return hydrogen()->kind(); }
659 NilValue nil() const { return hydrogen()->nil(); }
660
661 virtual void PrintDataTo(StringStream* stream);
662};
663
664
665class LIsObjectAndBranch: public LControlInstruction<1, 1> {
666 public:
667 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
668 inputs_[0] = value;
669 temps_[0] = temp;
670 }
671
672 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
673 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
674
675 virtual void PrintDataTo(StringStream* stream);
676};
677
678
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000679class LIsStringAndBranch: public LControlInstruction<1, 1> {
680 public:
681 LIsStringAndBranch(LOperand* value, LOperand* temp) {
682 inputs_[0] = value;
683 temps_[0] = temp;
684 }
685
686 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
687 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
688
689 virtual void PrintDataTo(StringStream* stream);
690};
691
692
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000693class LIsSmiAndBranch: public LControlInstruction<1, 0> {
694 public:
695 explicit LIsSmiAndBranch(LOperand* value) {
696 inputs_[0] = value;
697 }
698
699 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
700 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
701
702 virtual void PrintDataTo(StringStream* stream);
703};
704
705
706class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
707 public:
708 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
709 inputs_[0] = value;
710 temps_[0] = temp;
711 }
712
713 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
714 "is-undetectable-and-branch")
715 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
716
717 virtual void PrintDataTo(StringStream* stream);
718};
719
720
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000721class LStringCompareAndBranch: public LControlInstruction<2, 0> {
722 public:
723 LStringCompareAndBranch(LOperand* left, LOperand* right) {
724 inputs_[0] = left;
725 inputs_[1] = right;
726 }
727
728 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
729 "string-compare-and-branch")
730 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
731
732 Token::Value op() const { return hydrogen()->token(); }
733
734 virtual void PrintDataTo(StringStream* stream);
735};
736
737
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000738class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
739 public:
740 explicit LHasInstanceTypeAndBranch(LOperand* value) {
741 inputs_[0] = value;
742 }
743
744 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
745 "has-instance-type-and-branch")
746 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
747
748 virtual void PrintDataTo(StringStream* stream);
749};
750
751
752class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
753 public:
754 explicit LGetCachedArrayIndex(LOperand* value) {
755 inputs_[0] = value;
756 }
757
758 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
759 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
760};
761
762
763class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
764 public:
765 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
766 inputs_[0] = value;
767 }
768
769 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
770 "has-cached-array-index-and-branch")
771 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
772
773 virtual void PrintDataTo(StringStream* stream);
774};
775
776
777class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
778 public:
779 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
780 inputs_[0] = value;
781 temps_[0] = temp;
782 }
783
784 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
785 "class-of-test-and-branch")
786 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
787
788 virtual void PrintDataTo(StringStream* stream);
789};
790
791
792class LCmpT: public LTemplateInstruction<1, 2, 0> {
793 public:
794 LCmpT(LOperand* left, LOperand* right) {
795 inputs_[0] = left;
796 inputs_[1] = right;
797 }
798
799 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
800 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
801
802 Token::Value op() const { return hydrogen()->token(); }
803};
804
805
806class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
807 public:
808 LInstanceOf(LOperand* left, LOperand* right) {
809 inputs_[0] = left;
810 inputs_[1] = right;
811 }
812
813 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
814};
815
816
817class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
818 public:
819 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
820 inputs_[0] = value;
821 temps_[0] = temp;
822 }
823
824 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
825 "instance-of-known-global")
826 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
827
828 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000829 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
830 return lazy_deopt_env_;
831 }
832 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
833 lazy_deopt_env_ = env;
834 }
835
836 private:
837 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000838};
839
840
841class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
842 public:
843 LBoundsCheck(LOperand* index, LOperand* length) {
844 inputs_[0] = index;
845 inputs_[1] = length;
846 }
847
848 LOperand* index() { return inputs_[0]; }
849 LOperand* length() { return inputs_[1]; }
850
851 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +0000852 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000853};
854
855
856class LBitI: public LTemplateInstruction<1, 2, 0> {
857 public:
858 LBitI(LOperand* left, LOperand* right) {
859 inputs_[0] = left;
860 inputs_[1] = right;
861 }
862
863 Token::Value op() const { return hydrogen()->op(); }
864
865 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
866 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
867};
868
869
870class LShiftI: public LTemplateInstruction<1, 2, 0> {
871 public:
872 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
873 : op_(op), can_deopt_(can_deopt) {
874 inputs_[0] = left;
875 inputs_[1] = right;
876 }
877
878 Token::Value op() const { return op_; }
879
880 bool can_deopt() const { return can_deopt_; }
881
882 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
883
884 private:
885 Token::Value op_;
886 bool can_deopt_;
887};
888
889
890class LSubI: public LTemplateInstruction<1, 2, 0> {
891 public:
892 LSubI(LOperand* left, LOperand* right) {
893 inputs_[0] = left;
894 inputs_[1] = right;
895 }
896
897 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
898 DECLARE_HYDROGEN_ACCESSOR(Sub)
899};
900
901
902class LConstantI: public LTemplateInstruction<1, 0, 0> {
903 public:
904 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
905 DECLARE_HYDROGEN_ACCESSOR(Constant)
906
907 int32_t value() const { return hydrogen()->Integer32Value(); }
908};
909
910
911class LConstantD: public LTemplateInstruction<1, 0, 0> {
912 public:
913 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
914 DECLARE_HYDROGEN_ACCESSOR(Constant)
915
916 double value() const { return hydrogen()->DoubleValue(); }
917};
918
919
920class LConstantT: public LTemplateInstruction<1, 0, 0> {
921 public:
922 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
923 DECLARE_HYDROGEN_ACCESSOR(Constant)
924
925 Handle<Object> value() const { return hydrogen()->handle(); }
926};
927
928
929class LBranch: public LControlInstruction<1, 0> {
930 public:
931 explicit LBranch(LOperand* value) {
932 inputs_[0] = value;
933 }
934
935 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
936 DECLARE_HYDROGEN_ACCESSOR(Branch)
937
938 virtual void PrintDataTo(StringStream* stream);
939};
940
941
942class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
943 public:
944 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
945 inputs_[0] = value;
946 temps_[0] = temp;
947 }
948
949 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
950 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
951
952 virtual bool IsControl() const { return true; }
953
954 Handle<Map> map() const { return hydrogen()->map(); }
955 int true_block_id() const {
956 return hydrogen()->FirstSuccessor()->block_id();
957 }
958 int false_block_id() const {
959 return hydrogen()->SecondSuccessor()->block_id();
960 }
961};
962
963
964class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
965 public:
966 explicit LJSArrayLength(LOperand* value) {
967 inputs_[0] = value;
968 }
969
970 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
971 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
972};
973
974
975class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
976 public:
977 explicit LFixedArrayBaseLength(LOperand* value) {
978 inputs_[0] = value;
979 }
980
981 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
982 "fixed-array-base-length")
983 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
984};
985
986
987class LElementsKind: public LTemplateInstruction<1, 1, 0> {
988 public:
989 explicit LElementsKind(LOperand* value) {
990 inputs_[0] = value;
991 }
992
993 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
994 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
995};
996
997
998class LValueOf: public LTemplateInstruction<1, 1, 1> {
999 public:
1000 LValueOf(LOperand* value, LOperand* temp) {
1001 inputs_[0] = value;
1002 temps_[0] = temp;
1003 }
1004
1005 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1006 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1007};
1008
1009
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001010class LDateField: public LTemplateInstruction<1, 1, 1> {
1011 public:
1012 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1013 inputs_[0] = date;
1014 temps_[0] = temp;
1015 }
1016
1017 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1018 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1019 Smi* index() const { return index_; }
1020
1021 private:
1022 Smi* index_;
1023};
1024
1025
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001026class LThrow: public LTemplateInstruction<0, 1, 0> {
1027 public:
1028 explicit LThrow(LOperand* value) {
1029 inputs_[0] = value;
1030 }
1031
1032 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1033};
1034
1035
1036class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1037 public:
1038 explicit LBitNotI(LOperand* value) {
1039 inputs_[0] = value;
1040 }
1041
1042 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1043};
1044
1045
1046class LAddI: public LTemplateInstruction<1, 2, 0> {
1047 public:
1048 LAddI(LOperand* left, LOperand* right) {
1049 inputs_[0] = left;
1050 inputs_[1] = right;
1051 }
1052
1053 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1054 DECLARE_HYDROGEN_ACCESSOR(Add)
1055};
1056
1057
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001058class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1059 public:
1060 LMathMinMax(LOperand* left, LOperand* right) {
1061 inputs_[0] = left;
1062 inputs_[1] = right;
1063 }
1064
1065 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max")
1066 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1067};
1068
1069
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001070class LPower: public LTemplateInstruction<1, 2, 0> {
1071 public:
1072 LPower(LOperand* left, LOperand* right) {
1073 inputs_[0] = left;
1074 inputs_[1] = right;
1075 }
1076
1077 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1078 DECLARE_HYDROGEN_ACCESSOR(Power)
1079};
1080
1081
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001082class LRandom: public LTemplateInstruction<1, 1, 0> {
1083 public:
1084 explicit LRandom(LOperand* global_object) {
1085 inputs_[0] = global_object;
1086 }
1087
1088 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1089 DECLARE_HYDROGEN_ACCESSOR(Random)
1090};
1091
1092
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001093class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1094 public:
1095 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1096 : op_(op) {
1097 inputs_[0] = left;
1098 inputs_[1] = right;
1099 }
1100
1101 Token::Value op() const { return op_; }
1102
1103 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1104 virtual void CompileToNative(LCodeGen* generator);
1105 virtual const char* Mnemonic() const;
1106
1107 private:
1108 Token::Value op_;
1109};
1110
1111
1112class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1113 public:
1114 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1115 : op_(op) {
1116 inputs_[0] = left;
1117 inputs_[1] = right;
1118 }
1119
1120 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1121 virtual void CompileToNative(LCodeGen* generator);
1122 virtual const char* Mnemonic() const;
1123
1124 Token::Value op() const { return op_; }
1125
1126 private:
1127 Token::Value op_;
1128};
1129
1130
1131class LReturn: public LTemplateInstruction<0, 1, 0> {
1132 public:
1133 explicit LReturn(LOperand* value) {
1134 inputs_[0] = value;
1135 }
1136
1137 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1138};
1139
1140
1141class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1142 public:
1143 explicit LLoadNamedField(LOperand* object) {
1144 inputs_[0] = object;
1145 }
1146
1147 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1148 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1149};
1150
1151
1152class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1153 public:
1154 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1155 inputs_[0] = object;
1156 }
1157
1158 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1159 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
1160
1161 LOperand* object() { return inputs_[0]; }
1162};
1163
1164
1165class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1166 public:
1167 explicit LLoadNamedGeneric(LOperand* object) {
1168 inputs_[0] = object;
1169 }
1170
1171 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1172 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1173
1174 LOperand* object() { return inputs_[0]; }
1175 Handle<Object> name() const { return hydrogen()->name(); }
1176};
1177
1178
1179class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1180 public:
1181 explicit LLoadFunctionPrototype(LOperand* function) {
1182 inputs_[0] = function;
1183 }
1184
1185 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1186 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1187
1188 LOperand* function() { return inputs_[0]; }
1189};
1190
1191
1192class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1193 public:
1194 explicit LLoadElements(LOperand* object) {
1195 inputs_[0] = object;
1196 }
1197
1198 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1199};
1200
1201
1202class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1203 public:
1204 explicit LLoadExternalArrayPointer(LOperand* object) {
1205 inputs_[0] = object;
1206 }
1207
1208 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1209 "load-external-array-pointer")
1210};
1211
1212
1213class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> {
1214 public:
1215 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1216 inputs_[0] = elements;
1217 inputs_[1] = key;
1218 }
1219
1220 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1221 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1222
1223 LOperand* elements() { return inputs_[0]; }
1224 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001225 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001226};
1227
1228
1229class LLoadKeyedFastDoubleElement: public LTemplateInstruction<1, 2, 0> {
1230 public:
1231 LLoadKeyedFastDoubleElement(LOperand* elements, LOperand* key) {
1232 inputs_[0] = elements;
1233 inputs_[1] = key;
1234 }
1235
1236 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement,
1237 "load-keyed-fast-double-element")
1238 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastDoubleElement)
1239
1240 LOperand* elements() { return inputs_[0]; }
1241 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001242 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001243};
1244
1245
1246class LLoadKeyedSpecializedArrayElement: public LTemplateInstruction<1, 2, 0> {
1247 public:
svenpanne@chromium.org830d30c2012-05-29 13:20:14 +00001248 LLoadKeyedSpecializedArrayElement(LOperand* external_pointer,
1249 LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001250 inputs_[0] = external_pointer;
1251 inputs_[1] = key;
1252 }
1253
1254 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement,
1255 "load-keyed-specialized-array-element")
1256 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedSpecializedArrayElement)
1257
1258 LOperand* external_pointer() { return inputs_[0]; }
1259 LOperand* key() { return inputs_[1]; }
1260 ElementsKind elements_kind() const {
1261 return hydrogen()->elements_kind();
1262 }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001263 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001264};
1265
1266
1267class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1268 public:
1269 LLoadKeyedGeneric(LOperand* obj, LOperand* key) {
1270 inputs_[0] = obj;
1271 inputs_[1] = key;
1272 }
1273
1274 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1275
1276 LOperand* object() { return inputs_[0]; }
1277 LOperand* key() { return inputs_[1]; }
1278};
1279
1280
1281class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1282 public:
1283 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1284 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1285};
1286
1287
1288class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1289 public:
1290 explicit LLoadGlobalGeneric(LOperand* global_object) {
1291 inputs_[0] = global_object;
1292 }
1293
1294 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1295 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1296
1297 LOperand* global_object() { return inputs_[0]; }
1298 Handle<Object> name() const { return hydrogen()->name(); }
1299 bool for_typeof() const { return hydrogen()->for_typeof(); }
1300};
1301
1302
1303class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1304 public:
1305 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1306 inputs_[0] = value;
1307 temps_[0] = temp;
1308 }
1309
1310 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1311 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
danno@chromium.orge78f9fc2011-12-21 08:29:34 +00001312
1313 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001314};
1315
1316
1317class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1318 public:
1319 explicit LStoreGlobalGeneric(LOperand* global_object,
1320 LOperand* value) {
1321 inputs_[0] = global_object;
1322 inputs_[1] = value;
1323 }
1324
1325 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1326 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1327
1328 LOperand* global_object() { return InputAt(0); }
1329 Handle<Object> name() const { return hydrogen()->name(); }
1330 LOperand* value() { return InputAt(1); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001331 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001332};
1333
1334
1335class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1336 public:
1337 explicit LLoadContextSlot(LOperand* context) {
1338 inputs_[0] = context;
1339 }
1340
1341 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1342 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1343
1344 LOperand* context() { return InputAt(0); }
1345 int slot_index() { return hydrogen()->slot_index(); }
1346
1347 virtual void PrintDataTo(StringStream* stream);
1348};
1349
1350
1351class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1352 public:
1353 LStoreContextSlot(LOperand* context, LOperand* value) {
1354 inputs_[0] = context;
1355 inputs_[1] = value;
1356 }
1357
1358 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1359 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1360
1361 LOperand* context() { return InputAt(0); }
1362 LOperand* value() { return InputAt(1); }
1363 int slot_index() { return hydrogen()->slot_index(); }
1364
1365 virtual void PrintDataTo(StringStream* stream);
1366};
1367
1368
1369class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1370 public:
1371 explicit LPushArgument(LOperand* value) {
1372 inputs_[0] = value;
1373 }
1374
1375 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1376};
1377
1378
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001379class LDrop: public LTemplateInstruction<0, 0, 0> {
1380 public:
1381 explicit LDrop(int count) : count_(count) { }
1382
1383 int count() const { return count_; }
1384
1385 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1386
1387 private:
1388 int count_;
1389};
1390
1391
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001392class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1393 public:
1394 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1395 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1396};
1397
1398
1399class LContext: public LTemplateInstruction<1, 0, 0> {
1400 public:
1401 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1402};
1403
1404
1405class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1406 public:
1407 explicit LOuterContext(LOperand* context) {
1408 inputs_[0] = context;
1409 }
1410
1411 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
1412
1413 LOperand* context() { return InputAt(0); }
1414};
1415
1416
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001417class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1418 public:
1419 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1420 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1421};
1422
1423
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001424class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1425 public:
1426 explicit LGlobalObject(LOperand* context) {
1427 inputs_[0] = context;
1428 }
1429
1430 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1431
1432 LOperand* context() { return InputAt(0); }
1433};
1434
1435
1436class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1437 public:
1438 explicit LGlobalReceiver(LOperand* global_object) {
1439 inputs_[0] = global_object;
1440 }
1441
1442 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1443
1444 LOperand* global() { return InputAt(0); }
1445};
1446
1447
1448class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1449 public:
1450 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1451 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1452
1453 virtual void PrintDataTo(StringStream* stream);
1454
1455 Handle<JSFunction> function() { return hydrogen()->function(); }
1456 int arity() const { return hydrogen()->argument_count() - 1; }
1457};
1458
1459
1460class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1461 public:
1462 explicit LInvokeFunction(LOperand* function) {
1463 inputs_[0] = function;
1464 }
1465
1466 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1467 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1468
1469 LOperand* function() { return inputs_[0]; }
1470
1471 virtual void PrintDataTo(StringStream* stream);
1472
1473 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001474 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001475};
1476
1477
1478class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1479 public:
1480 explicit LCallKeyed(LOperand* key) {
1481 inputs_[0] = key;
1482 }
1483
1484 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1485 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1486
1487 virtual void PrintDataTo(StringStream* stream);
1488
1489 int arity() const { return hydrogen()->argument_count() - 1; }
1490};
1491
1492
1493
1494class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1495 public:
1496 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1497 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1498
1499 virtual void PrintDataTo(StringStream* stream);
1500
1501 Handle<String> name() const { return hydrogen()->name(); }
1502 int arity() const { return hydrogen()->argument_count() - 1; }
1503};
1504
1505
danno@chromium.orgc612e022011-11-10 11:38:15 +00001506class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001507 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001508 explicit LCallFunction(LOperand* function) {
1509 inputs_[0] = function;
1510 }
1511
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001512 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1513 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1514
danno@chromium.orgc612e022011-11-10 11:38:15 +00001515 LOperand* function() { return inputs_[0]; }
1516 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001517};
1518
1519
1520class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1521 public:
1522 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1523 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1524
1525 virtual void PrintDataTo(StringStream* stream);
1526
1527 Handle<String> name() const {return hydrogen()->name(); }
1528 int arity() const { return hydrogen()->argument_count() - 1; }
1529};
1530
1531
1532class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1533 public:
1534 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1535 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1536
1537 virtual void PrintDataTo(StringStream* stream);
1538
1539 Handle<JSFunction> target() const { return hydrogen()->target(); }
1540 int arity() const { return hydrogen()->argument_count() - 1; }
1541};
1542
1543
1544class LCallNew: public LTemplateInstruction<1, 1, 0> {
1545 public:
1546 explicit LCallNew(LOperand* constructor) {
1547 inputs_[0] = constructor;
1548 }
1549
1550 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1551 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1552
1553 virtual void PrintDataTo(StringStream* stream);
1554
1555 int arity() const { return hydrogen()->argument_count() - 1; }
1556};
1557
1558
1559class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1560 public:
1561 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1562 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1563
1564 const Runtime::Function* function() const { return hydrogen()->function(); }
1565 int arity() const { return hydrogen()->argument_count(); }
1566};
1567
1568
1569class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1570 public:
1571 explicit LInteger32ToDouble(LOperand* value) {
1572 inputs_[0] = value;
1573 }
1574
1575 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1576};
1577
1578
1579class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1580 public:
1581 explicit LNumberTagI(LOperand* value) {
1582 inputs_[0] = value;
1583 }
1584
1585 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1586};
1587
1588
1589class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1590 public:
1591 LNumberTagD(LOperand* value, LOperand* temp1, LOperand* temp2) {
1592 inputs_[0] = value;
1593 temps_[0] = temp1;
1594 temps_[1] = temp2;
1595 }
1596
1597 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1598};
1599
1600
1601// Sometimes truncating conversion from a tagged value to an int32.
1602class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1603 public:
1604 LDoubleToI(LOperand* value, LOperand* temp1, LOperand* temp2) {
1605 inputs_[0] = value;
1606 temps_[0] = temp1;
1607 temps_[1] = temp2;
1608 }
1609
1610 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1611 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1612
1613 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1614};
1615
1616
1617// Truncating conversion from a tagged value to an int32.
1618class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1619 public:
1620 LTaggedToI(LOperand* value,
1621 LOperand* temp1,
1622 LOperand* temp2,
1623 LOperand* temp3) {
1624 inputs_[0] = value;
1625 temps_[0] = temp1;
1626 temps_[1] = temp2;
1627 temps_[2] = temp3;
1628 }
1629
1630 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1631 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1632
1633 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1634};
1635
1636
1637class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1638 public:
1639 explicit LSmiTag(LOperand* value) {
1640 inputs_[0] = value;
1641 }
1642
1643 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1644};
1645
1646
1647class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1648 public:
1649 explicit LNumberUntagD(LOperand* value) {
1650 inputs_[0] = value;
1651 }
1652
1653 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1654 DECLARE_HYDROGEN_ACCESSOR(Change)
1655};
1656
1657
1658class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1659 public:
1660 LSmiUntag(LOperand* value, bool needs_check)
1661 : needs_check_(needs_check) {
1662 inputs_[0] = value;
1663 }
1664
1665 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1666
1667 bool needs_check() const { return needs_check_; }
1668
1669 private:
1670 bool needs_check_;
1671};
1672
1673
verwaest@chromium.org37141392012-05-31 13:27:02 +00001674class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001675 public:
verwaest@chromium.org37141392012-05-31 13:27:02 +00001676 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001677 inputs_[0] = obj;
1678 inputs_[1] = val;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001679 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001680 }
1681
1682 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1683 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1684
1685 virtual void PrintDataTo(StringStream* stream);
1686
1687 LOperand* object() { return inputs_[0]; }
1688 LOperand* value() { return inputs_[1]; }
1689
1690 Handle<Object> name() const { return hydrogen()->name(); }
1691 bool is_in_object() { return hydrogen()->is_in_object(); }
1692 int offset() { return hydrogen()->offset(); }
1693 Handle<Map> transition() const { return hydrogen()->transition(); }
1694};
1695
1696
1697class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1698 public:
1699 LStoreNamedGeneric(LOperand* obj, LOperand* val) {
1700 inputs_[0] = obj;
1701 inputs_[1] = val;
1702 }
1703
1704 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1705 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1706
1707 virtual void PrintDataTo(StringStream* stream);
1708
1709 LOperand* object() { return inputs_[0]; }
1710 LOperand* value() { return inputs_[1]; }
1711 Handle<Object> name() const { return hydrogen()->name(); }
1712 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001713};
1714
1715
1716class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
1717 public:
1718 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
1719 inputs_[0] = obj;
1720 inputs_[1] = key;
1721 inputs_[2] = val;
1722 }
1723
1724 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1725 "store-keyed-fast-element")
1726 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1727
1728 virtual void PrintDataTo(StringStream* stream);
1729
1730 LOperand* object() { return inputs_[0]; }
1731 LOperand* key() { return inputs_[1]; }
1732 LOperand* value() { return inputs_[2]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001733 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001734};
1735
1736
1737class LStoreKeyedFastDoubleElement: public LTemplateInstruction<0, 3, 0> {
1738 public:
1739 LStoreKeyedFastDoubleElement(LOperand* elements,
1740 LOperand* key,
1741 LOperand* val) {
1742 inputs_[0] = elements;
1743 inputs_[1] = key;
1744 inputs_[2] = val;
1745 }
1746
1747 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement,
1748 "store-keyed-fast-double-element")
1749 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastDoubleElement)
1750
1751 virtual void PrintDataTo(StringStream* stream);
1752
1753 LOperand* elements() { return inputs_[0]; }
1754 LOperand* key() { return inputs_[1]; }
1755 LOperand* value() { return inputs_[2]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001756 uint32_t additional_index() const { return hydrogen()->index_offset(); }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001757
1758 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001759};
1760
1761
1762class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1763 public:
1764 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) {
1765 inputs_[0] = obj;
1766 inputs_[1] = key;
1767 inputs_[2] = val;
1768 }
1769
1770 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1771 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1772
1773 virtual void PrintDataTo(StringStream* stream);
1774
1775 LOperand* object() { return inputs_[0]; }
1776 LOperand* key() { return inputs_[1]; }
1777 LOperand* value() { return inputs_[2]; }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001778 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001779};
1780
1781class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> {
1782 public:
1783 LStoreKeyedSpecializedArrayElement(LOperand* external_pointer,
1784 LOperand* key,
1785 LOperand* val) {
1786 inputs_[0] = external_pointer;
1787 inputs_[1] = key;
1788 inputs_[2] = val;
1789 }
1790
1791 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
1792 "store-keyed-specialized-array-element")
1793 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement)
1794
1795 LOperand* external_pointer() { return inputs_[0]; }
1796 LOperand* key() { return inputs_[1]; }
1797 LOperand* value() { return inputs_[2]; }
1798 ElementsKind elements_kind() const {
1799 return hydrogen()->elements_kind();
1800 }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001801 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001802};
1803
1804
1805class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1806 public:
1807 LTransitionElementsKind(LOperand* object,
1808 LOperand* new_map_temp,
1809 LOperand* temp_reg) {
1810 inputs_[0] = object;
1811 temps_[0] = new_map_temp;
1812 temps_[1] = temp_reg;
1813 }
1814
1815 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1816 "transition-elements-kind")
1817 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1818
1819 virtual void PrintDataTo(StringStream* stream);
1820
1821 LOperand* object() { return inputs_[0]; }
1822 LOperand* new_map_reg() { return temps_[0]; }
1823 LOperand* temp_reg() { return temps_[1]; }
1824 Handle<Map> original_map() { return hydrogen()->original_map(); }
1825 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
1826};
1827
1828
1829class LStringAdd: public LTemplateInstruction<1, 2, 0> {
1830 public:
1831 LStringAdd(LOperand* left, LOperand* right) {
1832 inputs_[0] = left;
1833 inputs_[1] = right;
1834 }
1835
1836 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1837 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
1838
1839 LOperand* left() { return inputs_[0]; }
1840 LOperand* right() { return inputs_[1]; }
1841};
1842
1843
1844
1845class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
1846 public:
1847 LStringCharCodeAt(LOperand* string, LOperand* index) {
1848 inputs_[0] = string;
1849 inputs_[1] = index;
1850 }
1851
1852 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1853 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
1854
1855 LOperand* string() { return inputs_[0]; }
1856 LOperand* index() { return inputs_[1]; }
1857};
1858
1859
1860class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
1861 public:
1862 explicit LStringCharFromCode(LOperand* char_code) {
1863 inputs_[0] = char_code;
1864 }
1865
1866 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
1867 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
1868
1869 LOperand* char_code() { return inputs_[0]; }
1870};
1871
1872
1873class LStringLength: public LTemplateInstruction<1, 1, 0> {
1874 public:
1875 explicit LStringLength(LOperand* string) {
1876 inputs_[0] = string;
1877 }
1878
1879 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1880 DECLARE_HYDROGEN_ACCESSOR(StringLength)
1881
1882 LOperand* string() { return inputs_[0]; }
1883};
1884
1885
1886class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
1887 public:
1888 explicit LCheckFunction(LOperand* value) {
1889 inputs_[0] = value;
1890 }
1891
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00001892 LOperand* value() { return InputAt(0); }
1893
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001894 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1895 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1896};
1897
1898
1899class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
1900 public:
1901 explicit LCheckInstanceType(LOperand* value) {
1902 inputs_[0] = value;
1903 }
1904
1905 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1906 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
1907};
1908
1909
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001910class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001911 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001912 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001913 inputs_[0] = value;
1914 }
1915
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001916 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
1917 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001918};
1919
1920
1921class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
1922 public:
1923 LCheckPrototypeMaps(LOperand* temp1, LOperand* temp2) {
1924 temps_[0] = temp1;
1925 temps_[1] = temp2;
1926 }
1927
1928 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1929 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1930
1931 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1932 Handle<JSObject> holder() const { return hydrogen()->holder(); }
1933};
1934
1935
1936class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
1937 public:
1938 explicit LCheckSmi(LOperand* value) {
1939 inputs_[0] = value;
1940 }
1941
1942 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
1943};
1944
1945
1946class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
1947 public:
1948 explicit LCheckNonSmi(LOperand* value) {
1949 inputs_[0] = value;
1950 }
1951
1952 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
1953};
1954
1955
1956class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
1957 public:
1958 LClampDToUint8(LOperand* value, LOperand* temp) {
1959 inputs_[0] = value;
1960 temps_[0] = temp;
1961 }
1962
1963 LOperand* unclamped() { return inputs_[0]; }
1964
1965 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
1966};
1967
1968
1969class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
1970 public:
1971 explicit LClampIToUint8(LOperand* value) {
1972 inputs_[0] = value;
1973 }
1974
1975 LOperand* unclamped() { return inputs_[0]; }
1976
1977 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
1978};
1979
1980
1981class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
1982 public:
1983 LClampTToUint8(LOperand* value, LOperand* temp) {
1984 inputs_[0] = value;
1985 temps_[0] = temp;
1986 }
1987
1988 LOperand* unclamped() { return inputs_[0]; }
1989
1990 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
1991};
1992
1993
fschneider@chromium.org35814e52012-03-01 15:43:35 +00001994class LAllocateObject: public LTemplateInstruction<1, 0, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00001995 public:
fschneider@chromium.org35814e52012-03-01 15:43:35 +00001996 LAllocateObject(LOperand* temp1, LOperand* temp2) {
1997 temps_[0] = temp1;
1998 temps_[1] = temp2;
1999 }
2000
ulan@chromium.org967e2702012-02-28 09:49:15 +00002001 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2002 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2003};
2004
2005
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002006class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
2007 public:
2008 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2009 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2010};
2011
2012
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002013class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2014 public:
2015 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2016 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2017};
2018
2019
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002020class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002021 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002022 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2023 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002024};
2025
2026
2027class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2028 public:
2029 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2030 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2031};
2032
2033
2034class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2035 public:
2036 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2037 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2038
2039 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2040};
2041
2042
2043class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2044 public:
2045 explicit LToFastProperties(LOperand* value) {
2046 inputs_[0] = value;
2047 }
2048
2049 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2050 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2051};
2052
2053
2054class LTypeof: public LTemplateInstruction<1, 1, 0> {
2055 public:
2056 explicit LTypeof(LOperand* value) {
2057 inputs_[0] = value;
2058 }
2059
2060 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2061};
2062
2063
2064class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2065 public:
2066 explicit LTypeofIsAndBranch(LOperand* value) {
2067 inputs_[0] = value;
2068 }
2069
2070 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2071 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2072
2073 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2074
2075 virtual void PrintDataTo(StringStream* stream);
2076};
2077
2078
2079class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2080 public:
2081 explicit LIsConstructCallAndBranch(LOperand* temp) {
2082 temps_[0] = temp;
2083 }
2084
2085 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2086 "is-construct-call-and-branch")
2087};
2088
2089
2090class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2091 public:
2092 LDeleteProperty(LOperand* obj, LOperand* key) {
2093 inputs_[0] = obj;
2094 inputs_[1] = key;
2095 }
2096
2097 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
2098
2099 LOperand* object() { return inputs_[0]; }
2100 LOperand* key() { return inputs_[1]; }
2101};
2102
2103
2104class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2105 public:
2106 LOsrEntry();
2107
2108 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2109
2110 LOperand** SpilledRegisterArray() { return register_spills_; }
2111 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2112
2113 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2114 void MarkSpilledDoubleRegister(int allocation_index,
2115 LOperand* spill_operand);
2116
2117 private:
2118 // Arrays of spill slot operands for registers with an assigned spill
2119 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2120 // NULL if the register has no assigned spill slot. Indexed by allocation
2121 // index.
2122 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2123 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2124};
2125
2126
2127class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2128 public:
2129 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2130 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2131
2132 Label* done_label() { return &done_label_; }
2133
2134 private:
2135 Label done_label_;
2136};
2137
2138
2139class LIn: public LTemplateInstruction<1, 2, 0> {
2140 public:
2141 LIn(LOperand* key, LOperand* object) {
2142 inputs_[0] = key;
2143 inputs_[1] = object;
2144 }
2145
2146 LOperand* key() { return inputs_[0]; }
2147 LOperand* object() { return inputs_[1]; }
2148
2149 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2150};
2151
2152
ulan@chromium.org812308e2012-02-29 15:58:45 +00002153class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2154 public:
2155 explicit LForInPrepareMap(LOperand* object) {
2156 inputs_[0] = object;
2157 }
2158
2159 LOperand* object() { return inputs_[0]; }
2160
2161 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2162};
2163
2164
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002165class LForInCacheArray: public LTemplateInstruction<1, 1, 1> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002166 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002167 explicit LForInCacheArray(LOperand* map, LOperand* scratch) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002168 inputs_[0] = map;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002169 temps_[0] = scratch;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002170 }
2171
2172 LOperand* map() { return inputs_[0]; }
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002173 LOperand* scratch() { return temps_[0]; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002174
2175 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2176
2177 int idx() {
2178 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2179 }
2180};
2181
2182
2183class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2184 public:
2185 LCheckMapValue(LOperand* value, LOperand* map) {
2186 inputs_[0] = value;
2187 inputs_[1] = map;
2188 }
2189
2190 LOperand* value() { return inputs_[0]; }
2191 LOperand* map() { return inputs_[1]; }
2192
2193 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2194};
2195
2196
2197class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2198 public:
2199 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2200 inputs_[0] = object;
2201 inputs_[1] = index;
2202 }
2203
2204 LOperand* object() { return inputs_[0]; }
2205 LOperand* index() { return inputs_[1]; }
2206
2207 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2208};
2209
2210
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002211class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002212class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002213 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002214 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2215 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002216
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002217 int GetNextSpillIndex(bool is_double);
2218 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002219};
2220
2221
2222class LChunkBuilder BASE_EMBEDDED {
2223 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002224 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2225 : chunk_(NULL),
2226 info_(info),
2227 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002228 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002229 status_(UNUSED),
2230 current_instruction_(NULL),
2231 current_block_(NULL),
2232 next_block_(NULL),
2233 argument_count_(0),
2234 allocator_(allocator),
2235 position_(RelocInfo::kNoPosition),
2236 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002237 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002238
2239 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002240 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002241
2242 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002243#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002244 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2245#undef DECLARE_DO
2246
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002247 private:
2248 enum Status {
2249 UNUSED,
2250 BUILDING,
2251 DONE,
2252 ABORTED
2253 };
2254
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002255 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002256 CompilationInfo* info() const { return info_; }
2257 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002258 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002259
2260 bool is_unused() const { return status_ == UNUSED; }
2261 bool is_building() const { return status_ == BUILDING; }
2262 bool is_done() const { return status_ == DONE; }
2263 bool is_aborted() const { return status_ == ABORTED; }
2264
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002265 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002266
2267 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002268 LUnallocated* ToUnallocated(Register reg);
2269 LUnallocated* ToUnallocated(DoubleRegister reg);
2270
2271 // Methods for setting up define-use relationships.
2272 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2273 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2274 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2275 DoubleRegister fixed_register);
2276
2277 // A value that is guaranteed to be allocated to a register.
2278 // Operand created by UseRegister is guaranteed to be live until the end of
2279 // instruction. This means that register allocator will not reuse it's
2280 // register for any other operand inside instruction.
2281 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2282 // instruction start. Register allocator is free to assign the same register
2283 // to some other operand used inside instruction (i.e. temporary or
2284 // output).
2285 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2286 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2287
2288 // An input operand in a register that may be trashed.
2289 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2290
2291 // An input operand in a register or stack slot.
2292 MUST_USE_RESULT LOperand* Use(HValue* value);
2293 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2294
2295 // An input operand in a register, stack slot or a constant operand.
2296 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2297 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2298
2299 // An input operand in a register or a constant operand.
2300 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2301 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2302
2303 // An input operand in register, stack slot or a constant operand.
2304 // Will not be moved to a register even if one is freely available.
2305 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2306
2307 // Temporary operand that must be in a register.
2308 MUST_USE_RESULT LUnallocated* TempRegister();
2309 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2310 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2311
2312 // Methods for setting up define-use relationships.
2313 // Return the same instruction that they are passed.
2314 template<int I, int T>
2315 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2316 LUnallocated* result);
2317 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002318 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2319 template<int I, int T>
2320 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2321 int index);
2322 template<int I, int T>
2323 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2324 template<int I, int T>
2325 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2326 Register reg);
2327 template<int I, int T>
2328 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2329 DoubleRegister reg);
2330 LInstruction* AssignEnvironment(LInstruction* instr);
2331 LInstruction* AssignPointerMap(LInstruction* instr);
2332
2333 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2334
2335 // By default we assume that instruction sequences generated for calls
2336 // cannot deoptimize eagerly and we do not attach environment to this
2337 // instruction.
2338 LInstruction* MarkAsCall(
2339 LInstruction* instr,
2340 HInstruction* hinstr,
2341 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002342
2343 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2344 int* argument_index_accumulator);
2345
2346 void VisitInstruction(HInstruction* current);
2347
2348 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2349 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2350 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2351 LInstruction* DoArithmeticD(Token::Value op,
2352 HArithmeticBinaryOperation* instr);
2353 LInstruction* DoArithmeticT(Token::Value op,
2354 HArithmeticBinaryOperation* instr);
2355
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002356 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002357 CompilationInfo* info_;
2358 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002359 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002360 Status status_;
2361 HInstruction* current_instruction_;
2362 HBasicBlock* current_block_;
2363 HBasicBlock* next_block_;
2364 int argument_count_;
2365 LAllocator* allocator_;
2366 int position_;
2367 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002368 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002369
lrn@chromium.org7516f052011-03-30 08:52:27 +00002370 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2371};
2372
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002373#undef DECLARE_HYDROGEN_ACCESSOR
2374#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002375
2376} } // namespace v8::internal
2377
2378#endif // V8_MIPS_LITHIUM_MIPS_H_