blob: 3ea0aef98511cd9d92c6697ca0afcddb000b0999 [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 {
619 return hydrogen()->GetInputRepresentation().IsDouble();
620 }
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
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001355 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001356};
1357
1358
1359class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1360 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001361 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1362 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001363 inputs_[1] = key;
1364 }
1365
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001366 LOperand* object() { return inputs_[0]; }
1367 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001368
1369 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001370};
1371
1372
1373class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1374 public:
1375 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1376 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1377};
1378
1379
1380class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1381 public:
1382 explicit LLoadGlobalGeneric(LOperand* global_object) {
1383 inputs_[0] = global_object;
1384 }
1385
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001386 LOperand* global_object() { return inputs_[0]; }
1387
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001388 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1389 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1390
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001391 Handle<Object> name() const { return hydrogen()->name(); }
1392 bool for_typeof() const { return hydrogen()->for_typeof(); }
1393};
1394
1395
1396class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1397 public:
1398 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1399 inputs_[0] = value;
1400 temps_[0] = temp;
1401 }
1402
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001403 LOperand* value() { return inputs_[0]; }
1404 LOperand* temp() { return temps_[0]; }
1405
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001406 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1407 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1408};
1409
1410
1411class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1412 public:
1413 explicit LStoreGlobalGeneric(LOperand* global_object,
1414 LOperand* value) {
1415 inputs_[0] = global_object;
1416 inputs_[1] = value;
1417 }
1418
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001419 LOperand* global_object() { return inputs_[0]; }
1420 LOperand* value() { return inputs_[1]; }
1421
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001422 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1423 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1424
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001425 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001426 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001427};
1428
1429
1430class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1431 public:
1432 explicit LLoadContextSlot(LOperand* context) {
1433 inputs_[0] = context;
1434 }
1435
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001436 LOperand* context() { return inputs_[0]; }
1437
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001438 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1439 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1440
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001441 int slot_index() { return hydrogen()->slot_index(); }
1442
1443 virtual void PrintDataTo(StringStream* stream);
1444};
1445
1446
1447class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1448 public:
1449 LStoreContextSlot(LOperand* context, LOperand* value) {
1450 inputs_[0] = context;
1451 inputs_[1] = value;
1452 }
1453
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001454 LOperand* context() { return inputs_[0]; }
1455 LOperand* value() { return inputs_[1]; }
1456
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001457 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1458 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1459
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001460 int slot_index() { return hydrogen()->slot_index(); }
1461
1462 virtual void PrintDataTo(StringStream* stream);
1463};
1464
1465
1466class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1467 public:
1468 explicit LPushArgument(LOperand* value) {
1469 inputs_[0] = value;
1470 }
1471
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001472 LOperand* value() { return inputs_[0]; }
1473
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001474 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1475};
1476
1477
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001478class LDrop: public LTemplateInstruction<0, 0, 0> {
1479 public:
1480 explicit LDrop(int count) : count_(count) { }
1481
1482 int count() const { return count_; }
1483
1484 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1485
1486 private:
1487 int count_;
1488};
1489
1490
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001491class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1492 public:
1493 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1494 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1495};
1496
1497
1498class LContext: public LTemplateInstruction<1, 0, 0> {
1499 public:
1500 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1501};
1502
1503
1504class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1505 public:
1506 explicit LOuterContext(LOperand* context) {
1507 inputs_[0] = context;
1508 }
1509
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001510 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001511
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001512 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001513};
1514
1515
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001516class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1517 public:
1518 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1519 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1520};
1521
1522
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001523class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1524 public:
1525 explicit LGlobalObject(LOperand* context) {
1526 inputs_[0] = context;
1527 }
1528
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001529 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001530
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001531 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001532};
1533
1534
1535class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1536 public:
1537 explicit LGlobalReceiver(LOperand* global_object) {
1538 inputs_[0] = global_object;
1539 }
1540
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001541 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001542
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001543 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001544};
1545
1546
1547class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1548 public:
1549 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1550 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1551
1552 virtual void PrintDataTo(StringStream* stream);
1553
1554 Handle<JSFunction> function() { return hydrogen()->function(); }
1555 int arity() const { return hydrogen()->argument_count() - 1; }
1556};
1557
1558
1559class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1560 public:
1561 explicit LInvokeFunction(LOperand* function) {
1562 inputs_[0] = function;
1563 }
1564
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001565 LOperand* function() { return inputs_[0]; }
1566
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001567 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1568 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1569
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001570 virtual void PrintDataTo(StringStream* stream);
1571
1572 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001573 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001574};
1575
1576
1577class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1578 public:
1579 explicit LCallKeyed(LOperand* key) {
1580 inputs_[0] = key;
1581 }
1582
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001583 LOperand* key() { return inputs_[0]; }
1584
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001585 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1586 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1587
1588 virtual void PrintDataTo(StringStream* stream);
1589
1590 int arity() const { return hydrogen()->argument_count() - 1; }
1591};
1592
1593
1594
1595class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1596 public:
1597 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1598 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1599
1600 virtual void PrintDataTo(StringStream* stream);
1601
1602 Handle<String> name() const { return hydrogen()->name(); }
1603 int arity() const { return hydrogen()->argument_count() - 1; }
1604};
1605
1606
danno@chromium.orgc612e022011-11-10 11:38:15 +00001607class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001608 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001609 explicit LCallFunction(LOperand* function) {
1610 inputs_[0] = function;
1611 }
1612
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001613 LOperand* function() { return inputs_[0]; }
1614
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001615 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1616 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1617
danno@chromium.orgc612e022011-11-10 11:38:15 +00001618 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001619};
1620
1621
1622class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1623 public:
1624 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1625 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1626
1627 virtual void PrintDataTo(StringStream* stream);
1628
1629 Handle<String> name() const {return hydrogen()->name(); }
1630 int arity() const { return hydrogen()->argument_count() - 1; }
1631};
1632
1633
1634class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1635 public:
1636 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1637 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1638
1639 virtual void PrintDataTo(StringStream* stream);
1640
1641 Handle<JSFunction> target() const { return hydrogen()->target(); }
1642 int arity() const { return hydrogen()->argument_count() - 1; }
1643};
1644
1645
1646class LCallNew: public LTemplateInstruction<1, 1, 0> {
1647 public:
1648 explicit LCallNew(LOperand* constructor) {
1649 inputs_[0] = constructor;
1650 }
1651
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001652 LOperand* constructor() { return inputs_[0]; }
1653
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001654 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1655 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1656
1657 virtual void PrintDataTo(StringStream* stream);
1658
1659 int arity() const { return hydrogen()->argument_count() - 1; }
1660};
1661
1662
1663class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1664 public:
1665 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1666 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1667
1668 const Runtime::Function* function() const { return hydrogen()->function(); }
1669 int arity() const { return hydrogen()->argument_count(); }
1670};
1671
1672
1673class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1674 public:
1675 explicit LInteger32ToDouble(LOperand* value) {
1676 inputs_[0] = value;
1677 }
1678
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001679 LOperand* value() { return inputs_[0]; }
1680
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001681 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1682};
1683
1684
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001685class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1686 public:
1687 explicit LUint32ToDouble(LOperand* value) {
1688 inputs_[0] = value;
1689 }
1690
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001691 LOperand* value() { return inputs_[0]; }
1692
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001693 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1694};
1695
1696
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001697class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1698 public:
1699 explicit LNumberTagI(LOperand* value) {
1700 inputs_[0] = value;
1701 }
1702
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001703 LOperand* value() { return inputs_[0]; }
1704
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001705 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1706};
1707
1708
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001709class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1710 public:
1711 explicit LNumberTagU(LOperand* value) {
1712 inputs_[0] = value;
1713 }
1714
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001715 LOperand* value() { return inputs_[0]; }
1716
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001717 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1718};
1719
1720
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001721class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1722 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001723 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001724 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001725 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001726 temps_[1] = temp2;
1727 }
1728
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001729 LOperand* value() { return inputs_[0]; }
1730 LOperand* temp() { return temps_[0]; }
1731 LOperand* temp2() { return temps_[1]; }
1732
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001733 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1734};
1735
1736
1737// Sometimes truncating conversion from a tagged value to an int32.
1738class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1739 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001740 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001741 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001742 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001743 temps_[1] = temp2;
1744 }
1745
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001746 LOperand* value() { return inputs_[0]; }
1747 LOperand* temp() { return temps_[0]; }
1748 LOperand* temp2() { return temps_[1]; }
1749
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001750 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1751 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1752
1753 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1754};
1755
1756
1757// Truncating conversion from a tagged value to an int32.
1758class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1759 public:
1760 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001761 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001762 LOperand* temp2,
1763 LOperand* temp3) {
1764 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001765 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001766 temps_[1] = temp2;
1767 temps_[2] = temp3;
1768 }
1769
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001770 LOperand* value() { return inputs_[0]; }
1771 LOperand* temp() { return temps_[0]; }
1772 LOperand* temp2() { return temps_[1]; }
1773 LOperand* temp3() { return temps_[2]; }
1774
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001775 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1776 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1777
1778 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1779};
1780
1781
1782class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1783 public:
1784 explicit LSmiTag(LOperand* value) {
1785 inputs_[0] = value;
1786 }
1787
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001788 LOperand* value() { return inputs_[0]; }
1789
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001790 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1791};
1792
1793
1794class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1795 public:
1796 explicit LNumberUntagD(LOperand* value) {
1797 inputs_[0] = value;
1798 }
1799
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001800 LOperand* value() { return inputs_[0]; }
1801
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001802 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1803 DECLARE_HYDROGEN_ACCESSOR(Change)
1804};
1805
1806
1807class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1808 public:
1809 LSmiUntag(LOperand* value, bool needs_check)
1810 : needs_check_(needs_check) {
1811 inputs_[0] = value;
1812 }
1813
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001814 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001815 bool needs_check() const { return needs_check_; }
1816
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001817 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1818
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001819 private:
1820 bool needs_check_;
1821};
1822
1823
verwaest@chromium.org37141392012-05-31 13:27:02 +00001824class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001825 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001826 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
1827 inputs_[0] = object;
1828 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001829 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001830 }
1831
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001832 LOperand* object() { return inputs_[0]; }
1833 LOperand* value() { return inputs_[1]; }
1834 LOperand* temp() { return temps_[0]; }
1835
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001836 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1837 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1838
1839 virtual void PrintDataTo(StringStream* stream);
1840
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001841 Handle<Object> name() const { return hydrogen()->name(); }
1842 bool is_in_object() { return hydrogen()->is_in_object(); }
1843 int offset() { return hydrogen()->offset(); }
1844 Handle<Map> transition() const { return hydrogen()->transition(); }
1845};
1846
1847
1848class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1849 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001850 LStoreNamedGeneric(LOperand* object, LOperand* value) {
1851 inputs_[0] = object;
1852 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001853 }
1854
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001855 LOperand* object() { return inputs_[0]; }
1856 LOperand* value() { return inputs_[1]; }
1857
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001858 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1859 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1860
1861 virtual void PrintDataTo(StringStream* stream);
1862
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001863 Handle<Object> name() const { return hydrogen()->name(); }
1864 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001865};
1866
1867
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001868class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001869 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001870 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001871 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001872 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001873 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001874 }
1875
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001876 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001877 LOperand* elements() { return inputs_[0]; }
1878 LOperand* key() { return inputs_[1]; }
1879 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001880 ElementsKind elements_kind() const {
1881 return hydrogen()->elements_kind();
1882 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001883
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001884 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
1885 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001886
1887 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001888 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001889 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001890};
1891
1892
1893class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1894 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001895 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001896 inputs_[0] = obj;
1897 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001898 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001899 }
1900
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001901 LOperand* object() { return inputs_[0]; }
1902 LOperand* key() { return inputs_[1]; }
1903 LOperand* value() { return inputs_[2]; }
1904
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001905 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1906 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1907
1908 virtual void PrintDataTo(StringStream* stream);
1909
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001910 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001911};
1912
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001913
1914class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1915 public:
1916 LTransitionElementsKind(LOperand* object,
1917 LOperand* new_map_temp,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001918 LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001919 inputs_[0] = object;
1920 temps_[0] = new_map_temp;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001921 temps_[1] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001922 }
1923
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001924 LOperand* object() { return inputs_[0]; }
1925 LOperand* new_map_temp() { return temps_[0]; }
1926 LOperand* temp() { return temps_[1]; }
1927
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001928 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1929 "transition-elements-kind")
1930 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1931
1932 virtual void PrintDataTo(StringStream* stream);
1933
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001934 Handle<Map> original_map() { return hydrogen()->original_map(); }
1935 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
1936};
1937
1938
1939class LStringAdd: public LTemplateInstruction<1, 2, 0> {
1940 public:
1941 LStringAdd(LOperand* left, LOperand* right) {
1942 inputs_[0] = left;
1943 inputs_[1] = right;
1944 }
1945
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001946 LOperand* left() { return inputs_[0]; }
1947 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001948
1949 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1950 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001951};
1952
1953
1954
1955class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
1956 public:
1957 LStringCharCodeAt(LOperand* string, LOperand* index) {
1958 inputs_[0] = string;
1959 inputs_[1] = index;
1960 }
1961
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001962 LOperand* string() { return inputs_[0]; }
1963 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001964
1965 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1966 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001967};
1968
1969
1970class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
1971 public:
1972 explicit LStringCharFromCode(LOperand* char_code) {
1973 inputs_[0] = char_code;
1974 }
1975
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001976 LOperand* char_code() { return inputs_[0]; }
1977
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001978 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
1979 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001980};
1981
1982
1983class LStringLength: public LTemplateInstruction<1, 1, 0> {
1984 public:
1985 explicit LStringLength(LOperand* string) {
1986 inputs_[0] = string;
1987 }
1988
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001989 LOperand* string() { return inputs_[0]; }
1990
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001991 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1992 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001993};
1994
1995
1996class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
1997 public:
1998 explicit LCheckFunction(LOperand* value) {
1999 inputs_[0] = value;
2000 }
2001
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002002 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002003
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002004 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2005 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2006};
2007
2008
2009class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2010 public:
2011 explicit LCheckInstanceType(LOperand* value) {
2012 inputs_[0] = value;
2013 }
2014
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002015 LOperand* value() { return inputs_[0]; }
2016
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002017 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2018 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2019};
2020
2021
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002022class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002023 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002024 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002025 inputs_[0] = value;
2026 }
2027
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002028 LOperand* value() { return inputs_[0]; }
2029
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002030 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2031 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002032};
2033
2034
verwaest@chromium.orge4ee6de2012-11-06 12:13:00 +00002035class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002036 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002037 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2038 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002039 temps_[1] = temp2;
2040 }
2041
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002042 LOperand* temp() { return temps_[0]; }
2043 LOperand* temp2() { return temps_[1]; }
2044
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002045 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2046 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2047
2048 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
2049 Handle<JSObject> holder() const { return hydrogen()->holder(); }
2050};
2051
2052
2053class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2054 public:
2055 explicit LCheckSmi(LOperand* value) {
2056 inputs_[0] = value;
2057 }
2058
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002059 LOperand* value() { return inputs_[0]; }
2060
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002061 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2062};
2063
2064
2065class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2066 public:
2067 explicit LCheckNonSmi(LOperand* value) {
2068 inputs_[0] = value;
2069 }
2070
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002071 LOperand* value() { return inputs_[0]; }
2072
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002073 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2074};
2075
2076
2077class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2078 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002079 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2080 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002081 temps_[0] = temp;
2082 }
2083
2084 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002085 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002086
2087 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2088};
2089
2090
2091class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2092 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002093 explicit LClampIToUint8(LOperand* unclamped) {
2094 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002095 }
2096
2097 LOperand* unclamped() { return inputs_[0]; }
2098
2099 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2100};
2101
2102
2103class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2104 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002105 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2106 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002107 temps_[0] = temp;
2108 }
2109
2110 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002111 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002112
2113 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2114};
2115
2116
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002117class LAllocateObject: public LTemplateInstruction<1, 0, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002118 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002119 LAllocateObject(LOperand* temp, LOperand* temp2) {
2120 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002121 temps_[1] = temp2;
2122 }
2123
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002124 LOperand* temp() { return temps_[0]; }
2125 LOperand* temp2() { return temps_[1]; }
2126
ulan@chromium.org967e2702012-02-28 09:49:15 +00002127 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2128 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2129};
2130
2131
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002132class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
2133 public:
2134 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2135 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2136};
2137
2138
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002139class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2140 public:
2141 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2142 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2143};
2144
2145
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002146class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002147 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002148 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2149 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002150};
2151
2152
2153class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2154 public:
2155 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2156 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2157};
2158
2159
2160class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2161 public:
2162 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2163 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2164
2165 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2166};
2167
2168
2169class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2170 public:
2171 explicit LToFastProperties(LOperand* value) {
2172 inputs_[0] = value;
2173 }
2174
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002175 LOperand* value() { return inputs_[0]; }
2176
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002177 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2178 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2179};
2180
2181
2182class LTypeof: public LTemplateInstruction<1, 1, 0> {
2183 public:
2184 explicit LTypeof(LOperand* value) {
2185 inputs_[0] = value;
2186 }
2187
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002188 LOperand* value() { return inputs_[0]; }
2189
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002190 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2191};
2192
2193
2194class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2195 public:
2196 explicit LTypeofIsAndBranch(LOperand* value) {
2197 inputs_[0] = value;
2198 }
2199
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002200 LOperand* value() { return inputs_[0]; }
2201
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002202 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2203 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2204
2205 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2206
2207 virtual void PrintDataTo(StringStream* stream);
2208};
2209
2210
2211class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2212 public:
2213 explicit LIsConstructCallAndBranch(LOperand* temp) {
2214 temps_[0] = temp;
2215 }
2216
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002217 LOperand* temp() { return temps_[0]; }
2218
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002219 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2220 "is-construct-call-and-branch")
2221};
2222
2223
2224class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2225 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002226 LDeleteProperty(LOperand* object, LOperand* key) {
2227 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002228 inputs_[1] = key;
2229 }
2230
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002231 LOperand* object() { return inputs_[0]; }
2232 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002233
2234 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002235};
2236
2237
2238class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2239 public:
2240 LOsrEntry();
2241
2242 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2243
2244 LOperand** SpilledRegisterArray() { return register_spills_; }
2245 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2246
2247 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2248 void MarkSpilledDoubleRegister(int allocation_index,
2249 LOperand* spill_operand);
2250
2251 private:
2252 // Arrays of spill slot operands for registers with an assigned spill
2253 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2254 // NULL if the register has no assigned spill slot. Indexed by allocation
2255 // index.
2256 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2257 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2258};
2259
2260
2261class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2262 public:
2263 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2264 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2265
2266 Label* done_label() { return &done_label_; }
2267
2268 private:
2269 Label done_label_;
2270};
2271
2272
2273class LIn: public LTemplateInstruction<1, 2, 0> {
2274 public:
2275 LIn(LOperand* key, LOperand* object) {
2276 inputs_[0] = key;
2277 inputs_[1] = object;
2278 }
2279
2280 LOperand* key() { return inputs_[0]; }
2281 LOperand* object() { return inputs_[1]; }
2282
2283 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2284};
2285
2286
ulan@chromium.org812308e2012-02-29 15:58:45 +00002287class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2288 public:
2289 explicit LForInPrepareMap(LOperand* object) {
2290 inputs_[0] = object;
2291 }
2292
2293 LOperand* object() { return inputs_[0]; }
2294
2295 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2296};
2297
2298
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002299class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002300 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002301 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002302 inputs_[0] = map;
2303 }
2304
2305 LOperand* map() { return inputs_[0]; }
2306
2307 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2308
2309 int idx() {
2310 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2311 }
2312};
2313
2314
2315class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2316 public:
2317 LCheckMapValue(LOperand* value, LOperand* map) {
2318 inputs_[0] = value;
2319 inputs_[1] = map;
2320 }
2321
2322 LOperand* value() { return inputs_[0]; }
2323 LOperand* map() { return inputs_[1]; }
2324
2325 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2326};
2327
2328
2329class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2330 public:
2331 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2332 inputs_[0] = object;
2333 inputs_[1] = index;
2334 }
2335
2336 LOperand* object() { return inputs_[0]; }
2337 LOperand* index() { return inputs_[1]; }
2338
2339 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2340};
2341
2342
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002343class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002344class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002345 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002346 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2347 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002348
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002349 int GetNextSpillIndex(bool is_double);
2350 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002351};
2352
2353
2354class LChunkBuilder BASE_EMBEDDED {
2355 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002356 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2357 : chunk_(NULL),
2358 info_(info),
2359 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002360 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002361 status_(UNUSED),
2362 current_instruction_(NULL),
2363 current_block_(NULL),
2364 next_block_(NULL),
2365 argument_count_(0),
2366 allocator_(allocator),
2367 position_(RelocInfo::kNoPosition),
2368 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002369 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002370
2371 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002372 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002373
2374 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002375#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002376 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2377#undef DECLARE_DO
2378
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002379 private:
2380 enum Status {
2381 UNUSED,
2382 BUILDING,
2383 DONE,
2384 ABORTED
2385 };
2386
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002387 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002388 CompilationInfo* info() const { return info_; }
2389 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002390 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002391
2392 bool is_unused() const { return status_ == UNUSED; }
2393 bool is_building() const { return status_ == BUILDING; }
2394 bool is_done() const { return status_ == DONE; }
2395 bool is_aborted() const { return status_ == ABORTED; }
2396
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002397 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002398
2399 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002400 LUnallocated* ToUnallocated(Register reg);
2401 LUnallocated* ToUnallocated(DoubleRegister reg);
2402
2403 // Methods for setting up define-use relationships.
2404 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2405 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2406 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2407 DoubleRegister fixed_register);
2408
2409 // A value that is guaranteed to be allocated to a register.
2410 // Operand created by UseRegister is guaranteed to be live until the end of
2411 // instruction. This means that register allocator will not reuse it's
2412 // register for any other operand inside instruction.
2413 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2414 // instruction start. Register allocator is free to assign the same register
2415 // to some other operand used inside instruction (i.e. temporary or
2416 // output).
2417 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2418 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2419
2420 // An input operand in a register that may be trashed.
2421 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2422
2423 // An input operand in a register or stack slot.
2424 MUST_USE_RESULT LOperand* Use(HValue* value);
2425 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2426
2427 // An input operand in a register, stack slot or a constant operand.
2428 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2429 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2430
2431 // An input operand in a register or a constant operand.
2432 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2433 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2434
2435 // An input operand in register, stack slot or a constant operand.
2436 // Will not be moved to a register even if one is freely available.
2437 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2438
2439 // Temporary operand that must be in a register.
2440 MUST_USE_RESULT LUnallocated* TempRegister();
2441 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2442 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2443
2444 // Methods for setting up define-use relationships.
2445 // Return the same instruction that they are passed.
2446 template<int I, int T>
2447 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2448 LUnallocated* result);
2449 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002450 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2451 template<int I, int T>
2452 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2453 int index);
2454 template<int I, int T>
2455 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2456 template<int I, int T>
2457 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2458 Register reg);
2459 template<int I, int T>
2460 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2461 DoubleRegister reg);
2462 LInstruction* AssignEnvironment(LInstruction* instr);
2463 LInstruction* AssignPointerMap(LInstruction* instr);
2464
2465 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2466
2467 // By default we assume that instruction sequences generated for calls
2468 // cannot deoptimize eagerly and we do not attach environment to this
2469 // instruction.
2470 LInstruction* MarkAsCall(
2471 LInstruction* instr,
2472 HInstruction* hinstr,
2473 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002474
2475 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2476 int* argument_index_accumulator);
2477
2478 void VisitInstruction(HInstruction* current);
2479
2480 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2481 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2482 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2483 LInstruction* DoArithmeticD(Token::Value op,
2484 HArithmeticBinaryOperation* instr);
2485 LInstruction* DoArithmeticT(Token::Value op,
2486 HArithmeticBinaryOperation* instr);
2487
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002488 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002489 CompilationInfo* info_;
2490 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002491 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002492 Status status_;
2493 HInstruction* current_instruction_;
2494 HBasicBlock* current_block_;
2495 HBasicBlock* next_block_;
2496 int argument_count_;
2497 LAllocator* allocator_;
2498 int position_;
2499 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002500 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002501
lrn@chromium.org7516f052011-03-30 08:52:27 +00002502 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2503};
2504
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002505#undef DECLARE_HYDROGEN_ACCESSOR
2506#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002507
2508} } // namespace v8::internal
2509
2510#endif // V8_MIPS_LITHIUM_MIPS_H_