blob: 1baf07dd12064d478ccabf5bdc00e4da6b4cb299 [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) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000134 V(MathMinMax) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000135 V(ModI) \
136 V(MulI) \
137 V(NumberTagD) \
138 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000139 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000140 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000141 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000142 V(OsrEntry) \
143 V(OuterContext) \
144 V(Parameter) \
145 V(Power) \
146 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000147 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000148 V(RegExpLiteral) \
149 V(Return) \
150 V(ShiftI) \
151 V(SmiTag) \
152 V(SmiUntag) \
153 V(StackCheck) \
154 V(StoreContextSlot) \
155 V(StoreGlobalCell) \
156 V(StoreGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000157 V(StoreKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000158 V(StoreKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000159 V(StoreNamedField) \
160 V(StoreNamedGeneric) \
161 V(StringAdd) \
162 V(StringCharCodeAt) \
163 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000164 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000165 V(StringLength) \
166 V(SubI) \
167 V(TaggedToI) \
168 V(ThisFunction) \
169 V(Throw) \
170 V(ToFastProperties) \
171 V(TransitionElementsKind) \
172 V(Typeof) \
173 V(TypeofIsAndBranch) \
174 V(UnaryMathOperation) \
175 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000176 V(ValueOf) \
177 V(ForInPrepareMap) \
178 V(ForInCacheArray) \
179 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000180 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000181 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000182 V(WrapReceiver) \
183 V(Drop)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000184
185#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
186 virtual Opcode opcode() const { return LInstruction::k##type; } \
187 virtual void CompileToNative(LCodeGen* generator); \
188 virtual const char* Mnemonic() const { return mnemonic; } \
189 static L##type* cast(LInstruction* instr) { \
190 ASSERT(instr->Is##type()); \
191 return reinterpret_cast<L##type*>(instr); \
192 }
193
194
195#define DECLARE_HYDROGEN_ACCESSOR(type) \
196 H##type* hydrogen() const { \
197 return H##type::cast(hydrogen_value()); \
198 }
199
lrn@chromium.org7516f052011-03-30 08:52:27 +0000200
201class LInstruction: public ZoneObject {
202 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000203 LInstruction()
204 : environment_(NULL),
205 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000206 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000207 virtual ~LInstruction() { }
208
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000209 virtual void CompileToNative(LCodeGen* generator) = 0;
210 virtual const char* Mnemonic() const = 0;
211 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000212 virtual void PrintDataTo(StringStream* stream);
213 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000214
215 enum Opcode {
216 // Declare a unique enum value for each instruction.
217#define DECLARE_OPCODE(type) k##type,
218 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
219 kNumberOfInstructions
220#undef DECLARE_OPCODE
221 };
222
223 virtual Opcode opcode() const = 0;
224
225 // Declare non-virtual type testers for all leaf IR classes.
226#define DECLARE_PREDICATE(type) \
227 bool Is##type() const { return opcode() == k##type; }
228 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
229#undef DECLARE_PREDICATE
230
231 // Declare virtual predicates for instructions that don't have
232 // an opcode.
233 virtual bool IsGap() const { return false; }
234
235 virtual bool IsControl() const { return false; }
236
237 void set_environment(LEnvironment* env) { environment_ = env; }
238 LEnvironment* environment() const { return environment_; }
239 bool HasEnvironment() const { return environment_ != NULL; }
240
241 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
242 LPointerMap* pointer_map() const { return pointer_map_.get(); }
243 bool HasPointerMap() const { return pointer_map_.is_set(); }
244
245 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
246 HValue* hydrogen_value() const { return hydrogen_value_; }
247
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000248 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000249
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000250 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000251
252 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000253 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000254
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000255 virtual bool HasResult() const = 0;
256 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000257
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000258 LOperand* FirstInput() { return InputAt(0); }
259 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000260
261#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000262 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000263#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000264
265 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000266 // Iterator interface.
267 friend class InputIterator;
268 virtual int InputCount() = 0;
269 virtual LOperand* InputAt(int i) = 0;
270
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000271 friend class TempIterator;
272 virtual int TempCount() = 0;
273 virtual LOperand* TempAt(int i) = 0;
274
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000275 LEnvironment* environment_;
276 SetOncePointer<LPointerMap> pointer_map_;
277 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000278 bool is_call_;
279 bool is_save_doubles_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000280};
281
282
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000283// R = number of result operands (0 or 1).
284// I = number of input operands.
285// T = number of temporary operands.
286template<int R, int I, int T>
287class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000288 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000289 // Allow 0 or 1 output operands.
290 STATIC_ASSERT(R == 0 || R == 1);
291 virtual bool HasResult() const { return R != 0; }
292 void set_result(LOperand* operand) { results_[0] = operand; }
293 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000294
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000295 protected:
296 EmbeddedContainer<LOperand*, R> results_;
297 EmbeddedContainer<LOperand*, I> inputs_;
298 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000299
300 private:
301 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000302 virtual LOperand* InputAt(int i) { return inputs_[i]; }
303
304 virtual int TempCount() { return T; }
305 virtual LOperand* TempAt(int i) { return temps_[i]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000306};
307
308
309class LGap: public LTemplateInstruction<0, 0, 0> {
310 public:
311 explicit LGap(HBasicBlock* block)
312 : block_(block) {
313 parallel_moves_[BEFORE] = NULL;
314 parallel_moves_[START] = NULL;
315 parallel_moves_[END] = NULL;
316 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000317 }
318
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000319 // Can't use the DECLARE-macro here because of sub-classes.
320 virtual bool IsGap() const { return true; }
321 virtual void PrintDataTo(StringStream* stream);
322 static LGap* cast(LInstruction* instr) {
323 ASSERT(instr->IsGap());
324 return reinterpret_cast<LGap*>(instr);
325 }
326
327 bool IsRedundant() const;
328
329 HBasicBlock* block() const { return block_; }
330
lrn@chromium.org7516f052011-03-30 08:52:27 +0000331 enum InnerPosition {
332 BEFORE,
333 START,
334 END,
335 AFTER,
336 FIRST_INNER_POSITION = BEFORE,
337 LAST_INNER_POSITION = AFTER
338 };
339
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000340 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
341 if (parallel_moves_[pos] == NULL) {
342 parallel_moves_[pos] = new(zone) LParallelMove(zone);
343 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000344 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000345 }
346
347 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000348 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000349 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000350
351 private:
352 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
353 HBasicBlock* block_;
354};
355
356
357class LInstructionGap: public LGap {
358 public:
359 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
360
361 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
362};
363
364
365class LGoto: public LTemplateInstruction<0, 0, 0> {
366 public:
367 explicit LGoto(int block_id) : block_id_(block_id) { }
368
369 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
370 virtual void PrintDataTo(StringStream* stream);
371 virtual bool IsControl() const { return true; }
372
373 int block_id() const { return block_id_; }
374
375 private:
376 int block_id_;
377};
378
379
380class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
381 public:
382 LLazyBailout() : gap_instructions_size_(0) { }
383
384 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
385
386 void set_gap_instructions_size(int gap_instructions_size) {
387 gap_instructions_size_ = gap_instructions_size;
388 }
389 int gap_instructions_size() { return gap_instructions_size_; }
390
391 private:
392 int gap_instructions_size_;
393};
394
395
396class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
397 public:
398 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000399};
400
401
402class LLabel: public LGap {
403 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000404 explicit LLabel(HBasicBlock* block)
405 : LGap(block), replacement_(NULL) { }
406
407 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
408
409 virtual void PrintDataTo(StringStream* stream);
410
411 int block_id() const { return block()->block_id(); }
412 bool is_loop_header() const { return block()->IsLoopHeader(); }
413 Label* label() { return &label_; }
414 LLabel* replacement() const { return replacement_; }
415 void set_replacement(LLabel* label) { replacement_ = label; }
416 bool HasReplacement() const { return replacement_ != NULL; }
417
418 private:
419 Label label_;
420 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000421};
422
423
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000424class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000425 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000426 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
427};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000428
lrn@chromium.org7516f052011-03-30 08:52:27 +0000429
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000430class LCallStub: public LTemplateInstruction<1, 0, 0> {
431 public:
432 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
433 DECLARE_HYDROGEN_ACCESSOR(CallStub)
434
435 TranscendentalCache::Type transcendental_type() {
436 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000437 }
438};
439
440
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000441class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
442 public:
443 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
444};
445
446
447template<int I, int T>
448class LControlInstruction: public LTemplateInstruction<0, I, T> {
449 public:
450 virtual bool IsControl() const { return true; }
451
452 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
453 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
454 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
455 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
456
457 private:
458 HControlInstruction* hydrogen() {
459 return HControlInstruction::cast(this->hydrogen_value());
460 }
461};
462
463
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000464class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
465 public:
466 LWrapReceiver(LOperand* receiver, LOperand* function) {
467 inputs_[0] = receiver;
468 inputs_[1] = function;
469 }
470
471 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
472
473 LOperand* receiver() { return inputs_[0]; }
474 LOperand* function() { return inputs_[1]; }
475};
476
477
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000478class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
479 public:
480 LApplyArguments(LOperand* function,
481 LOperand* receiver,
482 LOperand* length,
483 LOperand* elements) {
484 inputs_[0] = function;
485 inputs_[1] = receiver;
486 inputs_[2] = length;
487 inputs_[3] = elements;
488 }
489
490 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
491
492 LOperand* function() { return inputs_[0]; }
493 LOperand* receiver() { return inputs_[1]; }
494 LOperand* length() { return inputs_[2]; }
495 LOperand* elements() { return inputs_[3]; }
496};
497
498
499class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
500 public:
501 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
502 inputs_[0] = arguments;
503 inputs_[1] = length;
504 inputs_[2] = index;
505 }
506
507 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
508
509 LOperand* arguments() { return inputs_[0]; }
510 LOperand* length() { return inputs_[1]; }
511 LOperand* index() { return inputs_[2]; }
512
513 virtual void PrintDataTo(StringStream* stream);
514};
515
516
517class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
518 public:
519 explicit LArgumentsLength(LOperand* elements) {
520 inputs_[0] = elements;
521 }
522
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000523 LOperand* elements() { return inputs_[0]; }
524
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000525 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
526};
527
528
529class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
530 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000531 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000532 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000533};
534
535
536class LModI: public LTemplateInstruction<1, 2, 3> {
537 public:
538 // Used when the right hand is a constant power of 2.
539 LModI(LOperand* left,
540 LOperand* right) {
541 inputs_[0] = left;
542 inputs_[1] = right;
543 temps_[0] = NULL;
544 temps_[1] = NULL;
545 temps_[2] = NULL;
546 }
547
548 // Used for the standard case.
549 LModI(LOperand* left,
550 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000551 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000552 LOperand* temp2,
553 LOperand* temp3) {
554 inputs_[0] = left;
555 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000556 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000557 temps_[1] = temp2;
558 temps_[2] = temp3;
559 }
560
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000561 LOperand* left() { return inputs_[0]; }
562 LOperand* right() { return inputs_[1]; }
563 LOperand* temp() { return temps_[0]; }
564 LOperand* temp2() { return temps_[1]; }
565 LOperand* temp3() { return temps_[2]; }
566
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000567 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
568 DECLARE_HYDROGEN_ACCESSOR(Mod)
569};
570
571
572class LDivI: public LTemplateInstruction<1, 2, 0> {
573 public:
574 LDivI(LOperand* left, LOperand* right) {
575 inputs_[0] = left;
576 inputs_[1] = right;
577 }
578
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000579 LOperand* left() { return inputs_[0]; }
580 LOperand* right() { return inputs_[1]; }
581
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000582 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
583 DECLARE_HYDROGEN_ACCESSOR(Div)
584};
585
586
587class LMulI: public LTemplateInstruction<1, 2, 1> {
588 public:
589 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
590 inputs_[0] = left;
591 inputs_[1] = right;
592 temps_[0] = temp;
593 }
594
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000595 LOperand* left() { return inputs_[0]; }
596 LOperand* right() { return inputs_[1]; }
597 LOperand* temp() { return temps_[0]; }
598
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000599 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
600 DECLARE_HYDROGEN_ACCESSOR(Mul)
601};
602
603
604class LCmpIDAndBranch: public LControlInstruction<2, 0> {
605 public:
606 LCmpIDAndBranch(LOperand* left, LOperand* right) {
607 inputs_[0] = left;
608 inputs_[1] = right;
609 }
610
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000611 LOperand* left() { return inputs_[0]; }
612 LOperand* right() { return inputs_[1]; }
613
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000614 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
615 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
616
617 Token::Value op() const { return hydrogen()->token(); }
618 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000619 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000620 }
621
622 virtual void PrintDataTo(StringStream* stream);
623};
624
625
626class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
627 public:
628 LUnaryMathOperation(LOperand* value, LOperand* temp) {
629 inputs_[0] = value;
630 temps_[0] = temp;
631 }
632
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000633 LOperand* value() { return inputs_[0]; }
634 LOperand* temp() { return temps_[0]; }
635
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000636 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
637 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
638
639 virtual void PrintDataTo(StringStream* stream);
640 BuiltinFunctionId op() const { return hydrogen()->op(); }
641};
642
643
644class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
645 public:
646 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
647 inputs_[0] = left;
648 inputs_[1] = right;
649 }
650
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000651 LOperand* left() { return inputs_[0]; }
652 LOperand* right() { return inputs_[1]; }
653
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000654 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
655 "cmp-object-eq-and-branch")
656 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
657};
658
659
660class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
661 public:
662 explicit LCmpConstantEqAndBranch(LOperand* left) {
663 inputs_[0] = left;
664 }
665
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000666 LOperand* left() { return inputs_[0]; }
667
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000668 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
669 "cmp-constant-eq-and-branch")
670 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
671};
672
673
674class LIsNilAndBranch: public LControlInstruction<1, 0> {
675 public:
676 explicit LIsNilAndBranch(LOperand* value) {
677 inputs_[0] = value;
678 }
679
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000680 LOperand* value() { return inputs_[0]; }
681
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000682 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
683 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
684
685 EqualityKind kind() const { return hydrogen()->kind(); }
686 NilValue nil() const { return hydrogen()->nil(); }
687
688 virtual void PrintDataTo(StringStream* stream);
689};
690
691
692class LIsObjectAndBranch: public LControlInstruction<1, 1> {
693 public:
694 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
695 inputs_[0] = value;
696 temps_[0] = temp;
697 }
698
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000699 LOperand* value() { return inputs_[0]; }
700 LOperand* temp() { return temps_[0]; }
701
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000702 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
703 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
704
705 virtual void PrintDataTo(StringStream* stream);
706};
707
708
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000709class LIsStringAndBranch: public LControlInstruction<1, 1> {
710 public:
711 LIsStringAndBranch(LOperand* value, LOperand* temp) {
712 inputs_[0] = value;
713 temps_[0] = temp;
714 }
715
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000716 LOperand* value() { return inputs_[0]; }
717 LOperand* temp() { return temps_[0]; }
718
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000719 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
720 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
721
722 virtual void PrintDataTo(StringStream* stream);
723};
724
725
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000726class LIsSmiAndBranch: public LControlInstruction<1, 0> {
727 public:
728 explicit LIsSmiAndBranch(LOperand* value) {
729 inputs_[0] = value;
730 }
731
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000732 LOperand* value() { return inputs_[0]; }
733
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000734 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
735 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
736
737 virtual void PrintDataTo(StringStream* stream);
738};
739
740
741class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
742 public:
743 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
744 inputs_[0] = value;
745 temps_[0] = temp;
746 }
747
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000748 LOperand* value() { return inputs_[0]; }
749 LOperand* temp() { return temps_[0]; }
750
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000751 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
752 "is-undetectable-and-branch")
753 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
754
755 virtual void PrintDataTo(StringStream* stream);
756};
757
758
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000759class LStringCompareAndBranch: public LControlInstruction<2, 0> {
760 public:
761 LStringCompareAndBranch(LOperand* left, LOperand* right) {
762 inputs_[0] = left;
763 inputs_[1] = right;
764 }
765
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000766 LOperand* left() { return inputs_[0]; }
767 LOperand* right() { return inputs_[1]; }
768
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000769 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
770 "string-compare-and-branch")
771 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
772
773 Token::Value op() const { return hydrogen()->token(); }
774
775 virtual void PrintDataTo(StringStream* stream);
776};
777
778
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000779class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
780 public:
781 explicit LHasInstanceTypeAndBranch(LOperand* value) {
782 inputs_[0] = value;
783 }
784
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000785 LOperand* value() { return inputs_[0]; }
786
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000787 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
788 "has-instance-type-and-branch")
789 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
790
791 virtual void PrintDataTo(StringStream* stream);
792};
793
794
795class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
796 public:
797 explicit LGetCachedArrayIndex(LOperand* value) {
798 inputs_[0] = value;
799 }
800
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000801 LOperand* value() { return inputs_[0]; }
802
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000803 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
804 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
805};
806
807
808class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
809 public:
810 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
811 inputs_[0] = value;
812 }
813
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000814 LOperand* value() { return inputs_[0]; }
815
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000816 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
817 "has-cached-array-index-and-branch")
818 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
819
820 virtual void PrintDataTo(StringStream* stream);
821};
822
823
824class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
825 public:
826 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
827 inputs_[0] = value;
828 temps_[0] = temp;
829 }
830
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000831 LOperand* value() { return inputs_[0]; }
832 LOperand* temp() { return temps_[0]; }
833
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000834 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
835 "class-of-test-and-branch")
836 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
837
838 virtual void PrintDataTo(StringStream* stream);
839};
840
841
842class LCmpT: public LTemplateInstruction<1, 2, 0> {
843 public:
844 LCmpT(LOperand* left, LOperand* right) {
845 inputs_[0] = left;
846 inputs_[1] = right;
847 }
848
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000849 LOperand* left() { return inputs_[0]; }
850 LOperand* right() { return inputs_[1]; }
851
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000852 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
853 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
854
855 Token::Value op() const { return hydrogen()->token(); }
856};
857
858
859class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
860 public:
861 LInstanceOf(LOperand* left, LOperand* right) {
862 inputs_[0] = left;
863 inputs_[1] = right;
864 }
865
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000866 LOperand* left() { return inputs_[0]; }
867 LOperand* right() { return inputs_[1]; }
868
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000869 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
870};
871
872
873class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
874 public:
875 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
876 inputs_[0] = value;
877 temps_[0] = temp;
878 }
879
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000880 LOperand* value() { return inputs_[0]; }
881 LOperand* temp() { return temps_[0]; }
882
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000883 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
884 "instance-of-known-global")
885 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
886
887 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000888 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
889 return lazy_deopt_env_;
890 }
891 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
892 lazy_deopt_env_ = env;
893 }
894
895 private:
896 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000897};
898
899
900class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
901 public:
902 LBoundsCheck(LOperand* index, LOperand* length) {
903 inputs_[0] = index;
904 inputs_[1] = length;
905 }
906
907 LOperand* index() { return inputs_[0]; }
908 LOperand* length() { return inputs_[1]; }
909
910 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +0000911 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000912};
913
914
915class LBitI: public LTemplateInstruction<1, 2, 0> {
916 public:
917 LBitI(LOperand* left, LOperand* right) {
918 inputs_[0] = left;
919 inputs_[1] = right;
920 }
921
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000922 LOperand* left() { return inputs_[0]; }
923 LOperand* right() { return inputs_[1]; }
924
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000925 Token::Value op() const { return hydrogen()->op(); }
926
927 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
928 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
929};
930
931
932class LShiftI: public LTemplateInstruction<1, 2, 0> {
933 public:
934 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
935 : op_(op), can_deopt_(can_deopt) {
936 inputs_[0] = left;
937 inputs_[1] = right;
938 }
939
940 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000941 LOperand* left() { return inputs_[0]; }
942 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000943 bool can_deopt() const { return can_deopt_; }
944
945 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
946
947 private:
948 Token::Value op_;
949 bool can_deopt_;
950};
951
952
953class LSubI: public LTemplateInstruction<1, 2, 0> {
954 public:
955 LSubI(LOperand* left, LOperand* right) {
956 inputs_[0] = left;
957 inputs_[1] = right;
958 }
959
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000960 LOperand* left() { return inputs_[0]; }
961 LOperand* right() { return inputs_[1]; }
962
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000963 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
964 DECLARE_HYDROGEN_ACCESSOR(Sub)
965};
966
967
968class LConstantI: public LTemplateInstruction<1, 0, 0> {
969 public:
970 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
971 DECLARE_HYDROGEN_ACCESSOR(Constant)
972
973 int32_t value() const { return hydrogen()->Integer32Value(); }
974};
975
976
977class LConstantD: public LTemplateInstruction<1, 0, 0> {
978 public:
979 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
980 DECLARE_HYDROGEN_ACCESSOR(Constant)
981
982 double value() const { return hydrogen()->DoubleValue(); }
983};
984
985
986class LConstantT: public LTemplateInstruction<1, 0, 0> {
987 public:
988 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
989 DECLARE_HYDROGEN_ACCESSOR(Constant)
990
991 Handle<Object> value() const { return hydrogen()->handle(); }
992};
993
994
995class LBranch: public LControlInstruction<1, 0> {
996 public:
997 explicit LBranch(LOperand* value) {
998 inputs_[0] = value;
999 }
1000
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001001 LOperand* value() { return inputs_[0]; }
1002
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001003 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1004 DECLARE_HYDROGEN_ACCESSOR(Branch)
1005
1006 virtual void PrintDataTo(StringStream* stream);
1007};
1008
1009
1010class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1011 public:
1012 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1013 inputs_[0] = value;
1014 temps_[0] = temp;
1015 }
1016
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001017 LOperand* value() { return inputs_[0]; }
1018 LOperand* temp() { return temps_[0]; }
1019
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001020 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1021 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1022
1023 virtual bool IsControl() const { return true; }
1024
1025 Handle<Map> map() const { return hydrogen()->map(); }
1026 int true_block_id() const {
1027 return hydrogen()->FirstSuccessor()->block_id();
1028 }
1029 int false_block_id() const {
1030 return hydrogen()->SecondSuccessor()->block_id();
1031 }
1032};
1033
1034
1035class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
1036 public:
1037 explicit LJSArrayLength(LOperand* value) {
1038 inputs_[0] = value;
1039 }
1040
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001041 LOperand* value() { return inputs_[0]; }
1042
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001043 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
1044 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
1045};
1046
1047
1048class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1049 public:
1050 explicit LFixedArrayBaseLength(LOperand* value) {
1051 inputs_[0] = value;
1052 }
1053
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001054 LOperand* value() { return inputs_[0]; }
1055
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001056 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1057 "fixed-array-base-length")
1058 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1059};
1060
1061
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001062class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1063 public:
1064 explicit LMapEnumLength(LOperand* value) {
1065 inputs_[0] = value;
1066 }
1067
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001068 LOperand* value() { return inputs_[0]; }
1069
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001070 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1071};
1072
1073
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001074class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1075 public:
1076 explicit LElementsKind(LOperand* value) {
1077 inputs_[0] = value;
1078 }
1079
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001080 LOperand* value() { return inputs_[0]; }
1081
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001082 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1083 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1084};
1085
1086
1087class LValueOf: public LTemplateInstruction<1, 1, 1> {
1088 public:
1089 LValueOf(LOperand* value, LOperand* temp) {
1090 inputs_[0] = value;
1091 temps_[0] = temp;
1092 }
1093
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001094 LOperand* value() { return inputs_[0]; }
1095 LOperand* temp() { return temps_[0]; }
1096
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001097 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1098 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1099};
1100
1101
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001102class LDateField: public LTemplateInstruction<1, 1, 1> {
1103 public:
1104 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1105 inputs_[0] = date;
1106 temps_[0] = temp;
1107 }
1108
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001109 LOperand* date() { return inputs_[0]; }
1110 LOperand* temp() { return temps_[0]; }
1111 Smi* index() const { return index_; }
1112
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001113 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1114 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001115
1116 private:
1117 Smi* index_;
1118};
1119
1120
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001121class LThrow: public LTemplateInstruction<0, 1, 0> {
1122 public:
1123 explicit LThrow(LOperand* value) {
1124 inputs_[0] = value;
1125 }
1126
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001127 LOperand* value() { return inputs_[0]; }
1128
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001129 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1130};
1131
1132
1133class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1134 public:
1135 explicit LBitNotI(LOperand* value) {
1136 inputs_[0] = value;
1137 }
1138
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001139 LOperand* value() { return inputs_[0]; }
1140
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001141 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1142};
1143
1144
1145class LAddI: public LTemplateInstruction<1, 2, 0> {
1146 public:
1147 LAddI(LOperand* left, LOperand* right) {
1148 inputs_[0] = left;
1149 inputs_[1] = right;
1150 }
1151
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001152 LOperand* left() { return inputs_[0]; }
1153 LOperand* right() { return inputs_[1]; }
1154
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001155 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1156 DECLARE_HYDROGEN_ACCESSOR(Add)
1157};
1158
1159
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001160class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1161 public:
1162 LMathMinMax(LOperand* left, LOperand* right) {
1163 inputs_[0] = left;
1164 inputs_[1] = right;
1165 }
1166
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001167 LOperand* left() { return inputs_[0]; }
1168 LOperand* right() { return inputs_[1]; }
1169
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001170 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max")
1171 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1172};
1173
1174
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001175class LPower: public LTemplateInstruction<1, 2, 0> {
1176 public:
1177 LPower(LOperand* left, LOperand* right) {
1178 inputs_[0] = left;
1179 inputs_[1] = right;
1180 }
1181
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001182 LOperand* left() { return inputs_[0]; }
1183 LOperand* right() { return inputs_[1]; }
1184
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001185 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1186 DECLARE_HYDROGEN_ACCESSOR(Power)
1187};
1188
1189
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001190class LRandom: public LTemplateInstruction<1, 1, 0> {
1191 public:
1192 explicit LRandom(LOperand* global_object) {
1193 inputs_[0] = global_object;
1194 }
1195
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001196 LOperand* global_object() { return inputs_[0]; }
1197
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001198 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1199 DECLARE_HYDROGEN_ACCESSOR(Random)
1200};
1201
1202
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001203class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1204 public:
1205 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1206 : op_(op) {
1207 inputs_[0] = left;
1208 inputs_[1] = right;
1209 }
1210
1211 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001212 LOperand* left() { return inputs_[0]; }
1213 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001214
1215 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1216 virtual void CompileToNative(LCodeGen* generator);
1217 virtual const char* Mnemonic() const;
1218
1219 private:
1220 Token::Value op_;
1221};
1222
1223
1224class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1225 public:
1226 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1227 : op_(op) {
1228 inputs_[0] = left;
1229 inputs_[1] = right;
1230 }
1231
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001232 LOperand* left() { return inputs_[0]; }
1233 LOperand* right() { return inputs_[1]; }
1234 Token::Value op() const { return op_; }
1235
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001236 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1237 virtual void CompileToNative(LCodeGen* generator);
1238 virtual const char* Mnemonic() const;
1239
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001240 private:
1241 Token::Value op_;
1242};
1243
1244
1245class LReturn: public LTemplateInstruction<0, 1, 0> {
1246 public:
1247 explicit LReturn(LOperand* value) {
1248 inputs_[0] = value;
1249 }
1250
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001251 LOperand* value() { return inputs_[0]; }
1252
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001253 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1254};
1255
1256
1257class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1258 public:
1259 explicit LLoadNamedField(LOperand* object) {
1260 inputs_[0] = object;
1261 }
1262
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001263 LOperand* object() { return inputs_[0]; }
1264
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001265 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1266 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1267};
1268
1269
1270class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1271 public:
1272 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1273 inputs_[0] = object;
1274 }
1275
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001276 LOperand* object() { return inputs_[0]; }
1277
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001278 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1279 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001280};
1281
1282
1283class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1284 public:
1285 explicit LLoadNamedGeneric(LOperand* object) {
1286 inputs_[0] = object;
1287 }
1288
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001289 LOperand* object() { return inputs_[0]; }
1290
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001291 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1292 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1293
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001294 Handle<Object> name() const { return hydrogen()->name(); }
1295};
1296
1297
1298class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1299 public:
1300 explicit LLoadFunctionPrototype(LOperand* function) {
1301 inputs_[0] = function;
1302 }
1303
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001304 LOperand* function() { return inputs_[0]; }
1305
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001306 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1307 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001308};
1309
1310
1311class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1312 public:
1313 explicit LLoadElements(LOperand* object) {
1314 inputs_[0] = object;
1315 }
1316
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001317 LOperand* object() { return inputs_[0]; }
1318
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001319 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1320};
1321
1322
1323class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1324 public:
1325 explicit LLoadExternalArrayPointer(LOperand* object) {
1326 inputs_[0] = object;
1327 }
1328
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001329 LOperand* object() { return inputs_[0]; }
1330
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001331 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1332 "load-external-array-pointer")
1333};
1334
1335
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001336class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001337 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001338 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001339 inputs_[0] = elements;
1340 inputs_[1] = key;
1341 }
1342
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001343 LOperand* elements() { return inputs_[0]; }
1344 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001345 ElementsKind elements_kind() const {
1346 return hydrogen()->elements_kind();
1347 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001348 bool is_external() const {
1349 return hydrogen()->is_external();
1350 }
1351
1352 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1353 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1354
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001355 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001356 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001357};
1358
1359
1360class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1361 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001362 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1363 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001364 inputs_[1] = key;
1365 }
1366
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001367 LOperand* object() { return inputs_[0]; }
1368 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001369
1370 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001371};
1372
1373
1374class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1375 public:
1376 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1377 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1378};
1379
1380
1381class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1382 public:
1383 explicit LLoadGlobalGeneric(LOperand* global_object) {
1384 inputs_[0] = global_object;
1385 }
1386
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001387 LOperand* global_object() { return inputs_[0]; }
1388
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001389 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1390 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1391
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001392 Handle<Object> name() const { return hydrogen()->name(); }
1393 bool for_typeof() const { return hydrogen()->for_typeof(); }
1394};
1395
1396
1397class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1398 public:
1399 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1400 inputs_[0] = value;
1401 temps_[0] = temp;
1402 }
1403
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001404 LOperand* value() { return inputs_[0]; }
1405 LOperand* temp() { return temps_[0]; }
1406
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001407 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1408 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1409};
1410
1411
1412class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1413 public:
1414 explicit LStoreGlobalGeneric(LOperand* global_object,
1415 LOperand* value) {
1416 inputs_[0] = global_object;
1417 inputs_[1] = value;
1418 }
1419
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001420 LOperand* global_object() { return inputs_[0]; }
1421 LOperand* value() { return inputs_[1]; }
1422
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001423 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1424 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1425
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001426 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001427 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001428};
1429
1430
1431class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1432 public:
1433 explicit LLoadContextSlot(LOperand* context) {
1434 inputs_[0] = context;
1435 }
1436
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001437 LOperand* context() { return inputs_[0]; }
1438
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001439 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1440 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1441
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001442 int slot_index() { return hydrogen()->slot_index(); }
1443
1444 virtual void PrintDataTo(StringStream* stream);
1445};
1446
1447
1448class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1449 public:
1450 LStoreContextSlot(LOperand* context, LOperand* value) {
1451 inputs_[0] = context;
1452 inputs_[1] = value;
1453 }
1454
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001455 LOperand* context() { return inputs_[0]; }
1456 LOperand* value() { return inputs_[1]; }
1457
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001458 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1459 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1460
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001461 int slot_index() { return hydrogen()->slot_index(); }
1462
1463 virtual void PrintDataTo(StringStream* stream);
1464};
1465
1466
1467class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1468 public:
1469 explicit LPushArgument(LOperand* value) {
1470 inputs_[0] = value;
1471 }
1472
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001473 LOperand* value() { return inputs_[0]; }
1474
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001475 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1476};
1477
1478
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001479class LDrop: public LTemplateInstruction<0, 0, 0> {
1480 public:
1481 explicit LDrop(int count) : count_(count) { }
1482
1483 int count() const { return count_; }
1484
1485 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1486
1487 private:
1488 int count_;
1489};
1490
1491
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001492class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1493 public:
1494 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1495 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1496};
1497
1498
1499class LContext: public LTemplateInstruction<1, 0, 0> {
1500 public:
1501 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1502};
1503
1504
1505class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1506 public:
1507 explicit LOuterContext(LOperand* context) {
1508 inputs_[0] = context;
1509 }
1510
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001511 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001512
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001513 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001514};
1515
1516
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001517class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1518 public:
1519 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1520 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1521};
1522
1523
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001524class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1525 public:
1526 explicit LGlobalObject(LOperand* context) {
1527 inputs_[0] = context;
1528 }
1529
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001530 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001531
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001532 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001533};
1534
1535
1536class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1537 public:
1538 explicit LGlobalReceiver(LOperand* global_object) {
1539 inputs_[0] = global_object;
1540 }
1541
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001542 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001543
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001544 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001545};
1546
1547
1548class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1549 public:
1550 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1551 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1552
1553 virtual void PrintDataTo(StringStream* stream);
1554
1555 Handle<JSFunction> function() { return hydrogen()->function(); }
1556 int arity() const { return hydrogen()->argument_count() - 1; }
1557};
1558
1559
1560class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1561 public:
1562 explicit LInvokeFunction(LOperand* function) {
1563 inputs_[0] = function;
1564 }
1565
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001566 LOperand* function() { return inputs_[0]; }
1567
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001568 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1569 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1570
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001571 virtual void PrintDataTo(StringStream* stream);
1572
1573 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001574 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001575};
1576
1577
1578class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1579 public:
1580 explicit LCallKeyed(LOperand* key) {
1581 inputs_[0] = key;
1582 }
1583
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001584 LOperand* key() { return inputs_[0]; }
1585
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001586 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1587 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1588
1589 virtual void PrintDataTo(StringStream* stream);
1590
1591 int arity() const { return hydrogen()->argument_count() - 1; }
1592};
1593
1594
1595
1596class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1597 public:
1598 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1599 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1600
1601 virtual void PrintDataTo(StringStream* stream);
1602
1603 Handle<String> name() const { return hydrogen()->name(); }
1604 int arity() const { return hydrogen()->argument_count() - 1; }
1605};
1606
1607
danno@chromium.orgc612e022011-11-10 11:38:15 +00001608class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001609 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001610 explicit LCallFunction(LOperand* function) {
1611 inputs_[0] = function;
1612 }
1613
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001614 LOperand* function() { return inputs_[0]; }
1615
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001616 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1617 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1618
danno@chromium.orgc612e022011-11-10 11:38:15 +00001619 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001620};
1621
1622
1623class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1624 public:
1625 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1626 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1627
1628 virtual void PrintDataTo(StringStream* stream);
1629
1630 Handle<String> name() const {return hydrogen()->name(); }
1631 int arity() const { return hydrogen()->argument_count() - 1; }
1632};
1633
1634
1635class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1636 public:
1637 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1638 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1639
1640 virtual void PrintDataTo(StringStream* stream);
1641
1642 Handle<JSFunction> target() const { return hydrogen()->target(); }
1643 int arity() const { return hydrogen()->argument_count() - 1; }
1644};
1645
1646
1647class LCallNew: public LTemplateInstruction<1, 1, 0> {
1648 public:
1649 explicit LCallNew(LOperand* constructor) {
1650 inputs_[0] = constructor;
1651 }
1652
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001653 LOperand* constructor() { return inputs_[0]; }
1654
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001655 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1656 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1657
1658 virtual void PrintDataTo(StringStream* stream);
1659
1660 int arity() const { return hydrogen()->argument_count() - 1; }
1661};
1662
1663
1664class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1665 public:
1666 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1667 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1668
1669 const Runtime::Function* function() const { return hydrogen()->function(); }
1670 int arity() const { return hydrogen()->argument_count(); }
1671};
1672
1673
1674class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1675 public:
1676 explicit LInteger32ToDouble(LOperand* value) {
1677 inputs_[0] = value;
1678 }
1679
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001680 LOperand* value() { return inputs_[0]; }
1681
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001682 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1683};
1684
1685
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001686class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1687 public:
1688 explicit LUint32ToDouble(LOperand* value) {
1689 inputs_[0] = value;
1690 }
1691
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001692 LOperand* value() { return inputs_[0]; }
1693
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001694 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1695};
1696
1697
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001698class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1699 public:
1700 explicit LNumberTagI(LOperand* value) {
1701 inputs_[0] = value;
1702 }
1703
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001704 LOperand* value() { return inputs_[0]; }
1705
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001706 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1707};
1708
1709
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001710class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1711 public:
1712 explicit LNumberTagU(LOperand* value) {
1713 inputs_[0] = value;
1714 }
1715
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001716 LOperand* value() { return inputs_[0]; }
1717
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001718 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1719};
1720
1721
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001722class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1723 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001724 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001725 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001726 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001727 temps_[1] = temp2;
1728 }
1729
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001730 LOperand* value() { return inputs_[0]; }
1731 LOperand* temp() { return temps_[0]; }
1732 LOperand* temp2() { return temps_[1]; }
1733
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001734 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1735};
1736
1737
1738// Sometimes truncating conversion from a tagged value to an int32.
1739class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1740 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001741 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001742 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001743 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001744 temps_[1] = temp2;
1745 }
1746
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001747 LOperand* value() { return inputs_[0]; }
1748 LOperand* temp() { return temps_[0]; }
1749 LOperand* temp2() { return temps_[1]; }
1750
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001751 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1752 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1753
1754 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1755};
1756
1757
1758// Truncating conversion from a tagged value to an int32.
1759class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1760 public:
1761 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001762 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001763 LOperand* temp2,
1764 LOperand* temp3) {
1765 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001766 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001767 temps_[1] = temp2;
1768 temps_[2] = temp3;
1769 }
1770
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001771 LOperand* value() { return inputs_[0]; }
1772 LOperand* temp() { return temps_[0]; }
1773 LOperand* temp2() { return temps_[1]; }
1774 LOperand* temp3() { return temps_[2]; }
1775
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001776 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1777 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1778
1779 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1780};
1781
1782
1783class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1784 public:
1785 explicit LSmiTag(LOperand* value) {
1786 inputs_[0] = value;
1787 }
1788
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001789 LOperand* value() { return inputs_[0]; }
1790
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001791 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1792};
1793
1794
1795class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1796 public:
1797 explicit LNumberUntagD(LOperand* value) {
1798 inputs_[0] = value;
1799 }
1800
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001801 LOperand* value() { return inputs_[0]; }
1802
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001803 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1804 DECLARE_HYDROGEN_ACCESSOR(Change)
1805};
1806
1807
1808class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1809 public:
1810 LSmiUntag(LOperand* value, bool needs_check)
1811 : needs_check_(needs_check) {
1812 inputs_[0] = value;
1813 }
1814
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001815 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001816 bool needs_check() const { return needs_check_; }
1817
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001818 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1819
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001820 private:
1821 bool needs_check_;
1822};
1823
1824
verwaest@chromium.org37141392012-05-31 13:27:02 +00001825class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001826 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001827 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
1828 inputs_[0] = object;
1829 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001830 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001831 }
1832
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001833 LOperand* object() { return inputs_[0]; }
1834 LOperand* value() { return inputs_[1]; }
1835 LOperand* temp() { return temps_[0]; }
1836
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001837 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1838 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1839
1840 virtual void PrintDataTo(StringStream* stream);
1841
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001842 Handle<Object> name() const { return hydrogen()->name(); }
1843 bool is_in_object() { return hydrogen()->is_in_object(); }
1844 int offset() { return hydrogen()->offset(); }
1845 Handle<Map> transition() const { return hydrogen()->transition(); }
1846};
1847
1848
1849class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1850 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001851 LStoreNamedGeneric(LOperand* object, LOperand* value) {
1852 inputs_[0] = object;
1853 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001854 }
1855
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001856 LOperand* object() { return inputs_[0]; }
1857 LOperand* value() { return inputs_[1]; }
1858
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001859 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1860 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1861
1862 virtual void PrintDataTo(StringStream* stream);
1863
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001864 Handle<Object> name() const { return hydrogen()->name(); }
1865 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001866};
1867
1868
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001869class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001870 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001871 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001872 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001873 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001874 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001875 }
1876
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001877 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001878 LOperand* elements() { return inputs_[0]; }
1879 LOperand* key() { return inputs_[1]; }
1880 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001881 ElementsKind elements_kind() const {
1882 return hydrogen()->elements_kind();
1883 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001884
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001885 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
1886 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001887
1888 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001889 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001890 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001891};
1892
1893
1894class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1895 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001896 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001897 inputs_[0] = obj;
1898 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
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001902 LOperand* object() { return inputs_[0]; }
1903 LOperand* key() { return inputs_[1]; }
1904 LOperand* value() { return inputs_[2]; }
1905
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001906 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1907 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1908
1909 virtual void PrintDataTo(StringStream* stream);
1910
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001911 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001912};
1913
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001914
1915class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1916 public:
1917 LTransitionElementsKind(LOperand* object,
1918 LOperand* new_map_temp,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001919 LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001920 inputs_[0] = object;
1921 temps_[0] = new_map_temp;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001922 temps_[1] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001923 }
1924
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001925 LOperand* object() { return inputs_[0]; }
1926 LOperand* new_map_temp() { return temps_[0]; }
1927 LOperand* temp() { return temps_[1]; }
1928
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001929 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1930 "transition-elements-kind")
1931 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1932
1933 virtual void PrintDataTo(StringStream* stream);
1934
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001935 Handle<Map> original_map() { return hydrogen()->original_map(); }
1936 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
1937};
1938
1939
1940class LStringAdd: public LTemplateInstruction<1, 2, 0> {
1941 public:
1942 LStringAdd(LOperand* left, LOperand* right) {
1943 inputs_[0] = left;
1944 inputs_[1] = right;
1945 }
1946
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001947 LOperand* left() { return inputs_[0]; }
1948 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001949
1950 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1951 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001952};
1953
1954
1955
1956class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
1957 public:
1958 LStringCharCodeAt(LOperand* string, LOperand* index) {
1959 inputs_[0] = string;
1960 inputs_[1] = index;
1961 }
1962
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001963 LOperand* string() { return inputs_[0]; }
1964 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001965
1966 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1967 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001968};
1969
1970
1971class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
1972 public:
1973 explicit LStringCharFromCode(LOperand* char_code) {
1974 inputs_[0] = char_code;
1975 }
1976
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001977 LOperand* char_code() { return inputs_[0]; }
1978
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001979 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
1980 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001981};
1982
1983
1984class LStringLength: public LTemplateInstruction<1, 1, 0> {
1985 public:
1986 explicit LStringLength(LOperand* string) {
1987 inputs_[0] = string;
1988 }
1989
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001990 LOperand* string() { return inputs_[0]; }
1991
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001992 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1993 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001994};
1995
1996
1997class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
1998 public:
1999 explicit LCheckFunction(LOperand* value) {
2000 inputs_[0] = value;
2001 }
2002
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002003 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002004
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002005 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2006 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2007};
2008
2009
2010class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2011 public:
2012 explicit LCheckInstanceType(LOperand* value) {
2013 inputs_[0] = value;
2014 }
2015
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002016 LOperand* value() { return inputs_[0]; }
2017
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002018 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2019 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2020};
2021
2022
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002023class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002024 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002025 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002026 inputs_[0] = value;
2027 }
2028
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002029 LOperand* value() { return inputs_[0]; }
2030
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002031 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2032 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002033};
2034
2035
verwaest@chromium.orge4ee6de2012-11-06 12:13:00 +00002036class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002037 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002038 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2039 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002040 temps_[1] = temp2;
2041 }
2042
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002043 LOperand* temp() { return temps_[0]; }
2044 LOperand* temp2() { return temps_[1]; }
2045
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002046 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2047 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2048
2049 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
2050 Handle<JSObject> holder() const { return hydrogen()->holder(); }
2051};
2052
2053
2054class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2055 public:
2056 explicit LCheckSmi(LOperand* value) {
2057 inputs_[0] = value;
2058 }
2059
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002060 LOperand* value() { return inputs_[0]; }
2061
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002062 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2063};
2064
2065
2066class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2067 public:
2068 explicit LCheckNonSmi(LOperand* value) {
2069 inputs_[0] = value;
2070 }
2071
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002072 LOperand* value() { return inputs_[0]; }
2073
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002074 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2075};
2076
2077
2078class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2079 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002080 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2081 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002082 temps_[0] = temp;
2083 }
2084
2085 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002086 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002087
2088 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2089};
2090
2091
2092class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2093 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002094 explicit LClampIToUint8(LOperand* unclamped) {
2095 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002096 }
2097
2098 LOperand* unclamped() { return inputs_[0]; }
2099
2100 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2101};
2102
2103
2104class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2105 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002106 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2107 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002108 temps_[0] = temp;
2109 }
2110
2111 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002112 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002113
2114 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2115};
2116
2117
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002118class LAllocateObject: public LTemplateInstruction<1, 0, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002119 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002120 LAllocateObject(LOperand* temp, LOperand* temp2) {
2121 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002122 temps_[1] = temp2;
2123 }
2124
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002125 LOperand* temp() { return temps_[0]; }
2126 LOperand* temp2() { return temps_[1]; }
2127
ulan@chromium.org967e2702012-02-28 09:49:15 +00002128 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2129 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2130};
2131
2132
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002133class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
2134 public:
2135 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2136 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2137};
2138
2139
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002140class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2141 public:
2142 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2143 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2144};
2145
2146
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002147class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002148 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002149 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2150 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002151};
2152
2153
2154class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2155 public:
2156 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2157 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2158};
2159
2160
2161class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2162 public:
2163 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2164 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2165
2166 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2167};
2168
2169
2170class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2171 public:
2172 explicit LToFastProperties(LOperand* value) {
2173 inputs_[0] = value;
2174 }
2175
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002176 LOperand* value() { return inputs_[0]; }
2177
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002178 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2179 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2180};
2181
2182
2183class LTypeof: public LTemplateInstruction<1, 1, 0> {
2184 public:
2185 explicit LTypeof(LOperand* value) {
2186 inputs_[0] = value;
2187 }
2188
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002189 LOperand* value() { return inputs_[0]; }
2190
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002191 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2192};
2193
2194
2195class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2196 public:
2197 explicit LTypeofIsAndBranch(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(TypeofIsAndBranch, "typeof-is-and-branch")
2204 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2205
2206 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2207
2208 virtual void PrintDataTo(StringStream* stream);
2209};
2210
2211
2212class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2213 public:
2214 explicit LIsConstructCallAndBranch(LOperand* temp) {
2215 temps_[0] = temp;
2216 }
2217
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002218 LOperand* temp() { return temps_[0]; }
2219
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002220 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2221 "is-construct-call-and-branch")
2222};
2223
2224
2225class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2226 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002227 LDeleteProperty(LOperand* object, LOperand* key) {
2228 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002229 inputs_[1] = key;
2230 }
2231
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002232 LOperand* object() { return inputs_[0]; }
2233 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002234
2235 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002236};
2237
2238
2239class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2240 public:
2241 LOsrEntry();
2242
2243 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2244
2245 LOperand** SpilledRegisterArray() { return register_spills_; }
2246 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2247
2248 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2249 void MarkSpilledDoubleRegister(int allocation_index,
2250 LOperand* spill_operand);
2251
2252 private:
2253 // Arrays of spill slot operands for registers with an assigned spill
2254 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2255 // NULL if the register has no assigned spill slot. Indexed by allocation
2256 // index.
2257 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2258 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2259};
2260
2261
2262class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2263 public:
2264 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2265 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2266
2267 Label* done_label() { return &done_label_; }
2268
2269 private:
2270 Label done_label_;
2271};
2272
2273
2274class LIn: public LTemplateInstruction<1, 2, 0> {
2275 public:
2276 LIn(LOperand* key, LOperand* object) {
2277 inputs_[0] = key;
2278 inputs_[1] = object;
2279 }
2280
2281 LOperand* key() { return inputs_[0]; }
2282 LOperand* object() { return inputs_[1]; }
2283
2284 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2285};
2286
2287
ulan@chromium.org812308e2012-02-29 15:58:45 +00002288class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2289 public:
2290 explicit LForInPrepareMap(LOperand* object) {
2291 inputs_[0] = object;
2292 }
2293
2294 LOperand* object() { return inputs_[0]; }
2295
2296 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2297};
2298
2299
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002300class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002301 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002302 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002303 inputs_[0] = map;
2304 }
2305
2306 LOperand* map() { return inputs_[0]; }
2307
2308 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2309
2310 int idx() {
2311 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2312 }
2313};
2314
2315
2316class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2317 public:
2318 LCheckMapValue(LOperand* value, LOperand* map) {
2319 inputs_[0] = value;
2320 inputs_[1] = map;
2321 }
2322
2323 LOperand* value() { return inputs_[0]; }
2324 LOperand* map() { return inputs_[1]; }
2325
2326 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2327};
2328
2329
2330class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2331 public:
2332 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2333 inputs_[0] = object;
2334 inputs_[1] = index;
2335 }
2336
2337 LOperand* object() { return inputs_[0]; }
2338 LOperand* index() { return inputs_[1]; }
2339
2340 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2341};
2342
2343
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002344class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002345class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002346 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002347 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2348 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002349
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002350 int GetNextSpillIndex(bool is_double);
2351 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002352};
2353
2354
2355class LChunkBuilder BASE_EMBEDDED {
2356 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002357 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2358 : chunk_(NULL),
2359 info_(info),
2360 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002361 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002362 status_(UNUSED),
2363 current_instruction_(NULL),
2364 current_block_(NULL),
2365 next_block_(NULL),
2366 argument_count_(0),
2367 allocator_(allocator),
2368 position_(RelocInfo::kNoPosition),
2369 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002370 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002371
2372 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002373 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002374
2375 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002376#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002377 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2378#undef DECLARE_DO
2379
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002380 private:
2381 enum Status {
2382 UNUSED,
2383 BUILDING,
2384 DONE,
2385 ABORTED
2386 };
2387
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002388 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002389 CompilationInfo* info() const { return info_; }
2390 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002391 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002392
2393 bool is_unused() const { return status_ == UNUSED; }
2394 bool is_building() const { return status_ == BUILDING; }
2395 bool is_done() const { return status_ == DONE; }
2396 bool is_aborted() const { return status_ == ABORTED; }
2397
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002398 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002399
2400 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002401 LUnallocated* ToUnallocated(Register reg);
2402 LUnallocated* ToUnallocated(DoubleRegister reg);
2403
2404 // Methods for setting up define-use relationships.
2405 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2406 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2407 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2408 DoubleRegister fixed_register);
2409
2410 // A value that is guaranteed to be allocated to a register.
2411 // Operand created by UseRegister is guaranteed to be live until the end of
2412 // instruction. This means that register allocator will not reuse it's
2413 // register for any other operand inside instruction.
2414 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2415 // instruction start. Register allocator is free to assign the same register
2416 // to some other operand used inside instruction (i.e. temporary or
2417 // output).
2418 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2419 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2420
2421 // An input operand in a register that may be trashed.
2422 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2423
2424 // An input operand in a register or stack slot.
2425 MUST_USE_RESULT LOperand* Use(HValue* value);
2426 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2427
2428 // An input operand in a register, stack slot or a constant operand.
2429 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2430 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2431
2432 // An input operand in a register or a constant operand.
2433 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2434 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2435
2436 // An input operand in register, stack slot or a constant operand.
2437 // Will not be moved to a register even if one is freely available.
2438 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2439
2440 // Temporary operand that must be in a register.
2441 MUST_USE_RESULT LUnallocated* TempRegister();
2442 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2443 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2444
2445 // Methods for setting up define-use relationships.
2446 // Return the same instruction that they are passed.
2447 template<int I, int T>
2448 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2449 LUnallocated* result);
2450 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002451 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2452 template<int I, int T>
2453 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2454 int index);
2455 template<int I, int T>
2456 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2457 template<int I, int T>
2458 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2459 Register reg);
2460 template<int I, int T>
2461 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2462 DoubleRegister reg);
2463 LInstruction* AssignEnvironment(LInstruction* instr);
2464 LInstruction* AssignPointerMap(LInstruction* instr);
2465
2466 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2467
2468 // By default we assume that instruction sequences generated for calls
2469 // cannot deoptimize eagerly and we do not attach environment to this
2470 // instruction.
2471 LInstruction* MarkAsCall(
2472 LInstruction* instr,
2473 HInstruction* hinstr,
2474 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002475
2476 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2477 int* argument_index_accumulator);
2478
2479 void VisitInstruction(HInstruction* current);
2480
2481 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2482 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2483 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2484 LInstruction* DoArithmeticD(Token::Value op,
2485 HArithmeticBinaryOperation* instr);
2486 LInstruction* DoArithmeticT(Token::Value op,
2487 HArithmeticBinaryOperation* instr);
2488
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002489 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002490 CompilationInfo* info_;
2491 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002492 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002493 Status status_;
2494 HInstruction* current_instruction_;
2495 HBasicBlock* current_block_;
2496 HBasicBlock* next_block_;
2497 int argument_count_;
2498 LAllocator* allocator_;
2499 int position_;
2500 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002501 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002502
lrn@chromium.org7516f052011-03-30 08:52:27 +00002503 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2504};
2505
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002506#undef DECLARE_HYDROGEN_ACCESSOR
2507#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002508
2509} } // namespace v8::internal
2510
2511#endif // V8_MIPS_LITHIUM_MIPS_H_