blob: db235e4637b949a2602257f5ea85b210c55d4586 [file] [log] [blame]
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001// Copyright 2012 the V8 project authors. All rights reserved.
lrn@chromium.org7516f052011-03-30 08:52:27 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef V8_MIPS_LITHIUM_MIPS_H_
29#define V8_MIPS_LITHIUM_MIPS_H_
30
31#include "hydrogen.h"
32#include "lithium-allocator.h"
33#include "lithium.h"
34#include "safepoint-table.h"
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000035#include "utils.h"
lrn@chromium.org7516f052011-03-30 08:52:27 +000036
37namespace v8 {
38namespace internal {
39
40// Forward declarations.
41class LCodeGen;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000042
43#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
44 V(ControlInstruction) \
45 V(Call) \
46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
47
48
49#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
50 V(AccessArgumentsAt) \
51 V(AddI) \
ulan@chromium.org967e2702012-02-28 09:49:15 +000052 V(AllocateObject) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +000053 V(Allocate) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000054 V(ApplyArguments) \
55 V(ArgumentsElements) \
56 V(ArgumentsLength) \
57 V(ArithmeticD) \
58 V(ArithmeticT) \
59 V(ArrayLiteral) \
60 V(BitI) \
61 V(BitNotI) \
62 V(BoundsCheck) \
63 V(Branch) \
64 V(CallConstantFunction) \
65 V(CallFunction) \
66 V(CallGlobal) \
67 V(CallKeyed) \
68 V(CallKnownGlobal) \
69 V(CallNamed) \
70 V(CallNew) \
71 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) \
90 V(ConstantT) \
91 V(Context) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000092 V(DeclareGlobals) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000093 V(DeleteProperty) \
94 V(Deoptimize) \
95 V(DivI) \
96 V(DoubleToI) \
yangguo@chromium.org46a2a512013-01-18 16:29:40 +000097 V(DummyUse) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000098 V(ElementsKind) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000099 V(FastLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000100 V(FixedArrayBaseLength) \
101 V(FunctionLiteral) \
102 V(GetCachedArrayIndex) \
103 V(GlobalObject) \
104 V(GlobalReceiver) \
105 V(Goto) \
106 V(HasCachedArrayIndexAndBranch) \
107 V(HasInstanceTypeAndBranch) \
108 V(In) \
109 V(InstanceOf) \
110 V(InstanceOfKnownGlobal) \
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +0000111 V(InstanceSize) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000112 V(InstructionGap) \
113 V(Integer32ToDouble) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000114 V(Uint32ToDouble) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000115 V(InvokeFunction) \
116 V(IsConstructCallAndBranch) \
117 V(IsNilAndBranch) \
118 V(IsObjectAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000119 V(IsStringAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000120 V(IsSmiAndBranch) \
121 V(IsUndetectableAndBranch) \
122 V(JSArrayLength) \
123 V(Label) \
124 V(LazyBailout) \
125 V(LoadContextSlot) \
126 V(LoadElements) \
127 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) \
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000137 V(MathExp) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000138 V(MathMinMax) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000139 V(ModI) \
140 V(MulI) \
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000141 V(MultiplyAddD) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000142 V(NumberTagD) \
143 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000144 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000145 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000146 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000147 V(OsrEntry) \
148 V(OuterContext) \
149 V(Parameter) \
150 V(Power) \
151 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000152 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000153 V(RegExpLiteral) \
154 V(Return) \
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000155 V(SeqStringSetChar) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000156 V(ShiftI) \
157 V(SmiTag) \
158 V(SmiUntag) \
159 V(StackCheck) \
160 V(StoreContextSlot) \
161 V(StoreGlobalCell) \
162 V(StoreGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000163 V(StoreKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000164 V(StoreKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000165 V(StoreNamedField) \
166 V(StoreNamedGeneric) \
167 V(StringAdd) \
168 V(StringCharCodeAt) \
169 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000170 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000171 V(StringLength) \
172 V(SubI) \
173 V(TaggedToI) \
174 V(ThisFunction) \
175 V(Throw) \
176 V(ToFastProperties) \
177 V(TransitionElementsKind) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000178 V(TrapAllocationMemento) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000179 V(Typeof) \
180 V(TypeofIsAndBranch) \
181 V(UnaryMathOperation) \
182 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000183 V(ValueOf) \
184 V(ForInPrepareMap) \
185 V(ForInCacheArray) \
186 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000187 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000188 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000189 V(WrapReceiver) \
190 V(Drop)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000191
192#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
193 virtual Opcode opcode() const { return LInstruction::k##type; } \
194 virtual void CompileToNative(LCodeGen* generator); \
195 virtual const char* Mnemonic() const { return mnemonic; } \
196 static L##type* cast(LInstruction* instr) { \
197 ASSERT(instr->Is##type()); \
198 return reinterpret_cast<L##type*>(instr); \
199 }
200
201
202#define DECLARE_HYDROGEN_ACCESSOR(type) \
203 H##type* hydrogen() const { \
204 return H##type::cast(hydrogen_value()); \
205 }
206
lrn@chromium.org7516f052011-03-30 08:52:27 +0000207
208class LInstruction: public ZoneObject {
209 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000210 LInstruction()
211 : environment_(NULL),
212 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000213 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000214 virtual ~LInstruction() { }
215
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000216 virtual void CompileToNative(LCodeGen* generator) = 0;
217 virtual const char* Mnemonic() const = 0;
218 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000219 virtual void PrintDataTo(StringStream* stream);
220 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000221
222 enum Opcode {
223 // Declare a unique enum value for each instruction.
224#define DECLARE_OPCODE(type) k##type,
225 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
226 kNumberOfInstructions
227#undef DECLARE_OPCODE
228 };
229
230 virtual Opcode opcode() const = 0;
231
232 // Declare non-virtual type testers for all leaf IR classes.
233#define DECLARE_PREDICATE(type) \
234 bool Is##type() const { return opcode() == k##type; }
235 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
236#undef DECLARE_PREDICATE
237
238 // Declare virtual predicates for instructions that don't have
239 // an opcode.
240 virtual bool IsGap() const { return false; }
241
242 virtual bool IsControl() const { return false; }
243
244 void set_environment(LEnvironment* env) { environment_ = env; }
245 LEnvironment* environment() const { return environment_; }
246 bool HasEnvironment() const { return environment_ != NULL; }
247
248 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
249 LPointerMap* pointer_map() const { return pointer_map_.get(); }
250 bool HasPointerMap() const { return pointer_map_.is_set(); }
251
252 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
253 HValue* hydrogen_value() const { return hydrogen_value_; }
254
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000255 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000256
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000257 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000258
259 // Interface to the register allocator and iterators.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000260 bool ClobbersTemps() const { return is_call_; }
261 bool ClobbersRegisters() const { return is_call_; }
262 bool ClobbersDoubleRegisters() const { return is_call_; }
263
264 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000265 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000266
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000267 virtual bool HasResult() const = 0;
268 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000269
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000270 LOperand* FirstInput() { return InputAt(0); }
271 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000272
273#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000274 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000275#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000276
277 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000278 // Iterator interface.
279 friend class InputIterator;
280 virtual int InputCount() = 0;
281 virtual LOperand* InputAt(int i) = 0;
282
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000283 friend class TempIterator;
284 virtual int TempCount() = 0;
285 virtual LOperand* TempAt(int i) = 0;
286
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000287 LEnvironment* environment_;
288 SetOncePointer<LPointerMap> pointer_map_;
289 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000290 bool is_call_;
291 bool is_save_doubles_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000292};
293
294
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000295// R = number of result operands (0 or 1).
296// I = number of input operands.
297// T = number of temporary operands.
298template<int R, int I, int T>
299class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000300 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000301 // Allow 0 or 1 output operands.
302 STATIC_ASSERT(R == 0 || R == 1);
303 virtual bool HasResult() const { return R != 0; }
304 void set_result(LOperand* operand) { results_[0] = operand; }
305 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000306
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000307 protected:
308 EmbeddedContainer<LOperand*, R> results_;
309 EmbeddedContainer<LOperand*, I> inputs_;
310 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000311
312 private:
313 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000314 virtual LOperand* InputAt(int i) { return inputs_[i]; }
315
316 virtual int TempCount() { return T; }
317 virtual LOperand* TempAt(int i) { return temps_[i]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000318};
319
320
321class LGap: public LTemplateInstruction<0, 0, 0> {
322 public:
323 explicit LGap(HBasicBlock* block)
324 : block_(block) {
325 parallel_moves_[BEFORE] = NULL;
326 parallel_moves_[START] = NULL;
327 parallel_moves_[END] = NULL;
328 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000329 }
330
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000331 // Can't use the DECLARE-macro here because of sub-classes.
332 virtual bool IsGap() const { return true; }
333 virtual void PrintDataTo(StringStream* stream);
334 static LGap* cast(LInstruction* instr) {
335 ASSERT(instr->IsGap());
336 return reinterpret_cast<LGap*>(instr);
337 }
338
339 bool IsRedundant() const;
340
341 HBasicBlock* block() const { return block_; }
342
lrn@chromium.org7516f052011-03-30 08:52:27 +0000343 enum InnerPosition {
344 BEFORE,
345 START,
346 END,
347 AFTER,
348 FIRST_INNER_POSITION = BEFORE,
349 LAST_INNER_POSITION = AFTER
350 };
351
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000352 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
353 if (parallel_moves_[pos] == NULL) {
354 parallel_moves_[pos] = new(zone) LParallelMove(zone);
355 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000356 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000357 }
358
359 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000360 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000361 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000362
363 private:
364 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
365 HBasicBlock* block_;
366};
367
368
369class LInstructionGap: public LGap {
370 public:
371 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
372
373 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
374};
375
376
377class LGoto: public LTemplateInstruction<0, 0, 0> {
378 public:
379 explicit LGoto(int block_id) : block_id_(block_id) { }
380
381 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
382 virtual void PrintDataTo(StringStream* stream);
383 virtual bool IsControl() const { return true; }
384
385 int block_id() const { return block_id_; }
386
387 private:
388 int block_id_;
389};
390
391
392class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
393 public:
394 LLazyBailout() : gap_instructions_size_(0) { }
395
396 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
397
398 void set_gap_instructions_size(int gap_instructions_size) {
399 gap_instructions_size_ = gap_instructions_size;
400 }
401 int gap_instructions_size() { return gap_instructions_size_; }
402
403 private:
404 int gap_instructions_size_;
405};
406
407
yangguo@chromium.org46a2a512013-01-18 16:29:40 +0000408class LDummyUse: public LTemplateInstruction<1, 1, 0> {
409 public:
410 explicit LDummyUse(LOperand* value) {
411 inputs_[0] = value;
412 }
413 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
414};
415
416
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000417class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
418 public:
419 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000420};
421
422
423class LLabel: public LGap {
424 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000425 explicit LLabel(HBasicBlock* block)
426 : LGap(block), replacement_(NULL) { }
427
428 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
429
430 virtual void PrintDataTo(StringStream* stream);
431
432 int block_id() const { return block()->block_id(); }
433 bool is_loop_header() const { return block()->IsLoopHeader(); }
434 Label* label() { return &label_; }
435 LLabel* replacement() const { return replacement_; }
436 void set_replacement(LLabel* label) { replacement_ = label; }
437 bool HasReplacement() const { return replacement_ != NULL; }
438
439 private:
440 Label label_;
441 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000442};
443
444
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000445class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000446 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000447 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
448};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000449
lrn@chromium.org7516f052011-03-30 08:52:27 +0000450
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000451class LCallStub: public LTemplateInstruction<1, 0, 0> {
452 public:
453 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
454 DECLARE_HYDROGEN_ACCESSOR(CallStub)
455
456 TranscendentalCache::Type transcendental_type() {
457 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000458 }
459};
460
461
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000462class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
463 public:
464 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
465};
466
467
468template<int I, int T>
469class LControlInstruction: public LTemplateInstruction<0, I, T> {
470 public:
471 virtual bool IsControl() const { return true; }
472
473 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
474 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
475 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
476 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
477
478 private:
479 HControlInstruction* hydrogen() {
480 return HControlInstruction::cast(this->hydrogen_value());
481 }
482};
483
484
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000485class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
486 public:
487 LWrapReceiver(LOperand* receiver, LOperand* function) {
488 inputs_[0] = receiver;
489 inputs_[1] = function;
490 }
491
492 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
493
494 LOperand* receiver() { return inputs_[0]; }
495 LOperand* function() { return inputs_[1]; }
496};
497
498
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000499class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
500 public:
501 LApplyArguments(LOperand* function,
502 LOperand* receiver,
503 LOperand* length,
504 LOperand* elements) {
505 inputs_[0] = function;
506 inputs_[1] = receiver;
507 inputs_[2] = length;
508 inputs_[3] = elements;
509 }
510
511 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
512
513 LOperand* function() { return inputs_[0]; }
514 LOperand* receiver() { return inputs_[1]; }
515 LOperand* length() { return inputs_[2]; }
516 LOperand* elements() { return inputs_[3]; }
517};
518
519
520class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
521 public:
522 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
523 inputs_[0] = arguments;
524 inputs_[1] = length;
525 inputs_[2] = index;
526 }
527
528 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
529
530 LOperand* arguments() { return inputs_[0]; }
531 LOperand* length() { return inputs_[1]; }
532 LOperand* index() { return inputs_[2]; }
533
534 virtual void PrintDataTo(StringStream* stream);
535};
536
537
538class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
539 public:
540 explicit LArgumentsLength(LOperand* elements) {
541 inputs_[0] = elements;
542 }
543
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000544 LOperand* elements() { return inputs_[0]; }
545
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000546 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
547};
548
549
550class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
551 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000552 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000553 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000554};
555
556
557class LModI: public LTemplateInstruction<1, 2, 3> {
558 public:
559 // Used when the right hand is a constant power of 2.
560 LModI(LOperand* left,
561 LOperand* right) {
562 inputs_[0] = left;
563 inputs_[1] = right;
564 temps_[0] = NULL;
565 temps_[1] = NULL;
566 temps_[2] = NULL;
567 }
568
569 // Used for the standard case.
570 LModI(LOperand* left,
571 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000572 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000573 LOperand* temp2,
574 LOperand* temp3) {
575 inputs_[0] = left;
576 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000577 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000578 temps_[1] = temp2;
579 temps_[2] = temp3;
580 }
581
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000582 LOperand* left() { return inputs_[0]; }
583 LOperand* right() { return inputs_[1]; }
584 LOperand* temp() { return temps_[0]; }
585 LOperand* temp2() { return temps_[1]; }
586 LOperand* temp3() { return temps_[2]; }
587
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000588 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
589 DECLARE_HYDROGEN_ACCESSOR(Mod)
590};
591
592
593class LDivI: public LTemplateInstruction<1, 2, 0> {
594 public:
595 LDivI(LOperand* left, LOperand* right) {
596 inputs_[0] = left;
597 inputs_[1] = right;
598 }
599
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000600 LOperand* left() { return inputs_[0]; }
601 LOperand* right() { return inputs_[1]; }
602
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000603 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
604 DECLARE_HYDROGEN_ACCESSOR(Div)
605};
606
607
608class LMulI: public LTemplateInstruction<1, 2, 1> {
609 public:
610 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
611 inputs_[0] = left;
612 inputs_[1] = right;
613 temps_[0] = temp;
614 }
615
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000616 LOperand* left() { return inputs_[0]; }
617 LOperand* right() { return inputs_[1]; }
618 LOperand* temp() { return temps_[0]; }
619
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000620 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
621 DECLARE_HYDROGEN_ACCESSOR(Mul)
622};
623
624
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000625// Instruction for computing multiplier * multiplicand + addend.
626class LMultiplyAddD: public LTemplateInstruction<1, 3, 0> {
627 public:
628 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
629 LOperand* multiplicand) {
630 inputs_[0] = addend;
631 inputs_[1] = multiplier;
632 inputs_[2] = multiplicand;
633 }
634
635 LOperand* addend() { return inputs_[0]; }
636 LOperand* multiplier() { return inputs_[1]; }
637 LOperand* multiplicand() { return inputs_[2]; }
638
639 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
640};
641
642
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000643class LCmpIDAndBranch: public LControlInstruction<2, 0> {
644 public:
645 LCmpIDAndBranch(LOperand* left, LOperand* right) {
646 inputs_[0] = left;
647 inputs_[1] = right;
648 }
649
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000650 LOperand* left() { return inputs_[0]; }
651 LOperand* right() { return inputs_[1]; }
652
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000653 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
654 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
655
656 Token::Value op() const { return hydrogen()->token(); }
657 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000658 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000659 }
660
661 virtual void PrintDataTo(StringStream* stream);
662};
663
664
665class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
666 public:
667 LUnaryMathOperation(LOperand* value, LOperand* temp) {
668 inputs_[0] = value;
669 temps_[0] = temp;
670 }
671
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000672 LOperand* value() { return inputs_[0]; }
673 LOperand* temp() { return temps_[0]; }
674
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000675 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
676 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
677
678 virtual void PrintDataTo(StringStream* stream);
679 BuiltinFunctionId op() const { return hydrogen()->op(); }
680};
681
682
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000683class LMathExp: public LTemplateInstruction<1, 1, 3> {
684 public:
685 LMathExp(LOperand* value,
686 LOperand* double_temp,
687 LOperand* temp1,
688 LOperand* temp2) {
689 inputs_[0] = value;
690 temps_[0] = temp1;
691 temps_[1] = temp2;
692 temps_[2] = double_temp;
693 ExternalReference::InitializeMathExpData();
694 }
695
696 LOperand* value() { return inputs_[0]; }
697 LOperand* temp1() { return temps_[0]; }
698 LOperand* temp2() { return temps_[1]; }
699 LOperand* double_temp() { return temps_[2]; }
700
701 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
702
703 virtual void PrintDataTo(StringStream* stream);
704};
705
706
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000707class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
708 public:
709 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
710 inputs_[0] = left;
711 inputs_[1] = right;
712 }
713
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000714 LOperand* left() { return inputs_[0]; }
715 LOperand* right() { return inputs_[1]; }
716
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000717 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
718 "cmp-object-eq-and-branch")
719 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
720};
721
722
723class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
724 public:
725 explicit LCmpConstantEqAndBranch(LOperand* left) {
726 inputs_[0] = left;
727 }
728
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000729 LOperand* left() { return inputs_[0]; }
730
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000731 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
732 "cmp-constant-eq-and-branch")
733 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
734};
735
736
737class LIsNilAndBranch: public LControlInstruction<1, 0> {
738 public:
739 explicit LIsNilAndBranch(LOperand* value) {
740 inputs_[0] = value;
741 }
742
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000743 LOperand* value() { return inputs_[0]; }
744
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000745 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
746 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
747
748 EqualityKind kind() const { return hydrogen()->kind(); }
749 NilValue nil() const { return hydrogen()->nil(); }
750
751 virtual void PrintDataTo(StringStream* stream);
752};
753
754
755class LIsObjectAndBranch: public LControlInstruction<1, 1> {
756 public:
757 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
758 inputs_[0] = value;
759 temps_[0] = temp;
760 }
761
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000762 LOperand* value() { return inputs_[0]; }
763 LOperand* temp() { return temps_[0]; }
764
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000765 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
766 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
767
768 virtual void PrintDataTo(StringStream* stream);
769};
770
771
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000772class LIsStringAndBranch: public LControlInstruction<1, 1> {
773 public:
774 LIsStringAndBranch(LOperand* value, LOperand* temp) {
775 inputs_[0] = value;
776 temps_[0] = temp;
777 }
778
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000779 LOperand* value() { return inputs_[0]; }
780 LOperand* temp() { return temps_[0]; }
781
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000782 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
783 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
784
785 virtual void PrintDataTo(StringStream* stream);
786};
787
788
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000789class LIsSmiAndBranch: public LControlInstruction<1, 0> {
790 public:
791 explicit LIsSmiAndBranch(LOperand* value) {
792 inputs_[0] = value;
793 }
794
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000795 LOperand* value() { return inputs_[0]; }
796
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000797 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
798 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
799
800 virtual void PrintDataTo(StringStream* stream);
801};
802
803
804class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
805 public:
806 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
807 inputs_[0] = value;
808 temps_[0] = temp;
809 }
810
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000811 LOperand* value() { return inputs_[0]; }
812 LOperand* temp() { return temps_[0]; }
813
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000814 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
815 "is-undetectable-and-branch")
816 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
817
818 virtual void PrintDataTo(StringStream* stream);
819};
820
821
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000822class LStringCompareAndBranch: public LControlInstruction<2, 0> {
823 public:
824 LStringCompareAndBranch(LOperand* left, LOperand* right) {
825 inputs_[0] = left;
826 inputs_[1] = right;
827 }
828
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000829 LOperand* left() { return inputs_[0]; }
830 LOperand* right() { return inputs_[1]; }
831
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000832 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
833 "string-compare-and-branch")
834 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
835
836 Token::Value op() const { return hydrogen()->token(); }
837
838 virtual void PrintDataTo(StringStream* stream);
839};
840
841
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000842class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
843 public:
844 explicit LHasInstanceTypeAndBranch(LOperand* value) {
845 inputs_[0] = value;
846 }
847
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000848 LOperand* value() { return inputs_[0]; }
849
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000850 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
851 "has-instance-type-and-branch")
852 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
853
854 virtual void PrintDataTo(StringStream* stream);
855};
856
857
858class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
859 public:
860 explicit LGetCachedArrayIndex(LOperand* value) {
861 inputs_[0] = value;
862 }
863
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000864 LOperand* value() { return inputs_[0]; }
865
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000866 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
867 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
868};
869
870
871class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
872 public:
873 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
874 inputs_[0] = value;
875 }
876
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000877 LOperand* value() { return inputs_[0]; }
878
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000879 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
880 "has-cached-array-index-and-branch")
881 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
882
883 virtual void PrintDataTo(StringStream* stream);
884};
885
886
887class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
888 public:
889 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
890 inputs_[0] = value;
891 temps_[0] = temp;
892 }
893
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000894 LOperand* value() { return inputs_[0]; }
895 LOperand* temp() { return temps_[0]; }
896
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000897 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
898 "class-of-test-and-branch")
899 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
900
901 virtual void PrintDataTo(StringStream* stream);
902};
903
904
905class LCmpT: public LTemplateInstruction<1, 2, 0> {
906 public:
907 LCmpT(LOperand* left, LOperand* right) {
908 inputs_[0] = left;
909 inputs_[1] = right;
910 }
911
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000912 LOperand* left() { return inputs_[0]; }
913 LOperand* right() { return inputs_[1]; }
914
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000915 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
916 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
917
918 Token::Value op() const { return hydrogen()->token(); }
919};
920
921
922class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
923 public:
924 LInstanceOf(LOperand* left, LOperand* right) {
925 inputs_[0] = left;
926 inputs_[1] = right;
927 }
928
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000929 LOperand* left() { return inputs_[0]; }
930 LOperand* right() { return inputs_[1]; }
931
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000932 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
933};
934
935
936class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
937 public:
938 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
939 inputs_[0] = value;
940 temps_[0] = temp;
941 }
942
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000943 LOperand* value() { return inputs_[0]; }
944 LOperand* temp() { return temps_[0]; }
945
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000946 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
947 "instance-of-known-global")
948 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
949
950 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000951 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
952 return lazy_deopt_env_;
953 }
954 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
955 lazy_deopt_env_ = env;
956 }
957
958 private:
959 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000960};
961
962
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +0000963class LInstanceSize: public LTemplateInstruction<1, 1, 0> {
964 public:
965 explicit LInstanceSize(LOperand* object) {
966 inputs_[0] = object;
967 }
968
969 LOperand* object() { return inputs_[0]; }
970
971 DECLARE_CONCRETE_INSTRUCTION(InstanceSize, "instance-size")
972 DECLARE_HYDROGEN_ACCESSOR(InstanceSize)
973};
974
975
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000976class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
977 public:
978 LBoundsCheck(LOperand* index, LOperand* length) {
979 inputs_[0] = index;
980 inputs_[1] = length;
981 }
982
983 LOperand* index() { return inputs_[0]; }
984 LOperand* length() { return inputs_[1]; }
985
986 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +0000987 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000988};
989
990
991class LBitI: public LTemplateInstruction<1, 2, 0> {
992 public:
993 LBitI(LOperand* left, LOperand* right) {
994 inputs_[0] = left;
995 inputs_[1] = right;
996 }
997
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000998 LOperand* left() { return inputs_[0]; }
999 LOperand* right() { return inputs_[1]; }
1000
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001001 Token::Value op() const { return hydrogen()->op(); }
1002
1003 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1004 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1005};
1006
1007
1008class LShiftI: public LTemplateInstruction<1, 2, 0> {
1009 public:
1010 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1011 : op_(op), can_deopt_(can_deopt) {
1012 inputs_[0] = left;
1013 inputs_[1] = right;
1014 }
1015
1016 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001017 LOperand* left() { return inputs_[0]; }
1018 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001019 bool can_deopt() const { return can_deopt_; }
1020
1021 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1022
1023 private:
1024 Token::Value op_;
1025 bool can_deopt_;
1026};
1027
1028
1029class LSubI: public LTemplateInstruction<1, 2, 0> {
1030 public:
1031 LSubI(LOperand* left, LOperand* right) {
1032 inputs_[0] = left;
1033 inputs_[1] = right;
1034 }
1035
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001036 LOperand* left() { return inputs_[0]; }
1037 LOperand* right() { return inputs_[1]; }
1038
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001039 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1040 DECLARE_HYDROGEN_ACCESSOR(Sub)
1041};
1042
1043
1044class LConstantI: public LTemplateInstruction<1, 0, 0> {
1045 public:
1046 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1047 DECLARE_HYDROGEN_ACCESSOR(Constant)
1048
1049 int32_t value() const { return hydrogen()->Integer32Value(); }
1050};
1051
1052
1053class LConstantD: public LTemplateInstruction<1, 0, 0> {
1054 public:
1055 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1056 DECLARE_HYDROGEN_ACCESSOR(Constant)
1057
1058 double value() const { return hydrogen()->DoubleValue(); }
1059};
1060
1061
1062class LConstantT: public LTemplateInstruction<1, 0, 0> {
1063 public:
1064 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1065 DECLARE_HYDROGEN_ACCESSOR(Constant)
1066
1067 Handle<Object> value() const { return hydrogen()->handle(); }
1068};
1069
1070
1071class LBranch: public LControlInstruction<1, 0> {
1072 public:
1073 explicit LBranch(LOperand* value) {
1074 inputs_[0] = value;
1075 }
1076
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001077 LOperand* value() { return inputs_[0]; }
1078
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001079 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1080 DECLARE_HYDROGEN_ACCESSOR(Branch)
1081
1082 virtual void PrintDataTo(StringStream* stream);
1083};
1084
1085
1086class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1087 public:
1088 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1089 inputs_[0] = value;
1090 temps_[0] = temp;
1091 }
1092
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001093 LOperand* value() { return inputs_[0]; }
1094 LOperand* temp() { return temps_[0]; }
1095
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001096 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1097 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1098
1099 virtual bool IsControl() const { return true; }
1100
1101 Handle<Map> map() const { return hydrogen()->map(); }
1102 int true_block_id() const {
1103 return hydrogen()->FirstSuccessor()->block_id();
1104 }
1105 int false_block_id() const {
1106 return hydrogen()->SecondSuccessor()->block_id();
1107 }
1108};
1109
1110
1111class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
1112 public:
1113 explicit LJSArrayLength(LOperand* value) {
1114 inputs_[0] = value;
1115 }
1116
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001117 LOperand* value() { return inputs_[0]; }
1118
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001119 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
1120 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
1121};
1122
1123
1124class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1125 public:
1126 explicit LFixedArrayBaseLength(LOperand* value) {
1127 inputs_[0] = value;
1128 }
1129
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001130 LOperand* value() { return inputs_[0]; }
1131
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001132 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1133 "fixed-array-base-length")
1134 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1135};
1136
1137
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001138class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1139 public:
1140 explicit LMapEnumLength(LOperand* value) {
1141 inputs_[0] = value;
1142 }
1143
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001144 LOperand* value() { return inputs_[0]; }
1145
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001146 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1147};
1148
1149
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001150class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1151 public:
1152 explicit LElementsKind(LOperand* value) {
1153 inputs_[0] = value;
1154 }
1155
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001156 LOperand* value() { return inputs_[0]; }
1157
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001158 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1159 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1160};
1161
1162
1163class LValueOf: public LTemplateInstruction<1, 1, 1> {
1164 public:
1165 LValueOf(LOperand* value, LOperand* temp) {
1166 inputs_[0] = value;
1167 temps_[0] = temp;
1168 }
1169
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001170 LOperand* value() { return inputs_[0]; }
1171 LOperand* temp() { return temps_[0]; }
1172
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001173 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1174 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1175};
1176
1177
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001178class LDateField: public LTemplateInstruction<1, 1, 1> {
1179 public:
1180 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1181 inputs_[0] = date;
1182 temps_[0] = temp;
1183 }
1184
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001185 LOperand* date() { return inputs_[0]; }
1186 LOperand* temp() { return temps_[0]; }
1187 Smi* index() const { return index_; }
1188
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001189 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1190 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001191
1192 private:
1193 Smi* index_;
1194};
1195
1196
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +00001197class LSeqStringSetChar: public LTemplateInstruction<1, 3, 0> {
1198 public:
1199 LSeqStringSetChar(String::Encoding encoding,
1200 LOperand* string,
1201 LOperand* index,
1202 LOperand* value) : encoding_(encoding) {
1203 inputs_[0] = string;
1204 inputs_[1] = index;
1205 inputs_[2] = value;
1206 }
1207
1208 String::Encoding encoding() { return encoding_; }
1209 LOperand* string() { return inputs_[0]; }
1210 LOperand* index() { return inputs_[1]; }
1211 LOperand* value() { return inputs_[2]; }
1212
1213 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1214 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1215
1216 private:
1217 String::Encoding encoding_;
1218};
1219
1220
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001221class LThrow: public LTemplateInstruction<0, 1, 0> {
1222 public:
1223 explicit LThrow(LOperand* value) {
1224 inputs_[0] = value;
1225 }
1226
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001227 LOperand* value() { return inputs_[0]; }
1228
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001229 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1230};
1231
1232
1233class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1234 public:
1235 explicit LBitNotI(LOperand* value) {
1236 inputs_[0] = value;
1237 }
1238
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001239 LOperand* value() { return inputs_[0]; }
1240
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001241 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1242};
1243
1244
1245class LAddI: public LTemplateInstruction<1, 2, 0> {
1246 public:
1247 LAddI(LOperand* left, LOperand* right) {
1248 inputs_[0] = left;
1249 inputs_[1] = right;
1250 }
1251
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001252 LOperand* left() { return inputs_[0]; }
1253 LOperand* right() { return inputs_[1]; }
1254
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001255 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1256 DECLARE_HYDROGEN_ACCESSOR(Add)
1257};
1258
1259
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001260class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1261 public:
1262 LMathMinMax(LOperand* left, LOperand* right) {
1263 inputs_[0] = left;
1264 inputs_[1] = right;
1265 }
1266
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001267 LOperand* left() { return inputs_[0]; }
1268 LOperand* right() { return inputs_[1]; }
1269
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001270 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max")
1271 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1272};
1273
1274
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001275class LPower: public LTemplateInstruction<1, 2, 0> {
1276 public:
1277 LPower(LOperand* left, LOperand* right) {
1278 inputs_[0] = left;
1279 inputs_[1] = right;
1280 }
1281
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001282 LOperand* left() { return inputs_[0]; }
1283 LOperand* right() { return inputs_[1]; }
1284
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001285 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1286 DECLARE_HYDROGEN_ACCESSOR(Power)
1287};
1288
1289
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001290class LRandom: public LTemplateInstruction<1, 1, 0> {
1291 public:
1292 explicit LRandom(LOperand* global_object) {
1293 inputs_[0] = global_object;
1294 }
1295
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001296 LOperand* global_object() { return inputs_[0]; }
1297
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001298 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1299 DECLARE_HYDROGEN_ACCESSOR(Random)
1300};
1301
1302
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001303class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1304 public:
1305 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1306 : op_(op) {
1307 inputs_[0] = left;
1308 inputs_[1] = right;
1309 }
1310
1311 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001312 LOperand* left() { return inputs_[0]; }
1313 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001314
1315 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1316 virtual void CompileToNative(LCodeGen* generator);
1317 virtual const char* Mnemonic() const;
1318
1319 private:
1320 Token::Value op_;
1321};
1322
1323
1324class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1325 public:
1326 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1327 : op_(op) {
1328 inputs_[0] = left;
1329 inputs_[1] = right;
1330 }
1331
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001332 LOperand* left() { return inputs_[0]; }
1333 LOperand* right() { return inputs_[1]; }
1334 Token::Value op() const { return op_; }
1335
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001336 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1337 virtual void CompileToNative(LCodeGen* generator);
1338 virtual const char* Mnemonic() const;
1339
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001340 private:
1341 Token::Value op_;
1342};
1343
1344
1345class LReturn: public LTemplateInstruction<0, 1, 0> {
1346 public:
1347 explicit LReturn(LOperand* value) {
1348 inputs_[0] = value;
1349 }
1350
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001351 LOperand* value() { return inputs_[0]; }
1352
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001353 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1354};
1355
1356
1357class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1358 public:
1359 explicit LLoadNamedField(LOperand* object) {
1360 inputs_[0] = object;
1361 }
1362
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001363 LOperand* object() { return inputs_[0]; }
1364
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001365 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1366 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1367};
1368
1369
1370class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1371 public:
1372 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1373 inputs_[0] = object;
1374 }
1375
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001376 LOperand* object() { return inputs_[0]; }
1377
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001378 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1379 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001380};
1381
1382
1383class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1384 public:
1385 explicit LLoadNamedGeneric(LOperand* object) {
1386 inputs_[0] = object;
1387 }
1388
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001389 LOperand* object() { return inputs_[0]; }
1390
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001391 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1392 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1393
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001394 Handle<Object> name() const { return hydrogen()->name(); }
1395};
1396
1397
1398class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1399 public:
1400 explicit LLoadFunctionPrototype(LOperand* function) {
1401 inputs_[0] = function;
1402 }
1403
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001404 LOperand* function() { return inputs_[0]; }
1405
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001406 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1407 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001408};
1409
1410
1411class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1412 public:
1413 explicit LLoadElements(LOperand* object) {
1414 inputs_[0] = object;
1415 }
1416
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001417 LOperand* object() { return inputs_[0]; }
1418
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001419 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1420};
1421
1422
1423class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1424 public:
1425 explicit LLoadExternalArrayPointer(LOperand* object) {
1426 inputs_[0] = object;
1427 }
1428
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001429 LOperand* object() { return inputs_[0]; }
1430
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001431 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1432 "load-external-array-pointer")
1433};
1434
1435
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001436class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001437 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001438 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001439 inputs_[0] = elements;
1440 inputs_[1] = key;
1441 }
1442
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001443 LOperand* elements() { return inputs_[0]; }
1444 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001445 ElementsKind elements_kind() const {
1446 return hydrogen()->elements_kind();
1447 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001448 bool is_external() const {
1449 return hydrogen()->is_external();
1450 }
1451
1452 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1453 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1454
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001455 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001456 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001457};
1458
1459
1460class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1461 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001462 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1463 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001464 inputs_[1] = key;
1465 }
1466
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001467 LOperand* object() { return inputs_[0]; }
1468 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001469
1470 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001471};
1472
1473
1474class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1475 public:
1476 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1477 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1478};
1479
1480
1481class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1482 public:
1483 explicit LLoadGlobalGeneric(LOperand* global_object) {
1484 inputs_[0] = global_object;
1485 }
1486
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001487 LOperand* global_object() { return inputs_[0]; }
1488
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001489 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1490 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1491
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001492 Handle<Object> name() const { return hydrogen()->name(); }
1493 bool for_typeof() const { return hydrogen()->for_typeof(); }
1494};
1495
1496
1497class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1498 public:
1499 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1500 inputs_[0] = value;
1501 temps_[0] = temp;
1502 }
1503
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001504 LOperand* value() { return inputs_[0]; }
1505 LOperand* temp() { return temps_[0]; }
1506
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001507 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1508 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1509};
1510
1511
1512class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1513 public:
1514 explicit LStoreGlobalGeneric(LOperand* global_object,
1515 LOperand* value) {
1516 inputs_[0] = global_object;
1517 inputs_[1] = value;
1518 }
1519
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001520 LOperand* global_object() { return inputs_[0]; }
1521 LOperand* value() { return inputs_[1]; }
1522
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001523 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1524 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1525
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001526 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001527 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001528};
1529
1530
1531class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1532 public:
1533 explicit LLoadContextSlot(LOperand* context) {
1534 inputs_[0] = context;
1535 }
1536
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001537 LOperand* context() { return inputs_[0]; }
1538
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001539 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1540 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1541
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001542 int slot_index() { return hydrogen()->slot_index(); }
1543
1544 virtual void PrintDataTo(StringStream* stream);
1545};
1546
1547
1548class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1549 public:
1550 LStoreContextSlot(LOperand* context, LOperand* value) {
1551 inputs_[0] = context;
1552 inputs_[1] = value;
1553 }
1554
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001555 LOperand* context() { return inputs_[0]; }
1556 LOperand* value() { return inputs_[1]; }
1557
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001558 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1559 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1560
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001561 int slot_index() { return hydrogen()->slot_index(); }
1562
1563 virtual void PrintDataTo(StringStream* stream);
1564};
1565
1566
1567class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1568 public:
1569 explicit LPushArgument(LOperand* value) {
1570 inputs_[0] = value;
1571 }
1572
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001573 LOperand* value() { return inputs_[0]; }
1574
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001575 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1576};
1577
1578
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001579class LDrop: public LTemplateInstruction<0, 0, 0> {
1580 public:
1581 explicit LDrop(int count) : count_(count) { }
1582
1583 int count() const { return count_; }
1584
1585 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1586
1587 private:
1588 int count_;
1589};
1590
1591
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001592class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1593 public:
1594 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1595 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1596};
1597
1598
1599class LContext: public LTemplateInstruction<1, 0, 0> {
1600 public:
1601 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001602 DECLARE_HYDROGEN_ACCESSOR(Context)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001603};
1604
1605
1606class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1607 public:
1608 explicit LOuterContext(LOperand* context) {
1609 inputs_[0] = context;
1610 }
1611
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001612 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001613
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001614 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001615};
1616
1617
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001618class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1619 public:
1620 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1621 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1622};
1623
1624
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001625class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1626 public:
1627 explicit LGlobalObject(LOperand* context) {
1628 inputs_[0] = context;
1629 }
1630
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001631 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001632
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001633 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001634};
1635
1636
1637class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1638 public:
1639 explicit LGlobalReceiver(LOperand* global_object) {
1640 inputs_[0] = global_object;
1641 }
1642
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001643 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001644
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001645 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001646};
1647
1648
1649class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1650 public:
1651 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1652 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1653
1654 virtual void PrintDataTo(StringStream* stream);
1655
1656 Handle<JSFunction> function() { return hydrogen()->function(); }
1657 int arity() const { return hydrogen()->argument_count() - 1; }
1658};
1659
1660
1661class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1662 public:
1663 explicit LInvokeFunction(LOperand* function) {
1664 inputs_[0] = function;
1665 }
1666
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001667 LOperand* function() { return inputs_[0]; }
1668
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001669 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1670 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1671
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001672 virtual void PrintDataTo(StringStream* stream);
1673
1674 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001675 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001676};
1677
1678
1679class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1680 public:
1681 explicit LCallKeyed(LOperand* key) {
1682 inputs_[0] = key;
1683 }
1684
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001685 LOperand* key() { return inputs_[0]; }
1686
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001687 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1688 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1689
1690 virtual void PrintDataTo(StringStream* stream);
1691
1692 int arity() const { return hydrogen()->argument_count() - 1; }
1693};
1694
1695
1696
1697class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1698 public:
1699 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1700 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1701
1702 virtual void PrintDataTo(StringStream* stream);
1703
1704 Handle<String> name() const { return hydrogen()->name(); }
1705 int arity() const { return hydrogen()->argument_count() - 1; }
1706};
1707
1708
danno@chromium.orgc612e022011-11-10 11:38:15 +00001709class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001710 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001711 explicit LCallFunction(LOperand* function) {
1712 inputs_[0] = function;
1713 }
1714
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001715 LOperand* function() { return inputs_[0]; }
1716
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001717 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1718 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1719
danno@chromium.orgc612e022011-11-10 11:38:15 +00001720 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001721};
1722
1723
1724class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1725 public:
1726 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1727 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1728
1729 virtual void PrintDataTo(StringStream* stream);
1730
1731 Handle<String> name() const {return hydrogen()->name(); }
1732 int arity() const { return hydrogen()->argument_count() - 1; }
1733};
1734
1735
1736class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1737 public:
1738 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1739 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1740
1741 virtual void PrintDataTo(StringStream* stream);
1742
1743 Handle<JSFunction> target() const { return hydrogen()->target(); }
1744 int arity() const { return hydrogen()->argument_count() - 1; }
1745};
1746
1747
1748class LCallNew: public LTemplateInstruction<1, 1, 0> {
1749 public:
1750 explicit LCallNew(LOperand* constructor) {
1751 inputs_[0] = constructor;
1752 }
1753
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001754 LOperand* constructor() { return inputs_[0]; }
1755
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001756 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1757 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1758
1759 virtual void PrintDataTo(StringStream* stream);
1760
1761 int arity() const { return hydrogen()->argument_count() - 1; }
1762};
1763
1764
1765class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1766 public:
1767 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1768 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1769
1770 const Runtime::Function* function() const { return hydrogen()->function(); }
1771 int arity() const { return hydrogen()->argument_count(); }
1772};
1773
1774
1775class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1776 public:
1777 explicit LInteger32ToDouble(LOperand* value) {
1778 inputs_[0] = value;
1779 }
1780
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001781 LOperand* value() { return inputs_[0]; }
1782
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001783 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1784};
1785
1786
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001787class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1788 public:
1789 explicit LUint32ToDouble(LOperand* value) {
1790 inputs_[0] = value;
1791 }
1792
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001793 LOperand* value() { return inputs_[0]; }
1794
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001795 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1796};
1797
1798
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001799class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1800 public:
1801 explicit LNumberTagI(LOperand* value) {
1802 inputs_[0] = value;
1803 }
1804
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001805 LOperand* value() { return inputs_[0]; }
1806
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001807 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1808};
1809
1810
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001811class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1812 public:
1813 explicit LNumberTagU(LOperand* value) {
1814 inputs_[0] = value;
1815 }
1816
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001817 LOperand* value() { return inputs_[0]; }
1818
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001819 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1820};
1821
1822
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001823class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1824 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001825 LNumberTagD(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001826 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001827 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001828 temps_[1] = temp2;
1829 }
1830
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001831 LOperand* value() { return inputs_[0]; }
1832 LOperand* temp() { return temps_[0]; }
1833 LOperand* temp2() { return temps_[1]; }
1834
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001835 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001836 DECLARE_HYDROGEN_ACCESSOR(Change)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001837};
1838
1839
1840// Sometimes truncating conversion from a tagged value to an int32.
1841class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1842 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001843 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001844 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001845 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001846 temps_[1] = temp2;
1847 }
1848
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001849 LOperand* value() { return inputs_[0]; }
1850 LOperand* temp() { return temps_[0]; }
1851 LOperand* temp2() { return temps_[1]; }
1852
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001853 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1854 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1855
1856 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1857};
1858
1859
1860// Truncating conversion from a tagged value to an int32.
1861class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1862 public:
1863 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001864 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001865 LOperand* temp2,
1866 LOperand* temp3) {
1867 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001868 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001869 temps_[1] = temp2;
1870 temps_[2] = temp3;
1871 }
1872
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001873 LOperand* value() { return inputs_[0]; }
1874 LOperand* temp() { return temps_[0]; }
1875 LOperand* temp2() { return temps_[1]; }
1876 LOperand* temp3() { return temps_[2]; }
1877
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001878 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1879 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1880
1881 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1882};
1883
1884
1885class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1886 public:
1887 explicit LSmiTag(LOperand* value) {
1888 inputs_[0] = value;
1889 }
1890
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001891 LOperand* value() { return inputs_[0]; }
1892
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001893 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1894};
1895
1896
1897class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1898 public:
1899 explicit LNumberUntagD(LOperand* value) {
1900 inputs_[0] = value;
1901 }
1902
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001903 LOperand* value() { return inputs_[0]; }
1904
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001905 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1906 DECLARE_HYDROGEN_ACCESSOR(Change)
1907};
1908
1909
1910class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1911 public:
1912 LSmiUntag(LOperand* value, bool needs_check)
1913 : needs_check_(needs_check) {
1914 inputs_[0] = value;
1915 }
1916
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001917 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001918 bool needs_check() const { return needs_check_; }
1919
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001920 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1921
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001922 private:
1923 bool needs_check_;
1924};
1925
1926
verwaest@chromium.org37141392012-05-31 13:27:02 +00001927class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001928 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001929 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
1930 inputs_[0] = object;
1931 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001932 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001933 }
1934
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001935 LOperand* object() { return inputs_[0]; }
1936 LOperand* value() { return inputs_[1]; }
1937 LOperand* temp() { return temps_[0]; }
1938
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001939 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1940 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1941
1942 virtual void PrintDataTo(StringStream* stream);
1943
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001944 Handle<Object> name() const { return hydrogen()->name(); }
1945 bool is_in_object() { return hydrogen()->is_in_object(); }
1946 int offset() { return hydrogen()->offset(); }
1947 Handle<Map> transition() const { return hydrogen()->transition(); }
1948};
1949
1950
1951class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1952 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001953 LStoreNamedGeneric(LOperand* object, LOperand* value) {
1954 inputs_[0] = object;
1955 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001956 }
1957
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001958 LOperand* object() { return inputs_[0]; }
1959 LOperand* value() { return inputs_[1]; }
1960
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001961 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1962 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1963
1964 virtual void PrintDataTo(StringStream* stream);
1965
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001966 Handle<Object> name() const { return hydrogen()->name(); }
1967 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001968};
1969
1970
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001971class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001972 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001973 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001974 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001975 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001976 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001977 }
1978
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001979 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001980 LOperand* elements() { return inputs_[0]; }
1981 LOperand* key() { return inputs_[1]; }
1982 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001983 ElementsKind elements_kind() const {
1984 return hydrogen()->elements_kind();
1985 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001986
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001987 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
1988 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001989
1990 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001991 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001992 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001993};
1994
1995
1996class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1997 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001998 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001999 inputs_[0] = obj;
2000 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002001 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002002 }
2003
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002004 LOperand* object() { return inputs_[0]; }
2005 LOperand* key() { return inputs_[1]; }
2006 LOperand* value() { return inputs_[2]; }
2007
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002008 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2009 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2010
2011 virtual void PrintDataTo(StringStream* stream);
2012
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00002013 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002014};
2015
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002016
2017class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
2018 public:
2019 LTransitionElementsKind(LOperand* object,
2020 LOperand* new_map_temp,
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002021 LOperand* fixed_object_temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002022 inputs_[0] = object;
2023 temps_[0] = new_map_temp;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002024 temps_[1] = fixed_object_temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002025 }
2026
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002027 LOperand* object() { return inputs_[0]; }
2028 LOperand* new_map_temp() { return temps_[0]; }
2029 LOperand* temp() { return temps_[1]; }
2030
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002031 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2032 "transition-elements-kind")
2033 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2034
2035 virtual void PrintDataTo(StringStream* stream);
2036
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002037 Handle<Map> original_map() { return hydrogen()->original_map(); }
2038 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002039 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2040 ElementsKind to_kind() { return hydrogen()->to_kind(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002041};
2042
2043
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002044class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> {
2045 public:
2046 LTrapAllocationMemento(LOperand* object,
2047 LOperand* temp) {
2048 inputs_[0] = object;
2049 temps_[0] = temp;
2050 }
2051
2052 LOperand* object() { return inputs_[0]; }
2053 LOperand* temp() { return temps_[0]; }
2054
2055 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2056 "trap-allocation-memento")
2057};
2058
2059
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002060class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2061 public:
2062 LStringAdd(LOperand* left, LOperand* right) {
2063 inputs_[0] = left;
2064 inputs_[1] = right;
2065 }
2066
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002067 LOperand* left() { return inputs_[0]; }
2068 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002069
2070 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2071 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002072};
2073
2074
2075
2076class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2077 public:
2078 LStringCharCodeAt(LOperand* string, LOperand* index) {
2079 inputs_[0] = string;
2080 inputs_[1] = index;
2081 }
2082
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002083 LOperand* string() { return inputs_[0]; }
2084 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002085
2086 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2087 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002088};
2089
2090
2091class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2092 public:
2093 explicit LStringCharFromCode(LOperand* char_code) {
2094 inputs_[0] = char_code;
2095 }
2096
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002097 LOperand* char_code() { return inputs_[0]; }
2098
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002099 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2100 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002101};
2102
2103
2104class LStringLength: public LTemplateInstruction<1, 1, 0> {
2105 public:
2106 explicit LStringLength(LOperand* string) {
2107 inputs_[0] = string;
2108 }
2109
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002110 LOperand* string() { return inputs_[0]; }
2111
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002112 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2113 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002114};
2115
2116
2117class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2118 public:
2119 explicit LCheckFunction(LOperand* value) {
2120 inputs_[0] = value;
2121 }
2122
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002123 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002124
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002125 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2126 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2127};
2128
2129
2130class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2131 public:
2132 explicit LCheckInstanceType(LOperand* value) {
2133 inputs_[0] = value;
2134 }
2135
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002136 LOperand* value() { return inputs_[0]; }
2137
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002138 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2139 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2140};
2141
2142
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002143class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002144 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002145 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002146 inputs_[0] = value;
2147 }
2148
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002149 LOperand* value() { return inputs_[0]; }
2150
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002151 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2152 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002153};
2154
2155
verwaest@chromium.orge4ee6de2012-11-06 12:13:00 +00002156class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002157 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002158 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2159 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002160 temps_[1] = temp2;
2161 }
2162
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002163 LOperand* temp() { return temps_[0]; }
2164 LOperand* temp2() { return temps_[1]; }
2165
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002166 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2167 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2168
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002169 ZoneList<Handle<JSObject> >* prototypes() const {
2170 return hydrogen()->prototypes();
2171 }
2172 ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002173};
2174
2175
2176class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2177 public:
2178 explicit LCheckSmi(LOperand* value) {
2179 inputs_[0] = value;
2180 }
2181
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002182 LOperand* value() { return inputs_[0]; }
2183
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002184 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2185};
2186
2187
2188class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2189 public:
2190 explicit LCheckNonSmi(LOperand* value) {
2191 inputs_[0] = value;
2192 }
2193
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002194 LOperand* value() { return inputs_[0]; }
2195
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002196 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2197};
2198
2199
2200class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2201 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002202 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2203 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002204 temps_[0] = temp;
2205 }
2206
2207 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002208 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002209
2210 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2211};
2212
2213
2214class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2215 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002216 explicit LClampIToUint8(LOperand* unclamped) {
2217 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002218 }
2219
2220 LOperand* unclamped() { return inputs_[0]; }
2221
2222 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2223};
2224
2225
2226class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2227 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002228 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2229 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002230 temps_[0] = temp;
2231 }
2232
2233 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002234 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002235
2236 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2237};
2238
2239
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002240class LAllocateObject: public LTemplateInstruction<1, 1, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002241 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002242 LAllocateObject(LOperand* temp, LOperand* temp2) {
2243 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002244 temps_[1] = temp2;
2245 }
2246
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002247 LOperand* temp() { return temps_[0]; }
2248 LOperand* temp2() { return temps_[1]; }
2249
ulan@chromium.org967e2702012-02-28 09:49:15 +00002250 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2251 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2252};
2253
2254
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002255class LAllocate: public LTemplateInstruction<1, 2, 2> {
2256 public:
2257 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2258 inputs_[1] = size;
2259 temps_[0] = temp1;
2260 temps_[1] = temp2;
2261 }
2262
2263 LOperand* size() { return inputs_[1]; }
2264 LOperand* temp1() { return temps_[0]; }
2265 LOperand* temp2() { return temps_[1]; }
2266
2267 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2268 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2269};
2270
2271
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002272class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
2273 public:
2274 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2275 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2276};
2277
2278
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002279class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2280 public:
2281 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2282 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2283};
2284
2285
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002286class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002287 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002288 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2289 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002290};
2291
2292
2293class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2294 public:
2295 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2296 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2297};
2298
2299
2300class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2301 public:
2302 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2303 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2304
2305 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2306};
2307
2308
2309class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2310 public:
2311 explicit LToFastProperties(LOperand* value) {
2312 inputs_[0] = value;
2313 }
2314
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002315 LOperand* value() { return inputs_[0]; }
2316
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002317 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2318 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2319};
2320
2321
2322class LTypeof: public LTemplateInstruction<1, 1, 0> {
2323 public:
2324 explicit LTypeof(LOperand* value) {
2325 inputs_[0] = value;
2326 }
2327
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002328 LOperand* value() { return inputs_[0]; }
2329
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002330 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2331};
2332
2333
2334class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2335 public:
2336 explicit LTypeofIsAndBranch(LOperand* value) {
2337 inputs_[0] = value;
2338 }
2339
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002340 LOperand* value() { return inputs_[0]; }
2341
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002342 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2343 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2344
2345 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2346
2347 virtual void PrintDataTo(StringStream* stream);
2348};
2349
2350
2351class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2352 public:
2353 explicit LIsConstructCallAndBranch(LOperand* temp) {
2354 temps_[0] = temp;
2355 }
2356
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002357 LOperand* temp() { return temps_[0]; }
2358
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002359 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2360 "is-construct-call-and-branch")
2361};
2362
2363
2364class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2365 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002366 LDeleteProperty(LOperand* object, LOperand* key) {
2367 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002368 inputs_[1] = key;
2369 }
2370
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002371 LOperand* object() { return inputs_[0]; }
2372 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002373
2374 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002375};
2376
2377
2378class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2379 public:
2380 LOsrEntry();
2381
2382 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2383
2384 LOperand** SpilledRegisterArray() { return register_spills_; }
2385 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2386
2387 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2388 void MarkSpilledDoubleRegister(int allocation_index,
2389 LOperand* spill_operand);
2390
2391 private:
2392 // Arrays of spill slot operands for registers with an assigned spill
2393 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2394 // NULL if the register has no assigned spill slot. Indexed by allocation
2395 // index.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002396 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters];
2397 LOperand* double_register_spills_[
2398 DoubleRegister::kMaxNumAllocatableRegisters];
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002399};
2400
2401
2402class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2403 public:
2404 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2405 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2406
2407 Label* done_label() { return &done_label_; }
2408
2409 private:
2410 Label done_label_;
2411};
2412
2413
2414class LIn: public LTemplateInstruction<1, 2, 0> {
2415 public:
2416 LIn(LOperand* key, LOperand* object) {
2417 inputs_[0] = key;
2418 inputs_[1] = object;
2419 }
2420
2421 LOperand* key() { return inputs_[0]; }
2422 LOperand* object() { return inputs_[1]; }
2423
2424 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2425};
2426
2427
ulan@chromium.org812308e2012-02-29 15:58:45 +00002428class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2429 public:
2430 explicit LForInPrepareMap(LOperand* object) {
2431 inputs_[0] = object;
2432 }
2433
2434 LOperand* object() { return inputs_[0]; }
2435
2436 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2437};
2438
2439
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002440class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002441 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002442 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002443 inputs_[0] = map;
2444 }
2445
2446 LOperand* map() { return inputs_[0]; }
2447
2448 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2449
2450 int idx() {
2451 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2452 }
2453};
2454
2455
2456class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2457 public:
2458 LCheckMapValue(LOperand* value, LOperand* map) {
2459 inputs_[0] = value;
2460 inputs_[1] = map;
2461 }
2462
2463 LOperand* value() { return inputs_[0]; }
2464 LOperand* map() { return inputs_[1]; }
2465
2466 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2467};
2468
2469
2470class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2471 public:
2472 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2473 inputs_[0] = object;
2474 inputs_[1] = index;
2475 }
2476
2477 LOperand* object() { return inputs_[0]; }
2478 LOperand* index() { return inputs_[1]; }
2479
2480 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2481};
2482
2483
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002484class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002485class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002486 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002487 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2488 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002489
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002490 int GetNextSpillIndex(bool is_double);
2491 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002492};
2493
2494
2495class LChunkBuilder BASE_EMBEDDED {
2496 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002497 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2498 : chunk_(NULL),
2499 info_(info),
2500 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002501 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002502 status_(UNUSED),
2503 current_instruction_(NULL),
2504 current_block_(NULL),
2505 next_block_(NULL),
2506 argument_count_(0),
2507 allocator_(allocator),
2508 position_(RelocInfo::kNoPosition),
2509 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002510 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002511
2512 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002513 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002514
2515 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002516#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002517 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2518#undef DECLARE_DO
2519
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002520 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2521
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002522 private:
2523 enum Status {
2524 UNUSED,
2525 BUILDING,
2526 DONE,
2527 ABORTED
2528 };
2529
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002530 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002531 CompilationInfo* info() const { return info_; }
2532 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002533 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002534
2535 bool is_unused() const { return status_ == UNUSED; }
2536 bool is_building() const { return status_ == BUILDING; }
2537 bool is_done() const { return status_ == DONE; }
2538 bool is_aborted() const { return status_ == ABORTED; }
2539
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002540 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002541
2542 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002543 LUnallocated* ToUnallocated(Register reg);
2544 LUnallocated* ToUnallocated(DoubleRegister reg);
2545
2546 // Methods for setting up define-use relationships.
2547 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2548 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2549 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2550 DoubleRegister fixed_register);
2551
2552 // A value that is guaranteed to be allocated to a register.
2553 // Operand created by UseRegister is guaranteed to be live until the end of
2554 // instruction. This means that register allocator will not reuse it's
2555 // register for any other operand inside instruction.
2556 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2557 // instruction start. Register allocator is free to assign the same register
2558 // to some other operand used inside instruction (i.e. temporary or
2559 // output).
2560 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2561 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2562
2563 // An input operand in a register that may be trashed.
2564 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2565
2566 // An input operand in a register or stack slot.
2567 MUST_USE_RESULT LOperand* Use(HValue* value);
2568 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2569
2570 // An input operand in a register, stack slot or a constant operand.
2571 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2572 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2573
2574 // An input operand in a register or a constant operand.
2575 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2576 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2577
2578 // An input operand in register, stack slot or a constant operand.
2579 // Will not be moved to a register even if one is freely available.
2580 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2581
2582 // Temporary operand that must be in a register.
2583 MUST_USE_RESULT LUnallocated* TempRegister();
2584 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2585 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2586
2587 // Methods for setting up define-use relationships.
2588 // Return the same instruction that they are passed.
2589 template<int I, int T>
2590 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2591 LUnallocated* result);
2592 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002593 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2594 template<int I, int T>
2595 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2596 int index);
2597 template<int I, int T>
2598 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2599 template<int I, int T>
2600 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2601 Register reg);
2602 template<int I, int T>
2603 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2604 DoubleRegister reg);
2605 LInstruction* AssignEnvironment(LInstruction* instr);
2606 LInstruction* AssignPointerMap(LInstruction* instr);
2607
2608 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2609
2610 // By default we assume that instruction sequences generated for calls
2611 // cannot deoptimize eagerly and we do not attach environment to this
2612 // instruction.
2613 LInstruction* MarkAsCall(
2614 LInstruction* instr,
2615 HInstruction* hinstr,
2616 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002617
2618 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2619 int* argument_index_accumulator);
2620
2621 void VisitInstruction(HInstruction* current);
2622
2623 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2624 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2625 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2626 LInstruction* DoArithmeticD(Token::Value op,
2627 HArithmeticBinaryOperation* instr);
2628 LInstruction* DoArithmeticT(Token::Value op,
2629 HArithmeticBinaryOperation* instr);
2630
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002631 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002632 CompilationInfo* info_;
2633 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002634 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002635 Status status_;
2636 HInstruction* current_instruction_;
2637 HBasicBlock* current_block_;
2638 HBasicBlock* next_block_;
2639 int argument_count_;
2640 LAllocator* allocator_;
2641 int position_;
2642 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002643 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002644
lrn@chromium.org7516f052011-03-30 08:52:27 +00002645 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2646};
2647
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002648#undef DECLARE_HYDROGEN_ACCESSOR
2649#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002650
2651} } // namespace v8::internal
2652
2653#endif // V8_MIPS_LITHIUM_MIPS_H_