blob: b0fc59a3b242d3ce5f70831d6f969dda54ae4004 [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) \
125 V(LoadElements) \
126 V(LoadExternalArrayPointer) \
127 V(LoadFunctionPrototype) \
128 V(LoadGlobalCell) \
129 V(LoadGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000130 V(LoadKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000131 V(LoadKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000132 V(LoadNamedField) \
133 V(LoadNamedFieldPolymorphic) \
134 V(LoadNamedGeneric) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000135 V(MapEnumLength) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000136 V(MathAbs) \
137 V(MathCos) \
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000138 V(MathExp) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000139 V(MathFloor) \
140 V(MathLog) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000141 V(MathMinMax) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000142 V(MathPowHalf) \
143 V(MathRound) \
144 V(MathSin) \
145 V(MathSqrt) \
146 V(MathTan) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000147 V(ModI) \
148 V(MulI) \
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000149 V(MultiplyAddD) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000150 V(NumberTagD) \
151 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000152 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000153 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000154 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000155 V(OsrEntry) \
156 V(OuterContext) \
157 V(Parameter) \
158 V(Power) \
159 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000160 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000161 V(RegExpLiteral) \
162 V(Return) \
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000163 V(SeqStringSetChar) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000164 V(ShiftI) \
165 V(SmiTag) \
166 V(SmiUntag) \
167 V(StackCheck) \
168 V(StoreContextSlot) \
169 V(StoreGlobalCell) \
170 V(StoreGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000171 V(StoreKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000172 V(StoreKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000173 V(StoreNamedField) \
174 V(StoreNamedGeneric) \
175 V(StringAdd) \
176 V(StringCharCodeAt) \
177 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000178 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000179 V(StringLength) \
180 V(SubI) \
181 V(TaggedToI) \
182 V(ThisFunction) \
183 V(Throw) \
184 V(ToFastProperties) \
185 V(TransitionElementsKind) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000186 V(TrapAllocationMemento) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000187 V(Typeof) \
188 V(TypeofIsAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000189 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000190 V(ValueOf) \
191 V(ForInPrepareMap) \
192 V(ForInCacheArray) \
193 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000194 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000195 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000196 V(WrapReceiver) \
jkummerow@chromium.org4c54a2a2013-03-19 17:51:30 +0000197 V(Drop) \
198 V(InnerAllocatedObject)
199
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000200
201#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
202 virtual Opcode opcode() const { return LInstruction::k##type; } \
203 virtual void CompileToNative(LCodeGen* generator); \
204 virtual const char* Mnemonic() const { return mnemonic; } \
205 static L##type* cast(LInstruction* instr) { \
206 ASSERT(instr->Is##type()); \
207 return reinterpret_cast<L##type*>(instr); \
208 }
209
210
211#define DECLARE_HYDROGEN_ACCESSOR(type) \
212 H##type* hydrogen() const { \
213 return H##type::cast(hydrogen_value()); \
214 }
215
lrn@chromium.org7516f052011-03-30 08:52:27 +0000216
217class LInstruction: public ZoneObject {
218 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000219 LInstruction()
220 : environment_(NULL),
221 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000222 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000223 virtual ~LInstruction() { }
224
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000225 virtual void CompileToNative(LCodeGen* generator) = 0;
226 virtual const char* Mnemonic() const = 0;
227 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000228 virtual void PrintDataTo(StringStream* stream);
229 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000230
231 enum Opcode {
232 // Declare a unique enum value for each instruction.
233#define DECLARE_OPCODE(type) k##type,
234 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
235 kNumberOfInstructions
236#undef DECLARE_OPCODE
237 };
238
239 virtual Opcode opcode() const = 0;
240
241 // Declare non-virtual type testers for all leaf IR classes.
242#define DECLARE_PREDICATE(type) \
243 bool Is##type() const { return opcode() == k##type; }
244 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
245#undef DECLARE_PREDICATE
246
247 // Declare virtual predicates for instructions that don't have
248 // an opcode.
249 virtual bool IsGap() const { return false; }
250
251 virtual bool IsControl() const { return false; }
252
253 void set_environment(LEnvironment* env) { environment_ = env; }
254 LEnvironment* environment() const { return environment_; }
255 bool HasEnvironment() const { return environment_ != NULL; }
256
257 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
258 LPointerMap* pointer_map() const { return pointer_map_.get(); }
259 bool HasPointerMap() const { return pointer_map_.is_set(); }
260
261 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
262 HValue* hydrogen_value() const { return hydrogen_value_; }
263
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000264 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000265
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000266 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000267
268 // Interface to the register allocator and iterators.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000269 bool ClobbersTemps() const { return is_call_; }
270 bool ClobbersRegisters() const { return is_call_; }
271 bool ClobbersDoubleRegisters() const { return is_call_; }
272
273 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000274 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000275
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000276 virtual bool HasResult() const = 0;
277 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000278
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000279 LOperand* FirstInput() { return InputAt(0); }
280 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000281
282#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000283 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000284#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000285
286 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000287 // Iterator interface.
288 friend class InputIterator;
289 virtual int InputCount() = 0;
290 virtual LOperand* InputAt(int i) = 0;
291
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000292 friend class TempIterator;
293 virtual int TempCount() = 0;
294 virtual LOperand* TempAt(int i) = 0;
295
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000296 LEnvironment* environment_;
297 SetOncePointer<LPointerMap> pointer_map_;
298 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000299 bool is_call_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000300};
301
302
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000303// R = number of result operands (0 or 1).
304// I = number of input operands.
305// T = number of temporary operands.
306template<int R, int I, int T>
307class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000308 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000309 // Allow 0 or 1 output operands.
310 STATIC_ASSERT(R == 0 || R == 1);
311 virtual bool HasResult() const { return R != 0; }
312 void set_result(LOperand* operand) { results_[0] = operand; }
313 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000314
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000315 protected:
316 EmbeddedContainer<LOperand*, R> results_;
317 EmbeddedContainer<LOperand*, I> inputs_;
318 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000319
320 private:
321 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000322 virtual LOperand* InputAt(int i) { return inputs_[i]; }
323
324 virtual int TempCount() { return T; }
325 virtual LOperand* TempAt(int i) { return temps_[i]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000326};
327
328
329class LGap: public LTemplateInstruction<0, 0, 0> {
330 public:
331 explicit LGap(HBasicBlock* block)
332 : block_(block) {
333 parallel_moves_[BEFORE] = NULL;
334 parallel_moves_[START] = NULL;
335 parallel_moves_[END] = NULL;
336 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000337 }
338
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000339 // Can't use the DECLARE-macro here because of sub-classes.
340 virtual bool IsGap() const { return true; }
341 virtual void PrintDataTo(StringStream* stream);
342 static LGap* cast(LInstruction* instr) {
343 ASSERT(instr->IsGap());
344 return reinterpret_cast<LGap*>(instr);
345 }
346
347 bool IsRedundant() const;
348
349 HBasicBlock* block() const { return block_; }
350
lrn@chromium.org7516f052011-03-30 08:52:27 +0000351 enum InnerPosition {
352 BEFORE,
353 START,
354 END,
355 AFTER,
356 FIRST_INNER_POSITION = BEFORE,
357 LAST_INNER_POSITION = AFTER
358 };
359
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000360 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
361 if (parallel_moves_[pos] == NULL) {
362 parallel_moves_[pos] = new(zone) LParallelMove(zone);
363 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000364 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000365 }
366
367 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000368 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000369 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000370
371 private:
372 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
373 HBasicBlock* block_;
374};
375
376
377class LInstructionGap: public LGap {
378 public:
379 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
380
381 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
382};
383
384
385class LGoto: public LTemplateInstruction<0, 0, 0> {
386 public:
387 explicit LGoto(int block_id) : block_id_(block_id) { }
388
389 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
390 virtual void PrintDataTo(StringStream* stream);
391 virtual bool IsControl() const { return true; }
392
393 int block_id() const { return block_id_; }
394
395 private:
396 int block_id_;
397};
398
399
400class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
401 public:
402 LLazyBailout() : gap_instructions_size_(0) { }
403
404 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
405
406 void set_gap_instructions_size(int gap_instructions_size) {
407 gap_instructions_size_ = gap_instructions_size;
408 }
409 int gap_instructions_size() { return gap_instructions_size_; }
410
411 private:
412 int gap_instructions_size_;
413};
414
415
yangguo@chromium.org46a2a512013-01-18 16:29:40 +0000416class LDummyUse: public LTemplateInstruction<1, 1, 0> {
417 public:
418 explicit LDummyUse(LOperand* value) {
419 inputs_[0] = value;
420 }
421 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
422};
423
424
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000425class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
426 public:
427 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000428};
429
430
431class LLabel: public LGap {
432 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000433 explicit LLabel(HBasicBlock* block)
434 : LGap(block), replacement_(NULL) { }
435
436 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
437
438 virtual void PrintDataTo(StringStream* stream);
439
440 int block_id() const { return block()->block_id(); }
441 bool is_loop_header() const { return block()->IsLoopHeader(); }
442 Label* label() { return &label_; }
443 LLabel* replacement() const { return replacement_; }
444 void set_replacement(LLabel* label) { replacement_ = label; }
445 bool HasReplacement() const { return replacement_ != NULL; }
446
447 private:
448 Label label_;
449 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000450};
451
452
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000453class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000454 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000455 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
456};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000457
lrn@chromium.org7516f052011-03-30 08:52:27 +0000458
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000459class LCallStub: public LTemplateInstruction<1, 0, 0> {
460 public:
461 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
462 DECLARE_HYDROGEN_ACCESSOR(CallStub)
463
464 TranscendentalCache::Type transcendental_type() {
465 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000466 }
467};
468
469
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000470class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
471 public:
472 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
473};
474
475
476template<int I, int T>
477class LControlInstruction: public LTemplateInstruction<0, I, T> {
478 public:
479 virtual bool IsControl() const { return true; }
480
481 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
482 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
483 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
484 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
485
486 private:
487 HControlInstruction* hydrogen() {
488 return HControlInstruction::cast(this->hydrogen_value());
489 }
490};
491
492
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000493class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
494 public:
495 LWrapReceiver(LOperand* receiver, LOperand* function) {
496 inputs_[0] = receiver;
497 inputs_[1] = function;
498 }
499
500 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
501
502 LOperand* receiver() { return inputs_[0]; }
503 LOperand* function() { return inputs_[1]; }
504};
505
506
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000507class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
508 public:
509 LApplyArguments(LOperand* function,
510 LOperand* receiver,
511 LOperand* length,
512 LOperand* elements) {
513 inputs_[0] = function;
514 inputs_[1] = receiver;
515 inputs_[2] = length;
516 inputs_[3] = elements;
517 }
518
519 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
520
521 LOperand* function() { return inputs_[0]; }
522 LOperand* receiver() { return inputs_[1]; }
523 LOperand* length() { return inputs_[2]; }
524 LOperand* elements() { return inputs_[3]; }
525};
526
527
528class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
529 public:
530 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
531 inputs_[0] = arguments;
532 inputs_[1] = length;
533 inputs_[2] = index;
534 }
535
536 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
537
538 LOperand* arguments() { return inputs_[0]; }
539 LOperand* length() { return inputs_[1]; }
540 LOperand* index() { return inputs_[2]; }
541
542 virtual void PrintDataTo(StringStream* stream);
543};
544
545
546class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
547 public:
548 explicit LArgumentsLength(LOperand* elements) {
549 inputs_[0] = elements;
550 }
551
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000552 LOperand* elements() { return inputs_[0]; }
553
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000554 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
555};
556
557
558class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
559 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000560 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000561 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000562};
563
564
565class LModI: public LTemplateInstruction<1, 2, 3> {
566 public:
567 // Used when the right hand is a constant power of 2.
568 LModI(LOperand* left,
569 LOperand* right) {
570 inputs_[0] = left;
571 inputs_[1] = right;
572 temps_[0] = NULL;
573 temps_[1] = NULL;
574 temps_[2] = NULL;
575 }
576
577 // Used for the standard case.
578 LModI(LOperand* left,
579 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000580 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000581 LOperand* temp2,
582 LOperand* temp3) {
583 inputs_[0] = left;
584 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000585 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000586 temps_[1] = temp2;
587 temps_[2] = temp3;
588 }
589
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000590 LOperand* left() { return inputs_[0]; }
591 LOperand* right() { return inputs_[1]; }
592 LOperand* temp() { return temps_[0]; }
593 LOperand* temp2() { return temps_[1]; }
594 LOperand* temp3() { return temps_[2]; }
595
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000596 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
597 DECLARE_HYDROGEN_ACCESSOR(Mod)
598};
599
600
601class LDivI: public LTemplateInstruction<1, 2, 0> {
602 public:
603 LDivI(LOperand* left, LOperand* right) {
604 inputs_[0] = left;
605 inputs_[1] = right;
606 }
607
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000608 LOperand* left() { return inputs_[0]; }
609 LOperand* right() { return inputs_[1]; }
610
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000611 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
612 DECLARE_HYDROGEN_ACCESSOR(Div)
613};
614
615
616class LMulI: public LTemplateInstruction<1, 2, 1> {
617 public:
618 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
619 inputs_[0] = left;
620 inputs_[1] = right;
621 temps_[0] = temp;
622 }
623
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000624 LOperand* left() { return inputs_[0]; }
625 LOperand* right() { return inputs_[1]; }
626 LOperand* temp() { return temps_[0]; }
627
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000628 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
629 DECLARE_HYDROGEN_ACCESSOR(Mul)
630};
631
632
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000633// Instruction for computing multiplier * multiplicand + addend.
634class LMultiplyAddD: public LTemplateInstruction<1, 3, 0> {
635 public:
636 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
637 LOperand* multiplicand) {
638 inputs_[0] = addend;
639 inputs_[1] = multiplier;
640 inputs_[2] = multiplicand;
641 }
642
643 LOperand* addend() { return inputs_[0]; }
644 LOperand* multiplier() { return inputs_[1]; }
645 LOperand* multiplicand() { return inputs_[2]; }
646
647 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
648};
649
650
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000651class LCmpIDAndBranch: public LControlInstruction<2, 0> {
652 public:
653 LCmpIDAndBranch(LOperand* left, LOperand* right) {
654 inputs_[0] = left;
655 inputs_[1] = right;
656 }
657
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000658 LOperand* left() { return inputs_[0]; }
659 LOperand* right() { return inputs_[1]; }
660
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000661 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
662 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
663
664 Token::Value op() const { return hydrogen()->token(); }
665 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000666 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000667 }
668
669 virtual void PrintDataTo(StringStream* stream);
670};
671
672
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000673class LMathFloor: public LTemplateInstruction<1, 1, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000674 public:
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000675 LMathFloor(LOperand* value, LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000676 inputs_[0] = value;
677 temps_[0] = temp;
678 }
679
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000680 LOperand* value() { return inputs_[0]; }
681 LOperand* temp() { return temps_[0]; }
682
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000683 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000684 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000685};
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000686
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000687
688class LMathRound: public LTemplateInstruction<1, 1, 1> {
689 public:
690 LMathRound(LOperand* value, LOperand* temp) {
691 inputs_[0] = value;
692 temps_[0] = temp;
693 }
694
695 LOperand* value() { return inputs_[0]; }
696 LOperand* temp() { return temps_[0]; }
697
698 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
699 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
700};
701
702
703class LMathAbs: public LTemplateInstruction<1, 1, 0> {
704 public:
705 explicit LMathAbs(LOperand* value) {
706 inputs_[0] = value;
707 }
708
709 LOperand* value() { return inputs_[0]; }
710
711 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
712 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
713};
714
715
716class LMathLog: public LTemplateInstruction<1, 1, 0> {
717 public:
718 explicit LMathLog(LOperand* value) {
719 inputs_[0] = value;
720 }
721
722 LOperand* value() { return inputs_[0]; }
723
724 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
725};
726
727
728class LMathSin: public LTemplateInstruction<1, 1, 0> {
729 public:
730 explicit LMathSin(LOperand* value) {
731 inputs_[0] = value;
732 }
733
734 LOperand* value() { return inputs_[0]; }
735
736 DECLARE_CONCRETE_INSTRUCTION(MathSin, "math-sin")
737};
738
739
740class LMathCos: public LTemplateInstruction<1, 1, 0> {
741 public:
742 explicit LMathCos(LOperand* value) {
743 inputs_[0] = value;
744 }
745
746 LOperand* value() { return inputs_[0]; }
747
748 DECLARE_CONCRETE_INSTRUCTION(MathCos, "math-cos")
749};
750
751
752class LMathTan: public LTemplateInstruction<1, 1, 0> {
753 public:
754 explicit LMathTan(LOperand* value) {
755 inputs_[0] = value;
756 }
757
758 LOperand* value() { return inputs_[0]; }
759
760 DECLARE_CONCRETE_INSTRUCTION(MathTan, "math-tan")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000761};
762
763
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000764class LMathExp: public LTemplateInstruction<1, 1, 3> {
765 public:
766 LMathExp(LOperand* value,
767 LOperand* double_temp,
768 LOperand* temp1,
769 LOperand* temp2) {
770 inputs_[0] = value;
771 temps_[0] = temp1;
772 temps_[1] = temp2;
773 temps_[2] = double_temp;
774 ExternalReference::InitializeMathExpData();
775 }
776
777 LOperand* value() { return inputs_[0]; }
778 LOperand* temp1() { return temps_[0]; }
779 LOperand* temp2() { return temps_[1]; }
780 LOperand* double_temp() { return temps_[2]; }
781
782 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000783};
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000784
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000785
786class LMathSqrt: public LTemplateInstruction<1, 1, 0> {
787 public:
788 explicit LMathSqrt(LOperand* value) {
789 inputs_[0] = value;
790 }
791
792 LOperand* value() { return inputs_[0]; }
793
794 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
795};
796
797
798class LMathPowHalf: public LTemplateInstruction<1, 1, 1> {
799 public:
800 LMathPowHalf(LOperand* value, LOperand* temp) {
801 inputs_[0] = value;
802 temps_[0] = temp;
803 }
804
805 LOperand* value() { return inputs_[0]; }
806 LOperand* temp() { return temps_[0]; }
807
808 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000809};
810
811
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000812class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
813 public:
814 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
815 inputs_[0] = left;
816 inputs_[1] = right;
817 }
818
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000819 LOperand* left() { return inputs_[0]; }
820 LOperand* right() { return inputs_[1]; }
821
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000822 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
823 "cmp-object-eq-and-branch")
824 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
825};
826
827
828class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
829 public:
830 explicit LCmpConstantEqAndBranch(LOperand* left) {
831 inputs_[0] = left;
832 }
833
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000834 LOperand* left() { return inputs_[0]; }
835
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000836 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
837 "cmp-constant-eq-and-branch")
838 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
839};
840
841
842class LIsNilAndBranch: public LControlInstruction<1, 0> {
843 public:
844 explicit LIsNilAndBranch(LOperand* value) {
845 inputs_[0] = value;
846 }
847
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000848 LOperand* value() { return inputs_[0]; }
849
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000850 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
851 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
852
853 EqualityKind kind() const { return hydrogen()->kind(); }
854 NilValue nil() const { return hydrogen()->nil(); }
855
856 virtual void PrintDataTo(StringStream* stream);
857};
858
859
860class LIsObjectAndBranch: public LControlInstruction<1, 1> {
861 public:
862 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
863 inputs_[0] = value;
864 temps_[0] = temp;
865 }
866
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000867 LOperand* value() { return inputs_[0]; }
868 LOperand* temp() { return temps_[0]; }
869
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000870 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
871 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
872
873 virtual void PrintDataTo(StringStream* stream);
874};
875
876
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000877class LIsStringAndBranch: public LControlInstruction<1, 1> {
878 public:
879 LIsStringAndBranch(LOperand* value, LOperand* temp) {
880 inputs_[0] = value;
881 temps_[0] = temp;
882 }
883
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000884 LOperand* value() { return inputs_[0]; }
885 LOperand* temp() { return temps_[0]; }
886
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000887 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
888 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
889
890 virtual void PrintDataTo(StringStream* stream);
891};
892
893
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000894class LIsSmiAndBranch: public LControlInstruction<1, 0> {
895 public:
896 explicit LIsSmiAndBranch(LOperand* value) {
897 inputs_[0] = value;
898 }
899
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000900 LOperand* value() { return inputs_[0]; }
901
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000902 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
903 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
904
905 virtual void PrintDataTo(StringStream* stream);
906};
907
908
909class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
910 public:
911 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
912 inputs_[0] = value;
913 temps_[0] = temp;
914 }
915
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000916 LOperand* value() { return inputs_[0]; }
917 LOperand* temp() { return temps_[0]; }
918
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000919 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
920 "is-undetectable-and-branch")
921 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
922
923 virtual void PrintDataTo(StringStream* stream);
924};
925
926
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000927class LStringCompareAndBranch: public LControlInstruction<2, 0> {
928 public:
929 LStringCompareAndBranch(LOperand* left, LOperand* right) {
930 inputs_[0] = left;
931 inputs_[1] = right;
932 }
933
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000934 LOperand* left() { return inputs_[0]; }
935 LOperand* right() { return inputs_[1]; }
936
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000937 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
938 "string-compare-and-branch")
939 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
940
941 Token::Value op() const { return hydrogen()->token(); }
942
943 virtual void PrintDataTo(StringStream* stream);
944};
945
946
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000947class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
948 public:
949 explicit LHasInstanceTypeAndBranch(LOperand* value) {
950 inputs_[0] = value;
951 }
952
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000953 LOperand* value() { return inputs_[0]; }
954
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000955 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
956 "has-instance-type-and-branch")
957 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
958
959 virtual void PrintDataTo(StringStream* stream);
960};
961
962
963class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
964 public:
965 explicit LGetCachedArrayIndex(LOperand* value) {
966 inputs_[0] = value;
967 }
968
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000969 LOperand* value() { return inputs_[0]; }
970
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000971 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
972 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
973};
974
975
976class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
977 public:
978 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
979 inputs_[0] = value;
980 }
981
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000982 LOperand* value() { return inputs_[0]; }
983
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000984 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
985 "has-cached-array-index-and-branch")
986 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
987
988 virtual void PrintDataTo(StringStream* stream);
989};
990
991
992class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
993 public:
994 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
995 inputs_[0] = value;
996 temps_[0] = temp;
997 }
998
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000999 LOperand* value() { return inputs_[0]; }
1000 LOperand* temp() { return temps_[0]; }
1001
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001002 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1003 "class-of-test-and-branch")
1004 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1005
1006 virtual void PrintDataTo(StringStream* stream);
1007};
1008
1009
1010class LCmpT: public LTemplateInstruction<1, 2, 0> {
1011 public:
1012 LCmpT(LOperand* left, LOperand* right) {
1013 inputs_[0] = left;
1014 inputs_[1] = right;
1015 }
1016
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001017 LOperand* left() { return inputs_[0]; }
1018 LOperand* right() { return inputs_[1]; }
1019
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001020 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1021 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1022
1023 Token::Value op() const { return hydrogen()->token(); }
1024};
1025
1026
1027class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
1028 public:
1029 LInstanceOf(LOperand* left, LOperand* right) {
1030 inputs_[0] = left;
1031 inputs_[1] = right;
1032 }
1033
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001034 LOperand* left() { return inputs_[0]; }
1035 LOperand* right() { return inputs_[1]; }
1036
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001037 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1038};
1039
1040
1041class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
1042 public:
1043 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
1044 inputs_[0] = value;
1045 temps_[0] = temp;
1046 }
1047
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001048 LOperand* value() { return inputs_[0]; }
1049 LOperand* temp() { return temps_[0]; }
1050
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001051 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1052 "instance-of-known-global")
1053 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1054
1055 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +00001056 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
1057 return lazy_deopt_env_;
1058 }
1059 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
1060 lazy_deopt_env_ = env;
1061 }
1062
1063 private:
1064 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001065};
1066
1067
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +00001068class LInstanceSize: public LTemplateInstruction<1, 1, 0> {
1069 public:
1070 explicit LInstanceSize(LOperand* object) {
1071 inputs_[0] = object;
1072 }
1073
1074 LOperand* object() { return inputs_[0]; }
1075
1076 DECLARE_CONCRETE_INSTRUCTION(InstanceSize, "instance-size")
1077 DECLARE_HYDROGEN_ACCESSOR(InstanceSize)
1078};
1079
1080
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001081class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
1082 public:
1083 LBoundsCheck(LOperand* index, LOperand* length) {
1084 inputs_[0] = index;
1085 inputs_[1] = length;
1086 }
1087
1088 LOperand* index() { return inputs_[0]; }
1089 LOperand* length() { return inputs_[1]; }
1090
1091 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +00001092 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001093};
1094
1095
1096class LBitI: public LTemplateInstruction<1, 2, 0> {
1097 public:
1098 LBitI(LOperand* left, LOperand* right) {
1099 inputs_[0] = left;
1100 inputs_[1] = right;
1101 }
1102
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001103 LOperand* left() { return inputs_[0]; }
1104 LOperand* right() { return inputs_[1]; }
1105
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001106 Token::Value op() const { return hydrogen()->op(); }
1107
1108 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1109 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1110};
1111
1112
1113class LShiftI: public LTemplateInstruction<1, 2, 0> {
1114 public:
1115 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1116 : op_(op), can_deopt_(can_deopt) {
1117 inputs_[0] = left;
1118 inputs_[1] = right;
1119 }
1120
1121 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001122 LOperand* left() { return inputs_[0]; }
1123 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001124 bool can_deopt() const { return can_deopt_; }
1125
1126 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1127
1128 private:
1129 Token::Value op_;
1130 bool can_deopt_;
1131};
1132
1133
1134class LSubI: public LTemplateInstruction<1, 2, 0> {
1135 public:
1136 LSubI(LOperand* left, LOperand* right) {
1137 inputs_[0] = left;
1138 inputs_[1] = right;
1139 }
1140
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001141 LOperand* left() { return inputs_[0]; }
1142 LOperand* right() { return inputs_[1]; }
1143
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001144 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1145 DECLARE_HYDROGEN_ACCESSOR(Sub)
1146};
1147
1148
1149class LConstantI: public LTemplateInstruction<1, 0, 0> {
1150 public:
1151 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1152 DECLARE_HYDROGEN_ACCESSOR(Constant)
1153
1154 int32_t value() const { return hydrogen()->Integer32Value(); }
1155};
1156
1157
1158class LConstantD: public LTemplateInstruction<1, 0, 0> {
1159 public:
1160 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1161 DECLARE_HYDROGEN_ACCESSOR(Constant)
1162
1163 double value() const { return hydrogen()->DoubleValue(); }
1164};
1165
1166
1167class LConstantT: public LTemplateInstruction<1, 0, 0> {
1168 public:
1169 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1170 DECLARE_HYDROGEN_ACCESSOR(Constant)
1171
1172 Handle<Object> value() const { return hydrogen()->handle(); }
1173};
1174
1175
1176class LBranch: public LControlInstruction<1, 0> {
1177 public:
1178 explicit LBranch(LOperand* value) {
1179 inputs_[0] = value;
1180 }
1181
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001182 LOperand* value() { return inputs_[0]; }
1183
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001184 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1185 DECLARE_HYDROGEN_ACCESSOR(Branch)
1186
1187 virtual void PrintDataTo(StringStream* stream);
1188};
1189
1190
1191class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1192 public:
1193 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1194 inputs_[0] = value;
1195 temps_[0] = temp;
1196 }
1197
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001198 LOperand* value() { return inputs_[0]; }
1199 LOperand* temp() { return temps_[0]; }
1200
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001201 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1202 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1203
1204 virtual bool IsControl() const { return true; }
1205
1206 Handle<Map> map() const { return hydrogen()->map(); }
1207 int true_block_id() const {
1208 return hydrogen()->FirstSuccessor()->block_id();
1209 }
1210 int false_block_id() const {
1211 return hydrogen()->SecondSuccessor()->block_id();
1212 }
1213};
1214
1215
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001216class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1217 public:
1218 explicit LFixedArrayBaseLength(LOperand* value) {
1219 inputs_[0] = value;
1220 }
1221
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001222 LOperand* value() { return inputs_[0]; }
1223
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001224 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1225 "fixed-array-base-length")
1226 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1227};
1228
1229
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001230class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1231 public:
1232 explicit LMapEnumLength(LOperand* value) {
1233 inputs_[0] = value;
1234 }
1235
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001236 LOperand* value() { return inputs_[0]; }
1237
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001238 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1239};
1240
1241
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001242class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1243 public:
1244 explicit LElementsKind(LOperand* value) {
1245 inputs_[0] = value;
1246 }
1247
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001248 LOperand* value() { return inputs_[0]; }
1249
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001250 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1251 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1252};
1253
1254
1255class LValueOf: public LTemplateInstruction<1, 1, 1> {
1256 public:
1257 LValueOf(LOperand* value, LOperand* temp) {
1258 inputs_[0] = value;
1259 temps_[0] = temp;
1260 }
1261
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001262 LOperand* value() { return inputs_[0]; }
1263 LOperand* temp() { return temps_[0]; }
1264
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001265 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1266 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1267};
1268
1269
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001270class LDateField: public LTemplateInstruction<1, 1, 1> {
1271 public:
1272 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1273 inputs_[0] = date;
1274 temps_[0] = temp;
1275 }
1276
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001277 LOperand* date() { return inputs_[0]; }
1278 LOperand* temp() { return temps_[0]; }
1279 Smi* index() const { return index_; }
1280
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001281 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1282 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001283
1284 private:
1285 Smi* index_;
1286};
1287
1288
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +00001289class LSeqStringSetChar: public LTemplateInstruction<1, 3, 0> {
1290 public:
1291 LSeqStringSetChar(String::Encoding encoding,
1292 LOperand* string,
1293 LOperand* index,
1294 LOperand* value) : encoding_(encoding) {
1295 inputs_[0] = string;
1296 inputs_[1] = index;
1297 inputs_[2] = value;
1298 }
1299
1300 String::Encoding encoding() { return encoding_; }
1301 LOperand* string() { return inputs_[0]; }
1302 LOperand* index() { return inputs_[1]; }
1303 LOperand* value() { return inputs_[2]; }
1304
1305 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1306 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1307
1308 private:
1309 String::Encoding encoding_;
1310};
1311
1312
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001313class LThrow: public LTemplateInstruction<0, 1, 0> {
1314 public:
1315 explicit LThrow(LOperand* value) {
1316 inputs_[0] = value;
1317 }
1318
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001319 LOperand* value() { return inputs_[0]; }
1320
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001321 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1322};
1323
1324
1325class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1326 public:
1327 explicit LBitNotI(LOperand* value) {
1328 inputs_[0] = value;
1329 }
1330
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001331 LOperand* value() { return inputs_[0]; }
1332
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001333 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1334};
1335
1336
1337class LAddI: public LTemplateInstruction<1, 2, 0> {
1338 public:
1339 LAddI(LOperand* left, LOperand* right) {
1340 inputs_[0] = left;
1341 inputs_[1] = right;
1342 }
1343
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001344 LOperand* left() { return inputs_[0]; }
1345 LOperand* right() { return inputs_[1]; }
1346
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001347 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1348 DECLARE_HYDROGEN_ACCESSOR(Add)
1349};
1350
1351
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001352class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1353 public:
1354 LMathMinMax(LOperand* left, LOperand* right) {
1355 inputs_[0] = left;
1356 inputs_[1] = right;
1357 }
1358
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001359 LOperand* left() { return inputs_[0]; }
1360 LOperand* right() { return inputs_[1]; }
1361
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00001362 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001363 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1364};
1365
1366
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001367class LPower: public LTemplateInstruction<1, 2, 0> {
1368 public:
1369 LPower(LOperand* left, LOperand* right) {
1370 inputs_[0] = left;
1371 inputs_[1] = right;
1372 }
1373
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001374 LOperand* left() { return inputs_[0]; }
1375 LOperand* right() { return inputs_[1]; }
1376
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001377 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1378 DECLARE_HYDROGEN_ACCESSOR(Power)
1379};
1380
1381
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001382class LRandom: public LTemplateInstruction<1, 1, 0> {
1383 public:
1384 explicit LRandom(LOperand* global_object) {
1385 inputs_[0] = global_object;
1386 }
1387
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001388 LOperand* global_object() { return inputs_[0]; }
1389
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001390 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1391 DECLARE_HYDROGEN_ACCESSOR(Random)
1392};
1393
1394
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001395class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1396 public:
1397 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1398 : op_(op) {
1399 inputs_[0] = left;
1400 inputs_[1] = right;
1401 }
1402
1403 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001404 LOperand* left() { return inputs_[0]; }
1405 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001406
1407 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1408 virtual void CompileToNative(LCodeGen* generator);
1409 virtual const char* Mnemonic() const;
1410
1411 private:
1412 Token::Value op_;
1413};
1414
1415
1416class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1417 public:
1418 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1419 : op_(op) {
1420 inputs_[0] = left;
1421 inputs_[1] = right;
1422 }
1423
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001424 LOperand* left() { return inputs_[0]; }
1425 LOperand* right() { return inputs_[1]; }
1426 Token::Value op() const { return op_; }
1427
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001428 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1429 virtual void CompileToNative(LCodeGen* generator);
1430 virtual const char* Mnemonic() const;
1431
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001432 private:
1433 Token::Value op_;
1434};
1435
1436
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001437class LReturn: public LTemplateInstruction<0, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001438 public:
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001439 explicit LReturn(LOperand* value, LOperand* parameter_count) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001440 inputs_[0] = value;
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001441 inputs_[1] = parameter_count;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001442 }
1443
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001444 LOperand* value() { return inputs_[0]; }
1445
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001446 bool has_constant_parameter_count() {
1447 return parameter_count()->IsConstantOperand();
1448 }
1449 LConstantOperand* constant_parameter_count() {
1450 ASSERT(has_constant_parameter_count());
1451 return LConstantOperand::cast(parameter_count());
1452 }
1453 LOperand* parameter_count() { return inputs_[1]; }
1454
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001455 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1456};
1457
1458
1459class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1460 public:
1461 explicit LLoadNamedField(LOperand* object) {
1462 inputs_[0] = object;
1463 }
1464
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001465 LOperand* object() { return inputs_[0]; }
1466
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001467 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1468 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1469};
1470
1471
1472class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1473 public:
1474 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1475 inputs_[0] = object;
1476 }
1477
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001478 LOperand* object() { return inputs_[0]; }
1479
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001480 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1481 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001482};
1483
1484
1485class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1486 public:
1487 explicit LLoadNamedGeneric(LOperand* object) {
1488 inputs_[0] = object;
1489 }
1490
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001491 LOperand* object() { return inputs_[0]; }
1492
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001493 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1494 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1495
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001496 Handle<Object> name() const { return hydrogen()->name(); }
1497};
1498
1499
1500class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1501 public:
1502 explicit LLoadFunctionPrototype(LOperand* function) {
1503 inputs_[0] = function;
1504 }
1505
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001506 LOperand* function() { return inputs_[0]; }
1507
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001508 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1509 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001510};
1511
1512
1513class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1514 public:
1515 explicit LLoadElements(LOperand* object) {
1516 inputs_[0] = object;
1517 }
1518
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001519 LOperand* object() { return inputs_[0]; }
1520
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001521 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1522};
1523
1524
1525class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1526 public:
1527 explicit LLoadExternalArrayPointer(LOperand* object) {
1528 inputs_[0] = object;
1529 }
1530
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001531 LOperand* object() { return inputs_[0]; }
1532
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001533 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1534 "load-external-array-pointer")
1535};
1536
1537
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001538class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001539 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001540 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001541 inputs_[0] = elements;
1542 inputs_[1] = key;
1543 }
1544
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001545 LOperand* elements() { return inputs_[0]; }
1546 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001547 ElementsKind elements_kind() const {
1548 return hydrogen()->elements_kind();
1549 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001550 bool is_external() const {
1551 return hydrogen()->is_external();
1552 }
1553
1554 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1555 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1556
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001557 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001558 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001559};
1560
1561
1562class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1563 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001564 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1565 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001566 inputs_[1] = key;
1567 }
1568
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001569 LOperand* object() { return inputs_[0]; }
1570 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001571
1572 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001573};
1574
1575
1576class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1577 public:
1578 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1579 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1580};
1581
1582
1583class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1584 public:
1585 explicit LLoadGlobalGeneric(LOperand* global_object) {
1586 inputs_[0] = global_object;
1587 }
1588
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001589 LOperand* global_object() { return inputs_[0]; }
1590
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001591 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1592 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1593
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001594 Handle<Object> name() const { return hydrogen()->name(); }
1595 bool for_typeof() const { return hydrogen()->for_typeof(); }
1596};
1597
1598
1599class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1600 public:
1601 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1602 inputs_[0] = value;
1603 temps_[0] = temp;
1604 }
1605
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001606 LOperand* value() { return inputs_[0]; }
1607 LOperand* temp() { return temps_[0]; }
1608
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001609 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1610 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1611};
1612
1613
1614class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1615 public:
1616 explicit LStoreGlobalGeneric(LOperand* global_object,
1617 LOperand* value) {
1618 inputs_[0] = global_object;
1619 inputs_[1] = value;
1620 }
1621
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001622 LOperand* global_object() { return inputs_[0]; }
1623 LOperand* value() { return inputs_[1]; }
1624
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001625 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1626 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1627
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001628 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001629 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001630};
1631
1632
1633class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1634 public:
1635 explicit LLoadContextSlot(LOperand* context) {
1636 inputs_[0] = context;
1637 }
1638
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001639 LOperand* context() { return inputs_[0]; }
1640
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001641 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1642 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1643
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001644 int slot_index() { return hydrogen()->slot_index(); }
1645
1646 virtual void PrintDataTo(StringStream* stream);
1647};
1648
1649
1650class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1651 public:
1652 LStoreContextSlot(LOperand* context, LOperand* value) {
1653 inputs_[0] = context;
1654 inputs_[1] = value;
1655 }
1656
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001657 LOperand* context() { return inputs_[0]; }
1658 LOperand* value() { return inputs_[1]; }
1659
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001660 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1661 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1662
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001663 int slot_index() { return hydrogen()->slot_index(); }
1664
1665 virtual void PrintDataTo(StringStream* stream);
1666};
1667
1668
1669class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1670 public:
1671 explicit LPushArgument(LOperand* value) {
1672 inputs_[0] = value;
1673 }
1674
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001675 LOperand* value() { return inputs_[0]; }
1676
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001677 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1678};
1679
1680
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001681class LDrop: public LTemplateInstruction<0, 0, 0> {
1682 public:
1683 explicit LDrop(int count) : count_(count) { }
1684
1685 int count() const { return count_; }
1686
1687 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1688
1689 private:
1690 int count_;
1691};
1692
1693
jkummerow@chromium.org4c54a2a2013-03-19 17:51:30 +00001694class LInnerAllocatedObject: public LTemplateInstruction<1, 1, 0> {
1695 public:
1696 explicit LInnerAllocatedObject(LOperand* base_object) {
1697 inputs_[0] = base_object;
1698 }
1699
1700 LOperand* base_object() { return inputs_[0]; }
1701 int offset() { return hydrogen()->offset(); }
1702
1703 virtual void PrintDataTo(StringStream* stream);
1704
1705 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "sub-allocated-object")
1706 DECLARE_HYDROGEN_ACCESSOR(InnerAllocatedObject)
1707};
1708
1709
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001710class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1711 public:
1712 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1713 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1714};
1715
1716
1717class LContext: public LTemplateInstruction<1, 0, 0> {
1718 public:
1719 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001720 DECLARE_HYDROGEN_ACCESSOR(Context)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001721};
1722
1723
1724class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1725 public:
1726 explicit LOuterContext(LOperand* context) {
1727 inputs_[0] = context;
1728 }
1729
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001730 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001731
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001732 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001733};
1734
1735
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001736class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1737 public:
1738 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1739 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1740};
1741
1742
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001743class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1744 public:
1745 explicit LGlobalObject(LOperand* context) {
1746 inputs_[0] = context;
1747 }
1748
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001749 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001750
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001751 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001752};
1753
1754
1755class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1756 public:
1757 explicit LGlobalReceiver(LOperand* global_object) {
1758 inputs_[0] = global_object;
1759 }
1760
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001761 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001762
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001763 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001764};
1765
1766
1767class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1768 public:
1769 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1770 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1771
1772 virtual void PrintDataTo(StringStream* stream);
1773
1774 Handle<JSFunction> function() { return hydrogen()->function(); }
1775 int arity() const { return hydrogen()->argument_count() - 1; }
1776};
1777
1778
1779class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1780 public:
1781 explicit LInvokeFunction(LOperand* function) {
1782 inputs_[0] = function;
1783 }
1784
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001785 LOperand* function() { return inputs_[0]; }
1786
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001787 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1788 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1789
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001790 virtual void PrintDataTo(StringStream* stream);
1791
1792 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001793 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001794};
1795
1796
1797class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1798 public:
1799 explicit LCallKeyed(LOperand* key) {
1800 inputs_[0] = key;
1801 }
1802
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001803 LOperand* key() { return inputs_[0]; }
1804
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001805 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1806 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1807
1808 virtual void PrintDataTo(StringStream* stream);
1809
1810 int arity() const { return hydrogen()->argument_count() - 1; }
1811};
1812
1813
1814
1815class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1816 public:
1817 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1818 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1819
1820 virtual void PrintDataTo(StringStream* stream);
1821
1822 Handle<String> name() const { return hydrogen()->name(); }
1823 int arity() const { return hydrogen()->argument_count() - 1; }
1824};
1825
1826
danno@chromium.orgc612e022011-11-10 11:38:15 +00001827class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001828 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001829 explicit LCallFunction(LOperand* function) {
1830 inputs_[0] = function;
1831 }
1832
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001833 LOperand* function() { return inputs_[0]; }
1834
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001835 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1836 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1837
danno@chromium.orgc612e022011-11-10 11:38:15 +00001838 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001839};
1840
1841
1842class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1843 public:
1844 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1845 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1846
1847 virtual void PrintDataTo(StringStream* stream);
1848
1849 Handle<String> name() const {return hydrogen()->name(); }
1850 int arity() const { return hydrogen()->argument_count() - 1; }
1851};
1852
1853
1854class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1855 public:
1856 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1857 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1858
1859 virtual void PrintDataTo(StringStream* stream);
1860
1861 Handle<JSFunction> target() const { return hydrogen()->target(); }
1862 int arity() const { return hydrogen()->argument_count() - 1; }
1863};
1864
1865
1866class LCallNew: public LTemplateInstruction<1, 1, 0> {
1867 public:
1868 explicit LCallNew(LOperand* constructor) {
1869 inputs_[0] = constructor;
1870 }
1871
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001872 LOperand* constructor() { return inputs_[0]; }
1873
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001874 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1875 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1876
1877 virtual void PrintDataTo(StringStream* stream);
1878
1879 int arity() const { return hydrogen()->argument_count() - 1; }
1880};
1881
1882
ulan@chromium.org750145a2013-03-07 15:14:13 +00001883class LCallNewArray: public LTemplateInstruction<1, 1, 0> {
1884 public:
1885 explicit LCallNewArray(LOperand* constructor) {
1886 inputs_[0] = constructor;
1887 }
1888
1889 LOperand* constructor() { return inputs_[0]; }
1890
1891 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1892 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1893
1894 virtual void PrintDataTo(StringStream* stream);
1895
1896 int arity() const { return hydrogen()->argument_count() - 1; }
1897};
1898
1899
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001900class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1901 public:
1902 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1903 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1904
1905 const Runtime::Function* function() const { return hydrogen()->function(); }
1906 int arity() const { return hydrogen()->argument_count(); }
1907};
1908
1909
1910class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1911 public:
1912 explicit LInteger32ToDouble(LOperand* value) {
1913 inputs_[0] = value;
1914 }
1915
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001916 LOperand* value() { return inputs_[0]; }
1917
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001918 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1919};
1920
1921
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001922class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1923 public:
1924 explicit LUint32ToDouble(LOperand* value) {
1925 inputs_[0] = value;
1926 }
1927
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001928 LOperand* value() { return inputs_[0]; }
1929
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001930 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1931};
1932
1933
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001934class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1935 public:
1936 explicit LNumberTagI(LOperand* value) {
1937 inputs_[0] = value;
1938 }
1939
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001940 LOperand* value() { return inputs_[0]; }
1941
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001942 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1943};
1944
1945
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001946class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1947 public:
1948 explicit LNumberTagU(LOperand* value) {
1949 inputs_[0] = value;
1950 }
1951
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001952 LOperand* value() { return inputs_[0]; }
1953
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001954 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1955};
1956
1957
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001958class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1959 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001960 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001961 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001962 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001963 temps_[1] = temp2;
1964 }
1965
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001966 LOperand* value() { return inputs_[0]; }
1967 LOperand* temp() { return temps_[0]; }
1968 LOperand* temp2() { return temps_[1]; }
1969
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001970 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001971 DECLARE_HYDROGEN_ACCESSOR(Change)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001972};
1973
1974
1975// Sometimes truncating conversion from a tagged value to an int32.
1976class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1977 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001978 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001979 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001980 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001981 temps_[1] = temp2;
1982 }
1983
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001984 LOperand* value() { return inputs_[0]; }
1985 LOperand* temp() { return temps_[0]; }
1986 LOperand* temp2() { return temps_[1]; }
1987
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001988 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1989 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1990
1991 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1992};
1993
1994
1995// Truncating conversion from a tagged value to an int32.
1996class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1997 public:
1998 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001999 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002000 LOperand* temp2,
2001 LOperand* temp3) {
2002 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002003 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002004 temps_[1] = temp2;
2005 temps_[2] = temp3;
2006 }
2007
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002008 LOperand* value() { return inputs_[0]; }
2009 LOperand* temp() { return temps_[0]; }
2010 LOperand* temp2() { return temps_[1]; }
2011 LOperand* temp3() { return temps_[2]; }
2012
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002013 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
2014 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2015
2016 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2017};
2018
2019
2020class LSmiTag: public LTemplateInstruction<1, 1, 0> {
2021 public:
2022 explicit LSmiTag(LOperand* value) {
2023 inputs_[0] = value;
2024 }
2025
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002026 LOperand* value() { return inputs_[0]; }
2027
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002028 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2029};
2030
2031
2032class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
2033 public:
2034 explicit LNumberUntagD(LOperand* value) {
2035 inputs_[0] = value;
2036 }
2037
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002038 LOperand* value() { return inputs_[0]; }
2039
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002040 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2041 DECLARE_HYDROGEN_ACCESSOR(Change)
2042};
2043
2044
2045class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
2046 public:
2047 LSmiUntag(LOperand* value, bool needs_check)
2048 : needs_check_(needs_check) {
2049 inputs_[0] = value;
2050 }
2051
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002052 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002053 bool needs_check() const { return needs_check_; }
2054
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002055 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2056
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002057 private:
2058 bool needs_check_;
2059};
2060
2061
verwaest@chromium.org37141392012-05-31 13:27:02 +00002062class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002063 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002064 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2065 inputs_[0] = object;
2066 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00002067 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002068 }
2069
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002070 LOperand* object() { return inputs_[0]; }
2071 LOperand* value() { return inputs_[1]; }
2072 LOperand* temp() { return temps_[0]; }
2073
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002074 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2075 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2076
2077 virtual void PrintDataTo(StringStream* stream);
2078
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002079 Handle<Object> name() const { return hydrogen()->name(); }
2080 bool is_in_object() { return hydrogen()->is_in_object(); }
2081 int offset() { return hydrogen()->offset(); }
2082 Handle<Map> transition() const { return hydrogen()->transition(); }
2083};
2084
2085
2086class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
2087 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002088 LStoreNamedGeneric(LOperand* object, LOperand* value) {
2089 inputs_[0] = object;
2090 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002091 }
2092
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002093 LOperand* object() { return inputs_[0]; }
2094 LOperand* value() { return inputs_[1]; }
2095
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002096 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2097 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2098
2099 virtual void PrintDataTo(StringStream* stream);
2100
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002101 Handle<Object> name() const { return hydrogen()->name(); }
2102 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002103};
2104
2105
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002106class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002107 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002108 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002109 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002110 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002111 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002112 }
2113
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002114 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002115 LOperand* elements() { return inputs_[0]; }
2116 LOperand* key() { return inputs_[1]; }
2117 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002118 ElementsKind elements_kind() const {
2119 return hydrogen()->elements_kind();
2120 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002121
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002122 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2123 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002124
2125 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00002126 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002127 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002128};
2129
2130
2131class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
2132 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002133 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002134 inputs_[0] = obj;
2135 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002136 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002137 }
2138
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002139 LOperand* object() { return inputs_[0]; }
2140 LOperand* key() { return inputs_[1]; }
2141 LOperand* value() { return inputs_[2]; }
2142
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002143 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2144 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2145
2146 virtual void PrintDataTo(StringStream* stream);
2147
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00002148 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002149};
2150
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002151
mstarzinger@chromium.orgf705b502013-04-04 11:38:09 +00002152class LTransitionElementsKind: public LTemplateInstruction<0, 1, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002153 public:
2154 LTransitionElementsKind(LOperand* object,
2155 LOperand* new_map_temp,
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002156 LOperand* fixed_object_temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002157 inputs_[0] = object;
2158 temps_[0] = new_map_temp;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002159 temps_[1] = fixed_object_temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002160 }
2161
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002162 LOperand* object() { return inputs_[0]; }
2163 LOperand* new_map_temp() { return temps_[0]; }
2164 LOperand* temp() { return temps_[1]; }
2165
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002166 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2167 "transition-elements-kind")
2168 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2169
2170 virtual void PrintDataTo(StringStream* stream);
2171
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002172 Handle<Map> original_map() { return hydrogen()->original_map(); }
2173 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002174 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2175 ElementsKind to_kind() { return hydrogen()->to_kind(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002176};
2177
2178
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002179class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> {
2180 public:
2181 LTrapAllocationMemento(LOperand* object,
2182 LOperand* temp) {
2183 inputs_[0] = object;
2184 temps_[0] = temp;
2185 }
2186
2187 LOperand* object() { return inputs_[0]; }
2188 LOperand* temp() { return temps_[0]; }
2189
2190 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2191 "trap-allocation-memento")
2192};
2193
2194
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002195class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2196 public:
2197 LStringAdd(LOperand* left, LOperand* right) {
2198 inputs_[0] = left;
2199 inputs_[1] = right;
2200 }
2201
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002202 LOperand* left() { return inputs_[0]; }
2203 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002204
2205 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2206 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002207};
2208
2209
2210
2211class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2212 public:
2213 LStringCharCodeAt(LOperand* string, LOperand* index) {
2214 inputs_[0] = string;
2215 inputs_[1] = index;
2216 }
2217
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002218 LOperand* string() { return inputs_[0]; }
2219 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002220
2221 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2222 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002223};
2224
2225
2226class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2227 public:
2228 explicit LStringCharFromCode(LOperand* char_code) {
2229 inputs_[0] = char_code;
2230 }
2231
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002232 LOperand* char_code() { return inputs_[0]; }
2233
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002234 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2235 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002236};
2237
2238
2239class LStringLength: public LTemplateInstruction<1, 1, 0> {
2240 public:
2241 explicit LStringLength(LOperand* string) {
2242 inputs_[0] = string;
2243 }
2244
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002245 LOperand* string() { return inputs_[0]; }
2246
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002247 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2248 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002249};
2250
2251
2252class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2253 public:
2254 explicit LCheckFunction(LOperand* value) {
2255 inputs_[0] = value;
2256 }
2257
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002258 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002259
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002260 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2261 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2262};
2263
2264
2265class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2266 public:
2267 explicit LCheckInstanceType(LOperand* value) {
2268 inputs_[0] = value;
2269 }
2270
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002271 LOperand* value() { return inputs_[0]; }
2272
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002273 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2274 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2275};
2276
2277
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002278class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002279 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002280 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002281 inputs_[0] = value;
2282 }
2283
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002284 LOperand* value() { return inputs_[0]; }
2285
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002286 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2287 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002288};
2289
2290
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002291class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002292 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002293 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2294 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002295 temps_[1] = temp2;
2296 }
2297
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002298 LOperand* temp() { return temps_[0]; }
2299 LOperand* temp2() { return temps_[1]; }
2300
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002301 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2302 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2303
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002304 ZoneList<Handle<JSObject> >* prototypes() const {
2305 return hydrogen()->prototypes();
2306 }
2307 ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002308};
2309
2310
2311class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2312 public:
2313 explicit LCheckSmi(LOperand* value) {
2314 inputs_[0] = value;
2315 }
2316
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002317 LOperand* value() { return inputs_[0]; }
2318
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002319 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2320};
2321
2322
2323class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2324 public:
2325 explicit LCheckNonSmi(LOperand* value) {
2326 inputs_[0] = value;
2327 }
2328
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002329 LOperand* value() { return inputs_[0]; }
2330
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002331 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2332};
2333
2334
2335class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2336 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002337 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2338 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002339 temps_[0] = temp;
2340 }
2341
2342 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002343 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002344
2345 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2346};
2347
2348
2349class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2350 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002351 explicit LClampIToUint8(LOperand* unclamped) {
2352 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002353 }
2354
2355 LOperand* unclamped() { return inputs_[0]; }
2356
2357 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2358};
2359
2360
2361class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2362 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002363 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2364 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002365 temps_[0] = temp;
2366 }
2367
2368 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002369 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002370
2371 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2372};
2373
2374
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002375class LAllocateObject: public LTemplateInstruction<1, 1, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002376 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002377 LAllocateObject(LOperand* temp, LOperand* temp2) {
2378 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002379 temps_[1] = temp2;
2380 }
2381
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002382 LOperand* temp() { return temps_[0]; }
2383 LOperand* temp2() { return temps_[1]; }
2384
ulan@chromium.org967e2702012-02-28 09:49:15 +00002385 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2386 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2387};
2388
2389
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002390class LAllocate: public LTemplateInstruction<1, 2, 2> {
2391 public:
2392 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2393 inputs_[1] = size;
2394 temps_[0] = temp1;
2395 temps_[1] = temp2;
2396 }
2397
2398 LOperand* size() { return inputs_[1]; }
2399 LOperand* temp1() { return temps_[0]; }
2400 LOperand* temp2() { return temps_[1]; }
2401
2402 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2403 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2404};
2405
2406
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002407class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2408 public:
2409 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2410 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2411};
2412
2413
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002414class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002415 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002416 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2417 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002418};
2419
2420
2421class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2422 public:
2423 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2424 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2425};
2426
2427
2428class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2429 public:
2430 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2431 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2432
2433 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2434};
2435
2436
2437class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2438 public:
2439 explicit LToFastProperties(LOperand* value) {
2440 inputs_[0] = value;
2441 }
2442
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002443 LOperand* value() { return inputs_[0]; }
2444
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002445 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2446 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2447};
2448
2449
2450class LTypeof: public LTemplateInstruction<1, 1, 0> {
2451 public:
2452 explicit LTypeof(LOperand* value) {
2453 inputs_[0] = value;
2454 }
2455
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002456 LOperand* value() { return inputs_[0]; }
2457
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002458 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2459};
2460
2461
2462class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2463 public:
2464 explicit LTypeofIsAndBranch(LOperand* value) {
2465 inputs_[0] = value;
2466 }
2467
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002468 LOperand* value() { return inputs_[0]; }
2469
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002470 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2471 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2472
2473 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2474
2475 virtual void PrintDataTo(StringStream* stream);
2476};
2477
2478
2479class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2480 public:
2481 explicit LIsConstructCallAndBranch(LOperand* temp) {
2482 temps_[0] = temp;
2483 }
2484
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002485 LOperand* temp() { return temps_[0]; }
2486
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002487 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2488 "is-construct-call-and-branch")
2489};
2490
2491
2492class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2493 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002494 LDeleteProperty(LOperand* object, LOperand* key) {
2495 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002496 inputs_[1] = key;
2497 }
2498
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002499 LOperand* object() { return inputs_[0]; }
2500 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002501
2502 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002503};
2504
2505
2506class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2507 public:
2508 LOsrEntry();
2509
2510 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2511
2512 LOperand** SpilledRegisterArray() { return register_spills_; }
2513 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2514
2515 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2516 void MarkSpilledDoubleRegister(int allocation_index,
2517 LOperand* spill_operand);
2518
2519 private:
2520 // Arrays of spill slot operands for registers with an assigned spill
2521 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2522 // NULL if the register has no assigned spill slot. Indexed by allocation
2523 // index.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002524 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters];
2525 LOperand* double_register_spills_[
2526 DoubleRegister::kMaxNumAllocatableRegisters];
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002527};
2528
2529
2530class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2531 public:
2532 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2533 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2534
2535 Label* done_label() { return &done_label_; }
2536
2537 private:
2538 Label done_label_;
2539};
2540
2541
2542class LIn: public LTemplateInstruction<1, 2, 0> {
2543 public:
2544 LIn(LOperand* key, LOperand* object) {
2545 inputs_[0] = key;
2546 inputs_[1] = object;
2547 }
2548
2549 LOperand* key() { return inputs_[0]; }
2550 LOperand* object() { return inputs_[1]; }
2551
2552 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2553};
2554
2555
ulan@chromium.org812308e2012-02-29 15:58:45 +00002556class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2557 public:
2558 explicit LForInPrepareMap(LOperand* object) {
2559 inputs_[0] = object;
2560 }
2561
2562 LOperand* object() { return inputs_[0]; }
2563
2564 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2565};
2566
2567
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002568class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002569 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002570 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002571 inputs_[0] = map;
2572 }
2573
2574 LOperand* map() { return inputs_[0]; }
2575
2576 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2577
2578 int idx() {
2579 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2580 }
2581};
2582
2583
2584class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2585 public:
2586 LCheckMapValue(LOperand* value, LOperand* map) {
2587 inputs_[0] = value;
2588 inputs_[1] = map;
2589 }
2590
2591 LOperand* value() { return inputs_[0]; }
2592 LOperand* map() { return inputs_[1]; }
2593
2594 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2595};
2596
2597
2598class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2599 public:
2600 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2601 inputs_[0] = object;
2602 inputs_[1] = index;
2603 }
2604
2605 LOperand* object() { return inputs_[0]; }
2606 LOperand* index() { return inputs_[1]; }
2607
2608 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2609};
2610
2611
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002612class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002613class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002614 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002615 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2616 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002617
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002618 int GetNextSpillIndex(bool is_double);
2619 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002620};
2621
2622
2623class LChunkBuilder BASE_EMBEDDED {
2624 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002625 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2626 : chunk_(NULL),
2627 info_(info),
2628 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002629 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002630 status_(UNUSED),
2631 current_instruction_(NULL),
2632 current_block_(NULL),
2633 next_block_(NULL),
2634 argument_count_(0),
2635 allocator_(allocator),
2636 position_(RelocInfo::kNoPosition),
2637 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002638 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002639
2640 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002641 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002642
2643 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002644#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002645 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2646#undef DECLARE_DO
2647
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002648 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2649
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002650 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2651 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2652 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2653 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2654 LInstruction* DoMathSin(HUnaryMathOperation* instr);
2655 LInstruction* DoMathCos(HUnaryMathOperation* instr);
2656 LInstruction* DoMathTan(HUnaryMathOperation* instr);
2657 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2658 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2659 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2660
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002661 private:
2662 enum Status {
2663 UNUSED,
2664 BUILDING,
2665 DONE,
2666 ABORTED
2667 };
2668
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002669 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002670 CompilationInfo* info() const { return info_; }
2671 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002672 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002673
2674 bool is_unused() const { return status_ == UNUSED; }
2675 bool is_building() const { return status_ == BUILDING; }
2676 bool is_done() const { return status_ == DONE; }
2677 bool is_aborted() const { return status_ == ABORTED; }
2678
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002679 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002680
2681 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002682 LUnallocated* ToUnallocated(Register reg);
2683 LUnallocated* ToUnallocated(DoubleRegister reg);
2684
2685 // Methods for setting up define-use relationships.
2686 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2687 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2688 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2689 DoubleRegister fixed_register);
2690
2691 // A value that is guaranteed to be allocated to a register.
2692 // Operand created by UseRegister is guaranteed to be live until the end of
2693 // instruction. This means that register allocator will not reuse it's
2694 // register for any other operand inside instruction.
2695 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2696 // instruction start. Register allocator is free to assign the same register
2697 // to some other operand used inside instruction (i.e. temporary or
2698 // output).
2699 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2700 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2701
2702 // An input operand in a register that may be trashed.
2703 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2704
2705 // An input operand in a register or stack slot.
2706 MUST_USE_RESULT LOperand* Use(HValue* value);
2707 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2708
2709 // An input operand in a register, stack slot or a constant operand.
2710 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2711 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2712
2713 // An input operand in a register or a constant operand.
2714 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2715 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2716
2717 // An input operand in register, stack slot or a constant operand.
2718 // Will not be moved to a register even if one is freely available.
2719 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2720
2721 // Temporary operand that must be in a register.
2722 MUST_USE_RESULT LUnallocated* TempRegister();
2723 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2724 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2725
2726 // Methods for setting up define-use relationships.
2727 // Return the same instruction that they are passed.
2728 template<int I, int T>
2729 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2730 LUnallocated* result);
2731 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002732 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2733 template<int I, int T>
2734 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2735 int index);
2736 template<int I, int T>
2737 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2738 template<int I, int T>
2739 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2740 Register reg);
2741 template<int I, int T>
2742 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2743 DoubleRegister reg);
2744 LInstruction* AssignEnvironment(LInstruction* instr);
2745 LInstruction* AssignPointerMap(LInstruction* instr);
2746
2747 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2748
2749 // By default we assume that instruction sequences generated for calls
2750 // cannot deoptimize eagerly and we do not attach environment to this
2751 // instruction.
2752 LInstruction* MarkAsCall(
2753 LInstruction* instr,
2754 HInstruction* hinstr,
2755 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002756
2757 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2758 int* argument_index_accumulator);
2759
2760 void VisitInstruction(HInstruction* current);
2761
2762 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2763 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2764 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2765 LInstruction* DoArithmeticD(Token::Value op,
2766 HArithmeticBinaryOperation* instr);
2767 LInstruction* DoArithmeticT(Token::Value op,
2768 HArithmeticBinaryOperation* instr);
2769
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002770 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002771 CompilationInfo* info_;
2772 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002773 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002774 Status status_;
2775 HInstruction* current_instruction_;
2776 HBasicBlock* current_block_;
2777 HBasicBlock* next_block_;
2778 int argument_count_;
2779 LAllocator* allocator_;
2780 int position_;
2781 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002782 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002783
lrn@chromium.org7516f052011-03-30 08:52:27 +00002784 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2785};
2786
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002787#undef DECLARE_HYDROGEN_ACCESSOR
2788#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002789
2790} } // namespace v8::internal
2791
2792#endif // V8_MIPS_LITHIUM_MIPS_H_