blob: c5a00d74b62dd9e4b7772140f09045a2ad8dc0ee [file] [log] [blame]
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001// Copyright 2012 the V8 project authors. All rights reserved.
lrn@chromium.org7516f052011-03-30 08:52:27 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef V8_MIPS_LITHIUM_MIPS_H_
29#define V8_MIPS_LITHIUM_MIPS_H_
30
31#include "hydrogen.h"
32#include "lithium-allocator.h"
33#include "lithium.h"
34#include "safepoint-table.h"
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000035#include "utils.h"
lrn@chromium.org7516f052011-03-30 08:52:27 +000036
37namespace v8 {
38namespace internal {
39
40// Forward declarations.
41class LCodeGen;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000042
43#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
44 V(ControlInstruction) \
45 V(Call) \
46 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
47
48
49#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
50 V(AccessArgumentsAt) \
51 V(AddI) \
ulan@chromium.org967e2702012-02-28 09:49:15 +000052 V(AllocateObject) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +000053 V(Allocate) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000054 V(ApplyArguments) \
55 V(ArgumentsElements) \
56 V(ArgumentsLength) \
57 V(ArithmeticD) \
58 V(ArithmeticT) \
59 V(ArrayLiteral) \
60 V(BitI) \
61 V(BitNotI) \
62 V(BoundsCheck) \
63 V(Branch) \
64 V(CallConstantFunction) \
65 V(CallFunction) \
66 V(CallGlobal) \
67 V(CallKeyed) \
68 V(CallKnownGlobal) \
69 V(CallNamed) \
70 V(CallNew) \
ulan@chromium.org750145a2013-03-07 15:14:13 +000071 V(CallNewArray) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000072 V(CallRuntime) \
73 V(CallStub) \
74 V(CheckFunction) \
75 V(CheckInstanceType) \
jkummerow@chromium.org1456e702012-03-30 08:38:13 +000076 V(CheckMaps) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000077 V(CheckNonSmi) \
78 V(CheckPrototypeMaps) \
79 V(CheckSmi) \
80 V(ClampDToUint8) \
81 V(ClampIToUint8) \
82 V(ClampTToUint8) \
83 V(ClassOfTestAndBranch) \
84 V(CmpConstantEqAndBranch) \
85 V(CmpIDAndBranch) \
86 V(CmpObjectEqAndBranch) \
87 V(CmpMapAndBranch) \
88 V(CmpT) \
89 V(ConstantD) \
90 V(ConstantI) \
91 V(ConstantT) \
92 V(Context) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000093 V(DeclareGlobals) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000094 V(DeleteProperty) \
95 V(Deoptimize) \
96 V(DivI) \
97 V(DoubleToI) \
yangguo@chromium.org46a2a512013-01-18 16:29:40 +000098 V(DummyUse) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000099 V(ElementsKind) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000100 V(FastLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000101 V(FixedArrayBaseLength) \
102 V(FunctionLiteral) \
103 V(GetCachedArrayIndex) \
104 V(GlobalObject) \
105 V(GlobalReceiver) \
106 V(Goto) \
107 V(HasCachedArrayIndexAndBranch) \
108 V(HasInstanceTypeAndBranch) \
109 V(In) \
110 V(InstanceOf) \
111 V(InstanceOfKnownGlobal) \
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +0000112 V(InstanceSize) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000113 V(InstructionGap) \
114 V(Integer32ToDouble) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000115 V(Uint32ToDouble) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000116 V(InvokeFunction) \
117 V(IsConstructCallAndBranch) \
118 V(IsNilAndBranch) \
119 V(IsObjectAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000120 V(IsStringAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000121 V(IsSmiAndBranch) \
122 V(IsUndetectableAndBranch) \
123 V(JSArrayLength) \
124 V(Label) \
125 V(LazyBailout) \
126 V(LoadContextSlot) \
127 V(LoadElements) \
128 V(LoadExternalArrayPointer) \
129 V(LoadFunctionPrototype) \
130 V(LoadGlobalCell) \
131 V(LoadGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000132 V(LoadKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000133 V(LoadKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000134 V(LoadNamedField) \
135 V(LoadNamedFieldPolymorphic) \
136 V(LoadNamedGeneric) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000137 V(MapEnumLength) \
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000138 V(MathExp) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000139 V(MathMinMax) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000140 V(ModI) \
141 V(MulI) \
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000142 V(MultiplyAddD) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000143 V(NumberTagD) \
144 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000145 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000146 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000147 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000148 V(OsrEntry) \
149 V(OuterContext) \
150 V(Parameter) \
151 V(Power) \
152 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000153 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000154 V(RegExpLiteral) \
155 V(Return) \
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000156 V(SeqStringSetChar) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000157 V(ShiftI) \
158 V(SmiTag) \
159 V(SmiUntag) \
160 V(StackCheck) \
161 V(StoreContextSlot) \
162 V(StoreGlobalCell) \
163 V(StoreGlobalGeneric) \
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +0000164 V(StoreKeyed) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000165 V(StoreKeyedGeneric) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000166 V(StoreNamedField) \
167 V(StoreNamedGeneric) \
168 V(StringAdd) \
169 V(StringCharCodeAt) \
170 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000171 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000172 V(StringLength) \
173 V(SubI) \
174 V(TaggedToI) \
175 V(ThisFunction) \
176 V(Throw) \
177 V(ToFastProperties) \
178 V(TransitionElementsKind) \
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +0000179 V(TrapAllocationMemento) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000180 V(Typeof) \
181 V(TypeofIsAndBranch) \
182 V(UnaryMathOperation) \
183 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000184 V(ValueOf) \
185 V(ForInPrepareMap) \
186 V(ForInCacheArray) \
187 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000188 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000189 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000190 V(WrapReceiver) \
191 V(Drop)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000192
193#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
194 virtual Opcode opcode() const { return LInstruction::k##type; } \
195 virtual void CompileToNative(LCodeGen* generator); \
196 virtual const char* Mnemonic() const { return mnemonic; } \
197 static L##type* cast(LInstruction* instr) { \
198 ASSERT(instr->Is##type()); \
199 return reinterpret_cast<L##type*>(instr); \
200 }
201
202
203#define DECLARE_HYDROGEN_ACCESSOR(type) \
204 H##type* hydrogen() const { \
205 return H##type::cast(hydrogen_value()); \
206 }
207
lrn@chromium.org7516f052011-03-30 08:52:27 +0000208
209class LInstruction: public ZoneObject {
210 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000211 LInstruction()
212 : environment_(NULL),
213 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000214 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000215 virtual ~LInstruction() { }
216
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000217 virtual void CompileToNative(LCodeGen* generator) = 0;
218 virtual const char* Mnemonic() const = 0;
219 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000220 virtual void PrintDataTo(StringStream* stream);
221 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000222
223 enum Opcode {
224 // Declare a unique enum value for each instruction.
225#define DECLARE_OPCODE(type) k##type,
226 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
227 kNumberOfInstructions
228#undef DECLARE_OPCODE
229 };
230
231 virtual Opcode opcode() const = 0;
232
233 // Declare non-virtual type testers for all leaf IR classes.
234#define DECLARE_PREDICATE(type) \
235 bool Is##type() const { return opcode() == k##type; }
236 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
237#undef DECLARE_PREDICATE
238
239 // Declare virtual predicates for instructions that don't have
240 // an opcode.
241 virtual bool IsGap() const { return false; }
242
243 virtual bool IsControl() const { return false; }
244
245 void set_environment(LEnvironment* env) { environment_ = env; }
246 LEnvironment* environment() const { return environment_; }
247 bool HasEnvironment() const { return environment_ != NULL; }
248
249 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
250 LPointerMap* pointer_map() const { return pointer_map_.get(); }
251 bool HasPointerMap() const { return pointer_map_.is_set(); }
252
253 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
254 HValue* hydrogen_value() const { return hydrogen_value_; }
255
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000256 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000257
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000258 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000259
260 // Interface to the register allocator and iterators.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000261 bool ClobbersTemps() const { return is_call_; }
262 bool ClobbersRegisters() const { return is_call_; }
263 bool ClobbersDoubleRegisters() const { return is_call_; }
264
265 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000266 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000267
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000268 virtual bool HasResult() const = 0;
269 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000270
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000271 LOperand* FirstInput() { return InputAt(0); }
272 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000273
274#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000275 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000276#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000277
278 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000279 // Iterator interface.
280 friend class InputIterator;
281 virtual int InputCount() = 0;
282 virtual LOperand* InputAt(int i) = 0;
283
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000284 friend class TempIterator;
285 virtual int TempCount() = 0;
286 virtual LOperand* TempAt(int i) = 0;
287
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000288 LEnvironment* environment_;
289 SetOncePointer<LPointerMap> pointer_map_;
290 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000291 bool is_call_;
292 bool is_save_doubles_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000293};
294
295
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000296// R = number of result operands (0 or 1).
297// I = number of input operands.
298// T = number of temporary operands.
299template<int R, int I, int T>
300class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000301 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000302 // Allow 0 or 1 output operands.
303 STATIC_ASSERT(R == 0 || R == 1);
304 virtual bool HasResult() const { return R != 0; }
305 void set_result(LOperand* operand) { results_[0] = operand; }
306 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000307
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000308 protected:
309 EmbeddedContainer<LOperand*, R> results_;
310 EmbeddedContainer<LOperand*, I> inputs_;
311 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000312
313 private:
314 virtual int InputCount() { return I; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000315 virtual LOperand* InputAt(int i) { return inputs_[i]; }
316
317 virtual int TempCount() { return T; }
318 virtual LOperand* TempAt(int i) { return temps_[i]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000319};
320
321
322class LGap: public LTemplateInstruction<0, 0, 0> {
323 public:
324 explicit LGap(HBasicBlock* block)
325 : block_(block) {
326 parallel_moves_[BEFORE] = NULL;
327 parallel_moves_[START] = NULL;
328 parallel_moves_[END] = NULL;
329 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000330 }
331
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000332 // Can't use the DECLARE-macro here because of sub-classes.
333 virtual bool IsGap() const { return true; }
334 virtual void PrintDataTo(StringStream* stream);
335 static LGap* cast(LInstruction* instr) {
336 ASSERT(instr->IsGap());
337 return reinterpret_cast<LGap*>(instr);
338 }
339
340 bool IsRedundant() const;
341
342 HBasicBlock* block() const { return block_; }
343
lrn@chromium.org7516f052011-03-30 08:52:27 +0000344 enum InnerPosition {
345 BEFORE,
346 START,
347 END,
348 AFTER,
349 FIRST_INNER_POSITION = BEFORE,
350 LAST_INNER_POSITION = AFTER
351 };
352
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000353 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
354 if (parallel_moves_[pos] == NULL) {
355 parallel_moves_[pos] = new(zone) LParallelMove(zone);
356 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000357 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000358 }
359
360 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000361 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000362 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000363
364 private:
365 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
366 HBasicBlock* block_;
367};
368
369
370class LInstructionGap: public LGap {
371 public:
372 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
373
374 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
375};
376
377
378class LGoto: public LTemplateInstruction<0, 0, 0> {
379 public:
380 explicit LGoto(int block_id) : block_id_(block_id) { }
381
382 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
383 virtual void PrintDataTo(StringStream* stream);
384 virtual bool IsControl() const { return true; }
385
386 int block_id() const { return block_id_; }
387
388 private:
389 int block_id_;
390};
391
392
393class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
394 public:
395 LLazyBailout() : gap_instructions_size_(0) { }
396
397 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
398
399 void set_gap_instructions_size(int gap_instructions_size) {
400 gap_instructions_size_ = gap_instructions_size;
401 }
402 int gap_instructions_size() { return gap_instructions_size_; }
403
404 private:
405 int gap_instructions_size_;
406};
407
408
yangguo@chromium.org46a2a512013-01-18 16:29:40 +0000409class LDummyUse: public LTemplateInstruction<1, 1, 0> {
410 public:
411 explicit LDummyUse(LOperand* value) {
412 inputs_[0] = value;
413 }
414 DECLARE_CONCRETE_INSTRUCTION(DummyUse, "dummy-use")
415};
416
417
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000418class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
419 public:
420 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000421};
422
423
424class LLabel: public LGap {
425 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000426 explicit LLabel(HBasicBlock* block)
427 : LGap(block), replacement_(NULL) { }
428
429 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
430
431 virtual void PrintDataTo(StringStream* stream);
432
433 int block_id() const { return block()->block_id(); }
434 bool is_loop_header() const { return block()->IsLoopHeader(); }
435 Label* label() { return &label_; }
436 LLabel* replacement() const { return replacement_; }
437 void set_replacement(LLabel* label) { replacement_ = label; }
438 bool HasReplacement() const { return replacement_ != NULL; }
439
440 private:
441 Label label_;
442 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000443};
444
445
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000446class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000447 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000448 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
449};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000450
lrn@chromium.org7516f052011-03-30 08:52:27 +0000451
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000452class LCallStub: public LTemplateInstruction<1, 0, 0> {
453 public:
454 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
455 DECLARE_HYDROGEN_ACCESSOR(CallStub)
456
457 TranscendentalCache::Type transcendental_type() {
458 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000459 }
460};
461
462
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000463class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
464 public:
465 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
466};
467
468
469template<int I, int T>
470class LControlInstruction: public LTemplateInstruction<0, I, T> {
471 public:
472 virtual bool IsControl() const { return true; }
473
474 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
475 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
476 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
477 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
478
479 private:
480 HControlInstruction* hydrogen() {
481 return HControlInstruction::cast(this->hydrogen_value());
482 }
483};
484
485
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000486class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
487 public:
488 LWrapReceiver(LOperand* receiver, LOperand* function) {
489 inputs_[0] = receiver;
490 inputs_[1] = function;
491 }
492
493 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
494
495 LOperand* receiver() { return inputs_[0]; }
496 LOperand* function() { return inputs_[1]; }
497};
498
499
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000500class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
501 public:
502 LApplyArguments(LOperand* function,
503 LOperand* receiver,
504 LOperand* length,
505 LOperand* elements) {
506 inputs_[0] = function;
507 inputs_[1] = receiver;
508 inputs_[2] = length;
509 inputs_[3] = elements;
510 }
511
512 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
513
514 LOperand* function() { return inputs_[0]; }
515 LOperand* receiver() { return inputs_[1]; }
516 LOperand* length() { return inputs_[2]; }
517 LOperand* elements() { return inputs_[3]; }
518};
519
520
521class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
522 public:
523 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
524 inputs_[0] = arguments;
525 inputs_[1] = length;
526 inputs_[2] = index;
527 }
528
529 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
530
531 LOperand* arguments() { return inputs_[0]; }
532 LOperand* length() { return inputs_[1]; }
533 LOperand* index() { return inputs_[2]; }
534
535 virtual void PrintDataTo(StringStream* stream);
536};
537
538
539class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
540 public:
541 explicit LArgumentsLength(LOperand* elements) {
542 inputs_[0] = elements;
543 }
544
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000545 LOperand* elements() { return inputs_[0]; }
546
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000547 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
548};
549
550
551class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
552 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000553 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000554 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000555};
556
557
558class LModI: public LTemplateInstruction<1, 2, 3> {
559 public:
560 // Used when the right hand is a constant power of 2.
561 LModI(LOperand* left,
562 LOperand* right) {
563 inputs_[0] = left;
564 inputs_[1] = right;
565 temps_[0] = NULL;
566 temps_[1] = NULL;
567 temps_[2] = NULL;
568 }
569
570 // Used for the standard case.
571 LModI(LOperand* left,
572 LOperand* right,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000573 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000574 LOperand* temp2,
575 LOperand* temp3) {
576 inputs_[0] = left;
577 inputs_[1] = right;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000578 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000579 temps_[1] = temp2;
580 temps_[2] = temp3;
581 }
582
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000583 LOperand* left() { return inputs_[0]; }
584 LOperand* right() { return inputs_[1]; }
585 LOperand* temp() { return temps_[0]; }
586 LOperand* temp2() { return temps_[1]; }
587 LOperand* temp3() { return temps_[2]; }
588
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000589 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
590 DECLARE_HYDROGEN_ACCESSOR(Mod)
591};
592
593
594class LDivI: public LTemplateInstruction<1, 2, 0> {
595 public:
596 LDivI(LOperand* left, LOperand* right) {
597 inputs_[0] = left;
598 inputs_[1] = right;
599 }
600
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000601 LOperand* left() { return inputs_[0]; }
602 LOperand* right() { return inputs_[1]; }
603
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000604 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
605 DECLARE_HYDROGEN_ACCESSOR(Div)
606};
607
608
609class LMulI: public LTemplateInstruction<1, 2, 1> {
610 public:
611 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
612 inputs_[0] = left;
613 inputs_[1] = right;
614 temps_[0] = temp;
615 }
616
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000617 LOperand* left() { return inputs_[0]; }
618 LOperand* right() { return inputs_[1]; }
619 LOperand* temp() { return temps_[0]; }
620
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000621 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
622 DECLARE_HYDROGEN_ACCESSOR(Mul)
623};
624
625
jkummerow@chromium.org59297c72013-01-09 16:32:23 +0000626// Instruction for computing multiplier * multiplicand + addend.
627class LMultiplyAddD: public LTemplateInstruction<1, 3, 0> {
628 public:
629 LMultiplyAddD(LOperand* addend, LOperand* multiplier,
630 LOperand* multiplicand) {
631 inputs_[0] = addend;
632 inputs_[1] = multiplier;
633 inputs_[2] = multiplicand;
634 }
635
636 LOperand* addend() { return inputs_[0]; }
637 LOperand* multiplier() { return inputs_[1]; }
638 LOperand* multiplicand() { return inputs_[2]; }
639
640 DECLARE_CONCRETE_INSTRUCTION(MultiplyAddD, "multiply-add-d")
641};
642
643
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000644class LCmpIDAndBranch: public LControlInstruction<2, 0> {
645 public:
646 LCmpIDAndBranch(LOperand* left, LOperand* right) {
647 inputs_[0] = left;
648 inputs_[1] = right;
649 }
650
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000651 LOperand* left() { return inputs_[0]; }
652 LOperand* right() { return inputs_[1]; }
653
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000654 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
655 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
656
657 Token::Value op() const { return hydrogen()->token(); }
658 bool is_double() const {
ulan@chromium.org8e8d8822012-11-23 14:36:46 +0000659 return hydrogen()->representation().IsDouble();
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000660 }
661
662 virtual void PrintDataTo(StringStream* stream);
663};
664
665
666class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
667 public:
668 LUnaryMathOperation(LOperand* value, LOperand* temp) {
669 inputs_[0] = value;
670 temps_[0] = temp;
671 }
672
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000673 LOperand* value() { return inputs_[0]; }
674 LOperand* temp() { return temps_[0]; }
675
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000676 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
677 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
678
679 virtual void PrintDataTo(StringStream* stream);
680 BuiltinFunctionId op() const { return hydrogen()->op(); }
681};
682
683
svenpanne@chromium.org83130cf2012-11-30 10:13:25 +0000684class LMathExp: public LTemplateInstruction<1, 1, 3> {
685 public:
686 LMathExp(LOperand* value,
687 LOperand* double_temp,
688 LOperand* temp1,
689 LOperand* temp2) {
690 inputs_[0] = value;
691 temps_[0] = temp1;
692 temps_[1] = temp2;
693 temps_[2] = double_temp;
694 ExternalReference::InitializeMathExpData();
695 }
696
697 LOperand* value() { return inputs_[0]; }
698 LOperand* temp1() { return temps_[0]; }
699 LOperand* temp2() { return temps_[1]; }
700 LOperand* double_temp() { return temps_[2]; }
701
702 DECLARE_CONCRETE_INSTRUCTION(MathExp, "math-exp")
703
704 virtual void PrintDataTo(StringStream* stream);
705};
706
707
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000708class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
709 public:
710 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
711 inputs_[0] = left;
712 inputs_[1] = right;
713 }
714
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000715 LOperand* left() { return inputs_[0]; }
716 LOperand* right() { return inputs_[1]; }
717
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000718 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
719 "cmp-object-eq-and-branch")
720 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
721};
722
723
724class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
725 public:
726 explicit LCmpConstantEqAndBranch(LOperand* left) {
727 inputs_[0] = left;
728 }
729
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000730 LOperand* left() { return inputs_[0]; }
731
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000732 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
733 "cmp-constant-eq-and-branch")
734 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
735};
736
737
738class LIsNilAndBranch: public LControlInstruction<1, 0> {
739 public:
740 explicit LIsNilAndBranch(LOperand* value) {
741 inputs_[0] = value;
742 }
743
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000744 LOperand* value() { return inputs_[0]; }
745
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000746 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
747 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
748
749 EqualityKind kind() const { return hydrogen()->kind(); }
750 NilValue nil() const { return hydrogen()->nil(); }
751
752 virtual void PrintDataTo(StringStream* stream);
753};
754
755
756class LIsObjectAndBranch: public LControlInstruction<1, 1> {
757 public:
758 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
759 inputs_[0] = value;
760 temps_[0] = temp;
761 }
762
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000763 LOperand* value() { return inputs_[0]; }
764 LOperand* temp() { return temps_[0]; }
765
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000766 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
767 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
768
769 virtual void PrintDataTo(StringStream* stream);
770};
771
772
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000773class LIsStringAndBranch: public LControlInstruction<1, 1> {
774 public:
775 LIsStringAndBranch(LOperand* value, LOperand* temp) {
776 inputs_[0] = value;
777 temps_[0] = temp;
778 }
779
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000780 LOperand* value() { return inputs_[0]; }
781 LOperand* temp() { return temps_[0]; }
782
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000783 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
784 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
785
786 virtual void PrintDataTo(StringStream* stream);
787};
788
789
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000790class LIsSmiAndBranch: public LControlInstruction<1, 0> {
791 public:
792 explicit LIsSmiAndBranch(LOperand* value) {
793 inputs_[0] = value;
794 }
795
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000796 LOperand* value() { return inputs_[0]; }
797
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000798 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
799 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
800
801 virtual void PrintDataTo(StringStream* stream);
802};
803
804
805class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
806 public:
807 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
808 inputs_[0] = value;
809 temps_[0] = temp;
810 }
811
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000812 LOperand* value() { return inputs_[0]; }
813 LOperand* temp() { return temps_[0]; }
814
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000815 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
816 "is-undetectable-and-branch")
817 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
818
819 virtual void PrintDataTo(StringStream* stream);
820};
821
822
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000823class LStringCompareAndBranch: public LControlInstruction<2, 0> {
824 public:
825 LStringCompareAndBranch(LOperand* left, LOperand* right) {
826 inputs_[0] = left;
827 inputs_[1] = right;
828 }
829
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000830 LOperand* left() { return inputs_[0]; }
831 LOperand* right() { return inputs_[1]; }
832
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000833 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
834 "string-compare-and-branch")
835 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
836
837 Token::Value op() const { return hydrogen()->token(); }
838
839 virtual void PrintDataTo(StringStream* stream);
840};
841
842
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000843class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
844 public:
845 explicit LHasInstanceTypeAndBranch(LOperand* value) {
846 inputs_[0] = value;
847 }
848
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000849 LOperand* value() { return inputs_[0]; }
850
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000851 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
852 "has-instance-type-and-branch")
853 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
854
855 virtual void PrintDataTo(StringStream* stream);
856};
857
858
859class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
860 public:
861 explicit LGetCachedArrayIndex(LOperand* value) {
862 inputs_[0] = value;
863 }
864
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000865 LOperand* value() { return inputs_[0]; }
866
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000867 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
868 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
869};
870
871
872class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
873 public:
874 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
875 inputs_[0] = value;
876 }
877
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000878 LOperand* value() { return inputs_[0]; }
879
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000880 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
881 "has-cached-array-index-and-branch")
882 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
883
884 virtual void PrintDataTo(StringStream* stream);
885};
886
887
888class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
889 public:
890 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
891 inputs_[0] = value;
892 temps_[0] = temp;
893 }
894
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000895 LOperand* value() { return inputs_[0]; }
896 LOperand* temp() { return temps_[0]; }
897
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000898 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
899 "class-of-test-and-branch")
900 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
901
902 virtual void PrintDataTo(StringStream* stream);
903};
904
905
906class LCmpT: public LTemplateInstruction<1, 2, 0> {
907 public:
908 LCmpT(LOperand* left, LOperand* right) {
909 inputs_[0] = left;
910 inputs_[1] = right;
911 }
912
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000913 LOperand* left() { return inputs_[0]; }
914 LOperand* right() { return inputs_[1]; }
915
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000916 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
917 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
918
919 Token::Value op() const { return hydrogen()->token(); }
920};
921
922
923class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
924 public:
925 LInstanceOf(LOperand* left, LOperand* right) {
926 inputs_[0] = left;
927 inputs_[1] = right;
928 }
929
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000930 LOperand* left() { return inputs_[0]; }
931 LOperand* right() { return inputs_[1]; }
932
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000933 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
934};
935
936
937class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
938 public:
939 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
940 inputs_[0] = value;
941 temps_[0] = temp;
942 }
943
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000944 LOperand* value() { return inputs_[0]; }
945 LOperand* temp() { return temps_[0]; }
946
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000947 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
948 "instance-of-known-global")
949 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
950
951 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000952 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
953 return lazy_deopt_env_;
954 }
955 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
956 lazy_deopt_env_ = env;
957 }
958
959 private:
960 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000961};
962
963
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +0000964class LInstanceSize: public LTemplateInstruction<1, 1, 0> {
965 public:
966 explicit LInstanceSize(LOperand* object) {
967 inputs_[0] = object;
968 }
969
970 LOperand* object() { return inputs_[0]; }
971
972 DECLARE_CONCRETE_INSTRUCTION(InstanceSize, "instance-size")
973 DECLARE_HYDROGEN_ACCESSOR(InstanceSize)
974};
975
976
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000977class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
978 public:
979 LBoundsCheck(LOperand* index, LOperand* length) {
980 inputs_[0] = index;
981 inputs_[1] = length;
982 }
983
984 LOperand* index() { return inputs_[0]; }
985 LOperand* length() { return inputs_[1]; }
986
987 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +0000988 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000989};
990
991
992class LBitI: public LTemplateInstruction<1, 2, 0> {
993 public:
994 LBitI(LOperand* left, LOperand* right) {
995 inputs_[0] = left;
996 inputs_[1] = right;
997 }
998
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +0000999 LOperand* left() { return inputs_[0]; }
1000 LOperand* right() { return inputs_[1]; }
1001
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001002 Token::Value op() const { return hydrogen()->op(); }
1003
1004 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1005 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
1006};
1007
1008
1009class LShiftI: public LTemplateInstruction<1, 2, 0> {
1010 public:
1011 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1012 : op_(op), can_deopt_(can_deopt) {
1013 inputs_[0] = left;
1014 inputs_[1] = right;
1015 }
1016
1017 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001018 LOperand* left() { return inputs_[0]; }
1019 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001020 bool can_deopt() const { return can_deopt_; }
1021
1022 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1023
1024 private:
1025 Token::Value op_;
1026 bool can_deopt_;
1027};
1028
1029
1030class LSubI: public LTemplateInstruction<1, 2, 0> {
1031 public:
1032 LSubI(LOperand* left, LOperand* right) {
1033 inputs_[0] = left;
1034 inputs_[1] = right;
1035 }
1036
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001037 LOperand* left() { return inputs_[0]; }
1038 LOperand* right() { return inputs_[1]; }
1039
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001040 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1041 DECLARE_HYDROGEN_ACCESSOR(Sub)
1042};
1043
1044
1045class LConstantI: public LTemplateInstruction<1, 0, 0> {
1046 public:
1047 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
1048 DECLARE_HYDROGEN_ACCESSOR(Constant)
1049
1050 int32_t value() const { return hydrogen()->Integer32Value(); }
1051};
1052
1053
1054class LConstantD: public LTemplateInstruction<1, 0, 0> {
1055 public:
1056 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
1057 DECLARE_HYDROGEN_ACCESSOR(Constant)
1058
1059 double value() const { return hydrogen()->DoubleValue(); }
1060};
1061
1062
1063class LConstantT: public LTemplateInstruction<1, 0, 0> {
1064 public:
1065 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1066 DECLARE_HYDROGEN_ACCESSOR(Constant)
1067
1068 Handle<Object> value() const { return hydrogen()->handle(); }
1069};
1070
1071
1072class LBranch: public LControlInstruction<1, 0> {
1073 public:
1074 explicit LBranch(LOperand* value) {
1075 inputs_[0] = value;
1076 }
1077
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001078 LOperand* value() { return inputs_[0]; }
1079
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001080 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1081 DECLARE_HYDROGEN_ACCESSOR(Branch)
1082
1083 virtual void PrintDataTo(StringStream* stream);
1084};
1085
1086
1087class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1088 public:
1089 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1090 inputs_[0] = value;
1091 temps_[0] = temp;
1092 }
1093
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001094 LOperand* value() { return inputs_[0]; }
1095 LOperand* temp() { return temps_[0]; }
1096
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001097 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1098 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1099
1100 virtual bool IsControl() const { return true; }
1101
1102 Handle<Map> map() const { return hydrogen()->map(); }
1103 int true_block_id() const {
1104 return hydrogen()->FirstSuccessor()->block_id();
1105 }
1106 int false_block_id() const {
1107 return hydrogen()->SecondSuccessor()->block_id();
1108 }
1109};
1110
1111
1112class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
1113 public:
1114 explicit LJSArrayLength(LOperand* value) {
1115 inputs_[0] = value;
1116 }
1117
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001118 LOperand* value() { return inputs_[0]; }
1119
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001120 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
1121 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
1122};
1123
1124
1125class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1126 public:
1127 explicit LFixedArrayBaseLength(LOperand* value) {
1128 inputs_[0] = value;
1129 }
1130
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001131 LOperand* value() { return inputs_[0]; }
1132
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001133 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
1134 "fixed-array-base-length")
1135 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
1136};
1137
1138
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001139class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
1140 public:
1141 explicit LMapEnumLength(LOperand* value) {
1142 inputs_[0] = value;
1143 }
1144
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001145 LOperand* value() { return inputs_[0]; }
1146
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001147 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
1148};
1149
1150
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001151class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1152 public:
1153 explicit LElementsKind(LOperand* value) {
1154 inputs_[0] = value;
1155 }
1156
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001157 LOperand* value() { return inputs_[0]; }
1158
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001159 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1160 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1161};
1162
1163
1164class LValueOf: public LTemplateInstruction<1, 1, 1> {
1165 public:
1166 LValueOf(LOperand* value, LOperand* temp) {
1167 inputs_[0] = value;
1168 temps_[0] = temp;
1169 }
1170
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001171 LOperand* value() { return inputs_[0]; }
1172 LOperand* temp() { return temps_[0]; }
1173
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001174 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1175 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1176};
1177
1178
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001179class LDateField: public LTemplateInstruction<1, 1, 1> {
1180 public:
1181 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1182 inputs_[0] = date;
1183 temps_[0] = temp;
1184 }
1185
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001186 LOperand* date() { return inputs_[0]; }
1187 LOperand* temp() { return temps_[0]; }
1188 Smi* index() const { return index_; }
1189
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001190 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1191 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001192
1193 private:
1194 Smi* index_;
1195};
1196
1197
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +00001198class LSeqStringSetChar: public LTemplateInstruction<1, 3, 0> {
1199 public:
1200 LSeqStringSetChar(String::Encoding encoding,
1201 LOperand* string,
1202 LOperand* index,
1203 LOperand* value) : encoding_(encoding) {
1204 inputs_[0] = string;
1205 inputs_[1] = index;
1206 inputs_[2] = value;
1207 }
1208
1209 String::Encoding encoding() { return encoding_; }
1210 LOperand* string() { return inputs_[0]; }
1211 LOperand* index() { return inputs_[1]; }
1212 LOperand* value() { return inputs_[2]; }
1213
1214 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar, "seq-string-set-char")
1215 DECLARE_HYDROGEN_ACCESSOR(SeqStringSetChar)
1216
1217 private:
1218 String::Encoding encoding_;
1219};
1220
1221
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001222class LThrow: public LTemplateInstruction<0, 1, 0> {
1223 public:
1224 explicit LThrow(LOperand* value) {
1225 inputs_[0] = value;
1226 }
1227
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001228 LOperand* value() { return inputs_[0]; }
1229
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001230 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1231};
1232
1233
1234class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1235 public:
1236 explicit LBitNotI(LOperand* value) {
1237 inputs_[0] = value;
1238 }
1239
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001240 LOperand* value() { return inputs_[0]; }
1241
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001242 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1243};
1244
1245
1246class LAddI: public LTemplateInstruction<1, 2, 0> {
1247 public:
1248 LAddI(LOperand* left, LOperand* right) {
1249 inputs_[0] = left;
1250 inputs_[1] = right;
1251 }
1252
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001253 LOperand* left() { return inputs_[0]; }
1254 LOperand* right() { return inputs_[1]; }
1255
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001256 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1257 DECLARE_HYDROGEN_ACCESSOR(Add)
1258};
1259
1260
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001261class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1262 public:
1263 LMathMinMax(LOperand* left, LOperand* right) {
1264 inputs_[0] = left;
1265 inputs_[1] = right;
1266 }
1267
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001268 LOperand* left() { return inputs_[0]; }
1269 LOperand* right() { return inputs_[1]; }
1270
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001271 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max")
1272 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1273};
1274
1275
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001276class LPower: public LTemplateInstruction<1, 2, 0> {
1277 public:
1278 LPower(LOperand* left, LOperand* right) {
1279 inputs_[0] = left;
1280 inputs_[1] = right;
1281 }
1282
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001283 LOperand* left() { return inputs_[0]; }
1284 LOperand* right() { return inputs_[1]; }
1285
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001286 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1287 DECLARE_HYDROGEN_ACCESSOR(Power)
1288};
1289
1290
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001291class LRandom: public LTemplateInstruction<1, 1, 0> {
1292 public:
1293 explicit LRandom(LOperand* global_object) {
1294 inputs_[0] = global_object;
1295 }
1296
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001297 LOperand* global_object() { return inputs_[0]; }
1298
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001299 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1300 DECLARE_HYDROGEN_ACCESSOR(Random)
1301};
1302
1303
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001304class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1305 public:
1306 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1307 : op_(op) {
1308 inputs_[0] = left;
1309 inputs_[1] = right;
1310 }
1311
1312 Token::Value op() const { return op_; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001313 LOperand* left() { return inputs_[0]; }
1314 LOperand* right() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001315
1316 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1317 virtual void CompileToNative(LCodeGen* generator);
1318 virtual const char* Mnemonic() const;
1319
1320 private:
1321 Token::Value op_;
1322};
1323
1324
1325class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1326 public:
1327 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1328 : op_(op) {
1329 inputs_[0] = left;
1330 inputs_[1] = right;
1331 }
1332
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001333 LOperand* left() { return inputs_[0]; }
1334 LOperand* right() { return inputs_[1]; }
1335 Token::Value op() const { return op_; }
1336
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001337 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1338 virtual void CompileToNative(LCodeGen* generator);
1339 virtual const char* Mnemonic() const;
1340
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001341 private:
1342 Token::Value op_;
1343};
1344
1345
1346class LReturn: public LTemplateInstruction<0, 1, 0> {
1347 public:
1348 explicit LReturn(LOperand* value) {
1349 inputs_[0] = value;
1350 }
1351
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001352 LOperand* value() { return inputs_[0]; }
1353
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001354 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1355};
1356
1357
1358class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1359 public:
1360 explicit LLoadNamedField(LOperand* object) {
1361 inputs_[0] = object;
1362 }
1363
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001364 LOperand* object() { return inputs_[0]; }
1365
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001366 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1367 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1368};
1369
1370
1371class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1372 public:
1373 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1374 inputs_[0] = object;
1375 }
1376
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001377 LOperand* object() { return inputs_[0]; }
1378
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001379 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1380 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001381};
1382
1383
1384class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1385 public:
1386 explicit LLoadNamedGeneric(LOperand* object) {
1387 inputs_[0] = object;
1388 }
1389
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001390 LOperand* object() { return inputs_[0]; }
1391
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001392 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1393 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1394
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001395 Handle<Object> name() const { return hydrogen()->name(); }
1396};
1397
1398
1399class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1400 public:
1401 explicit LLoadFunctionPrototype(LOperand* function) {
1402 inputs_[0] = function;
1403 }
1404
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001405 LOperand* function() { return inputs_[0]; }
1406
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001407 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1408 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001409};
1410
1411
1412class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1413 public:
1414 explicit LLoadElements(LOperand* object) {
1415 inputs_[0] = object;
1416 }
1417
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001418 LOperand* object() { return inputs_[0]; }
1419
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001420 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1421};
1422
1423
1424class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1425 public:
1426 explicit LLoadExternalArrayPointer(LOperand* object) {
1427 inputs_[0] = object;
1428 }
1429
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001430 LOperand* object() { return inputs_[0]; }
1431
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001432 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1433 "load-external-array-pointer")
1434};
1435
1436
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001437class LLoadKeyed: public LTemplateInstruction<1, 2, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001438 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001439 LLoadKeyed(LOperand* elements, LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001440 inputs_[0] = elements;
1441 inputs_[1] = key;
1442 }
1443
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001444 LOperand* elements() { return inputs_[0]; }
1445 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001446 ElementsKind elements_kind() const {
1447 return hydrogen()->elements_kind();
1448 }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001449 bool is_external() const {
1450 return hydrogen()->is_external();
1451 }
1452
1453 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
1454 DECLARE_HYDROGEN_ACCESSOR(LoadKeyed)
1455
ulan@chromium.org8e8d8822012-11-23 14:36:46 +00001456 virtual void PrintDataTo(StringStream* stream);
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001457 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001458};
1459
1460
1461class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1462 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001463 LLoadKeyedGeneric(LOperand* object, LOperand* key) {
1464 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001465 inputs_[1] = key;
1466 }
1467
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001468 LOperand* object() { return inputs_[0]; }
1469 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001470
1471 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001472};
1473
1474
1475class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1476 public:
1477 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1478 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1479};
1480
1481
1482class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1483 public:
1484 explicit LLoadGlobalGeneric(LOperand* global_object) {
1485 inputs_[0] = global_object;
1486 }
1487
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001488 LOperand* global_object() { return inputs_[0]; }
1489
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001490 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1491 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1492
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001493 Handle<Object> name() const { return hydrogen()->name(); }
1494 bool for_typeof() const { return hydrogen()->for_typeof(); }
1495};
1496
1497
1498class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1499 public:
1500 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1501 inputs_[0] = value;
1502 temps_[0] = temp;
1503 }
1504
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001505 LOperand* value() { return inputs_[0]; }
1506 LOperand* temp() { return temps_[0]; }
1507
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001508 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1509 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1510};
1511
1512
1513class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1514 public:
1515 explicit LStoreGlobalGeneric(LOperand* global_object,
1516 LOperand* value) {
1517 inputs_[0] = global_object;
1518 inputs_[1] = value;
1519 }
1520
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001521 LOperand* global_object() { return inputs_[0]; }
1522 LOperand* value() { return inputs_[1]; }
1523
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001524 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1525 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1526
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001527 Handle<Object> name() const { return hydrogen()->name(); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001528 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001529};
1530
1531
1532class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1533 public:
1534 explicit LLoadContextSlot(LOperand* context) {
1535 inputs_[0] = context;
1536 }
1537
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001538 LOperand* context() { return inputs_[0]; }
1539
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001540 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1541 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1542
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001543 int slot_index() { return hydrogen()->slot_index(); }
1544
1545 virtual void PrintDataTo(StringStream* stream);
1546};
1547
1548
1549class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1550 public:
1551 LStoreContextSlot(LOperand* context, LOperand* value) {
1552 inputs_[0] = context;
1553 inputs_[1] = value;
1554 }
1555
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001556 LOperand* context() { return inputs_[0]; }
1557 LOperand* value() { return inputs_[1]; }
1558
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001559 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1560 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1561
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001562 int slot_index() { return hydrogen()->slot_index(); }
1563
1564 virtual void PrintDataTo(StringStream* stream);
1565};
1566
1567
1568class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1569 public:
1570 explicit LPushArgument(LOperand* value) {
1571 inputs_[0] = value;
1572 }
1573
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001574 LOperand* value() { return inputs_[0]; }
1575
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001576 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1577};
1578
1579
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001580class LDrop: public LTemplateInstruction<0, 0, 0> {
1581 public:
1582 explicit LDrop(int count) : count_(count) { }
1583
1584 int count() const { return count_; }
1585
1586 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1587
1588 private:
1589 int count_;
1590};
1591
1592
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001593class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1594 public:
1595 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1596 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1597};
1598
1599
1600class LContext: public LTemplateInstruction<1, 0, 0> {
1601 public:
1602 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001603 DECLARE_HYDROGEN_ACCESSOR(Context)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001604};
1605
1606
1607class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1608 public:
1609 explicit LOuterContext(LOperand* context) {
1610 inputs_[0] = context;
1611 }
1612
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001613 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001614
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001615 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001616};
1617
1618
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001619class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1620 public:
1621 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1622 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1623};
1624
1625
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001626class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1627 public:
1628 explicit LGlobalObject(LOperand* context) {
1629 inputs_[0] = context;
1630 }
1631
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001632 LOperand* context() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001633
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001634 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001635};
1636
1637
1638class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1639 public:
1640 explicit LGlobalReceiver(LOperand* global_object) {
1641 inputs_[0] = global_object;
1642 }
1643
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001644 LOperand* global_object() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001645
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001646 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001647};
1648
1649
1650class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1651 public:
1652 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1653 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1654
1655 virtual void PrintDataTo(StringStream* stream);
1656
1657 Handle<JSFunction> function() { return hydrogen()->function(); }
1658 int arity() const { return hydrogen()->argument_count() - 1; }
1659};
1660
1661
1662class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1663 public:
1664 explicit LInvokeFunction(LOperand* function) {
1665 inputs_[0] = function;
1666 }
1667
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001668 LOperand* function() { return inputs_[0]; }
1669
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001670 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1671 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1672
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001673 virtual void PrintDataTo(StringStream* stream);
1674
1675 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001676 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001677};
1678
1679
1680class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1681 public:
1682 explicit LCallKeyed(LOperand* key) {
1683 inputs_[0] = key;
1684 }
1685
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001686 LOperand* key() { return inputs_[0]; }
1687
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001688 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1689 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1690
1691 virtual void PrintDataTo(StringStream* stream);
1692
1693 int arity() const { return hydrogen()->argument_count() - 1; }
1694};
1695
1696
1697
1698class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1699 public:
1700 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1701 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1702
1703 virtual void PrintDataTo(StringStream* stream);
1704
1705 Handle<String> name() const { return hydrogen()->name(); }
1706 int arity() const { return hydrogen()->argument_count() - 1; }
1707};
1708
1709
danno@chromium.orgc612e022011-11-10 11:38:15 +00001710class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001711 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001712 explicit LCallFunction(LOperand* function) {
1713 inputs_[0] = function;
1714 }
1715
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001716 LOperand* function() { return inputs_[0]; }
1717
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001718 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1719 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1720
danno@chromium.orgc612e022011-11-10 11:38:15 +00001721 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001722};
1723
1724
1725class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1726 public:
1727 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1728 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1729
1730 virtual void PrintDataTo(StringStream* stream);
1731
1732 Handle<String> name() const {return hydrogen()->name(); }
1733 int arity() const { return hydrogen()->argument_count() - 1; }
1734};
1735
1736
1737class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1738 public:
1739 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1740 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1741
1742 virtual void PrintDataTo(StringStream* stream);
1743
1744 Handle<JSFunction> target() const { return hydrogen()->target(); }
1745 int arity() const { return hydrogen()->argument_count() - 1; }
1746};
1747
1748
1749class LCallNew: public LTemplateInstruction<1, 1, 0> {
1750 public:
1751 explicit LCallNew(LOperand* constructor) {
1752 inputs_[0] = constructor;
1753 }
1754
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001755 LOperand* constructor() { return inputs_[0]; }
1756
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001757 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1758 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1759
1760 virtual void PrintDataTo(StringStream* stream);
1761
1762 int arity() const { return hydrogen()->argument_count() - 1; }
1763};
1764
1765
ulan@chromium.org750145a2013-03-07 15:14:13 +00001766class LCallNewArray: public LTemplateInstruction<1, 1, 0> {
1767 public:
1768 explicit LCallNewArray(LOperand* constructor) {
1769 inputs_[0] = constructor;
1770 }
1771
1772 LOperand* constructor() { return inputs_[0]; }
1773
1774 DECLARE_CONCRETE_INSTRUCTION(CallNewArray, "call-new-array")
1775 DECLARE_HYDROGEN_ACCESSOR(CallNewArray)
1776
1777 virtual void PrintDataTo(StringStream* stream);
1778
1779 int arity() const { return hydrogen()->argument_count() - 1; }
1780};
1781
1782
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001783class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1784 public:
1785 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1786 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1787
1788 const Runtime::Function* function() const { return hydrogen()->function(); }
1789 int arity() const { return hydrogen()->argument_count(); }
1790};
1791
1792
1793class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1794 public:
1795 explicit LInteger32ToDouble(LOperand* value) {
1796 inputs_[0] = value;
1797 }
1798
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001799 LOperand* value() { return inputs_[0]; }
1800
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001801 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1802};
1803
1804
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001805class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1806 public:
1807 explicit LUint32ToDouble(LOperand* value) {
1808 inputs_[0] = value;
1809 }
1810
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001811 LOperand* value() { return inputs_[0]; }
1812
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001813 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1814};
1815
1816
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001817class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1818 public:
1819 explicit LNumberTagI(LOperand* value) {
1820 inputs_[0] = value;
1821 }
1822
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001823 LOperand* value() { return inputs_[0]; }
1824
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001825 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1826};
1827
1828
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001829class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1830 public:
1831 explicit LNumberTagU(LOperand* value) {
1832 inputs_[0] = value;
1833 }
1834
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001835 LOperand* value() { return inputs_[0]; }
1836
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001837 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1838};
1839
1840
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001841class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1842 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001843 LNumberTagD(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(NumberTagD, "number-tag-d")
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00001854 DECLARE_HYDROGEN_ACCESSOR(Change)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001855};
1856
1857
1858// Sometimes truncating conversion from a tagged value to an int32.
1859class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1860 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001861 LDoubleToI(LOperand* value, LOperand* temp, LOperand* temp2) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001862 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001863 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001864 temps_[1] = temp2;
1865 }
1866
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001867 LOperand* value() { return inputs_[0]; }
1868 LOperand* temp() { return temps_[0]; }
1869 LOperand* temp2() { return temps_[1]; }
1870
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001871 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1872 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1873
1874 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1875};
1876
1877
1878// Truncating conversion from a tagged value to an int32.
1879class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1880 public:
1881 LTaggedToI(LOperand* value,
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001882 LOperand* temp,
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001883 LOperand* temp2,
1884 LOperand* temp3) {
1885 inputs_[0] = value;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001886 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001887 temps_[1] = temp2;
1888 temps_[2] = temp3;
1889 }
1890
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001891 LOperand* value() { return inputs_[0]; }
1892 LOperand* temp() { return temps_[0]; }
1893 LOperand* temp2() { return temps_[1]; }
1894 LOperand* temp3() { return temps_[2]; }
1895
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001896 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1897 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1898
1899 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1900};
1901
1902
1903class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1904 public:
1905 explicit LSmiTag(LOperand* value) {
1906 inputs_[0] = value;
1907 }
1908
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001909 LOperand* value() { return inputs_[0]; }
1910
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001911 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1912};
1913
1914
1915class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1916 public:
1917 explicit LNumberUntagD(LOperand* value) {
1918 inputs_[0] = value;
1919 }
1920
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001921 LOperand* value() { return inputs_[0]; }
1922
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001923 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1924 DECLARE_HYDROGEN_ACCESSOR(Change)
1925};
1926
1927
1928class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1929 public:
1930 LSmiUntag(LOperand* value, bool needs_check)
1931 : needs_check_(needs_check) {
1932 inputs_[0] = value;
1933 }
1934
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001935 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001936 bool needs_check() const { return needs_check_; }
1937
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001938 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1939
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001940 private:
1941 bool needs_check_;
1942};
1943
1944
verwaest@chromium.org37141392012-05-31 13:27:02 +00001945class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001946 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001947 LStoreNamedField(LOperand* object, LOperand* value, LOperand* temp) {
1948 inputs_[0] = object;
1949 inputs_[1] = value;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001950 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001951 }
1952
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001953 LOperand* object() { return inputs_[0]; }
1954 LOperand* value() { return inputs_[1]; }
1955 LOperand* temp() { return temps_[0]; }
1956
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001957 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1958 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1959
1960 virtual void PrintDataTo(StringStream* stream);
1961
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001962 Handle<Object> name() const { return hydrogen()->name(); }
1963 bool is_in_object() { return hydrogen()->is_in_object(); }
1964 int offset() { return hydrogen()->offset(); }
1965 Handle<Map> transition() const { return hydrogen()->transition(); }
1966};
1967
1968
1969class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1970 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001971 LStoreNamedGeneric(LOperand* object, LOperand* value) {
1972 inputs_[0] = object;
1973 inputs_[1] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001974 }
1975
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001976 LOperand* object() { return inputs_[0]; }
1977 LOperand* value() { return inputs_[1]; }
1978
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001979 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1980 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1981
1982 virtual void PrintDataTo(StringStream* stream);
1983
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001984 Handle<Object> name() const { return hydrogen()->name(); }
1985 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001986};
1987
1988
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001989class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001990 public:
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001991 LStoreKeyed(LOperand* object, LOperand* key, LOperand* value) {
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001992 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001993 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001994 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001995 }
1996
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00001997 bool is_external() const { return hydrogen()->is_external(); }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00001998 LOperand* elements() { return inputs_[0]; }
1999 LOperand* key() { return inputs_[1]; }
2000 LOperand* value() { return inputs_[2]; }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002001 ElementsKind elements_kind() const {
2002 return hydrogen()->elements_kind();
2003 }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002004
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002005 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed, "store-keyed")
2006 DECLARE_HYDROGEN_ACCESSOR(StoreKeyed)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002007
2008 virtual void PrintDataTo(StringStream* stream);
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00002009 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
mvstanton@chromium.orge4ac3ef2012-11-12 14:53:34 +00002010 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002011};
2012
2013
2014class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
2015 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002016 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002017 inputs_[0] = obj;
2018 inputs_[1] = key;
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002019 inputs_[2] = value;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002020 }
2021
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002022 LOperand* object() { return inputs_[0]; }
2023 LOperand* key() { return inputs_[1]; }
2024 LOperand* value() { return inputs_[2]; }
2025
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002026 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
2027 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
2028
2029 virtual void PrintDataTo(StringStream* stream);
2030
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00002031 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002032};
2033
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002034
2035class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
2036 public:
2037 LTransitionElementsKind(LOperand* object,
2038 LOperand* new_map_temp,
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002039 LOperand* fixed_object_temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002040 inputs_[0] = object;
2041 temps_[0] = new_map_temp;
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002042 temps_[1] = fixed_object_temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002043 }
2044
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002045 LOperand* object() { return inputs_[0]; }
2046 LOperand* new_map_temp() { return temps_[0]; }
2047 LOperand* temp() { return temps_[1]; }
2048
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002049 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
2050 "transition-elements-kind")
2051 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
2052
2053 virtual void PrintDataTo(StringStream* stream);
2054
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002055 Handle<Map> original_map() { return hydrogen()->original_map(); }
2056 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002057 ElementsKind from_kind() { return hydrogen()->from_kind(); }
2058 ElementsKind to_kind() { return hydrogen()->to_kind(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002059};
2060
2061
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002062class LTrapAllocationMemento : public LTemplateInstruction<0, 1, 1> {
2063 public:
2064 LTrapAllocationMemento(LOperand* object,
2065 LOperand* temp) {
2066 inputs_[0] = object;
2067 temps_[0] = temp;
2068 }
2069
2070 LOperand* object() { return inputs_[0]; }
2071 LOperand* temp() { return temps_[0]; }
2072
2073 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento,
2074 "trap-allocation-memento")
2075};
2076
2077
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002078class LStringAdd: public LTemplateInstruction<1, 2, 0> {
2079 public:
2080 LStringAdd(LOperand* left, LOperand* right) {
2081 inputs_[0] = left;
2082 inputs_[1] = right;
2083 }
2084
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002085 LOperand* left() { return inputs_[0]; }
2086 LOperand* right() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002087
2088 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
2089 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002090};
2091
2092
2093
2094class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
2095 public:
2096 LStringCharCodeAt(LOperand* string, LOperand* index) {
2097 inputs_[0] = string;
2098 inputs_[1] = index;
2099 }
2100
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002101 LOperand* string() { return inputs_[0]; }
2102 LOperand* index() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002103
2104 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
2105 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002106};
2107
2108
2109class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
2110 public:
2111 explicit LStringCharFromCode(LOperand* char_code) {
2112 inputs_[0] = char_code;
2113 }
2114
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002115 LOperand* char_code() { return inputs_[0]; }
2116
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002117 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
2118 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002119};
2120
2121
2122class LStringLength: public LTemplateInstruction<1, 1, 0> {
2123 public:
2124 explicit LStringLength(LOperand* string) {
2125 inputs_[0] = string;
2126 }
2127
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002128 LOperand* string() { return inputs_[0]; }
2129
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002130 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
2131 DECLARE_HYDROGEN_ACCESSOR(StringLength)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002132};
2133
2134
2135class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
2136 public:
2137 explicit LCheckFunction(LOperand* value) {
2138 inputs_[0] = value;
2139 }
2140
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002141 LOperand* value() { return inputs_[0]; }
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00002142
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002143 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
2144 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
2145};
2146
2147
2148class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
2149 public:
2150 explicit LCheckInstanceType(LOperand* value) {
2151 inputs_[0] = value;
2152 }
2153
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002154 LOperand* value() { return inputs_[0]; }
2155
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002156 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
2157 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
2158};
2159
2160
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002161class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002162 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002163 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002164 inputs_[0] = value;
2165 }
2166
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002167 LOperand* value() { return inputs_[0]; }
2168
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00002169 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
2170 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002171};
2172
2173
verwaest@chromium.orge4ee6de2012-11-06 12:13:00 +00002174class LCheckPrototypeMaps: public LTemplateInstruction<1, 0, 2> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002175 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002176 LCheckPrototypeMaps(LOperand* temp, LOperand* temp2) {
2177 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002178 temps_[1] = temp2;
2179 }
2180
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002181 LOperand* temp() { return temps_[0]; }
2182 LOperand* temp2() { return temps_[1]; }
2183
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002184 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
2185 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
2186
yangguo@chromium.org003650e2013-01-24 16:31:08 +00002187 ZoneList<Handle<JSObject> >* prototypes() const {
2188 return hydrogen()->prototypes();
2189 }
2190 ZoneList<Handle<Map> >* maps() const { return hydrogen()->maps(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002191};
2192
2193
2194class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
2195 public:
2196 explicit LCheckSmi(LOperand* value) {
2197 inputs_[0] = value;
2198 }
2199
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002200 LOperand* value() { return inputs_[0]; }
2201
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002202 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
2203};
2204
2205
2206class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
2207 public:
2208 explicit LCheckNonSmi(LOperand* value) {
2209 inputs_[0] = value;
2210 }
2211
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002212 LOperand* value() { return inputs_[0]; }
2213
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002214 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
2215};
2216
2217
2218class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
2219 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002220 LClampDToUint8(LOperand* unclamped, LOperand* temp) {
2221 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002222 temps_[0] = temp;
2223 }
2224
2225 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002226 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002227
2228 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
2229};
2230
2231
2232class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2233 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002234 explicit LClampIToUint8(LOperand* unclamped) {
2235 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002236 }
2237
2238 LOperand* unclamped() { return inputs_[0]; }
2239
2240 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2241};
2242
2243
2244class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2245 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002246 LClampTToUint8(LOperand* unclamped, LOperand* temp) {
2247 inputs_[0] = unclamped;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002248 temps_[0] = temp;
2249 }
2250
2251 LOperand* unclamped() { return inputs_[0]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002252 LOperand* temp() { return temps_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002253
2254 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2255};
2256
2257
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002258class LAllocateObject: public LTemplateInstruction<1, 1, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002259 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002260 LAllocateObject(LOperand* temp, LOperand* temp2) {
2261 temps_[0] = temp;
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002262 temps_[1] = temp2;
2263 }
2264
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002265 LOperand* temp() { return temps_[0]; }
2266 LOperand* temp2() { return temps_[1]; }
2267
ulan@chromium.org967e2702012-02-28 09:49:15 +00002268 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2269 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2270};
2271
2272
hpayer@chromium.org7c3372b2013-02-13 17:26:04 +00002273class LAllocate: public LTemplateInstruction<1, 2, 2> {
2274 public:
2275 LAllocate(LOperand* size, LOperand* temp1, LOperand* temp2) {
2276 inputs_[1] = size;
2277 temps_[0] = temp1;
2278 temps_[1] = temp2;
2279 }
2280
2281 LOperand* size() { return inputs_[1]; }
2282 LOperand* temp1() { return temps_[0]; }
2283 LOperand* temp2() { return temps_[1]; }
2284
2285 DECLARE_CONCRETE_INSTRUCTION(Allocate, "allocate")
2286 DECLARE_HYDROGEN_ACCESSOR(Allocate)
2287};
2288
2289
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002290class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
2291 public:
2292 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2293 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2294};
2295
2296
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002297class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2298 public:
2299 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2300 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2301};
2302
2303
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002304class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002305 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002306 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2307 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002308};
2309
2310
2311class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2312 public:
2313 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2314 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2315};
2316
2317
2318class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2319 public:
2320 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2321 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2322
2323 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2324};
2325
2326
2327class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2328 public:
2329 explicit LToFastProperties(LOperand* value) {
2330 inputs_[0] = value;
2331 }
2332
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002333 LOperand* value() { return inputs_[0]; }
2334
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002335 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2336 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2337};
2338
2339
2340class LTypeof: public LTemplateInstruction<1, 1, 0> {
2341 public:
2342 explicit LTypeof(LOperand* value) {
2343 inputs_[0] = value;
2344 }
2345
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002346 LOperand* value() { return inputs_[0]; }
2347
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002348 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2349};
2350
2351
2352class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2353 public:
2354 explicit LTypeofIsAndBranch(LOperand* value) {
2355 inputs_[0] = value;
2356 }
2357
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002358 LOperand* value() { return inputs_[0]; }
2359
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002360 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2361 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2362
2363 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2364
2365 virtual void PrintDataTo(StringStream* stream);
2366};
2367
2368
2369class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2370 public:
2371 explicit LIsConstructCallAndBranch(LOperand* temp) {
2372 temps_[0] = temp;
2373 }
2374
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002375 LOperand* temp() { return temps_[0]; }
2376
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002377 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2378 "is-construct-call-and-branch")
2379};
2380
2381
2382class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2383 public:
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002384 LDeleteProperty(LOperand* object, LOperand* key) {
2385 inputs_[0] = object;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002386 inputs_[1] = key;
2387 }
2388
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002389 LOperand* object() { return inputs_[0]; }
2390 LOperand* key() { return inputs_[1]; }
svenpanne@chromium.orgc859c4f2012-10-15 11:51:39 +00002391
2392 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002393};
2394
2395
2396class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2397 public:
2398 LOsrEntry();
2399
2400 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2401
2402 LOperand** SpilledRegisterArray() { return register_spills_; }
2403 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2404
2405 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2406 void MarkSpilledDoubleRegister(int allocation_index,
2407 LOperand* spill_operand);
2408
2409 private:
2410 // Arrays of spill slot operands for registers with an assigned spill
2411 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2412 // NULL if the register has no assigned spill slot. Indexed by allocation
2413 // index.
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002414 LOperand* register_spills_[Register::kMaxNumAllocatableRegisters];
2415 LOperand* double_register_spills_[
2416 DoubleRegister::kMaxNumAllocatableRegisters];
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002417};
2418
2419
2420class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2421 public:
2422 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2423 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2424
2425 Label* done_label() { return &done_label_; }
2426
2427 private:
2428 Label done_label_;
2429};
2430
2431
2432class LIn: public LTemplateInstruction<1, 2, 0> {
2433 public:
2434 LIn(LOperand* key, LOperand* object) {
2435 inputs_[0] = key;
2436 inputs_[1] = object;
2437 }
2438
2439 LOperand* key() { return inputs_[0]; }
2440 LOperand* object() { return inputs_[1]; }
2441
2442 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2443};
2444
2445
ulan@chromium.org812308e2012-02-29 15:58:45 +00002446class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2447 public:
2448 explicit LForInPrepareMap(LOperand* object) {
2449 inputs_[0] = object;
2450 }
2451
2452 LOperand* object() { return inputs_[0]; }
2453
2454 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2455};
2456
2457
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002458class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002459 public:
rossberg@chromium.org89e18f52012-10-22 13:09:53 +00002460 explicit LForInCacheArray(LOperand* map) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002461 inputs_[0] = map;
2462 }
2463
2464 LOperand* map() { return inputs_[0]; }
2465
2466 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2467
2468 int idx() {
2469 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2470 }
2471};
2472
2473
2474class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2475 public:
2476 LCheckMapValue(LOperand* value, LOperand* map) {
2477 inputs_[0] = value;
2478 inputs_[1] = map;
2479 }
2480
2481 LOperand* value() { return inputs_[0]; }
2482 LOperand* map() { return inputs_[1]; }
2483
2484 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2485};
2486
2487
2488class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2489 public:
2490 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2491 inputs_[0] = object;
2492 inputs_[1] = index;
2493 }
2494
2495 LOperand* object() { return inputs_[0]; }
2496 LOperand* index() { return inputs_[1]; }
2497
2498 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2499};
2500
2501
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002502class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002503class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002504 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002505 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2506 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002507
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002508 int GetNextSpillIndex(bool is_double);
2509 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002510};
2511
2512
2513class LChunkBuilder BASE_EMBEDDED {
2514 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002515 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2516 : chunk_(NULL),
2517 info_(info),
2518 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002519 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002520 status_(UNUSED),
2521 current_instruction_(NULL),
2522 current_block_(NULL),
2523 next_block_(NULL),
2524 argument_count_(0),
2525 allocator_(allocator),
2526 position_(RelocInfo::kNoPosition),
2527 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002528 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002529
2530 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002531 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002532
2533 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002534#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002535 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2536#undef DECLARE_DO
2537
jkummerow@chromium.org59297c72013-01-09 16:32:23 +00002538 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2539
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002540 private:
2541 enum Status {
2542 UNUSED,
2543 BUILDING,
2544 DONE,
2545 ABORTED
2546 };
2547
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002548 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002549 CompilationInfo* info() const { return info_; }
2550 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002551 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002552
2553 bool is_unused() const { return status_ == UNUSED; }
2554 bool is_building() const { return status_ == BUILDING; }
2555 bool is_done() const { return status_ == DONE; }
2556 bool is_aborted() const { return status_ == ABORTED; }
2557
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002558 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002559
2560 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002561 LUnallocated* ToUnallocated(Register reg);
2562 LUnallocated* ToUnallocated(DoubleRegister reg);
2563
2564 // Methods for setting up define-use relationships.
2565 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2566 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2567 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2568 DoubleRegister fixed_register);
2569
2570 // A value that is guaranteed to be allocated to a register.
2571 // Operand created by UseRegister is guaranteed to be live until the end of
2572 // instruction. This means that register allocator will not reuse it's
2573 // register for any other operand inside instruction.
2574 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2575 // instruction start. Register allocator is free to assign the same register
2576 // to some other operand used inside instruction (i.e. temporary or
2577 // output).
2578 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2579 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2580
2581 // An input operand in a register that may be trashed.
2582 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2583
2584 // An input operand in a register or stack slot.
2585 MUST_USE_RESULT LOperand* Use(HValue* value);
2586 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2587
2588 // An input operand in a register, stack slot or a constant operand.
2589 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2590 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2591
2592 // An input operand in a register or a constant operand.
2593 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2594 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2595
2596 // An input operand in register, stack slot or a constant operand.
2597 // Will not be moved to a register even if one is freely available.
2598 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2599
2600 // Temporary operand that must be in a register.
2601 MUST_USE_RESULT LUnallocated* TempRegister();
2602 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2603 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2604
2605 // Methods for setting up define-use relationships.
2606 // Return the same instruction that they are passed.
2607 template<int I, int T>
2608 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2609 LUnallocated* result);
2610 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002611 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2612 template<int I, int T>
2613 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2614 int index);
2615 template<int I, int T>
2616 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2617 template<int I, int T>
2618 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2619 Register reg);
2620 template<int I, int T>
2621 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2622 DoubleRegister reg);
2623 LInstruction* AssignEnvironment(LInstruction* instr);
2624 LInstruction* AssignPointerMap(LInstruction* instr);
2625
2626 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2627
2628 // By default we assume that instruction sequences generated for calls
2629 // cannot deoptimize eagerly and we do not attach environment to this
2630 // instruction.
2631 LInstruction* MarkAsCall(
2632 LInstruction* instr,
2633 HInstruction* hinstr,
2634 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002635
2636 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2637 int* argument_index_accumulator);
2638
2639 void VisitInstruction(HInstruction* current);
2640
2641 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2642 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2643 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2644 LInstruction* DoArithmeticD(Token::Value op,
2645 HArithmeticBinaryOperation* instr);
2646 LInstruction* DoArithmeticT(Token::Value op,
2647 HArithmeticBinaryOperation* instr);
2648
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002649 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002650 CompilationInfo* info_;
2651 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002652 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002653 Status status_;
2654 HInstruction* current_instruction_;
2655 HBasicBlock* current_block_;
2656 HBasicBlock* next_block_;
2657 int argument_count_;
2658 LAllocator* allocator_;
2659 int position_;
2660 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002661 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002662
lrn@chromium.org7516f052011-03-30 08:52:27 +00002663 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2664};
2665
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002666#undef DECLARE_HYDROGEN_ACCESSOR
2667#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002668
2669} } // namespace v8::internal
2670
2671#endif // V8_MIPS_LITHIUM_MIPS_H_