blob: 17ef24cb1a5d3c0d23f7900dd024118550185563 [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) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000111 V(Uint32ToDouble) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000112 V(InvokeFunction) \
113 V(IsConstructCallAndBranch) \
114 V(IsNilAndBranch) \
115 V(IsObjectAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000116 V(IsStringAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000117 V(IsSmiAndBranch) \
118 V(IsUndetectableAndBranch) \
119 V(JSArrayLength) \
120 V(Label) \
121 V(LazyBailout) \
122 V(LoadContextSlot) \
123 V(LoadElements) \
124 V(LoadExternalArrayPointer) \
125 V(LoadFunctionPrototype) \
126 V(LoadGlobalCell) \
127 V(LoadGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000128 V(LoadKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000129 V(LoadKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000130 V(LoadNamedField) \
131 V(LoadNamedFieldPolymorphic) \
132 V(LoadNamedGeneric) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000133 V(MapEnumLength) \
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000134 V(MathExp) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000135 V(MathMinMax) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000136 V(ModI) \
137 V(MulI) \
138 V(NumberTagD) \
139 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000140 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000141 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000142 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000143 V(OsrEntry) \
144 V(OuterContext) \
145 V(Parameter) \
146 V(Power) \
147 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000148 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000149 V(RegExpLiteral) \
150 V(Return) \
151 V(ShiftI) \
152 V(SmiTag) \
153 V(SmiUntag) \
154 V(StackCheck) \
155 V(StoreContextSlot) \
156 V(StoreGlobalCell) \
157 V(StoreGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000158 V(StoreKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000159 V(StoreKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000160 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 LOperand* FirstInput() { return InputAt(0); }
260 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000261
262#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000263 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000264#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000265
266 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000267 // Iterator interface.
268 friend class InputIterator;
269 virtual int InputCount() = 0;
270 virtual LOperand* InputAt(int i) = 0;
271
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000272 friend class TempIterator;
273 virtual int TempCount() = 0;
274 virtual LOperand* TempAt(int i) = 0;
275
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000276 LEnvironment* environment_;
277 SetOncePointer<LPointerMap> pointer_map_;
278 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000279 bool is_call_;
280 bool is_save_doubles_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000281};
282
283
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000284// R = number of result operands (0 or 1).
285// I = number of input operands.
286// T = number of temporary operands.
287template<int R, int I, int T>
288class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000289 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000290 // Allow 0 or 1 output operands.
291 STATIC_ASSERT(R == 0 || R == 1);
292 virtual bool HasResult() const { return R != 0; }
293 void set_result(LOperand* operand) { results_[0] = operand; }
294 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000295
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000296 protected:
297 EmbeddedContainer<LOperand*, R> results_;
298 EmbeddedContainer<LOperand*, I> inputs_;
299 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000300
301 private:
302 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000303 virtual LOperand* InputAt(int i) { return inputs_[i]; }
304
305 virtual int TempCount() { return T; }
306 virtual LOperand* TempAt(int i) { return temps_[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
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000524 LOperand* elements() { return inputs_[0]; }
525
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000526 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
527};
528
529
530class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
531 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000532 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000533 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000534};
535
536
537class LModI: public LTemplateInstruction<1, 2, 3> {
538 public:
539 // Used when the right hand is a constant power of 2.
540 LModI(LOperand* left,
541 LOperand* right) {
542 inputs_[0] = left;
543 inputs_[1] = right;
544 temps_[0] = NULL;
545 temps_[1] = NULL;
546 temps_[2] = NULL;
547 }
548
549 // Used for the standard case.
550 LModI(LOperand* left,
551 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000552 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000553 LOperand* temp2,
554 LOperand* temp3) {
555 inputs_[0] = left;
556 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000557 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000558 temps_[1] = temp2;
559 temps_[2] = temp3;
560 }
561
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000562 LOperand* left() { return inputs_[0]; }
563 LOperand* right() { return inputs_[1]; }
564 LOperand* temp() { return temps_[0]; }
565 LOperand* temp2() { return temps_[1]; }
566 LOperand* temp3() { return temps_[2]; }
567
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000568 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
569 DECLARE_HYDROGEN_ACCESSOR(Mod)
570};
571
572
573class LDivI: public LTemplateInstruction<1, 2, 0> {
574 public:
575 LDivI(LOperand* left, LOperand* right) {
576 inputs_[0] = left;
577 inputs_[1] = right;
578 }
579
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000580 LOperand* left() { return inputs_[0]; }
581 LOperand* right() { return inputs_[1]; }
582
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000583 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
584 DECLARE_HYDROGEN_ACCESSOR(Div)
585};
586
587
588class LMulI: public LTemplateInstruction<1, 2, 1> {
589 public:
590 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
591 inputs_[0] = left;
592 inputs_[1] = right;
593 temps_[0] = temp;
594 }
595
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000596 LOperand* left() { return inputs_[0]; }
597 LOperand* right() { return inputs_[1]; }
598 LOperand* temp() { return temps_[0]; }
599
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000600 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
601 DECLARE_HYDROGEN_ACCESSOR(Mul)
602};
603
604
605class LCmpIDAndBranch: public LControlInstruction<2, 0> {
606 public:
607 LCmpIDAndBranch(LOperand* left, LOperand* right) {
608 inputs_[0] = left;
609 inputs_[1] = right;
610 }
611
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000612 LOperand* left() { return inputs_[0]; }
613 LOperand* right() { return inputs_[1]; }
614
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000615 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
616 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
617
618 Token::Value op() const { return hydrogen()->token(); }
619 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000620 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000621 }
622
623 virtual void PrintDataTo(StringStream* stream);
624};
625
626
627class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
628 public:
629 LUnaryMathOperation(LOperand* value, LOperand* temp) {
630 inputs_[0] = value;
631 temps_[0] = temp;
632 }
633
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000634 LOperand* value() { return inputs_[0]; }
635 LOperand* temp() { return temps_[0]; }
636
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000637 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
638 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
639
640 virtual void PrintDataTo(StringStream* stream);
641 BuiltinFunctionId op() const { return hydrogen()->op(); }
642};
643
644
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000645class LMathExp: public LTemplateInstruction<1, 1, 3> {
646 public:
647 LMathExp(LOperand* value,
648 LOperand* double_temp,
649 LOperand* temp1,
650 LOperand* temp2) {
651 inputs_[0] = value;
652 temps_[0] = temp1;
653 temps_[1] = temp2;
654 temps_[2] = double_temp;
655 ExternalReference::InitializeMathExpData();
656 }
657
658 LOperand* value() { return inputs_[0]; }
659 LOperand* temp1() { return temps_[0]; }
660 LOperand* temp2() { return temps_[1]; }
661 LOperand* double_temp() { return temps_[2]; }
662
663 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
664
665 virtual void PrintDataTo(StringStream* stream);
666};
667
668
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000669class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
670 public:
671 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
672 inputs_[0] = left;
673 inputs_[1] = right;
674 }
675
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000676 LOperand* left() { return inputs_[0]; }
677 LOperand* right() { return inputs_[1]; }
678
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000679 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
680 "cmp-object-eq-and-branch")
681 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
682};
683
684
685class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
686 public:
687 explicit LCmpConstantEqAndBranch(LOperand* left) {
688 inputs_[0] = left;
689 }
690
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000691 LOperand* left() { return inputs_[0]; }
692
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000693 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
694 "cmp-constant-eq-and-branch")
695 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
696};
697
698
699class LIsNilAndBranch: public LControlInstruction<1, 0> {
700 public:
701 explicit LIsNilAndBranch(LOperand* value) {
702 inputs_[0] = value;
703 }
704
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000705 LOperand* value() { return inputs_[0]; }
706
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000707 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
708 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
709
710 EqualityKind kind() const { return hydrogen()->kind(); }
711 NilValue nil() const { return hydrogen()->nil(); }
712
713 virtual void PrintDataTo(StringStream* stream);
714};
715
716
717class LIsObjectAndBranch: public LControlInstruction<1, 1> {
718 public:
719 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
720 inputs_[0] = value;
721 temps_[0] = temp;
722 }
723
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000724 LOperand* value() { return inputs_[0]; }
725 LOperand* temp() { return temps_[0]; }
726
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000727 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
728 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
729
730 virtual void PrintDataTo(StringStream* stream);
731};
732
733
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000734class LIsStringAndBranch: public LControlInstruction<1, 1> {
735 public:
736 LIsStringAndBranch(LOperand* value, LOperand* temp) {
737 inputs_[0] = value;
738 temps_[0] = temp;
739 }
740
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000741 LOperand* value() { return inputs_[0]; }
742 LOperand* temp() { return temps_[0]; }
743
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000744 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
745 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
746
747 virtual void PrintDataTo(StringStream* stream);
748};
749
750
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000751class LIsSmiAndBranch: public LControlInstruction<1, 0> {
752 public:
753 explicit LIsSmiAndBranch(LOperand* value) {
754 inputs_[0] = value;
755 }
756
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000757 LOperand* value() { return inputs_[0]; }
758
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000759 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
760 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
761
762 virtual void PrintDataTo(StringStream* stream);
763};
764
765
766class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
767 public:
768 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
769 inputs_[0] = value;
770 temps_[0] = temp;
771 }
772
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000773 LOperand* value() { return inputs_[0]; }
774 LOperand* temp() { return temps_[0]; }
775
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000776 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
777 "is-undetectable-and-branch")
778 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
779
780 virtual void PrintDataTo(StringStream* stream);
781};
782
783
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000784class LStringCompareAndBranch: public LControlInstruction<2, 0> {
785 public:
786 LStringCompareAndBranch(LOperand* left, LOperand* right) {
787 inputs_[0] = left;
788 inputs_[1] = right;
789 }
790
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000791 LOperand* left() { return inputs_[0]; }
792 LOperand* right() { return inputs_[1]; }
793
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000794 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
795 "string-compare-and-branch")
796 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
797
798 Token::Value op() const { return hydrogen()->token(); }
799
800 virtual void PrintDataTo(StringStream* stream);
801};
802
803
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000804class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
805 public:
806 explicit LHasInstanceTypeAndBranch(LOperand* value) {
807 inputs_[0] = value;
808 }
809
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000810 LOperand* value() { return inputs_[0]; }
811
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000812 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
813 "has-instance-type-and-branch")
814 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
815
816 virtual void PrintDataTo(StringStream* stream);
817};
818
819
820class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
821 public:
822 explicit LGetCachedArrayIndex(LOperand* value) {
823 inputs_[0] = value;
824 }
825
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000826 LOperand* value() { return inputs_[0]; }
827
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000828 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
829 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
830};
831
832
833class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
834 public:
835 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
836 inputs_[0] = value;
837 }
838
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000839 LOperand* value() { return inputs_[0]; }
840
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000841 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
842 "has-cached-array-index-and-branch")
843 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
844
845 virtual void PrintDataTo(StringStream* stream);
846};
847
848
849class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
850 public:
851 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
852 inputs_[0] = value;
853 temps_[0] = temp;
854 }
855
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000856 LOperand* value() { return inputs_[0]; }
857 LOperand* temp() { return temps_[0]; }
858
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000859 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
860 "class-of-test-and-branch")
861 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
862
863 virtual void PrintDataTo(StringStream* stream);
864};
865
866
867class LCmpT: public LTemplateInstruction<1, 2, 0> {
868 public:
869 LCmpT(LOperand* left, LOperand* right) {
870 inputs_[0] = left;
871 inputs_[1] = right;
872 }
873
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000874 LOperand* left() { return inputs_[0]; }
875 LOperand* right() { return inputs_[1]; }
876
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000877 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
878 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
879
880 Token::Value op() const { return hydrogen()->token(); }
881};
882
883
884class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
885 public:
886 LInstanceOf(LOperand* left, LOperand* right) {
887 inputs_[0] = left;
888 inputs_[1] = right;
889 }
890
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000891 LOperand* left() { return inputs_[0]; }
892 LOperand* right() { return inputs_[1]; }
893
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000894 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
895};
896
897
898class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
899 public:
900 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
901 inputs_[0] = value;
902 temps_[0] = temp;
903 }
904
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000905 LOperand* value() { return inputs_[0]; }
906 LOperand* temp() { return temps_[0]; }
907
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000908 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
909 "instance-of-known-global")
910 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
911
912 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000913 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
914 return lazy_deopt_env_;
915 }
916 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
917 lazy_deopt_env_ = env;
918 }
919
920 private:
921 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000922};
923
924
925class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
926 public:
927 LBoundsCheck(LOperand* index, LOperand* length) {
928 inputs_[0] = index;
929 inputs_[1] = length;
930 }
931
932 LOperand* index() { return inputs_[0]; }
933 LOperand* length() { return inputs_[1]; }
934
935 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +0000936 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000937};
938
939
940class LBitI: public LTemplateInstruction<1, 2, 0> {
941 public:
942 LBitI(LOperand* left, LOperand* right) {
943 inputs_[0] = left;
944 inputs_[1] = right;
945 }
946
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000947 LOperand* left() { return inputs_[0]; }
948 LOperand* right() { return inputs_[1]; }
949
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000950 Token::Value op() const { return hydrogen()->op(); }
951
952 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
953 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
954};
955
956
957class LShiftI: public LTemplateInstruction<1, 2, 0> {
958 public:
959 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
960 : op_(op), can_deopt_(can_deopt) {
961 inputs_[0] = left;
962 inputs_[1] = right;
963 }
964
965 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000966 LOperand* left() { return inputs_[0]; }
967 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000968 bool can_deopt() const { return can_deopt_; }
969
970 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
971
972 private:
973 Token::Value op_;
974 bool can_deopt_;
975};
976
977
978class LSubI: public LTemplateInstruction<1, 2, 0> {
979 public:
980 LSubI(LOperand* left, LOperand* right) {
981 inputs_[0] = left;
982 inputs_[1] = right;
983 }
984
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000985 LOperand* left() { return inputs_[0]; }
986 LOperand* right() { return inputs_[1]; }
987
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000988 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
989 DECLARE_HYDROGEN_ACCESSOR(Sub)
990};
991
992
993class LConstantI: public LTemplateInstruction<1, 0, 0> {
994 public:
995 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
996 DECLARE_HYDROGEN_ACCESSOR(Constant)
997
998 int32_t value() const { return hydrogen()->Integer32Value(); }
999};
1000
1001
1002class LConstantD: public LTemplateInstruction<1, 0, 0> {
1003 public:
1004 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1005 DECLARE_HYDROGEN_ACCESSOR(Constant)
1006
1007 double value() const { return hydrogen()->DoubleValue(); }
1008};
1009
1010
1011class LConstantT: public LTemplateInstruction<1, 0, 0> {
1012 public:
1013 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1014 DECLARE_HYDROGEN_ACCESSOR(Constant)
1015
1016 Handle<Object> value() const { return hydrogen()->handle(); }
1017};
1018
1019
1020class LBranch: public LControlInstruction<1, 0> {
1021 public:
1022 explicit LBranch(LOperand* value) {
1023 inputs_[0] = value;
1024 }
1025
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001026 LOperand* value() { return inputs_[0]; }
1027
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001028 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1029 DECLARE_HYDROGEN_ACCESSOR(Branch)
1030
1031 virtual void PrintDataTo(StringStream* stream);
1032};
1033
1034
1035class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1036 public:
1037 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1038 inputs_[0] = value;
1039 temps_[0] = temp;
1040 }
1041
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001042 LOperand* value() { return inputs_[0]; }
1043 LOperand* temp() { return temps_[0]; }
1044
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001045 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1046 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1047
1048 virtual bool IsControl() const { return true; }
1049
1050 Handle<Map> map() const { return hydrogen()->map(); }
1051 int true_block_id() const {
1052 return hydrogen()->FirstSuccessor()->block_id();
1053 }
1054 int false_block_id() const {
1055 return hydrogen()->SecondSuccessor()->block_id();
1056 }
1057};
1058
1059
1060class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
1061 public:
1062 explicit LJSArrayLength(LOperand* value) {
1063 inputs_[0] = value;
1064 }
1065
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001066 LOperand* value() { return inputs_[0]; }
1067
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001068 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
1069 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
1070};
1071
1072
1073class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1074 public:
1075 explicit LFixedArrayBaseLength(LOperand* value) {
1076 inputs_[0] = value;
1077 }
1078
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001079 LOperand* value() { return inputs_[0]; }
1080
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001081 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1082 "fixed-array-base-length")
1083 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1084};
1085
1086
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001087class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1088 public:
1089 explicit LMapEnumLength(LOperand* value) {
1090 inputs_[0] = value;
1091 }
1092
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001093 LOperand* value() { return inputs_[0]; }
1094
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001095 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1096};
1097
1098
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001099class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1100 public:
1101 explicit LElementsKind(LOperand* value) {
1102 inputs_[0] = value;
1103 }
1104
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001105 LOperand* value() { return inputs_[0]; }
1106
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001107 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1108 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1109};
1110
1111
1112class LValueOf: public LTemplateInstruction<1, 1, 1> {
1113 public:
1114 LValueOf(LOperand* value, LOperand* temp) {
1115 inputs_[0] = value;
1116 temps_[0] = temp;
1117 }
1118
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001119 LOperand* value() { return inputs_[0]; }
1120 LOperand* temp() { return temps_[0]; }
1121
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001122 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1123 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1124};
1125
1126
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001127class LDateField: public LTemplateInstruction<1, 1, 1> {
1128 public:
1129 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1130 inputs_[0] = date;
1131 temps_[0] = temp;
1132 }
1133
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001134 LOperand* date() { return inputs_[0]; }
1135 LOperand* temp() { return temps_[0]; }
1136 Smi* index() const { return index_; }
1137
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001138 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1139 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001140
1141 private:
1142 Smi* index_;
1143};
1144
1145
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001146class LThrow: public LTemplateInstruction<0, 1, 0> {
1147 public:
1148 explicit LThrow(LOperand* value) {
1149 inputs_[0] = value;
1150 }
1151
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001152 LOperand* value() { return inputs_[0]; }
1153
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001154 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1155};
1156
1157
1158class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1159 public:
1160 explicit LBitNotI(LOperand* value) {
1161 inputs_[0] = value;
1162 }
1163
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001164 LOperand* value() { return inputs_[0]; }
1165
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001166 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1167};
1168
1169
1170class LAddI: public LTemplateInstruction<1, 2, 0> {
1171 public:
1172 LAddI(LOperand* left, LOperand* right) {
1173 inputs_[0] = left;
1174 inputs_[1] = right;
1175 }
1176
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001177 LOperand* left() { return inputs_[0]; }
1178 LOperand* right() { return inputs_[1]; }
1179
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001180 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1181 DECLARE_HYDROGEN_ACCESSOR(Add)
1182};
1183
1184
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001185class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1186 public:
1187 LMathMinMax(LOperand* left, LOperand* right) {
1188 inputs_[0] = left;
1189 inputs_[1] = right;
1190 }
1191
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001192 LOperand* left() { return inputs_[0]; }
1193 LOperand* right() { return inputs_[1]; }
1194
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001195 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max")
1196 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1197};
1198
1199
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001200class LPower: public LTemplateInstruction<1, 2, 0> {
1201 public:
1202 LPower(LOperand* left, LOperand* right) {
1203 inputs_[0] = left;
1204 inputs_[1] = right;
1205 }
1206
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001207 LOperand* left() { return inputs_[0]; }
1208 LOperand* right() { return inputs_[1]; }
1209
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001210 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1211 DECLARE_HYDROGEN_ACCESSOR(Power)
1212};
1213
1214
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001215class LRandom: public LTemplateInstruction<1, 1, 0> {
1216 public:
1217 explicit LRandom(LOperand* global_object) {
1218 inputs_[0] = global_object;
1219 }
1220
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001221 LOperand* global_object() { return inputs_[0]; }
1222
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001223 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1224 DECLARE_HYDROGEN_ACCESSOR(Random)
1225};
1226
1227
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001228class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1229 public:
1230 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1231 : op_(op) {
1232 inputs_[0] = left;
1233 inputs_[1] = right;
1234 }
1235
1236 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001237 LOperand* left() { return inputs_[0]; }
1238 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001239
1240 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1241 virtual void CompileToNative(LCodeGen* generator);
1242 virtual const char* Mnemonic() const;
1243
1244 private:
1245 Token::Value op_;
1246};
1247
1248
1249class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1250 public:
1251 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1252 : op_(op) {
1253 inputs_[0] = left;
1254 inputs_[1] = right;
1255 }
1256
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001257 LOperand* left() { return inputs_[0]; }
1258 LOperand* right() { return inputs_[1]; }
1259 Token::Value op() const { return op_; }
1260
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001261 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1262 virtual void CompileToNative(LCodeGen* generator);
1263 virtual const char* Mnemonic() const;
1264
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001265 private:
1266 Token::Value op_;
1267};
1268
1269
1270class LReturn: public LTemplateInstruction<0, 1, 0> {
1271 public:
1272 explicit LReturn(LOperand* value) {
1273 inputs_[0] = value;
1274 }
1275
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001276 LOperand* value() { return inputs_[0]; }
1277
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001278 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1279};
1280
1281
1282class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1283 public:
1284 explicit LLoadNamedField(LOperand* object) {
1285 inputs_[0] = object;
1286 }
1287
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001288 LOperand* object() { return inputs_[0]; }
1289
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001290 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1291 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1292};
1293
1294
1295class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1296 public:
1297 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1298 inputs_[0] = object;
1299 }
1300
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001301 LOperand* object() { return inputs_[0]; }
1302
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001303 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1304 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001305};
1306
1307
1308class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1309 public:
1310 explicit LLoadNamedGeneric(LOperand* object) {
1311 inputs_[0] = object;
1312 }
1313
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001314 LOperand* object() { return inputs_[0]; }
1315
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001316 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1317 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1318
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001319 Handle<Object> name() const { return hydrogen()->name(); }
1320};
1321
1322
1323class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1324 public:
1325 explicit LLoadFunctionPrototype(LOperand* function) {
1326 inputs_[0] = function;
1327 }
1328
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001329 LOperand* function() { return inputs_[0]; }
1330
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001331 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1332 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001333};
1334
1335
1336class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1337 public:
1338 explicit LLoadElements(LOperand* object) {
1339 inputs_[0] = object;
1340 }
1341
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001342 LOperand* object() { return inputs_[0]; }
1343
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001344 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1345};
1346
1347
1348class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1349 public:
1350 explicit LLoadExternalArrayPointer(LOperand* object) {
1351 inputs_[0] = object;
1352 }
1353
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001354 LOperand* object() { return inputs_[0]; }
1355
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001356 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1357 "load-external-array-pointer")
1358};
1359
1360
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001361class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001362 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001363 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001364 inputs_[0] = elements;
1365 inputs_[1] = key;
1366 }
1367
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001368 LOperand* elements() { return inputs_[0]; }
1369 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001370 ElementsKind elements_kind() const {
1371 return hydrogen()->elements_kind();
1372 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001373 bool is_external() const {
1374 return hydrogen()->is_external();
1375 }
1376
1377 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1378 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1379
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001380 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001381 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001382};
1383
1384
1385class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1386 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001387 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1388 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001389 inputs_[1] = key;
1390 }
1391
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001392 LOperand* object() { return inputs_[0]; }
1393 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001394
1395 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001396};
1397
1398
1399class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1400 public:
1401 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1402 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1403};
1404
1405
1406class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1407 public:
1408 explicit LLoadGlobalGeneric(LOperand* global_object) {
1409 inputs_[0] = global_object;
1410 }
1411
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001412 LOperand* global_object() { return inputs_[0]; }
1413
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001414 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1415 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1416
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001417 Handle<Object> name() const { return hydrogen()->name(); }
1418 bool for_typeof() const { return hydrogen()->for_typeof(); }
1419};
1420
1421
1422class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1423 public:
1424 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1425 inputs_[0] = value;
1426 temps_[0] = temp;
1427 }
1428
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001429 LOperand* value() { return inputs_[0]; }
1430 LOperand* temp() { return temps_[0]; }
1431
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001432 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1433 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1434};
1435
1436
1437class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1438 public:
1439 explicit LStoreGlobalGeneric(LOperand* global_object,
1440 LOperand* value) {
1441 inputs_[0] = global_object;
1442 inputs_[1] = value;
1443 }
1444
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001445 LOperand* global_object() { return inputs_[0]; }
1446 LOperand* value() { return inputs_[1]; }
1447
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001448 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1449 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1450
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001451 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001452 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001453};
1454
1455
1456class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1457 public:
1458 explicit LLoadContextSlot(LOperand* context) {
1459 inputs_[0] = context;
1460 }
1461
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001462 LOperand* context() { return inputs_[0]; }
1463
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001464 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1465 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1466
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001467 int slot_index() { return hydrogen()->slot_index(); }
1468
1469 virtual void PrintDataTo(StringStream* stream);
1470};
1471
1472
1473class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1474 public:
1475 LStoreContextSlot(LOperand* context, LOperand* value) {
1476 inputs_[0] = context;
1477 inputs_[1] = value;
1478 }
1479
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001480 LOperand* context() { return inputs_[0]; }
1481 LOperand* value() { return inputs_[1]; }
1482
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001483 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1484 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1485
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001486 int slot_index() { return hydrogen()->slot_index(); }
1487
1488 virtual void PrintDataTo(StringStream* stream);
1489};
1490
1491
1492class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1493 public:
1494 explicit LPushArgument(LOperand* value) {
1495 inputs_[0] = value;
1496 }
1497
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001498 LOperand* value() { return inputs_[0]; }
1499
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001500 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1501};
1502
1503
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001504class LDrop: public LTemplateInstruction<0, 0, 0> {
1505 public:
1506 explicit LDrop(int count) : count_(count) { }
1507
1508 int count() const { return count_; }
1509
1510 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1511
1512 private:
1513 int count_;
1514};
1515
1516
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001517class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1518 public:
1519 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1520 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1521};
1522
1523
1524class LContext: public LTemplateInstruction<1, 0, 0> {
1525 public:
1526 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1527};
1528
1529
1530class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1531 public:
1532 explicit LOuterContext(LOperand* context) {
1533 inputs_[0] = context;
1534 }
1535
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001536 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001537
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001538 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001539};
1540
1541
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001542class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1543 public:
1544 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1545 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1546};
1547
1548
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001549class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1550 public:
1551 explicit LGlobalObject(LOperand* context) {
1552 inputs_[0] = context;
1553 }
1554
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001555 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001556
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001557 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001558};
1559
1560
1561class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1562 public:
1563 explicit LGlobalReceiver(LOperand* global_object) {
1564 inputs_[0] = global_object;
1565 }
1566
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001567 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001568
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001569 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001570};
1571
1572
1573class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1574 public:
1575 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1576 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1577
1578 virtual void PrintDataTo(StringStream* stream);
1579
1580 Handle<JSFunction> function() { return hydrogen()->function(); }
1581 int arity() const { return hydrogen()->argument_count() - 1; }
1582};
1583
1584
1585class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1586 public:
1587 explicit LInvokeFunction(LOperand* function) {
1588 inputs_[0] = function;
1589 }
1590
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001591 LOperand* function() { return inputs_[0]; }
1592
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001593 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1594 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1595
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001596 virtual void PrintDataTo(StringStream* stream);
1597
1598 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001599 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001600};
1601
1602
1603class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1604 public:
1605 explicit LCallKeyed(LOperand* key) {
1606 inputs_[0] = key;
1607 }
1608
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001609 LOperand* key() { return inputs_[0]; }
1610
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001611 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1612 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1613
1614 virtual void PrintDataTo(StringStream* stream);
1615
1616 int arity() const { return hydrogen()->argument_count() - 1; }
1617};
1618
1619
1620
1621class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1622 public:
1623 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1624 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1625
1626 virtual void PrintDataTo(StringStream* stream);
1627
1628 Handle<String> name() const { return hydrogen()->name(); }
1629 int arity() const { return hydrogen()->argument_count() - 1; }
1630};
1631
1632
danno@chromium.orgc612e022011-11-10 11:38:15 +00001633class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001634 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001635 explicit LCallFunction(LOperand* function) {
1636 inputs_[0] = function;
1637 }
1638
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001639 LOperand* function() { return inputs_[0]; }
1640
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001641 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1642 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1643
danno@chromium.orgc612e022011-11-10 11:38:15 +00001644 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001645};
1646
1647
1648class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1649 public:
1650 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1651 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1652
1653 virtual void PrintDataTo(StringStream* stream);
1654
1655 Handle<String> name() const {return hydrogen()->name(); }
1656 int arity() const { return hydrogen()->argument_count() - 1; }
1657};
1658
1659
1660class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1661 public:
1662 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1663 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1664
1665 virtual void PrintDataTo(StringStream* stream);
1666
1667 Handle<JSFunction> target() const { return hydrogen()->target(); }
1668 int arity() const { return hydrogen()->argument_count() - 1; }
1669};
1670
1671
1672class LCallNew: public LTemplateInstruction<1, 1, 0> {
1673 public:
1674 explicit LCallNew(LOperand* constructor) {
1675 inputs_[0] = constructor;
1676 }
1677
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001678 LOperand* constructor() { return inputs_[0]; }
1679
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001680 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1681 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1682
1683 virtual void PrintDataTo(StringStream* stream);
1684
1685 int arity() const { return hydrogen()->argument_count() - 1; }
1686};
1687
1688
1689class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1690 public:
1691 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1692 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1693
1694 const Runtime::Function* function() const { return hydrogen()->function(); }
1695 int arity() const { return hydrogen()->argument_count(); }
1696};
1697
1698
1699class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1700 public:
1701 explicit LInteger32ToDouble(LOperand* value) {
1702 inputs_[0] = value;
1703 }
1704
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001705 LOperand* value() { return inputs_[0]; }
1706
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001707 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1708};
1709
1710
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001711class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1712 public:
1713 explicit LUint32ToDouble(LOperand* value) {
1714 inputs_[0] = value;
1715 }
1716
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001717 LOperand* value() { return inputs_[0]; }
1718
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001719 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1720};
1721
1722
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001723class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1724 public:
1725 explicit LNumberTagI(LOperand* value) {
1726 inputs_[0] = value;
1727 }
1728
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001729 LOperand* value() { return inputs_[0]; }
1730
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001731 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1732};
1733
1734
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001735class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1736 public:
1737 explicit LNumberTagU(LOperand* value) {
1738 inputs_[0] = value;
1739 }
1740
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001741 LOperand* value() { return inputs_[0]; }
1742
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001743 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1744};
1745
1746
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001747class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1748 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001749 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001750 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001751 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001752 temps_[1] = temp2;
1753 }
1754
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001755 LOperand* value() { return inputs_[0]; }
1756 LOperand* temp() { return temps_[0]; }
1757 LOperand* temp2() { return temps_[1]; }
1758
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001759 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1760};
1761
1762
1763// Sometimes truncating conversion from a tagged value to an int32.
1764class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1765 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001766 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001767 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001768 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001769 temps_[1] = temp2;
1770 }
1771
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001772 LOperand* value() { return inputs_[0]; }
1773 LOperand* temp() { return temps_[0]; }
1774 LOperand* temp2() { return temps_[1]; }
1775
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001776 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1777 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1778
1779 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1780};
1781
1782
1783// Truncating conversion from a tagged value to an int32.
1784class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1785 public:
1786 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001787 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001788 LOperand* temp2,
1789 LOperand* temp3) {
1790 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001791 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001792 temps_[1] = temp2;
1793 temps_[2] = temp3;
1794 }
1795
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001796 LOperand* value() { return inputs_[0]; }
1797 LOperand* temp() { return temps_[0]; }
1798 LOperand* temp2() { return temps_[1]; }
1799 LOperand* temp3() { return temps_[2]; }
1800
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001801 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1802 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1803
1804 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1805};
1806
1807
1808class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1809 public:
1810 explicit LSmiTag(LOperand* value) {
1811 inputs_[0] = value;
1812 }
1813
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001814 LOperand* value() { return inputs_[0]; }
1815
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001816 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1817};
1818
1819
1820class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1821 public:
1822 explicit LNumberUntagD(LOperand* value) {
1823 inputs_[0] = value;
1824 }
1825
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001826 LOperand* value() { return inputs_[0]; }
1827
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001828 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1829 DECLARE_HYDROGEN_ACCESSOR(Change)
1830};
1831
1832
1833class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1834 public:
1835 LSmiUntag(LOperand* value, bool needs_check)
1836 : needs_check_(needs_check) {
1837 inputs_[0] = value;
1838 }
1839
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001840 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001841 bool needs_check() const { return needs_check_; }
1842
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001843 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1844
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001845 private:
1846 bool needs_check_;
1847};
1848
1849
verwaest@chromium.org37141392012-05-31 13:27:02 +00001850class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001851 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001852 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
1853 inputs_[0] = object;
1854 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001855 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001856 }
1857
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001858 LOperand* object() { return inputs_[0]; }
1859 LOperand* value() { return inputs_[1]; }
1860 LOperand* temp() { return temps_[0]; }
1861
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001862 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1863 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1864
1865 virtual void PrintDataTo(StringStream* stream);
1866
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001867 Handle<Object> name() const { return hydrogen()->name(); }
1868 bool is_in_object() { return hydrogen()->is_in_object(); }
1869 int offset() { return hydrogen()->offset(); }
1870 Handle<Map> transition() const { return hydrogen()->transition(); }
1871};
1872
1873
1874class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1875 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001876 LStoreNamedGeneric(LOperand* object, LOperand* value) {
1877 inputs_[0] = object;
1878 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001879 }
1880
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001881 LOperand* object() { return inputs_[0]; }
1882 LOperand* value() { return inputs_[1]; }
1883
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001884 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1885 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1886
1887 virtual void PrintDataTo(StringStream* stream);
1888
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001889 Handle<Object> name() const { return hydrogen()->name(); }
1890 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001891};
1892
1893
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001894class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001895 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001896 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001897 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001898 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001899 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001900 }
1901
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001902 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001903 LOperand* elements() { return inputs_[0]; }
1904 LOperand* key() { return inputs_[1]; }
1905 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001906 ElementsKind elements_kind() const {
1907 return hydrogen()->elements_kind();
1908 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001909
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001910 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
1911 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001912
1913 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001914 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001915 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001916};
1917
1918
1919class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1920 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001921 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001922 inputs_[0] = obj;
1923 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001924 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001925 }
1926
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001927 LOperand* object() { return inputs_[0]; }
1928 LOperand* key() { return inputs_[1]; }
1929 LOperand* value() { return inputs_[2]; }
1930
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001931 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1932 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1933
1934 virtual void PrintDataTo(StringStream* stream);
1935
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001936 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001937};
1938
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001939
1940class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1941 public:
1942 LTransitionElementsKind(LOperand* object,
1943 LOperand* new_map_temp,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001944 LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001945 inputs_[0] = object;
1946 temps_[0] = new_map_temp;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001947 temps_[1] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001948 }
1949
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001950 LOperand* object() { return inputs_[0]; }
1951 LOperand* new_map_temp() { return temps_[0]; }
1952 LOperand* temp() { return temps_[1]; }
1953
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001954 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1955 "transition-elements-kind")
1956 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1957
1958 virtual void PrintDataTo(StringStream* stream);
1959
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001960 Handle<Map> original_map() { return hydrogen()->original_map(); }
1961 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
1962};
1963
1964
1965class LStringAdd: public LTemplateInstruction<1, 2, 0> {
1966 public:
1967 LStringAdd(LOperand* left, LOperand* right) {
1968 inputs_[0] = left;
1969 inputs_[1] = right;
1970 }
1971
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001972 LOperand* left() { return inputs_[0]; }
1973 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001974
1975 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1976 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001977};
1978
1979
1980
1981class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
1982 public:
1983 LStringCharCodeAt(LOperand* string, LOperand* index) {
1984 inputs_[0] = string;
1985 inputs_[1] = index;
1986 }
1987
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001988 LOperand* string() { return inputs_[0]; }
1989 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001990
1991 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1992 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001993};
1994
1995
1996class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
1997 public:
1998 explicit LStringCharFromCode(LOperand* char_code) {
1999 inputs_[0] = char_code;
2000 }
2001
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002002 LOperand* char_code() { return inputs_[0]; }
2003
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002004 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2005 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002006};
2007
2008
2009class LStringLength: public LTemplateInstruction<1, 1, 0> {
2010 public:
2011 explicit LStringLength(LOperand* string) {
2012 inputs_[0] = string;
2013 }
2014
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002015 LOperand* string() { return inputs_[0]; }
2016
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002017 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2018 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002019};
2020
2021
2022class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2023 public:
2024 explicit LCheckFunction(LOperand* value) {
2025 inputs_[0] = value;
2026 }
2027
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002028 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002029
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002030 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2031 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2032};
2033
2034
2035class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2036 public:
2037 explicit LCheckInstanceType(LOperand* value) {
2038 inputs_[0] = value;
2039 }
2040
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002041 LOperand* value() { return inputs_[0]; }
2042
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002043 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2044 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2045};
2046
2047
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002048class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002049 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002050 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002051 inputs_[0] = value;
2052 }
2053
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002054 LOperand* value() { return inputs_[0]; }
2055
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002056 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2057 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002058};
2059
2060
verwaest@chromium.orge4ee6de2012-11-06 12:13:00 +00002061class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002062 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002063 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2064 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002065 temps_[1] = temp2;
2066 }
2067
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002068 LOperand* temp() { return temps_[0]; }
2069 LOperand* temp2() { return temps_[1]; }
2070
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002071 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2072 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2073
2074 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
2075 Handle<JSObject> holder() const { return hydrogen()->holder(); }
2076};
2077
2078
2079class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2080 public:
2081 explicit LCheckSmi(LOperand* value) {
2082 inputs_[0] = value;
2083 }
2084
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002085 LOperand* value() { return inputs_[0]; }
2086
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002087 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2088};
2089
2090
2091class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2092 public:
2093 explicit LCheckNonSmi(LOperand* value) {
2094 inputs_[0] = value;
2095 }
2096
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002097 LOperand* value() { return inputs_[0]; }
2098
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002099 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2100};
2101
2102
2103class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2104 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002105 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2106 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002107 temps_[0] = temp;
2108 }
2109
2110 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002111 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002112
2113 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2114};
2115
2116
2117class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2118 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002119 explicit LClampIToUint8(LOperand* unclamped) {
2120 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002121 }
2122
2123 LOperand* unclamped() { return inputs_[0]; }
2124
2125 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2126};
2127
2128
2129class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2130 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002131 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2132 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002133 temps_[0] = temp;
2134 }
2135
2136 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002137 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002138
2139 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2140};
2141
2142
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002143class LAllocateObject: public LTemplateInstruction<1, 0, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002144 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002145 LAllocateObject(LOperand* temp, LOperand* temp2) {
2146 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002147 temps_[1] = temp2;
2148 }
2149
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002150 LOperand* temp() { return temps_[0]; }
2151 LOperand* temp2() { return temps_[1]; }
2152
ulan@chromium.org967e2702012-02-28 09:49:15 +00002153 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2154 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2155};
2156
2157
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002158class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
2159 public:
2160 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2161 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2162};
2163
2164
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002165class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2166 public:
2167 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2168 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2169};
2170
2171
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002172class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002173 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002174 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2175 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002176};
2177
2178
2179class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2180 public:
2181 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2182 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2183};
2184
2185
2186class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2187 public:
2188 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2189 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2190
2191 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2192};
2193
2194
2195class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2196 public:
2197 explicit LToFastProperties(LOperand* value) {
2198 inputs_[0] = value;
2199 }
2200
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002201 LOperand* value() { return inputs_[0]; }
2202
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002203 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2204 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2205};
2206
2207
2208class LTypeof: public LTemplateInstruction<1, 1, 0> {
2209 public:
2210 explicit LTypeof(LOperand* value) {
2211 inputs_[0] = value;
2212 }
2213
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002214 LOperand* value() { return inputs_[0]; }
2215
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002216 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2217};
2218
2219
2220class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2221 public:
2222 explicit LTypeofIsAndBranch(LOperand* value) {
2223 inputs_[0] = value;
2224 }
2225
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002226 LOperand* value() { return inputs_[0]; }
2227
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002228 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2229 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2230
2231 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2232
2233 virtual void PrintDataTo(StringStream* stream);
2234};
2235
2236
2237class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2238 public:
2239 explicit LIsConstructCallAndBranch(LOperand* temp) {
2240 temps_[0] = temp;
2241 }
2242
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002243 LOperand* temp() { return temps_[0]; }
2244
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002245 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2246 "is-construct-call-and-branch")
2247};
2248
2249
2250class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2251 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002252 LDeleteProperty(LOperand* object, LOperand* key) {
2253 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002254 inputs_[1] = key;
2255 }
2256
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002257 LOperand* object() { return inputs_[0]; }
2258 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002259
2260 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002261};
2262
2263
2264class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2265 public:
2266 LOsrEntry();
2267
2268 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2269
2270 LOperand** SpilledRegisterArray() { return register_spills_; }
2271 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2272
2273 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2274 void MarkSpilledDoubleRegister(int allocation_index,
2275 LOperand* spill_operand);
2276
2277 private:
2278 // Arrays of spill slot operands for registers with an assigned spill
2279 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2280 // NULL if the register has no assigned spill slot. Indexed by allocation
2281 // index.
2282 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2283 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2284};
2285
2286
2287class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2288 public:
2289 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2290 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2291
2292 Label* done_label() { return &done_label_; }
2293
2294 private:
2295 Label done_label_;
2296};
2297
2298
2299class LIn: public LTemplateInstruction<1, 2, 0> {
2300 public:
2301 LIn(LOperand* key, LOperand* object) {
2302 inputs_[0] = key;
2303 inputs_[1] = object;
2304 }
2305
2306 LOperand* key() { return inputs_[0]; }
2307 LOperand* object() { return inputs_[1]; }
2308
2309 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2310};
2311
2312
ulan@chromium.org812308e2012-02-29 15:58:45 +00002313class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2314 public:
2315 explicit LForInPrepareMap(LOperand* object) {
2316 inputs_[0] = object;
2317 }
2318
2319 LOperand* object() { return inputs_[0]; }
2320
2321 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2322};
2323
2324
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002325class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002326 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002327 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002328 inputs_[0] = map;
2329 }
2330
2331 LOperand* map() { return inputs_[0]; }
2332
2333 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2334
2335 int idx() {
2336 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2337 }
2338};
2339
2340
2341class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2342 public:
2343 LCheckMapValue(LOperand* value, LOperand* map) {
2344 inputs_[0] = value;
2345 inputs_[1] = map;
2346 }
2347
2348 LOperand* value() { return inputs_[0]; }
2349 LOperand* map() { return inputs_[1]; }
2350
2351 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2352};
2353
2354
2355class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2356 public:
2357 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2358 inputs_[0] = object;
2359 inputs_[1] = index;
2360 }
2361
2362 LOperand* object() { return inputs_[0]; }
2363 LOperand* index() { return inputs_[1]; }
2364
2365 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2366};
2367
2368
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002369class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002370class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002371 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002372 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2373 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002374
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002375 int GetNextSpillIndex(bool is_double);
2376 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002377};
2378
2379
2380class LChunkBuilder BASE_EMBEDDED {
2381 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002382 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2383 : chunk_(NULL),
2384 info_(info),
2385 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002386 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002387 status_(UNUSED),
2388 current_instruction_(NULL),
2389 current_block_(NULL),
2390 next_block_(NULL),
2391 argument_count_(0),
2392 allocator_(allocator),
2393 position_(RelocInfo::kNoPosition),
2394 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002395 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002396
2397 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002398 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002399
2400 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002401#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002402 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2403#undef DECLARE_DO
2404
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002405 private:
2406 enum Status {
2407 UNUSED,
2408 BUILDING,
2409 DONE,
2410 ABORTED
2411 };
2412
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002413 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002414 CompilationInfo* info() const { return info_; }
2415 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002416 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002417
2418 bool is_unused() const { return status_ == UNUSED; }
2419 bool is_building() const { return status_ == BUILDING; }
2420 bool is_done() const { return status_ == DONE; }
2421 bool is_aborted() const { return status_ == ABORTED; }
2422
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002423 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002424
2425 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002426 LUnallocated* ToUnallocated(Register reg);
2427 LUnallocated* ToUnallocated(DoubleRegister reg);
2428
2429 // Methods for setting up define-use relationships.
2430 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2431 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2432 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2433 DoubleRegister fixed_register);
2434
2435 // A value that is guaranteed to be allocated to a register.
2436 // Operand created by UseRegister is guaranteed to be live until the end of
2437 // instruction. This means that register allocator will not reuse it's
2438 // register for any other operand inside instruction.
2439 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2440 // instruction start. Register allocator is free to assign the same register
2441 // to some other operand used inside instruction (i.e. temporary or
2442 // output).
2443 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2444 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2445
2446 // An input operand in a register that may be trashed.
2447 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2448
2449 // An input operand in a register or stack slot.
2450 MUST_USE_RESULT LOperand* Use(HValue* value);
2451 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2452
2453 // An input operand in a register, stack slot or a constant operand.
2454 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2455 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2456
2457 // An input operand in a register or a constant operand.
2458 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2459 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2460
2461 // An input operand in register, stack slot or a constant operand.
2462 // Will not be moved to a register even if one is freely available.
2463 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2464
2465 // Temporary operand that must be in a register.
2466 MUST_USE_RESULT LUnallocated* TempRegister();
2467 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2468 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2469
2470 // Methods for setting up define-use relationships.
2471 // Return the same instruction that they are passed.
2472 template<int I, int T>
2473 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2474 LUnallocated* result);
2475 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002476 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2477 template<int I, int T>
2478 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2479 int index);
2480 template<int I, int T>
2481 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2482 template<int I, int T>
2483 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2484 Register reg);
2485 template<int I, int T>
2486 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2487 DoubleRegister reg);
2488 LInstruction* AssignEnvironment(LInstruction* instr);
2489 LInstruction* AssignPointerMap(LInstruction* instr);
2490
2491 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2492
2493 // By default we assume that instruction sequences generated for calls
2494 // cannot deoptimize eagerly and we do not attach environment to this
2495 // instruction.
2496 LInstruction* MarkAsCall(
2497 LInstruction* instr,
2498 HInstruction* hinstr,
2499 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002500
2501 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2502 int* argument_index_accumulator);
2503
2504 void VisitInstruction(HInstruction* current);
2505
2506 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2507 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2508 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2509 LInstruction* DoArithmeticD(Token::Value op,
2510 HArithmeticBinaryOperation* instr);
2511 LInstruction* DoArithmeticT(Token::Value op,
2512 HArithmeticBinaryOperation* instr);
2513
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002514 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002515 CompilationInfo* info_;
2516 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002517 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002518 Status status_;
2519 HInstruction* current_instruction_;
2520 HBasicBlock* current_block_;
2521 HBasicBlock* next_block_;
2522 int argument_count_;
2523 LAllocator* allocator_;
2524 int position_;
2525 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002526 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002527
lrn@chromium.org7516f052011-03-30 08:52:27 +00002528 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2529};
2530
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002531#undef DECLARE_HYDROGEN_ACCESSOR
2532#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002533
2534} } // namespace v8::internal
2535
2536#endif // V8_MIPS_LITHIUM_MIPS_H_