blob: bb8c9930c091a01f0f6d080666659f50a7b4b047 [file] [log] [blame]
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001// Copyright 2012 the V8 project authors. All rights reserved.
lrn@chromium.org7516f052011-03-30 08:52:27 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef V8_MIPS_LITHIUM_MIPS_H_
29#define V8_MIPS_LITHIUM_MIPS_H_
30
31#include "hydrogen.h"
32#include "lithium-allocator.h"
33#include "lithium.h"
34#include "safepoint-table.h"
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000035#include "utils.h"
lrn@chromium.org7516f052011-03-30 08:52:27 +000036
37namespace v8 {
38namespace internal {
39
40// Forward declarations.
41class LCodeGen;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000042
43#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
44 V(ControlInstruction) \
45 V(Call) \
46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
47
48
49#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
50 V(AccessArgumentsAt) \
51 V(AddI) \
ulan@chromium.org967e2702012-02-28 09:49:15 +000052 V(AllocateObject) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +000053 V(Allocate) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000054 V(ApplyArguments) \
55 V(ArgumentsElements) \
56 V(ArgumentsLength) \
57 V(ArithmeticD) \
58 V(ArithmeticT) \
59 V(ArrayLiteral) \
60 V(BitI) \
61 V(BitNotI) \
62 V(BoundsCheck) \
63 V(Branch) \
64 V(CallConstantFunction) \
65 V(CallFunction) \
66 V(CallGlobal) \
67 V(CallKeyed) \
68 V(CallKnownGlobal) \
69 V(CallNamed) \
70 V(CallNew) \
ulan@chromium.org750145a2013-03-07 15:14:13 +000071 V(CallNewArray) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000072 V(CallRuntime) \
73 V(CallStub) \
74 V(CheckFunction) \
75 V(CheckInstanceType) \
jkummerow@chromium.org1456e702012-03-30 08:38:13 +000076 V(CheckMaps) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000077 V(CheckNonSmi) \
78 V(CheckPrototypeMaps) \
79 V(CheckSmi) \
80 V(ClampDToUint8) \
81 V(ClampIToUint8) \
82 V(ClampTToUint8) \
83 V(ClassOfTestAndBranch) \
84 V(CmpConstantEqAndBranch) \
85 V(CmpIDAndBranch) \
86 V(CmpObjectEqAndBranch) \
87 V(CmpMapAndBranch) \
88 V(CmpT) \
89 V(ConstantD) \
90 V(ConstantI) \
91 V(ConstantT) \
92 V(Context) \
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) \
117 V(IsNilAndBranch) \
118 V(IsObjectAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000119 V(IsStringAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000120 V(IsSmiAndBranch) \
121 V(IsUndetectableAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000122 V(Label) \
123 V(LazyBailout) \
124 V(LoadContextSlot) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000125 V(LoadExternalArrayPointer) \
126 V(LoadFunctionPrototype) \
127 V(LoadGlobalCell) \
128 V(LoadGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000129 V(LoadKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000130 V(LoadKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000131 V(LoadNamedField) \
132 V(LoadNamedFieldPolymorphic) \
133 V(LoadNamedGeneric) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000134 V(MapEnumLength) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000135 V(MathAbs) \
136 V(MathCos) \
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000137 V(MathExp) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000138 V(MathFloor) \
139 V(MathLog) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000140 V(MathMinMax) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000141 V(MathPowHalf) \
142 V(MathRound) \
143 V(MathSin) \
144 V(MathSqrt) \
145 V(MathTan) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000146 V(ModI) \
147 V(MulI) \
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000148 V(MultiplyAddD) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000149 V(NumberTagD) \
150 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000151 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000152 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000153 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000154 V(OsrEntry) \
155 V(OuterContext) \
156 V(Parameter) \
157 V(Power) \
158 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000159 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000160 V(RegExpLiteral) \
161 V(Return) \
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000162 V(SeqStringSetChar) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000163 V(ShiftI) \
164 V(SmiTag) \
165 V(SmiUntag) \
166 V(StackCheck) \
167 V(StoreContextSlot) \
168 V(StoreGlobalCell) \
169 V(StoreGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000170 V(StoreKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000171 V(StoreKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000172 V(StoreNamedField) \
173 V(StoreNamedGeneric) \
174 V(StringAdd) \
175 V(StringCharCodeAt) \
176 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000177 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000178 V(StringLength) \
179 V(SubI) \
180 V(TaggedToI) \
181 V(ThisFunction) \
182 V(Throw) \
183 V(ToFastProperties) \
184 V(TransitionElementsKind) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000185 V(TrapAllocationMemento) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000186 V(Typeof) \
187 V(TypeofIsAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000188 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000189 V(ValueOf) \
190 V(ForInPrepareMap) \
191 V(ForInCacheArray) \
192 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000193 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000194 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000195 V(WrapReceiver) \
jkummerow@chromium.org4c54a2a2013-03-19 17:51:30 +0000196 V(Drop) \
197 V(InnerAllocatedObject)
198
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000199
200#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
201 virtual Opcode opcode() const { return LInstruction::k##type; } \
202 virtual void CompileToNative(LCodeGen* generator); \
203 virtual const char* Mnemonic() const { return mnemonic; } \
204 static L##type* cast(LInstruction* instr) { \
205 ASSERT(instr->Is##type()); \
206 return reinterpret_cast<L##type*>(instr); \
207 }
208
209
210#define DECLARE_HYDROGEN_ACCESSOR(type) \
211 H##type* hydrogen() const { \
212 return H##type::cast(hydrogen_value()); \
213 }
214
lrn@chromium.org7516f052011-03-30 08:52:27 +0000215
216class LInstruction: public ZoneObject {
217 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000218 LInstruction()
219 : environment_(NULL),
220 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000221 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000222 virtual ~LInstruction() { }
223
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000224 virtual void CompileToNative(LCodeGen* generator) = 0;
225 virtual const char* Mnemonic() const = 0;
226 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000227 virtual void PrintDataTo(StringStream* stream);
228 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000229
230 enum Opcode {
231 // Declare a unique enum value for each instruction.
232#define DECLARE_OPCODE(type) k##type,
233 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
234 kNumberOfInstructions
235#undef DECLARE_OPCODE
236 };
237
238 virtual Opcode opcode() const = 0;
239
240 // Declare non-virtual type testers for all leaf IR classes.
241#define DECLARE_PREDICATE(type) \
242 bool Is##type() const { return opcode() == k##type; }
243 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
244#undef DECLARE_PREDICATE
245
246 // Declare virtual predicates for instructions that don't have
247 // an opcode.
248 virtual bool IsGap() const { return false; }
249
250 virtual bool IsControl() const { return false; }
251
252 void set_environment(LEnvironment* env) { environment_ = env; }
253 LEnvironment* environment() const { return environment_; }
254 bool HasEnvironment() const { return environment_ != NULL; }
255
256 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
257 LPointerMap* pointer_map() const { return pointer_map_.get(); }
258 bool HasPointerMap() const { return pointer_map_.is_set(); }
259
260 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
261 HValue* hydrogen_value() const { return hydrogen_value_; }
262
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000263 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000264
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000265 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000266
267 // Interface to the register allocator and iterators.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000268 bool ClobbersTemps() const { return is_call_; }
269 bool ClobbersRegisters() const { return is_call_; }
270 bool ClobbersDoubleRegisters() const { return is_call_; }
271
272 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000273 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000274
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000275 virtual bool HasResult() const = 0;
276 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000277
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000278 LOperand* FirstInput() { return InputAt(0); }
279 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000280
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000281 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
282
lrn@chromium.org7516f052011-03-30 08:52:27 +0000283#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000284 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000285#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000286
287 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000288 // Iterator interface.
289 friend class InputIterator;
290 virtual int InputCount() = 0;
291 virtual LOperand* InputAt(int i) = 0;
292
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000293 friend class TempIterator;
294 virtual int TempCount() = 0;
295 virtual LOperand* TempAt(int i) = 0;
296
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000297 LEnvironment* environment_;
298 SetOncePointer<LPointerMap> pointer_map_;
299 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000300 bool is_call_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000301};
302
303
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000304// R = number of result operands (0 or 1).
305// I = number of input operands.
306// T = number of temporary operands.
307template<int R, int I, int T>
308class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000309 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000310 // Allow 0 or 1 output operands.
311 STATIC_ASSERT(R == 0 || R == 1);
312 virtual bool HasResult() const { return R != 0; }
313 void set_result(LOperand* operand) { results_[0] = operand; }
314 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000315
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000316 protected:
317 EmbeddedContainer<LOperand*, R> results_;
318 EmbeddedContainer<LOperand*, I> inputs_;
319 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000320
321 private:
322 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000323 virtual LOperand* InputAt(int i) { return inputs_[i]; }
324
325 virtual int TempCount() { return T; }
326 virtual LOperand* TempAt(int i) { return temps_[i]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000327};
328
329
330class LGap: public LTemplateInstruction<0, 0, 0> {
331 public:
332 explicit LGap(HBasicBlock* block)
333 : block_(block) {
334 parallel_moves_[BEFORE] = NULL;
335 parallel_moves_[START] = NULL;
336 parallel_moves_[END] = NULL;
337 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000338 }
339
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000340 // Can't use the DECLARE-macro here because of sub-classes.
341 virtual bool IsGap() const { return true; }
342 virtual void PrintDataTo(StringStream* stream);
343 static LGap* cast(LInstruction* instr) {
344 ASSERT(instr->IsGap());
345 return reinterpret_cast<LGap*>(instr);
346 }
347
348 bool IsRedundant() const;
349
350 HBasicBlock* block() const { return block_; }
351
lrn@chromium.org7516f052011-03-30 08:52:27 +0000352 enum InnerPosition {
353 BEFORE,
354 START,
355 END,
356 AFTER,
357 FIRST_INNER_POSITION = BEFORE,
358 LAST_INNER_POSITION = AFTER
359 };
360
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000361 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
362 if (parallel_moves_[pos] == NULL) {
363 parallel_moves_[pos] = new(zone) LParallelMove(zone);
364 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000365 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000366 }
367
368 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000369 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000370 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000371
372 private:
373 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
374 HBasicBlock* block_;
375};
376
377
378class LInstructionGap: public LGap {
379 public:
380 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
381
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000382 virtual bool HasInterestingComment(LCodeGen* gen) const {
383 return !IsRedundant();
384 }
385
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000386 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
387};
388
389
390class LGoto: public LTemplateInstruction<0, 0, 0> {
391 public:
392 explicit LGoto(int block_id) : block_id_(block_id) { }
393
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000394 virtual bool HasInterestingComment(LCodeGen* gen) const;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000395 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
396 virtual void PrintDataTo(StringStream* stream);
397 virtual bool IsControl() const { return true; }
398
399 int block_id() const { return block_id_; }
400
401 private:
402 int block_id_;
403};
404
405
406class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
407 public:
408 LLazyBailout() : gap_instructions_size_(0) { }
409
410 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
411
412 void set_gap_instructions_size(int gap_instructions_size) {
413 gap_instructions_size_ = gap_instructions_size;
414 }
415 int gap_instructions_size() { return gap_instructions_size_; }
416
417 private:
418 int gap_instructions_size_;
419};
420
421
yangguo@chromium.org46a2a512013-01-18 16:29:40 +0000422class LDummyUse: public LTemplateInstruction<1, 1, 0> {
423 public:
424 explicit LDummyUse(LOperand* value) {
425 inputs_[0] = value;
426 }
427 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
428};
429
430
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000431class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
432 public:
433 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000434};
435
436
437class LLabel: public LGap {
438 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000439 explicit LLabel(HBasicBlock* block)
440 : LGap(block), replacement_(NULL) { }
441
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000442 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000443 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
444
445 virtual void PrintDataTo(StringStream* stream);
446
447 int block_id() const { return block()->block_id(); }
448 bool is_loop_header() const { return block()->IsLoopHeader(); }
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000449 bool is_osr_entry() const { return block()->is_osr_entry(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000450 Label* label() { return &label_; }
451 LLabel* replacement() const { return replacement_; }
452 void set_replacement(LLabel* label) { replacement_ = label; }
453 bool HasReplacement() const { return replacement_ != NULL; }
454
455 private:
456 Label label_;
457 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000458};
459
460
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000461class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000462 public:
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000463 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000464 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
465};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000466
lrn@chromium.org7516f052011-03-30 08:52:27 +0000467
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000468class LCallStub: public LTemplateInstruction<1, 0, 0> {
469 public:
470 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
471 DECLARE_HYDROGEN_ACCESSOR(CallStub)
472
473 TranscendentalCache::Type transcendental_type() {
474 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000475 }
476};
477
478
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000479class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
480 public:
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000481 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000482 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
483};
484
485
486template<int I, int T>
487class LControlInstruction: public LTemplateInstruction<0, I, T> {
488 public:
489 virtual bool IsControl() const { return true; }
490
491 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
492 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
493 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
494 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
495
496 private:
497 HControlInstruction* hydrogen() {
498 return HControlInstruction::cast(this->hydrogen_value());
499 }
500};
501
502
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000503class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
504 public:
505 LWrapReceiver(LOperand* receiver, LOperand* function) {
506 inputs_[0] = receiver;
507 inputs_[1] = function;
508 }
509
510 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
511
512 LOperand* receiver() { return inputs_[0]; }
513 LOperand* function() { return inputs_[1]; }
514};
515
516
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000517class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
518 public:
519 LApplyArguments(LOperand* function,
520 LOperand* receiver,
521 LOperand* length,
522 LOperand* elements) {
523 inputs_[0] = function;
524 inputs_[1] = receiver;
525 inputs_[2] = length;
526 inputs_[3] = elements;
527 }
528
529 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
530
531 LOperand* function() { return inputs_[0]; }
532 LOperand* receiver() { return inputs_[1]; }
533 LOperand* length() { return inputs_[2]; }
534 LOperand* elements() { return inputs_[3]; }
535};
536
537
538class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
539 public:
540 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
541 inputs_[0] = arguments;
542 inputs_[1] = length;
543 inputs_[2] = index;
544 }
545
546 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
547
548 LOperand* arguments() { return inputs_[0]; }
549 LOperand* length() { return inputs_[1]; }
550 LOperand* index() { return inputs_[2]; }
551
552 virtual void PrintDataTo(StringStream* stream);
553};
554
555
556class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
557 public:
558 explicit LArgumentsLength(LOperand* elements) {
559 inputs_[0] = elements;
560 }
561
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000562 LOperand* elements() { return inputs_[0]; }
563
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000564 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
565};
566
567
568class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
569 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000570 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000571 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000572};
573
574
575class LModI: public LTemplateInstruction<1, 2, 3> {
576 public:
577 // Used when the right hand is a constant power of 2.
578 LModI(LOperand* left,
579 LOperand* right) {
580 inputs_[0] = left;
581 inputs_[1] = right;
582 temps_[0] = NULL;
583 temps_[1] = NULL;
584 temps_[2] = NULL;
585 }
586
587 // Used for the standard case.
588 LModI(LOperand* left,
589 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000590 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000591 LOperand* temp2,
592 LOperand* temp3) {
593 inputs_[0] = left;
594 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000595 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000596 temps_[1] = temp2;
597 temps_[2] = temp3;
598 }
599
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000600 LOperand* left() { return inputs_[0]; }
601 LOperand* right() { return inputs_[1]; }
602 LOperand* temp() { return temps_[0]; }
603 LOperand* temp2() { return temps_[1]; }
604 LOperand* temp3() { return temps_[2]; }
605
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000606 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
607 DECLARE_HYDROGEN_ACCESSOR(Mod)
608};
609
610
611class LDivI: public LTemplateInstruction<1, 2, 0> {
612 public:
613 LDivI(LOperand* left, LOperand* right) {
614 inputs_[0] = left;
615 inputs_[1] = right;
616 }
617
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000618 LOperand* left() { return inputs_[0]; }
619 LOperand* right() { return inputs_[1]; }
620
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000621 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
622 DECLARE_HYDROGEN_ACCESSOR(Div)
623};
624
625
626class LMulI: public LTemplateInstruction<1, 2, 1> {
627 public:
628 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
629 inputs_[0] = left;
630 inputs_[1] = right;
631 temps_[0] = temp;
632 }
633
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000634 LOperand* left() { return inputs_[0]; }
635 LOperand* right() { return inputs_[1]; }
636 LOperand* temp() { return temps_[0]; }
637
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000638 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
639 DECLARE_HYDROGEN_ACCESSOR(Mul)
640};
641
642
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000643// Instruction for computing multiplier * multiplicand + addend.
644class LMultiplyAddD: public LTemplateInstruction<1, 3, 0> {
645 public:
646 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
647 LOperand* multiplicand) {
648 inputs_[0] = addend;
649 inputs_[1] = multiplier;
650 inputs_[2] = multiplicand;
651 }
652
653 LOperand* addend() { return inputs_[0]; }
654 LOperand* multiplier() { return inputs_[1]; }
655 LOperand* multiplicand() { return inputs_[2]; }
656
657 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
658};
659
660
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000661class LCmpIDAndBranch: public LControlInstruction<2, 0> {
662 public:
663 LCmpIDAndBranch(LOperand* left, LOperand* right) {
664 inputs_[0] = left;
665 inputs_[1] = right;
666 }
667
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000668 LOperand* left() { return inputs_[0]; }
669 LOperand* right() { return inputs_[1]; }
670
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000671 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
672 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
673
674 Token::Value op() const { return hydrogen()->token(); }
675 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000676 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000677 }
678
679 virtual void PrintDataTo(StringStream* stream);
680};
681
682
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000683class LMathFloor: public LTemplateInstruction<1, 1, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000684 public:
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000685 LMathFloor(LOperand* value, LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000686 inputs_[0] = value;
687 temps_[0] = temp;
688 }
689
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000690 LOperand* value() { return inputs_[0]; }
691 LOperand* temp() { return temps_[0]; }
692
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000693 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000694 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000695};
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000696
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000697
698class LMathRound: public LTemplateInstruction<1, 1, 1> {
699 public:
700 LMathRound(LOperand* value, LOperand* temp) {
701 inputs_[0] = value;
702 temps_[0] = temp;
703 }
704
705 LOperand* value() { return inputs_[0]; }
706 LOperand* temp() { return temps_[0]; }
707
708 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
709 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
710};
711
712
713class LMathAbs: public LTemplateInstruction<1, 1, 0> {
714 public:
715 explicit LMathAbs(LOperand* value) {
716 inputs_[0] = value;
717 }
718
719 LOperand* value() { return inputs_[0]; }
720
721 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
722 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
723};
724
725
726class LMathLog: public LTemplateInstruction<1, 1, 0> {
727 public:
728 explicit LMathLog(LOperand* value) {
729 inputs_[0] = value;
730 }
731
732 LOperand* value() { return inputs_[0]; }
733
734 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
735};
736
737
738class LMathSin: public LTemplateInstruction<1, 1, 0> {
739 public:
740 explicit LMathSin(LOperand* value) {
741 inputs_[0] = value;
742 }
743
744 LOperand* value() { return inputs_[0]; }
745
746 DECLARE_CONCRETE_INSTRUCTION(MathSin, "math-sin")
747};
748
749
750class LMathCos: public LTemplateInstruction<1, 1, 0> {
751 public:
752 explicit LMathCos(LOperand* value) {
753 inputs_[0] = value;
754 }
755
756 LOperand* value() { return inputs_[0]; }
757
758 DECLARE_CONCRETE_INSTRUCTION(MathCos, "math-cos")
759};
760
761
762class LMathTan: public LTemplateInstruction<1, 1, 0> {
763 public:
764 explicit LMathTan(LOperand* value) {
765 inputs_[0] = value;
766 }
767
768 LOperand* value() { return inputs_[0]; }
769
770 DECLARE_CONCRETE_INSTRUCTION(MathTan, "math-tan")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000771};
772
773
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000774class LMathExp: public LTemplateInstruction<1, 1, 3> {
775 public:
776 LMathExp(LOperand* value,
777 LOperand* double_temp,
778 LOperand* temp1,
779 LOperand* temp2) {
780 inputs_[0] = value;
781 temps_[0] = temp1;
782 temps_[1] = temp2;
783 temps_[2] = double_temp;
784 ExternalReference::InitializeMathExpData();
785 }
786
787 LOperand* value() { return inputs_[0]; }
788 LOperand* temp1() { return temps_[0]; }
789 LOperand* temp2() { return temps_[1]; }
790 LOperand* double_temp() { return temps_[2]; }
791
792 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000793};
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000794
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000795
796class LMathSqrt: public LTemplateInstruction<1, 1, 0> {
797 public:
798 explicit LMathSqrt(LOperand* value) {
799 inputs_[0] = value;
800 }
801
802 LOperand* value() { return inputs_[0]; }
803
804 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
805};
806
807
808class LMathPowHalf: public LTemplateInstruction<1, 1, 1> {
809 public:
810 LMathPowHalf(LOperand* value, LOperand* temp) {
811 inputs_[0] = value;
812 temps_[0] = temp;
813 }
814
815 LOperand* value() { return inputs_[0]; }
816 LOperand* temp() { return temps_[0]; }
817
818 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000819};
820
821
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000822class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
823 public:
824 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
825 inputs_[0] = left;
826 inputs_[1] = right;
827 }
828
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000829 LOperand* left() { return inputs_[0]; }
830 LOperand* right() { return inputs_[1]; }
831
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000832 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
833 "cmp-object-eq-and-branch")
834 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
835};
836
837
838class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
839 public:
840 explicit LCmpConstantEqAndBranch(LOperand* left) {
841 inputs_[0] = left;
842 }
843
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000844 LOperand* left() { return inputs_[0]; }
845
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000846 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
847 "cmp-constant-eq-and-branch")
848 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
849};
850
851
852class LIsNilAndBranch: public LControlInstruction<1, 0> {
853 public:
854 explicit LIsNilAndBranch(LOperand* value) {
855 inputs_[0] = value;
856 }
857
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000858 LOperand* value() { return inputs_[0]; }
859
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000860 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
861 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
862
863 EqualityKind kind() const { return hydrogen()->kind(); }
864 NilValue nil() const { return hydrogen()->nil(); }
865
866 virtual void PrintDataTo(StringStream* stream);
867};
868
869
870class LIsObjectAndBranch: public LControlInstruction<1, 1> {
871 public:
872 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
873 inputs_[0] = value;
874 temps_[0] = temp;
875 }
876
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000877 LOperand* value() { return inputs_[0]; }
878 LOperand* temp() { return temps_[0]; }
879
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000880 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
881 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
882
883 virtual void PrintDataTo(StringStream* stream);
884};
885
886
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000887class LIsStringAndBranch: public LControlInstruction<1, 1> {
888 public:
889 LIsStringAndBranch(LOperand* value, LOperand* temp) {
890 inputs_[0] = value;
891 temps_[0] = temp;
892 }
893
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000894 LOperand* value() { return inputs_[0]; }
895 LOperand* temp() { return temps_[0]; }
896
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000897 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
898 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
899
900 virtual void PrintDataTo(StringStream* stream);
901};
902
903
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000904class LIsSmiAndBranch: public LControlInstruction<1, 0> {
905 public:
906 explicit LIsSmiAndBranch(LOperand* value) {
907 inputs_[0] = value;
908 }
909
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000910 LOperand* value() { return inputs_[0]; }
911
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000912 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
913 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
914
915 virtual void PrintDataTo(StringStream* stream);
916};
917
918
919class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
920 public:
921 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
922 inputs_[0] = value;
923 temps_[0] = temp;
924 }
925
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000926 LOperand* value() { return inputs_[0]; }
927 LOperand* temp() { return temps_[0]; }
928
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000929 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
930 "is-undetectable-and-branch")
931 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
932
933 virtual void PrintDataTo(StringStream* stream);
934};
935
936
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000937class LStringCompareAndBranch: public LControlInstruction<2, 0> {
938 public:
939 LStringCompareAndBranch(LOperand* left, LOperand* right) {
940 inputs_[0] = left;
941 inputs_[1] = right;
942 }
943
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000944 LOperand* left() { return inputs_[0]; }
945 LOperand* right() { return inputs_[1]; }
946
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000947 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
948 "string-compare-and-branch")
949 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
950
951 Token::Value op() const { return hydrogen()->token(); }
952
953 virtual void PrintDataTo(StringStream* stream);
954};
955
956
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000957class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
958 public:
959 explicit LHasInstanceTypeAndBranch(LOperand* value) {
960 inputs_[0] = value;
961 }
962
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000963 LOperand* value() { return inputs_[0]; }
964
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000965 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
966 "has-instance-type-and-branch")
967 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
968
969 virtual void PrintDataTo(StringStream* stream);
970};
971
972
973class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
974 public:
975 explicit LGetCachedArrayIndex(LOperand* value) {
976 inputs_[0] = value;
977 }
978
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000979 LOperand* value() { return inputs_[0]; }
980
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000981 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
982 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
983};
984
985
986class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
987 public:
988 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
989 inputs_[0] = value;
990 }
991
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000992 LOperand* value() { return inputs_[0]; }
993
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000994 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
995 "has-cached-array-index-and-branch")
996 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
997
998 virtual void PrintDataTo(StringStream* stream);
999};
1000
1001
1002class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
1003 public:
1004 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
1005 inputs_[0] = value;
1006 temps_[0] = temp;
1007 }
1008
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001009 LOperand* value() { return inputs_[0]; }
1010 LOperand* temp() { return temps_[0]; }
1011
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001012 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1013 "class-of-test-and-branch")
1014 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1015
1016 virtual void PrintDataTo(StringStream* stream);
1017};
1018
1019
1020class LCmpT: public LTemplateInstruction<1, 2, 0> {
1021 public:
1022 LCmpT(LOperand* left, LOperand* right) {
1023 inputs_[0] = left;
1024 inputs_[1] = right;
1025 }
1026
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001027 LOperand* left() { return inputs_[0]; }
1028 LOperand* right() { return inputs_[1]; }
1029
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001030 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1031 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1032
1033 Token::Value op() const { return hydrogen()->token(); }
1034};
1035
1036
1037class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
1038 public:
1039 LInstanceOf(LOperand* left, LOperand* right) {
1040 inputs_[0] = left;
1041 inputs_[1] = right;
1042 }
1043
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001044 LOperand* left() { return inputs_[0]; }
1045 LOperand* right() { return inputs_[1]; }
1046
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001047 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1048};
1049
1050
1051class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
1052 public:
1053 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
1054 inputs_[0] = value;
1055 temps_[0] = temp;
1056 }
1057
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001058 LOperand* value() { return inputs_[0]; }
1059 LOperand* temp() { return temps_[0]; }
1060
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001061 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1062 "instance-of-known-global")
1063 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1064
1065 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +00001066 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
1067 return lazy_deopt_env_;
1068 }
1069 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
1070 lazy_deopt_env_ = env;
1071 }
1072
1073 private:
1074 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001075};
1076
1077
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +00001078class LInstanceSize: public LTemplateInstruction<1, 1, 0> {
1079 public:
1080 explicit LInstanceSize(LOperand* object) {
1081 inputs_[0] = object;
1082 }
1083
1084 LOperand* object() { return inputs_[0]; }
1085
1086 DECLARE_CONCRETE_INSTRUCTION(InstanceSize, "instance-size")
1087 DECLARE_HYDROGEN_ACCESSOR(InstanceSize)
1088};
1089
1090
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001091class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
1092 public:
1093 LBoundsCheck(LOperand* index, LOperand* length) {
1094 inputs_[0] = index;
1095 inputs_[1] = length;
1096 }
1097
1098 LOperand* index() { return inputs_[0]; }
1099 LOperand* length() { return inputs_[1]; }
1100
1101 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +00001102 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001103};
1104
1105
1106class LBitI: public LTemplateInstruction<1, 2, 0> {
1107 public:
1108 LBitI(LOperand* left, LOperand* right) {
1109 inputs_[0] = left;
1110 inputs_[1] = right;
1111 }
1112
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001113 LOperand* left() { return inputs_[0]; }
1114 LOperand* right() { return inputs_[1]; }
1115
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001116 Token::Value op() const { return hydrogen()->op(); }
1117
1118 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1119 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1120};
1121
1122
1123class LShiftI: public LTemplateInstruction<1, 2, 0> {
1124 public:
1125 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1126 : op_(op), can_deopt_(can_deopt) {
1127 inputs_[0] = left;
1128 inputs_[1] = right;
1129 }
1130
1131 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001132 LOperand* left() { return inputs_[0]; }
1133 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001134 bool can_deopt() const { return can_deopt_; }
1135
1136 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1137
1138 private:
1139 Token::Value op_;
1140 bool can_deopt_;
1141};
1142
1143
1144class LSubI: public LTemplateInstruction<1, 2, 0> {
1145 public:
1146 LSubI(LOperand* left, LOperand* right) {
1147 inputs_[0] = left;
1148 inputs_[1] = right;
1149 }
1150
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001151 LOperand* left() { return inputs_[0]; }
1152 LOperand* right() { return inputs_[1]; }
1153
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001154 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1155 DECLARE_HYDROGEN_ACCESSOR(Sub)
1156};
1157
1158
1159class LConstantI: public LTemplateInstruction<1, 0, 0> {
1160 public:
1161 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1162 DECLARE_HYDROGEN_ACCESSOR(Constant)
1163
1164 int32_t value() const { return hydrogen()->Integer32Value(); }
1165};
1166
1167
1168class LConstantD: public LTemplateInstruction<1, 0, 0> {
1169 public:
1170 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1171 DECLARE_HYDROGEN_ACCESSOR(Constant)
1172
1173 double value() const { return hydrogen()->DoubleValue(); }
1174};
1175
1176
1177class LConstantT: public LTemplateInstruction<1, 0, 0> {
1178 public:
1179 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1180 DECLARE_HYDROGEN_ACCESSOR(Constant)
1181
1182 Handle<Object> value() const { return hydrogen()->handle(); }
1183};
1184
1185
1186class LBranch: public LControlInstruction<1, 0> {
1187 public:
1188 explicit LBranch(LOperand* value) {
1189 inputs_[0] = value;
1190 }
1191
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001192 LOperand* value() { return inputs_[0]; }
1193
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001194 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1195 DECLARE_HYDROGEN_ACCESSOR(Branch)
1196
1197 virtual void PrintDataTo(StringStream* stream);
1198};
1199
1200
1201class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1202 public:
1203 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1204 inputs_[0] = value;
1205 temps_[0] = temp;
1206 }
1207
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001208 LOperand* value() { return inputs_[0]; }
1209 LOperand* temp() { return temps_[0]; }
1210
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001211 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1212 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1213
1214 virtual bool IsControl() const { return true; }
1215
1216 Handle<Map> map() const { return hydrogen()->map(); }
1217 int true_block_id() const {
1218 return hydrogen()->FirstSuccessor()->block_id();
1219 }
1220 int false_block_id() const {
1221 return hydrogen()->SecondSuccessor()->block_id();
1222 }
1223};
1224
1225
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001226class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1227 public:
1228 explicit LFixedArrayBaseLength(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.orgc3b37122011-11-07 10:14:12 +00001234 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1235 "fixed-array-base-length")
1236 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1237};
1238
1239
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001240class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1241 public:
1242 explicit LMapEnumLength(LOperand* value) {
1243 inputs_[0] = value;
1244 }
1245
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001246 LOperand* value() { return inputs_[0]; }
1247
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001248 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1249};
1250
1251
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001252class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1253 public:
1254 explicit LElementsKind(LOperand* value) {
1255 inputs_[0] = value;
1256 }
1257
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001258 LOperand* value() { return inputs_[0]; }
1259
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001260 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1261 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1262};
1263
1264
1265class LValueOf: public LTemplateInstruction<1, 1, 1> {
1266 public:
1267 LValueOf(LOperand* value, LOperand* temp) {
1268 inputs_[0] = value;
1269 temps_[0] = temp;
1270 }
1271
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001272 LOperand* value() { return inputs_[0]; }
1273 LOperand* temp() { return temps_[0]; }
1274
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001275 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1276 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1277};
1278
1279
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001280class LDateField: public LTemplateInstruction<1, 1, 1> {
1281 public:
1282 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1283 inputs_[0] = date;
1284 temps_[0] = temp;
1285 }
1286
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001287 LOperand* date() { return inputs_[0]; }
1288 LOperand* temp() { return temps_[0]; }
1289 Smi* index() const { return index_; }
1290
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001291 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1292 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001293
1294 private:
1295 Smi* index_;
1296};
1297
1298
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +00001299class LSeqStringSetChar: public LTemplateInstruction<1, 3, 0> {
1300 public:
1301 LSeqStringSetChar(String::Encoding encoding,
1302 LOperand* string,
1303 LOperand* index,
1304 LOperand* value) : encoding_(encoding) {
1305 inputs_[0] = string;
1306 inputs_[1] = index;
1307 inputs_[2] = value;
1308 }
1309
1310 String::Encoding encoding() { return encoding_; }
1311 LOperand* string() { return inputs_[0]; }
1312 LOperand* index() { return inputs_[1]; }
1313 LOperand* value() { return inputs_[2]; }
1314
1315 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1316 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1317
1318 private:
1319 String::Encoding encoding_;
1320};
1321
1322
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001323class LThrow: public LTemplateInstruction<0, 1, 0> {
1324 public:
1325 explicit LThrow(LOperand* value) {
1326 inputs_[0] = value;
1327 }
1328
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001329 LOperand* value() { return inputs_[0]; }
1330
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001331 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1332};
1333
1334
1335class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1336 public:
1337 explicit LBitNotI(LOperand* value) {
1338 inputs_[0] = value;
1339 }
1340
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001341 LOperand* value() { return inputs_[0]; }
1342
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001343 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1344};
1345
1346
1347class LAddI: public LTemplateInstruction<1, 2, 0> {
1348 public:
1349 LAddI(LOperand* left, LOperand* right) {
1350 inputs_[0] = left;
1351 inputs_[1] = right;
1352 }
1353
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001354 LOperand* left() { return inputs_[0]; }
1355 LOperand* right() { return inputs_[1]; }
1356
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001357 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1358 DECLARE_HYDROGEN_ACCESSOR(Add)
1359};
1360
1361
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001362class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1363 public:
1364 LMathMinMax(LOperand* left, LOperand* right) {
1365 inputs_[0] = left;
1366 inputs_[1] = right;
1367 }
1368
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001369 LOperand* left() { return inputs_[0]; }
1370 LOperand* right() { return inputs_[1]; }
1371
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00001372 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001373 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1374};
1375
1376
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001377class LPower: public LTemplateInstruction<1, 2, 0> {
1378 public:
1379 LPower(LOperand* left, LOperand* right) {
1380 inputs_[0] = left;
1381 inputs_[1] = right;
1382 }
1383
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001384 LOperand* left() { return inputs_[0]; }
1385 LOperand* right() { return inputs_[1]; }
1386
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001387 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1388 DECLARE_HYDROGEN_ACCESSOR(Power)
1389};
1390
1391
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001392class LRandom: public LTemplateInstruction<1, 1, 0> {
1393 public:
1394 explicit LRandom(LOperand* global_object) {
1395 inputs_[0] = global_object;
1396 }
1397
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001398 LOperand* global_object() { return inputs_[0]; }
1399
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001400 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1401 DECLARE_HYDROGEN_ACCESSOR(Random)
1402};
1403
1404
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001405class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1406 public:
1407 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1408 : op_(op) {
1409 inputs_[0] = left;
1410 inputs_[1] = right;
1411 }
1412
1413 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001414 LOperand* left() { return inputs_[0]; }
1415 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001416
1417 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1418 virtual void CompileToNative(LCodeGen* generator);
1419 virtual const char* Mnemonic() const;
1420
1421 private:
1422 Token::Value op_;
1423};
1424
1425
1426class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1427 public:
1428 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1429 : op_(op) {
1430 inputs_[0] = left;
1431 inputs_[1] = right;
1432 }
1433
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001434 LOperand* left() { return inputs_[0]; }
1435 LOperand* right() { return inputs_[1]; }
1436 Token::Value op() const { return op_; }
1437
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001438 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1439 virtual void CompileToNative(LCodeGen* generator);
1440 virtual const char* Mnemonic() const;
1441
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001442 private:
1443 Token::Value op_;
1444};
1445
1446
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001447class LReturn: public LTemplateInstruction<0, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001448 public:
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001449 explicit LReturn(LOperand* value, LOperand* parameter_count) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001450 inputs_[0] = value;
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001451 inputs_[1] = parameter_count;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001452 }
1453
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001454 LOperand* value() { return inputs_[0]; }
1455
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001456 bool has_constant_parameter_count() {
1457 return parameter_count()->IsConstantOperand();
1458 }
1459 LConstantOperand* constant_parameter_count() {
1460 ASSERT(has_constant_parameter_count());
1461 return LConstantOperand::cast(parameter_count());
1462 }
1463 LOperand* parameter_count() { return inputs_[1]; }
1464
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001465 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1466};
1467
1468
1469class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1470 public:
1471 explicit LLoadNamedField(LOperand* object) {
1472 inputs_[0] = object;
1473 }
1474
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001475 LOperand* object() { return inputs_[0]; }
1476
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001477 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1478 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1479};
1480
1481
1482class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1483 public:
1484 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1485 inputs_[0] = object;
1486 }
1487
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001488 LOperand* object() { return inputs_[0]; }
1489
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001490 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1491 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001492};
1493
1494
1495class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1496 public:
1497 explicit LLoadNamedGeneric(LOperand* object) {
1498 inputs_[0] = object;
1499 }
1500
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001501 LOperand* object() { return inputs_[0]; }
1502
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001503 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1504 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1505
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001506 Handle<Object> name() const { return hydrogen()->name(); }
1507};
1508
1509
1510class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1511 public:
1512 explicit LLoadFunctionPrototype(LOperand* function) {
1513 inputs_[0] = function;
1514 }
1515
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001516 LOperand* function() { return inputs_[0]; }
1517
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001518 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1519 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001520};
1521
1522
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001523class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1524 public:
1525 explicit LLoadExternalArrayPointer(LOperand* object) {
1526 inputs_[0] = object;
1527 }
1528
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001529 LOperand* object() { return inputs_[0]; }
1530
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001531 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1532 "load-external-array-pointer")
1533};
1534
1535
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001536class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001537 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001538 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001539 inputs_[0] = elements;
1540 inputs_[1] = key;
1541 }
1542
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001543 LOperand* elements() { return inputs_[0]; }
1544 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001545 ElementsKind elements_kind() const {
1546 return hydrogen()->elements_kind();
1547 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001548 bool is_external() const {
1549 return hydrogen()->is_external();
1550 }
1551
1552 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1553 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1554
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001555 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001556 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001557};
1558
1559
1560class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1561 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001562 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1563 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001564 inputs_[1] = key;
1565 }
1566
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001567 LOperand* object() { return inputs_[0]; }
1568 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001569
1570 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001571};
1572
1573
1574class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1575 public:
1576 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1577 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1578};
1579
1580
1581class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1582 public:
1583 explicit LLoadGlobalGeneric(LOperand* global_object) {
1584 inputs_[0] = global_object;
1585 }
1586
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001587 LOperand* global_object() { return inputs_[0]; }
1588
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001589 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1590 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1591
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001592 Handle<Object> name() const { return hydrogen()->name(); }
1593 bool for_typeof() const { return hydrogen()->for_typeof(); }
1594};
1595
1596
1597class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1598 public:
1599 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1600 inputs_[0] = value;
1601 temps_[0] = temp;
1602 }
1603
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001604 LOperand* value() { return inputs_[0]; }
1605 LOperand* temp() { return temps_[0]; }
1606
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001607 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1608 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1609};
1610
1611
1612class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1613 public:
1614 explicit LStoreGlobalGeneric(LOperand* global_object,
1615 LOperand* value) {
1616 inputs_[0] = global_object;
1617 inputs_[1] = value;
1618 }
1619
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001620 LOperand* global_object() { return inputs_[0]; }
1621 LOperand* value() { return inputs_[1]; }
1622
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001623 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1624 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1625
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001626 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001627 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001628};
1629
1630
1631class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1632 public:
1633 explicit LLoadContextSlot(LOperand* context) {
1634 inputs_[0] = context;
1635 }
1636
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001637 LOperand* context() { return inputs_[0]; }
1638
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001639 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1640 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1641
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001642 int slot_index() { return hydrogen()->slot_index(); }
1643
1644 virtual void PrintDataTo(StringStream* stream);
1645};
1646
1647
1648class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1649 public:
1650 LStoreContextSlot(LOperand* context, LOperand* value) {
1651 inputs_[0] = context;
1652 inputs_[1] = value;
1653 }
1654
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001655 LOperand* context() { return inputs_[0]; }
1656 LOperand* value() { return inputs_[1]; }
1657
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001658 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1659 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1660
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001661 int slot_index() { return hydrogen()->slot_index(); }
1662
1663 virtual void PrintDataTo(StringStream* stream);
1664};
1665
1666
1667class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1668 public:
1669 explicit LPushArgument(LOperand* value) {
1670 inputs_[0] = value;
1671 }
1672
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001673 LOperand* value() { return inputs_[0]; }
1674
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001675 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1676};
1677
1678
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001679class LDrop: public LTemplateInstruction<0, 0, 0> {
1680 public:
1681 explicit LDrop(int count) : count_(count) { }
1682
1683 int count() const { return count_; }
1684
1685 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1686
1687 private:
1688 int count_;
1689};
1690
1691
jkummerow@chromium.org4c54a2a2013-03-19 17:51:30 +00001692class LInnerAllocatedObject: public LTemplateInstruction<1, 1, 0> {
1693 public:
1694 explicit LInnerAllocatedObject(LOperand* base_object) {
1695 inputs_[0] = base_object;
1696 }
1697
1698 LOperand* base_object() { return inputs_[0]; }
1699 int offset() { return hydrogen()->offset(); }
1700
1701 virtual void PrintDataTo(StringStream* stream);
1702
1703 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "sub-allocated-object")
1704 DECLARE_HYDROGEN_ACCESSOR(InnerAllocatedObject)
1705};
1706
1707
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001708class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1709 public:
1710 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1711 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1712};
1713
1714
1715class LContext: public LTemplateInstruction<1, 0, 0> {
1716 public:
1717 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001718 DECLARE_HYDROGEN_ACCESSOR(Context)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001719};
1720
1721
1722class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1723 public:
1724 explicit LOuterContext(LOperand* context) {
1725 inputs_[0] = context;
1726 }
1727
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001728 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001729
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001730 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001731};
1732
1733
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001734class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1735 public:
1736 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1737 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1738};
1739
1740
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001741class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1742 public:
1743 explicit LGlobalObject(LOperand* context) {
1744 inputs_[0] = context;
1745 }
1746
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001747 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001748
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001749 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001750};
1751
1752
1753class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1754 public:
1755 explicit LGlobalReceiver(LOperand* global_object) {
1756 inputs_[0] = global_object;
1757 }
1758
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001759 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001760
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001761 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001762};
1763
1764
1765class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1766 public:
1767 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1768 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1769
1770 virtual void PrintDataTo(StringStream* stream);
1771
1772 Handle<JSFunction> function() { return hydrogen()->function(); }
1773 int arity() const { return hydrogen()->argument_count() - 1; }
1774};
1775
1776
1777class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1778 public:
1779 explicit LInvokeFunction(LOperand* function) {
1780 inputs_[0] = function;
1781 }
1782
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001783 LOperand* function() { return inputs_[0]; }
1784
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001785 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1786 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1787
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001788 virtual void PrintDataTo(StringStream* stream);
1789
1790 int arity() const { return hydrogen()->argument_count() - 1; }
1791};
1792
1793
1794class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1795 public:
1796 explicit LCallKeyed(LOperand* key) {
1797 inputs_[0] = key;
1798 }
1799
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001800 LOperand* key() { return inputs_[0]; }
1801
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001802 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1803 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1804
1805 virtual void PrintDataTo(StringStream* stream);
1806
1807 int arity() const { return hydrogen()->argument_count() - 1; }
1808};
1809
1810
1811
1812class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1813 public:
1814 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1815 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1816
1817 virtual void PrintDataTo(StringStream* stream);
1818
1819 Handle<String> name() const { return hydrogen()->name(); }
1820 int arity() const { return hydrogen()->argument_count() - 1; }
1821};
1822
1823
danno@chromium.orgc612e022011-11-10 11:38:15 +00001824class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001825 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001826 explicit LCallFunction(LOperand* function) {
1827 inputs_[0] = function;
1828 }
1829
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001830 LOperand* function() { return inputs_[0]; }
1831
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001832 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1833 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1834
danno@chromium.orgc612e022011-11-10 11:38:15 +00001835 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001836};
1837
1838
1839class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1840 public:
1841 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1842 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1843
1844 virtual void PrintDataTo(StringStream* stream);
1845
1846 Handle<String> name() const {return hydrogen()->name(); }
1847 int arity() const { return hydrogen()->argument_count() - 1; }
1848};
1849
1850
1851class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1852 public:
1853 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1854 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1855
1856 virtual void PrintDataTo(StringStream* stream);
1857
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001858 int arity() const { return hydrogen()->argument_count() - 1; }
1859};
1860
1861
1862class LCallNew: public LTemplateInstruction<1, 1, 0> {
1863 public:
1864 explicit LCallNew(LOperand* constructor) {
1865 inputs_[0] = constructor;
1866 }
1867
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001868 LOperand* constructor() { return inputs_[0]; }
1869
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001870 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1871 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1872
1873 virtual void PrintDataTo(StringStream* stream);
1874
1875 int arity() const { return hydrogen()->argument_count() - 1; }
1876};
1877
1878
ulan@chromium.org750145a2013-03-07 15:14:13 +00001879class LCallNewArray: public LTemplateInstruction<1, 1, 0> {
1880 public:
1881 explicit LCallNewArray(LOperand* constructor) {
1882 inputs_[0] = constructor;
1883 }
1884
1885 LOperand* constructor() { return inputs_[0]; }
1886
1887 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1888 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1889
1890 virtual void PrintDataTo(StringStream* stream);
1891
1892 int arity() const { return hydrogen()->argument_count() - 1; }
1893};
1894
1895
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001896class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1897 public:
1898 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1899 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1900
1901 const Runtime::Function* function() const { return hydrogen()->function(); }
1902 int arity() const { return hydrogen()->argument_count(); }
1903};
1904
1905
1906class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1907 public:
1908 explicit LInteger32ToDouble(LOperand* value) {
1909 inputs_[0] = value;
1910 }
1911
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001912 LOperand* value() { return inputs_[0]; }
1913
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001914 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1915};
1916
1917
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001918class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1919 public:
1920 explicit LUint32ToDouble(LOperand* value) {
1921 inputs_[0] = value;
1922 }
1923
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001924 LOperand* value() { return inputs_[0]; }
1925
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001926 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1927};
1928
1929
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001930class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1931 public:
1932 explicit LNumberTagI(LOperand* value) {
1933 inputs_[0] = value;
1934 }
1935
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001936 LOperand* value() { return inputs_[0]; }
1937
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001938 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1939};
1940
1941
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001942class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1943 public:
1944 explicit LNumberTagU(LOperand* value) {
1945 inputs_[0] = value;
1946 }
1947
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001948 LOperand* value() { return inputs_[0]; }
1949
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001950 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1951};
1952
1953
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001954class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1955 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001956 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001957 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001958 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001959 temps_[1] = temp2;
1960 }
1961
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001962 LOperand* value() { return inputs_[0]; }
1963 LOperand* temp() { return temps_[0]; }
1964 LOperand* temp2() { return temps_[1]; }
1965
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001966 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001967 DECLARE_HYDROGEN_ACCESSOR(Change)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001968};
1969
1970
1971// Sometimes truncating conversion from a tagged value to an int32.
1972class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1973 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001974 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001975 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001976 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001977 temps_[1] = temp2;
1978 }
1979
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001980 LOperand* value() { return inputs_[0]; }
1981 LOperand* temp() { return temps_[0]; }
1982 LOperand* temp2() { return temps_[1]; }
1983
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001984 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1985 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1986
1987 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1988};
1989
1990
1991// Truncating conversion from a tagged value to an int32.
1992class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1993 public:
1994 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001995 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001996 LOperand* temp2,
1997 LOperand* temp3) {
1998 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001999 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002000 temps_[1] = temp2;
2001 temps_[2] = temp3;
2002 }
2003
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002004 LOperand* value() { return inputs_[0]; }
2005 LOperand* temp() { return temps_[0]; }
2006 LOperand* temp2() { return temps_[1]; }
2007 LOperand* temp3() { return temps_[2]; }
2008
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002009 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
2010 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2011
2012 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2013};
2014
2015
2016class LSmiTag: public LTemplateInstruction<1, 1, 0> {
2017 public:
2018 explicit LSmiTag(LOperand* value) {
2019 inputs_[0] = value;
2020 }
2021
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002022 LOperand* value() { return inputs_[0]; }
2023
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002024 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2025};
2026
2027
2028class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
2029 public:
2030 explicit LNumberUntagD(LOperand* value) {
2031 inputs_[0] = value;
2032 }
2033
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002034 LOperand* value() { return inputs_[0]; }
2035
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002036 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2037 DECLARE_HYDROGEN_ACCESSOR(Change)
2038};
2039
2040
2041class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
2042 public:
2043 LSmiUntag(LOperand* value, bool needs_check)
2044 : needs_check_(needs_check) {
2045 inputs_[0] = value;
2046 }
2047
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002048 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002049 bool needs_check() const { return needs_check_; }
2050
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002051 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2052
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002053 private:
2054 bool needs_check_;
2055};
2056
2057
verwaest@chromium.org37141392012-05-31 13:27:02 +00002058class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002059 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002060 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2061 inputs_[0] = object;
2062 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00002063 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002064 }
2065
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002066 LOperand* object() { return inputs_[0]; }
2067 LOperand* value() { return inputs_[1]; }
2068 LOperand* temp() { return temps_[0]; }
2069
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002070 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2071 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2072
2073 virtual void PrintDataTo(StringStream* stream);
2074
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002075 Handle<Object> name() const { return hydrogen()->name(); }
2076 bool is_in_object() { return hydrogen()->is_in_object(); }
2077 int offset() { return hydrogen()->offset(); }
2078 Handle<Map> transition() const { return hydrogen()->transition(); }
danno@chromium.orgf005df62013-04-30 16:36:45 +00002079 Representation representation() const {
2080 return hydrogen()->field_representation();
2081 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002082};
2083
2084
2085class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
2086 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002087 LStoreNamedGeneric(LOperand* object, LOperand* value) {
2088 inputs_[0] = object;
2089 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002090 }
2091
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002092 LOperand* object() { return inputs_[0]; }
2093 LOperand* value() { return inputs_[1]; }
2094
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002095 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2096 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2097
2098 virtual void PrintDataTo(StringStream* stream);
2099
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002100 Handle<Object> name() const { return hydrogen()->name(); }
2101 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002102};
2103
2104
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002105class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002106 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002107 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002108 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002109 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002110 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002111 }
2112
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002113 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002114 LOperand* elements() { return inputs_[0]; }
2115 LOperand* key() { return inputs_[1]; }
2116 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002117 ElementsKind elements_kind() const {
2118 return hydrogen()->elements_kind();
2119 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002120
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002121 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2122 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002123
2124 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00002125 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002126 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002127};
2128
2129
2130class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
2131 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002132 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002133 inputs_[0] = obj;
2134 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002135 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002136 }
2137
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002138 LOperand* object() { return inputs_[0]; }
2139 LOperand* key() { return inputs_[1]; }
2140 LOperand* value() { return inputs_[2]; }
2141
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002142 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2143 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2144
2145 virtual void PrintDataTo(StringStream* stream);
2146
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00002147 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002148};
2149
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002150
mstarzinger@chromium.orgf705b502013-04-04 11:38:09 +00002151class LTransitionElementsKind: public LTemplateInstruction<0, 1, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002152 public:
2153 LTransitionElementsKind(LOperand* object,
2154 LOperand* new_map_temp,
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002155 LOperand* fixed_object_temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002156 inputs_[0] = object;
2157 temps_[0] = new_map_temp;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002158 temps_[1] = fixed_object_temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002159 }
2160
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002161 LOperand* object() { return inputs_[0]; }
2162 LOperand* new_map_temp() { return temps_[0]; }
2163 LOperand* temp() { return temps_[1]; }
2164
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002165 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2166 "transition-elements-kind")
2167 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2168
2169 virtual void PrintDataTo(StringStream* stream);
2170
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002171 Handle<Map> original_map() { return hydrogen()->original_map(); }
2172 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002173 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2174 ElementsKind to_kind() { return hydrogen()->to_kind(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002175};
2176
2177
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002178class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> {
2179 public:
2180 LTrapAllocationMemento(LOperand* object,
2181 LOperand* temp) {
2182 inputs_[0] = object;
2183 temps_[0] = temp;
2184 }
2185
2186 LOperand* object() { return inputs_[0]; }
2187 LOperand* temp() { return temps_[0]; }
2188
2189 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2190 "trap-allocation-memento")
2191};
2192
2193
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002194class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2195 public:
2196 LStringAdd(LOperand* left, LOperand* right) {
2197 inputs_[0] = left;
2198 inputs_[1] = right;
2199 }
2200
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002201 LOperand* left() { return inputs_[0]; }
2202 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002203
2204 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2205 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002206};
2207
2208
2209
2210class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2211 public:
2212 LStringCharCodeAt(LOperand* string, LOperand* index) {
2213 inputs_[0] = string;
2214 inputs_[1] = index;
2215 }
2216
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002217 LOperand* string() { return inputs_[0]; }
2218 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002219
2220 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2221 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002222};
2223
2224
2225class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2226 public:
2227 explicit LStringCharFromCode(LOperand* char_code) {
2228 inputs_[0] = char_code;
2229 }
2230
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002231 LOperand* char_code() { return inputs_[0]; }
2232
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002233 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2234 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002235};
2236
2237
2238class LStringLength: public LTemplateInstruction<1, 1, 0> {
2239 public:
2240 explicit LStringLength(LOperand* string) {
2241 inputs_[0] = string;
2242 }
2243
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002244 LOperand* string() { return inputs_[0]; }
2245
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002246 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2247 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002248};
2249
2250
2251class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2252 public:
2253 explicit LCheckFunction(LOperand* value) {
2254 inputs_[0] = value;
2255 }
2256
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002257 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002258
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002259 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2260 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2261};
2262
2263
2264class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2265 public:
2266 explicit LCheckInstanceType(LOperand* value) {
2267 inputs_[0] = value;
2268 }
2269
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002270 LOperand* value() { return inputs_[0]; }
2271
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002272 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2273 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2274};
2275
2276
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002277class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002278 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002279 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002280 inputs_[0] = value;
2281 }
2282
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002283 LOperand* value() { return inputs_[0]; }
2284
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002285 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2286 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002287};
2288
2289
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002290class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002291 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002292 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2293 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002294 temps_[1] = temp2;
2295 }
2296
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002297 LOperand* temp() { return temps_[0]; }
2298 LOperand* temp2() { return temps_[1]; }
2299
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002300 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2301 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2302
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002303 ZoneList<Handle<JSObject> >* prototypes() const {
2304 return hydrogen()->prototypes();
2305 }
2306 ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002307};
2308
2309
2310class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2311 public:
2312 explicit LCheckSmi(LOperand* value) {
2313 inputs_[0] = value;
2314 }
2315
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002316 LOperand* value() { return inputs_[0]; }
2317
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002318 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2319};
2320
2321
2322class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2323 public:
2324 explicit LCheckNonSmi(LOperand* value) {
2325 inputs_[0] = value;
2326 }
2327
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002328 LOperand* value() { return inputs_[0]; }
2329
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002330 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2331};
2332
2333
2334class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2335 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002336 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2337 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002338 temps_[0] = temp;
2339 }
2340
2341 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002342 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002343
2344 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2345};
2346
2347
2348class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2349 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002350 explicit LClampIToUint8(LOperand* unclamped) {
2351 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002352 }
2353
2354 LOperand* unclamped() { return inputs_[0]; }
2355
2356 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2357};
2358
2359
2360class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2361 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002362 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2363 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002364 temps_[0] = temp;
2365 }
2366
2367 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002368 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002369
2370 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2371};
2372
2373
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002374class LAllocateObject: public LTemplateInstruction<1, 1, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002375 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002376 LAllocateObject(LOperand* temp, LOperand* temp2) {
2377 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002378 temps_[1] = temp2;
2379 }
2380
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002381 LOperand* temp() { return temps_[0]; }
2382 LOperand* temp2() { return temps_[1]; }
2383
ulan@chromium.org967e2702012-02-28 09:49:15 +00002384 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2385 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2386};
2387
2388
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002389class LAllocate: public LTemplateInstruction<1, 2, 2> {
2390 public:
2391 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2392 inputs_[1] = size;
2393 temps_[0] = temp1;
2394 temps_[1] = temp2;
2395 }
2396
2397 LOperand* size() { return inputs_[1]; }
2398 LOperand* temp1() { return temps_[0]; }
2399 LOperand* temp2() { return temps_[1]; }
2400
2401 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2402 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2403};
2404
2405
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002406class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2407 public:
2408 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2409 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2410};
2411
2412
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002413class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002414 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002415 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2416 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002417};
2418
2419
2420class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2421 public:
2422 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2423 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2424};
2425
2426
2427class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2428 public:
2429 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2430 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002431};
2432
2433
2434class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2435 public:
2436 explicit LToFastProperties(LOperand* value) {
2437 inputs_[0] = value;
2438 }
2439
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002440 LOperand* value() { return inputs_[0]; }
2441
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002442 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2443 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2444};
2445
2446
2447class LTypeof: public LTemplateInstruction<1, 1, 0> {
2448 public:
2449 explicit LTypeof(LOperand* value) {
2450 inputs_[0] = value;
2451 }
2452
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002453 LOperand* value() { return inputs_[0]; }
2454
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002455 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2456};
2457
2458
2459class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2460 public:
2461 explicit LTypeofIsAndBranch(LOperand* value) {
2462 inputs_[0] = value;
2463 }
2464
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002465 LOperand* value() { return inputs_[0]; }
2466
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002467 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2468 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2469
2470 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2471
2472 virtual void PrintDataTo(StringStream* stream);
2473};
2474
2475
2476class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2477 public:
2478 explicit LIsConstructCallAndBranch(LOperand* temp) {
2479 temps_[0] = temp;
2480 }
2481
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002482 LOperand* temp() { return temps_[0]; }
2483
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002484 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2485 "is-construct-call-and-branch")
2486};
2487
2488
2489class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2490 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002491 LDeleteProperty(LOperand* object, LOperand* key) {
2492 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002493 inputs_[1] = key;
2494 }
2495
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002496 LOperand* object() { return inputs_[0]; }
2497 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002498
2499 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002500};
2501
2502
2503class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2504 public:
2505 LOsrEntry();
2506
ulan@chromium.org32d7dba2013-04-24 10:59:06 +00002507 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002508 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2509
2510 LOperand** SpilledRegisterArray() { return register_spills_; }
2511 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2512
2513 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2514 void MarkSpilledDoubleRegister(int allocation_index,
2515 LOperand* spill_operand);
2516
2517 private:
2518 // Arrays of spill slot operands for registers with an assigned spill
2519 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2520 // NULL if the register has no assigned spill slot. Indexed by allocation
2521 // index.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002522 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters];
2523 LOperand* double_register_spills_[
2524 DoubleRegister::kMaxNumAllocatableRegisters];
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002525};
2526
2527
2528class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2529 public:
2530 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2531 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2532
2533 Label* done_label() { return &done_label_; }
2534
2535 private:
2536 Label done_label_;
2537};
2538
2539
2540class LIn: public LTemplateInstruction<1, 2, 0> {
2541 public:
2542 LIn(LOperand* key, LOperand* object) {
2543 inputs_[0] = key;
2544 inputs_[1] = object;
2545 }
2546
2547 LOperand* key() { return inputs_[0]; }
2548 LOperand* object() { return inputs_[1]; }
2549
2550 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2551};
2552
2553
ulan@chromium.org812308e2012-02-29 15:58:45 +00002554class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2555 public:
2556 explicit LForInPrepareMap(LOperand* object) {
2557 inputs_[0] = object;
2558 }
2559
2560 LOperand* object() { return inputs_[0]; }
2561
2562 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2563};
2564
2565
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002566class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002567 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002568 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002569 inputs_[0] = map;
2570 }
2571
2572 LOperand* map() { return inputs_[0]; }
2573
2574 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2575
2576 int idx() {
2577 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2578 }
2579};
2580
2581
2582class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2583 public:
2584 LCheckMapValue(LOperand* value, LOperand* map) {
2585 inputs_[0] = value;
2586 inputs_[1] = map;
2587 }
2588
2589 LOperand* value() { return inputs_[0]; }
2590 LOperand* map() { return inputs_[1]; }
2591
2592 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2593};
2594
2595
2596class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2597 public:
2598 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2599 inputs_[0] = object;
2600 inputs_[1] = index;
2601 }
2602
2603 LOperand* object() { return inputs_[0]; }
2604 LOperand* index() { return inputs_[1]; }
2605
2606 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2607};
2608
2609
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002610class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002611class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002612 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002613 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2614 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002615
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002616 int GetNextSpillIndex(bool is_double);
2617 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002618};
2619
2620
2621class LChunkBuilder BASE_EMBEDDED {
2622 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002623 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2624 : chunk_(NULL),
2625 info_(info),
2626 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002627 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002628 status_(UNUSED),
2629 current_instruction_(NULL),
2630 current_block_(NULL),
2631 next_block_(NULL),
2632 argument_count_(0),
2633 allocator_(allocator),
2634 position_(RelocInfo::kNoPosition),
2635 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002636 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002637
2638 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002639 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002640
2641 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002642#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002643 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2644#undef DECLARE_DO
2645
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002646 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2647
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002648 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2649 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2650 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2651 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2652 LInstruction* DoMathSin(HUnaryMathOperation* instr);
2653 LInstruction* DoMathCos(HUnaryMathOperation* instr);
2654 LInstruction* DoMathTan(HUnaryMathOperation* instr);
2655 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2656 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2657 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2658
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002659 private:
2660 enum Status {
2661 UNUSED,
2662 BUILDING,
2663 DONE,
2664 ABORTED
2665 };
2666
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002667 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002668 CompilationInfo* info() const { return info_; }
2669 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002670 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002671
2672 bool is_unused() const { return status_ == UNUSED; }
2673 bool is_building() const { return status_ == BUILDING; }
2674 bool is_done() const { return status_ == DONE; }
2675 bool is_aborted() const { return status_ == ABORTED; }
2676
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002677 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002678
2679 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002680 LUnallocated* ToUnallocated(Register reg);
2681 LUnallocated* ToUnallocated(DoubleRegister reg);
2682
2683 // Methods for setting up define-use relationships.
2684 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2685 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2686 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2687 DoubleRegister fixed_register);
2688
2689 // A value that is guaranteed to be allocated to a register.
2690 // Operand created by UseRegister is guaranteed to be live until the end of
2691 // instruction. This means that register allocator will not reuse it's
2692 // register for any other operand inside instruction.
2693 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2694 // instruction start. Register allocator is free to assign the same register
2695 // to some other operand used inside instruction (i.e. temporary or
2696 // output).
2697 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2698 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2699
2700 // An input operand in a register that may be trashed.
2701 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2702
2703 // An input operand in a register or stack slot.
2704 MUST_USE_RESULT LOperand* Use(HValue* value);
2705 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2706
2707 // An input operand in a register, stack slot or a constant operand.
2708 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2709 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2710
2711 // An input operand in a register or a constant operand.
2712 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2713 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2714
danno@chromium.orgf005df62013-04-30 16:36:45 +00002715 // An input operand in a constant operand.
2716 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2717
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002718 // An input operand in register, stack slot or a constant operand.
2719 // Will not be moved to a register even if one is freely available.
2720 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2721
2722 // Temporary operand that must be in a register.
2723 MUST_USE_RESULT LUnallocated* TempRegister();
2724 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2725 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2726
2727 // Methods for setting up define-use relationships.
2728 // Return the same instruction that they are passed.
2729 template<int I, int T>
2730 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2731 LUnallocated* result);
2732 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002733 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2734 template<int I, int T>
2735 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2736 int index);
2737 template<int I, int T>
2738 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2739 template<int I, int T>
2740 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2741 Register reg);
2742 template<int I, int T>
2743 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2744 DoubleRegister reg);
2745 LInstruction* AssignEnvironment(LInstruction* instr);
2746 LInstruction* AssignPointerMap(LInstruction* instr);
2747
2748 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2749
2750 // By default we assume that instruction sequences generated for calls
2751 // cannot deoptimize eagerly and we do not attach environment to this
2752 // instruction.
2753 LInstruction* MarkAsCall(
2754 LInstruction* instr,
2755 HInstruction* hinstr,
2756 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002757
2758 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2759 int* argument_index_accumulator);
2760
2761 void VisitInstruction(HInstruction* current);
2762
2763 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2764 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2765 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2766 LInstruction* DoArithmeticD(Token::Value op,
2767 HArithmeticBinaryOperation* instr);
2768 LInstruction* DoArithmeticT(Token::Value op,
2769 HArithmeticBinaryOperation* instr);
2770
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002771 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002772 CompilationInfo* info_;
2773 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002774 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002775 Status status_;
2776 HInstruction* current_instruction_;
2777 HBasicBlock* current_block_;
2778 HBasicBlock* next_block_;
2779 int argument_count_;
2780 LAllocator* allocator_;
2781 int position_;
2782 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002783 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002784
lrn@chromium.org7516f052011-03-30 08:52:27 +00002785 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2786};
2787
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002788#undef DECLARE_HYDROGEN_ACCESSOR
2789#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002790
2791} } // namespace v8::internal
2792
2793#endif // V8_MIPS_LITHIUM_MIPS_H_