blob: cfca64452b5a344eb1ac3b1ac7c3c12de8d06921 [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
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000282 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; }
283
lrn@chromium.org7516f052011-03-30 08:52:27 +0000284#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000285 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000286#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000287
288 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000289 // Iterator interface.
290 friend class InputIterator;
291 virtual int InputCount() = 0;
292 virtual LOperand* InputAt(int i) = 0;
293
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000294 friend class TempIterator;
295 virtual int TempCount() = 0;
296 virtual LOperand* TempAt(int i) = 0;
297
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000298 LEnvironment* environment_;
299 SetOncePointer<LPointerMap> pointer_map_;
300 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000301 bool is_call_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000302};
303
304
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000305// R = number of result operands (0 or 1).
306// I = number of input operands.
307// T = number of temporary operands.
308template<int R, int I, int T>
309class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000310 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000311 // Allow 0 or 1 output operands.
312 STATIC_ASSERT(R == 0 || R == 1);
313 virtual bool HasResult() const { return R != 0; }
314 void set_result(LOperand* operand) { results_[0] = operand; }
315 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000316
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000317 protected:
318 EmbeddedContainer<LOperand*, R> results_;
319 EmbeddedContainer<LOperand*, I> inputs_;
320 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000321
322 private:
323 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000324 virtual LOperand* InputAt(int i) { return inputs_[i]; }
325
326 virtual int TempCount() { return T; }
327 virtual LOperand* TempAt(int i) { return temps_[i]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000328};
329
330
331class LGap: public LTemplateInstruction<0, 0, 0> {
332 public:
333 explicit LGap(HBasicBlock* block)
334 : block_(block) {
335 parallel_moves_[BEFORE] = NULL;
336 parallel_moves_[START] = NULL;
337 parallel_moves_[END] = NULL;
338 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000339 }
340
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000341 // Can't use the DECLARE-macro here because of sub-classes.
342 virtual bool IsGap() const { return true; }
343 virtual void PrintDataTo(StringStream* stream);
344 static LGap* cast(LInstruction* instr) {
345 ASSERT(instr->IsGap());
346 return reinterpret_cast<LGap*>(instr);
347 }
348
349 bool IsRedundant() const;
350
351 HBasicBlock* block() const { return block_; }
352
lrn@chromium.org7516f052011-03-30 08:52:27 +0000353 enum InnerPosition {
354 BEFORE,
355 START,
356 END,
357 AFTER,
358 FIRST_INNER_POSITION = BEFORE,
359 LAST_INNER_POSITION = AFTER
360 };
361
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000362 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
363 if (parallel_moves_[pos] == NULL) {
364 parallel_moves_[pos] = new(zone) LParallelMove(zone);
365 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000366 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000367 }
368
369 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000370 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000371 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000372
373 private:
374 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
375 HBasicBlock* block_;
376};
377
378
379class LInstructionGap: public LGap {
380 public:
381 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
382
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000383 virtual bool HasInterestingComment(LCodeGen* gen) const {
384 return !IsRedundant();
385 }
386
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000387 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
388};
389
390
391class LGoto: public LTemplateInstruction<0, 0, 0> {
392 public:
393 explicit LGoto(int block_id) : block_id_(block_id) { }
394
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000395 virtual bool HasInterestingComment(LCodeGen* gen) const;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000396 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
397 virtual void PrintDataTo(StringStream* stream);
398 virtual bool IsControl() const { return true; }
399
400 int block_id() const { return block_id_; }
401
402 private:
403 int block_id_;
404};
405
406
407class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
408 public:
409 LLazyBailout() : gap_instructions_size_(0) { }
410
411 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
412
413 void set_gap_instructions_size(int gap_instructions_size) {
414 gap_instructions_size_ = gap_instructions_size;
415 }
416 int gap_instructions_size() { return gap_instructions_size_; }
417
418 private:
419 int gap_instructions_size_;
420};
421
422
yangguo@chromium.org46a2a512013-01-18 16:29:40 +0000423class LDummyUse: public LTemplateInstruction<1, 1, 0> {
424 public:
425 explicit LDummyUse(LOperand* value) {
426 inputs_[0] = value;
427 }
428 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
429};
430
431
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000432class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
433 public:
434 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000435};
436
437
438class LLabel: public LGap {
439 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000440 explicit LLabel(HBasicBlock* block)
441 : LGap(block), replacement_(NULL) { }
442
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000443 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000444 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
445
446 virtual void PrintDataTo(StringStream* stream);
447
448 int block_id() const { return block()->block_id(); }
449 bool is_loop_header() const { return block()->IsLoopHeader(); }
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000450 bool is_osr_entry() const { return block()->is_osr_entry(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000451 Label* label() { return &label_; }
452 LLabel* replacement() const { return replacement_; }
453 void set_replacement(LLabel* label) { replacement_ = label; }
454 bool HasReplacement() const { return replacement_ != NULL; }
455
456 private:
457 Label label_;
458 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000459};
460
461
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000462class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000463 public:
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000464 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000465 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
466};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000467
lrn@chromium.org7516f052011-03-30 08:52:27 +0000468
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000469class LCallStub: public LTemplateInstruction<1, 0, 0> {
470 public:
471 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
472 DECLARE_HYDROGEN_ACCESSOR(CallStub)
473
474 TranscendentalCache::Type transcendental_type() {
475 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000476 }
477};
478
479
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000480class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
481 public:
ulan@chromium.org32d7dba2013-04-24 10:59:06 +0000482 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000483 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
484};
485
486
487template<int I, int T>
488class LControlInstruction: public LTemplateInstruction<0, I, T> {
489 public:
490 virtual bool IsControl() const { return true; }
491
492 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
493 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
494 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
495 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
496
497 private:
498 HControlInstruction* hydrogen() {
499 return HControlInstruction::cast(this->hydrogen_value());
500 }
501};
502
503
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000504class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
505 public:
506 LWrapReceiver(LOperand* receiver, LOperand* function) {
507 inputs_[0] = receiver;
508 inputs_[1] = function;
509 }
510
511 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
512
513 LOperand* receiver() { return inputs_[0]; }
514 LOperand* function() { return inputs_[1]; }
515};
516
517
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000518class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
519 public:
520 LApplyArguments(LOperand* function,
521 LOperand* receiver,
522 LOperand* length,
523 LOperand* elements) {
524 inputs_[0] = function;
525 inputs_[1] = receiver;
526 inputs_[2] = length;
527 inputs_[3] = elements;
528 }
529
530 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
531
532 LOperand* function() { return inputs_[0]; }
533 LOperand* receiver() { return inputs_[1]; }
534 LOperand* length() { return inputs_[2]; }
535 LOperand* elements() { return inputs_[3]; }
536};
537
538
539class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
540 public:
541 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
542 inputs_[0] = arguments;
543 inputs_[1] = length;
544 inputs_[2] = index;
545 }
546
547 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
548
549 LOperand* arguments() { return inputs_[0]; }
550 LOperand* length() { return inputs_[1]; }
551 LOperand* index() { return inputs_[2]; }
552
553 virtual void PrintDataTo(StringStream* stream);
554};
555
556
557class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
558 public:
559 explicit LArgumentsLength(LOperand* elements) {
560 inputs_[0] = elements;
561 }
562
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000563 LOperand* elements() { return inputs_[0]; }
564
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000565 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
566};
567
568
569class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
570 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000571 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000572 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000573};
574
575
576class LModI: public LTemplateInstruction<1, 2, 3> {
577 public:
578 // Used when the right hand is a constant power of 2.
579 LModI(LOperand* left,
580 LOperand* right) {
581 inputs_[0] = left;
582 inputs_[1] = right;
583 temps_[0] = NULL;
584 temps_[1] = NULL;
585 temps_[2] = NULL;
586 }
587
588 // Used for the standard case.
589 LModI(LOperand* left,
590 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000591 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000592 LOperand* temp2,
593 LOperand* temp3) {
594 inputs_[0] = left;
595 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000596 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000597 temps_[1] = temp2;
598 temps_[2] = temp3;
599 }
600
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000601 LOperand* left() { return inputs_[0]; }
602 LOperand* right() { return inputs_[1]; }
603 LOperand* temp() { return temps_[0]; }
604 LOperand* temp2() { return temps_[1]; }
605 LOperand* temp3() { return temps_[2]; }
606
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000607 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
608 DECLARE_HYDROGEN_ACCESSOR(Mod)
609};
610
611
612class LDivI: public LTemplateInstruction<1, 2, 0> {
613 public:
614 LDivI(LOperand* left, LOperand* right) {
615 inputs_[0] = left;
616 inputs_[1] = right;
617 }
618
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000619 LOperand* left() { return inputs_[0]; }
620 LOperand* right() { return inputs_[1]; }
621
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000622 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
623 DECLARE_HYDROGEN_ACCESSOR(Div)
624};
625
626
627class LMulI: public LTemplateInstruction<1, 2, 1> {
628 public:
629 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
630 inputs_[0] = left;
631 inputs_[1] = right;
632 temps_[0] = temp;
633 }
634
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000635 LOperand* left() { return inputs_[0]; }
636 LOperand* right() { return inputs_[1]; }
637 LOperand* temp() { return temps_[0]; }
638
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000639 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
640 DECLARE_HYDROGEN_ACCESSOR(Mul)
641};
642
643
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000644// Instruction for computing multiplier * multiplicand + addend.
645class LMultiplyAddD: public LTemplateInstruction<1, 3, 0> {
646 public:
647 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
648 LOperand* multiplicand) {
649 inputs_[0] = addend;
650 inputs_[1] = multiplier;
651 inputs_[2] = multiplicand;
652 }
653
654 LOperand* addend() { return inputs_[0]; }
655 LOperand* multiplier() { return inputs_[1]; }
656 LOperand* multiplicand() { return inputs_[2]; }
657
658 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
659};
660
661
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000662class LCmpIDAndBranch: public LControlInstruction<2, 0> {
663 public:
664 LCmpIDAndBranch(LOperand* left, LOperand* right) {
665 inputs_[0] = left;
666 inputs_[1] = right;
667 }
668
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000669 LOperand* left() { return inputs_[0]; }
670 LOperand* right() { return inputs_[1]; }
671
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000672 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
673 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
674
675 Token::Value op() const { return hydrogen()->token(); }
676 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000677 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000678 }
679
680 virtual void PrintDataTo(StringStream* stream);
681};
682
683
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000684class LMathFloor: public LTemplateInstruction<1, 1, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000685 public:
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000686 LMathFloor(LOperand* value, LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000687 inputs_[0] = value;
688 temps_[0] = temp;
689 }
690
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000691 LOperand* value() { return inputs_[0]; }
692 LOperand* temp() { return temps_[0]; }
693
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000694 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000695 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000696};
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000697
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000698
699class LMathRound: public LTemplateInstruction<1, 1, 1> {
700 public:
701 LMathRound(LOperand* value, LOperand* temp) {
702 inputs_[0] = value;
703 temps_[0] = temp;
704 }
705
706 LOperand* value() { return inputs_[0]; }
707 LOperand* temp() { return temps_[0]; }
708
709 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
710 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
711};
712
713
714class LMathAbs: public LTemplateInstruction<1, 1, 0> {
715 public:
716 explicit LMathAbs(LOperand* value) {
717 inputs_[0] = value;
718 }
719
720 LOperand* value() { return inputs_[0]; }
721
722 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
723 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
724};
725
726
727class LMathLog: public LTemplateInstruction<1, 1, 0> {
728 public:
729 explicit LMathLog(LOperand* value) {
730 inputs_[0] = value;
731 }
732
733 LOperand* value() { return inputs_[0]; }
734
735 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
736};
737
738
739class LMathSin: public LTemplateInstruction<1, 1, 0> {
740 public:
741 explicit LMathSin(LOperand* value) {
742 inputs_[0] = value;
743 }
744
745 LOperand* value() { return inputs_[0]; }
746
747 DECLARE_CONCRETE_INSTRUCTION(MathSin, "math-sin")
748};
749
750
751class LMathCos: public LTemplateInstruction<1, 1, 0> {
752 public:
753 explicit LMathCos(LOperand* value) {
754 inputs_[0] = value;
755 }
756
757 LOperand* value() { return inputs_[0]; }
758
759 DECLARE_CONCRETE_INSTRUCTION(MathCos, "math-cos")
760};
761
762
763class LMathTan: public LTemplateInstruction<1, 1, 0> {
764 public:
765 explicit LMathTan(LOperand* value) {
766 inputs_[0] = value;
767 }
768
769 LOperand* value() { return inputs_[0]; }
770
771 DECLARE_CONCRETE_INSTRUCTION(MathTan, "math-tan")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000772};
773
774
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000775class LMathExp: public LTemplateInstruction<1, 1, 3> {
776 public:
777 LMathExp(LOperand* value,
778 LOperand* double_temp,
779 LOperand* temp1,
780 LOperand* temp2) {
781 inputs_[0] = value;
782 temps_[0] = temp1;
783 temps_[1] = temp2;
784 temps_[2] = double_temp;
785 ExternalReference::InitializeMathExpData();
786 }
787
788 LOperand* value() { return inputs_[0]; }
789 LOperand* temp1() { return temps_[0]; }
790 LOperand* temp2() { return temps_[1]; }
791 LOperand* double_temp() { return temps_[2]; }
792
793 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000794};
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000795
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000796
797class LMathSqrt: public LTemplateInstruction<1, 1, 0> {
798 public:
799 explicit LMathSqrt(LOperand* value) {
800 inputs_[0] = value;
801 }
802
803 LOperand* value() { return inputs_[0]; }
804
805 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
806};
807
808
809class LMathPowHalf: public LTemplateInstruction<1, 1, 1> {
810 public:
811 LMathPowHalf(LOperand* value, LOperand* temp) {
812 inputs_[0] = value;
813 temps_[0] = temp;
814 }
815
816 LOperand* value() { return inputs_[0]; }
817 LOperand* temp() { return temps_[0]; }
818
819 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000820};
821
822
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000823class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
824 public:
825 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
826 inputs_[0] = left;
827 inputs_[1] = right;
828 }
829
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000830 LOperand* left() { return inputs_[0]; }
831 LOperand* right() { return inputs_[1]; }
832
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000833 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
834 "cmp-object-eq-and-branch")
835 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
836};
837
838
839class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
840 public:
841 explicit LCmpConstantEqAndBranch(LOperand* left) {
842 inputs_[0] = left;
843 }
844
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000845 LOperand* left() { return inputs_[0]; }
846
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000847 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
848 "cmp-constant-eq-and-branch")
849 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
850};
851
852
853class LIsNilAndBranch: public LControlInstruction<1, 0> {
854 public:
855 explicit LIsNilAndBranch(LOperand* value) {
856 inputs_[0] = value;
857 }
858
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000859 LOperand* value() { return inputs_[0]; }
860
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000861 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
862 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
863
864 EqualityKind kind() const { return hydrogen()->kind(); }
865 NilValue nil() const { return hydrogen()->nil(); }
866
867 virtual void PrintDataTo(StringStream* stream);
868};
869
870
871class LIsObjectAndBranch: public LControlInstruction<1, 1> {
872 public:
873 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
874 inputs_[0] = value;
875 temps_[0] = temp;
876 }
877
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000878 LOperand* value() { return inputs_[0]; }
879 LOperand* temp() { return temps_[0]; }
880
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000881 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
882 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
883
884 virtual void PrintDataTo(StringStream* stream);
885};
886
887
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000888class LIsStringAndBranch: public LControlInstruction<1, 1> {
889 public:
890 LIsStringAndBranch(LOperand* value, LOperand* temp) {
891 inputs_[0] = value;
892 temps_[0] = temp;
893 }
894
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000895 LOperand* value() { return inputs_[0]; }
896 LOperand* temp() { return temps_[0]; }
897
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000898 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
899 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
900
901 virtual void PrintDataTo(StringStream* stream);
902};
903
904
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000905class LIsSmiAndBranch: public LControlInstruction<1, 0> {
906 public:
907 explicit LIsSmiAndBranch(LOperand* value) {
908 inputs_[0] = value;
909 }
910
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000911 LOperand* value() { return inputs_[0]; }
912
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000913 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
914 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
915
916 virtual void PrintDataTo(StringStream* stream);
917};
918
919
920class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
921 public:
922 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
923 inputs_[0] = value;
924 temps_[0] = temp;
925 }
926
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000927 LOperand* value() { return inputs_[0]; }
928 LOperand* temp() { return temps_[0]; }
929
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000930 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
931 "is-undetectable-and-branch")
932 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
933
934 virtual void PrintDataTo(StringStream* stream);
935};
936
937
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000938class LStringCompareAndBranch: public LControlInstruction<2, 0> {
939 public:
940 LStringCompareAndBranch(LOperand* left, LOperand* right) {
941 inputs_[0] = left;
942 inputs_[1] = right;
943 }
944
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000945 LOperand* left() { return inputs_[0]; }
946 LOperand* right() { return inputs_[1]; }
947
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000948 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
949 "string-compare-and-branch")
950 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
951
952 Token::Value op() const { return hydrogen()->token(); }
953
954 virtual void PrintDataTo(StringStream* stream);
955};
956
957
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000958class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
959 public:
960 explicit LHasInstanceTypeAndBranch(LOperand* value) {
961 inputs_[0] = value;
962 }
963
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000964 LOperand* value() { return inputs_[0]; }
965
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000966 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
967 "has-instance-type-and-branch")
968 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
969
970 virtual void PrintDataTo(StringStream* stream);
971};
972
973
974class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
975 public:
976 explicit LGetCachedArrayIndex(LOperand* value) {
977 inputs_[0] = value;
978 }
979
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000980 LOperand* value() { return inputs_[0]; }
981
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000982 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
983 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
984};
985
986
987class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
988 public:
989 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
990 inputs_[0] = value;
991 }
992
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000993 LOperand* value() { return inputs_[0]; }
994
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000995 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
996 "has-cached-array-index-and-branch")
997 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
998
999 virtual void PrintDataTo(StringStream* stream);
1000};
1001
1002
1003class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
1004 public:
1005 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
1006 inputs_[0] = value;
1007 temps_[0] = temp;
1008 }
1009
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001010 LOperand* value() { return inputs_[0]; }
1011 LOperand* temp() { return temps_[0]; }
1012
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001013 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1014 "class-of-test-and-branch")
1015 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1016
1017 virtual void PrintDataTo(StringStream* stream);
1018};
1019
1020
1021class LCmpT: public LTemplateInstruction<1, 2, 0> {
1022 public:
1023 LCmpT(LOperand* left, LOperand* right) {
1024 inputs_[0] = left;
1025 inputs_[1] = right;
1026 }
1027
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001028 LOperand* left() { return inputs_[0]; }
1029 LOperand* right() { return inputs_[1]; }
1030
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001031 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1032 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1033
1034 Token::Value op() const { return hydrogen()->token(); }
1035};
1036
1037
1038class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
1039 public:
1040 LInstanceOf(LOperand* left, LOperand* right) {
1041 inputs_[0] = left;
1042 inputs_[1] = right;
1043 }
1044
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001045 LOperand* left() { return inputs_[0]; }
1046 LOperand* right() { return inputs_[1]; }
1047
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001048 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1049};
1050
1051
1052class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
1053 public:
1054 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
1055 inputs_[0] = value;
1056 temps_[0] = temp;
1057 }
1058
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001059 LOperand* value() { return inputs_[0]; }
1060 LOperand* temp() { return temps_[0]; }
1061
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001062 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1063 "instance-of-known-global")
1064 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1065
1066 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +00001067 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
1068 return lazy_deopt_env_;
1069 }
1070 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
1071 lazy_deopt_env_ = env;
1072 }
1073
1074 private:
1075 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001076};
1077
1078
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +00001079class LInstanceSize: public LTemplateInstruction<1, 1, 0> {
1080 public:
1081 explicit LInstanceSize(LOperand* object) {
1082 inputs_[0] = object;
1083 }
1084
1085 LOperand* object() { return inputs_[0]; }
1086
1087 DECLARE_CONCRETE_INSTRUCTION(InstanceSize, "instance-size")
1088 DECLARE_HYDROGEN_ACCESSOR(InstanceSize)
1089};
1090
1091
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001092class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
1093 public:
1094 LBoundsCheck(LOperand* index, LOperand* length) {
1095 inputs_[0] = index;
1096 inputs_[1] = length;
1097 }
1098
1099 LOperand* index() { return inputs_[0]; }
1100 LOperand* length() { return inputs_[1]; }
1101
1102 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +00001103 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001104};
1105
1106
1107class LBitI: public LTemplateInstruction<1, 2, 0> {
1108 public:
1109 LBitI(LOperand* left, LOperand* right) {
1110 inputs_[0] = left;
1111 inputs_[1] = right;
1112 }
1113
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001114 LOperand* left() { return inputs_[0]; }
1115 LOperand* right() { return inputs_[1]; }
1116
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001117 Token::Value op() const { return hydrogen()->op(); }
1118
1119 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1120 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1121};
1122
1123
1124class LShiftI: public LTemplateInstruction<1, 2, 0> {
1125 public:
1126 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1127 : op_(op), can_deopt_(can_deopt) {
1128 inputs_[0] = left;
1129 inputs_[1] = right;
1130 }
1131
1132 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001133 LOperand* left() { return inputs_[0]; }
1134 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001135 bool can_deopt() const { return can_deopt_; }
1136
1137 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1138
1139 private:
1140 Token::Value op_;
1141 bool can_deopt_;
1142};
1143
1144
1145class LSubI: public LTemplateInstruction<1, 2, 0> {
1146 public:
1147 LSubI(LOperand* left, LOperand* right) {
1148 inputs_[0] = left;
1149 inputs_[1] = right;
1150 }
1151
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001152 LOperand* left() { return inputs_[0]; }
1153 LOperand* right() { return inputs_[1]; }
1154
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001155 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1156 DECLARE_HYDROGEN_ACCESSOR(Sub)
1157};
1158
1159
1160class LConstantI: public LTemplateInstruction<1, 0, 0> {
1161 public:
1162 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1163 DECLARE_HYDROGEN_ACCESSOR(Constant)
1164
1165 int32_t value() const { return hydrogen()->Integer32Value(); }
1166};
1167
1168
1169class LConstantD: public LTemplateInstruction<1, 0, 0> {
1170 public:
1171 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1172 DECLARE_HYDROGEN_ACCESSOR(Constant)
1173
1174 double value() const { return hydrogen()->DoubleValue(); }
1175};
1176
1177
1178class LConstantT: public LTemplateInstruction<1, 0, 0> {
1179 public:
1180 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1181 DECLARE_HYDROGEN_ACCESSOR(Constant)
1182
1183 Handle<Object> value() const { return hydrogen()->handle(); }
1184};
1185
1186
1187class LBranch: public LControlInstruction<1, 0> {
1188 public:
1189 explicit LBranch(LOperand* value) {
1190 inputs_[0] = value;
1191 }
1192
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001193 LOperand* value() { return inputs_[0]; }
1194
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001195 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1196 DECLARE_HYDROGEN_ACCESSOR(Branch)
1197
1198 virtual void PrintDataTo(StringStream* stream);
1199};
1200
1201
1202class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1203 public:
1204 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1205 inputs_[0] = value;
1206 temps_[0] = temp;
1207 }
1208
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001209 LOperand* value() { return inputs_[0]; }
1210 LOperand* temp() { return temps_[0]; }
1211
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001212 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1213 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1214
1215 virtual bool IsControl() const { return true; }
1216
1217 Handle<Map> map() const { return hydrogen()->map(); }
1218 int true_block_id() const {
1219 return hydrogen()->FirstSuccessor()->block_id();
1220 }
1221 int false_block_id() const {
1222 return hydrogen()->SecondSuccessor()->block_id();
1223 }
1224};
1225
1226
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001227class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1228 public:
1229 explicit LFixedArrayBaseLength(LOperand* value) {
1230 inputs_[0] = value;
1231 }
1232
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001233 LOperand* value() { return inputs_[0]; }
1234
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001235 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1236 "fixed-array-base-length")
1237 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1238};
1239
1240
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001241class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1242 public:
1243 explicit LMapEnumLength(LOperand* value) {
1244 inputs_[0] = value;
1245 }
1246
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001247 LOperand* value() { return inputs_[0]; }
1248
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001249 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1250};
1251
1252
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001253class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1254 public:
1255 explicit LElementsKind(LOperand* value) {
1256 inputs_[0] = value;
1257 }
1258
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001259 LOperand* value() { return inputs_[0]; }
1260
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001261 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1262 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1263};
1264
1265
1266class LValueOf: public LTemplateInstruction<1, 1, 1> {
1267 public:
1268 LValueOf(LOperand* value, LOperand* temp) {
1269 inputs_[0] = value;
1270 temps_[0] = temp;
1271 }
1272
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001273 LOperand* value() { return inputs_[0]; }
1274 LOperand* temp() { return temps_[0]; }
1275
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001276 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1277 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1278};
1279
1280
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001281class LDateField: public LTemplateInstruction<1, 1, 1> {
1282 public:
1283 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1284 inputs_[0] = date;
1285 temps_[0] = temp;
1286 }
1287
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001288 LOperand* date() { return inputs_[0]; }
1289 LOperand* temp() { return temps_[0]; }
1290 Smi* index() const { return index_; }
1291
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001292 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1293 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001294
1295 private:
1296 Smi* index_;
1297};
1298
1299
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +00001300class LSeqStringSetChar: public LTemplateInstruction<1, 3, 0> {
1301 public:
1302 LSeqStringSetChar(String::Encoding encoding,
1303 LOperand* string,
1304 LOperand* index,
1305 LOperand* value) : encoding_(encoding) {
1306 inputs_[0] = string;
1307 inputs_[1] = index;
1308 inputs_[2] = value;
1309 }
1310
1311 String::Encoding encoding() { return encoding_; }
1312 LOperand* string() { return inputs_[0]; }
1313 LOperand* index() { return inputs_[1]; }
1314 LOperand* value() { return inputs_[2]; }
1315
1316 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1317 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1318
1319 private:
1320 String::Encoding encoding_;
1321};
1322
1323
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001324class LThrow: public LTemplateInstruction<0, 1, 0> {
1325 public:
1326 explicit LThrow(LOperand* value) {
1327 inputs_[0] = value;
1328 }
1329
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001330 LOperand* value() { return inputs_[0]; }
1331
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001332 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1333};
1334
1335
1336class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1337 public:
1338 explicit LBitNotI(LOperand* value) {
1339 inputs_[0] = value;
1340 }
1341
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001342 LOperand* value() { return inputs_[0]; }
1343
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001344 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1345};
1346
1347
1348class LAddI: public LTemplateInstruction<1, 2, 0> {
1349 public:
1350 LAddI(LOperand* left, LOperand* right) {
1351 inputs_[0] = left;
1352 inputs_[1] = right;
1353 }
1354
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001355 LOperand* left() { return inputs_[0]; }
1356 LOperand* right() { return inputs_[1]; }
1357
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001358 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1359 DECLARE_HYDROGEN_ACCESSOR(Add)
1360};
1361
1362
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001363class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1364 public:
1365 LMathMinMax(LOperand* left, LOperand* right) {
1366 inputs_[0] = left;
1367 inputs_[1] = right;
1368 }
1369
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001370 LOperand* left() { return inputs_[0]; }
1371 LOperand* right() { return inputs_[1]; }
1372
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00001373 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001374 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1375};
1376
1377
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001378class LPower: public LTemplateInstruction<1, 2, 0> {
1379 public:
1380 LPower(LOperand* left, LOperand* right) {
1381 inputs_[0] = left;
1382 inputs_[1] = right;
1383 }
1384
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001385 LOperand* left() { return inputs_[0]; }
1386 LOperand* right() { return inputs_[1]; }
1387
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001388 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1389 DECLARE_HYDROGEN_ACCESSOR(Power)
1390};
1391
1392
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001393class LRandom: public LTemplateInstruction<1, 1, 0> {
1394 public:
1395 explicit LRandom(LOperand* global_object) {
1396 inputs_[0] = global_object;
1397 }
1398
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001399 LOperand* global_object() { return inputs_[0]; }
1400
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001401 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1402 DECLARE_HYDROGEN_ACCESSOR(Random)
1403};
1404
1405
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001406class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1407 public:
1408 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1409 : op_(op) {
1410 inputs_[0] = left;
1411 inputs_[1] = right;
1412 }
1413
1414 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001415 LOperand* left() { return inputs_[0]; }
1416 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001417
1418 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1419 virtual void CompileToNative(LCodeGen* generator);
1420 virtual const char* Mnemonic() const;
1421
1422 private:
1423 Token::Value op_;
1424};
1425
1426
1427class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1428 public:
1429 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1430 : op_(op) {
1431 inputs_[0] = left;
1432 inputs_[1] = right;
1433 }
1434
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001435 LOperand* left() { return inputs_[0]; }
1436 LOperand* right() { return inputs_[1]; }
1437 Token::Value op() const { return op_; }
1438
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001439 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1440 virtual void CompileToNative(LCodeGen* generator);
1441 virtual const char* Mnemonic() const;
1442
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001443 private:
1444 Token::Value op_;
1445};
1446
1447
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001448class LReturn: public LTemplateInstruction<0, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001449 public:
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001450 explicit LReturn(LOperand* value, LOperand* parameter_count) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001451 inputs_[0] = value;
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001452 inputs_[1] = parameter_count;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001453 }
1454
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001455 LOperand* value() { return inputs_[0]; }
1456
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001457 bool has_constant_parameter_count() {
1458 return parameter_count()->IsConstantOperand();
1459 }
1460 LConstantOperand* constant_parameter_count() {
1461 ASSERT(has_constant_parameter_count());
1462 return LConstantOperand::cast(parameter_count());
1463 }
1464 LOperand* parameter_count() { return inputs_[1]; }
1465
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001466 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1467};
1468
1469
1470class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1471 public:
1472 explicit LLoadNamedField(LOperand* object) {
1473 inputs_[0] = object;
1474 }
1475
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001476 LOperand* object() { return inputs_[0]; }
1477
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001478 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1479 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1480};
1481
1482
1483class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1484 public:
1485 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1486 inputs_[0] = object;
1487 }
1488
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001489 LOperand* object() { return inputs_[0]; }
1490
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001491 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1492 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001493};
1494
1495
1496class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1497 public:
1498 explicit LLoadNamedGeneric(LOperand* object) {
1499 inputs_[0] = object;
1500 }
1501
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001502 LOperand* object() { return inputs_[0]; }
1503
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001504 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1505 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1506
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001507 Handle<Object> name() const { return hydrogen()->name(); }
1508};
1509
1510
1511class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1512 public:
1513 explicit LLoadFunctionPrototype(LOperand* function) {
1514 inputs_[0] = function;
1515 }
1516
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001517 LOperand* function() { return inputs_[0]; }
1518
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001519 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1520 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001521};
1522
1523
1524class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1525 public:
1526 explicit LLoadElements(LOperand* object) {
1527 inputs_[0] = object;
1528 }
1529
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001530 LOperand* object() { return inputs_[0]; }
1531
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001532 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1533};
1534
1535
1536class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1537 public:
1538 explicit LLoadExternalArrayPointer(LOperand* object) {
1539 inputs_[0] = object;
1540 }
1541
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001542 LOperand* object() { return inputs_[0]; }
1543
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001544 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1545 "load-external-array-pointer")
1546};
1547
1548
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001549class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001550 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001551 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001552 inputs_[0] = elements;
1553 inputs_[1] = key;
1554 }
1555
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001556 LOperand* elements() { return inputs_[0]; }
1557 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001558 ElementsKind elements_kind() const {
1559 return hydrogen()->elements_kind();
1560 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001561 bool is_external() const {
1562 return hydrogen()->is_external();
1563 }
1564
1565 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1566 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1567
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001568 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001569 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001570};
1571
1572
1573class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1574 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001575 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1576 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001577 inputs_[1] = key;
1578 }
1579
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001580 LOperand* object() { return inputs_[0]; }
1581 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001582
1583 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001584};
1585
1586
1587class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1588 public:
1589 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1590 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1591};
1592
1593
1594class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1595 public:
1596 explicit LLoadGlobalGeneric(LOperand* global_object) {
1597 inputs_[0] = global_object;
1598 }
1599
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001600 LOperand* global_object() { return inputs_[0]; }
1601
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001602 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1603 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1604
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001605 Handle<Object> name() const { return hydrogen()->name(); }
1606 bool for_typeof() const { return hydrogen()->for_typeof(); }
1607};
1608
1609
1610class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1611 public:
1612 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1613 inputs_[0] = value;
1614 temps_[0] = temp;
1615 }
1616
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001617 LOperand* value() { return inputs_[0]; }
1618 LOperand* temp() { return temps_[0]; }
1619
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001620 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1621 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1622};
1623
1624
1625class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1626 public:
1627 explicit LStoreGlobalGeneric(LOperand* global_object,
1628 LOperand* value) {
1629 inputs_[0] = global_object;
1630 inputs_[1] = value;
1631 }
1632
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001633 LOperand* global_object() { return inputs_[0]; }
1634 LOperand* value() { return inputs_[1]; }
1635
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001636 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1637 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1638
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001639 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001640 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001641};
1642
1643
1644class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1645 public:
1646 explicit LLoadContextSlot(LOperand* context) {
1647 inputs_[0] = context;
1648 }
1649
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001650 LOperand* context() { return inputs_[0]; }
1651
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001652 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1653 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1654
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001655 int slot_index() { return hydrogen()->slot_index(); }
1656
1657 virtual void PrintDataTo(StringStream* stream);
1658};
1659
1660
1661class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1662 public:
1663 LStoreContextSlot(LOperand* context, LOperand* value) {
1664 inputs_[0] = context;
1665 inputs_[1] = value;
1666 }
1667
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001668 LOperand* context() { return inputs_[0]; }
1669 LOperand* value() { return inputs_[1]; }
1670
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001671 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1672 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1673
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001674 int slot_index() { return hydrogen()->slot_index(); }
1675
1676 virtual void PrintDataTo(StringStream* stream);
1677};
1678
1679
1680class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1681 public:
1682 explicit LPushArgument(LOperand* value) {
1683 inputs_[0] = value;
1684 }
1685
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001686 LOperand* value() { return inputs_[0]; }
1687
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001688 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1689};
1690
1691
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001692class LDrop: public LTemplateInstruction<0, 0, 0> {
1693 public:
1694 explicit LDrop(int count) : count_(count) { }
1695
1696 int count() const { return count_; }
1697
1698 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1699
1700 private:
1701 int count_;
1702};
1703
1704
jkummerow@chromium.org4c54a2a2013-03-19 17:51:30 +00001705class LInnerAllocatedObject: public LTemplateInstruction<1, 1, 0> {
1706 public:
1707 explicit LInnerAllocatedObject(LOperand* base_object) {
1708 inputs_[0] = base_object;
1709 }
1710
1711 LOperand* base_object() { return inputs_[0]; }
1712 int offset() { return hydrogen()->offset(); }
1713
1714 virtual void PrintDataTo(StringStream* stream);
1715
1716 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "sub-allocated-object")
1717 DECLARE_HYDROGEN_ACCESSOR(InnerAllocatedObject)
1718};
1719
1720
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001721class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1722 public:
1723 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1724 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1725};
1726
1727
1728class LContext: public LTemplateInstruction<1, 0, 0> {
1729 public:
1730 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001731 DECLARE_HYDROGEN_ACCESSOR(Context)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001732};
1733
1734
1735class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1736 public:
1737 explicit LOuterContext(LOperand* context) {
1738 inputs_[0] = context;
1739 }
1740
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001741 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001742
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001743 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001744};
1745
1746
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001747class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1748 public:
1749 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1750 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1751};
1752
1753
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001754class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1755 public:
1756 explicit LGlobalObject(LOperand* context) {
1757 inputs_[0] = context;
1758 }
1759
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001760 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001761
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001762 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001763};
1764
1765
1766class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1767 public:
1768 explicit LGlobalReceiver(LOperand* global_object) {
1769 inputs_[0] = global_object;
1770 }
1771
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001772 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001773
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001774 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001775};
1776
1777
1778class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1779 public:
1780 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1781 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1782
1783 virtual void PrintDataTo(StringStream* stream);
1784
1785 Handle<JSFunction> function() { return hydrogen()->function(); }
1786 int arity() const { return hydrogen()->argument_count() - 1; }
1787};
1788
1789
1790class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1791 public:
1792 explicit LInvokeFunction(LOperand* function) {
1793 inputs_[0] = function;
1794 }
1795
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001796 LOperand* function() { return inputs_[0]; }
1797
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001798 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1799 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1800
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001801 virtual void PrintDataTo(StringStream* stream);
1802
1803 int arity() const { return hydrogen()->argument_count() - 1; }
1804};
1805
1806
1807class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1808 public:
1809 explicit LCallKeyed(LOperand* key) {
1810 inputs_[0] = key;
1811 }
1812
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001813 LOperand* key() { return inputs_[0]; }
1814
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001815 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1816 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1817
1818 virtual void PrintDataTo(StringStream* stream);
1819
1820 int arity() const { return hydrogen()->argument_count() - 1; }
1821};
1822
1823
1824
1825class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1826 public:
1827 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1828 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1829
1830 virtual void PrintDataTo(StringStream* stream);
1831
1832 Handle<String> name() const { return hydrogen()->name(); }
1833 int arity() const { return hydrogen()->argument_count() - 1; }
1834};
1835
1836
danno@chromium.orgc612e022011-11-10 11:38:15 +00001837class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001838 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001839 explicit LCallFunction(LOperand* function) {
1840 inputs_[0] = function;
1841 }
1842
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001843 LOperand* function() { return inputs_[0]; }
1844
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001845 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1846 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1847
danno@chromium.orgc612e022011-11-10 11:38:15 +00001848 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001849};
1850
1851
1852class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1853 public:
1854 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1855 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1856
1857 virtual void PrintDataTo(StringStream* stream);
1858
1859 Handle<String> name() const {return hydrogen()->name(); }
1860 int arity() const { return hydrogen()->argument_count() - 1; }
1861};
1862
1863
1864class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1865 public:
1866 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1867 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1868
1869 virtual void PrintDataTo(StringStream* stream);
1870
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001871 int arity() const { return hydrogen()->argument_count() - 1; }
1872};
1873
1874
1875class LCallNew: public LTemplateInstruction<1, 1, 0> {
1876 public:
1877 explicit LCallNew(LOperand* constructor) {
1878 inputs_[0] = constructor;
1879 }
1880
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001881 LOperand* constructor() { return inputs_[0]; }
1882
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001883 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1884 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1885
1886 virtual void PrintDataTo(StringStream* stream);
1887
1888 int arity() const { return hydrogen()->argument_count() - 1; }
1889};
1890
1891
ulan@chromium.org750145a2013-03-07 15:14:13 +00001892class LCallNewArray: public LTemplateInstruction<1, 1, 0> {
1893 public:
1894 explicit LCallNewArray(LOperand* constructor) {
1895 inputs_[0] = constructor;
1896 }
1897
1898 LOperand* constructor() { return inputs_[0]; }
1899
1900 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1901 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1902
1903 virtual void PrintDataTo(StringStream* stream);
1904
1905 int arity() const { return hydrogen()->argument_count() - 1; }
1906};
1907
1908
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001909class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1910 public:
1911 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1912 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1913
1914 const Runtime::Function* function() const { return hydrogen()->function(); }
1915 int arity() const { return hydrogen()->argument_count(); }
1916};
1917
1918
1919class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1920 public:
1921 explicit LInteger32ToDouble(LOperand* value) {
1922 inputs_[0] = value;
1923 }
1924
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001925 LOperand* value() { return inputs_[0]; }
1926
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001927 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1928};
1929
1930
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001931class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1932 public:
1933 explicit LUint32ToDouble(LOperand* value) {
1934 inputs_[0] = value;
1935 }
1936
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001937 LOperand* value() { return inputs_[0]; }
1938
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001939 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1940};
1941
1942
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001943class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1944 public:
1945 explicit LNumberTagI(LOperand* value) {
1946 inputs_[0] = value;
1947 }
1948
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001949 LOperand* value() { return inputs_[0]; }
1950
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001951 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1952};
1953
1954
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001955class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1956 public:
1957 explicit LNumberTagU(LOperand* value) {
1958 inputs_[0] = value;
1959 }
1960
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001961 LOperand* value() { return inputs_[0]; }
1962
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001963 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1964};
1965
1966
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001967class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1968 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001969 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001970 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001971 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001972 temps_[1] = temp2;
1973 }
1974
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001975 LOperand* value() { return inputs_[0]; }
1976 LOperand* temp() { return temps_[0]; }
1977 LOperand* temp2() { return temps_[1]; }
1978
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001979 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001980 DECLARE_HYDROGEN_ACCESSOR(Change)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001981};
1982
1983
1984// Sometimes truncating conversion from a tagged value to an int32.
1985class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1986 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001987 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001988 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001989 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001990 temps_[1] = temp2;
1991 }
1992
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001993 LOperand* value() { return inputs_[0]; }
1994 LOperand* temp() { return temps_[0]; }
1995 LOperand* temp2() { return temps_[1]; }
1996
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001997 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1998 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1999
2000 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2001};
2002
2003
2004// Truncating conversion from a tagged value to an int32.
2005class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
2006 public:
2007 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002008 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002009 LOperand* temp2,
2010 LOperand* temp3) {
2011 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002012 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002013 temps_[1] = temp2;
2014 temps_[2] = temp3;
2015 }
2016
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002017 LOperand* value() { return inputs_[0]; }
2018 LOperand* temp() { return temps_[0]; }
2019 LOperand* temp2() { return temps_[1]; }
2020 LOperand* temp3() { return temps_[2]; }
2021
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002022 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
2023 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2024
2025 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2026};
2027
2028
2029class LSmiTag: public LTemplateInstruction<1, 1, 0> {
2030 public:
2031 explicit LSmiTag(LOperand* value) {
2032 inputs_[0] = value;
2033 }
2034
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002035 LOperand* value() { return inputs_[0]; }
2036
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002037 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2038};
2039
2040
2041class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
2042 public:
2043 explicit LNumberUntagD(LOperand* value) {
2044 inputs_[0] = value;
2045 }
2046
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002047 LOperand* value() { return inputs_[0]; }
2048
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002049 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2050 DECLARE_HYDROGEN_ACCESSOR(Change)
2051};
2052
2053
2054class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
2055 public:
2056 LSmiUntag(LOperand* value, bool needs_check)
2057 : needs_check_(needs_check) {
2058 inputs_[0] = value;
2059 }
2060
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002061 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002062 bool needs_check() const { return needs_check_; }
2063
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002064 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2065
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002066 private:
2067 bool needs_check_;
2068};
2069
2070
verwaest@chromium.org37141392012-05-31 13:27:02 +00002071class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002072 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002073 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2074 inputs_[0] = object;
2075 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00002076 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002077 }
2078
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002079 LOperand* object() { return inputs_[0]; }
2080 LOperand* value() { return inputs_[1]; }
2081 LOperand* temp() { return temps_[0]; }
2082
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002083 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2084 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2085
2086 virtual void PrintDataTo(StringStream* stream);
2087
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002088 Handle<Object> name() const { return hydrogen()->name(); }
2089 bool is_in_object() { return hydrogen()->is_in_object(); }
2090 int offset() { return hydrogen()->offset(); }
2091 Handle<Map> transition() const { return hydrogen()->transition(); }
2092};
2093
2094
2095class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
2096 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002097 LStoreNamedGeneric(LOperand* object, LOperand* value) {
2098 inputs_[0] = object;
2099 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002100 }
2101
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002102 LOperand* object() { return inputs_[0]; }
2103 LOperand* value() { return inputs_[1]; }
2104
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002105 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2106 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2107
2108 virtual void PrintDataTo(StringStream* stream);
2109
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002110 Handle<Object> name() const { return hydrogen()->name(); }
2111 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002112};
2113
2114
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002115class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002116 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002117 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002118 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002119 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002120 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002121 }
2122
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002123 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002124 LOperand* elements() { return inputs_[0]; }
2125 LOperand* key() { return inputs_[1]; }
2126 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002127 ElementsKind elements_kind() const {
2128 return hydrogen()->elements_kind();
2129 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002130
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002131 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2132 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002133
2134 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00002135 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002136 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002137};
2138
2139
2140class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
2141 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002142 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002143 inputs_[0] = obj;
2144 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002145 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002146 }
2147
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002148 LOperand* object() { return inputs_[0]; }
2149 LOperand* key() { return inputs_[1]; }
2150 LOperand* value() { return inputs_[2]; }
2151
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002152 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2153 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2154
2155 virtual void PrintDataTo(StringStream* stream);
2156
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00002157 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002158};
2159
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002160
mstarzinger@chromium.orgf705b502013-04-04 11:38:09 +00002161class LTransitionElementsKind: public LTemplateInstruction<0, 1, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002162 public:
2163 LTransitionElementsKind(LOperand* object,
2164 LOperand* new_map_temp,
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002165 LOperand* fixed_object_temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002166 inputs_[0] = object;
2167 temps_[0] = new_map_temp;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002168 temps_[1] = fixed_object_temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002169 }
2170
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002171 LOperand* object() { return inputs_[0]; }
2172 LOperand* new_map_temp() { return temps_[0]; }
2173 LOperand* temp() { return temps_[1]; }
2174
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002175 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2176 "transition-elements-kind")
2177 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2178
2179 virtual void PrintDataTo(StringStream* stream);
2180
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002181 Handle<Map> original_map() { return hydrogen()->original_map(); }
2182 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002183 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2184 ElementsKind to_kind() { return hydrogen()->to_kind(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002185};
2186
2187
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002188class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> {
2189 public:
2190 LTrapAllocationMemento(LOperand* object,
2191 LOperand* temp) {
2192 inputs_[0] = object;
2193 temps_[0] = temp;
2194 }
2195
2196 LOperand* object() { return inputs_[0]; }
2197 LOperand* temp() { return temps_[0]; }
2198
2199 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2200 "trap-allocation-memento")
2201};
2202
2203
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002204class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2205 public:
2206 LStringAdd(LOperand* left, LOperand* right) {
2207 inputs_[0] = left;
2208 inputs_[1] = right;
2209 }
2210
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002211 LOperand* left() { return inputs_[0]; }
2212 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002213
2214 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2215 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002216};
2217
2218
2219
2220class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2221 public:
2222 LStringCharCodeAt(LOperand* string, LOperand* index) {
2223 inputs_[0] = string;
2224 inputs_[1] = index;
2225 }
2226
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002227 LOperand* string() { return inputs_[0]; }
2228 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002229
2230 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2231 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002232};
2233
2234
2235class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2236 public:
2237 explicit LStringCharFromCode(LOperand* char_code) {
2238 inputs_[0] = char_code;
2239 }
2240
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002241 LOperand* char_code() { return inputs_[0]; }
2242
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002243 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2244 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002245};
2246
2247
2248class LStringLength: public LTemplateInstruction<1, 1, 0> {
2249 public:
2250 explicit LStringLength(LOperand* string) {
2251 inputs_[0] = string;
2252 }
2253
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002254 LOperand* string() { return inputs_[0]; }
2255
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002256 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2257 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002258};
2259
2260
2261class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2262 public:
2263 explicit LCheckFunction(LOperand* value) {
2264 inputs_[0] = value;
2265 }
2266
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002267 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002268
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002269 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2270 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2271};
2272
2273
2274class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2275 public:
2276 explicit LCheckInstanceType(LOperand* value) {
2277 inputs_[0] = value;
2278 }
2279
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002280 LOperand* value() { return inputs_[0]; }
2281
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002282 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2283 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2284};
2285
2286
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002287class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002288 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002289 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002290 inputs_[0] = value;
2291 }
2292
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002293 LOperand* value() { return inputs_[0]; }
2294
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002295 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2296 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002297};
2298
2299
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002300class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002301 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002302 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2303 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002304 temps_[1] = temp2;
2305 }
2306
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002307 LOperand* temp() { return temps_[0]; }
2308 LOperand* temp2() { return temps_[1]; }
2309
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002310 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2311 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2312
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002313 ZoneList<Handle<JSObject> >* prototypes() const {
2314 return hydrogen()->prototypes();
2315 }
2316 ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002317};
2318
2319
2320class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2321 public:
2322 explicit LCheckSmi(LOperand* value) {
2323 inputs_[0] = value;
2324 }
2325
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002326 LOperand* value() { return inputs_[0]; }
2327
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002328 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2329};
2330
2331
2332class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2333 public:
2334 explicit LCheckNonSmi(LOperand* value) {
2335 inputs_[0] = value;
2336 }
2337
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002338 LOperand* value() { return inputs_[0]; }
2339
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002340 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2341};
2342
2343
2344class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2345 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002346 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2347 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002348 temps_[0] = temp;
2349 }
2350
2351 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002352 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002353
2354 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2355};
2356
2357
2358class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2359 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002360 explicit LClampIToUint8(LOperand* unclamped) {
2361 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002362 }
2363
2364 LOperand* unclamped() { return inputs_[0]; }
2365
2366 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2367};
2368
2369
2370class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2371 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002372 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2373 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002374 temps_[0] = temp;
2375 }
2376
2377 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002378 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002379
2380 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2381};
2382
2383
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002384class LAllocateObject: public LTemplateInstruction<1, 1, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002385 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002386 LAllocateObject(LOperand* temp, LOperand* temp2) {
2387 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002388 temps_[1] = temp2;
2389 }
2390
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002391 LOperand* temp() { return temps_[0]; }
2392 LOperand* temp2() { return temps_[1]; }
2393
ulan@chromium.org967e2702012-02-28 09:49:15 +00002394 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2395 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2396};
2397
2398
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002399class LAllocate: public LTemplateInstruction<1, 2, 2> {
2400 public:
2401 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2402 inputs_[1] = size;
2403 temps_[0] = temp1;
2404 temps_[1] = temp2;
2405 }
2406
2407 LOperand* size() { return inputs_[1]; }
2408 LOperand* temp1() { return temps_[0]; }
2409 LOperand* temp2() { return temps_[1]; }
2410
2411 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2412 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2413};
2414
2415
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002416class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2417 public:
2418 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2419 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2420};
2421
2422
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002423class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002424 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002425 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2426 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002427};
2428
2429
2430class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2431 public:
2432 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2433 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2434};
2435
2436
2437class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2438 public:
2439 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2440 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002441};
2442
2443
2444class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2445 public:
2446 explicit LToFastProperties(LOperand* value) {
2447 inputs_[0] = value;
2448 }
2449
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002450 LOperand* value() { return inputs_[0]; }
2451
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002452 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2453 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2454};
2455
2456
2457class LTypeof: public LTemplateInstruction<1, 1, 0> {
2458 public:
2459 explicit LTypeof(LOperand* value) {
2460 inputs_[0] = value;
2461 }
2462
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002463 LOperand* value() { return inputs_[0]; }
2464
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002465 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2466};
2467
2468
2469class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2470 public:
2471 explicit LTypeofIsAndBranch(LOperand* value) {
2472 inputs_[0] = value;
2473 }
2474
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002475 LOperand* value() { return inputs_[0]; }
2476
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002477 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2478 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2479
2480 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2481
2482 virtual void PrintDataTo(StringStream* stream);
2483};
2484
2485
2486class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2487 public:
2488 explicit LIsConstructCallAndBranch(LOperand* temp) {
2489 temps_[0] = temp;
2490 }
2491
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002492 LOperand* temp() { return temps_[0]; }
2493
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002494 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2495 "is-construct-call-and-branch")
2496};
2497
2498
2499class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2500 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002501 LDeleteProperty(LOperand* object, LOperand* key) {
2502 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002503 inputs_[1] = key;
2504 }
2505
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002506 LOperand* object() { return inputs_[0]; }
2507 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002508
2509 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002510};
2511
2512
2513class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2514 public:
2515 LOsrEntry();
2516
ulan@chromium.org32d7dba2013-04-24 10:59:06 +00002517 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002518 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2519
2520 LOperand** SpilledRegisterArray() { return register_spills_; }
2521 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2522
2523 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2524 void MarkSpilledDoubleRegister(int allocation_index,
2525 LOperand* spill_operand);
2526
2527 private:
2528 // Arrays of spill slot operands for registers with an assigned spill
2529 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2530 // NULL if the register has no assigned spill slot. Indexed by allocation
2531 // index.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002532 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters];
2533 LOperand* double_register_spills_[
2534 DoubleRegister::kMaxNumAllocatableRegisters];
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002535};
2536
2537
2538class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2539 public:
2540 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2541 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2542
2543 Label* done_label() { return &done_label_; }
2544
2545 private:
2546 Label done_label_;
2547};
2548
2549
2550class LIn: public LTemplateInstruction<1, 2, 0> {
2551 public:
2552 LIn(LOperand* key, LOperand* object) {
2553 inputs_[0] = key;
2554 inputs_[1] = object;
2555 }
2556
2557 LOperand* key() { return inputs_[0]; }
2558 LOperand* object() { return inputs_[1]; }
2559
2560 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2561};
2562
2563
ulan@chromium.org812308e2012-02-29 15:58:45 +00002564class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2565 public:
2566 explicit LForInPrepareMap(LOperand* object) {
2567 inputs_[0] = object;
2568 }
2569
2570 LOperand* object() { return inputs_[0]; }
2571
2572 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2573};
2574
2575
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002576class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002577 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002578 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002579 inputs_[0] = map;
2580 }
2581
2582 LOperand* map() { return inputs_[0]; }
2583
2584 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2585
2586 int idx() {
2587 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2588 }
2589};
2590
2591
2592class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2593 public:
2594 LCheckMapValue(LOperand* value, LOperand* map) {
2595 inputs_[0] = value;
2596 inputs_[1] = map;
2597 }
2598
2599 LOperand* value() { return inputs_[0]; }
2600 LOperand* map() { return inputs_[1]; }
2601
2602 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2603};
2604
2605
2606class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2607 public:
2608 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2609 inputs_[0] = object;
2610 inputs_[1] = index;
2611 }
2612
2613 LOperand* object() { return inputs_[0]; }
2614 LOperand* index() { return inputs_[1]; }
2615
2616 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2617};
2618
2619
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002620class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002621class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002622 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002623 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2624 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002625
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002626 int GetNextSpillIndex(bool is_double);
2627 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002628};
2629
2630
2631class LChunkBuilder BASE_EMBEDDED {
2632 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002633 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2634 : chunk_(NULL),
2635 info_(info),
2636 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002637 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002638 status_(UNUSED),
2639 current_instruction_(NULL),
2640 current_block_(NULL),
2641 next_block_(NULL),
2642 argument_count_(0),
2643 allocator_(allocator),
2644 position_(RelocInfo::kNoPosition),
2645 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002646 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002647
2648 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002649 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002650
2651 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002652#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002653 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2654#undef DECLARE_DO
2655
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002656 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2657
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002658 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2659 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2660 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2661 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2662 LInstruction* DoMathSin(HUnaryMathOperation* instr);
2663 LInstruction* DoMathCos(HUnaryMathOperation* instr);
2664 LInstruction* DoMathTan(HUnaryMathOperation* instr);
2665 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2666 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2667 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2668
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002669 private:
2670 enum Status {
2671 UNUSED,
2672 BUILDING,
2673 DONE,
2674 ABORTED
2675 };
2676
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002677 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002678 CompilationInfo* info() const { return info_; }
2679 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002680 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002681
2682 bool is_unused() const { return status_ == UNUSED; }
2683 bool is_building() const { return status_ == BUILDING; }
2684 bool is_done() const { return status_ == DONE; }
2685 bool is_aborted() const { return status_ == ABORTED; }
2686
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002687 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002688
2689 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002690 LUnallocated* ToUnallocated(Register reg);
2691 LUnallocated* ToUnallocated(DoubleRegister reg);
2692
2693 // Methods for setting up define-use relationships.
2694 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2695 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2696 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2697 DoubleRegister fixed_register);
2698
2699 // A value that is guaranteed to be allocated to a register.
2700 // Operand created by UseRegister is guaranteed to be live until the end of
2701 // instruction. This means that register allocator will not reuse it's
2702 // register for any other operand inside instruction.
2703 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2704 // instruction start. Register allocator is free to assign the same register
2705 // to some other operand used inside instruction (i.e. temporary or
2706 // output).
2707 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2708 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2709
2710 // An input operand in a register that may be trashed.
2711 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2712
2713 // An input operand in a register or stack slot.
2714 MUST_USE_RESULT LOperand* Use(HValue* value);
2715 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2716
2717 // An input operand in a register, stack slot or a constant operand.
2718 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2719 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2720
2721 // An input operand in a register or a constant operand.
2722 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2723 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2724
2725 // An input operand in register, stack slot or a constant operand.
2726 // Will not be moved to a register even if one is freely available.
2727 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2728
2729 // Temporary operand that must be in a register.
2730 MUST_USE_RESULT LUnallocated* TempRegister();
2731 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2732 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2733
2734 // Methods for setting up define-use relationships.
2735 // Return the same instruction that they are passed.
2736 template<int I, int T>
2737 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2738 LUnallocated* result);
2739 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002740 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2741 template<int I, int T>
2742 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2743 int index);
2744 template<int I, int T>
2745 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2746 template<int I, int T>
2747 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2748 Register reg);
2749 template<int I, int T>
2750 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2751 DoubleRegister reg);
2752 LInstruction* AssignEnvironment(LInstruction* instr);
2753 LInstruction* AssignPointerMap(LInstruction* instr);
2754
2755 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2756
2757 // By default we assume that instruction sequences generated for calls
2758 // cannot deoptimize eagerly and we do not attach environment to this
2759 // instruction.
2760 LInstruction* MarkAsCall(
2761 LInstruction* instr,
2762 HInstruction* hinstr,
2763 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002764
2765 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2766 int* argument_index_accumulator);
2767
2768 void VisitInstruction(HInstruction* current);
2769
2770 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2771 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2772 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2773 LInstruction* DoArithmeticD(Token::Value op,
2774 HArithmeticBinaryOperation* instr);
2775 LInstruction* DoArithmeticT(Token::Value op,
2776 HArithmeticBinaryOperation* instr);
2777
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002778 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002779 CompilationInfo* info_;
2780 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002781 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002782 Status status_;
2783 HInstruction* current_instruction_;
2784 HBasicBlock* current_block_;
2785 HBasicBlock* next_block_;
2786 int argument_count_;
2787 LAllocator* allocator_;
2788 int position_;
2789 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002790 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002791
lrn@chromium.org7516f052011-03-30 08:52:27 +00002792 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2793};
2794
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002795#undef DECLARE_HYDROGEN_ACCESSOR
2796#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002797
2798} } // namespace v8::internal
2799
2800#endif // V8_MIPS_LITHIUM_MIPS_H_