blob: 01dd6c2438247ede4897620495f33a016a3ba994 [file] [log] [blame]
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001// Copyright 2012 the V8 project authors. All rights reserved.
lrn@chromium.org7516f052011-03-30 08:52:27 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef V8_MIPS_LITHIUM_MIPS_H_
29#define V8_MIPS_LITHIUM_MIPS_H_
30
31#include "hydrogen.h"
32#include "lithium-allocator.h"
33#include "lithium.h"
34#include "safepoint-table.h"
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000035#include "utils.h"
lrn@chromium.org7516f052011-03-30 08:52:27 +000036
37namespace v8 {
38namespace internal {
39
40// Forward declarations.
41class LCodeGen;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000042
43#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
44 V(ControlInstruction) \
45 V(Call) \
46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
47
48
49#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
50 V(AccessArgumentsAt) \
51 V(AddI) \
ulan@chromium.org967e2702012-02-28 09:49:15 +000052 V(AllocateObject) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +000053 V(Allocate) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000054 V(ApplyArguments) \
55 V(ArgumentsElements) \
56 V(ArgumentsLength) \
57 V(ArithmeticD) \
58 V(ArithmeticT) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000059 V(BitI) \
60 V(BitNotI) \
61 V(BoundsCheck) \
62 V(Branch) \
63 V(CallConstantFunction) \
64 V(CallFunction) \
65 V(CallGlobal) \
66 V(CallKeyed) \
67 V(CallKnownGlobal) \
68 V(CallNamed) \
69 V(CallNew) \
ulan@chromium.org750145a2013-03-07 15:14:13 +000070 V(CallNewArray) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000071 V(CallRuntime) \
72 V(CallStub) \
73 V(CheckFunction) \
74 V(CheckInstanceType) \
jkummerow@chromium.org1456e702012-03-30 08:38:13 +000075 V(CheckMaps) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000076 V(CheckNonSmi) \
77 V(CheckPrototypeMaps) \
78 V(CheckSmi) \
79 V(ClampDToUint8) \
80 V(ClampIToUint8) \
81 V(ClampTToUint8) \
82 V(ClassOfTestAndBranch) \
83 V(CmpConstantEqAndBranch) \
84 V(CmpIDAndBranch) \
85 V(CmpObjectEqAndBranch) \
86 V(CmpMapAndBranch) \
87 V(CmpT) \
88 V(ConstantD) \
89 V(ConstantI) \
rossberg@chromium.orgb99c7542013-05-31 11:40:45 +000090 V(ConstantS) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000091 V(ConstantT) \
92 V(Context) \
jkummerow@chromium.org4e308cf2013-05-17 13:39:16 +000093 V(DebugBreak) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000094 V(DeclareGlobals) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000095 V(DeleteProperty) \
96 V(Deoptimize) \
97 V(DivI) \
98 V(DoubleToI) \
svenpanne@chromium.orga53e8e02013-05-24 12:35:50 +000099 V(DoubleToSmi) \
yangguo@chromium.org46a2a512013-01-18 16:29:40 +0000100 V(DummyUse) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000101 V(ElementsKind) \
102 V(FixedArrayBaseLength) \
103 V(FunctionLiteral) \
104 V(GetCachedArrayIndex) \
105 V(GlobalObject) \
106 V(GlobalReceiver) \
107 V(Goto) \
108 V(HasCachedArrayIndexAndBranch) \
109 V(HasInstanceTypeAndBranch) \
110 V(In) \
111 V(InstanceOf) \
112 V(InstanceOfKnownGlobal) \
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +0000113 V(InstanceSize) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000114 V(InstructionGap) \
115 V(Integer32ToDouble) \
svenpanne@chromium.orga53e8e02013-05-24 12:35:50 +0000116 V(Integer32ToSmi) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000117 V(Uint32ToDouble) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000118 V(InvokeFunction) \
119 V(IsConstructCallAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000120 V(IsObjectAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000121 V(IsStringAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000122 V(IsSmiAndBranch) \
123 V(IsUndetectableAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000124 V(Label) \
125 V(LazyBailout) \
126 V(LoadContextSlot) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000127 V(LoadExternalArrayPointer) \
128 V(LoadFunctionPrototype) \
129 V(LoadGlobalCell) \
130 V(LoadGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000131 V(LoadKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000132 V(LoadKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000133 V(LoadNamedField) \
134 V(LoadNamedFieldPolymorphic) \
135 V(LoadNamedGeneric) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000136 V(MapEnumLength) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000137 V(MathAbs) \
138 V(MathCos) \
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000139 V(MathExp) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000140 V(MathFloor) \
141 V(MathLog) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000142 V(MathMinMax) \
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000143 V(MathPowHalf) \
144 V(MathRound) \
145 V(MathSin) \
146 V(MathSqrt) \
147 V(MathTan) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000148 V(ModI) \
149 V(MulI) \
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000150 V(MultiplyAddD) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000151 V(NumberTagD) \
152 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000153 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000154 V(NumberUntagD) \
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.org4e308cf2013-05-17 13:39:16 +0000662class LDebugBreak: public LTemplateInstruction<0, 0, 0> {
663 public:
664 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
665};
666
667
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000668class LCmpIDAndBranch: public LControlInstruction<2, 0> {
669 public:
670 LCmpIDAndBranch(LOperand* left, LOperand* right) {
671 inputs_[0] = left;
672 inputs_[1] = right;
673 }
674
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000675 LOperand* left() { return inputs_[0]; }
676 LOperand* right() { return inputs_[1]; }
677
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000678 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
679 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
680
681 Token::Value op() const { return hydrogen()->token(); }
682 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000683 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000684 }
685
686 virtual void PrintDataTo(StringStream* stream);
687};
688
689
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000690class LMathFloor: public LTemplateInstruction<1, 1, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000691 public:
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000692 LMathFloor(LOperand* value, LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000693 inputs_[0] = value;
694 temps_[0] = temp;
695 }
696
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000697 LOperand* value() { return inputs_[0]; }
698 LOperand* temp() { return temps_[0]; }
699
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000700 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000701 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000702};
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000703
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000704
705class LMathRound: public LTemplateInstruction<1, 1, 1> {
706 public:
707 LMathRound(LOperand* value, LOperand* temp) {
708 inputs_[0] = value;
709 temps_[0] = temp;
710 }
711
712 LOperand* value() { return inputs_[0]; }
713 LOperand* temp() { return temps_[0]; }
714
715 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round")
716 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
717};
718
719
720class LMathAbs: public LTemplateInstruction<1, 1, 0> {
721 public:
722 explicit LMathAbs(LOperand* value) {
723 inputs_[0] = value;
724 }
725
726 LOperand* value() { return inputs_[0]; }
727
728 DECLARE_CONCRETE_INSTRUCTION(MathAbs, "math-abs")
729 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
730};
731
732
733class LMathLog: public LTemplateInstruction<1, 1, 0> {
734 public:
735 explicit LMathLog(LOperand* value) {
736 inputs_[0] = value;
737 }
738
739 LOperand* value() { return inputs_[0]; }
740
741 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
742};
743
744
745class LMathSin: public LTemplateInstruction<1, 1, 0> {
746 public:
747 explicit LMathSin(LOperand* value) {
748 inputs_[0] = value;
749 }
750
751 LOperand* value() { return inputs_[0]; }
752
753 DECLARE_CONCRETE_INSTRUCTION(MathSin, "math-sin")
754};
755
756
757class LMathCos: public LTemplateInstruction<1, 1, 0> {
758 public:
759 explicit LMathCos(LOperand* value) {
760 inputs_[0] = value;
761 }
762
763 LOperand* value() { return inputs_[0]; }
764
765 DECLARE_CONCRETE_INSTRUCTION(MathCos, "math-cos")
766};
767
768
769class LMathTan: public LTemplateInstruction<1, 1, 0> {
770 public:
771 explicit LMathTan(LOperand* value) {
772 inputs_[0] = value;
773 }
774
775 LOperand* value() { return inputs_[0]; }
776
777 DECLARE_CONCRETE_INSTRUCTION(MathTan, "math-tan")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000778};
779
780
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000781class LMathExp: public LTemplateInstruction<1, 1, 3> {
782 public:
783 LMathExp(LOperand* value,
784 LOperand* double_temp,
785 LOperand* temp1,
786 LOperand* temp2) {
787 inputs_[0] = value;
788 temps_[0] = temp1;
789 temps_[1] = temp2;
790 temps_[2] = double_temp;
791 ExternalReference::InitializeMathExpData();
792 }
793
794 LOperand* value() { return inputs_[0]; }
795 LOperand* temp1() { return temps_[0]; }
796 LOperand* temp2() { return temps_[1]; }
797 LOperand* double_temp() { return temps_[2]; }
798
799 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000800};
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000801
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +0000802
803class LMathSqrt: public LTemplateInstruction<1, 1, 0> {
804 public:
805 explicit LMathSqrt(LOperand* value) {
806 inputs_[0] = value;
807 }
808
809 LOperand* value() { return inputs_[0]; }
810
811 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
812};
813
814
815class LMathPowHalf: public LTemplateInstruction<1, 1, 1> {
816 public:
817 LMathPowHalf(LOperand* value, LOperand* temp) {
818 inputs_[0] = value;
819 temps_[0] = temp;
820 }
821
822 LOperand* value() { return inputs_[0]; }
823 LOperand* temp() { return temps_[0]; }
824
825 DECLARE_CONCRETE_INSTRUCTION(MathPowHalf, "math-pow-half")
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000826};
827
828
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000829class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
830 public:
831 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
832 inputs_[0] = left;
833 inputs_[1] = right;
834 }
835
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000836 LOperand* left() { return inputs_[0]; }
837 LOperand* right() { return inputs_[1]; }
838
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000839 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
840 "cmp-object-eq-and-branch")
841 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
842};
843
844
845class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
846 public:
847 explicit LCmpConstantEqAndBranch(LOperand* left) {
848 inputs_[0] = left;
849 }
850
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000851 LOperand* left() { return inputs_[0]; }
852
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000853 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
854 "cmp-constant-eq-and-branch")
855 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
856};
857
858
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000859class LIsObjectAndBranch: public LControlInstruction<1, 1> {
860 public:
861 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
862 inputs_[0] = value;
863 temps_[0] = temp;
864 }
865
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000866 LOperand* value() { return inputs_[0]; }
867 LOperand* temp() { return temps_[0]; }
868
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000869 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
870 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
871
872 virtual void PrintDataTo(StringStream* stream);
873};
874
875
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000876class LIsStringAndBranch: public LControlInstruction<1, 1> {
877 public:
878 LIsStringAndBranch(LOperand* value, LOperand* temp) {
879 inputs_[0] = value;
880 temps_[0] = temp;
881 }
882
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000883 LOperand* value() { return inputs_[0]; }
884 LOperand* temp() { return temps_[0]; }
885
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000886 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
887 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
888
889 virtual void PrintDataTo(StringStream* stream);
890};
891
892
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000893class LIsSmiAndBranch: public LControlInstruction<1, 0> {
894 public:
895 explicit LIsSmiAndBranch(LOperand* value) {
896 inputs_[0] = value;
897 }
898
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000899 LOperand* value() { return inputs_[0]; }
900
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000901 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
902 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
903
904 virtual void PrintDataTo(StringStream* stream);
905};
906
907
908class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
909 public:
910 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
911 inputs_[0] = value;
912 temps_[0] = temp;
913 }
914
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000915 LOperand* value() { return inputs_[0]; }
916 LOperand* temp() { return temps_[0]; }
917
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000918 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
919 "is-undetectable-and-branch")
920 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
921
922 virtual void PrintDataTo(StringStream* stream);
923};
924
925
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000926class LStringCompareAndBranch: public LControlInstruction<2, 0> {
927 public:
928 LStringCompareAndBranch(LOperand* left, LOperand* right) {
929 inputs_[0] = left;
930 inputs_[1] = right;
931 }
932
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000933 LOperand* left() { return inputs_[0]; }
934 LOperand* right() { return inputs_[1]; }
935
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000936 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
937 "string-compare-and-branch")
938 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
939
940 Token::Value op() const { return hydrogen()->token(); }
941
942 virtual void PrintDataTo(StringStream* stream);
943};
944
945
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000946class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
947 public:
948 explicit LHasInstanceTypeAndBranch(LOperand* value) {
949 inputs_[0] = value;
950 }
951
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000952 LOperand* value() { return inputs_[0]; }
953
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000954 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
955 "has-instance-type-and-branch")
956 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
957
958 virtual void PrintDataTo(StringStream* stream);
959};
960
961
962class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
963 public:
964 explicit LGetCachedArrayIndex(LOperand* value) {
965 inputs_[0] = value;
966 }
967
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000968 LOperand* value() { return inputs_[0]; }
969
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000970 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
971 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
972};
973
974
975class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
976 public:
977 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
978 inputs_[0] = value;
979 }
980
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000981 LOperand* value() { return inputs_[0]; }
982
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000983 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
984 "has-cached-array-index-and-branch")
985 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
986
987 virtual void PrintDataTo(StringStream* stream);
988};
989
990
991class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
992 public:
993 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
994 inputs_[0] = value;
995 temps_[0] = temp;
996 }
997
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000998 LOperand* value() { return inputs_[0]; }
999 LOperand* temp() { return temps_[0]; }
1000
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001001 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
1002 "class-of-test-and-branch")
1003 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
1004
1005 virtual void PrintDataTo(StringStream* stream);
1006};
1007
1008
1009class LCmpT: public LTemplateInstruction<1, 2, 0> {
1010 public:
1011 LCmpT(LOperand* left, LOperand* right) {
1012 inputs_[0] = left;
1013 inputs_[1] = right;
1014 }
1015
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001016 LOperand* left() { return inputs_[0]; }
1017 LOperand* right() { return inputs_[1]; }
1018
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001019 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
1020 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
1021
1022 Token::Value op() const { return hydrogen()->token(); }
1023};
1024
1025
1026class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
1027 public:
1028 LInstanceOf(LOperand* left, LOperand* right) {
1029 inputs_[0] = left;
1030 inputs_[1] = right;
1031 }
1032
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001033 LOperand* left() { return inputs_[0]; }
1034 LOperand* right() { return inputs_[1]; }
1035
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001036 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
1037};
1038
1039
1040class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
1041 public:
1042 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
1043 inputs_[0] = value;
1044 temps_[0] = temp;
1045 }
1046
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001047 LOperand* value() { return inputs_[0]; }
1048 LOperand* temp() { return temps_[0]; }
1049
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001050 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
1051 "instance-of-known-global")
1052 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1053
1054 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +00001055 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
1056 return lazy_deopt_env_;
1057 }
1058 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
1059 lazy_deopt_env_ = env;
1060 }
1061
1062 private:
1063 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001064};
1065
1066
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +00001067class LInstanceSize: public LTemplateInstruction<1, 1, 0> {
1068 public:
1069 explicit LInstanceSize(LOperand* object) {
1070 inputs_[0] = object;
1071 }
1072
1073 LOperand* object() { return inputs_[0]; }
1074
1075 DECLARE_CONCRETE_INSTRUCTION(InstanceSize, "instance-size")
1076 DECLARE_HYDROGEN_ACCESSOR(InstanceSize)
1077};
1078
1079
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001080class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
1081 public:
1082 LBoundsCheck(LOperand* index, LOperand* length) {
1083 inputs_[0] = index;
1084 inputs_[1] = length;
1085 }
1086
1087 LOperand* index() { return inputs_[0]; }
1088 LOperand* length() { return inputs_[1]; }
1089
1090 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +00001091 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001092};
1093
1094
1095class LBitI: public LTemplateInstruction<1, 2, 0> {
1096 public:
1097 LBitI(LOperand* left, LOperand* right) {
1098 inputs_[0] = left;
1099 inputs_[1] = right;
1100 }
1101
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001102 LOperand* left() { return inputs_[0]; }
1103 LOperand* right() { return inputs_[1]; }
1104
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001105 Token::Value op() const { return hydrogen()->op(); }
1106
1107 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1108 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1109};
1110
1111
1112class LShiftI: public LTemplateInstruction<1, 2, 0> {
1113 public:
1114 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1115 : op_(op), can_deopt_(can_deopt) {
1116 inputs_[0] = left;
1117 inputs_[1] = right;
1118 }
1119
1120 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001121 LOperand* left() { return inputs_[0]; }
1122 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001123 bool can_deopt() const { return can_deopt_; }
1124
1125 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1126
1127 private:
1128 Token::Value op_;
1129 bool can_deopt_;
1130};
1131
1132
1133class LSubI: public LTemplateInstruction<1, 2, 0> {
1134 public:
1135 LSubI(LOperand* left, LOperand* right) {
1136 inputs_[0] = left;
1137 inputs_[1] = right;
1138 }
1139
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001140 LOperand* left() { return inputs_[0]; }
1141 LOperand* right() { return inputs_[1]; }
1142
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001143 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1144 DECLARE_HYDROGEN_ACCESSOR(Sub)
1145};
1146
1147
1148class LConstantI: public LTemplateInstruction<1, 0, 0> {
1149 public:
1150 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1151 DECLARE_HYDROGEN_ACCESSOR(Constant)
1152
1153 int32_t value() const { return hydrogen()->Integer32Value(); }
1154};
1155
1156
rossberg@chromium.orgb99c7542013-05-31 11:40:45 +00001157class LConstantS: public LTemplateInstruction<1, 0, 0> {
1158 public:
1159 DECLARE_CONCRETE_INSTRUCTION(ConstantS, "constant-s")
1160 DECLARE_HYDROGEN_ACCESSOR(Constant)
1161
1162 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); }
1163};
1164
1165
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001166class LConstantD: public LTemplateInstruction<1, 0, 0> {
1167 public:
1168 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1169 DECLARE_HYDROGEN_ACCESSOR(Constant)
1170
1171 double value() const { return hydrogen()->DoubleValue(); }
1172};
1173
1174
1175class LConstantT: public LTemplateInstruction<1, 0, 0> {
1176 public:
1177 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1178 DECLARE_HYDROGEN_ACCESSOR(Constant)
1179
1180 Handle<Object> value() const { return hydrogen()->handle(); }
1181};
1182
1183
1184class LBranch: public LControlInstruction<1, 0> {
1185 public:
1186 explicit LBranch(LOperand* value) {
1187 inputs_[0] = value;
1188 }
1189
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001190 LOperand* value() { return inputs_[0]; }
1191
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001192 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1193 DECLARE_HYDROGEN_ACCESSOR(Branch)
1194
1195 virtual void PrintDataTo(StringStream* stream);
1196};
1197
1198
1199class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1200 public:
1201 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1202 inputs_[0] = value;
1203 temps_[0] = temp;
1204 }
1205
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001206 LOperand* value() { return inputs_[0]; }
1207 LOperand* temp() { return temps_[0]; }
1208
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001209 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1210 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1211
1212 virtual bool IsControl() const { return true; }
1213
1214 Handle<Map> map() const { return hydrogen()->map(); }
1215 int true_block_id() const {
1216 return hydrogen()->FirstSuccessor()->block_id();
1217 }
1218 int false_block_id() const {
1219 return hydrogen()->SecondSuccessor()->block_id();
1220 }
1221};
1222
1223
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001224class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1225 public:
1226 explicit LFixedArrayBaseLength(LOperand* value) {
1227 inputs_[0] = value;
1228 }
1229
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001230 LOperand* value() { return inputs_[0]; }
1231
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001232 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1233 "fixed-array-base-length")
1234 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1235};
1236
1237
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001238class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1239 public:
1240 explicit LMapEnumLength(LOperand* value) {
1241 inputs_[0] = value;
1242 }
1243
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001244 LOperand* value() { return inputs_[0]; }
1245
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001246 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1247};
1248
1249
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001250class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1251 public:
1252 explicit LElementsKind(LOperand* value) {
1253 inputs_[0] = value;
1254 }
1255
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001256 LOperand* value() { return inputs_[0]; }
1257
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001258 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1259 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1260};
1261
1262
1263class LValueOf: public LTemplateInstruction<1, 1, 1> {
1264 public:
1265 LValueOf(LOperand* value, LOperand* temp) {
1266 inputs_[0] = value;
1267 temps_[0] = temp;
1268 }
1269
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001270 LOperand* value() { return inputs_[0]; }
1271 LOperand* temp() { return temps_[0]; }
1272
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001273 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1274 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1275};
1276
1277
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001278class LDateField: public LTemplateInstruction<1, 1, 1> {
1279 public:
1280 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1281 inputs_[0] = date;
1282 temps_[0] = temp;
1283 }
1284
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001285 LOperand* date() { return inputs_[0]; }
1286 LOperand* temp() { return temps_[0]; }
1287 Smi* index() const { return index_; }
1288
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001289 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1290 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001291
1292 private:
1293 Smi* index_;
1294};
1295
1296
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +00001297class LSeqStringSetChar: public LTemplateInstruction<1, 3, 0> {
1298 public:
1299 LSeqStringSetChar(String::Encoding encoding,
1300 LOperand* string,
1301 LOperand* index,
1302 LOperand* value) : encoding_(encoding) {
1303 inputs_[0] = string;
1304 inputs_[1] = index;
1305 inputs_[2] = value;
1306 }
1307
1308 String::Encoding encoding() { return encoding_; }
1309 LOperand* string() { return inputs_[0]; }
1310 LOperand* index() { return inputs_[1]; }
1311 LOperand* value() { return inputs_[2]; }
1312
1313 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1314 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1315
1316 private:
1317 String::Encoding encoding_;
1318};
1319
1320
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001321class LThrow: public LTemplateInstruction<0, 1, 0> {
1322 public:
1323 explicit LThrow(LOperand* value) {
1324 inputs_[0] = value;
1325 }
1326
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001327 LOperand* value() { return inputs_[0]; }
1328
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001329 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1330};
1331
1332
1333class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1334 public:
1335 explicit LBitNotI(LOperand* value) {
1336 inputs_[0] = value;
1337 }
1338
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001339 LOperand* value() { return inputs_[0]; }
1340
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001341 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1342};
1343
1344
1345class LAddI: public LTemplateInstruction<1, 2, 0> {
1346 public:
1347 LAddI(LOperand* left, LOperand* right) {
1348 inputs_[0] = left;
1349 inputs_[1] = right;
1350 }
1351
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001352 LOperand* left() { return inputs_[0]; }
1353 LOperand* right() { return inputs_[1]; }
1354
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001355 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1356 DECLARE_HYDROGEN_ACCESSOR(Add)
1357};
1358
1359
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001360class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1361 public:
1362 LMathMinMax(LOperand* left, LOperand* right) {
1363 inputs_[0] = left;
1364 inputs_[1] = right;
1365 }
1366
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001367 LOperand* left() { return inputs_[0]; }
1368 LOperand* right() { return inputs_[1]; }
1369
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00001370 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "math-min-max")
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001371 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1372};
1373
1374
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001375class LPower: public LTemplateInstruction<1, 2, 0> {
1376 public:
1377 LPower(LOperand* left, LOperand* right) {
1378 inputs_[0] = left;
1379 inputs_[1] = right;
1380 }
1381
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001382 LOperand* left() { return inputs_[0]; }
1383 LOperand* right() { return inputs_[1]; }
1384
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001385 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1386 DECLARE_HYDROGEN_ACCESSOR(Power)
1387};
1388
1389
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001390class LRandom: public LTemplateInstruction<1, 1, 0> {
1391 public:
1392 explicit LRandom(LOperand* global_object) {
1393 inputs_[0] = global_object;
1394 }
1395
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001396 LOperand* global_object() { return inputs_[0]; }
1397
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001398 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1399 DECLARE_HYDROGEN_ACCESSOR(Random)
1400};
1401
1402
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001403class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1404 public:
1405 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1406 : op_(op) {
1407 inputs_[0] = left;
1408 inputs_[1] = right;
1409 }
1410
1411 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001412 LOperand* left() { return inputs_[0]; }
1413 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001414
1415 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1416 virtual void CompileToNative(LCodeGen* generator);
1417 virtual const char* Mnemonic() const;
1418
1419 private:
1420 Token::Value op_;
1421};
1422
1423
1424class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1425 public:
1426 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1427 : op_(op) {
1428 inputs_[0] = left;
1429 inputs_[1] = right;
1430 }
1431
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001432 LOperand* left() { return inputs_[0]; }
1433 LOperand* right() { return inputs_[1]; }
1434 Token::Value op() const { return op_; }
1435
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001436 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1437 virtual void CompileToNative(LCodeGen* generator);
1438 virtual const char* Mnemonic() const;
1439
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001440 private:
1441 Token::Value op_;
1442};
1443
1444
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001445class LReturn: public LTemplateInstruction<0, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001446 public:
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001447 explicit LReturn(LOperand* value, LOperand* parameter_count) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001448 inputs_[0] = value;
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001449 inputs_[1] = parameter_count;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001450 }
1451
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001452 LOperand* value() { return inputs_[0]; }
1453
ulan@chromium.org6e196bf2013-03-13 09:38:22 +00001454 bool has_constant_parameter_count() {
1455 return parameter_count()->IsConstantOperand();
1456 }
1457 LConstantOperand* constant_parameter_count() {
1458 ASSERT(has_constant_parameter_count());
1459 return LConstantOperand::cast(parameter_count());
1460 }
1461 LOperand* parameter_count() { return inputs_[1]; }
1462
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001463 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1464};
1465
1466
1467class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1468 public:
1469 explicit LLoadNamedField(LOperand* object) {
1470 inputs_[0] = object;
1471 }
1472
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001473 LOperand* object() { return inputs_[0]; }
1474
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001475 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1476 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1477};
1478
1479
1480class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1481 public:
1482 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1483 inputs_[0] = object;
1484 }
1485
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001486 LOperand* object() { return inputs_[0]; }
1487
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001488 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1489 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001490};
1491
1492
1493class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1494 public:
1495 explicit LLoadNamedGeneric(LOperand* object) {
1496 inputs_[0] = object;
1497 }
1498
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001499 LOperand* object() { return inputs_[0]; }
1500
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001501 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1502 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1503
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001504 Handle<Object> name() const { return hydrogen()->name(); }
1505};
1506
1507
1508class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1509 public:
1510 explicit LLoadFunctionPrototype(LOperand* function) {
1511 inputs_[0] = function;
1512 }
1513
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001514 LOperand* function() { return inputs_[0]; }
1515
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001516 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1517 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001518};
1519
1520
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001521class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1522 public:
1523 explicit LLoadExternalArrayPointer(LOperand* object) {
1524 inputs_[0] = object;
1525 }
1526
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001527 LOperand* object() { return inputs_[0]; }
1528
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001529 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1530 "load-external-array-pointer")
1531};
1532
1533
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001534class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001535 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001536 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001537 inputs_[0] = elements;
1538 inputs_[1] = key;
1539 }
1540
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001541 LOperand* elements() { return inputs_[0]; }
1542 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001543 ElementsKind elements_kind() const {
1544 return hydrogen()->elements_kind();
1545 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001546 bool is_external() const {
1547 return hydrogen()->is_external();
1548 }
1549
1550 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1551 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1552
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001553 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001554 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001555};
1556
1557
1558class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1559 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001560 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1561 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001562 inputs_[1] = key;
1563 }
1564
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001565 LOperand* object() { return inputs_[0]; }
1566 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001567
1568 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001569};
1570
1571
1572class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1573 public:
1574 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1575 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1576};
1577
1578
1579class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1580 public:
1581 explicit LLoadGlobalGeneric(LOperand* global_object) {
1582 inputs_[0] = global_object;
1583 }
1584
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001585 LOperand* global_object() { return inputs_[0]; }
1586
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001587 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1588 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1589
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001590 Handle<Object> name() const { return hydrogen()->name(); }
1591 bool for_typeof() const { return hydrogen()->for_typeof(); }
1592};
1593
1594
1595class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1596 public:
1597 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1598 inputs_[0] = value;
1599 temps_[0] = temp;
1600 }
1601
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001602 LOperand* value() { return inputs_[0]; }
1603 LOperand* temp() { return temps_[0]; }
1604
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001605 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1606 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1607};
1608
1609
1610class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1611 public:
1612 explicit LStoreGlobalGeneric(LOperand* global_object,
1613 LOperand* value) {
1614 inputs_[0] = global_object;
1615 inputs_[1] = value;
1616 }
1617
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001618 LOperand* global_object() { return inputs_[0]; }
1619 LOperand* value() { return inputs_[1]; }
1620
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001621 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1622 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1623
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001624 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001625 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001626};
1627
1628
1629class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1630 public:
1631 explicit LLoadContextSlot(LOperand* context) {
1632 inputs_[0] = context;
1633 }
1634
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001635 LOperand* context() { return inputs_[0]; }
1636
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001637 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1638 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1639
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001640 int slot_index() { return hydrogen()->slot_index(); }
1641
1642 virtual void PrintDataTo(StringStream* stream);
1643};
1644
1645
1646class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1647 public:
1648 LStoreContextSlot(LOperand* context, LOperand* value) {
1649 inputs_[0] = context;
1650 inputs_[1] = value;
1651 }
1652
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001653 LOperand* context() { return inputs_[0]; }
1654 LOperand* value() { return inputs_[1]; }
1655
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001656 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1657 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1658
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001659 int slot_index() { return hydrogen()->slot_index(); }
1660
1661 virtual void PrintDataTo(StringStream* stream);
1662};
1663
1664
1665class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1666 public:
1667 explicit LPushArgument(LOperand* value) {
1668 inputs_[0] = value;
1669 }
1670
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001671 LOperand* value() { return inputs_[0]; }
1672
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001673 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1674};
1675
1676
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001677class LDrop: public LTemplateInstruction<0, 0, 0> {
1678 public:
1679 explicit LDrop(int count) : count_(count) { }
1680
1681 int count() const { return count_; }
1682
1683 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1684
1685 private:
1686 int count_;
1687};
1688
1689
jkummerow@chromium.org4c54a2a2013-03-19 17:51:30 +00001690class LInnerAllocatedObject: public LTemplateInstruction<1, 1, 0> {
1691 public:
1692 explicit LInnerAllocatedObject(LOperand* base_object) {
1693 inputs_[0] = base_object;
1694 }
1695
1696 LOperand* base_object() { return inputs_[0]; }
1697 int offset() { return hydrogen()->offset(); }
1698
1699 virtual void PrintDataTo(StringStream* stream);
1700
1701 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject, "sub-allocated-object")
1702 DECLARE_HYDROGEN_ACCESSOR(InnerAllocatedObject)
1703};
1704
1705
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001706class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1707 public:
1708 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1709 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1710};
1711
1712
1713class LContext: public LTemplateInstruction<1, 0, 0> {
1714 public:
1715 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001716 DECLARE_HYDROGEN_ACCESSOR(Context)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001717};
1718
1719
1720class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1721 public:
1722 explicit LOuterContext(LOperand* context) {
1723 inputs_[0] = context;
1724 }
1725
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001726 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001727
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001728 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001729};
1730
1731
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001732class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1733 public:
1734 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1735 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1736};
1737
1738
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001739class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1740 public:
1741 explicit LGlobalObject(LOperand* context) {
1742 inputs_[0] = context;
1743 }
1744
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001745 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001746
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001747 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001748};
1749
1750
1751class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1752 public:
1753 explicit LGlobalReceiver(LOperand* global_object) {
1754 inputs_[0] = global_object;
1755 }
1756
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001757 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001758
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001759 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001760};
1761
1762
1763class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1764 public:
1765 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1766 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1767
1768 virtual void PrintDataTo(StringStream* stream);
1769
1770 Handle<JSFunction> function() { return hydrogen()->function(); }
1771 int arity() const { return hydrogen()->argument_count() - 1; }
1772};
1773
1774
1775class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1776 public:
1777 explicit LInvokeFunction(LOperand* function) {
1778 inputs_[0] = function;
1779 }
1780
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001781 LOperand* function() { return inputs_[0]; }
1782
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001783 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1784 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1785
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001786 virtual void PrintDataTo(StringStream* stream);
1787
1788 int arity() const { return hydrogen()->argument_count() - 1; }
1789};
1790
1791
1792class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1793 public:
1794 explicit LCallKeyed(LOperand* key) {
1795 inputs_[0] = key;
1796 }
1797
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001798 LOperand* key() { return inputs_[0]; }
1799
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001800 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1801 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1802
1803 virtual void PrintDataTo(StringStream* stream);
1804
1805 int arity() const { return hydrogen()->argument_count() - 1; }
1806};
1807
1808
1809
1810class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1811 public:
1812 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1813 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1814
1815 virtual void PrintDataTo(StringStream* stream);
1816
1817 Handle<String> name() const { return hydrogen()->name(); }
1818 int arity() const { return hydrogen()->argument_count() - 1; }
1819};
1820
1821
danno@chromium.orgc612e022011-11-10 11:38:15 +00001822class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001823 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001824 explicit LCallFunction(LOperand* function) {
1825 inputs_[0] = function;
1826 }
1827
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001828 LOperand* function() { return inputs_[0]; }
1829
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001830 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1831 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1832
danno@chromium.orgc612e022011-11-10 11:38:15 +00001833 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001834};
1835
1836
1837class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1838 public:
1839 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1840 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1841
1842 virtual void PrintDataTo(StringStream* stream);
1843
1844 Handle<String> name() const {return hydrogen()->name(); }
1845 int arity() const { return hydrogen()->argument_count() - 1; }
1846};
1847
1848
1849class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1850 public:
1851 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1852 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1853
1854 virtual void PrintDataTo(StringStream* stream);
1855
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001856 int arity() const { return hydrogen()->argument_count() - 1; }
1857};
1858
1859
1860class LCallNew: public LTemplateInstruction<1, 1, 0> {
1861 public:
1862 explicit LCallNew(LOperand* constructor) {
1863 inputs_[0] = constructor;
1864 }
1865
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001866 LOperand* constructor() { return inputs_[0]; }
1867
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001868 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1869 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1870
1871 virtual void PrintDataTo(StringStream* stream);
1872
1873 int arity() const { return hydrogen()->argument_count() - 1; }
1874};
1875
1876
ulan@chromium.org750145a2013-03-07 15:14:13 +00001877class LCallNewArray: public LTemplateInstruction<1, 1, 0> {
1878 public:
1879 explicit LCallNewArray(LOperand* constructor) {
1880 inputs_[0] = constructor;
1881 }
1882
1883 LOperand* constructor() { return inputs_[0]; }
1884
1885 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1886 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1887
1888 virtual void PrintDataTo(StringStream* stream);
1889
1890 int arity() const { return hydrogen()->argument_count() - 1; }
1891};
1892
1893
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001894class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1895 public:
1896 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1897 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1898
1899 const Runtime::Function* function() const { return hydrogen()->function(); }
1900 int arity() const { return hydrogen()->argument_count(); }
1901};
1902
1903
1904class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1905 public:
1906 explicit LInteger32ToDouble(LOperand* value) {
1907 inputs_[0] = value;
1908 }
1909
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001910 LOperand* value() { return inputs_[0]; }
1911
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001912 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1913};
1914
1915
svenpanne@chromium.orga53e8e02013-05-24 12:35:50 +00001916class LInteger32ToSmi: public LTemplateInstruction<1, 1, 0> {
1917 public:
1918 explicit LInteger32ToSmi(LOperand* value) {
1919 inputs_[0] = value;
1920 }
1921
1922 LOperand* value() { return inputs_[0]; }
1923
1924 DECLARE_CONCRETE_INSTRUCTION(Integer32ToSmi, "int32-to-smi")
1925 DECLARE_HYDROGEN_ACCESSOR(Change)
1926};
1927
1928
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001929class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1930 public:
1931 explicit LUint32ToDouble(LOperand* value) {
1932 inputs_[0] = value;
1933 }
1934
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001935 LOperand* value() { return inputs_[0]; }
1936
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001937 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1938};
1939
1940
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001941class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1942 public:
1943 explicit LNumberTagI(LOperand* value) {
1944 inputs_[0] = value;
1945 }
1946
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001947 LOperand* value() { return inputs_[0]; }
1948
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001949 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1950};
1951
1952
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001953class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1954 public:
1955 explicit LNumberTagU(LOperand* value) {
1956 inputs_[0] = value;
1957 }
1958
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001959 LOperand* value() { return inputs_[0]; }
1960
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001961 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1962};
1963
1964
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001965class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1966 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001967 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001968 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001969 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001970 temps_[1] = temp2;
1971 }
1972
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001973 LOperand* value() { return inputs_[0]; }
1974 LOperand* temp() { return temps_[0]; }
1975 LOperand* temp2() { return temps_[1]; }
1976
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001977 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001978 DECLARE_HYDROGEN_ACCESSOR(Change)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001979};
1980
1981
svenpanne@chromium.orga53e8e02013-05-24 12:35:50 +00001982class LDoubleToSmi: public LTemplateInstruction<1, 1, 2> {
1983 public:
1984 LDoubleToSmi(LOperand* value, LOperand* temp, LOperand* temp2) {
1985 inputs_[0] = value;
1986 temps_[0] = temp;
1987 temps_[1] = temp2;
1988 }
1989
1990 LOperand* value() { return inputs_[0]; }
1991 LOperand* temp() { return temps_[0]; }
1992 LOperand* temp2() { return temps_[1]; }
1993
1994 DECLARE_CONCRETE_INSTRUCTION(DoubleToSmi, "double-to-smi")
1995 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1996
1997 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1998};
1999
2000
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002001// Sometimes truncating conversion from a tagged value to an int32.
2002class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
2003 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002004 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002005 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002006 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002007 temps_[1] = temp2;
2008 }
2009
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002010 LOperand* value() { return inputs_[0]; }
2011 LOperand* temp() { return temps_[0]; }
2012 LOperand* temp2() { return temps_[1]; }
2013
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002014 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
2015 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2016
2017 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2018};
2019
2020
2021// Truncating conversion from a tagged value to an int32.
2022class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
2023 public:
2024 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002025 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002026 LOperand* temp2,
2027 LOperand* temp3) {
2028 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002029 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002030 temps_[1] = temp2;
2031 temps_[2] = temp3;
2032 }
2033
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002034 LOperand* value() { return inputs_[0]; }
2035 LOperand* temp() { return temps_[0]; }
2036 LOperand* temp2() { return temps_[1]; }
2037 LOperand* temp3() { return temps_[2]; }
2038
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002039 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
2040 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
2041
2042 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
2043};
2044
2045
2046class LSmiTag: public LTemplateInstruction<1, 1, 0> {
2047 public:
2048 explicit LSmiTag(LOperand* value) {
2049 inputs_[0] = value;
2050 }
2051
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002052 LOperand* value() { return inputs_[0]; }
2053
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002054 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
2055};
2056
2057
2058class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
2059 public:
2060 explicit LNumberUntagD(LOperand* value) {
2061 inputs_[0] = value;
2062 }
2063
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002064 LOperand* value() { return inputs_[0]; }
2065
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002066 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
2067 DECLARE_HYDROGEN_ACCESSOR(Change)
2068};
2069
2070
2071class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
2072 public:
2073 LSmiUntag(LOperand* value, bool needs_check)
2074 : needs_check_(needs_check) {
2075 inputs_[0] = value;
2076 }
2077
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002078 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002079 bool needs_check() const { return needs_check_; }
2080
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002081 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
2082
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002083 private:
2084 bool needs_check_;
2085};
2086
2087
verwaest@chromium.org37141392012-05-31 13:27:02 +00002088class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002089 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002090 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
2091 inputs_[0] = object;
2092 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00002093 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002094 }
2095
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002096 LOperand* object() { return inputs_[0]; }
2097 LOperand* value() { return inputs_[1]; }
2098 LOperand* temp() { return temps_[0]; }
2099
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002100 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
2101 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
2102
2103 virtual void PrintDataTo(StringStream* stream);
2104
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002105 Handle<Map> transition() const { return hydrogen()->transition(); }
danno@chromium.orgf005df62013-04-30 16:36:45 +00002106 Representation representation() const {
2107 return hydrogen()->field_representation();
2108 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002109};
2110
2111
2112class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
2113 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002114 LStoreNamedGeneric(LOperand* object, LOperand* value) {
2115 inputs_[0] = object;
2116 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002117 }
2118
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002119 LOperand* object() { return inputs_[0]; }
2120 LOperand* value() { return inputs_[1]; }
2121
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002122 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
2123 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
2124
2125 virtual void PrintDataTo(StringStream* stream);
2126
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002127 Handle<Object> name() const { return hydrogen()->name(); }
2128 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002129};
2130
2131
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002132class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002133 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002134 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002135 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002136 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002137 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002138 }
2139
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002140 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002141 LOperand* elements() { return inputs_[0]; }
2142 LOperand* key() { return inputs_[1]; }
2143 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002144 ElementsKind elements_kind() const {
2145 return hydrogen()->elements_kind();
2146 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002147
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002148 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2149 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002150
2151 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00002152 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002153 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002154};
2155
2156
2157class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
2158 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002159 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002160 inputs_[0] = obj;
2161 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002162 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002163 }
2164
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002165 LOperand* object() { return inputs_[0]; }
2166 LOperand* key() { return inputs_[1]; }
2167 LOperand* value() { return inputs_[2]; }
2168
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002169 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2170 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2171
2172 virtual void PrintDataTo(StringStream* stream);
2173
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00002174 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002175};
2176
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002177
mstarzinger@chromium.orgf705b502013-04-04 11:38:09 +00002178class LTransitionElementsKind: public LTemplateInstruction<0, 1, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002179 public:
2180 LTransitionElementsKind(LOperand* object,
2181 LOperand* new_map_temp,
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002182 LOperand* fixed_object_temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002183 inputs_[0] = object;
2184 temps_[0] = new_map_temp;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002185 temps_[1] = fixed_object_temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002186 }
2187
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002188 LOperand* object() { return inputs_[0]; }
2189 LOperand* new_map_temp() { return temps_[0]; }
2190 LOperand* temp() { return temps_[1]; }
2191
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002192 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2193 "transition-elements-kind")
2194 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2195
2196 virtual void PrintDataTo(StringStream* stream);
2197
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002198 Handle<Map> original_map() { return hydrogen()->original_map(); }
2199 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002200 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2201 ElementsKind to_kind() { return hydrogen()->to_kind(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002202};
2203
2204
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002205class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> {
2206 public:
2207 LTrapAllocationMemento(LOperand* object,
2208 LOperand* temp) {
2209 inputs_[0] = object;
2210 temps_[0] = temp;
2211 }
2212
2213 LOperand* object() { return inputs_[0]; }
2214 LOperand* temp() { return temps_[0]; }
2215
2216 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2217 "trap-allocation-memento")
2218};
2219
2220
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002221class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2222 public:
2223 LStringAdd(LOperand* left, LOperand* right) {
2224 inputs_[0] = left;
2225 inputs_[1] = right;
2226 }
2227
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002228 LOperand* left() { return inputs_[0]; }
2229 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002230
2231 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2232 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002233};
2234
2235
2236
2237class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2238 public:
2239 LStringCharCodeAt(LOperand* string, LOperand* index) {
2240 inputs_[0] = string;
2241 inputs_[1] = index;
2242 }
2243
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002244 LOperand* string() { return inputs_[0]; }
2245 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002246
2247 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2248 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002249};
2250
2251
2252class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2253 public:
2254 explicit LStringCharFromCode(LOperand* char_code) {
2255 inputs_[0] = char_code;
2256 }
2257
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002258 LOperand* char_code() { return inputs_[0]; }
2259
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002260 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2261 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002262};
2263
2264
2265class LStringLength: public LTemplateInstruction<1, 1, 0> {
2266 public:
2267 explicit LStringLength(LOperand* string) {
2268 inputs_[0] = string;
2269 }
2270
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002271 LOperand* string() { return inputs_[0]; }
2272
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002273 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2274 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002275};
2276
2277
2278class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2279 public:
2280 explicit LCheckFunction(LOperand* value) {
2281 inputs_[0] = value;
2282 }
2283
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002284 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002285
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002286 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2287 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2288};
2289
2290
2291class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2292 public:
2293 explicit LCheckInstanceType(LOperand* value) {
2294 inputs_[0] = value;
2295 }
2296
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002297 LOperand* value() { return inputs_[0]; }
2298
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002299 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2300 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2301};
2302
2303
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002304class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002305 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002306 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002307 inputs_[0] = value;
2308 }
2309
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002310 LOperand* value() { return inputs_[0]; }
2311
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002312 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2313 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002314};
2315
2316
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +00002317class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002318 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002319 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2320 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002321 temps_[1] = temp2;
2322 }
2323
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002324 LOperand* temp() { return temps_[0]; }
2325 LOperand* temp2() { return temps_[1]; }
2326
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002327 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2328 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2329
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002330 ZoneList<Handle<JSObject> >* prototypes() const {
2331 return hydrogen()->prototypes();
2332 }
2333 ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002334};
2335
2336
jkummerow@chromium.orgc1184022013-05-28 16:58:15 +00002337class LCheckSmi: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002338 public:
2339 explicit LCheckSmi(LOperand* value) {
2340 inputs_[0] = value;
2341 }
2342
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002343 LOperand* value() { return inputs_[0]; }
2344
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002345 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2346};
2347
2348
2349class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2350 public:
2351 explicit LCheckNonSmi(LOperand* value) {
2352 inputs_[0] = value;
2353 }
2354
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002355 LOperand* value() { return inputs_[0]; }
2356
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002357 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2358};
2359
2360
2361class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2362 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002363 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2364 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002365 temps_[0] = temp;
2366 }
2367
2368 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002369 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002370
2371 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2372};
2373
2374
2375class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2376 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002377 explicit LClampIToUint8(LOperand* unclamped) {
2378 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002379 }
2380
2381 LOperand* unclamped() { return inputs_[0]; }
2382
2383 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2384};
2385
2386
2387class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2388 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002389 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2390 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002391 temps_[0] = temp;
2392 }
2393
2394 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002395 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002396
2397 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2398};
2399
2400
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002401class LAllocateObject: public LTemplateInstruction<1, 1, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002402 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002403 LAllocateObject(LOperand* temp, LOperand* temp2) {
2404 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002405 temps_[1] = temp2;
2406 }
2407
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002408 LOperand* temp() { return temps_[0]; }
2409 LOperand* temp2() { return temps_[1]; }
2410
ulan@chromium.org967e2702012-02-28 09:49:15 +00002411 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2412 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2413};
2414
2415
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002416class LAllocate: public LTemplateInstruction<1, 2, 2> {
2417 public:
2418 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2419 inputs_[1] = size;
2420 temps_[0] = temp1;
2421 temps_[1] = temp2;
2422 }
2423
2424 LOperand* size() { return inputs_[1]; }
2425 LOperand* temp1() { return temps_[0]; }
2426 LOperand* temp2() { return temps_[1]; }
2427
2428 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2429 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2430};
2431
2432
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002433class 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_