blob: 8b46e6fd396590d4245d04e4ea0e2eb8e07034fc [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(); }
danno@chromium.orgf005df62013-04-30 16:36:45 +00002092 Representation representation() const {
2093 return hydrogen()->field_representation();
2094 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002095};
2096
2097
2098class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
2099 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002100 LStoreNamedGeneric(LOperand* object, LOperand* value) {
2101 inputs_[0] = object;
2102 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002103 }
2104
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002105 LOperand* object() { return inputs_[0]; }
2106 LOperand* value() { return inputs_[1]; }
2107
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002108 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2109 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2110
2111 virtual void PrintDataTo(StringStream* stream);
2112
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002113 Handle<Object> name() const { return hydrogen()->name(); }
2114 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002115};
2116
2117
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002118class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002119 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002120 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002121 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002122 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002123 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002124 }
2125
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002126 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002127 LOperand* elements() { return inputs_[0]; }
2128 LOperand* key() { return inputs_[1]; }
2129 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002130 ElementsKind elements_kind() const {
2131 return hydrogen()->elements_kind();
2132 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002133
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002134 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2135 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002136
2137 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00002138 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002139 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002140};
2141
2142
2143class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
2144 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002145 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002146 inputs_[0] = obj;
2147 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002148 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002149 }
2150
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002151 LOperand* object() { return inputs_[0]; }
2152 LOperand* key() { return inputs_[1]; }
2153 LOperand* value() { return inputs_[2]; }
2154
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002155 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2156 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2157
2158 virtual void PrintDataTo(StringStream* stream);
2159
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00002160 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002161};
2162
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002163
mstarzinger@chromium.orgf705b502013-04-04 11:38:09 +00002164class LTransitionElementsKind: public LTemplateInstruction<0, 1, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002165 public:
2166 LTransitionElementsKind(LOperand* object,
2167 LOperand* new_map_temp,
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002168 LOperand* fixed_object_temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002169 inputs_[0] = object;
2170 temps_[0] = new_map_temp;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002171 temps_[1] = fixed_object_temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002172 }
2173
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002174 LOperand* object() { return inputs_[0]; }
2175 LOperand* new_map_temp() { return temps_[0]; }
2176 LOperand* temp() { return temps_[1]; }
2177
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002178 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2179 "transition-elements-kind")
2180 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2181
2182 virtual void PrintDataTo(StringStream* stream);
2183
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002184 Handle<Map> original_map() { return hydrogen()->original_map(); }
2185 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002186 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2187 ElementsKind to_kind() { return hydrogen()->to_kind(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002188};
2189
2190
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002191class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> {
2192 public:
2193 LTrapAllocationMemento(LOperand* object,
2194 LOperand* temp) {
2195 inputs_[0] = object;
2196 temps_[0] = temp;
2197 }
2198
2199 LOperand* object() { return inputs_[0]; }
2200 LOperand* temp() { return temps_[0]; }
2201
2202 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2203 "trap-allocation-memento")
2204};
2205
2206
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002207class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2208 public:
2209 LStringAdd(LOperand* left, LOperand* right) {
2210 inputs_[0] = left;
2211 inputs_[1] = right;
2212 }
2213
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002214 LOperand* left() { return inputs_[0]; }
2215 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002216
2217 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2218 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002219};
2220
2221
2222
2223class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2224 public:
2225 LStringCharCodeAt(LOperand* string, LOperand* index) {
2226 inputs_[0] = string;
2227 inputs_[1] = index;
2228 }
2229
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002230 LOperand* string() { return inputs_[0]; }
2231 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002232
2233 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2234 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002235};
2236
2237
2238class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2239 public:
2240 explicit LStringCharFromCode(LOperand* char_code) {
2241 inputs_[0] = char_code;
2242 }
2243
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002244 LOperand* char_code() { return inputs_[0]; }
2245
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002246 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2247 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002248};
2249
2250
2251class LStringLength: public LTemplateInstruction<1, 1, 0> {
2252 public:
2253 explicit LStringLength(LOperand* string) {
2254 inputs_[0] = string;
2255 }
2256
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002257 LOperand* string() { return inputs_[0]; }
2258
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002259 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2260 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002261};
2262
2263
2264class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2265 public:
2266 explicit LCheckFunction(LOperand* value) {
2267 inputs_[0] = value;
2268 }
2269
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002270 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002271
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002272 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2273 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2274};
2275
2276
2277class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2278 public:
2279 explicit LCheckInstanceType(LOperand* value) {
2280 inputs_[0] = value;
2281 }
2282
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002283 LOperand* value() { return inputs_[0]; }
2284
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002285 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2286 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2287};
2288
2289
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002290class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002291 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002292 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002293 inputs_[0] = value;
2294 }
2295
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002296 LOperand* value() { return inputs_[0]; }
2297
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002298 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2299 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002300};
2301
2302
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002303class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002304 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002305 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2306 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002307 temps_[1] = temp2;
2308 }
2309
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002310 LOperand* temp() { return temps_[0]; }
2311 LOperand* temp2() { return temps_[1]; }
2312
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002313 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2314 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2315
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002316 ZoneList<Handle<JSObject> >* prototypes() const {
2317 return hydrogen()->prototypes();
2318 }
2319 ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002320};
2321
2322
2323class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2324 public:
2325 explicit LCheckSmi(LOperand* value) {
2326 inputs_[0] = value;
2327 }
2328
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002329 LOperand* value() { return inputs_[0]; }
2330
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002331 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2332};
2333
2334
2335class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2336 public:
2337 explicit LCheckNonSmi(LOperand* value) {
2338 inputs_[0] = value;
2339 }
2340
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002341 LOperand* value() { return inputs_[0]; }
2342
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002343 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2344};
2345
2346
2347class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2348 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002349 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2350 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002351 temps_[0] = temp;
2352 }
2353
2354 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002355 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002356
2357 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2358};
2359
2360
2361class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2362 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002363 explicit LClampIToUint8(LOperand* unclamped) {
2364 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002365 }
2366
2367 LOperand* unclamped() { return inputs_[0]; }
2368
2369 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2370};
2371
2372
2373class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2374 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002375 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2376 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002377 temps_[0] = temp;
2378 }
2379
2380 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002381 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002382
2383 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2384};
2385
2386
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002387class LAllocateObject: public LTemplateInstruction<1, 1, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002388 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002389 LAllocateObject(LOperand* temp, LOperand* temp2) {
2390 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002391 temps_[1] = temp2;
2392 }
2393
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002394 LOperand* temp() { return temps_[0]; }
2395 LOperand* temp2() { return temps_[1]; }
2396
ulan@chromium.org967e2702012-02-28 09:49:15 +00002397 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2398 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2399};
2400
2401
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002402class LAllocate: public LTemplateInstruction<1, 2, 2> {
2403 public:
2404 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2405 inputs_[1] = size;
2406 temps_[0] = temp1;
2407 temps_[1] = temp2;
2408 }
2409
2410 LOperand* size() { return inputs_[1]; }
2411 LOperand* temp1() { return temps_[0]; }
2412 LOperand* temp2() { return temps_[1]; }
2413
2414 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2415 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2416};
2417
2418
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002419class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2420 public:
2421 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2422 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2423};
2424
2425
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002426class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002427 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002428 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2429 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002430};
2431
2432
2433class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2434 public:
2435 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2436 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2437};
2438
2439
2440class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2441 public:
2442 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2443 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002444};
2445
2446
2447class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2448 public:
2449 explicit LToFastProperties(LOperand* value) {
2450 inputs_[0] = value;
2451 }
2452
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002453 LOperand* value() { return inputs_[0]; }
2454
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002455 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2456 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2457};
2458
2459
2460class LTypeof: public LTemplateInstruction<1, 1, 0> {
2461 public:
2462 explicit LTypeof(LOperand* value) {
2463 inputs_[0] = value;
2464 }
2465
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002466 LOperand* value() { return inputs_[0]; }
2467
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002468 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2469};
2470
2471
2472class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2473 public:
2474 explicit LTypeofIsAndBranch(LOperand* value) {
2475 inputs_[0] = value;
2476 }
2477
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002478 LOperand* value() { return inputs_[0]; }
2479
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002480 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2481 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2482
2483 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2484
2485 virtual void PrintDataTo(StringStream* stream);
2486};
2487
2488
2489class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2490 public:
2491 explicit LIsConstructCallAndBranch(LOperand* temp) {
2492 temps_[0] = temp;
2493 }
2494
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002495 LOperand* temp() { return temps_[0]; }
2496
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002497 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2498 "is-construct-call-and-branch")
2499};
2500
2501
2502class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2503 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002504 LDeleteProperty(LOperand* object, LOperand* key) {
2505 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002506 inputs_[1] = key;
2507 }
2508
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002509 LOperand* object() { return inputs_[0]; }
2510 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002511
2512 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002513};
2514
2515
2516class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2517 public:
2518 LOsrEntry();
2519
ulan@chromium.org32d7dba2013-04-24 10:59:06 +00002520 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002521 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2522
2523 LOperand** SpilledRegisterArray() { return register_spills_; }
2524 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2525
2526 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2527 void MarkSpilledDoubleRegister(int allocation_index,
2528 LOperand* spill_operand);
2529
2530 private:
2531 // Arrays of spill slot operands for registers with an assigned spill
2532 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2533 // NULL if the register has no assigned spill slot. Indexed by allocation
2534 // index.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002535 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters];
2536 LOperand* double_register_spills_[
2537 DoubleRegister::kMaxNumAllocatableRegisters];
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002538};
2539
2540
2541class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2542 public:
2543 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2544 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2545
2546 Label* done_label() { return &done_label_; }
2547
2548 private:
2549 Label done_label_;
2550};
2551
2552
2553class LIn: public LTemplateInstruction<1, 2, 0> {
2554 public:
2555 LIn(LOperand* key, LOperand* object) {
2556 inputs_[0] = key;
2557 inputs_[1] = object;
2558 }
2559
2560 LOperand* key() { return inputs_[0]; }
2561 LOperand* object() { return inputs_[1]; }
2562
2563 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2564};
2565
2566
ulan@chromium.org812308e2012-02-29 15:58:45 +00002567class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2568 public:
2569 explicit LForInPrepareMap(LOperand* object) {
2570 inputs_[0] = object;
2571 }
2572
2573 LOperand* object() { return inputs_[0]; }
2574
2575 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2576};
2577
2578
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002579class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002580 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002581 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002582 inputs_[0] = map;
2583 }
2584
2585 LOperand* map() { return inputs_[0]; }
2586
2587 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2588
2589 int idx() {
2590 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2591 }
2592};
2593
2594
2595class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2596 public:
2597 LCheckMapValue(LOperand* value, LOperand* map) {
2598 inputs_[0] = value;
2599 inputs_[1] = map;
2600 }
2601
2602 LOperand* value() { return inputs_[0]; }
2603 LOperand* map() { return inputs_[1]; }
2604
2605 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2606};
2607
2608
2609class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2610 public:
2611 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2612 inputs_[0] = object;
2613 inputs_[1] = index;
2614 }
2615
2616 LOperand* object() { return inputs_[0]; }
2617 LOperand* index() { return inputs_[1]; }
2618
2619 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2620};
2621
2622
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002623class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002624class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002625 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002626 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2627 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002628
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002629 int GetNextSpillIndex(bool is_double);
2630 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002631};
2632
2633
2634class LChunkBuilder BASE_EMBEDDED {
2635 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002636 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2637 : chunk_(NULL),
2638 info_(info),
2639 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002640 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002641 status_(UNUSED),
2642 current_instruction_(NULL),
2643 current_block_(NULL),
2644 next_block_(NULL),
2645 argument_count_(0),
2646 allocator_(allocator),
2647 position_(RelocInfo::kNoPosition),
2648 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002649 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002650
2651 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002652 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002653
2654 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002655#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002656 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2657#undef DECLARE_DO
2658
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002659 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2660
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002661 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2662 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2663 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2664 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2665 LInstruction* DoMathSin(HUnaryMathOperation* instr);
2666 LInstruction* DoMathCos(HUnaryMathOperation* instr);
2667 LInstruction* DoMathTan(HUnaryMathOperation* instr);
2668 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2669 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2670 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2671
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002672 private:
2673 enum Status {
2674 UNUSED,
2675 BUILDING,
2676 DONE,
2677 ABORTED
2678 };
2679
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002680 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002681 CompilationInfo* info() const { return info_; }
2682 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002683 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002684
2685 bool is_unused() const { return status_ == UNUSED; }
2686 bool is_building() const { return status_ == BUILDING; }
2687 bool is_done() const { return status_ == DONE; }
2688 bool is_aborted() const { return status_ == ABORTED; }
2689
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002690 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002691
2692 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002693 LUnallocated* ToUnallocated(Register reg);
2694 LUnallocated* ToUnallocated(DoubleRegister reg);
2695
2696 // Methods for setting up define-use relationships.
2697 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2698 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2699 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2700 DoubleRegister fixed_register);
2701
2702 // A value that is guaranteed to be allocated to a register.
2703 // Operand created by UseRegister is guaranteed to be live until the end of
2704 // instruction. This means that register allocator will not reuse it's
2705 // register for any other operand inside instruction.
2706 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2707 // instruction start. Register allocator is free to assign the same register
2708 // to some other operand used inside instruction (i.e. temporary or
2709 // output).
2710 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2711 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2712
2713 // An input operand in a register that may be trashed.
2714 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2715
2716 // An input operand in a register or stack slot.
2717 MUST_USE_RESULT LOperand* Use(HValue* value);
2718 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2719
2720 // An input operand in a register, stack slot or a constant operand.
2721 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2722 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2723
2724 // An input operand in a register or a constant operand.
2725 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2726 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2727
danno@chromium.orgf005df62013-04-30 16:36:45 +00002728 // An input operand in a constant operand.
2729 MUST_USE_RESULT LOperand* UseConstant(HValue* value);
2730
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002731 // An input operand in register, stack slot or a constant operand.
2732 // Will not be moved to a register even if one is freely available.
2733 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2734
2735 // Temporary operand that must be in a register.
2736 MUST_USE_RESULT LUnallocated* TempRegister();
2737 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2738 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2739
2740 // Methods for setting up define-use relationships.
2741 // Return the same instruction that they are passed.
2742 template<int I, int T>
2743 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2744 LUnallocated* result);
2745 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002746 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2747 template<int I, int T>
2748 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2749 int index);
2750 template<int I, int T>
2751 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2752 template<int I, int T>
2753 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2754 Register reg);
2755 template<int I, int T>
2756 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2757 DoubleRegister reg);
2758 LInstruction* AssignEnvironment(LInstruction* instr);
2759 LInstruction* AssignPointerMap(LInstruction* instr);
2760
2761 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2762
2763 // By default we assume that instruction sequences generated for calls
2764 // cannot deoptimize eagerly and we do not attach environment to this
2765 // instruction.
2766 LInstruction* MarkAsCall(
2767 LInstruction* instr,
2768 HInstruction* hinstr,
2769 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002770
2771 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2772 int* argument_index_accumulator);
2773
2774 void VisitInstruction(HInstruction* current);
2775
2776 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2777 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2778 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2779 LInstruction* DoArithmeticD(Token::Value op,
2780 HArithmeticBinaryOperation* instr);
2781 LInstruction* DoArithmeticT(Token::Value op,
2782 HArithmeticBinaryOperation* instr);
2783
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002784 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002785 CompilationInfo* info_;
2786 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002787 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002788 Status status_;
2789 HInstruction* current_instruction_;
2790 HBasicBlock* current_block_;
2791 HBasicBlock* next_block_;
2792 int argument_count_;
2793 LAllocator* allocator_;
2794 int position_;
2795 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002796 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002797
lrn@chromium.org7516f052011-03-30 08:52:27 +00002798 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2799};
2800
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002801#undef DECLARE_HYDROGEN_ACCESSOR
2802#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002803
2804} } // namespace v8::internal
2805
2806#endif // V8_MIPS_LITHIUM_MIPS_H_