blob: 738a46434ba3f0360fd7faf8b25b559207f04b78 [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) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +000053 V(Allocate) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000054 V(ApplyArguments) \
55 V(ArgumentsElements) \
56 V(ArgumentsLength) \
57 V(ArithmeticD) \
58 V(ArithmeticT) \
59 V(ArrayLiteral) \
60 V(BitI) \
61 V(BitNotI) \
62 V(BoundsCheck) \
63 V(Branch) \
64 V(CallConstantFunction) \
65 V(CallFunction) \
66 V(CallGlobal) \
67 V(CallKeyed) \
68 V(CallKnownGlobal) \
69 V(CallNamed) \
70 V(CallNew) \
71 V(CallRuntime) \
72 V(CallStub) \
73 V(CheckFunction) \
74 V(CheckInstanceType) \
jkummerow@chromium.org1456e702012-03-30 08:38:13 +000075 V(CheckMaps) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000076 V(CheckNonSmi) \
77 V(CheckPrototypeMaps) \
78 V(CheckSmi) \
79 V(ClampDToUint8) \
80 V(ClampIToUint8) \
81 V(ClampTToUint8) \
82 V(ClassOfTestAndBranch) \
83 V(CmpConstantEqAndBranch) \
84 V(CmpIDAndBranch) \
85 V(CmpObjectEqAndBranch) \
86 V(CmpMapAndBranch) \
87 V(CmpT) \
88 V(ConstantD) \
89 V(ConstantI) \
90 V(ConstantT) \
91 V(Context) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000092 V(DeclareGlobals) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000093 V(DeleteProperty) \
94 V(Deoptimize) \
95 V(DivI) \
96 V(DoubleToI) \
yangguo@chromium.org46a2a512013-01-18 16:29:40 +000097 V(DummyUse) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000098 V(ElementsKind) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000099 V(FastLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000100 V(FixedArrayBaseLength) \
101 V(FunctionLiteral) \
102 V(GetCachedArrayIndex) \
103 V(GlobalObject) \
104 V(GlobalReceiver) \
105 V(Goto) \
106 V(HasCachedArrayIndexAndBranch) \
107 V(HasInstanceTypeAndBranch) \
108 V(In) \
109 V(InstanceOf) \
110 V(InstanceOfKnownGlobal) \
111 V(InstructionGap) \
112 V(Integer32ToDouble) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000113 V(Uint32ToDouble) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000114 V(InvokeFunction) \
115 V(IsConstructCallAndBranch) \
116 V(IsNilAndBranch) \
117 V(IsObjectAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000118 V(IsStringAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000119 V(IsSmiAndBranch) \
120 V(IsUndetectableAndBranch) \
121 V(JSArrayLength) \
122 V(Label) \
123 V(LazyBailout) \
124 V(LoadContextSlot) \
125 V(LoadElements) \
126 V(LoadExternalArrayPointer) \
127 V(LoadFunctionPrototype) \
128 V(LoadGlobalCell) \
129 V(LoadGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000130 V(LoadKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000131 V(LoadKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000132 V(LoadNamedField) \
133 V(LoadNamedFieldPolymorphic) \
134 V(LoadNamedGeneric) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000135 V(MapEnumLength) \
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000136 V(MathExp) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000137 V(MathMinMax) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000138 V(ModI) \
139 V(MulI) \
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000140 V(MultiplyAddD) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000141 V(NumberTagD) \
142 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000143 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000144 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000145 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000146 V(OsrEntry) \
147 V(OuterContext) \
148 V(Parameter) \
149 V(Power) \
150 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000151 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000152 V(RegExpLiteral) \
153 V(Return) \
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000154 V(SeqStringSetChar) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000155 V(ShiftI) \
156 V(SmiTag) \
157 V(SmiUntag) \
158 V(StackCheck) \
159 V(StoreContextSlot) \
160 V(StoreGlobalCell) \
161 V(StoreGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000162 V(StoreKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000163 V(StoreKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000164 V(StoreNamedField) \
165 V(StoreNamedGeneric) \
166 V(StringAdd) \
167 V(StringCharCodeAt) \
168 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000169 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000170 V(StringLength) \
171 V(SubI) \
172 V(TaggedToI) \
173 V(ThisFunction) \
174 V(Throw) \
175 V(ToFastProperties) \
176 V(TransitionElementsKind) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000177 V(TrapAllocationMemento) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000178 V(Typeof) \
179 V(TypeofIsAndBranch) \
180 V(UnaryMathOperation) \
181 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000182 V(ValueOf) \
183 V(ForInPrepareMap) \
184 V(ForInCacheArray) \
185 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000186 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000187 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000188 V(WrapReceiver) \
189 V(Drop)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000190
191#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
192 virtual Opcode opcode() const { return LInstruction::k##type; } \
193 virtual void CompileToNative(LCodeGen* generator); \
194 virtual const char* Mnemonic() const { return mnemonic; } \
195 static L##type* cast(LInstruction* instr) { \
196 ASSERT(instr->Is##type()); \
197 return reinterpret_cast<L##type*>(instr); \
198 }
199
200
201#define DECLARE_HYDROGEN_ACCESSOR(type) \
202 H##type* hydrogen() const { \
203 return H##type::cast(hydrogen_value()); \
204 }
205
lrn@chromium.org7516f052011-03-30 08:52:27 +0000206
207class LInstruction: public ZoneObject {
208 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000209 LInstruction()
210 : environment_(NULL),
211 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000212 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000213 virtual ~LInstruction() { }
214
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000215 virtual void CompileToNative(LCodeGen* generator) = 0;
216 virtual const char* Mnemonic() const = 0;
217 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000218 virtual void PrintDataTo(StringStream* stream);
219 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000220
221 enum Opcode {
222 // Declare a unique enum value for each instruction.
223#define DECLARE_OPCODE(type) k##type,
224 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
225 kNumberOfInstructions
226#undef DECLARE_OPCODE
227 };
228
229 virtual Opcode opcode() const = 0;
230
231 // Declare non-virtual type testers for all leaf IR classes.
232#define DECLARE_PREDICATE(type) \
233 bool Is##type() const { return opcode() == k##type; }
234 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
235#undef DECLARE_PREDICATE
236
237 // Declare virtual predicates for instructions that don't have
238 // an opcode.
239 virtual bool IsGap() const { return false; }
240
241 virtual bool IsControl() const { return false; }
242
243 void set_environment(LEnvironment* env) { environment_ = env; }
244 LEnvironment* environment() const { return environment_; }
245 bool HasEnvironment() const { return environment_ != NULL; }
246
247 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
248 LPointerMap* pointer_map() const { return pointer_map_.get(); }
249 bool HasPointerMap() const { return pointer_map_.is_set(); }
250
251 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
252 HValue* hydrogen_value() const { return hydrogen_value_; }
253
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000254 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000255
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000256 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000257
258 // Interface to the register allocator and iterators.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000259 bool ClobbersTemps() const { return is_call_; }
260 bool ClobbersRegisters() const { return is_call_; }
261 bool ClobbersDoubleRegisters() const { return is_call_; }
262
263 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000264 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000265
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000266 virtual bool HasResult() const = 0;
267 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000268
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000269 LOperand* FirstInput() { return InputAt(0); }
270 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000271
272#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000273 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000274#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000275
276 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000277 // Iterator interface.
278 friend class InputIterator;
279 virtual int InputCount() = 0;
280 virtual LOperand* InputAt(int i) = 0;
281
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000282 friend class TempIterator;
283 virtual int TempCount() = 0;
284 virtual LOperand* TempAt(int i) = 0;
285
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000286 LEnvironment* environment_;
287 SetOncePointer<LPointerMap> pointer_map_;
288 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000289 bool is_call_;
290 bool is_save_doubles_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000291};
292
293
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000294// R = number of result operands (0 or 1).
295// I = number of input operands.
296// T = number of temporary operands.
297template<int R, int I, int T>
298class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000299 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000300 // Allow 0 or 1 output operands.
301 STATIC_ASSERT(R == 0 || R == 1);
302 virtual bool HasResult() const { return R != 0; }
303 void set_result(LOperand* operand) { results_[0] = operand; }
304 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000305
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000306 protected:
307 EmbeddedContainer<LOperand*, R> results_;
308 EmbeddedContainer<LOperand*, I> inputs_;
309 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000310
311 private:
312 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000313 virtual LOperand* InputAt(int i) { return inputs_[i]; }
314
315 virtual int TempCount() { return T; }
316 virtual LOperand* TempAt(int i) { return temps_[i]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000317};
318
319
320class LGap: public LTemplateInstruction<0, 0, 0> {
321 public:
322 explicit LGap(HBasicBlock* block)
323 : block_(block) {
324 parallel_moves_[BEFORE] = NULL;
325 parallel_moves_[START] = NULL;
326 parallel_moves_[END] = NULL;
327 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000328 }
329
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000330 // Can't use the DECLARE-macro here because of sub-classes.
331 virtual bool IsGap() const { return true; }
332 virtual void PrintDataTo(StringStream* stream);
333 static LGap* cast(LInstruction* instr) {
334 ASSERT(instr->IsGap());
335 return reinterpret_cast<LGap*>(instr);
336 }
337
338 bool IsRedundant() const;
339
340 HBasicBlock* block() const { return block_; }
341
lrn@chromium.org7516f052011-03-30 08:52:27 +0000342 enum InnerPosition {
343 BEFORE,
344 START,
345 END,
346 AFTER,
347 FIRST_INNER_POSITION = BEFORE,
348 LAST_INNER_POSITION = AFTER
349 };
350
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000351 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
352 if (parallel_moves_[pos] == NULL) {
353 parallel_moves_[pos] = new(zone) LParallelMove(zone);
354 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000355 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000356 }
357
358 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000359 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000360 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000361
362 private:
363 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
364 HBasicBlock* block_;
365};
366
367
368class LInstructionGap: public LGap {
369 public:
370 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
371
372 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
373};
374
375
376class LGoto: public LTemplateInstruction<0, 0, 0> {
377 public:
378 explicit LGoto(int block_id) : block_id_(block_id) { }
379
380 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
381 virtual void PrintDataTo(StringStream* stream);
382 virtual bool IsControl() const { return true; }
383
384 int block_id() const { return block_id_; }
385
386 private:
387 int block_id_;
388};
389
390
391class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
392 public:
393 LLazyBailout() : gap_instructions_size_(0) { }
394
395 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
396
397 void set_gap_instructions_size(int gap_instructions_size) {
398 gap_instructions_size_ = gap_instructions_size;
399 }
400 int gap_instructions_size() { return gap_instructions_size_; }
401
402 private:
403 int gap_instructions_size_;
404};
405
406
yangguo@chromium.org46a2a512013-01-18 16:29:40 +0000407class LDummyUse: public LTemplateInstruction<1, 1, 0> {
408 public:
409 explicit LDummyUse(LOperand* value) {
410 inputs_[0] = value;
411 }
412 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
413};
414
415
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000416class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
417 public:
418 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000419};
420
421
422class LLabel: public LGap {
423 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000424 explicit LLabel(HBasicBlock* block)
425 : LGap(block), replacement_(NULL) { }
426
427 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
428
429 virtual void PrintDataTo(StringStream* stream);
430
431 int block_id() const { return block()->block_id(); }
432 bool is_loop_header() const { return block()->IsLoopHeader(); }
433 Label* label() { return &label_; }
434 LLabel* replacement() const { return replacement_; }
435 void set_replacement(LLabel* label) { replacement_ = label; }
436 bool HasReplacement() const { return replacement_ != NULL; }
437
438 private:
439 Label label_;
440 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000441};
442
443
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000444class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000445 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000446 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
447};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000448
lrn@chromium.org7516f052011-03-30 08:52:27 +0000449
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000450class LCallStub: public LTemplateInstruction<1, 0, 0> {
451 public:
452 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
453 DECLARE_HYDROGEN_ACCESSOR(CallStub)
454
455 TranscendentalCache::Type transcendental_type() {
456 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000457 }
458};
459
460
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000461class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
462 public:
463 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
464};
465
466
467template<int I, int T>
468class LControlInstruction: public LTemplateInstruction<0, I, T> {
469 public:
470 virtual bool IsControl() const { return true; }
471
472 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
473 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
474 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
475 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
476
477 private:
478 HControlInstruction* hydrogen() {
479 return HControlInstruction::cast(this->hydrogen_value());
480 }
481};
482
483
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000484class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
485 public:
486 LWrapReceiver(LOperand* receiver, LOperand* function) {
487 inputs_[0] = receiver;
488 inputs_[1] = function;
489 }
490
491 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
492
493 LOperand* receiver() { return inputs_[0]; }
494 LOperand* function() { return inputs_[1]; }
495};
496
497
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000498class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
499 public:
500 LApplyArguments(LOperand* function,
501 LOperand* receiver,
502 LOperand* length,
503 LOperand* elements) {
504 inputs_[0] = function;
505 inputs_[1] = receiver;
506 inputs_[2] = length;
507 inputs_[3] = elements;
508 }
509
510 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
511
512 LOperand* function() { return inputs_[0]; }
513 LOperand* receiver() { return inputs_[1]; }
514 LOperand* length() { return inputs_[2]; }
515 LOperand* elements() { return inputs_[3]; }
516};
517
518
519class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
520 public:
521 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
522 inputs_[0] = arguments;
523 inputs_[1] = length;
524 inputs_[2] = index;
525 }
526
527 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
528
529 LOperand* arguments() { return inputs_[0]; }
530 LOperand* length() { return inputs_[1]; }
531 LOperand* index() { return inputs_[2]; }
532
533 virtual void PrintDataTo(StringStream* stream);
534};
535
536
537class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
538 public:
539 explicit LArgumentsLength(LOperand* elements) {
540 inputs_[0] = elements;
541 }
542
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000543 LOperand* elements() { return inputs_[0]; }
544
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000545 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
546};
547
548
549class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
550 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000551 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000552 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000553};
554
555
556class LModI: public LTemplateInstruction<1, 2, 3> {
557 public:
558 // Used when the right hand is a constant power of 2.
559 LModI(LOperand* left,
560 LOperand* right) {
561 inputs_[0] = left;
562 inputs_[1] = right;
563 temps_[0] = NULL;
564 temps_[1] = NULL;
565 temps_[2] = NULL;
566 }
567
568 // Used for the standard case.
569 LModI(LOperand* left,
570 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000571 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000572 LOperand* temp2,
573 LOperand* temp3) {
574 inputs_[0] = left;
575 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000576 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000577 temps_[1] = temp2;
578 temps_[2] = temp3;
579 }
580
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000581 LOperand* left() { return inputs_[0]; }
582 LOperand* right() { return inputs_[1]; }
583 LOperand* temp() { return temps_[0]; }
584 LOperand* temp2() { return temps_[1]; }
585 LOperand* temp3() { return temps_[2]; }
586
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000587 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
588 DECLARE_HYDROGEN_ACCESSOR(Mod)
589};
590
591
592class LDivI: public LTemplateInstruction<1, 2, 0> {
593 public:
594 LDivI(LOperand* left, LOperand* right) {
595 inputs_[0] = left;
596 inputs_[1] = right;
597 }
598
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000599 LOperand* left() { return inputs_[0]; }
600 LOperand* right() { return inputs_[1]; }
601
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000602 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
603 DECLARE_HYDROGEN_ACCESSOR(Div)
604};
605
606
607class LMulI: public LTemplateInstruction<1, 2, 1> {
608 public:
609 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
610 inputs_[0] = left;
611 inputs_[1] = right;
612 temps_[0] = temp;
613 }
614
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000615 LOperand* left() { return inputs_[0]; }
616 LOperand* right() { return inputs_[1]; }
617 LOperand* temp() { return temps_[0]; }
618
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000619 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
620 DECLARE_HYDROGEN_ACCESSOR(Mul)
621};
622
623
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000624// Instruction for computing multiplier * multiplicand + addend.
625class LMultiplyAddD: public LTemplateInstruction<1, 3, 0> {
626 public:
627 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
628 LOperand* multiplicand) {
629 inputs_[0] = addend;
630 inputs_[1] = multiplier;
631 inputs_[2] = multiplicand;
632 }
633
634 LOperand* addend() { return inputs_[0]; }
635 LOperand* multiplier() { return inputs_[1]; }
636 LOperand* multiplicand() { return inputs_[2]; }
637
638 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
639};
640
641
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000642class LCmpIDAndBranch: public LControlInstruction<2, 0> {
643 public:
644 LCmpIDAndBranch(LOperand* left, LOperand* right) {
645 inputs_[0] = left;
646 inputs_[1] = right;
647 }
648
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000649 LOperand* left() { return inputs_[0]; }
650 LOperand* right() { return inputs_[1]; }
651
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000652 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
653 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
654
655 Token::Value op() const { return hydrogen()->token(); }
656 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000657 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000658 }
659
660 virtual void PrintDataTo(StringStream* stream);
661};
662
663
664class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
665 public:
666 LUnaryMathOperation(LOperand* value, LOperand* temp) {
667 inputs_[0] = value;
668 temps_[0] = temp;
669 }
670
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000671 LOperand* value() { return inputs_[0]; }
672 LOperand* temp() { return temps_[0]; }
673
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000674 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
675 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
676
677 virtual void PrintDataTo(StringStream* stream);
678 BuiltinFunctionId op() const { return hydrogen()->op(); }
679};
680
681
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000682class LMathExp: public LTemplateInstruction<1, 1, 3> {
683 public:
684 LMathExp(LOperand* value,
685 LOperand* double_temp,
686 LOperand* temp1,
687 LOperand* temp2) {
688 inputs_[0] = value;
689 temps_[0] = temp1;
690 temps_[1] = temp2;
691 temps_[2] = double_temp;
692 ExternalReference::InitializeMathExpData();
693 }
694
695 LOperand* value() { return inputs_[0]; }
696 LOperand* temp1() { return temps_[0]; }
697 LOperand* temp2() { return temps_[1]; }
698 LOperand* double_temp() { return temps_[2]; }
699
700 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
701
702 virtual void PrintDataTo(StringStream* stream);
703};
704
705
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000706class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
707 public:
708 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
709 inputs_[0] = left;
710 inputs_[1] = right;
711 }
712
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000713 LOperand* left() { return inputs_[0]; }
714 LOperand* right() { return inputs_[1]; }
715
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000716 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
717 "cmp-object-eq-and-branch")
718 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
719};
720
721
722class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
723 public:
724 explicit LCmpConstantEqAndBranch(LOperand* left) {
725 inputs_[0] = left;
726 }
727
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000728 LOperand* left() { return inputs_[0]; }
729
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000730 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
731 "cmp-constant-eq-and-branch")
732 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
733};
734
735
736class LIsNilAndBranch: public LControlInstruction<1, 0> {
737 public:
738 explicit LIsNilAndBranch(LOperand* value) {
739 inputs_[0] = value;
740 }
741
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000742 LOperand* value() { return inputs_[0]; }
743
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000744 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
745 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
746
747 EqualityKind kind() const { return hydrogen()->kind(); }
748 NilValue nil() const { return hydrogen()->nil(); }
749
750 virtual void PrintDataTo(StringStream* stream);
751};
752
753
754class LIsObjectAndBranch: public LControlInstruction<1, 1> {
755 public:
756 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
757 inputs_[0] = value;
758 temps_[0] = temp;
759 }
760
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000761 LOperand* value() { return inputs_[0]; }
762 LOperand* temp() { return temps_[0]; }
763
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000764 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
765 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
766
767 virtual void PrintDataTo(StringStream* stream);
768};
769
770
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000771class LIsStringAndBranch: public LControlInstruction<1, 1> {
772 public:
773 LIsStringAndBranch(LOperand* value, LOperand* temp) {
774 inputs_[0] = value;
775 temps_[0] = temp;
776 }
777
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000778 LOperand* value() { return inputs_[0]; }
779 LOperand* temp() { return temps_[0]; }
780
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000781 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
782 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
783
784 virtual void PrintDataTo(StringStream* stream);
785};
786
787
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000788class LIsSmiAndBranch: public LControlInstruction<1, 0> {
789 public:
790 explicit LIsSmiAndBranch(LOperand* value) {
791 inputs_[0] = value;
792 }
793
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000794 LOperand* value() { return inputs_[0]; }
795
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000796 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
797 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
798
799 virtual void PrintDataTo(StringStream* stream);
800};
801
802
803class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
804 public:
805 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
806 inputs_[0] = value;
807 temps_[0] = temp;
808 }
809
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000810 LOperand* value() { return inputs_[0]; }
811 LOperand* temp() { return temps_[0]; }
812
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000813 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
814 "is-undetectable-and-branch")
815 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
816
817 virtual void PrintDataTo(StringStream* stream);
818};
819
820
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000821class LStringCompareAndBranch: public LControlInstruction<2, 0> {
822 public:
823 LStringCompareAndBranch(LOperand* left, LOperand* right) {
824 inputs_[0] = left;
825 inputs_[1] = right;
826 }
827
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000828 LOperand* left() { return inputs_[0]; }
829 LOperand* right() { return inputs_[1]; }
830
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000831 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
832 "string-compare-and-branch")
833 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
834
835 Token::Value op() const { return hydrogen()->token(); }
836
837 virtual void PrintDataTo(StringStream* stream);
838};
839
840
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000841class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
842 public:
843 explicit LHasInstanceTypeAndBranch(LOperand* value) {
844 inputs_[0] = value;
845 }
846
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000847 LOperand* value() { return inputs_[0]; }
848
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000849 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
850 "has-instance-type-and-branch")
851 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
852
853 virtual void PrintDataTo(StringStream* stream);
854};
855
856
857class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
858 public:
859 explicit LGetCachedArrayIndex(LOperand* value) {
860 inputs_[0] = value;
861 }
862
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000863 LOperand* value() { return inputs_[0]; }
864
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000865 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
866 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
867};
868
869
870class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
871 public:
872 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
873 inputs_[0] = value;
874 }
875
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000876 LOperand* value() { return inputs_[0]; }
877
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000878 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
879 "has-cached-array-index-and-branch")
880 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
881
882 virtual void PrintDataTo(StringStream* stream);
883};
884
885
886class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
887 public:
888 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
889 inputs_[0] = value;
890 temps_[0] = temp;
891 }
892
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000893 LOperand* value() { return inputs_[0]; }
894 LOperand* temp() { return temps_[0]; }
895
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000896 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
897 "class-of-test-and-branch")
898 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
899
900 virtual void PrintDataTo(StringStream* stream);
901};
902
903
904class LCmpT: public LTemplateInstruction<1, 2, 0> {
905 public:
906 LCmpT(LOperand* left, LOperand* right) {
907 inputs_[0] = left;
908 inputs_[1] = right;
909 }
910
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000911 LOperand* left() { return inputs_[0]; }
912 LOperand* right() { return inputs_[1]; }
913
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000914 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
915 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
916
917 Token::Value op() const { return hydrogen()->token(); }
918};
919
920
921class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
922 public:
923 LInstanceOf(LOperand* left, LOperand* right) {
924 inputs_[0] = left;
925 inputs_[1] = right;
926 }
927
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000928 LOperand* left() { return inputs_[0]; }
929 LOperand* right() { return inputs_[1]; }
930
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000931 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
932};
933
934
935class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
936 public:
937 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
938 inputs_[0] = value;
939 temps_[0] = temp;
940 }
941
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000942 LOperand* value() { return inputs_[0]; }
943 LOperand* temp() { return temps_[0]; }
944
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000945 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
946 "instance-of-known-global")
947 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
948
949 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000950 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
951 return lazy_deopt_env_;
952 }
953 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
954 lazy_deopt_env_ = env;
955 }
956
957 private:
958 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000959};
960
961
962class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
963 public:
964 LBoundsCheck(LOperand* index, LOperand* length) {
965 inputs_[0] = index;
966 inputs_[1] = length;
967 }
968
969 LOperand* index() { return inputs_[0]; }
970 LOperand* length() { return inputs_[1]; }
971
972 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +0000973 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000974};
975
976
977class LBitI: public LTemplateInstruction<1, 2, 0> {
978 public:
979 LBitI(LOperand* left, LOperand* right) {
980 inputs_[0] = left;
981 inputs_[1] = right;
982 }
983
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000984 LOperand* left() { return inputs_[0]; }
985 LOperand* right() { return inputs_[1]; }
986
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000987 Token::Value op() const { return hydrogen()->op(); }
988
989 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
990 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
991};
992
993
994class LShiftI: public LTemplateInstruction<1, 2, 0> {
995 public:
996 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
997 : op_(op), can_deopt_(can_deopt) {
998 inputs_[0] = left;
999 inputs_[1] = right;
1000 }
1001
1002 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001003 LOperand* left() { return inputs_[0]; }
1004 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001005 bool can_deopt() const { return can_deopt_; }
1006
1007 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1008
1009 private:
1010 Token::Value op_;
1011 bool can_deopt_;
1012};
1013
1014
1015class LSubI: public LTemplateInstruction<1, 2, 0> {
1016 public:
1017 LSubI(LOperand* left, LOperand* right) {
1018 inputs_[0] = left;
1019 inputs_[1] = right;
1020 }
1021
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001022 LOperand* left() { return inputs_[0]; }
1023 LOperand* right() { return inputs_[1]; }
1024
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001025 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1026 DECLARE_HYDROGEN_ACCESSOR(Sub)
1027};
1028
1029
1030class LConstantI: public LTemplateInstruction<1, 0, 0> {
1031 public:
1032 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1033 DECLARE_HYDROGEN_ACCESSOR(Constant)
1034
1035 int32_t value() const { return hydrogen()->Integer32Value(); }
1036};
1037
1038
1039class LConstantD: public LTemplateInstruction<1, 0, 0> {
1040 public:
1041 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1042 DECLARE_HYDROGEN_ACCESSOR(Constant)
1043
1044 double value() const { return hydrogen()->DoubleValue(); }
1045};
1046
1047
1048class LConstantT: public LTemplateInstruction<1, 0, 0> {
1049 public:
1050 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1051 DECLARE_HYDROGEN_ACCESSOR(Constant)
1052
1053 Handle<Object> value() const { return hydrogen()->handle(); }
1054};
1055
1056
1057class LBranch: public LControlInstruction<1, 0> {
1058 public:
1059 explicit LBranch(LOperand* value) {
1060 inputs_[0] = value;
1061 }
1062
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001063 LOperand* value() { return inputs_[0]; }
1064
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001065 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1066 DECLARE_HYDROGEN_ACCESSOR(Branch)
1067
1068 virtual void PrintDataTo(StringStream* stream);
1069};
1070
1071
1072class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1073 public:
1074 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1075 inputs_[0] = value;
1076 temps_[0] = temp;
1077 }
1078
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001079 LOperand* value() { return inputs_[0]; }
1080 LOperand* temp() { return temps_[0]; }
1081
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001082 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1083 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1084
1085 virtual bool IsControl() const { return true; }
1086
1087 Handle<Map> map() const { return hydrogen()->map(); }
1088 int true_block_id() const {
1089 return hydrogen()->FirstSuccessor()->block_id();
1090 }
1091 int false_block_id() const {
1092 return hydrogen()->SecondSuccessor()->block_id();
1093 }
1094};
1095
1096
1097class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
1098 public:
1099 explicit LJSArrayLength(LOperand* value) {
1100 inputs_[0] = value;
1101 }
1102
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001103 LOperand* value() { return inputs_[0]; }
1104
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001105 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
1106 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
1107};
1108
1109
1110class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1111 public:
1112 explicit LFixedArrayBaseLength(LOperand* value) {
1113 inputs_[0] = value;
1114 }
1115
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001116 LOperand* value() { return inputs_[0]; }
1117
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001118 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1119 "fixed-array-base-length")
1120 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1121};
1122
1123
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001124class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1125 public:
1126 explicit LMapEnumLength(LOperand* value) {
1127 inputs_[0] = value;
1128 }
1129
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001130 LOperand* value() { return inputs_[0]; }
1131
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001132 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1133};
1134
1135
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001136class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1137 public:
1138 explicit LElementsKind(LOperand* value) {
1139 inputs_[0] = value;
1140 }
1141
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001142 LOperand* value() { return inputs_[0]; }
1143
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001144 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1145 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1146};
1147
1148
1149class LValueOf: public LTemplateInstruction<1, 1, 1> {
1150 public:
1151 LValueOf(LOperand* value, LOperand* temp) {
1152 inputs_[0] = value;
1153 temps_[0] = temp;
1154 }
1155
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001156 LOperand* value() { return inputs_[0]; }
1157 LOperand* temp() { return temps_[0]; }
1158
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001159 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1160 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1161};
1162
1163
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001164class LDateField: public LTemplateInstruction<1, 1, 1> {
1165 public:
1166 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1167 inputs_[0] = date;
1168 temps_[0] = temp;
1169 }
1170
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001171 LOperand* date() { return inputs_[0]; }
1172 LOperand* temp() { return temps_[0]; }
1173 Smi* index() const { return index_; }
1174
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001175 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1176 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001177
1178 private:
1179 Smi* index_;
1180};
1181
1182
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +00001183class LSeqStringSetChar: public LTemplateInstruction<1, 3, 0> {
1184 public:
1185 LSeqStringSetChar(String::Encoding encoding,
1186 LOperand* string,
1187 LOperand* index,
1188 LOperand* value) : encoding_(encoding) {
1189 inputs_[0] = string;
1190 inputs_[1] = index;
1191 inputs_[2] = value;
1192 }
1193
1194 String::Encoding encoding() { return encoding_; }
1195 LOperand* string() { return inputs_[0]; }
1196 LOperand* index() { return inputs_[1]; }
1197 LOperand* value() { return inputs_[2]; }
1198
1199 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1200 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1201
1202 private:
1203 String::Encoding encoding_;
1204};
1205
1206
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001207class LThrow: public LTemplateInstruction<0, 1, 0> {
1208 public:
1209 explicit LThrow(LOperand* value) {
1210 inputs_[0] = value;
1211 }
1212
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001213 LOperand* value() { return inputs_[0]; }
1214
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001215 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1216};
1217
1218
1219class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1220 public:
1221 explicit LBitNotI(LOperand* value) {
1222 inputs_[0] = value;
1223 }
1224
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001225 LOperand* value() { return inputs_[0]; }
1226
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001227 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1228};
1229
1230
1231class LAddI: public LTemplateInstruction<1, 2, 0> {
1232 public:
1233 LAddI(LOperand* left, LOperand* right) {
1234 inputs_[0] = left;
1235 inputs_[1] = right;
1236 }
1237
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001238 LOperand* left() { return inputs_[0]; }
1239 LOperand* right() { return inputs_[1]; }
1240
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001241 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1242 DECLARE_HYDROGEN_ACCESSOR(Add)
1243};
1244
1245
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001246class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1247 public:
1248 LMathMinMax(LOperand* left, LOperand* right) {
1249 inputs_[0] = left;
1250 inputs_[1] = right;
1251 }
1252
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001253 LOperand* left() { return inputs_[0]; }
1254 LOperand* right() { return inputs_[1]; }
1255
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001256 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max")
1257 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1258};
1259
1260
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001261class LPower: public LTemplateInstruction<1, 2, 0> {
1262 public:
1263 LPower(LOperand* left, LOperand* right) {
1264 inputs_[0] = left;
1265 inputs_[1] = right;
1266 }
1267
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001268 LOperand* left() { return inputs_[0]; }
1269 LOperand* right() { return inputs_[1]; }
1270
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001271 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1272 DECLARE_HYDROGEN_ACCESSOR(Power)
1273};
1274
1275
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001276class LRandom: public LTemplateInstruction<1, 1, 0> {
1277 public:
1278 explicit LRandom(LOperand* global_object) {
1279 inputs_[0] = global_object;
1280 }
1281
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001282 LOperand* global_object() { return inputs_[0]; }
1283
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001284 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1285 DECLARE_HYDROGEN_ACCESSOR(Random)
1286};
1287
1288
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001289class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1290 public:
1291 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1292 : op_(op) {
1293 inputs_[0] = left;
1294 inputs_[1] = right;
1295 }
1296
1297 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001298 LOperand* left() { return inputs_[0]; }
1299 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001300
1301 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1302 virtual void CompileToNative(LCodeGen* generator);
1303 virtual const char* Mnemonic() const;
1304
1305 private:
1306 Token::Value op_;
1307};
1308
1309
1310class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1311 public:
1312 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1313 : op_(op) {
1314 inputs_[0] = left;
1315 inputs_[1] = right;
1316 }
1317
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001318 LOperand* left() { return inputs_[0]; }
1319 LOperand* right() { return inputs_[1]; }
1320 Token::Value op() const { return op_; }
1321
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001322 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1323 virtual void CompileToNative(LCodeGen* generator);
1324 virtual const char* Mnemonic() const;
1325
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001326 private:
1327 Token::Value op_;
1328};
1329
1330
1331class LReturn: public LTemplateInstruction<0, 1, 0> {
1332 public:
1333 explicit LReturn(LOperand* value) {
1334 inputs_[0] = value;
1335 }
1336
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001337 LOperand* value() { return inputs_[0]; }
1338
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001339 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1340};
1341
1342
1343class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1344 public:
1345 explicit LLoadNamedField(LOperand* object) {
1346 inputs_[0] = object;
1347 }
1348
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001349 LOperand* object() { return inputs_[0]; }
1350
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001351 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1352 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1353};
1354
1355
1356class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1357 public:
1358 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1359 inputs_[0] = object;
1360 }
1361
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001362 LOperand* object() { return inputs_[0]; }
1363
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001364 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1365 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001366};
1367
1368
1369class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1370 public:
1371 explicit LLoadNamedGeneric(LOperand* object) {
1372 inputs_[0] = object;
1373 }
1374
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001375 LOperand* object() { return inputs_[0]; }
1376
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001377 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1378 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1379
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001380 Handle<Object> name() const { return hydrogen()->name(); }
1381};
1382
1383
1384class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1385 public:
1386 explicit LLoadFunctionPrototype(LOperand* function) {
1387 inputs_[0] = function;
1388 }
1389
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001390 LOperand* function() { return inputs_[0]; }
1391
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001392 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1393 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001394};
1395
1396
1397class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1398 public:
1399 explicit LLoadElements(LOperand* object) {
1400 inputs_[0] = object;
1401 }
1402
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001403 LOperand* object() { return inputs_[0]; }
1404
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001405 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1406};
1407
1408
1409class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1410 public:
1411 explicit LLoadExternalArrayPointer(LOperand* object) {
1412 inputs_[0] = object;
1413 }
1414
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001415 LOperand* object() { return inputs_[0]; }
1416
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001417 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1418 "load-external-array-pointer")
1419};
1420
1421
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001422class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001423 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001424 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001425 inputs_[0] = elements;
1426 inputs_[1] = key;
1427 }
1428
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001429 LOperand* elements() { return inputs_[0]; }
1430 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001431 ElementsKind elements_kind() const {
1432 return hydrogen()->elements_kind();
1433 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001434 bool is_external() const {
1435 return hydrogen()->is_external();
1436 }
1437
1438 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1439 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1440
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001441 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001442 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001443};
1444
1445
1446class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1447 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001448 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1449 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001450 inputs_[1] = key;
1451 }
1452
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001453 LOperand* object() { return inputs_[0]; }
1454 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001455
1456 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001457};
1458
1459
1460class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1461 public:
1462 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1463 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1464};
1465
1466
1467class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1468 public:
1469 explicit LLoadGlobalGeneric(LOperand* global_object) {
1470 inputs_[0] = global_object;
1471 }
1472
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001473 LOperand* global_object() { return inputs_[0]; }
1474
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001475 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1476 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1477
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001478 Handle<Object> name() const { return hydrogen()->name(); }
1479 bool for_typeof() const { return hydrogen()->for_typeof(); }
1480};
1481
1482
1483class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1484 public:
1485 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1486 inputs_[0] = value;
1487 temps_[0] = temp;
1488 }
1489
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001490 LOperand* value() { return inputs_[0]; }
1491 LOperand* temp() { return temps_[0]; }
1492
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001493 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1494 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1495};
1496
1497
1498class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1499 public:
1500 explicit LStoreGlobalGeneric(LOperand* global_object,
1501 LOperand* value) {
1502 inputs_[0] = global_object;
1503 inputs_[1] = value;
1504 }
1505
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001506 LOperand* global_object() { return inputs_[0]; }
1507 LOperand* value() { return inputs_[1]; }
1508
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001509 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1510 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1511
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001512 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001513 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001514};
1515
1516
1517class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1518 public:
1519 explicit LLoadContextSlot(LOperand* context) {
1520 inputs_[0] = context;
1521 }
1522
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001523 LOperand* context() { return inputs_[0]; }
1524
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001525 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1526 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1527
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001528 int slot_index() { return hydrogen()->slot_index(); }
1529
1530 virtual void PrintDataTo(StringStream* stream);
1531};
1532
1533
1534class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1535 public:
1536 LStoreContextSlot(LOperand* context, LOperand* value) {
1537 inputs_[0] = context;
1538 inputs_[1] = value;
1539 }
1540
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001541 LOperand* context() { return inputs_[0]; }
1542 LOperand* value() { return inputs_[1]; }
1543
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001544 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1545 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1546
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001547 int slot_index() { return hydrogen()->slot_index(); }
1548
1549 virtual void PrintDataTo(StringStream* stream);
1550};
1551
1552
1553class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1554 public:
1555 explicit LPushArgument(LOperand* value) {
1556 inputs_[0] = value;
1557 }
1558
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001559 LOperand* value() { return inputs_[0]; }
1560
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001561 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1562};
1563
1564
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001565class LDrop: public LTemplateInstruction<0, 0, 0> {
1566 public:
1567 explicit LDrop(int count) : count_(count) { }
1568
1569 int count() const { return count_; }
1570
1571 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1572
1573 private:
1574 int count_;
1575};
1576
1577
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001578class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1579 public:
1580 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1581 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1582};
1583
1584
1585class LContext: public LTemplateInstruction<1, 0, 0> {
1586 public:
1587 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001588 DECLARE_HYDROGEN_ACCESSOR(Context)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001589};
1590
1591
1592class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1593 public:
1594 explicit LOuterContext(LOperand* context) {
1595 inputs_[0] = context;
1596 }
1597
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001598 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001599
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001600 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001601};
1602
1603
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001604class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1605 public:
1606 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1607 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1608};
1609
1610
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001611class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1612 public:
1613 explicit LGlobalObject(LOperand* context) {
1614 inputs_[0] = context;
1615 }
1616
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001617 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001618
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001619 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001620};
1621
1622
1623class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1624 public:
1625 explicit LGlobalReceiver(LOperand* global_object) {
1626 inputs_[0] = global_object;
1627 }
1628
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001629 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001630
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001631 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001632};
1633
1634
1635class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1636 public:
1637 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1638 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1639
1640 virtual void PrintDataTo(StringStream* stream);
1641
1642 Handle<JSFunction> function() { return hydrogen()->function(); }
1643 int arity() const { return hydrogen()->argument_count() - 1; }
1644};
1645
1646
1647class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1648 public:
1649 explicit LInvokeFunction(LOperand* function) {
1650 inputs_[0] = function;
1651 }
1652
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001653 LOperand* function() { return inputs_[0]; }
1654
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001655 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1656 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1657
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001658 virtual void PrintDataTo(StringStream* stream);
1659
1660 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001661 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001662};
1663
1664
1665class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1666 public:
1667 explicit LCallKeyed(LOperand* key) {
1668 inputs_[0] = key;
1669 }
1670
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001671 LOperand* key() { return inputs_[0]; }
1672
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001673 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1674 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1675
1676 virtual void PrintDataTo(StringStream* stream);
1677
1678 int arity() const { return hydrogen()->argument_count() - 1; }
1679};
1680
1681
1682
1683class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1684 public:
1685 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1686 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1687
1688 virtual void PrintDataTo(StringStream* stream);
1689
1690 Handle<String> name() const { return hydrogen()->name(); }
1691 int arity() const { return hydrogen()->argument_count() - 1; }
1692};
1693
1694
danno@chromium.orgc612e022011-11-10 11:38:15 +00001695class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001696 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001697 explicit LCallFunction(LOperand* function) {
1698 inputs_[0] = function;
1699 }
1700
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001701 LOperand* function() { return inputs_[0]; }
1702
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001703 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1704 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1705
danno@chromium.orgc612e022011-11-10 11:38:15 +00001706 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001707};
1708
1709
1710class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1711 public:
1712 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1713 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1714
1715 virtual void PrintDataTo(StringStream* stream);
1716
1717 Handle<String> name() const {return hydrogen()->name(); }
1718 int arity() const { return hydrogen()->argument_count() - 1; }
1719};
1720
1721
1722class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1723 public:
1724 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1725 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1726
1727 virtual void PrintDataTo(StringStream* stream);
1728
1729 Handle<JSFunction> target() const { return hydrogen()->target(); }
1730 int arity() const { return hydrogen()->argument_count() - 1; }
1731};
1732
1733
1734class LCallNew: public LTemplateInstruction<1, 1, 0> {
1735 public:
1736 explicit LCallNew(LOperand* constructor) {
1737 inputs_[0] = constructor;
1738 }
1739
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001740 LOperand* constructor() { return inputs_[0]; }
1741
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001742 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1743 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1744
1745 virtual void PrintDataTo(StringStream* stream);
1746
1747 int arity() const { return hydrogen()->argument_count() - 1; }
1748};
1749
1750
1751class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1752 public:
1753 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1754 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1755
1756 const Runtime::Function* function() const { return hydrogen()->function(); }
1757 int arity() const { return hydrogen()->argument_count(); }
1758};
1759
1760
1761class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1762 public:
1763 explicit LInteger32ToDouble(LOperand* value) {
1764 inputs_[0] = value;
1765 }
1766
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001767 LOperand* value() { return inputs_[0]; }
1768
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001769 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1770};
1771
1772
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001773class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1774 public:
1775 explicit LUint32ToDouble(LOperand* value) {
1776 inputs_[0] = value;
1777 }
1778
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001779 LOperand* value() { return inputs_[0]; }
1780
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001781 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1782};
1783
1784
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001785class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1786 public:
1787 explicit LNumberTagI(LOperand* value) {
1788 inputs_[0] = value;
1789 }
1790
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001791 LOperand* value() { return inputs_[0]; }
1792
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001793 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1794};
1795
1796
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001797class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1798 public:
1799 explicit LNumberTagU(LOperand* value) {
1800 inputs_[0] = value;
1801 }
1802
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001803 LOperand* value() { return inputs_[0]; }
1804
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001805 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1806};
1807
1808
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001809class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1810 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001811 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001812 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001813 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001814 temps_[1] = temp2;
1815 }
1816
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001817 LOperand* value() { return inputs_[0]; }
1818 LOperand* temp() { return temps_[0]; }
1819 LOperand* temp2() { return temps_[1]; }
1820
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001821 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001822 DECLARE_HYDROGEN_ACCESSOR(Change)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001823};
1824
1825
1826// Sometimes truncating conversion from a tagged value to an int32.
1827class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1828 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001829 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001830 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001831 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001832 temps_[1] = temp2;
1833 }
1834
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001835 LOperand* value() { return inputs_[0]; }
1836 LOperand* temp() { return temps_[0]; }
1837 LOperand* temp2() { return temps_[1]; }
1838
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001839 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1840 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1841
1842 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1843};
1844
1845
1846// Truncating conversion from a tagged value to an int32.
1847class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1848 public:
1849 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001850 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001851 LOperand* temp2,
1852 LOperand* temp3) {
1853 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001854 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001855 temps_[1] = temp2;
1856 temps_[2] = temp3;
1857 }
1858
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001859 LOperand* value() { return inputs_[0]; }
1860 LOperand* temp() { return temps_[0]; }
1861 LOperand* temp2() { return temps_[1]; }
1862 LOperand* temp3() { return temps_[2]; }
1863
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001864 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1865 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1866
1867 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1868};
1869
1870
1871class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1872 public:
1873 explicit LSmiTag(LOperand* value) {
1874 inputs_[0] = value;
1875 }
1876
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001877 LOperand* value() { return inputs_[0]; }
1878
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001879 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1880};
1881
1882
1883class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1884 public:
1885 explicit LNumberUntagD(LOperand* value) {
1886 inputs_[0] = value;
1887 }
1888
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001889 LOperand* value() { return inputs_[0]; }
1890
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001891 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1892 DECLARE_HYDROGEN_ACCESSOR(Change)
1893};
1894
1895
1896class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1897 public:
1898 LSmiUntag(LOperand* value, bool needs_check)
1899 : needs_check_(needs_check) {
1900 inputs_[0] = value;
1901 }
1902
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001903 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001904 bool needs_check() const { return needs_check_; }
1905
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001906 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1907
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001908 private:
1909 bool needs_check_;
1910};
1911
1912
verwaest@chromium.org37141392012-05-31 13:27:02 +00001913class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001914 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001915 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
1916 inputs_[0] = object;
1917 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001918 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001919 }
1920
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001921 LOperand* object() { return inputs_[0]; }
1922 LOperand* value() { return inputs_[1]; }
1923 LOperand* temp() { return temps_[0]; }
1924
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001925 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1926 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1927
1928 virtual void PrintDataTo(StringStream* stream);
1929
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001930 Handle<Object> name() const { return hydrogen()->name(); }
1931 bool is_in_object() { return hydrogen()->is_in_object(); }
1932 int offset() { return hydrogen()->offset(); }
1933 Handle<Map> transition() const { return hydrogen()->transition(); }
1934};
1935
1936
1937class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1938 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001939 LStoreNamedGeneric(LOperand* object, LOperand* value) {
1940 inputs_[0] = object;
1941 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001942 }
1943
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001944 LOperand* object() { return inputs_[0]; }
1945 LOperand* value() { return inputs_[1]; }
1946
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001947 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1948 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1949
1950 virtual void PrintDataTo(StringStream* stream);
1951
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001952 Handle<Object> name() const { return hydrogen()->name(); }
1953 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001954};
1955
1956
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001957class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001958 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001959 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001960 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001961 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001962 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001963 }
1964
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001965 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001966 LOperand* elements() { return inputs_[0]; }
1967 LOperand* key() { return inputs_[1]; }
1968 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001969 ElementsKind elements_kind() const {
1970 return hydrogen()->elements_kind();
1971 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001972
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001973 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
1974 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001975
1976 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001977 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001978 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001979};
1980
1981
1982class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1983 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001984 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001985 inputs_[0] = obj;
1986 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001987 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001988 }
1989
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001990 LOperand* object() { return inputs_[0]; }
1991 LOperand* key() { return inputs_[1]; }
1992 LOperand* value() { return inputs_[2]; }
1993
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001994 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1995 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1996
1997 virtual void PrintDataTo(StringStream* stream);
1998
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001999 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002000};
2001
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002002
2003class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
2004 public:
2005 LTransitionElementsKind(LOperand* object,
2006 LOperand* new_map_temp,
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002007 LOperand* fixed_object_temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002008 inputs_[0] = object;
2009 temps_[0] = new_map_temp;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002010 temps_[1] = fixed_object_temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002011 }
2012
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002013 LOperand* object() { return inputs_[0]; }
2014 LOperand* new_map_temp() { return temps_[0]; }
2015 LOperand* temp() { return temps_[1]; }
2016
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002017 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2018 "transition-elements-kind")
2019 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2020
2021 virtual void PrintDataTo(StringStream* stream);
2022
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002023 Handle<Map> original_map() { return hydrogen()->original_map(); }
2024 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002025 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2026 ElementsKind to_kind() { return hydrogen()->to_kind(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002027};
2028
2029
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002030class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> {
2031 public:
2032 LTrapAllocationMemento(LOperand* object,
2033 LOperand* temp) {
2034 inputs_[0] = object;
2035 temps_[0] = temp;
2036 }
2037
2038 LOperand* object() { return inputs_[0]; }
2039 LOperand* temp() { return temps_[0]; }
2040
2041 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2042 "trap-allocation-memento")
2043};
2044
2045
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002046class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2047 public:
2048 LStringAdd(LOperand* left, LOperand* right) {
2049 inputs_[0] = left;
2050 inputs_[1] = right;
2051 }
2052
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002053 LOperand* left() { return inputs_[0]; }
2054 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002055
2056 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2057 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002058};
2059
2060
2061
2062class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2063 public:
2064 LStringCharCodeAt(LOperand* string, LOperand* index) {
2065 inputs_[0] = string;
2066 inputs_[1] = index;
2067 }
2068
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002069 LOperand* string() { return inputs_[0]; }
2070 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002071
2072 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2073 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002074};
2075
2076
2077class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2078 public:
2079 explicit LStringCharFromCode(LOperand* char_code) {
2080 inputs_[0] = char_code;
2081 }
2082
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002083 LOperand* char_code() { return inputs_[0]; }
2084
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002085 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2086 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002087};
2088
2089
2090class LStringLength: public LTemplateInstruction<1, 1, 0> {
2091 public:
2092 explicit LStringLength(LOperand* string) {
2093 inputs_[0] = string;
2094 }
2095
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002096 LOperand* string() { return inputs_[0]; }
2097
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002098 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2099 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002100};
2101
2102
2103class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2104 public:
2105 explicit LCheckFunction(LOperand* value) {
2106 inputs_[0] = value;
2107 }
2108
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002109 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002110
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002111 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2112 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2113};
2114
2115
2116class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2117 public:
2118 explicit LCheckInstanceType(LOperand* value) {
2119 inputs_[0] = value;
2120 }
2121
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002122 LOperand* value() { return inputs_[0]; }
2123
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002124 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2125 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2126};
2127
2128
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002129class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002130 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002131 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002132 inputs_[0] = value;
2133 }
2134
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002135 LOperand* value() { return inputs_[0]; }
2136
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002137 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2138 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002139};
2140
2141
verwaest@chromium.orge4ee6de2012-11-06 12:13:00 +00002142class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002143 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002144 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2145 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002146 temps_[1] = temp2;
2147 }
2148
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002149 LOperand* temp() { return temps_[0]; }
2150 LOperand* temp2() { return temps_[1]; }
2151
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002152 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2153 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2154
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002155 ZoneList<Handle<JSObject> >* prototypes() const {
2156 return hydrogen()->prototypes();
2157 }
2158 ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002159};
2160
2161
2162class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2163 public:
2164 explicit LCheckSmi(LOperand* value) {
2165 inputs_[0] = value;
2166 }
2167
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002168 LOperand* value() { return inputs_[0]; }
2169
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002170 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2171};
2172
2173
2174class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2175 public:
2176 explicit LCheckNonSmi(LOperand* value) {
2177 inputs_[0] = value;
2178 }
2179
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002180 LOperand* value() { return inputs_[0]; }
2181
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002182 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2183};
2184
2185
2186class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2187 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002188 LClampDToUint8(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(ClampDToUint8, "clamp-d-to-uint8")
2197};
2198
2199
2200class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2201 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002202 explicit LClampIToUint8(LOperand* unclamped) {
2203 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002204 }
2205
2206 LOperand* unclamped() { return inputs_[0]; }
2207
2208 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2209};
2210
2211
2212class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2213 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002214 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2215 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002216 temps_[0] = temp;
2217 }
2218
2219 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002220 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002221
2222 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2223};
2224
2225
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002226class LAllocateObject: public LTemplateInstruction<1, 1, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002227 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002228 LAllocateObject(LOperand* temp, LOperand* temp2) {
2229 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002230 temps_[1] = temp2;
2231 }
2232
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002233 LOperand* temp() { return temps_[0]; }
2234 LOperand* temp2() { return temps_[1]; }
2235
ulan@chromium.org967e2702012-02-28 09:49:15 +00002236 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2237 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2238};
2239
2240
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002241class LAllocate: public LTemplateInstruction<1, 2, 2> {
2242 public:
2243 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2244 inputs_[1] = size;
2245 temps_[0] = temp1;
2246 temps_[1] = temp2;
2247 }
2248
2249 LOperand* size() { return inputs_[1]; }
2250 LOperand* temp1() { return temps_[0]; }
2251 LOperand* temp2() { return temps_[1]; }
2252
2253 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2254 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2255};
2256
2257
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002258class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
2259 public:
2260 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2261 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2262};
2263
2264
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002265class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2266 public:
2267 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2268 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2269};
2270
2271
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002272class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002273 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002274 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2275 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002276};
2277
2278
2279class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2280 public:
2281 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2282 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2283};
2284
2285
2286class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2287 public:
2288 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2289 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2290
2291 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2292};
2293
2294
2295class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2296 public:
2297 explicit LToFastProperties(LOperand* value) {
2298 inputs_[0] = value;
2299 }
2300
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002301 LOperand* value() { return inputs_[0]; }
2302
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002303 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2304 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2305};
2306
2307
2308class LTypeof: public LTemplateInstruction<1, 1, 0> {
2309 public:
2310 explicit LTypeof(LOperand* value) {
2311 inputs_[0] = value;
2312 }
2313
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002314 LOperand* value() { return inputs_[0]; }
2315
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002316 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2317};
2318
2319
2320class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2321 public:
2322 explicit LTypeofIsAndBranch(LOperand* value) {
2323 inputs_[0] = value;
2324 }
2325
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002326 LOperand* value() { return inputs_[0]; }
2327
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002328 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2329 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2330
2331 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2332
2333 virtual void PrintDataTo(StringStream* stream);
2334};
2335
2336
2337class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2338 public:
2339 explicit LIsConstructCallAndBranch(LOperand* temp) {
2340 temps_[0] = temp;
2341 }
2342
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002343 LOperand* temp() { return temps_[0]; }
2344
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002345 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2346 "is-construct-call-and-branch")
2347};
2348
2349
2350class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2351 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002352 LDeleteProperty(LOperand* object, LOperand* key) {
2353 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002354 inputs_[1] = key;
2355 }
2356
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002357 LOperand* object() { return inputs_[0]; }
2358 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002359
2360 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002361};
2362
2363
2364class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2365 public:
2366 LOsrEntry();
2367
2368 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2369
2370 LOperand** SpilledRegisterArray() { return register_spills_; }
2371 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2372
2373 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2374 void MarkSpilledDoubleRegister(int allocation_index,
2375 LOperand* spill_operand);
2376
2377 private:
2378 // Arrays of spill slot operands for registers with an assigned spill
2379 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2380 // NULL if the register has no assigned spill slot. Indexed by allocation
2381 // index.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002382 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters];
2383 LOperand* double_register_spills_[
2384 DoubleRegister::kMaxNumAllocatableRegisters];
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002385};
2386
2387
2388class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2389 public:
2390 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2391 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2392
2393 Label* done_label() { return &done_label_; }
2394
2395 private:
2396 Label done_label_;
2397};
2398
2399
2400class LIn: public LTemplateInstruction<1, 2, 0> {
2401 public:
2402 LIn(LOperand* key, LOperand* object) {
2403 inputs_[0] = key;
2404 inputs_[1] = object;
2405 }
2406
2407 LOperand* key() { return inputs_[0]; }
2408 LOperand* object() { return inputs_[1]; }
2409
2410 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2411};
2412
2413
ulan@chromium.org812308e2012-02-29 15:58:45 +00002414class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2415 public:
2416 explicit LForInPrepareMap(LOperand* object) {
2417 inputs_[0] = object;
2418 }
2419
2420 LOperand* object() { return inputs_[0]; }
2421
2422 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2423};
2424
2425
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002426class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002427 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002428 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002429 inputs_[0] = map;
2430 }
2431
2432 LOperand* map() { return inputs_[0]; }
2433
2434 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2435
2436 int idx() {
2437 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2438 }
2439};
2440
2441
2442class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2443 public:
2444 LCheckMapValue(LOperand* value, LOperand* map) {
2445 inputs_[0] = value;
2446 inputs_[1] = map;
2447 }
2448
2449 LOperand* value() { return inputs_[0]; }
2450 LOperand* map() { return inputs_[1]; }
2451
2452 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2453};
2454
2455
2456class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2457 public:
2458 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2459 inputs_[0] = object;
2460 inputs_[1] = index;
2461 }
2462
2463 LOperand* object() { return inputs_[0]; }
2464 LOperand* index() { return inputs_[1]; }
2465
2466 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2467};
2468
2469
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002470class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002471class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002472 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002473 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2474 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002475
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002476 int GetNextSpillIndex(bool is_double);
2477 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002478};
2479
2480
2481class LChunkBuilder BASE_EMBEDDED {
2482 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002483 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2484 : chunk_(NULL),
2485 info_(info),
2486 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002487 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002488 status_(UNUSED),
2489 current_instruction_(NULL),
2490 current_block_(NULL),
2491 next_block_(NULL),
2492 argument_count_(0),
2493 allocator_(allocator),
2494 position_(RelocInfo::kNoPosition),
2495 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002496 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002497
2498 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002499 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002500
2501 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002502#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002503 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2504#undef DECLARE_DO
2505
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002506 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2507
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002508 private:
2509 enum Status {
2510 UNUSED,
2511 BUILDING,
2512 DONE,
2513 ABORTED
2514 };
2515
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002516 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002517 CompilationInfo* info() const { return info_; }
2518 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002519 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002520
2521 bool is_unused() const { return status_ == UNUSED; }
2522 bool is_building() const { return status_ == BUILDING; }
2523 bool is_done() const { return status_ == DONE; }
2524 bool is_aborted() const { return status_ == ABORTED; }
2525
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002526 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002527
2528 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002529 LUnallocated* ToUnallocated(Register reg);
2530 LUnallocated* ToUnallocated(DoubleRegister reg);
2531
2532 // Methods for setting up define-use relationships.
2533 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2534 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2535 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2536 DoubleRegister fixed_register);
2537
2538 // A value that is guaranteed to be allocated to a register.
2539 // Operand created by UseRegister is guaranteed to be live until the end of
2540 // instruction. This means that register allocator will not reuse it's
2541 // register for any other operand inside instruction.
2542 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2543 // instruction start. Register allocator is free to assign the same register
2544 // to some other operand used inside instruction (i.e. temporary or
2545 // output).
2546 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2547 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2548
2549 // An input operand in a register that may be trashed.
2550 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2551
2552 // An input operand in a register or stack slot.
2553 MUST_USE_RESULT LOperand* Use(HValue* value);
2554 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2555
2556 // An input operand in a register, stack slot or a constant operand.
2557 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2558 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2559
2560 // An input operand in a register or a constant operand.
2561 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2562 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2563
2564 // An input operand in register, stack slot or a constant operand.
2565 // Will not be moved to a register even if one is freely available.
2566 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2567
2568 // Temporary operand that must be in a register.
2569 MUST_USE_RESULT LUnallocated* TempRegister();
2570 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2571 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2572
2573 // Methods for setting up define-use relationships.
2574 // Return the same instruction that they are passed.
2575 template<int I, int T>
2576 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2577 LUnallocated* result);
2578 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002579 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2580 template<int I, int T>
2581 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2582 int index);
2583 template<int I, int T>
2584 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2585 template<int I, int T>
2586 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2587 Register reg);
2588 template<int I, int T>
2589 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2590 DoubleRegister reg);
2591 LInstruction* AssignEnvironment(LInstruction* instr);
2592 LInstruction* AssignPointerMap(LInstruction* instr);
2593
2594 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2595
2596 // By default we assume that instruction sequences generated for calls
2597 // cannot deoptimize eagerly and we do not attach environment to this
2598 // instruction.
2599 LInstruction* MarkAsCall(
2600 LInstruction* instr,
2601 HInstruction* hinstr,
2602 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002603
2604 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2605 int* argument_index_accumulator);
2606
2607 void VisitInstruction(HInstruction* current);
2608
2609 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2610 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2611 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2612 LInstruction* DoArithmeticD(Token::Value op,
2613 HArithmeticBinaryOperation* instr);
2614 LInstruction* DoArithmeticT(Token::Value op,
2615 HArithmeticBinaryOperation* instr);
2616
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002617 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002618 CompilationInfo* info_;
2619 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002620 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002621 Status status_;
2622 HInstruction* current_instruction_;
2623 HBasicBlock* current_block_;
2624 HBasicBlock* next_block_;
2625 int argument_count_;
2626 LAllocator* allocator_;
2627 int position_;
2628 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002629 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002630
lrn@chromium.org7516f052011-03-30 08:52:27 +00002631 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2632};
2633
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002634#undef DECLARE_HYDROGEN_ACCESSOR
2635#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002636
2637} } // namespace v8::internal
2638
2639#endif // V8_MIPS_LITHIUM_MIPS_H_