blob: 3a9aa7accfbe4c2ee8c16561adb39dfa1b877437 [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) \
128 V(LoadKeyedFastDoubleElement) \
129 V(LoadKeyedFastElement) \
130 V(LoadKeyedGeneric) \
131 V(LoadKeyedSpecializedArrayElement) \
132 V(LoadNamedField) \
133 V(LoadNamedFieldPolymorphic) \
134 V(LoadNamedGeneric) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000135 V(MapEnumLength) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000136 V(MathMinMax) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000137 V(ModI) \
138 V(MulI) \
139 V(NumberTagD) \
140 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000141 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000142 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000143 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000144 V(OsrEntry) \
145 V(OuterContext) \
146 V(Parameter) \
147 V(Power) \
148 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000149 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000150 V(RegExpLiteral) \
151 V(Return) \
152 V(ShiftI) \
153 V(SmiTag) \
154 V(SmiUntag) \
155 V(StackCheck) \
156 V(StoreContextSlot) \
157 V(StoreGlobalCell) \
158 V(StoreGlobalGeneric) \
159 V(StoreKeyedFastDoubleElement) \
160 V(StoreKeyedFastElement) \
161 V(StoreKeyedGeneric) \
162 V(StoreKeyedSpecializedArrayElement) \
163 V(StoreNamedField) \
164 V(StoreNamedGeneric) \
165 V(StringAdd) \
166 V(StringCharCodeAt) \
167 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000168 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000169 V(StringLength) \
170 V(SubI) \
171 V(TaggedToI) \
172 V(ThisFunction) \
173 V(Throw) \
174 V(ToFastProperties) \
175 V(TransitionElementsKind) \
176 V(Typeof) \
177 V(TypeofIsAndBranch) \
178 V(UnaryMathOperation) \
179 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000180 V(ValueOf) \
181 V(ForInPrepareMap) \
182 V(ForInCacheArray) \
183 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000184 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000185 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000186 V(WrapReceiver) \
187 V(Drop)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000188
189#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
190 virtual Opcode opcode() const { return LInstruction::k##type; } \
191 virtual void CompileToNative(LCodeGen* generator); \
192 virtual const char* Mnemonic() const { return mnemonic; } \
193 static L##type* cast(LInstruction* instr) { \
194 ASSERT(instr->Is##type()); \
195 return reinterpret_cast<L##type*>(instr); \
196 }
197
198
199#define DECLARE_HYDROGEN_ACCESSOR(type) \
200 H##type* hydrogen() const { \
201 return H##type::cast(hydrogen_value()); \
202 }
203
lrn@chromium.org7516f052011-03-30 08:52:27 +0000204
205class LInstruction: public ZoneObject {
206 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000207 LInstruction()
208 : environment_(NULL),
209 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000210 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000211 virtual ~LInstruction() { }
212
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000213 virtual void CompileToNative(LCodeGen* generator) = 0;
214 virtual const char* Mnemonic() const = 0;
215 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000216 virtual void PrintDataTo(StringStream* stream);
217 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000218
219 enum Opcode {
220 // Declare a unique enum value for each instruction.
221#define DECLARE_OPCODE(type) k##type,
222 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
223 kNumberOfInstructions
224#undef DECLARE_OPCODE
225 };
226
227 virtual Opcode opcode() const = 0;
228
229 // Declare non-virtual type testers for all leaf IR classes.
230#define DECLARE_PREDICATE(type) \
231 bool Is##type() const { return opcode() == k##type; }
232 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
233#undef DECLARE_PREDICATE
234
235 // Declare virtual predicates for instructions that don't have
236 // an opcode.
237 virtual bool IsGap() const { return false; }
238
239 virtual bool IsControl() const { return false; }
240
241 void set_environment(LEnvironment* env) { environment_ = env; }
242 LEnvironment* environment() const { return environment_; }
243 bool HasEnvironment() const { return environment_ != NULL; }
244
245 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
246 LPointerMap* pointer_map() const { return pointer_map_.get(); }
247 bool HasPointerMap() const { return pointer_map_.is_set(); }
248
249 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
250 HValue* hydrogen_value() const { return hydrogen_value_; }
251
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000252 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000253
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000254 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000255
256 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000257 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000258
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000259 virtual bool HasResult() const = 0;
260 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000261
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000262 LOperand* FirstInput() { return InputAt(0); }
263 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000264
265#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000266 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000267#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000268
269 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000270 // Iterator interface.
271 friend class InputIterator;
272 virtual int InputCount() = 0;
273 virtual LOperand* InputAt(int i) = 0;
274
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000275 friend class TempIterator;
276 virtual int TempCount() = 0;
277 virtual LOperand* TempAt(int i) = 0;
278
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000279 LEnvironment* environment_;
280 SetOncePointer<LPointerMap> pointer_map_;
281 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000282 bool is_call_;
283 bool is_save_doubles_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000284};
285
286
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000287// R = number of result operands (0 or 1).
288// I = number of input operands.
289// T = number of temporary operands.
290template<int R, int I, int T>
291class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000292 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000293 // Allow 0 or 1 output operands.
294 STATIC_ASSERT(R == 0 || R == 1);
295 virtual bool HasResult() const { return R != 0; }
296 void set_result(LOperand* operand) { results_[0] = operand; }
297 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000298
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000299 protected:
300 EmbeddedContainer<LOperand*, R> results_;
301 EmbeddedContainer<LOperand*, I> inputs_;
302 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000303
304 private:
305 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000306 virtual LOperand* InputAt(int i) { return inputs_[i]; }
307
308 virtual int TempCount() { return T; }
309 virtual LOperand* TempAt(int i) { return temps_[i]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000310};
311
312
313class LGap: public LTemplateInstruction<0, 0, 0> {
314 public:
315 explicit LGap(HBasicBlock* block)
316 : block_(block) {
317 parallel_moves_[BEFORE] = NULL;
318 parallel_moves_[START] = NULL;
319 parallel_moves_[END] = NULL;
320 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000321 }
322
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000323 // Can't use the DECLARE-macro here because of sub-classes.
324 virtual bool IsGap() const { return true; }
325 virtual void PrintDataTo(StringStream* stream);
326 static LGap* cast(LInstruction* instr) {
327 ASSERT(instr->IsGap());
328 return reinterpret_cast<LGap*>(instr);
329 }
330
331 bool IsRedundant() const;
332
333 HBasicBlock* block() const { return block_; }
334
lrn@chromium.org7516f052011-03-30 08:52:27 +0000335 enum InnerPosition {
336 BEFORE,
337 START,
338 END,
339 AFTER,
340 FIRST_INNER_POSITION = BEFORE,
341 LAST_INNER_POSITION = AFTER
342 };
343
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000344 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
345 if (parallel_moves_[pos] == NULL) {
346 parallel_moves_[pos] = new(zone) LParallelMove(zone);
347 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000348 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000349 }
350
351 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000352 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000353 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000354
355 private:
356 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
357 HBasicBlock* block_;
358};
359
360
361class LInstructionGap: public LGap {
362 public:
363 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
364
365 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
366};
367
368
369class LGoto: public LTemplateInstruction<0, 0, 0> {
370 public:
371 explicit LGoto(int block_id) : block_id_(block_id) { }
372
373 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
374 virtual void PrintDataTo(StringStream* stream);
375 virtual bool IsControl() const { return true; }
376
377 int block_id() const { return block_id_; }
378
379 private:
380 int block_id_;
381};
382
383
384class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
385 public:
386 LLazyBailout() : gap_instructions_size_(0) { }
387
388 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
389
390 void set_gap_instructions_size(int gap_instructions_size) {
391 gap_instructions_size_ = gap_instructions_size;
392 }
393 int gap_instructions_size() { return gap_instructions_size_; }
394
395 private:
396 int gap_instructions_size_;
397};
398
399
400class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
401 public:
402 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000403};
404
405
406class LLabel: public LGap {
407 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000408 explicit LLabel(HBasicBlock* block)
409 : LGap(block), replacement_(NULL) { }
410
411 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
412
413 virtual void PrintDataTo(StringStream* stream);
414
415 int block_id() const { return block()->block_id(); }
416 bool is_loop_header() const { return block()->IsLoopHeader(); }
417 Label* label() { return &label_; }
418 LLabel* replacement() const { return replacement_; }
419 void set_replacement(LLabel* label) { replacement_ = label; }
420 bool HasReplacement() const { return replacement_ != NULL; }
421
422 private:
423 Label label_;
424 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000425};
426
427
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000428class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000429 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000430 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
431};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000432
lrn@chromium.org7516f052011-03-30 08:52:27 +0000433
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000434class LCallStub: public LTemplateInstruction<1, 0, 0> {
435 public:
436 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
437 DECLARE_HYDROGEN_ACCESSOR(CallStub)
438
439 TranscendentalCache::Type transcendental_type() {
440 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000441 }
442};
443
444
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000445class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
446 public:
447 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
448};
449
450
451template<int I, int T>
452class LControlInstruction: public LTemplateInstruction<0, I, T> {
453 public:
454 virtual bool IsControl() const { return true; }
455
456 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
457 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
458 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
459 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
460
461 private:
462 HControlInstruction* hydrogen() {
463 return HControlInstruction::cast(this->hydrogen_value());
464 }
465};
466
467
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000468class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
469 public:
470 LWrapReceiver(LOperand* receiver, LOperand* function) {
471 inputs_[0] = receiver;
472 inputs_[1] = function;
473 }
474
475 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
476
477 LOperand* receiver() { return inputs_[0]; }
478 LOperand* function() { return inputs_[1]; }
479};
480
481
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000482class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
483 public:
484 LApplyArguments(LOperand* function,
485 LOperand* receiver,
486 LOperand* length,
487 LOperand* elements) {
488 inputs_[0] = function;
489 inputs_[1] = receiver;
490 inputs_[2] = length;
491 inputs_[3] = elements;
492 }
493
494 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
495
496 LOperand* function() { return inputs_[0]; }
497 LOperand* receiver() { return inputs_[1]; }
498 LOperand* length() { return inputs_[2]; }
499 LOperand* elements() { return inputs_[3]; }
500};
501
502
503class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
504 public:
505 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
506 inputs_[0] = arguments;
507 inputs_[1] = length;
508 inputs_[2] = index;
509 }
510
511 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
512
513 LOperand* arguments() { return inputs_[0]; }
514 LOperand* length() { return inputs_[1]; }
515 LOperand* index() { return inputs_[2]; }
516
517 virtual void PrintDataTo(StringStream* stream);
518};
519
520
521class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
522 public:
523 explicit LArgumentsLength(LOperand* elements) {
524 inputs_[0] = elements;
525 }
526
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000527 LOperand* elements() { return inputs_[0]; }
528
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000529 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
530};
531
532
533class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
534 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000535 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000536 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000537};
538
539
540class LModI: public LTemplateInstruction<1, 2, 3> {
541 public:
542 // Used when the right hand is a constant power of 2.
543 LModI(LOperand* left,
544 LOperand* right) {
545 inputs_[0] = left;
546 inputs_[1] = right;
547 temps_[0] = NULL;
548 temps_[1] = NULL;
549 temps_[2] = NULL;
550 }
551
552 // Used for the standard case.
553 LModI(LOperand* left,
554 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000555 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000556 LOperand* temp2,
557 LOperand* temp3) {
558 inputs_[0] = left;
559 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000560 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000561 temps_[1] = temp2;
562 temps_[2] = temp3;
563 }
564
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000565 LOperand* left() { return inputs_[0]; }
566 LOperand* right() { return inputs_[1]; }
567 LOperand* temp() { return temps_[0]; }
568 LOperand* temp2() { return temps_[1]; }
569 LOperand* temp3() { return temps_[2]; }
570
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000571 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
572 DECLARE_HYDROGEN_ACCESSOR(Mod)
573};
574
575
576class LDivI: public LTemplateInstruction<1, 2, 0> {
577 public:
578 LDivI(LOperand* left, LOperand* right) {
579 inputs_[0] = left;
580 inputs_[1] = right;
581 }
582
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000583 LOperand* left() { return inputs_[0]; }
584 LOperand* right() { return inputs_[1]; }
585
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000586 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
587 DECLARE_HYDROGEN_ACCESSOR(Div)
588};
589
590
591class LMulI: public LTemplateInstruction<1, 2, 1> {
592 public:
593 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
594 inputs_[0] = left;
595 inputs_[1] = right;
596 temps_[0] = temp;
597 }
598
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000599 LOperand* left() { return inputs_[0]; }
600 LOperand* right() { return inputs_[1]; }
601 LOperand* temp() { return temps_[0]; }
602
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000603 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
604 DECLARE_HYDROGEN_ACCESSOR(Mul)
605};
606
607
608class LCmpIDAndBranch: public LControlInstruction<2, 0> {
609 public:
610 LCmpIDAndBranch(LOperand* left, LOperand* right) {
611 inputs_[0] = left;
612 inputs_[1] = right;
613 }
614
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000615 LOperand* left() { return inputs_[0]; }
616 LOperand* right() { return inputs_[1]; }
617
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000618 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
619 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
620
621 Token::Value op() const { return hydrogen()->token(); }
622 bool is_double() const {
623 return hydrogen()->GetInputRepresentation().IsDouble();
624 }
625
626 virtual void PrintDataTo(StringStream* stream);
627};
628
629
630class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
631 public:
632 LUnaryMathOperation(LOperand* value, LOperand* temp) {
633 inputs_[0] = value;
634 temps_[0] = temp;
635 }
636
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000637 LOperand* value() { return inputs_[0]; }
638 LOperand* temp() { return temps_[0]; }
639
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000640 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
641 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
642
643 virtual void PrintDataTo(StringStream* stream);
644 BuiltinFunctionId op() const { return hydrogen()->op(); }
645};
646
647
648class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
649 public:
650 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
651 inputs_[0] = left;
652 inputs_[1] = right;
653 }
654
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000655 LOperand* left() { return inputs_[0]; }
656 LOperand* right() { return inputs_[1]; }
657
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000658 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
659 "cmp-object-eq-and-branch")
660 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
661};
662
663
664class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
665 public:
666 explicit LCmpConstantEqAndBranch(LOperand* left) {
667 inputs_[0] = left;
668 }
669
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000670 LOperand* left() { return inputs_[0]; }
671
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000672 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
673 "cmp-constant-eq-and-branch")
674 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
675};
676
677
678class LIsNilAndBranch: public LControlInstruction<1, 0> {
679 public:
680 explicit LIsNilAndBranch(LOperand* value) {
681 inputs_[0] = value;
682 }
683
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000684 LOperand* value() { return inputs_[0]; }
685
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000686 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
687 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
688
689 EqualityKind kind() const { return hydrogen()->kind(); }
690 NilValue nil() const { return hydrogen()->nil(); }
691
692 virtual void PrintDataTo(StringStream* stream);
693};
694
695
696class LIsObjectAndBranch: public LControlInstruction<1, 1> {
697 public:
698 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
699 inputs_[0] = value;
700 temps_[0] = temp;
701 }
702
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000703 LOperand* value() { return inputs_[0]; }
704 LOperand* temp() { return temps_[0]; }
705
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000706 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
707 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
708
709 virtual void PrintDataTo(StringStream* stream);
710};
711
712
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000713class LIsStringAndBranch: public LControlInstruction<1, 1> {
714 public:
715 LIsStringAndBranch(LOperand* value, LOperand* temp) {
716 inputs_[0] = value;
717 temps_[0] = temp;
718 }
719
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000720 LOperand* value() { return inputs_[0]; }
721 LOperand* temp() { return temps_[0]; }
722
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000723 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
724 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
725
726 virtual void PrintDataTo(StringStream* stream);
727};
728
729
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000730class LIsSmiAndBranch: public LControlInstruction<1, 0> {
731 public:
732 explicit LIsSmiAndBranch(LOperand* value) {
733 inputs_[0] = value;
734 }
735
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000736 LOperand* value() { return inputs_[0]; }
737
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000738 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
739 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
740
741 virtual void PrintDataTo(StringStream* stream);
742};
743
744
745class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
746 public:
747 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
748 inputs_[0] = value;
749 temps_[0] = temp;
750 }
751
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000752 LOperand* value() { return inputs_[0]; }
753 LOperand* temp() { return temps_[0]; }
754
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000755 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
756 "is-undetectable-and-branch")
757 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
758
759 virtual void PrintDataTo(StringStream* stream);
760};
761
762
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000763class LStringCompareAndBranch: public LControlInstruction<2, 0> {
764 public:
765 LStringCompareAndBranch(LOperand* left, LOperand* right) {
766 inputs_[0] = left;
767 inputs_[1] = right;
768 }
769
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000770 LOperand* left() { return inputs_[0]; }
771 LOperand* right() { return inputs_[1]; }
772
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000773 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
774 "string-compare-and-branch")
775 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
776
777 Token::Value op() const { return hydrogen()->token(); }
778
779 virtual void PrintDataTo(StringStream* stream);
780};
781
782
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000783class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
784 public:
785 explicit LHasInstanceTypeAndBranch(LOperand* value) {
786 inputs_[0] = value;
787 }
788
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000789 LOperand* value() { return inputs_[0]; }
790
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000791 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
792 "has-instance-type-and-branch")
793 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
794
795 virtual void PrintDataTo(StringStream* stream);
796};
797
798
799class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
800 public:
801 explicit LGetCachedArrayIndex(LOperand* value) {
802 inputs_[0] = value;
803 }
804
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000805 LOperand* value() { return inputs_[0]; }
806
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000807 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
808 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
809};
810
811
812class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
813 public:
814 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
815 inputs_[0] = value;
816 }
817
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000818 LOperand* value() { return inputs_[0]; }
819
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000820 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
821 "has-cached-array-index-and-branch")
822 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
823
824 virtual void PrintDataTo(StringStream* stream);
825};
826
827
828class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
829 public:
830 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
831 inputs_[0] = value;
832 temps_[0] = temp;
833 }
834
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000835 LOperand* value() { return inputs_[0]; }
836 LOperand* temp() { return temps_[0]; }
837
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000838 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
839 "class-of-test-and-branch")
840 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
841
842 virtual void PrintDataTo(StringStream* stream);
843};
844
845
846class LCmpT: public LTemplateInstruction<1, 2, 0> {
847 public:
848 LCmpT(LOperand* left, LOperand* right) {
849 inputs_[0] = left;
850 inputs_[1] = right;
851 }
852
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000853 LOperand* left() { return inputs_[0]; }
854 LOperand* right() { return inputs_[1]; }
855
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000856 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
857 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
858
859 Token::Value op() const { return hydrogen()->token(); }
860};
861
862
863class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
864 public:
865 LInstanceOf(LOperand* left, LOperand* right) {
866 inputs_[0] = left;
867 inputs_[1] = right;
868 }
869
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000870 LOperand* left() { return inputs_[0]; }
871 LOperand* right() { return inputs_[1]; }
872
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000873 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
874};
875
876
877class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
878 public:
879 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
880 inputs_[0] = value;
881 temps_[0] = temp;
882 }
883
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000884 LOperand* value() { return inputs_[0]; }
885 LOperand* temp() { return temps_[0]; }
886
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000887 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
888 "instance-of-known-global")
889 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
890
891 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000892 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
893 return lazy_deopt_env_;
894 }
895 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
896 lazy_deopt_env_ = env;
897 }
898
899 private:
900 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000901};
902
903
904class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
905 public:
906 LBoundsCheck(LOperand* index, LOperand* length) {
907 inputs_[0] = index;
908 inputs_[1] = length;
909 }
910
911 LOperand* index() { return inputs_[0]; }
912 LOperand* length() { return inputs_[1]; }
913
914 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +0000915 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000916};
917
918
919class LBitI: public LTemplateInstruction<1, 2, 0> {
920 public:
921 LBitI(LOperand* left, LOperand* right) {
922 inputs_[0] = left;
923 inputs_[1] = right;
924 }
925
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000926 LOperand* left() { return inputs_[0]; }
927 LOperand* right() { return inputs_[1]; }
928
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000929 Token::Value op() const { return hydrogen()->op(); }
930
931 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
932 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
933};
934
935
936class LShiftI: public LTemplateInstruction<1, 2, 0> {
937 public:
938 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
939 : op_(op), can_deopt_(can_deopt) {
940 inputs_[0] = left;
941 inputs_[1] = right;
942 }
943
944 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000945 LOperand* left() { return inputs_[0]; }
946 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000947 bool can_deopt() const { return can_deopt_; }
948
949 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
950
951 private:
952 Token::Value op_;
953 bool can_deopt_;
954};
955
956
957class LSubI: public LTemplateInstruction<1, 2, 0> {
958 public:
959 LSubI(LOperand* left, LOperand* right) {
960 inputs_[0] = left;
961 inputs_[1] = right;
962 }
963
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000964 LOperand* left() { return inputs_[0]; }
965 LOperand* right() { return inputs_[1]; }
966
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000967 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
968 DECLARE_HYDROGEN_ACCESSOR(Sub)
969};
970
971
972class LConstantI: public LTemplateInstruction<1, 0, 0> {
973 public:
974 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
975 DECLARE_HYDROGEN_ACCESSOR(Constant)
976
977 int32_t value() const { return hydrogen()->Integer32Value(); }
978};
979
980
981class LConstantD: public LTemplateInstruction<1, 0, 0> {
982 public:
983 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
984 DECLARE_HYDROGEN_ACCESSOR(Constant)
985
986 double value() const { return hydrogen()->DoubleValue(); }
987};
988
989
990class LConstantT: public LTemplateInstruction<1, 0, 0> {
991 public:
992 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
993 DECLARE_HYDROGEN_ACCESSOR(Constant)
994
995 Handle<Object> value() const { return hydrogen()->handle(); }
996};
997
998
999class LBranch: public LControlInstruction<1, 0> {
1000 public:
1001 explicit LBranch(LOperand* value) {
1002 inputs_[0] = value;
1003 }
1004
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001005 LOperand* value() { return inputs_[0]; }
1006
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001007 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1008 DECLARE_HYDROGEN_ACCESSOR(Branch)
1009
1010 virtual void PrintDataTo(StringStream* stream);
1011};
1012
1013
1014class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1015 public:
1016 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1017 inputs_[0] = value;
1018 temps_[0] = temp;
1019 }
1020
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001021 LOperand* value() { return inputs_[0]; }
1022 LOperand* temp() { return temps_[0]; }
1023
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001024 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1025 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1026
1027 virtual bool IsControl() const { return true; }
1028
1029 Handle<Map> map() const { return hydrogen()->map(); }
1030 int true_block_id() const {
1031 return hydrogen()->FirstSuccessor()->block_id();
1032 }
1033 int false_block_id() const {
1034 return hydrogen()->SecondSuccessor()->block_id();
1035 }
1036};
1037
1038
1039class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
1040 public:
1041 explicit LJSArrayLength(LOperand* value) {
1042 inputs_[0] = value;
1043 }
1044
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001045 LOperand* value() { return inputs_[0]; }
1046
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001047 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
1048 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
1049};
1050
1051
1052class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1053 public:
1054 explicit LFixedArrayBaseLength(LOperand* value) {
1055 inputs_[0] = value;
1056 }
1057
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001058 LOperand* value() { return inputs_[0]; }
1059
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001060 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1061 "fixed-array-base-length")
1062 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1063};
1064
1065
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001066class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1067 public:
1068 explicit LMapEnumLength(LOperand* value) {
1069 inputs_[0] = value;
1070 }
1071
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001072 LOperand* value() { return inputs_[0]; }
1073
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001074 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1075};
1076
1077
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001078class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1079 public:
1080 explicit LElementsKind(LOperand* value) {
1081 inputs_[0] = value;
1082 }
1083
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001084 LOperand* value() { return inputs_[0]; }
1085
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001086 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1087 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1088};
1089
1090
1091class LValueOf: public LTemplateInstruction<1, 1, 1> {
1092 public:
1093 LValueOf(LOperand* value, LOperand* temp) {
1094 inputs_[0] = value;
1095 temps_[0] = temp;
1096 }
1097
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001098 LOperand* value() { return inputs_[0]; }
1099 LOperand* temp() { return temps_[0]; }
1100
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001101 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1102 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1103};
1104
1105
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001106class LDateField: public LTemplateInstruction<1, 1, 1> {
1107 public:
1108 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1109 inputs_[0] = date;
1110 temps_[0] = temp;
1111 }
1112
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001113 LOperand* date() { return inputs_[0]; }
1114 LOperand* temp() { return temps_[0]; }
1115 Smi* index() const { return index_; }
1116
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001117 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1118 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001119
1120 private:
1121 Smi* index_;
1122};
1123
1124
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001125class LThrow: public LTemplateInstruction<0, 1, 0> {
1126 public:
1127 explicit LThrow(LOperand* value) {
1128 inputs_[0] = value;
1129 }
1130
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001131 LOperand* value() { return inputs_[0]; }
1132
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001133 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1134};
1135
1136
1137class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1138 public:
1139 explicit LBitNotI(LOperand* value) {
1140 inputs_[0] = value;
1141 }
1142
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001143 LOperand* value() { return inputs_[0]; }
1144
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001145 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1146};
1147
1148
1149class LAddI: public LTemplateInstruction<1, 2, 0> {
1150 public:
1151 LAddI(LOperand* left, LOperand* right) {
1152 inputs_[0] = left;
1153 inputs_[1] = right;
1154 }
1155
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001156 LOperand* left() { return inputs_[0]; }
1157 LOperand* right() { return inputs_[1]; }
1158
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001159 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1160 DECLARE_HYDROGEN_ACCESSOR(Add)
1161};
1162
1163
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001164class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1165 public:
1166 LMathMinMax(LOperand* left, LOperand* right) {
1167 inputs_[0] = left;
1168 inputs_[1] = right;
1169 }
1170
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001171 LOperand* left() { return inputs_[0]; }
1172 LOperand* right() { return inputs_[1]; }
1173
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001174 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max")
1175 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1176};
1177
1178
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001179class LPower: public LTemplateInstruction<1, 2, 0> {
1180 public:
1181 LPower(LOperand* left, LOperand* right) {
1182 inputs_[0] = left;
1183 inputs_[1] = right;
1184 }
1185
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001186 LOperand* left() { return inputs_[0]; }
1187 LOperand* right() { return inputs_[1]; }
1188
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001189 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1190 DECLARE_HYDROGEN_ACCESSOR(Power)
1191};
1192
1193
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001194class LRandom: public LTemplateInstruction<1, 1, 0> {
1195 public:
1196 explicit LRandom(LOperand* global_object) {
1197 inputs_[0] = global_object;
1198 }
1199
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001200 LOperand* global_object() { return inputs_[0]; }
1201
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001202 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1203 DECLARE_HYDROGEN_ACCESSOR(Random)
1204};
1205
1206
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001207class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1208 public:
1209 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1210 : op_(op) {
1211 inputs_[0] = left;
1212 inputs_[1] = right;
1213 }
1214
1215 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001216 LOperand* left() { return inputs_[0]; }
1217 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001218
1219 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1220 virtual void CompileToNative(LCodeGen* generator);
1221 virtual const char* Mnemonic() const;
1222
1223 private:
1224 Token::Value op_;
1225};
1226
1227
1228class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1229 public:
1230 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1231 : op_(op) {
1232 inputs_[0] = left;
1233 inputs_[1] = right;
1234 }
1235
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001236 LOperand* left() { return inputs_[0]; }
1237 LOperand* right() { return inputs_[1]; }
1238 Token::Value op() const { return op_; }
1239
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001240 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1241 virtual void CompileToNative(LCodeGen* generator);
1242 virtual const char* Mnemonic() const;
1243
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001244 private:
1245 Token::Value op_;
1246};
1247
1248
1249class LReturn: public LTemplateInstruction<0, 1, 0> {
1250 public:
1251 explicit LReturn(LOperand* value) {
1252 inputs_[0] = value;
1253 }
1254
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001255 LOperand* value() { return inputs_[0]; }
1256
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001257 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1258};
1259
1260
1261class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1262 public:
1263 explicit LLoadNamedField(LOperand* object) {
1264 inputs_[0] = object;
1265 }
1266
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001267 LOperand* object() { return inputs_[0]; }
1268
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001269 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1270 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1271};
1272
1273
1274class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1275 public:
1276 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1277 inputs_[0] = object;
1278 }
1279
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001280 LOperand* object() { return inputs_[0]; }
1281
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001282 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1283 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001284};
1285
1286
1287class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1288 public:
1289 explicit LLoadNamedGeneric(LOperand* object) {
1290 inputs_[0] = object;
1291 }
1292
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001293 LOperand* object() { return inputs_[0]; }
1294
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001295 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1296 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1297
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001298 Handle<Object> name() const { return hydrogen()->name(); }
1299};
1300
1301
1302class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1303 public:
1304 explicit LLoadFunctionPrototype(LOperand* function) {
1305 inputs_[0] = function;
1306 }
1307
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001308 LOperand* function() { return inputs_[0]; }
1309
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001310 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1311 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001312};
1313
1314
1315class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1316 public:
1317 explicit LLoadElements(LOperand* object) {
1318 inputs_[0] = object;
1319 }
1320
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001321 LOperand* object() { return inputs_[0]; }
1322
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001323 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1324};
1325
1326
1327class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1328 public:
1329 explicit LLoadExternalArrayPointer(LOperand* object) {
1330 inputs_[0] = object;
1331 }
1332
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001333 LOperand* object() { return inputs_[0]; }
1334
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001335 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1336 "load-external-array-pointer")
1337};
1338
1339
1340class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> {
1341 public:
1342 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1343 inputs_[0] = elements;
1344 inputs_[1] = key;
1345 }
1346
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001347 LOperand* elements() { return inputs_[0]; }
1348 LOperand* key() { return inputs_[1]; }
1349
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001350 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1351 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1352
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001353 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001354};
1355
1356
1357class LLoadKeyedFastDoubleElement: public LTemplateInstruction<1, 2, 0> {
1358 public:
1359 LLoadKeyedFastDoubleElement(LOperand* elements, LOperand* key) {
1360 inputs_[0] = elements;
1361 inputs_[1] = key;
1362 }
1363
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001364 LOperand* elements() { return inputs_[0]; }
1365 LOperand* key() { return inputs_[1]; }
1366
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001367 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement,
1368 "load-keyed-fast-double-element")
1369 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastDoubleElement)
1370
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001371 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001372};
1373
1374
1375class LLoadKeyedSpecializedArrayElement: public LTemplateInstruction<1, 2, 0> {
1376 public:
svenpanne@chromium.org830d30c2012-05-29 13:20:14 +00001377 LLoadKeyedSpecializedArrayElement(LOperand* external_pointer,
1378 LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001379 inputs_[0] = external_pointer;
1380 inputs_[1] = key;
1381 }
1382
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001383 LOperand* external_pointer() { return inputs_[0]; }
1384 LOperand* key() { return inputs_[1]; }
1385
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001386 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement,
1387 "load-keyed-specialized-array-element")
1388 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedSpecializedArrayElement)
1389
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001390 ElementsKind elements_kind() const {
1391 return hydrogen()->elements_kind();
1392 }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001393 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001394};
1395
1396
1397class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1398 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001399 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1400 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001401 inputs_[1] = key;
1402 }
1403
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001404 LOperand* object() { return inputs_[0]; }
1405 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001406
1407 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001408};
1409
1410
1411class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1412 public:
1413 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1414 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1415};
1416
1417
1418class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1419 public:
1420 explicit LLoadGlobalGeneric(LOperand* global_object) {
1421 inputs_[0] = global_object;
1422 }
1423
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001424 LOperand* global_object() { return inputs_[0]; }
1425
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001426 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1427 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1428
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001429 Handle<Object> name() const { return hydrogen()->name(); }
1430 bool for_typeof() const { return hydrogen()->for_typeof(); }
1431};
1432
1433
1434class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1435 public:
1436 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1437 inputs_[0] = value;
1438 temps_[0] = temp;
1439 }
1440
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001441 LOperand* value() { return inputs_[0]; }
1442 LOperand* temp() { return temps_[0]; }
1443
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001444 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1445 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1446};
1447
1448
1449class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1450 public:
1451 explicit LStoreGlobalGeneric(LOperand* global_object,
1452 LOperand* value) {
1453 inputs_[0] = global_object;
1454 inputs_[1] = value;
1455 }
1456
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001457 LOperand* global_object() { return inputs_[0]; }
1458 LOperand* value() { return inputs_[1]; }
1459
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001460 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1461 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1462
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001463 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001464 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001465};
1466
1467
1468class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1469 public:
1470 explicit LLoadContextSlot(LOperand* context) {
1471 inputs_[0] = context;
1472 }
1473
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001474 LOperand* context() { return inputs_[0]; }
1475
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001476 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1477 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1478
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001479 int slot_index() { return hydrogen()->slot_index(); }
1480
1481 virtual void PrintDataTo(StringStream* stream);
1482};
1483
1484
1485class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1486 public:
1487 LStoreContextSlot(LOperand* context, LOperand* value) {
1488 inputs_[0] = context;
1489 inputs_[1] = value;
1490 }
1491
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001492 LOperand* context() { return inputs_[0]; }
1493 LOperand* value() { return inputs_[1]; }
1494
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001495 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1496 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1497
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001498 int slot_index() { return hydrogen()->slot_index(); }
1499
1500 virtual void PrintDataTo(StringStream* stream);
1501};
1502
1503
1504class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1505 public:
1506 explicit LPushArgument(LOperand* value) {
1507 inputs_[0] = value;
1508 }
1509
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001510 LOperand* value() { return inputs_[0]; }
1511
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001512 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1513};
1514
1515
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001516class LDrop: public LTemplateInstruction<0, 0, 0> {
1517 public:
1518 explicit LDrop(int count) : count_(count) { }
1519
1520 int count() const { return count_; }
1521
1522 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1523
1524 private:
1525 int count_;
1526};
1527
1528
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001529class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1530 public:
1531 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1532 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1533};
1534
1535
1536class LContext: public LTemplateInstruction<1, 0, 0> {
1537 public:
1538 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1539};
1540
1541
1542class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1543 public:
1544 explicit LOuterContext(LOperand* context) {
1545 inputs_[0] = context;
1546 }
1547
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001548 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001549
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001550 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001551};
1552
1553
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001554class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1555 public:
1556 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1557 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1558};
1559
1560
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001561class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1562 public:
1563 explicit LGlobalObject(LOperand* context) {
1564 inputs_[0] = context;
1565 }
1566
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001567 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001568
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001569 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001570};
1571
1572
1573class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1574 public:
1575 explicit LGlobalReceiver(LOperand* global_object) {
1576 inputs_[0] = global_object;
1577 }
1578
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001579 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001580
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001581 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001582};
1583
1584
1585class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1586 public:
1587 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1588 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1589
1590 virtual void PrintDataTo(StringStream* stream);
1591
1592 Handle<JSFunction> function() { return hydrogen()->function(); }
1593 int arity() const { return hydrogen()->argument_count() - 1; }
1594};
1595
1596
1597class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1598 public:
1599 explicit LInvokeFunction(LOperand* function) {
1600 inputs_[0] = function;
1601 }
1602
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001603 LOperand* function() { return inputs_[0]; }
1604
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001605 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1606 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1607
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001608 virtual void PrintDataTo(StringStream* stream);
1609
1610 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001611 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001612};
1613
1614
1615class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1616 public:
1617 explicit LCallKeyed(LOperand* key) {
1618 inputs_[0] = key;
1619 }
1620
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001621 LOperand* key() { return inputs_[0]; }
1622
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001623 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1624 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1625
1626 virtual void PrintDataTo(StringStream* stream);
1627
1628 int arity() const { return hydrogen()->argument_count() - 1; }
1629};
1630
1631
1632
1633class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1634 public:
1635 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1636 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1637
1638 virtual void PrintDataTo(StringStream* stream);
1639
1640 Handle<String> name() const { return hydrogen()->name(); }
1641 int arity() const { return hydrogen()->argument_count() - 1; }
1642};
1643
1644
danno@chromium.orgc612e022011-11-10 11:38:15 +00001645class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001646 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001647 explicit LCallFunction(LOperand* function) {
1648 inputs_[0] = function;
1649 }
1650
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001651 LOperand* function() { return inputs_[0]; }
1652
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001653 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1654 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1655
danno@chromium.orgc612e022011-11-10 11:38:15 +00001656 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001657};
1658
1659
1660class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1661 public:
1662 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1663 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1664
1665 virtual void PrintDataTo(StringStream* stream);
1666
1667 Handle<String> name() const {return hydrogen()->name(); }
1668 int arity() const { return hydrogen()->argument_count() - 1; }
1669};
1670
1671
1672class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1673 public:
1674 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1675 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1676
1677 virtual void PrintDataTo(StringStream* stream);
1678
1679 Handle<JSFunction> target() const { return hydrogen()->target(); }
1680 int arity() const { return hydrogen()->argument_count() - 1; }
1681};
1682
1683
1684class LCallNew: public LTemplateInstruction<1, 1, 0> {
1685 public:
1686 explicit LCallNew(LOperand* constructor) {
1687 inputs_[0] = constructor;
1688 }
1689
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001690 LOperand* constructor() { return inputs_[0]; }
1691
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001692 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1693 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1694
1695 virtual void PrintDataTo(StringStream* stream);
1696
1697 int arity() const { return hydrogen()->argument_count() - 1; }
1698};
1699
1700
1701class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1702 public:
1703 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1704 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1705
1706 const Runtime::Function* function() const { return hydrogen()->function(); }
1707 int arity() const { return hydrogen()->argument_count(); }
1708};
1709
1710
1711class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1712 public:
1713 explicit LInteger32ToDouble(LOperand* value) {
1714 inputs_[0] = value;
1715 }
1716
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001717 LOperand* value() { return inputs_[0]; }
1718
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001719 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1720};
1721
1722
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001723class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1724 public:
1725 explicit LUint32ToDouble(LOperand* value) {
1726 inputs_[0] = value;
1727 }
1728
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001729 LOperand* value() { return inputs_[0]; }
1730
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001731 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1732};
1733
1734
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001735class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1736 public:
1737 explicit LNumberTagI(LOperand* value) {
1738 inputs_[0] = value;
1739 }
1740
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001741 LOperand* value() { return inputs_[0]; }
1742
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001743 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1744};
1745
1746
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001747class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1748 public:
1749 explicit LNumberTagU(LOperand* value) {
1750 inputs_[0] = value;
1751 }
1752
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001753 LOperand* value() { return inputs_[0]; }
1754
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001755 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1756};
1757
1758
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001759class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1760 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001761 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001762 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001763 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001764 temps_[1] = temp2;
1765 }
1766
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001767 LOperand* value() { return inputs_[0]; }
1768 LOperand* temp() { return temps_[0]; }
1769 LOperand* temp2() { return temps_[1]; }
1770
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001771 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1772};
1773
1774
1775// Sometimes truncating conversion from a tagged value to an int32.
1776class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1777 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001778 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001779 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001780 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001781 temps_[1] = temp2;
1782 }
1783
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001784 LOperand* value() { return inputs_[0]; }
1785 LOperand* temp() { return temps_[0]; }
1786 LOperand* temp2() { return temps_[1]; }
1787
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001788 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1789 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1790
1791 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1792};
1793
1794
1795// Truncating conversion from a tagged value to an int32.
1796class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1797 public:
1798 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001799 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001800 LOperand* temp2,
1801 LOperand* temp3) {
1802 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001803 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001804 temps_[1] = temp2;
1805 temps_[2] = temp3;
1806 }
1807
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001808 LOperand* value() { return inputs_[0]; }
1809 LOperand* temp() { return temps_[0]; }
1810 LOperand* temp2() { return temps_[1]; }
1811 LOperand* temp3() { return temps_[2]; }
1812
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001813 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1814 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1815
1816 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1817};
1818
1819
1820class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1821 public:
1822 explicit LSmiTag(LOperand* value) {
1823 inputs_[0] = value;
1824 }
1825
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001826 LOperand* value() { return inputs_[0]; }
1827
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001828 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1829};
1830
1831
1832class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1833 public:
1834 explicit LNumberUntagD(LOperand* value) {
1835 inputs_[0] = value;
1836 }
1837
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001838 LOperand* value() { return inputs_[0]; }
1839
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001840 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1841 DECLARE_HYDROGEN_ACCESSOR(Change)
1842};
1843
1844
1845class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1846 public:
1847 LSmiUntag(LOperand* value, bool needs_check)
1848 : needs_check_(needs_check) {
1849 inputs_[0] = value;
1850 }
1851
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001852 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001853 bool needs_check() const { return needs_check_; }
1854
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001855 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1856
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001857 private:
1858 bool needs_check_;
1859};
1860
1861
verwaest@chromium.org37141392012-05-31 13:27:02 +00001862class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001863 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001864 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
1865 inputs_[0] = object;
1866 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001867 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001868 }
1869
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001870 LOperand* object() { return inputs_[0]; }
1871 LOperand* value() { return inputs_[1]; }
1872 LOperand* temp() { return temps_[0]; }
1873
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001874 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1875 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1876
1877 virtual void PrintDataTo(StringStream* stream);
1878
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001879 Handle<Object> name() const { return hydrogen()->name(); }
1880 bool is_in_object() { return hydrogen()->is_in_object(); }
1881 int offset() { return hydrogen()->offset(); }
1882 Handle<Map> transition() const { return hydrogen()->transition(); }
1883};
1884
1885
1886class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1887 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001888 LStoreNamedGeneric(LOperand* object, LOperand* value) {
1889 inputs_[0] = object;
1890 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001891 }
1892
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001893 LOperand* object() { return inputs_[0]; }
1894 LOperand* value() { return inputs_[1]; }
1895
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001896 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1897 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1898
1899 virtual void PrintDataTo(StringStream* stream);
1900
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001901 Handle<Object> name() const { return hydrogen()->name(); }
1902 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001903};
1904
1905
1906class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
1907 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001908 LStoreKeyedFastElement(LOperand* object, LOperand* key, LOperand* value) {
1909 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001910 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001911 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001912 }
1913
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001914 LOperand* object() { return inputs_[0]; }
1915 LOperand* key() { return inputs_[1]; }
1916 LOperand* value() { return inputs_[2]; }
1917
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001918 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1919 "store-keyed-fast-element")
1920 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1921
1922 virtual void PrintDataTo(StringStream* stream);
1923
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001924 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001925};
1926
1927
1928class LStoreKeyedFastDoubleElement: public LTemplateInstruction<0, 3, 0> {
1929 public:
1930 LStoreKeyedFastDoubleElement(LOperand* elements,
1931 LOperand* key,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001932 LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001933 inputs_[0] = elements;
1934 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001935 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001936 }
1937
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001938 LOperand* elements() { return inputs_[0]; }
1939 LOperand* key() { return inputs_[1]; }
1940 LOperand* value() { return inputs_[2]; }
1941
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001942 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement,
1943 "store-keyed-fast-double-element")
1944 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastDoubleElement)
1945
1946 virtual void PrintDataTo(StringStream* stream);
1947
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001948 uint32_t additional_index() const { return hydrogen()->index_offset(); }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001949
1950 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001951};
1952
1953
1954class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1955 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001956 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001957 inputs_[0] = obj;
1958 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001959 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001960 }
1961
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001962 LOperand* object() { return inputs_[0]; }
1963 LOperand* key() { return inputs_[1]; }
1964 LOperand* value() { return inputs_[2]; }
1965
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001966 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1967 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1968
1969 virtual void PrintDataTo(StringStream* stream);
1970
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001971 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001972};
1973
1974class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> {
1975 public:
1976 LStoreKeyedSpecializedArrayElement(LOperand* external_pointer,
1977 LOperand* key,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001978 LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001979 inputs_[0] = external_pointer;
1980 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001981 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001982 }
1983
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001984 LOperand* external_pointer() { return inputs_[0]; }
1985 LOperand* key() { return inputs_[1]; }
1986 LOperand* value() { return inputs_[2]; }
1987
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001988 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
1989 "store-keyed-specialized-array-element")
1990 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement)
1991
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001992 ElementsKind elements_kind() const { return hydrogen()->elements_kind(); }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001993 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001994};
1995
1996
1997class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1998 public:
1999 LTransitionElementsKind(LOperand* object,
2000 LOperand* new_map_temp,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002001 LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002002 inputs_[0] = object;
2003 temps_[0] = new_map_temp;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002004 temps_[1] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002005 }
2006
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002007 LOperand* object() { return inputs_[0]; }
2008 LOperand* new_map_temp() { return temps_[0]; }
2009 LOperand* temp() { return temps_[1]; }
2010
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002011 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2012 "transition-elements-kind")
2013 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2014
2015 virtual void PrintDataTo(StringStream* stream);
2016
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002017 Handle<Map> original_map() { return hydrogen()->original_map(); }
2018 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
2019};
2020
2021
2022class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2023 public:
2024 LStringAdd(LOperand* left, LOperand* right) {
2025 inputs_[0] = left;
2026 inputs_[1] = right;
2027 }
2028
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002029 LOperand* left() { return inputs_[0]; }
2030 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002031
2032 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2033 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002034};
2035
2036
2037
2038class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2039 public:
2040 LStringCharCodeAt(LOperand* string, LOperand* index) {
2041 inputs_[0] = string;
2042 inputs_[1] = index;
2043 }
2044
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002045 LOperand* string() { return inputs_[0]; }
2046 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002047
2048 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2049 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002050};
2051
2052
2053class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2054 public:
2055 explicit LStringCharFromCode(LOperand* char_code) {
2056 inputs_[0] = char_code;
2057 }
2058
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002059 LOperand* char_code() { return inputs_[0]; }
2060
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002061 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2062 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002063};
2064
2065
2066class LStringLength: public LTemplateInstruction<1, 1, 0> {
2067 public:
2068 explicit LStringLength(LOperand* string) {
2069 inputs_[0] = string;
2070 }
2071
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002072 LOperand* string() { return inputs_[0]; }
2073
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002074 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2075 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002076};
2077
2078
2079class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2080 public:
2081 explicit LCheckFunction(LOperand* value) {
2082 inputs_[0] = value;
2083 }
2084
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002085 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002086
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002087 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2088 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2089};
2090
2091
2092class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2093 public:
2094 explicit LCheckInstanceType(LOperand* value) {
2095 inputs_[0] = value;
2096 }
2097
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002098 LOperand* value() { return inputs_[0]; }
2099
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002100 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2101 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2102};
2103
2104
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002105class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002106 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002107 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002108 inputs_[0] = value;
2109 }
2110
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002111 LOperand* value() { return inputs_[0]; }
2112
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002113 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2114 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002115};
2116
2117
2118class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
2119 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002120 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2121 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002122 temps_[1] = temp2;
2123 }
2124
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002125 LOperand* temp() { return temps_[0]; }
2126 LOperand* temp2() { return temps_[1]; }
2127
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002128 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2129 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2130
2131 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
2132 Handle<JSObject> holder() const { return hydrogen()->holder(); }
2133};
2134
2135
2136class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2137 public:
2138 explicit LCheckSmi(LOperand* value) {
2139 inputs_[0] = value;
2140 }
2141
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002142 LOperand* value() { return inputs_[0]; }
2143
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002144 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2145};
2146
2147
2148class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2149 public:
2150 explicit LCheckNonSmi(LOperand* value) {
2151 inputs_[0] = value;
2152 }
2153
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002154 LOperand* value() { return inputs_[0]; }
2155
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002156 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2157};
2158
2159
2160class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2161 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002162 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2163 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002164 temps_[0] = temp;
2165 }
2166
2167 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002168 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002169
2170 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2171};
2172
2173
2174class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2175 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002176 explicit LClampIToUint8(LOperand* unclamped) {
2177 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002178 }
2179
2180 LOperand* unclamped() { return inputs_[0]; }
2181
2182 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2183};
2184
2185
2186class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2187 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002188 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2189 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002190 temps_[0] = temp;
2191 }
2192
2193 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002194 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002195
2196 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2197};
2198
2199
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002200class LAllocateObject: public LTemplateInstruction<1, 0, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002201 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002202 LAllocateObject(LOperand* temp, LOperand* temp2) {
2203 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002204 temps_[1] = temp2;
2205 }
2206
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002207 LOperand* temp() { return temps_[0]; }
2208 LOperand* temp2() { return temps_[1]; }
2209
ulan@chromium.org967e2702012-02-28 09:49:15 +00002210 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2211 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2212};
2213
2214
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002215class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
2216 public:
2217 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2218 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2219};
2220
2221
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002222class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2223 public:
2224 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2225 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2226};
2227
2228
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002229class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002230 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002231 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2232 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002233};
2234
2235
2236class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2237 public:
2238 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2239 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2240};
2241
2242
2243class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2244 public:
2245 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2246 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2247
2248 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2249};
2250
2251
2252class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2253 public:
2254 explicit LToFastProperties(LOperand* value) {
2255 inputs_[0] = value;
2256 }
2257
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002258 LOperand* value() { return inputs_[0]; }
2259
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002260 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2261 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2262};
2263
2264
2265class LTypeof: public LTemplateInstruction<1, 1, 0> {
2266 public:
2267 explicit LTypeof(LOperand* value) {
2268 inputs_[0] = value;
2269 }
2270
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002271 LOperand* value() { return inputs_[0]; }
2272
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002273 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2274};
2275
2276
2277class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2278 public:
2279 explicit LTypeofIsAndBranch(LOperand* value) {
2280 inputs_[0] = value;
2281 }
2282
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002283 LOperand* value() { return inputs_[0]; }
2284
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002285 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2286 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2287
2288 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2289
2290 virtual void PrintDataTo(StringStream* stream);
2291};
2292
2293
2294class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2295 public:
2296 explicit LIsConstructCallAndBranch(LOperand* temp) {
2297 temps_[0] = temp;
2298 }
2299
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002300 LOperand* temp() { return temps_[0]; }
2301
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002302 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2303 "is-construct-call-and-branch")
2304};
2305
2306
2307class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2308 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002309 LDeleteProperty(LOperand* object, LOperand* key) {
2310 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002311 inputs_[1] = key;
2312 }
2313
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002314 LOperand* object() { return inputs_[0]; }
2315 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002316
2317 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002318};
2319
2320
2321class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2322 public:
2323 LOsrEntry();
2324
2325 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2326
2327 LOperand** SpilledRegisterArray() { return register_spills_; }
2328 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2329
2330 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2331 void MarkSpilledDoubleRegister(int allocation_index,
2332 LOperand* spill_operand);
2333
2334 private:
2335 // Arrays of spill slot operands for registers with an assigned spill
2336 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2337 // NULL if the register has no assigned spill slot. Indexed by allocation
2338 // index.
2339 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2340 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2341};
2342
2343
2344class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2345 public:
2346 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2347 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2348
2349 Label* done_label() { return &done_label_; }
2350
2351 private:
2352 Label done_label_;
2353};
2354
2355
2356class LIn: public LTemplateInstruction<1, 2, 0> {
2357 public:
2358 LIn(LOperand* key, LOperand* object) {
2359 inputs_[0] = key;
2360 inputs_[1] = object;
2361 }
2362
2363 LOperand* key() { return inputs_[0]; }
2364 LOperand* object() { return inputs_[1]; }
2365
2366 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2367};
2368
2369
ulan@chromium.org812308e2012-02-29 15:58:45 +00002370class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2371 public:
2372 explicit LForInPrepareMap(LOperand* object) {
2373 inputs_[0] = object;
2374 }
2375
2376 LOperand* object() { return inputs_[0]; }
2377
2378 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2379};
2380
2381
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002382class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002383 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002384 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002385 inputs_[0] = map;
2386 }
2387
2388 LOperand* map() { return inputs_[0]; }
2389
2390 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2391
2392 int idx() {
2393 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2394 }
2395};
2396
2397
2398class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2399 public:
2400 LCheckMapValue(LOperand* value, LOperand* map) {
2401 inputs_[0] = value;
2402 inputs_[1] = map;
2403 }
2404
2405 LOperand* value() { return inputs_[0]; }
2406 LOperand* map() { return inputs_[1]; }
2407
2408 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2409};
2410
2411
2412class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2413 public:
2414 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2415 inputs_[0] = object;
2416 inputs_[1] = index;
2417 }
2418
2419 LOperand* object() { return inputs_[0]; }
2420 LOperand* index() { return inputs_[1]; }
2421
2422 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2423};
2424
2425
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002426class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002427class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002428 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002429 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2430 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002431
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002432 int GetNextSpillIndex(bool is_double);
2433 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002434};
2435
2436
2437class LChunkBuilder BASE_EMBEDDED {
2438 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002439 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2440 : chunk_(NULL),
2441 info_(info),
2442 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002443 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002444 status_(UNUSED),
2445 current_instruction_(NULL),
2446 current_block_(NULL),
2447 next_block_(NULL),
2448 argument_count_(0),
2449 allocator_(allocator),
2450 position_(RelocInfo::kNoPosition),
2451 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002452 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002453
2454 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002455 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002456
2457 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002458#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002459 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2460#undef DECLARE_DO
2461
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002462 private:
2463 enum Status {
2464 UNUSED,
2465 BUILDING,
2466 DONE,
2467 ABORTED
2468 };
2469
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002470 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002471 CompilationInfo* info() const { return info_; }
2472 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002473 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002474
2475 bool is_unused() const { return status_ == UNUSED; }
2476 bool is_building() const { return status_ == BUILDING; }
2477 bool is_done() const { return status_ == DONE; }
2478 bool is_aborted() const { return status_ == ABORTED; }
2479
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002480 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002481
2482 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002483 LUnallocated* ToUnallocated(Register reg);
2484 LUnallocated* ToUnallocated(DoubleRegister reg);
2485
2486 // Methods for setting up define-use relationships.
2487 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2488 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2489 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2490 DoubleRegister fixed_register);
2491
2492 // A value that is guaranteed to be allocated to a register.
2493 // Operand created by UseRegister is guaranteed to be live until the end of
2494 // instruction. This means that register allocator will not reuse it's
2495 // register for any other operand inside instruction.
2496 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2497 // instruction start. Register allocator is free to assign the same register
2498 // to some other operand used inside instruction (i.e. temporary or
2499 // output).
2500 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2501 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2502
2503 // An input operand in a register that may be trashed.
2504 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2505
2506 // An input operand in a register or stack slot.
2507 MUST_USE_RESULT LOperand* Use(HValue* value);
2508 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2509
2510 // An input operand in a register, stack slot or a constant operand.
2511 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2512 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2513
2514 // An input operand in a register or a constant operand.
2515 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2516 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2517
2518 // An input operand in register, stack slot or a constant operand.
2519 // Will not be moved to a register even if one is freely available.
2520 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2521
2522 // Temporary operand that must be in a register.
2523 MUST_USE_RESULT LUnallocated* TempRegister();
2524 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2525 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2526
2527 // Methods for setting up define-use relationships.
2528 // Return the same instruction that they are passed.
2529 template<int I, int T>
2530 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2531 LUnallocated* result);
2532 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002533 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2534 template<int I, int T>
2535 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2536 int index);
2537 template<int I, int T>
2538 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2539 template<int I, int T>
2540 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2541 Register reg);
2542 template<int I, int T>
2543 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2544 DoubleRegister reg);
2545 LInstruction* AssignEnvironment(LInstruction* instr);
2546 LInstruction* AssignPointerMap(LInstruction* instr);
2547
2548 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2549
2550 // By default we assume that instruction sequences generated for calls
2551 // cannot deoptimize eagerly and we do not attach environment to this
2552 // instruction.
2553 LInstruction* MarkAsCall(
2554 LInstruction* instr,
2555 HInstruction* hinstr,
2556 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002557
2558 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2559 int* argument_index_accumulator);
2560
2561 void VisitInstruction(HInstruction* current);
2562
2563 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2564 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2565 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2566 LInstruction* DoArithmeticD(Token::Value op,
2567 HArithmeticBinaryOperation* instr);
2568 LInstruction* DoArithmeticT(Token::Value op,
2569 HArithmeticBinaryOperation* instr);
2570
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002571 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002572 CompilationInfo* info_;
2573 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002574 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002575 Status status_;
2576 HInstruction* current_instruction_;
2577 HBasicBlock* current_block_;
2578 HBasicBlock* next_block_;
2579 int argument_count_;
2580 LAllocator* allocator_;
2581 int position_;
2582 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002583 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002584
lrn@chromium.org7516f052011-03-30 08:52:27 +00002585 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2586};
2587
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002588#undef DECLARE_HYDROGEN_ACCESSOR
2589#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002590
2591} } // namespace v8::internal
2592
2593#endif // V8_MIPS_LITHIUM_MIPS_H_