blob: 1abea90141b67dc2ab1e22ba01832d0f1117496a [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) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000059 V(BitI) \
60 V(BitNotI) \
61 V(BoundsCheck) \
62 V(Branch) \
63 V(CallConstantFunction) \
64 V(CallFunction) \
65 V(CallGlobal) \
66 V(CallKeyed) \
67 V(CallKnownGlobal) \
68 V(CallNamed) \
69 V(CallNew) \
ulan@chromium.org750145a2013-03-07 15:14:13 +000070 V(CallNewArray) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000071 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.org4e308cf2013-05-17 13:39:16 +000092 V(DebugBreak) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000093 V(DeclareGlobals) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000094 V(DeleteProperty) \
95 V(Deoptimize) \
96 V(DivI) \
97 V(DoubleToI) \
yangguo@chromium.org46a2a512013-01-18 16:29:40 +000098 V(DummyUse) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000099 V(ElementsKind) \
100 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) \
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +0000111 V(InstanceSize) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000112 V(InstructionGap) \
113 V(Integer32ToDouble) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000114 V(Uint32ToDouble) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000115 V(InvokeFunction) \
116 V(IsConstructCallAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000117 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) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000121 V(Label) \
122 V(LazyBailout) \
123 V(LoadContextSlot) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000124 V(LoadExternalArrayPointer) \
125 V(LoadFunctionPrototype) \
126 V(LoadGlobalCell) \
127 V(LoadGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000128 V(LoadKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000129 V(LoadKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000130 V(LoadNamedField) \
131 V(LoadNamedFieldPolymorphic) \
132 V(LoadNamedGeneric) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000133 V(MapEnumLength) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000134 V(MathAbs) \
135 V(MathCos) \
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000136 V(MathExp) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000137 V(MathFloor) \
138 V(MathLog) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000139 V(MathMinMax) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000140 V(MathPowHalf) \
141 V(MathRound) \
142 V(MathSin) \
143 V(MathSqrt) \
144 V(MathTan) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000145 V(ModI) \
146 V(MulI) \
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000147 V(MultiplyAddD) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000148 V(NumberTagD) \
149 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000150 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000151 V(NumberUntagD) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000152 V(OsrEntry) \
153 V(OuterContext) \
154 V(Parameter) \
155 V(Power) \
156 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000157 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000158 V(RegExpLiteral) \
159 V(Return) \
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000160 V(SeqStringSetChar) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000161 V(ShiftI) \
162 V(SmiTag) \
163 V(SmiUntag) \
164 V(StackCheck) \
165 V(StoreContextSlot) \
166 V(StoreGlobalCell) \
167 V(StoreGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000168 V(StoreKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000169 V(StoreKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000170 V(StoreNamedField) \
171 V(StoreNamedGeneric) \
172 V(StringAdd) \
173 V(StringCharCodeAt) \
174 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000175 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000176 V(StringLength) \
177 V(SubI) \
178 V(TaggedToI) \
179 V(ThisFunction) \
180 V(Throw) \
181 V(ToFastProperties) \
182 V(TransitionElementsKind) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000183 V(TrapAllocationMemento) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000184 V(Typeof) \
185 V(TypeofIsAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000186 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000187 V(ValueOf) \
188 V(ForInPrepareMap) \
189 V(ForInCacheArray) \
190 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000191 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000192 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000193 V(WrapReceiver) \
jkummerow@chromium.org4c54a2a2013-03-19 17:51:30 +0000194 V(Drop) \
195 V(InnerAllocatedObject)
196
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000197
198#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
199 virtual Opcode opcode() const { return LInstruction::k##type; } \
200 virtual void CompileToNative(LCodeGen* generator); \
201 virtual const char* Mnemonic() const { return mnemonic; } \
202 static L##type* cast(LInstruction* instr) { \
203 ASSERT(instr->Is##type()); \
204 return reinterpret_cast<L##type*>(instr); \
205 }
206
207
208#define DECLARE_HYDROGEN_ACCESSOR(type) \
209 H##type* hydrogen() const { \
210 return H##type::cast(hydrogen_value()); \
211 }
212
lrn@chromium.org7516f052011-03-30 08:52:27 +0000213
214class LInstruction: public ZoneObject {
215 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000216 LInstruction()
217 : environment_(NULL),
218 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000219 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000220 virtual ~LInstruction() { }
221
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000222 virtual void CompileToNative(LCodeGen* generator) = 0;
223 virtual const char* Mnemonic() const = 0;
224 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000225 virtual void PrintDataTo(StringStream* stream);
226 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000227
228 enum Opcode {
229 // Declare a unique enum value for each instruction.
230#define DECLARE_OPCODE(type) k##type,
231 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
232 kNumberOfInstructions
233#undef DECLARE_OPCODE
234 };
235
236 virtual Opcode opcode() const = 0;
237
238 // Declare non-virtual type testers for all leaf IR classes.
239#define DECLARE_PREDICATE(type) \
240 bool Is##type() const { return opcode() == k##type; }
241 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
242#undef DECLARE_PREDICATE
243
244 // Declare virtual predicates for instructions that don't have
245 // an opcode.
246 virtual bool IsGap() const { return false; }
247
248 virtual bool IsControl() const { return false; }
249
250 void set_environment(LEnvironment* env) { environment_ = env; }
251 LEnvironment* environment() const { return environment_; }
252 bool HasEnvironment() const { return environment_ != NULL; }
253
254 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
255 LPointerMap* pointer_map() const { return pointer_map_.get(); }
256 bool HasPointerMap() const { return pointer_map_.is_set(); }
257
258 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
259 HValue* hydrogen_value() const { return hydrogen_value_; }
260
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000261 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000262
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000263 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000264
265 // Interface to the register allocator and iterators.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000266 bool ClobbersTemps() const { return is_call_; }
267 bool ClobbersRegisters() const { return is_call_; }
268 bool ClobbersDoubleRegisters() const { return is_call_; }
269
270 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000271 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000272
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000273 virtual bool HasResult() const = 0;
274 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000275
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000276 LOperand* FirstInput() { return InputAt(0); }
277 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000278
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000279 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
280
lrn@chromium.org7516f052011-03-30 08:52:27 +0000281#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000282 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000283#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000284
285 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000286 // Iterator interface.
287 friend class InputIterator;
288 virtual int InputCount() = 0;
289 virtual LOperand* InputAt(int i) = 0;
290
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000291 friend class TempIterator;
292 virtual int TempCount() = 0;
293 virtual LOperand* TempAt(int i) = 0;
294
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000295 LEnvironment* environment_;
296 SetOncePointer<LPointerMap> pointer_map_;
297 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000298 bool is_call_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000299};
300
301
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000302// R = number of result operands (0 or 1).
303// I = number of input operands.
304// T = number of temporary operands.
305template<int R, int I, int T>
306class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000307 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000308 // Allow 0 or 1 output operands.
309 STATIC_ASSERT(R == 0 || R == 1);
310 virtual bool HasResult() const { return R != 0; }
311 void set_result(LOperand* operand) { results_[0] = operand; }
312 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000313
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000314 protected:
315 EmbeddedContainer<LOperand*, R> results_;
316 EmbeddedContainer<LOperand*, I> inputs_;
317 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000318
319 private:
320 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000321 virtual LOperand* InputAt(int i) { return inputs_[i]; }
322
323 virtual int TempCount() { return T; }
324 virtual LOperand* TempAt(int i) { return temps_[i]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000325};
326
327
328class LGap: public LTemplateInstruction<0, 0, 0> {
329 public:
330 explicit LGap(HBasicBlock* block)
331 : block_(block) {
332 parallel_moves_[BEFORE] = NULL;
333 parallel_moves_[START] = NULL;
334 parallel_moves_[END] = NULL;
335 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000336 }
337
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000338 // Can't use the DECLARE-macro here because of sub-classes.
339 virtual bool IsGap() const { return true; }
340 virtual void PrintDataTo(StringStream* stream);
341 static LGap* cast(LInstruction* instr) {
342 ASSERT(instr->IsGap());
343 return reinterpret_cast<LGap*>(instr);
344 }
345
346 bool IsRedundant() const;
347
348 HBasicBlock* block() const { return block_; }
349
lrn@chromium.org7516f052011-03-30 08:52:27 +0000350 enum InnerPosition {
351 BEFORE,
352 START,
353 END,
354 AFTER,
355 FIRST_INNER_POSITION = BEFORE,
356 LAST_INNER_POSITION = AFTER
357 };
358
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000359 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
360 if (parallel_moves_[pos] == NULL) {
361 parallel_moves_[pos] = new(zone) LParallelMove(zone);
362 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000363 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000364 }
365
366 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000367 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000368 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000369
370 private:
371 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
372 HBasicBlock* block_;
373};
374
375
376class LInstructionGap: public LGap {
377 public:
378 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
379
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000380 virtual bool HasInterestingComment(LCodeGen* gen) const {
381 return !IsRedundant();
382 }
383
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000384 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
385};
386
387
388class LGoto: public LTemplateInstruction<0, 0, 0> {
389 public:
390 explicit LGoto(int block_id) : block_id_(block_id) { }
391
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000392 virtual bool HasInterestingComment(LCodeGen* gen) const;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000393 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
394 virtual void PrintDataTo(StringStream* stream);
395 virtual bool IsControl() const { return true; }
396
397 int block_id() const { return block_id_; }
398
399 private:
400 int block_id_;
401};
402
403
404class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
405 public:
406 LLazyBailout() : gap_instructions_size_(0) { }
407
408 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
409
410 void set_gap_instructions_size(int gap_instructions_size) {
411 gap_instructions_size_ = gap_instructions_size;
412 }
413 int gap_instructions_size() { return gap_instructions_size_; }
414
415 private:
416 int gap_instructions_size_;
417};
418
419
yangguo@chromium.org46a2a512013-01-18 16:29:40 +0000420class LDummyUse: public LTemplateInstruction<1, 1, 0> {
421 public:
422 explicit LDummyUse(LOperand* value) {
423 inputs_[0] = value;
424 }
425 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
426};
427
428
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000429class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
430 public:
431 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000432};
433
434
435class LLabel: public LGap {
436 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000437 explicit LLabel(HBasicBlock* block)
438 : LGap(block), replacement_(NULL) { }
439
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000440 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000441 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
442
443 virtual void PrintDataTo(StringStream* stream);
444
445 int block_id() const { return block()->block_id(); }
446 bool is_loop_header() const { return block()->IsLoopHeader(); }
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000447 bool is_osr_entry() const { return block()->is_osr_entry(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000448 Label* label() { return &label_; }
449 LLabel* replacement() const { return replacement_; }
450 void set_replacement(LLabel* label) { replacement_ = label; }
451 bool HasReplacement() const { return replacement_ != NULL; }
452
453 private:
454 Label label_;
455 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000456};
457
458
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000459class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000460 public:
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000461 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000462 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
463};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000464
lrn@chromium.org7516f052011-03-30 08:52:27 +0000465
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000466class LCallStub: public LTemplateInstruction<1, 0, 0> {
467 public:
468 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
469 DECLARE_HYDROGEN_ACCESSOR(CallStub)
470
471 TranscendentalCache::Type transcendental_type() {
472 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000473 }
474};
475
476
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000477class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
478 public:
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000479 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000480 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
481};
482
483
484template<int I, int T>
485class LControlInstruction: public LTemplateInstruction<0, I, T> {
486 public:
487 virtual bool IsControl() const { return true; }
488
489 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
490 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
491 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
492 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
493
494 private:
495 HControlInstruction* hydrogen() {
496 return HControlInstruction::cast(this->hydrogen_value());
497 }
498};
499
500
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000501class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
502 public:
503 LWrapReceiver(LOperand* receiver, LOperand* function) {
504 inputs_[0] = receiver;
505 inputs_[1] = function;
506 }
507
508 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
509
510 LOperand* receiver() { return inputs_[0]; }
511 LOperand* function() { return inputs_[1]; }
512};
513
514
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000515class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
516 public:
517 LApplyArguments(LOperand* function,
518 LOperand* receiver,
519 LOperand* length,
520 LOperand* elements) {
521 inputs_[0] = function;
522 inputs_[1] = receiver;
523 inputs_[2] = length;
524 inputs_[3] = elements;
525 }
526
527 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
528
529 LOperand* function() { return inputs_[0]; }
530 LOperand* receiver() { return inputs_[1]; }
531 LOperand* length() { return inputs_[2]; }
532 LOperand* elements() { return inputs_[3]; }
533};
534
535
536class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
537 public:
538 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
539 inputs_[0] = arguments;
540 inputs_[1] = length;
541 inputs_[2] = index;
542 }
543
544 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
545
546 LOperand* arguments() { return inputs_[0]; }
547 LOperand* length() { return inputs_[1]; }
548 LOperand* index() { return inputs_[2]; }
549
550 virtual void PrintDataTo(StringStream* stream);
551};
552
553
554class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
555 public:
556 explicit LArgumentsLength(LOperand* elements) {
557 inputs_[0] = elements;
558 }
559
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000560 LOperand* elements() { return inputs_[0]; }
561
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000562 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
563};
564
565
566class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
567 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000568 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000569 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000570};
571
572
573class LModI: public LTemplateInstruction<1, 2, 3> {
574 public:
575 // Used when the right hand is a constant power of 2.
576 LModI(LOperand* left,
577 LOperand* right) {
578 inputs_[0] = left;
579 inputs_[1] = right;
580 temps_[0] = NULL;
581 temps_[1] = NULL;
582 temps_[2] = NULL;
583 }
584
585 // Used for the standard case.
586 LModI(LOperand* left,
587 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000588 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000589 LOperand* temp2,
590 LOperand* temp3) {
591 inputs_[0] = left;
592 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000593 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000594 temps_[1] = temp2;
595 temps_[2] = temp3;
596 }
597
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000598 LOperand* left() { return inputs_[0]; }
599 LOperand* right() { return inputs_[1]; }
600 LOperand* temp() { return temps_[0]; }
601 LOperand* temp2() { return temps_[1]; }
602 LOperand* temp3() { return temps_[2]; }
603
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000604 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
605 DECLARE_HYDROGEN_ACCESSOR(Mod)
606};
607
608
609class LDivI: public LTemplateInstruction<1, 2, 0> {
610 public:
611 LDivI(LOperand* left, LOperand* right) {
612 inputs_[0] = left;
613 inputs_[1] = right;
614 }
615
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000616 LOperand* left() { return inputs_[0]; }
617 LOperand* right() { return inputs_[1]; }
618
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000619 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
620 DECLARE_HYDROGEN_ACCESSOR(Div)
621};
622
623
624class LMulI: public LTemplateInstruction<1, 2, 1> {
625 public:
626 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
627 inputs_[0] = left;
628 inputs_[1] = right;
629 temps_[0] = temp;
630 }
631
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000632 LOperand* left() { return inputs_[0]; }
633 LOperand* right() { return inputs_[1]; }
634 LOperand* temp() { return temps_[0]; }
635
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000636 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
637 DECLARE_HYDROGEN_ACCESSOR(Mul)
638};
639
640
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000641// Instruction for computing multiplier * multiplicand + addend.
642class LMultiplyAddD: public LTemplateInstruction<1, 3, 0> {
643 public:
644 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
645 LOperand* multiplicand) {
646 inputs_[0] = addend;
647 inputs_[1] = multiplier;
648 inputs_[2] = multiplicand;
649 }
650
651 LOperand* addend() { return inputs_[0]; }
652 LOperand* multiplier() { return inputs_[1]; }
653 LOperand* multiplicand() { return inputs_[2]; }
654
655 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
656};
657
658
jkummerow@chromium.org4e308cf2013-05-17 13:39:16 +0000659class LDebugBreak: public LTemplateInstruction<0, 0, 0> {
660 public:
661 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
662};
663
664
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000665class LCmpIDAndBranch: public LControlInstruction<2, 0> {
666 public:
667 LCmpIDAndBranch(LOperand* left, LOperand* right) {
668 inputs_[0] = left;
669 inputs_[1] = right;
670 }
671
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000672 LOperand* left() { return inputs_[0]; }
673 LOperand* right() { return inputs_[1]; }
674
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000675 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
676 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
677
678 Token::Value op() const { return hydrogen()->token(); }
679 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000680 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000681 }
682
683 virtual void PrintDataTo(StringStream* stream);
684};
685
686
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000687class LMathFloor: public LTemplateInstruction<1, 1, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000688 public:
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000689 LMathFloor(LOperand* value, LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000690 inputs_[0] = value;
691 temps_[0] = temp;
692 }
693
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000694 LOperand* value() { return inputs_[0]; }
695 LOperand* temp() { return temps_[0]; }
696
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000697 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000698 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000699};
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000700
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000701
702class LMathRound: public LTemplateInstruction<1, 1, 1> {
703 public:
704 LMathRound(LOperand* value, LOperand* temp) {
705 inputs_[0] = value;
706 temps_[0] = temp;
707 }
708
709 LOperand* value() { return inputs_[0]; }
710 LOperand* temp() { return temps_[0]; }
711
712 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
713 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
714};
715
716
717class LMathAbs: public LTemplateInstruction<1, 1, 0> {
718 public:
719 explicit LMathAbs(LOperand* value) {
720 inputs_[0] = value;
721 }
722
723 LOperand* value() { return inputs_[0]; }
724
725 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
726 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
727};
728
729
730class LMathLog: public LTemplateInstruction<1, 1, 0> {
731 public:
732 explicit LMathLog(LOperand* value) {
733 inputs_[0] = value;
734 }
735
736 LOperand* value() { return inputs_[0]; }
737
738 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
739};
740
741
742class LMathSin: public LTemplateInstruction<1, 1, 0> {
743 public:
744 explicit LMathSin(LOperand* value) {
745 inputs_[0] = value;
746 }
747
748 LOperand* value() { return inputs_[0]; }
749
750 DECLARE_CONCRETE_INSTRUCTION(MathSin, "math-sin")
751};
752
753
754class LMathCos: public LTemplateInstruction<1, 1, 0> {
755 public:
756 explicit LMathCos(LOperand* value) {
757 inputs_[0] = value;
758 }
759
760 LOperand* value() { return inputs_[0]; }
761
762 DECLARE_CONCRETE_INSTRUCTION(MathCos, "math-cos")
763};
764
765
766class LMathTan: public LTemplateInstruction<1, 1, 0> {
767 public:
768 explicit LMathTan(LOperand* value) {
769 inputs_[0] = value;
770 }
771
772 LOperand* value() { return inputs_[0]; }
773
774 DECLARE_CONCRETE_INSTRUCTION(MathTan, "math-tan")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000775};
776
777
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000778class LMathExp: public LTemplateInstruction<1, 1, 3> {
779 public:
780 LMathExp(LOperand* value,
781 LOperand* double_temp,
782 LOperand* temp1,
783 LOperand* temp2) {
784 inputs_[0] = value;
785 temps_[0] = temp1;
786 temps_[1] = temp2;
787 temps_[2] = double_temp;
788 ExternalReference::InitializeMathExpData();
789 }
790
791 LOperand* value() { return inputs_[0]; }
792 LOperand* temp1() { return temps_[0]; }
793 LOperand* temp2() { return temps_[1]; }
794 LOperand* double_temp() { return temps_[2]; }
795
796 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000797};
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000798
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000799
800class LMathSqrt: public LTemplateInstruction<1, 1, 0> {
801 public:
802 explicit LMathSqrt(LOperand* value) {
803 inputs_[0] = value;
804 }
805
806 LOperand* value() { return inputs_[0]; }
807
808 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
809};
810
811
812class LMathPowHalf: public LTemplateInstruction<1, 1, 1> {
813 public:
814 LMathPowHalf(LOperand* value, LOperand* temp) {
815 inputs_[0] = value;
816 temps_[0] = temp;
817 }
818
819 LOperand* value() { return inputs_[0]; }
820 LOperand* temp() { return temps_[0]; }
821
822 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000823};
824
825
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000826class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
827 public:
828 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
829 inputs_[0] = left;
830 inputs_[1] = right;
831 }
832
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000833 LOperand* left() { return inputs_[0]; }
834 LOperand* right() { return inputs_[1]; }
835
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000836 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
837 "cmp-object-eq-and-branch")
838 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
839};
840
841
842class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
843 public:
844 explicit LCmpConstantEqAndBranch(LOperand* left) {
845 inputs_[0] = left;
846 }
847
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000848 LOperand* left() { return inputs_[0]; }
849
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000850 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
851 "cmp-constant-eq-and-branch")
852 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
853};
854
855
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000856class LIsObjectAndBranch: public LControlInstruction<1, 1> {
857 public:
858 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
859 inputs_[0] = value;
860 temps_[0] = temp;
861 }
862
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000863 LOperand* value() { return inputs_[0]; }
864 LOperand* temp() { return temps_[0]; }
865
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000866 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
867 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
868
869 virtual void PrintDataTo(StringStream* stream);
870};
871
872
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000873class LIsStringAndBranch: public LControlInstruction<1, 1> {
874 public:
875 LIsStringAndBranch(LOperand* value, LOperand* temp) {
876 inputs_[0] = value;
877 temps_[0] = temp;
878 }
879
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000880 LOperand* value() { return inputs_[0]; }
881 LOperand* temp() { return temps_[0]; }
882
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000883 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
884 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
885
886 virtual void PrintDataTo(StringStream* stream);
887};
888
889
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000890class LIsSmiAndBranch: public LControlInstruction<1, 0> {
891 public:
892 explicit LIsSmiAndBranch(LOperand* value) {
893 inputs_[0] = value;
894 }
895
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000896 LOperand* value() { return inputs_[0]; }
897
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000898 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
899 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
900
901 virtual void PrintDataTo(StringStream* stream);
902};
903
904
905class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
906 public:
907 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
908 inputs_[0] = value;
909 temps_[0] = temp;
910 }
911
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000912 LOperand* value() { return inputs_[0]; }
913 LOperand* temp() { return temps_[0]; }
914
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000915 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
916 "is-undetectable-and-branch")
917 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
918
919 virtual void PrintDataTo(StringStream* stream);
920};
921
922
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000923class LStringCompareAndBranch: public LControlInstruction<2, 0> {
924 public:
925 LStringCompareAndBranch(LOperand* left, LOperand* right) {
926 inputs_[0] = left;
927 inputs_[1] = right;
928 }
929
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000930 LOperand* left() { return inputs_[0]; }
931 LOperand* right() { return inputs_[1]; }
932
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000933 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
934 "string-compare-and-branch")
935 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
936
937 Token::Value op() const { return hydrogen()->token(); }
938
939 virtual void PrintDataTo(StringStream* stream);
940};
941
942
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000943class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
944 public:
945 explicit LHasInstanceTypeAndBranch(LOperand* value) {
946 inputs_[0] = value;
947 }
948
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000949 LOperand* value() { return inputs_[0]; }
950
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000951 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
952 "has-instance-type-and-branch")
953 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
954
955 virtual void PrintDataTo(StringStream* stream);
956};
957
958
959class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
960 public:
961 explicit LGetCachedArrayIndex(LOperand* value) {
962 inputs_[0] = value;
963 }
964
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000965 LOperand* value() { return inputs_[0]; }
966
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000967 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
968 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
969};
970
971
972class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
973 public:
974 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
975 inputs_[0] = value;
976 }
977
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000978 LOperand* value() { return inputs_[0]; }
979
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000980 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
981 "has-cached-array-index-and-branch")
982 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
983
984 virtual void PrintDataTo(StringStream* stream);
985};
986
987
988class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
989 public:
990 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
991 inputs_[0] = value;
992 temps_[0] = temp;
993 }
994
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000995 LOperand* value() { return inputs_[0]; }
996 LOperand* temp() { return temps_[0]; }
997
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000998 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
999 "class-of-test-and-branch")
1000 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1001
1002 virtual void PrintDataTo(StringStream* stream);
1003};
1004
1005
1006class LCmpT: public LTemplateInstruction<1, 2, 0> {
1007 public:
1008 LCmpT(LOperand* left, LOperand* right) {
1009 inputs_[0] = left;
1010 inputs_[1] = right;
1011 }
1012
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001013 LOperand* left() { return inputs_[0]; }
1014 LOperand* right() { return inputs_[1]; }
1015
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001016 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1017 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1018
1019 Token::Value op() const { return hydrogen()->token(); }
1020};
1021
1022
1023class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
1024 public:
1025 LInstanceOf(LOperand* left, LOperand* right) {
1026 inputs_[0] = left;
1027 inputs_[1] = right;
1028 }
1029
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001030 LOperand* left() { return inputs_[0]; }
1031 LOperand* right() { return inputs_[1]; }
1032
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001033 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1034};
1035
1036
1037class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
1038 public:
1039 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
1040 inputs_[0] = value;
1041 temps_[0] = temp;
1042 }
1043
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001044 LOperand* value() { return inputs_[0]; }
1045 LOperand* temp() { return temps_[0]; }
1046
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001047 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1048 "instance-of-known-global")
1049 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1050
1051 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +00001052 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
1053 return lazy_deopt_env_;
1054 }
1055 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
1056 lazy_deopt_env_ = env;
1057 }
1058
1059 private:
1060 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001061};
1062
1063
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +00001064class LInstanceSize: public LTemplateInstruction<1, 1, 0> {
1065 public:
1066 explicit LInstanceSize(LOperand* object) {
1067 inputs_[0] = object;
1068 }
1069
1070 LOperand* object() { return inputs_[0]; }
1071
1072 DECLARE_CONCRETE_INSTRUCTION(InstanceSize, "instance-size")
1073 DECLARE_HYDROGEN_ACCESSOR(InstanceSize)
1074};
1075
1076
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001077class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
1078 public:
1079 LBoundsCheck(LOperand* index, LOperand* length) {
1080 inputs_[0] = index;
1081 inputs_[1] = length;
1082 }
1083
1084 LOperand* index() { return inputs_[0]; }
1085 LOperand* length() { return inputs_[1]; }
1086
1087 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +00001088 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001089};
1090
1091
1092class LBitI: public LTemplateInstruction<1, 2, 0> {
1093 public:
1094 LBitI(LOperand* left, LOperand* right) {
1095 inputs_[0] = left;
1096 inputs_[1] = right;
1097 }
1098
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001099 LOperand* left() { return inputs_[0]; }
1100 LOperand* right() { return inputs_[1]; }
1101
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001102 Token::Value op() const { return hydrogen()->op(); }
1103
1104 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1105 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1106};
1107
1108
1109class LShiftI: public LTemplateInstruction<1, 2, 0> {
1110 public:
1111 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1112 : op_(op), can_deopt_(can_deopt) {
1113 inputs_[0] = left;
1114 inputs_[1] = right;
1115 }
1116
1117 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001118 LOperand* left() { return inputs_[0]; }
1119 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001120 bool can_deopt() const { return can_deopt_; }
1121
1122 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1123
1124 private:
1125 Token::Value op_;
1126 bool can_deopt_;
1127};
1128
1129
1130class LSubI: public LTemplateInstruction<1, 2, 0> {
1131 public:
1132 LSubI(LOperand* left, LOperand* right) {
1133 inputs_[0] = left;
1134 inputs_[1] = right;
1135 }
1136
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001137 LOperand* left() { return inputs_[0]; }
1138 LOperand* right() { return inputs_[1]; }
1139
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001140 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1141 DECLARE_HYDROGEN_ACCESSOR(Sub)
1142};
1143
1144
1145class LConstantI: public LTemplateInstruction<1, 0, 0> {
1146 public:
1147 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1148 DECLARE_HYDROGEN_ACCESSOR(Constant)
1149
1150 int32_t value() const { return hydrogen()->Integer32Value(); }
1151};
1152
1153
1154class LConstantD: public LTemplateInstruction<1, 0, 0> {
1155 public:
1156 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1157 DECLARE_HYDROGEN_ACCESSOR(Constant)
1158
1159 double value() const { return hydrogen()->DoubleValue(); }
1160};
1161
1162
1163class LConstantT: public LTemplateInstruction<1, 0, 0> {
1164 public:
1165 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1166 DECLARE_HYDROGEN_ACCESSOR(Constant)
1167
1168 Handle<Object> value() const { return hydrogen()->handle(); }
1169};
1170
1171
1172class LBranch: public LControlInstruction<1, 0> {
1173 public:
1174 explicit LBranch(LOperand* value) {
1175 inputs_[0] = value;
1176 }
1177
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001178 LOperand* value() { return inputs_[0]; }
1179
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001180 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1181 DECLARE_HYDROGEN_ACCESSOR(Branch)
1182
1183 virtual void PrintDataTo(StringStream* stream);
1184};
1185
1186
1187class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1188 public:
1189 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1190 inputs_[0] = value;
1191 temps_[0] = temp;
1192 }
1193
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001194 LOperand* value() { return inputs_[0]; }
1195 LOperand* temp() { return temps_[0]; }
1196
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001197 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1198 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1199
1200 virtual bool IsControl() const { return true; }
1201
1202 Handle<Map> map() const { return hydrogen()->map(); }
1203 int true_block_id() const {
1204 return hydrogen()->FirstSuccessor()->block_id();
1205 }
1206 int false_block_id() const {
1207 return hydrogen()->SecondSuccessor()->block_id();
1208 }
1209};
1210
1211
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001212class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1213 public:
1214 explicit LFixedArrayBaseLength(LOperand* value) {
1215 inputs_[0] = value;
1216 }
1217
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001218 LOperand* value() { return inputs_[0]; }
1219
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001220 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1221 "fixed-array-base-length")
1222 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1223};
1224
1225
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001226class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1227 public:
1228 explicit LMapEnumLength(LOperand* value) {
1229 inputs_[0] = value;
1230 }
1231
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001232 LOperand* value() { return inputs_[0]; }
1233
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001234 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1235};
1236
1237
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001238class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1239 public:
1240 explicit LElementsKind(LOperand* value) {
1241 inputs_[0] = value;
1242 }
1243
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001244 LOperand* value() { return inputs_[0]; }
1245
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001246 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1247 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1248};
1249
1250
1251class LValueOf: public LTemplateInstruction<1, 1, 1> {
1252 public:
1253 LValueOf(LOperand* value, LOperand* temp) {
1254 inputs_[0] = value;
1255 temps_[0] = temp;
1256 }
1257
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001258 LOperand* value() { return inputs_[0]; }
1259 LOperand* temp() { return temps_[0]; }
1260
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001261 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1262 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1263};
1264
1265
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001266class LDateField: public LTemplateInstruction<1, 1, 1> {
1267 public:
1268 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1269 inputs_[0] = date;
1270 temps_[0] = temp;
1271 }
1272
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001273 LOperand* date() { return inputs_[0]; }
1274 LOperand* temp() { return temps_[0]; }
1275 Smi* index() const { return index_; }
1276
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001277 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1278 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001279
1280 private:
1281 Smi* index_;
1282};
1283
1284
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +00001285class LSeqStringSetChar: public LTemplateInstruction<1, 3, 0> {
1286 public:
1287 LSeqStringSetChar(String::Encoding encoding,
1288 LOperand* string,
1289 LOperand* index,
1290 LOperand* value) : encoding_(encoding) {
1291 inputs_[0] = string;
1292 inputs_[1] = index;
1293 inputs_[2] = value;
1294 }
1295
1296 String::Encoding encoding() { return encoding_; }
1297 LOperand* string() { return inputs_[0]; }
1298 LOperand* index() { return inputs_[1]; }
1299 LOperand* value() { return inputs_[2]; }
1300
1301 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1302 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1303
1304 private:
1305 String::Encoding encoding_;
1306};
1307
1308
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001309class LThrow: public LTemplateInstruction<0, 1, 0> {
1310 public:
1311 explicit LThrow(LOperand* value) {
1312 inputs_[0] = value;
1313 }
1314
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001315 LOperand* value() { return inputs_[0]; }
1316
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001317 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1318};
1319
1320
1321class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1322 public:
1323 explicit LBitNotI(LOperand* value) {
1324 inputs_[0] = value;
1325 }
1326
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001327 LOperand* value() { return inputs_[0]; }
1328
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001329 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1330};
1331
1332
1333class LAddI: public LTemplateInstruction<1, 2, 0> {
1334 public:
1335 LAddI(LOperand* left, LOperand* right) {
1336 inputs_[0] = left;
1337 inputs_[1] = right;
1338 }
1339
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001340 LOperand* left() { return inputs_[0]; }
1341 LOperand* right() { return inputs_[1]; }
1342
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001343 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1344 DECLARE_HYDROGEN_ACCESSOR(Add)
1345};
1346
1347
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001348class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1349 public:
1350 LMathMinMax(LOperand* left, LOperand* right) {
1351 inputs_[0] = left;
1352 inputs_[1] = right;
1353 }
1354
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001355 LOperand* left() { return inputs_[0]; }
1356 LOperand* right() { return inputs_[1]; }
1357
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00001358 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001359 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1360};
1361
1362
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001363class LPower: public LTemplateInstruction<1, 2, 0> {
1364 public:
1365 LPower(LOperand* left, LOperand* right) {
1366 inputs_[0] = left;
1367 inputs_[1] = right;
1368 }
1369
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001370 LOperand* left() { return inputs_[0]; }
1371 LOperand* right() { return inputs_[1]; }
1372
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001373 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1374 DECLARE_HYDROGEN_ACCESSOR(Power)
1375};
1376
1377
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001378class LRandom: public LTemplateInstruction<1, 1, 0> {
1379 public:
1380 explicit LRandom(LOperand* global_object) {
1381 inputs_[0] = global_object;
1382 }
1383
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001384 LOperand* global_object() { return inputs_[0]; }
1385
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001386 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1387 DECLARE_HYDROGEN_ACCESSOR(Random)
1388};
1389
1390
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001391class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1392 public:
1393 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1394 : op_(op) {
1395 inputs_[0] = left;
1396 inputs_[1] = right;
1397 }
1398
1399 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001400 LOperand* left() { return inputs_[0]; }
1401 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001402
1403 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1404 virtual void CompileToNative(LCodeGen* generator);
1405 virtual const char* Mnemonic() const;
1406
1407 private:
1408 Token::Value op_;
1409};
1410
1411
1412class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1413 public:
1414 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1415 : op_(op) {
1416 inputs_[0] = left;
1417 inputs_[1] = right;
1418 }
1419
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001420 LOperand* left() { return inputs_[0]; }
1421 LOperand* right() { return inputs_[1]; }
1422 Token::Value op() const { return op_; }
1423
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001424 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1425 virtual void CompileToNative(LCodeGen* generator);
1426 virtual const char* Mnemonic() const;
1427
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001428 private:
1429 Token::Value op_;
1430};
1431
1432
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001433class LReturn: public LTemplateInstruction<0, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001434 public:
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001435 explicit LReturn(LOperand* value, LOperand* parameter_count) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001436 inputs_[0] = value;
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001437 inputs_[1] = parameter_count;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001438 }
1439
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001440 LOperand* value() { return inputs_[0]; }
1441
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001442 bool has_constant_parameter_count() {
1443 return parameter_count()->IsConstantOperand();
1444 }
1445 LConstantOperand* constant_parameter_count() {
1446 ASSERT(has_constant_parameter_count());
1447 return LConstantOperand::cast(parameter_count());
1448 }
1449 LOperand* parameter_count() { return inputs_[1]; }
1450
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001451 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1452};
1453
1454
1455class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1456 public:
1457 explicit LLoadNamedField(LOperand* object) {
1458 inputs_[0] = object;
1459 }
1460
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001461 LOperand* object() { return inputs_[0]; }
1462
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001463 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1464 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1465};
1466
1467
1468class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1469 public:
1470 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1471 inputs_[0] = object;
1472 }
1473
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001474 LOperand* object() { return inputs_[0]; }
1475
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001476 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1477 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001478};
1479
1480
1481class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1482 public:
1483 explicit LLoadNamedGeneric(LOperand* object) {
1484 inputs_[0] = object;
1485 }
1486
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001487 LOperand* object() { return inputs_[0]; }
1488
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001489 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1490 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1491
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001492 Handle<Object> name() const { return hydrogen()->name(); }
1493};
1494
1495
1496class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1497 public:
1498 explicit LLoadFunctionPrototype(LOperand* function) {
1499 inputs_[0] = function;
1500 }
1501
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001502 LOperand* function() { return inputs_[0]; }
1503
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001504 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1505 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001506};
1507
1508
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001509class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1510 public:
1511 explicit LLoadExternalArrayPointer(LOperand* object) {
1512 inputs_[0] = object;
1513 }
1514
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001515 LOperand* object() { return inputs_[0]; }
1516
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001517 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1518 "load-external-array-pointer")
1519};
1520
1521
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001522class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001523 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001524 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001525 inputs_[0] = elements;
1526 inputs_[1] = key;
1527 }
1528
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001529 LOperand* elements() { return inputs_[0]; }
1530 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001531 ElementsKind elements_kind() const {
1532 return hydrogen()->elements_kind();
1533 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001534 bool is_external() const {
1535 return hydrogen()->is_external();
1536 }
1537
1538 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1539 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1540
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001541 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001542 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001543};
1544
1545
1546class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1547 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001548 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1549 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001550 inputs_[1] = key;
1551 }
1552
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001553 LOperand* object() { return inputs_[0]; }
1554 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001555
1556 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001557};
1558
1559
1560class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1561 public:
1562 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1563 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1564};
1565
1566
1567class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1568 public:
1569 explicit LLoadGlobalGeneric(LOperand* global_object) {
1570 inputs_[0] = global_object;
1571 }
1572
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001573 LOperand* global_object() { return inputs_[0]; }
1574
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001575 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1576 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1577
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001578 Handle<Object> name() const { return hydrogen()->name(); }
1579 bool for_typeof() const { return hydrogen()->for_typeof(); }
1580};
1581
1582
1583class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1584 public:
1585 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1586 inputs_[0] = value;
1587 temps_[0] = temp;
1588 }
1589
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001590 LOperand* value() { return inputs_[0]; }
1591 LOperand* temp() { return temps_[0]; }
1592
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001593 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1594 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1595};
1596
1597
1598class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1599 public:
1600 explicit LStoreGlobalGeneric(LOperand* global_object,
1601 LOperand* value) {
1602 inputs_[0] = global_object;
1603 inputs_[1] = value;
1604 }
1605
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001606 LOperand* global_object() { return inputs_[0]; }
1607 LOperand* value() { return inputs_[1]; }
1608
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001609 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1610 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1611
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001612 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001613 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001614};
1615
1616
1617class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1618 public:
1619 explicit LLoadContextSlot(LOperand* context) {
1620 inputs_[0] = context;
1621 }
1622
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001623 LOperand* context() { return inputs_[0]; }
1624
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001625 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1626 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1627
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001628 int slot_index() { return hydrogen()->slot_index(); }
1629
1630 virtual void PrintDataTo(StringStream* stream);
1631};
1632
1633
1634class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1635 public:
1636 LStoreContextSlot(LOperand* context, LOperand* value) {
1637 inputs_[0] = context;
1638 inputs_[1] = value;
1639 }
1640
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001641 LOperand* context() { return inputs_[0]; }
1642 LOperand* value() { return inputs_[1]; }
1643
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001644 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1645 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1646
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001647 int slot_index() { return hydrogen()->slot_index(); }
1648
1649 virtual void PrintDataTo(StringStream* stream);
1650};
1651
1652
1653class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1654 public:
1655 explicit LPushArgument(LOperand* value) {
1656 inputs_[0] = value;
1657 }
1658
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001659 LOperand* value() { return inputs_[0]; }
1660
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001661 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1662};
1663
1664
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001665class LDrop: public LTemplateInstruction<0, 0, 0> {
1666 public:
1667 explicit LDrop(int count) : count_(count) { }
1668
1669 int count() const { return count_; }
1670
1671 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1672
1673 private:
1674 int count_;
1675};
1676
1677
jkummerow@chromium.org4c54a2a2013-03-19 17:51:30 +00001678class LInnerAllocatedObject: public LTemplateInstruction<1, 1, 0> {
1679 public:
1680 explicit LInnerAllocatedObject(LOperand* base_object) {
1681 inputs_[0] = base_object;
1682 }
1683
1684 LOperand* base_object() { return inputs_[0]; }
1685 int offset() { return hydrogen()->offset(); }
1686
1687 virtual void PrintDataTo(StringStream* stream);
1688
1689 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "sub-allocated-object")
1690 DECLARE_HYDROGEN_ACCESSOR(InnerAllocatedObject)
1691};
1692
1693
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001694class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1695 public:
1696 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1697 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1698};
1699
1700
1701class LContext: public LTemplateInstruction<1, 0, 0> {
1702 public:
1703 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001704 DECLARE_HYDROGEN_ACCESSOR(Context)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001705};
1706
1707
1708class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1709 public:
1710 explicit LOuterContext(LOperand* context) {
1711 inputs_[0] = context;
1712 }
1713
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001714 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001715
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001716 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001717};
1718
1719
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001720class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1721 public:
1722 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1723 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1724};
1725
1726
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001727class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1728 public:
1729 explicit LGlobalObject(LOperand* context) {
1730 inputs_[0] = context;
1731 }
1732
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001733 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001734
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001735 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001736};
1737
1738
1739class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1740 public:
1741 explicit LGlobalReceiver(LOperand* global_object) {
1742 inputs_[0] = global_object;
1743 }
1744
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001745 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001746
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001747 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001748};
1749
1750
1751class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1752 public:
1753 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1754 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1755
1756 virtual void PrintDataTo(StringStream* stream);
1757
1758 Handle<JSFunction> function() { return hydrogen()->function(); }
1759 int arity() const { return hydrogen()->argument_count() - 1; }
1760};
1761
1762
1763class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1764 public:
1765 explicit LInvokeFunction(LOperand* function) {
1766 inputs_[0] = function;
1767 }
1768
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001769 LOperand* function() { return inputs_[0]; }
1770
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001771 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1772 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1773
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001774 virtual void PrintDataTo(StringStream* stream);
1775
1776 int arity() const { return hydrogen()->argument_count() - 1; }
1777};
1778
1779
1780class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1781 public:
1782 explicit LCallKeyed(LOperand* key) {
1783 inputs_[0] = key;
1784 }
1785
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001786 LOperand* key() { return inputs_[0]; }
1787
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001788 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1789 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1790
1791 virtual void PrintDataTo(StringStream* stream);
1792
1793 int arity() const { return hydrogen()->argument_count() - 1; }
1794};
1795
1796
1797
1798class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1799 public:
1800 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1801 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1802
1803 virtual void PrintDataTo(StringStream* stream);
1804
1805 Handle<String> name() const { return hydrogen()->name(); }
1806 int arity() const { return hydrogen()->argument_count() - 1; }
1807};
1808
1809
danno@chromium.orgc612e022011-11-10 11:38:15 +00001810class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001811 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001812 explicit LCallFunction(LOperand* function) {
1813 inputs_[0] = function;
1814 }
1815
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001816 LOperand* function() { return inputs_[0]; }
1817
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001818 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1819 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1820
danno@chromium.orgc612e022011-11-10 11:38:15 +00001821 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001822};
1823
1824
1825class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1826 public:
1827 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1828 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1829
1830 virtual void PrintDataTo(StringStream* stream);
1831
1832 Handle<String> name() const {return hydrogen()->name(); }
1833 int arity() const { return hydrogen()->argument_count() - 1; }
1834};
1835
1836
1837class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1838 public:
1839 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1840 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1841
1842 virtual void PrintDataTo(StringStream* stream);
1843
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001844 int arity() const { return hydrogen()->argument_count() - 1; }
1845};
1846
1847
1848class LCallNew: public LTemplateInstruction<1, 1, 0> {
1849 public:
1850 explicit LCallNew(LOperand* constructor) {
1851 inputs_[0] = constructor;
1852 }
1853
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001854 LOperand* constructor() { return inputs_[0]; }
1855
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001856 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1857 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1858
1859 virtual void PrintDataTo(StringStream* stream);
1860
1861 int arity() const { return hydrogen()->argument_count() - 1; }
1862};
1863
1864
ulan@chromium.org750145a2013-03-07 15:14:13 +00001865class LCallNewArray: public LTemplateInstruction<1, 1, 0> {
1866 public:
1867 explicit LCallNewArray(LOperand* constructor) {
1868 inputs_[0] = constructor;
1869 }
1870
1871 LOperand* constructor() { return inputs_[0]; }
1872
1873 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1874 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1875
1876 virtual void PrintDataTo(StringStream* stream);
1877
1878 int arity() const { return hydrogen()->argument_count() - 1; }
1879};
1880
1881
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001882class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1883 public:
1884 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1885 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1886
1887 const Runtime::Function* function() const { return hydrogen()->function(); }
1888 int arity() const { return hydrogen()->argument_count(); }
1889};
1890
1891
1892class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1893 public:
1894 explicit LInteger32ToDouble(LOperand* value) {
1895 inputs_[0] = value;
1896 }
1897
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001898 LOperand* value() { return inputs_[0]; }
1899
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001900 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1901};
1902
1903
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001904class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1905 public:
1906 explicit LUint32ToDouble(LOperand* value) {
1907 inputs_[0] = value;
1908 }
1909
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001910 LOperand* value() { return inputs_[0]; }
1911
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001912 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1913};
1914
1915
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001916class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1917 public:
1918 explicit LNumberTagI(LOperand* value) {
1919 inputs_[0] = value;
1920 }
1921
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001922 LOperand* value() { return inputs_[0]; }
1923
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001924 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1925};
1926
1927
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001928class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1929 public:
1930 explicit LNumberTagU(LOperand* value) {
1931 inputs_[0] = value;
1932 }
1933
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001934 LOperand* value() { return inputs_[0]; }
1935
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001936 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1937};
1938
1939
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001940class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1941 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001942 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001943 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001944 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001945 temps_[1] = temp2;
1946 }
1947
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001948 LOperand* value() { return inputs_[0]; }
1949 LOperand* temp() { return temps_[0]; }
1950 LOperand* temp2() { return temps_[1]; }
1951
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001952 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001953 DECLARE_HYDROGEN_ACCESSOR(Change)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001954};
1955
1956
1957// Sometimes truncating conversion from a tagged value to an int32.
1958class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1959 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001960 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001961 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001962 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001963 temps_[1] = temp2;
1964 }
1965
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001966 LOperand* value() { return inputs_[0]; }
1967 LOperand* temp() { return temps_[0]; }
1968 LOperand* temp2() { return temps_[1]; }
1969
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001970 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1971 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1972
1973 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1974};
1975
1976
1977// Truncating conversion from a tagged value to an int32.
1978class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1979 public:
1980 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001981 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001982 LOperand* temp2,
1983 LOperand* temp3) {
1984 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001985 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001986 temps_[1] = temp2;
1987 temps_[2] = temp3;
1988 }
1989
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001990 LOperand* value() { return inputs_[0]; }
1991 LOperand* temp() { return temps_[0]; }
1992 LOperand* temp2() { return temps_[1]; }
1993 LOperand* temp3() { return temps_[2]; }
1994
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001995 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1996 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1997
1998 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1999};
2000
2001
2002class LSmiTag: public LTemplateInstruction<1, 1, 0> {
2003 public:
2004 explicit LSmiTag(LOperand* value) {
2005 inputs_[0] = value;
2006 }
2007
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002008 LOperand* value() { return inputs_[0]; }
2009
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002010 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2011};
2012
2013
2014class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
2015 public:
2016 explicit LNumberUntagD(LOperand* value) {
2017 inputs_[0] = value;
2018 }
2019
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002020 LOperand* value() { return inputs_[0]; }
2021
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002022 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2023 DECLARE_HYDROGEN_ACCESSOR(Change)
2024};
2025
2026
2027class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
2028 public:
2029 LSmiUntag(LOperand* value, bool needs_check)
2030 : needs_check_(needs_check) {
2031 inputs_[0] = value;
2032 }
2033
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002034 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002035 bool needs_check() const { return needs_check_; }
2036
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002037 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2038
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002039 private:
2040 bool needs_check_;
2041};
2042
2043
verwaest@chromium.org37141392012-05-31 13:27:02 +00002044class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002045 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002046 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2047 inputs_[0] = object;
2048 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00002049 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002050 }
2051
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002052 LOperand* object() { return inputs_[0]; }
2053 LOperand* value() { return inputs_[1]; }
2054 LOperand* temp() { return temps_[0]; }
2055
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002056 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2057 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2058
2059 virtual void PrintDataTo(StringStream* stream);
2060
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002061 Handle<Object> name() const { return hydrogen()->name(); }
2062 bool is_in_object() { return hydrogen()->is_in_object(); }
2063 int offset() { return hydrogen()->offset(); }
2064 Handle<Map> transition() const { return hydrogen()->transition(); }
danno@chromium.orgf005df62013-04-30 16:36:45 +00002065 Representation representation() const {
2066 return hydrogen()->field_representation();
2067 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002068};
2069
2070
2071class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
2072 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002073 LStoreNamedGeneric(LOperand* object, LOperand* value) {
2074 inputs_[0] = object;
2075 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002076 }
2077
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002078 LOperand* object() { return inputs_[0]; }
2079 LOperand* value() { return inputs_[1]; }
2080
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002081 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2082 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2083
2084 virtual void PrintDataTo(StringStream* stream);
2085
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002086 Handle<Object> name() const { return hydrogen()->name(); }
2087 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002088};
2089
2090
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002091class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002092 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002093 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002094 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002095 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002096 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002097 }
2098
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002099 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002100 LOperand* elements() { return inputs_[0]; }
2101 LOperand* key() { return inputs_[1]; }
2102 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002103 ElementsKind elements_kind() const {
2104 return hydrogen()->elements_kind();
2105 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002106
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002107 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2108 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002109
2110 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00002111 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002112 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002113};
2114
2115
2116class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
2117 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002118 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002119 inputs_[0] = obj;
2120 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002121 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002122 }
2123
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002124 LOperand* object() { return inputs_[0]; }
2125 LOperand* key() { return inputs_[1]; }
2126 LOperand* value() { return inputs_[2]; }
2127
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002128 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2129 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2130
2131 virtual void PrintDataTo(StringStream* stream);
2132
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00002133 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002134};
2135
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002136
mstarzinger@chromium.orgf705b502013-04-04 11:38:09 +00002137class LTransitionElementsKind: public LTemplateInstruction<0, 1, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002138 public:
2139 LTransitionElementsKind(LOperand* object,
2140 LOperand* new_map_temp,
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002141 LOperand* fixed_object_temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002142 inputs_[0] = object;
2143 temps_[0] = new_map_temp;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002144 temps_[1] = fixed_object_temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002145 }
2146
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002147 LOperand* object() { return inputs_[0]; }
2148 LOperand* new_map_temp() { return temps_[0]; }
2149 LOperand* temp() { return temps_[1]; }
2150
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002151 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2152 "transition-elements-kind")
2153 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2154
2155 virtual void PrintDataTo(StringStream* stream);
2156
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002157 Handle<Map> original_map() { return hydrogen()->original_map(); }
2158 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002159 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2160 ElementsKind to_kind() { return hydrogen()->to_kind(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002161};
2162
2163
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002164class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> {
2165 public:
2166 LTrapAllocationMemento(LOperand* object,
2167 LOperand* temp) {
2168 inputs_[0] = object;
2169 temps_[0] = temp;
2170 }
2171
2172 LOperand* object() { return inputs_[0]; }
2173 LOperand* temp() { return temps_[0]; }
2174
2175 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2176 "trap-allocation-memento")
2177};
2178
2179
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002180class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2181 public:
2182 LStringAdd(LOperand* left, LOperand* right) {
2183 inputs_[0] = left;
2184 inputs_[1] = right;
2185 }
2186
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002187 LOperand* left() { return inputs_[0]; }
2188 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002189
2190 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2191 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002192};
2193
2194
2195
2196class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2197 public:
2198 LStringCharCodeAt(LOperand* string, LOperand* index) {
2199 inputs_[0] = string;
2200 inputs_[1] = index;
2201 }
2202
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002203 LOperand* string() { return inputs_[0]; }
2204 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002205
2206 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2207 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002208};
2209
2210
2211class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2212 public:
2213 explicit LStringCharFromCode(LOperand* char_code) {
2214 inputs_[0] = char_code;
2215 }
2216
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002217 LOperand* char_code() { return inputs_[0]; }
2218
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002219 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2220 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002221};
2222
2223
2224class LStringLength: public LTemplateInstruction<1, 1, 0> {
2225 public:
2226 explicit LStringLength(LOperand* string) {
2227 inputs_[0] = string;
2228 }
2229
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002230 LOperand* string() { return inputs_[0]; }
2231
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002232 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2233 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002234};
2235
2236
2237class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2238 public:
2239 explicit LCheckFunction(LOperand* value) {
2240 inputs_[0] = value;
2241 }
2242
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002243 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002244
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002245 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2246 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2247};
2248
2249
2250class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2251 public:
2252 explicit LCheckInstanceType(LOperand* value) {
2253 inputs_[0] = value;
2254 }
2255
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002256 LOperand* value() { return inputs_[0]; }
2257
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002258 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2259 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2260};
2261
2262
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002263class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002264 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002265 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002266 inputs_[0] = value;
2267 }
2268
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002269 LOperand* value() { return inputs_[0]; }
2270
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002271 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2272 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002273};
2274
2275
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002276class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002277 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002278 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2279 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002280 temps_[1] = temp2;
2281 }
2282
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002283 LOperand* temp() { return temps_[0]; }
2284 LOperand* temp2() { return temps_[1]; }
2285
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002286 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2287 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2288
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002289 ZoneList<Handle<JSObject> >* prototypes() const {
2290 return hydrogen()->prototypes();
2291 }
2292 ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002293};
2294
2295
2296class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2297 public:
2298 explicit LCheckSmi(LOperand* value) {
2299 inputs_[0] = value;
2300 }
2301
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002302 LOperand* value() { return inputs_[0]; }
2303
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002304 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2305};
2306
2307
2308class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2309 public:
2310 explicit LCheckNonSmi(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(CheckNonSmi, "check-non-smi")
2317};
2318
2319
2320class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2321 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002322 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2323 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002324 temps_[0] = temp;
2325 }
2326
2327 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002328 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002329
2330 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2331};
2332
2333
2334class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2335 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002336 explicit LClampIToUint8(LOperand* unclamped) {
2337 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002338 }
2339
2340 LOperand* unclamped() { return inputs_[0]; }
2341
2342 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2343};
2344
2345
2346class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2347 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002348 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2349 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002350 temps_[0] = temp;
2351 }
2352
2353 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002354 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002355
2356 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2357};
2358
2359
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002360class LAllocateObject: public LTemplateInstruction<1, 1, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002361 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002362 LAllocateObject(LOperand* temp, LOperand* temp2) {
2363 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002364 temps_[1] = temp2;
2365 }
2366
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002367 LOperand* temp() { return temps_[0]; }
2368 LOperand* temp2() { return temps_[1]; }
2369
ulan@chromium.org967e2702012-02-28 09:49:15 +00002370 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2371 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2372};
2373
2374
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002375class LAllocate: public LTemplateInstruction<1, 2, 2> {
2376 public:
2377 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2378 inputs_[1] = size;
2379 temps_[0] = temp1;
2380 temps_[1] = temp2;
2381 }
2382
2383 LOperand* size() { return inputs_[1]; }
2384 LOperand* temp1() { return temps_[0]; }
2385 LOperand* temp2() { return temps_[1]; }
2386
2387 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2388 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2389};
2390
2391
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002392class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2393 public:
2394 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2395 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2396};
2397
2398
2399class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2400 public:
2401 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2402 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002403};
2404
2405
2406class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2407 public:
2408 explicit LToFastProperties(LOperand* value) {
2409 inputs_[0] = value;
2410 }
2411
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002412 LOperand* value() { return inputs_[0]; }
2413
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002414 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2415 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2416};
2417
2418
2419class LTypeof: public LTemplateInstruction<1, 1, 0> {
2420 public:
2421 explicit LTypeof(LOperand* value) {
2422 inputs_[0] = value;
2423 }
2424
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002425 LOperand* value() { return inputs_[0]; }
2426
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002427 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2428};
2429
2430
2431class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2432 public:
2433 explicit LTypeofIsAndBranch(LOperand* value) {
2434 inputs_[0] = value;
2435 }
2436
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002437 LOperand* value() { return inputs_[0]; }
2438
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002439 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2440 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2441
2442 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2443
2444 virtual void PrintDataTo(StringStream* stream);
2445};
2446
2447
2448class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2449 public:
2450 explicit LIsConstructCallAndBranch(LOperand* temp) {
2451 temps_[0] = temp;
2452 }
2453
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002454 LOperand* temp() { return temps_[0]; }
2455
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002456 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2457 "is-construct-call-and-branch")
2458};
2459
2460
2461class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2462 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002463 LDeleteProperty(LOperand* object, LOperand* key) {
2464 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002465 inputs_[1] = key;
2466 }
2467
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002468 LOperand* object() { return inputs_[0]; }
2469 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002470
2471 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002472};
2473
2474
2475class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2476 public:
2477 LOsrEntry();
2478
ulan@chromium.org32d7dba2013-04-24 10:59:06 +00002479 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002480 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2481
2482 LOperand** SpilledRegisterArray() { return register_spills_; }
2483 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2484
2485 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2486 void MarkSpilledDoubleRegister(int allocation_index,
2487 LOperand* spill_operand);
2488
2489 private:
2490 // Arrays of spill slot operands for registers with an assigned spill
2491 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2492 // NULL if the register has no assigned spill slot. Indexed by allocation
2493 // index.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002494 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters];
2495 LOperand* double_register_spills_[
2496 DoubleRegister::kMaxNumAllocatableRegisters];
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002497};
2498
2499
2500class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2501 public:
2502 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2503 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2504
2505 Label* done_label() { return &done_label_; }
2506
2507 private:
2508 Label done_label_;
2509};
2510
2511
2512class LIn: public LTemplateInstruction<1, 2, 0> {
2513 public:
2514 LIn(LOperand* key, LOperand* object) {
2515 inputs_[0] = key;
2516 inputs_[1] = object;
2517 }
2518
2519 LOperand* key() { return inputs_[0]; }
2520 LOperand* object() { return inputs_[1]; }
2521
2522 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2523};
2524
2525
ulan@chromium.org812308e2012-02-29 15:58:45 +00002526class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2527 public:
2528 explicit LForInPrepareMap(LOperand* object) {
2529 inputs_[0] = object;
2530 }
2531
2532 LOperand* object() { return inputs_[0]; }
2533
2534 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2535};
2536
2537
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002538class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002539 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002540 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002541 inputs_[0] = map;
2542 }
2543
2544 LOperand* map() { return inputs_[0]; }
2545
2546 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2547
2548 int idx() {
2549 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2550 }
2551};
2552
2553
2554class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2555 public:
2556 LCheckMapValue(LOperand* value, LOperand* map) {
2557 inputs_[0] = value;
2558 inputs_[1] = map;
2559 }
2560
2561 LOperand* value() { return inputs_[0]; }
2562 LOperand* map() { return inputs_[1]; }
2563
2564 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2565};
2566
2567
2568class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2569 public:
2570 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2571 inputs_[0] = object;
2572 inputs_[1] = index;
2573 }
2574
2575 LOperand* object() { return inputs_[0]; }
2576 LOperand* index() { return inputs_[1]; }
2577
2578 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2579};
2580
2581
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002582class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002583class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002584 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002585 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2586 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002587
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002588 int GetNextSpillIndex(bool is_double);
2589 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002590};
2591
2592
2593class LChunkBuilder BASE_EMBEDDED {
2594 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002595 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2596 : chunk_(NULL),
2597 info_(info),
2598 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002599 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002600 status_(UNUSED),
2601 current_instruction_(NULL),
2602 current_block_(NULL),
2603 next_block_(NULL),
2604 argument_count_(0),
2605 allocator_(allocator),
2606 position_(RelocInfo::kNoPosition),
2607 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002608 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002609
2610 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002611 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002612
2613 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002614#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002615 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2616#undef DECLARE_DO
2617
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002618 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2619
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002620 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2621 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2622 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2623 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2624 LInstruction* DoMathSin(HUnaryMathOperation* instr);
2625 LInstruction* DoMathCos(HUnaryMathOperation* instr);
2626 LInstruction* DoMathTan(HUnaryMathOperation* instr);
2627 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2628 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2629 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2630
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002631 private:
2632 enum Status {
2633 UNUSED,
2634 BUILDING,
2635 DONE,
2636 ABORTED
2637 };
2638
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002639 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002640 CompilationInfo* info() const { return info_; }
2641 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002642 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002643
2644 bool is_unused() const { return status_ == UNUSED; }
2645 bool is_building() const { return status_ == BUILDING; }
2646 bool is_done() const { return status_ == DONE; }
2647 bool is_aborted() const { return status_ == ABORTED; }
2648
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002649 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002650
2651 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002652 LUnallocated* ToUnallocated(Register reg);
2653 LUnallocated* ToUnallocated(DoubleRegister reg);
2654
2655 // Methods for setting up define-use relationships.
2656 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2657 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2658 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2659 DoubleRegister fixed_register);
2660
2661 // A value that is guaranteed to be allocated to a register.
2662 // Operand created by UseRegister is guaranteed to be live until the end of
2663 // instruction. This means that register allocator will not reuse it's
2664 // register for any other operand inside instruction.
2665 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2666 // instruction start. Register allocator is free to assign the same register
2667 // to some other operand used inside instruction (i.e. temporary or
2668 // output).
2669 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2670 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2671
2672 // An input operand in a register that may be trashed.
2673 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2674
2675 // An input operand in a register or stack slot.
2676 MUST_USE_RESULT LOperand* Use(HValue* value);
2677 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2678
2679 // An input operand in a register, stack slot or a constant operand.
2680 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2681 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2682
2683 // An input operand in a register or a constant operand.
2684 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2685 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2686
danno@chromium.orgf005df62013-04-30 16:36:45 +00002687 // An input operand in a constant operand.
2688 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2689
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002690 // An input operand in register, stack slot or a constant operand.
2691 // Will not be moved to a register even if one is freely available.
2692 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2693
2694 // Temporary operand that must be in a register.
2695 MUST_USE_RESULT LUnallocated* TempRegister();
2696 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2697 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2698
2699 // Methods for setting up define-use relationships.
2700 // Return the same instruction that they are passed.
2701 template<int I, int T>
2702 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2703 LUnallocated* result);
2704 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002705 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2706 template<int I, int T>
2707 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2708 int index);
2709 template<int I, int T>
2710 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2711 template<int I, int T>
2712 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2713 Register reg);
2714 template<int I, int T>
2715 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2716 DoubleRegister reg);
2717 LInstruction* AssignEnvironment(LInstruction* instr);
2718 LInstruction* AssignPointerMap(LInstruction* instr);
2719
2720 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2721
2722 // By default we assume that instruction sequences generated for calls
2723 // cannot deoptimize eagerly and we do not attach environment to this
2724 // instruction.
2725 LInstruction* MarkAsCall(
2726 LInstruction* instr,
2727 HInstruction* hinstr,
2728 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002729
2730 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2731 int* argument_index_accumulator);
2732
2733 void VisitInstruction(HInstruction* current);
2734
2735 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2736 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2737 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2738 LInstruction* DoArithmeticD(Token::Value op,
2739 HArithmeticBinaryOperation* instr);
2740 LInstruction* DoArithmeticT(Token::Value op,
2741 HArithmeticBinaryOperation* instr);
2742
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002743 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002744 CompilationInfo* info_;
2745 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002746 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002747 Status status_;
2748 HInstruction* current_instruction_;
2749 HBasicBlock* current_block_;
2750 HBasicBlock* next_block_;
2751 int argument_count_;
2752 LAllocator* allocator_;
2753 int position_;
2754 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002755 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002756
lrn@chromium.org7516f052011-03-30 08:52:27 +00002757 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2758};
2759
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002760#undef DECLARE_HYDROGEN_ACCESSOR
2761#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002762
2763} } // namespace v8::internal
2764
2765#endif // V8_MIPS_LITHIUM_MIPS_H_