blob: 367cf2a90c2b28ad516dcb99aaaff192873dcfec [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) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000053 V(ApplyArguments) \
54 V(ArgumentsElements) \
55 V(ArgumentsLength) \
56 V(ArithmeticD) \
57 V(ArithmeticT) \
58 V(ArrayLiteral) \
59 V(BitI) \
60 V(BitNotI) \
61 V(BoundsCheck) \
62 V(Branch) \
63 V(CallConstantFunction) \
64 V(CallFunction) \
65 V(CallGlobal) \
66 V(CallKeyed) \
67 V(CallKnownGlobal) \
68 V(CallNamed) \
69 V(CallNew) \
70 V(CallRuntime) \
71 V(CallStub) \
72 V(CheckFunction) \
73 V(CheckInstanceType) \
jkummerow@chromium.org1456e702012-03-30 08:38:13 +000074 V(CheckMaps) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000075 V(CheckNonSmi) \
76 V(CheckPrototypeMaps) \
77 V(CheckSmi) \
78 V(ClampDToUint8) \
79 V(ClampIToUint8) \
80 V(ClampTToUint8) \
81 V(ClassOfTestAndBranch) \
82 V(CmpConstantEqAndBranch) \
83 V(CmpIDAndBranch) \
84 V(CmpObjectEqAndBranch) \
85 V(CmpMapAndBranch) \
86 V(CmpT) \
87 V(ConstantD) \
88 V(ConstantI) \
89 V(ConstantT) \
90 V(Context) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000091 V(DeclareGlobals) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000092 V(DeleteProperty) \
93 V(Deoptimize) \
94 V(DivI) \
95 V(DoubleToI) \
96 V(ElementsKind) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +000097 V(FastLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +000098 V(FixedArrayBaseLength) \
99 V(FunctionLiteral) \
100 V(GetCachedArrayIndex) \
101 V(GlobalObject) \
102 V(GlobalReceiver) \
103 V(Goto) \
104 V(HasCachedArrayIndexAndBranch) \
105 V(HasInstanceTypeAndBranch) \
106 V(In) \
107 V(InstanceOf) \
108 V(InstanceOfKnownGlobal) \
109 V(InstructionGap) \
110 V(Integer32ToDouble) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000111 V(Uint32ToDouble) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000112 V(InvokeFunction) \
113 V(IsConstructCallAndBranch) \
114 V(IsNilAndBranch) \
115 V(IsObjectAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000116 V(IsStringAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000117 V(IsSmiAndBranch) \
118 V(IsUndetectableAndBranch) \
119 V(JSArrayLength) \
120 V(Label) \
121 V(LazyBailout) \
122 V(LoadContextSlot) \
123 V(LoadElements) \
124 V(LoadExternalArrayPointer) \
125 V(LoadFunctionPrototype) \
126 V(LoadGlobalCell) \
127 V(LoadGlobalGeneric) \
128 V(LoadKeyedFastDoubleElement) \
129 V(LoadKeyedFastElement) \
130 V(LoadKeyedGeneric) \
131 V(LoadKeyedSpecializedArrayElement) \
132 V(LoadNamedField) \
133 V(LoadNamedFieldPolymorphic) \
134 V(LoadNamedGeneric) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000135 V(MapEnumLength) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000136 V(MathMinMax) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000137 V(ModI) \
138 V(MulI) \
139 V(NumberTagD) \
140 V(NumberTagI) \
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000141 V(NumberTagU) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000142 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000143 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000144 V(OsrEntry) \
145 V(OuterContext) \
146 V(Parameter) \
147 V(Power) \
148 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000149 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000150 V(RegExpLiteral) \
151 V(Return) \
152 V(ShiftI) \
153 V(SmiTag) \
154 V(SmiUntag) \
155 V(StackCheck) \
156 V(StoreContextSlot) \
157 V(StoreGlobalCell) \
158 V(StoreGlobalGeneric) \
159 V(StoreKeyedFastDoubleElement) \
160 V(StoreKeyedFastElement) \
161 V(StoreKeyedGeneric) \
162 V(StoreKeyedSpecializedArrayElement) \
163 V(StoreNamedField) \
164 V(StoreNamedGeneric) \
165 V(StringAdd) \
166 V(StringCharCodeAt) \
167 V(StringCharFromCode) \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000168 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000169 V(StringLength) \
170 V(SubI) \
171 V(TaggedToI) \
172 V(ThisFunction) \
173 V(Throw) \
174 V(ToFastProperties) \
175 V(TransitionElementsKind) \
176 V(Typeof) \
177 V(TypeofIsAndBranch) \
178 V(UnaryMathOperation) \
179 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000180 V(ValueOf) \
181 V(ForInPrepareMap) \
182 V(ForInCacheArray) \
183 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000184 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000185 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000186 V(WrapReceiver) \
187 V(Drop)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000188
189#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
190 virtual Opcode opcode() const { return LInstruction::k##type; } \
191 virtual void CompileToNative(LCodeGen* generator); \
192 virtual const char* Mnemonic() const { return mnemonic; } \
193 static L##type* cast(LInstruction* instr) { \
194 ASSERT(instr->Is##type()); \
195 return reinterpret_cast<L##type*>(instr); \
196 }
197
198
199#define DECLARE_HYDROGEN_ACCESSOR(type) \
200 H##type* hydrogen() const { \
201 return H##type::cast(hydrogen_value()); \
202 }
203
lrn@chromium.org7516f052011-03-30 08:52:27 +0000204
205class LInstruction: public ZoneObject {
206 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000207 LInstruction()
208 : environment_(NULL),
209 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000210 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000211 virtual ~LInstruction() { }
212
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000213 virtual void CompileToNative(LCodeGen* generator) = 0;
214 virtual const char* Mnemonic() const = 0;
215 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000216 virtual void PrintDataTo(StringStream* stream);
217 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000218
219 enum Opcode {
220 // Declare a unique enum value for each instruction.
221#define DECLARE_OPCODE(type) k##type,
222 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
223 kNumberOfInstructions
224#undef DECLARE_OPCODE
225 };
226
227 virtual Opcode opcode() const = 0;
228
229 // Declare non-virtual type testers for all leaf IR classes.
230#define DECLARE_PREDICATE(type) \
231 bool Is##type() const { return opcode() == k##type; }
232 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
233#undef DECLARE_PREDICATE
234
235 // Declare virtual predicates for instructions that don't have
236 // an opcode.
237 virtual bool IsGap() const { return false; }
238
239 virtual bool IsControl() const { return false; }
240
241 void set_environment(LEnvironment* env) { environment_ = env; }
242 LEnvironment* environment() const { return environment_; }
243 bool HasEnvironment() const { return environment_ != NULL; }
244
245 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
246 LPointerMap* pointer_map() const { return pointer_map_.get(); }
247 bool HasPointerMap() const { return pointer_map_.is_set(); }
248
249 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
250 HValue* hydrogen_value() const { return hydrogen_value_; }
251
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000252 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000253
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000254 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000255
256 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000257 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000258
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000259 virtual bool HasResult() const = 0;
260 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000261
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000262 virtual int TempCount() = 0;
263 virtual LOperand* TempAt(int i) = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000264
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000265 LOperand* FirstInput() { return InputAt(0); }
266 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000267
268#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000269 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000270#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000271
272 private:
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000273 // Iterator interface.
274 friend class InputIterator;
275 virtual int InputCount() = 0;
276 virtual LOperand* InputAt(int i) = 0;
277
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000278 LEnvironment* environment_;
279 SetOncePointer<LPointerMap> pointer_map_;
280 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000281 bool is_call_;
282 bool is_save_doubles_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000283};
284
285
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000286// R = number of result operands (0 or 1).
287// I = number of input operands.
288// T = number of temporary operands.
289template<int R, int I, int T>
290class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000291 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000292 // Allow 0 or 1 output operands.
293 STATIC_ASSERT(R == 0 || R == 1);
294 virtual bool HasResult() const { return R != 0; }
295 void set_result(LOperand* operand) { results_[0] = operand; }
296 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000297
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000298 LOperand* InputAt(int i) { return inputs_[i]; }
299
300 int TempCount() { return T; }
301 LOperand* TempAt(int i) { return temps_[i]; }
302
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000303 protected:
304 EmbeddedContainer<LOperand*, R> results_;
305 EmbeddedContainer<LOperand*, I> inputs_;
306 EmbeddedContainer<LOperand*, T> temps_;
yangguo@chromium.org46839fb2012-08-28 09:06:19 +0000307
308 private:
309 virtual int InputCount() { return I; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000310};
311
312
313class LGap: public LTemplateInstruction<0, 0, 0> {
314 public:
315 explicit LGap(HBasicBlock* block)
316 : block_(block) {
317 parallel_moves_[BEFORE] = NULL;
318 parallel_moves_[START] = NULL;
319 parallel_moves_[END] = NULL;
320 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000321 }
322
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000323 // Can't use the DECLARE-macro here because of sub-classes.
324 virtual bool IsGap() const { return true; }
325 virtual void PrintDataTo(StringStream* stream);
326 static LGap* cast(LInstruction* instr) {
327 ASSERT(instr->IsGap());
328 return reinterpret_cast<LGap*>(instr);
329 }
330
331 bool IsRedundant() const;
332
333 HBasicBlock* block() const { return block_; }
334
lrn@chromium.org7516f052011-03-30 08:52:27 +0000335 enum InnerPosition {
336 BEFORE,
337 START,
338 END,
339 AFTER,
340 FIRST_INNER_POSITION = BEFORE,
341 LAST_INNER_POSITION = AFTER
342 };
343
mmassi@chromium.org7028c052012-06-13 11:51:58 +0000344 LParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
345 if (parallel_moves_[pos] == NULL) {
346 parallel_moves_[pos] = new(zone) LParallelMove(zone);
347 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000348 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000349 }
350
351 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000352 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000353 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000354
355 private:
356 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
357 HBasicBlock* block_;
358};
359
360
361class LInstructionGap: public LGap {
362 public:
363 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
364
365 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
366};
367
368
369class LGoto: public LTemplateInstruction<0, 0, 0> {
370 public:
371 explicit LGoto(int block_id) : block_id_(block_id) { }
372
373 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
374 virtual void PrintDataTo(StringStream* stream);
375 virtual bool IsControl() const { return true; }
376
377 int block_id() const { return block_id_; }
378
379 private:
380 int block_id_;
381};
382
383
384class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
385 public:
386 LLazyBailout() : gap_instructions_size_(0) { }
387
388 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
389
390 void set_gap_instructions_size(int gap_instructions_size) {
391 gap_instructions_size_ = gap_instructions_size;
392 }
393 int gap_instructions_size() { return gap_instructions_size_; }
394
395 private:
396 int gap_instructions_size_;
397};
398
399
400class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
401 public:
402 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000403};
404
405
406class LLabel: public LGap {
407 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000408 explicit LLabel(HBasicBlock* block)
409 : LGap(block), replacement_(NULL) { }
410
411 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
412
413 virtual void PrintDataTo(StringStream* stream);
414
415 int block_id() const { return block()->block_id(); }
416 bool is_loop_header() const { return block()->IsLoopHeader(); }
417 Label* label() { return &label_; }
418 LLabel* replacement() const { return replacement_; }
419 void set_replacement(LLabel* label) { replacement_ = label; }
420 bool HasReplacement() const { return replacement_ != NULL; }
421
422 private:
423 Label label_;
424 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000425};
426
427
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000428class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000429 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000430 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
431};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000432
lrn@chromium.org7516f052011-03-30 08:52:27 +0000433
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000434class LCallStub: public LTemplateInstruction<1, 0, 0> {
435 public:
436 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
437 DECLARE_HYDROGEN_ACCESSOR(CallStub)
438
439 TranscendentalCache::Type transcendental_type() {
440 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000441 }
442};
443
444
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000445class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
446 public:
447 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
448};
449
450
451template<int I, int T>
452class LControlInstruction: public LTemplateInstruction<0, I, T> {
453 public:
454 virtual bool IsControl() const { return true; }
455
456 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
457 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
458 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
459 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
460
461 private:
462 HControlInstruction* hydrogen() {
463 return HControlInstruction::cast(this->hydrogen_value());
464 }
465};
466
467
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000468class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
469 public:
470 LWrapReceiver(LOperand* receiver, LOperand* function) {
471 inputs_[0] = receiver;
472 inputs_[1] = function;
473 }
474
475 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
476
477 LOperand* receiver() { return inputs_[0]; }
478 LOperand* function() { return inputs_[1]; }
479};
480
481
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000482class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
483 public:
484 LApplyArguments(LOperand* function,
485 LOperand* receiver,
486 LOperand* length,
487 LOperand* elements) {
488 inputs_[0] = function;
489 inputs_[1] = receiver;
490 inputs_[2] = length;
491 inputs_[3] = elements;
492 }
493
494 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
495
496 LOperand* function() { return inputs_[0]; }
497 LOperand* receiver() { return inputs_[1]; }
498 LOperand* length() { return inputs_[2]; }
499 LOperand* elements() { return inputs_[3]; }
500};
501
502
503class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
504 public:
505 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
506 inputs_[0] = arguments;
507 inputs_[1] = length;
508 inputs_[2] = index;
509 }
510
511 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
512
513 LOperand* arguments() { return inputs_[0]; }
514 LOperand* length() { return inputs_[1]; }
515 LOperand* index() { return inputs_[2]; }
516
517 virtual void PrintDataTo(StringStream* stream);
518};
519
520
521class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
522 public:
523 explicit LArgumentsLength(LOperand* elements) {
524 inputs_[0] = elements;
525 }
526
527 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
528};
529
530
531class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
532 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000533 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000534 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000535};
536
537
538class LModI: public LTemplateInstruction<1, 2, 3> {
539 public:
540 // Used when the right hand is a constant power of 2.
541 LModI(LOperand* left,
542 LOperand* right) {
543 inputs_[0] = left;
544 inputs_[1] = right;
545 temps_[0] = NULL;
546 temps_[1] = NULL;
547 temps_[2] = NULL;
548 }
549
550 // Used for the standard case.
551 LModI(LOperand* left,
552 LOperand* right,
553 LOperand* temp1,
554 LOperand* temp2,
555 LOperand* temp3) {
556 inputs_[0] = left;
557 inputs_[1] = right;
558 temps_[0] = temp1;
559 temps_[1] = temp2;
560 temps_[2] = temp3;
561 }
562
563 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
564 DECLARE_HYDROGEN_ACCESSOR(Mod)
565};
566
567
568class LDivI: public LTemplateInstruction<1, 2, 0> {
569 public:
570 LDivI(LOperand* left, LOperand* right) {
571 inputs_[0] = left;
572 inputs_[1] = right;
573 }
574
575 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
576 DECLARE_HYDROGEN_ACCESSOR(Div)
577};
578
579
580class LMulI: public LTemplateInstruction<1, 2, 1> {
581 public:
582 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
583 inputs_[0] = left;
584 inputs_[1] = right;
585 temps_[0] = temp;
586 }
587
588 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
589 DECLARE_HYDROGEN_ACCESSOR(Mul)
590};
591
592
593class LCmpIDAndBranch: public LControlInstruction<2, 0> {
594 public:
595 LCmpIDAndBranch(LOperand* left, LOperand* right) {
596 inputs_[0] = left;
597 inputs_[1] = right;
598 }
599
600 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
601 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
602
603 Token::Value op() const { return hydrogen()->token(); }
604 bool is_double() const {
605 return hydrogen()->GetInputRepresentation().IsDouble();
606 }
607
608 virtual void PrintDataTo(StringStream* stream);
609};
610
611
612class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
613 public:
614 LUnaryMathOperation(LOperand* value, LOperand* temp) {
615 inputs_[0] = value;
616 temps_[0] = temp;
617 }
618
619 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
620 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
621
622 virtual void PrintDataTo(StringStream* stream);
623 BuiltinFunctionId op() const { return hydrogen()->op(); }
624};
625
626
627class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
628 public:
629 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
630 inputs_[0] = left;
631 inputs_[1] = right;
632 }
633
634 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
635 "cmp-object-eq-and-branch")
636 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
637};
638
639
640class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
641 public:
642 explicit LCmpConstantEqAndBranch(LOperand* left) {
643 inputs_[0] = left;
644 }
645
646 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
647 "cmp-constant-eq-and-branch")
648 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
649};
650
651
652class LIsNilAndBranch: public LControlInstruction<1, 0> {
653 public:
654 explicit LIsNilAndBranch(LOperand* value) {
655 inputs_[0] = value;
656 }
657
658 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
659 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
660
661 EqualityKind kind() const { return hydrogen()->kind(); }
662 NilValue nil() const { return hydrogen()->nil(); }
663
664 virtual void PrintDataTo(StringStream* stream);
665};
666
667
668class LIsObjectAndBranch: public LControlInstruction<1, 1> {
669 public:
670 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
671 inputs_[0] = value;
672 temps_[0] = temp;
673 }
674
675 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
676 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
677
678 virtual void PrintDataTo(StringStream* stream);
679};
680
681
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000682class LIsStringAndBranch: public LControlInstruction<1, 1> {
683 public:
684 LIsStringAndBranch(LOperand* value, LOperand* temp) {
685 inputs_[0] = value;
686 temps_[0] = temp;
687 }
688
689 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
690 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
691
692 virtual void PrintDataTo(StringStream* stream);
693};
694
695
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000696class LIsSmiAndBranch: public LControlInstruction<1, 0> {
697 public:
698 explicit LIsSmiAndBranch(LOperand* value) {
699 inputs_[0] = value;
700 }
701
702 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
703 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
704
705 virtual void PrintDataTo(StringStream* stream);
706};
707
708
709class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
710 public:
711 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
712 inputs_[0] = value;
713 temps_[0] = temp;
714 }
715
716 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
717 "is-undetectable-and-branch")
718 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
719
720 virtual void PrintDataTo(StringStream* stream);
721};
722
723
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000724class LStringCompareAndBranch: public LControlInstruction<2, 0> {
725 public:
726 LStringCompareAndBranch(LOperand* left, LOperand* right) {
727 inputs_[0] = left;
728 inputs_[1] = right;
729 }
730
731 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
732 "string-compare-and-branch")
733 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
734
735 Token::Value op() const { return hydrogen()->token(); }
736
737 virtual void PrintDataTo(StringStream* stream);
738};
739
740
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000741class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
742 public:
743 explicit LHasInstanceTypeAndBranch(LOperand* value) {
744 inputs_[0] = value;
745 }
746
747 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
748 "has-instance-type-and-branch")
749 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
750
751 virtual void PrintDataTo(StringStream* stream);
752};
753
754
755class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
756 public:
757 explicit LGetCachedArrayIndex(LOperand* value) {
758 inputs_[0] = value;
759 }
760
761 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
762 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
763};
764
765
766class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
767 public:
768 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
769 inputs_[0] = value;
770 }
771
772 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
773 "has-cached-array-index-and-branch")
774 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
775
776 virtual void PrintDataTo(StringStream* stream);
777};
778
779
780class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
781 public:
782 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
783 inputs_[0] = value;
784 temps_[0] = temp;
785 }
786
787 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
788 "class-of-test-and-branch")
789 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
790
791 virtual void PrintDataTo(StringStream* stream);
792};
793
794
795class LCmpT: public LTemplateInstruction<1, 2, 0> {
796 public:
797 LCmpT(LOperand* left, LOperand* right) {
798 inputs_[0] = left;
799 inputs_[1] = right;
800 }
801
802 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
803 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
804
805 Token::Value op() const { return hydrogen()->token(); }
806};
807
808
809class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
810 public:
811 LInstanceOf(LOperand* left, LOperand* right) {
812 inputs_[0] = left;
813 inputs_[1] = right;
814 }
815
816 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
817};
818
819
820class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
821 public:
822 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
823 inputs_[0] = value;
824 temps_[0] = temp;
825 }
826
827 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
828 "instance-of-known-global")
829 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
830
831 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000832 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
833 return lazy_deopt_env_;
834 }
835 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
836 lazy_deopt_env_ = env;
837 }
838
839 private:
840 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000841};
842
843
844class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
845 public:
846 LBoundsCheck(LOperand* index, LOperand* length) {
847 inputs_[0] = index;
848 inputs_[1] = length;
849 }
850
851 LOperand* index() { return inputs_[0]; }
852 LOperand* length() { return inputs_[1]; }
853
854 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
danno@chromium.org129d3982012-07-25 15:01:47 +0000855 DECLARE_HYDROGEN_ACCESSOR(BoundsCheck)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000856};
857
858
859class LBitI: public LTemplateInstruction<1, 2, 0> {
860 public:
861 LBitI(LOperand* left, LOperand* right) {
862 inputs_[0] = left;
863 inputs_[1] = right;
864 }
865
866 Token::Value op() const { return hydrogen()->op(); }
867
868 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
869 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
870};
871
872
873class LShiftI: public LTemplateInstruction<1, 2, 0> {
874 public:
875 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
876 : op_(op), can_deopt_(can_deopt) {
877 inputs_[0] = left;
878 inputs_[1] = right;
879 }
880
881 Token::Value op() const { return op_; }
882
883 bool can_deopt() const { return can_deopt_; }
884
885 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
886
887 private:
888 Token::Value op_;
889 bool can_deopt_;
890};
891
892
893class LSubI: public LTemplateInstruction<1, 2, 0> {
894 public:
895 LSubI(LOperand* left, LOperand* right) {
896 inputs_[0] = left;
897 inputs_[1] = right;
898 }
899
900 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
901 DECLARE_HYDROGEN_ACCESSOR(Sub)
902};
903
904
905class LConstantI: public LTemplateInstruction<1, 0, 0> {
906 public:
907 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
908 DECLARE_HYDROGEN_ACCESSOR(Constant)
909
910 int32_t value() const { return hydrogen()->Integer32Value(); }
911};
912
913
914class LConstantD: public LTemplateInstruction<1, 0, 0> {
915 public:
916 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
917 DECLARE_HYDROGEN_ACCESSOR(Constant)
918
919 double value() const { return hydrogen()->DoubleValue(); }
920};
921
922
923class LConstantT: public LTemplateInstruction<1, 0, 0> {
924 public:
925 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
926 DECLARE_HYDROGEN_ACCESSOR(Constant)
927
928 Handle<Object> value() const { return hydrogen()->handle(); }
929};
930
931
932class LBranch: public LControlInstruction<1, 0> {
933 public:
934 explicit LBranch(LOperand* value) {
935 inputs_[0] = value;
936 }
937
938 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
939 DECLARE_HYDROGEN_ACCESSOR(Branch)
940
941 virtual void PrintDataTo(StringStream* stream);
942};
943
944
945class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
946 public:
947 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
948 inputs_[0] = value;
949 temps_[0] = temp;
950 }
951
952 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
953 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
954
955 virtual bool IsControl() const { return true; }
956
957 Handle<Map> map() const { return hydrogen()->map(); }
958 int true_block_id() const {
959 return hydrogen()->FirstSuccessor()->block_id();
960 }
961 int false_block_id() const {
962 return hydrogen()->SecondSuccessor()->block_id();
963 }
964};
965
966
967class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
968 public:
969 explicit LJSArrayLength(LOperand* value) {
970 inputs_[0] = value;
971 }
972
973 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
974 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
975};
976
977
978class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
979 public:
980 explicit LFixedArrayBaseLength(LOperand* value) {
981 inputs_[0] = value;
982 }
983
984 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
985 "fixed-array-base-length")
986 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
987};
988
989
jkummerow@chromium.org78502a92012-09-06 13:50:42 +0000990class LMapEnumLength: public LTemplateInstruction<1, 1, 0> {
991 public:
992 explicit LMapEnumLength(LOperand* value) {
993 inputs_[0] = value;
994 }
995
996 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength, "map-enum-length")
997};
998
999
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001000class LElementsKind: public LTemplateInstruction<1, 1, 0> {
1001 public:
1002 explicit LElementsKind(LOperand* value) {
1003 inputs_[0] = value;
1004 }
1005
1006 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
1007 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
1008};
1009
1010
1011class LValueOf: public LTemplateInstruction<1, 1, 1> {
1012 public:
1013 LValueOf(LOperand* value, LOperand* temp) {
1014 inputs_[0] = value;
1015 temps_[0] = temp;
1016 }
1017
1018 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1019 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1020};
1021
1022
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001023class LDateField: public LTemplateInstruction<1, 1, 1> {
1024 public:
1025 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1026 inputs_[0] = date;
1027 temps_[0] = temp;
1028 }
1029
1030 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1031 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1032 Smi* index() const { return index_; }
1033
1034 private:
1035 Smi* index_;
1036};
1037
1038
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001039class LThrow: public LTemplateInstruction<0, 1, 0> {
1040 public:
1041 explicit LThrow(LOperand* value) {
1042 inputs_[0] = value;
1043 }
1044
1045 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1046};
1047
1048
1049class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1050 public:
1051 explicit LBitNotI(LOperand* value) {
1052 inputs_[0] = value;
1053 }
1054
1055 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1056};
1057
1058
1059class LAddI: public LTemplateInstruction<1, 2, 0> {
1060 public:
1061 LAddI(LOperand* left, LOperand* right) {
1062 inputs_[0] = left;
1063 inputs_[1] = right;
1064 }
1065
1066 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1067 DECLARE_HYDROGEN_ACCESSOR(Add)
1068};
1069
1070
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00001071class LMathMinMax: public LTemplateInstruction<1, 2, 0> {
1072 public:
1073 LMathMinMax(LOperand* left, LOperand* right) {
1074 inputs_[0] = left;
1075 inputs_[1] = right;
1076 }
1077
1078 DECLARE_CONCRETE_INSTRUCTION(MathMinMax, "min-max")
1079 DECLARE_HYDROGEN_ACCESSOR(MathMinMax)
1080};
1081
1082
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001083class LPower: public LTemplateInstruction<1, 2, 0> {
1084 public:
1085 LPower(LOperand* left, LOperand* right) {
1086 inputs_[0] = left;
1087 inputs_[1] = right;
1088 }
1089
1090 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1091 DECLARE_HYDROGEN_ACCESSOR(Power)
1092};
1093
1094
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001095class LRandom: public LTemplateInstruction<1, 1, 0> {
1096 public:
1097 explicit LRandom(LOperand* global_object) {
1098 inputs_[0] = global_object;
1099 }
1100
1101 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1102 DECLARE_HYDROGEN_ACCESSOR(Random)
1103};
1104
1105
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001106class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1107 public:
1108 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1109 : op_(op) {
1110 inputs_[0] = left;
1111 inputs_[1] = right;
1112 }
1113
1114 Token::Value op() const { return op_; }
1115
1116 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1117 virtual void CompileToNative(LCodeGen* generator);
1118 virtual const char* Mnemonic() const;
1119
1120 private:
1121 Token::Value op_;
1122};
1123
1124
1125class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1126 public:
1127 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1128 : op_(op) {
1129 inputs_[0] = left;
1130 inputs_[1] = right;
1131 }
1132
1133 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1134 virtual void CompileToNative(LCodeGen* generator);
1135 virtual const char* Mnemonic() const;
1136
1137 Token::Value op() const { return op_; }
1138
1139 private:
1140 Token::Value op_;
1141};
1142
1143
1144class LReturn: public LTemplateInstruction<0, 1, 0> {
1145 public:
1146 explicit LReturn(LOperand* value) {
1147 inputs_[0] = value;
1148 }
1149
1150 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1151};
1152
1153
1154class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1155 public:
1156 explicit LLoadNamedField(LOperand* object) {
1157 inputs_[0] = object;
1158 }
1159
1160 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1161 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1162};
1163
1164
1165class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1166 public:
1167 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1168 inputs_[0] = object;
1169 }
1170
1171 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1172 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
1173
1174 LOperand* object() { return inputs_[0]; }
1175};
1176
1177
1178class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1179 public:
1180 explicit LLoadNamedGeneric(LOperand* object) {
1181 inputs_[0] = object;
1182 }
1183
1184 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1185 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1186
1187 LOperand* object() { return inputs_[0]; }
1188 Handle<Object> name() const { return hydrogen()->name(); }
1189};
1190
1191
1192class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1193 public:
1194 explicit LLoadFunctionPrototype(LOperand* function) {
1195 inputs_[0] = function;
1196 }
1197
1198 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1199 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1200
1201 LOperand* function() { return inputs_[0]; }
1202};
1203
1204
1205class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1206 public:
1207 explicit LLoadElements(LOperand* object) {
1208 inputs_[0] = object;
1209 }
1210
1211 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1212};
1213
1214
1215class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1216 public:
1217 explicit LLoadExternalArrayPointer(LOperand* object) {
1218 inputs_[0] = object;
1219 }
1220
1221 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1222 "load-external-array-pointer")
1223};
1224
1225
1226class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> {
1227 public:
1228 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1229 inputs_[0] = elements;
1230 inputs_[1] = key;
1231 }
1232
1233 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1234 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1235
1236 LOperand* elements() { return inputs_[0]; }
1237 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001238 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001239};
1240
1241
1242class LLoadKeyedFastDoubleElement: public LTemplateInstruction<1, 2, 0> {
1243 public:
1244 LLoadKeyedFastDoubleElement(LOperand* elements, LOperand* key) {
1245 inputs_[0] = elements;
1246 inputs_[1] = key;
1247 }
1248
1249 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement,
1250 "load-keyed-fast-double-element")
1251 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastDoubleElement)
1252
1253 LOperand* elements() { return inputs_[0]; }
1254 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001255 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001256};
1257
1258
1259class LLoadKeyedSpecializedArrayElement: public LTemplateInstruction<1, 2, 0> {
1260 public:
svenpanne@chromium.org830d30c2012-05-29 13:20:14 +00001261 LLoadKeyedSpecializedArrayElement(LOperand* external_pointer,
1262 LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001263 inputs_[0] = external_pointer;
1264 inputs_[1] = key;
1265 }
1266
1267 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement,
1268 "load-keyed-specialized-array-element")
1269 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedSpecializedArrayElement)
1270
1271 LOperand* external_pointer() { return inputs_[0]; }
1272 LOperand* key() { return inputs_[1]; }
1273 ElementsKind elements_kind() const {
1274 return hydrogen()->elements_kind();
1275 }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001276 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001277};
1278
1279
1280class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1281 public:
1282 LLoadKeyedGeneric(LOperand* obj, LOperand* key) {
1283 inputs_[0] = obj;
1284 inputs_[1] = key;
1285 }
1286
1287 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1288
1289 LOperand* object() { return inputs_[0]; }
1290 LOperand* key() { return inputs_[1]; }
1291};
1292
1293
1294class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1295 public:
1296 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1297 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1298};
1299
1300
1301class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1302 public:
1303 explicit LLoadGlobalGeneric(LOperand* global_object) {
1304 inputs_[0] = global_object;
1305 }
1306
1307 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1308 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1309
1310 LOperand* global_object() { return inputs_[0]; }
1311 Handle<Object> name() const { return hydrogen()->name(); }
1312 bool for_typeof() const { return hydrogen()->for_typeof(); }
1313};
1314
1315
1316class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1317 public:
1318 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1319 inputs_[0] = value;
1320 temps_[0] = temp;
1321 }
1322
1323 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1324 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
danno@chromium.orge78f9fc2011-12-21 08:29:34 +00001325
1326 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001327};
1328
1329
1330class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1331 public:
1332 explicit LStoreGlobalGeneric(LOperand* global_object,
1333 LOperand* value) {
1334 inputs_[0] = global_object;
1335 inputs_[1] = value;
1336 }
1337
1338 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1339 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1340
1341 LOperand* global_object() { return InputAt(0); }
1342 Handle<Object> name() const { return hydrogen()->name(); }
1343 LOperand* value() { return InputAt(1); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001344 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001345};
1346
1347
1348class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1349 public:
1350 explicit LLoadContextSlot(LOperand* context) {
1351 inputs_[0] = context;
1352 }
1353
1354 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1355 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1356
1357 LOperand* context() { return InputAt(0); }
1358 int slot_index() { return hydrogen()->slot_index(); }
1359
1360 virtual void PrintDataTo(StringStream* stream);
1361};
1362
1363
1364class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1365 public:
1366 LStoreContextSlot(LOperand* context, LOperand* value) {
1367 inputs_[0] = context;
1368 inputs_[1] = value;
1369 }
1370
1371 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1372 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1373
1374 LOperand* context() { return InputAt(0); }
1375 LOperand* value() { return InputAt(1); }
1376 int slot_index() { return hydrogen()->slot_index(); }
1377
1378 virtual void PrintDataTo(StringStream* stream);
1379};
1380
1381
1382class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1383 public:
1384 explicit LPushArgument(LOperand* value) {
1385 inputs_[0] = value;
1386 }
1387
1388 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1389};
1390
1391
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001392class LDrop: public LTemplateInstruction<0, 0, 0> {
1393 public:
1394 explicit LDrop(int count) : count_(count) { }
1395
1396 int count() const { return count_; }
1397
1398 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1399
1400 private:
1401 int count_;
1402};
1403
1404
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001405class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1406 public:
1407 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1408 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1409};
1410
1411
1412class LContext: public LTemplateInstruction<1, 0, 0> {
1413 public:
1414 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1415};
1416
1417
1418class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1419 public:
1420 explicit LOuterContext(LOperand* context) {
1421 inputs_[0] = context;
1422 }
1423
1424 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
1425
1426 LOperand* context() { return InputAt(0); }
1427};
1428
1429
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001430class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1431 public:
1432 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1433 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1434};
1435
1436
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001437class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1438 public:
1439 explicit LGlobalObject(LOperand* context) {
1440 inputs_[0] = context;
1441 }
1442
1443 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1444
1445 LOperand* context() { return InputAt(0); }
1446};
1447
1448
1449class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1450 public:
1451 explicit LGlobalReceiver(LOperand* global_object) {
1452 inputs_[0] = global_object;
1453 }
1454
1455 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1456
1457 LOperand* global() { return InputAt(0); }
1458};
1459
1460
1461class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1462 public:
1463 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1464 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1465
1466 virtual void PrintDataTo(StringStream* stream);
1467
1468 Handle<JSFunction> function() { return hydrogen()->function(); }
1469 int arity() const { return hydrogen()->argument_count() - 1; }
1470};
1471
1472
1473class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1474 public:
1475 explicit LInvokeFunction(LOperand* function) {
1476 inputs_[0] = function;
1477 }
1478
1479 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1480 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1481
1482 LOperand* function() { return inputs_[0]; }
1483
1484 virtual void PrintDataTo(StringStream* stream);
1485
1486 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001487 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001488};
1489
1490
1491class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1492 public:
1493 explicit LCallKeyed(LOperand* key) {
1494 inputs_[0] = key;
1495 }
1496
1497 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1498 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1499
1500 virtual void PrintDataTo(StringStream* stream);
1501
1502 int arity() const { return hydrogen()->argument_count() - 1; }
1503};
1504
1505
1506
1507class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1508 public:
1509 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1510 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1511
1512 virtual void PrintDataTo(StringStream* stream);
1513
1514 Handle<String> name() const { return hydrogen()->name(); }
1515 int arity() const { return hydrogen()->argument_count() - 1; }
1516};
1517
1518
danno@chromium.orgc612e022011-11-10 11:38:15 +00001519class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001520 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001521 explicit LCallFunction(LOperand* function) {
1522 inputs_[0] = function;
1523 }
1524
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001525 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1526 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1527
danno@chromium.orgc612e022011-11-10 11:38:15 +00001528 LOperand* function() { return inputs_[0]; }
1529 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001530};
1531
1532
1533class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1534 public:
1535 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1536 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1537
1538 virtual void PrintDataTo(StringStream* stream);
1539
1540 Handle<String> name() const {return hydrogen()->name(); }
1541 int arity() const { return hydrogen()->argument_count() - 1; }
1542};
1543
1544
1545class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1546 public:
1547 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1548 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1549
1550 virtual void PrintDataTo(StringStream* stream);
1551
1552 Handle<JSFunction> target() const { return hydrogen()->target(); }
1553 int arity() const { return hydrogen()->argument_count() - 1; }
1554};
1555
1556
1557class LCallNew: public LTemplateInstruction<1, 1, 0> {
1558 public:
1559 explicit LCallNew(LOperand* constructor) {
1560 inputs_[0] = constructor;
1561 }
1562
1563 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1564 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1565
1566 virtual void PrintDataTo(StringStream* stream);
1567
1568 int arity() const { return hydrogen()->argument_count() - 1; }
1569};
1570
1571
1572class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1573 public:
1574 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1575 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1576
1577 const Runtime::Function* function() const { return hydrogen()->function(); }
1578 int arity() const { return hydrogen()->argument_count(); }
1579};
1580
1581
1582class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1583 public:
1584 explicit LInteger32ToDouble(LOperand* value) {
1585 inputs_[0] = value;
1586 }
1587
1588 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1589};
1590
1591
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001592class LUint32ToDouble: public LTemplateInstruction<1, 1, 0> {
1593 public:
1594 explicit LUint32ToDouble(LOperand* value) {
1595 inputs_[0] = value;
1596 }
1597
1598 DECLARE_CONCRETE_INSTRUCTION(Uint32ToDouble, "uint32-to-double")
1599};
1600
1601
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001602class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1603 public:
1604 explicit LNumberTagI(LOperand* value) {
1605 inputs_[0] = value;
1606 }
1607
1608 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1609};
1610
1611
jkummerow@chromium.org78502a92012-09-06 13:50:42 +00001612class LNumberTagU: public LTemplateInstruction<1, 1, 0> {
1613 public:
1614 explicit LNumberTagU(LOperand* value) {
1615 inputs_[0] = value;
1616 }
1617
1618 DECLARE_CONCRETE_INSTRUCTION(NumberTagU, "number-tag-u")
1619};
1620
1621
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001622class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1623 public:
1624 LNumberTagD(LOperand* value, LOperand* temp1, LOperand* temp2) {
1625 inputs_[0] = value;
1626 temps_[0] = temp1;
1627 temps_[1] = temp2;
1628 }
1629
1630 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1631};
1632
1633
1634// Sometimes truncating conversion from a tagged value to an int32.
1635class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1636 public:
1637 LDoubleToI(LOperand* value, LOperand* temp1, LOperand* temp2) {
1638 inputs_[0] = value;
1639 temps_[0] = temp1;
1640 temps_[1] = temp2;
1641 }
1642
1643 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1644 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1645
1646 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1647};
1648
1649
1650// Truncating conversion from a tagged value to an int32.
1651class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1652 public:
1653 LTaggedToI(LOperand* value,
1654 LOperand* temp1,
1655 LOperand* temp2,
1656 LOperand* temp3) {
1657 inputs_[0] = value;
1658 temps_[0] = temp1;
1659 temps_[1] = temp2;
1660 temps_[2] = temp3;
1661 }
1662
1663 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1664 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1665
1666 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1667};
1668
1669
1670class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1671 public:
1672 explicit LSmiTag(LOperand* value) {
1673 inputs_[0] = value;
1674 }
1675
1676 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1677};
1678
1679
1680class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1681 public:
1682 explicit LNumberUntagD(LOperand* value) {
1683 inputs_[0] = value;
1684 }
1685
1686 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1687 DECLARE_HYDROGEN_ACCESSOR(Change)
1688};
1689
1690
1691class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1692 public:
1693 LSmiUntag(LOperand* value, bool needs_check)
1694 : needs_check_(needs_check) {
1695 inputs_[0] = value;
1696 }
1697
1698 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1699
1700 bool needs_check() const { return needs_check_; }
1701
1702 private:
1703 bool needs_check_;
1704};
1705
1706
verwaest@chromium.org37141392012-05-31 13:27:02 +00001707class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001708 public:
verwaest@chromium.org37141392012-05-31 13:27:02 +00001709 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001710 inputs_[0] = obj;
1711 inputs_[1] = val;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001712 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001713 }
1714
1715 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1716 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1717
1718 virtual void PrintDataTo(StringStream* stream);
1719
1720 LOperand* object() { return inputs_[0]; }
1721 LOperand* value() { return inputs_[1]; }
1722
1723 Handle<Object> name() const { return hydrogen()->name(); }
1724 bool is_in_object() { return hydrogen()->is_in_object(); }
1725 int offset() { return hydrogen()->offset(); }
1726 Handle<Map> transition() const { return hydrogen()->transition(); }
1727};
1728
1729
1730class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1731 public:
1732 LStoreNamedGeneric(LOperand* obj, LOperand* val) {
1733 inputs_[0] = obj;
1734 inputs_[1] = val;
1735 }
1736
1737 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1738 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1739
1740 virtual void PrintDataTo(StringStream* stream);
1741
1742 LOperand* object() { return inputs_[0]; }
1743 LOperand* value() { return inputs_[1]; }
1744 Handle<Object> name() const { return hydrogen()->name(); }
1745 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001746};
1747
1748
1749class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
1750 public:
1751 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
1752 inputs_[0] = obj;
1753 inputs_[1] = key;
1754 inputs_[2] = val;
1755 }
1756
1757 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1758 "store-keyed-fast-element")
1759 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1760
1761 virtual void PrintDataTo(StringStream* stream);
1762
1763 LOperand* object() { return inputs_[0]; }
1764 LOperand* key() { return inputs_[1]; }
1765 LOperand* value() { return inputs_[2]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001766 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001767};
1768
1769
1770class LStoreKeyedFastDoubleElement: public LTemplateInstruction<0, 3, 0> {
1771 public:
1772 LStoreKeyedFastDoubleElement(LOperand* elements,
1773 LOperand* key,
1774 LOperand* val) {
1775 inputs_[0] = elements;
1776 inputs_[1] = key;
1777 inputs_[2] = val;
1778 }
1779
1780 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement,
1781 "store-keyed-fast-double-element")
1782 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastDoubleElement)
1783
1784 virtual void PrintDataTo(StringStream* stream);
1785
1786 LOperand* elements() { return inputs_[0]; }
1787 LOperand* key() { return inputs_[1]; }
1788 LOperand* value() { return inputs_[2]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001789 uint32_t additional_index() const { return hydrogen()->index_offset(); }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001790
1791 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001792};
1793
1794
1795class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1796 public:
1797 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) {
1798 inputs_[0] = obj;
1799 inputs_[1] = key;
1800 inputs_[2] = val;
1801 }
1802
1803 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1804 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1805
1806 virtual void PrintDataTo(StringStream* stream);
1807
1808 LOperand* object() { return inputs_[0]; }
1809 LOperand* key() { return inputs_[1]; }
1810 LOperand* value() { return inputs_[2]; }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001811 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001812};
1813
1814class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> {
1815 public:
1816 LStoreKeyedSpecializedArrayElement(LOperand* external_pointer,
1817 LOperand* key,
1818 LOperand* val) {
1819 inputs_[0] = external_pointer;
1820 inputs_[1] = key;
1821 inputs_[2] = val;
1822 }
1823
1824 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
1825 "store-keyed-specialized-array-element")
1826 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement)
1827
1828 LOperand* external_pointer() { return inputs_[0]; }
1829 LOperand* key() { return inputs_[1]; }
1830 LOperand* value() { return inputs_[2]; }
1831 ElementsKind elements_kind() const {
1832 return hydrogen()->elements_kind();
1833 }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001834 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001835};
1836
1837
1838class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1839 public:
1840 LTransitionElementsKind(LOperand* object,
1841 LOperand* new_map_temp,
1842 LOperand* temp_reg) {
1843 inputs_[0] = object;
1844 temps_[0] = new_map_temp;
1845 temps_[1] = temp_reg;
1846 }
1847
1848 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1849 "transition-elements-kind")
1850 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1851
1852 virtual void PrintDataTo(StringStream* stream);
1853
1854 LOperand* object() { return inputs_[0]; }
1855 LOperand* new_map_reg() { return temps_[0]; }
1856 LOperand* temp_reg() { return temps_[1]; }
1857 Handle<Map> original_map() { return hydrogen()->original_map(); }
1858 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
1859};
1860
1861
1862class LStringAdd: public LTemplateInstruction<1, 2, 0> {
1863 public:
1864 LStringAdd(LOperand* left, LOperand* right) {
1865 inputs_[0] = left;
1866 inputs_[1] = right;
1867 }
1868
1869 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1870 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
1871
1872 LOperand* left() { return inputs_[0]; }
1873 LOperand* right() { return inputs_[1]; }
1874};
1875
1876
1877
1878class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
1879 public:
1880 LStringCharCodeAt(LOperand* string, LOperand* index) {
1881 inputs_[0] = string;
1882 inputs_[1] = index;
1883 }
1884
1885 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1886 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
1887
1888 LOperand* string() { return inputs_[0]; }
1889 LOperand* index() { return inputs_[1]; }
1890};
1891
1892
1893class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
1894 public:
1895 explicit LStringCharFromCode(LOperand* char_code) {
1896 inputs_[0] = char_code;
1897 }
1898
1899 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
1900 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
1901
1902 LOperand* char_code() { return inputs_[0]; }
1903};
1904
1905
1906class LStringLength: public LTemplateInstruction<1, 1, 0> {
1907 public:
1908 explicit LStringLength(LOperand* string) {
1909 inputs_[0] = string;
1910 }
1911
1912 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1913 DECLARE_HYDROGEN_ACCESSOR(StringLength)
1914
1915 LOperand* string() { return inputs_[0]; }
1916};
1917
1918
1919class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
1920 public:
1921 explicit LCheckFunction(LOperand* value) {
1922 inputs_[0] = value;
1923 }
1924
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00001925 LOperand* value() { return InputAt(0); }
1926
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001927 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1928 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1929};
1930
1931
1932class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
1933 public:
1934 explicit LCheckInstanceType(LOperand* value) {
1935 inputs_[0] = value;
1936 }
1937
1938 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1939 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
1940};
1941
1942
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001943class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001944 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001945 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001946 inputs_[0] = value;
1947 }
1948
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001949 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
1950 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001951};
1952
1953
1954class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
1955 public:
1956 LCheckPrototypeMaps(LOperand* temp1, LOperand* temp2) {
1957 temps_[0] = temp1;
1958 temps_[1] = temp2;
1959 }
1960
1961 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1962 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1963
1964 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1965 Handle<JSObject> holder() const { return hydrogen()->holder(); }
1966};
1967
1968
1969class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
1970 public:
1971 explicit LCheckSmi(LOperand* value) {
1972 inputs_[0] = value;
1973 }
1974
1975 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
1976};
1977
1978
1979class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
1980 public:
1981 explicit LCheckNonSmi(LOperand* value) {
1982 inputs_[0] = value;
1983 }
1984
1985 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
1986};
1987
1988
1989class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
1990 public:
1991 LClampDToUint8(LOperand* value, LOperand* temp) {
1992 inputs_[0] = value;
1993 temps_[0] = temp;
1994 }
1995
1996 LOperand* unclamped() { return inputs_[0]; }
1997
1998 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
1999};
2000
2001
2002class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
2003 public:
2004 explicit LClampIToUint8(LOperand* value) {
2005 inputs_[0] = value;
2006 }
2007
2008 LOperand* unclamped() { return inputs_[0]; }
2009
2010 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
2011};
2012
2013
2014class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
2015 public:
2016 LClampTToUint8(LOperand* value, LOperand* temp) {
2017 inputs_[0] = value;
2018 temps_[0] = temp;
2019 }
2020
2021 LOperand* unclamped() { return inputs_[0]; }
2022
2023 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
2024};
2025
2026
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002027class LAllocateObject: public LTemplateInstruction<1, 0, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00002028 public:
fschneider@chromium.org35814e52012-03-01 15:43:35 +00002029 LAllocateObject(LOperand* temp1, LOperand* temp2) {
2030 temps_[0] = temp1;
2031 temps_[1] = temp2;
2032 }
2033
ulan@chromium.org967e2702012-02-28 09:49:15 +00002034 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
2035 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
2036};
2037
2038
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002039class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
2040 public:
2041 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
2042 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
2043};
2044
2045
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002046class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
2047 public:
2048 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
2049 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
2050};
2051
2052
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002053class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002054 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002055 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2056 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002057};
2058
2059
2060class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2061 public:
2062 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2063 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2064};
2065
2066
2067class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2068 public:
2069 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2070 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2071
2072 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2073};
2074
2075
2076class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2077 public:
2078 explicit LToFastProperties(LOperand* value) {
2079 inputs_[0] = value;
2080 }
2081
2082 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2083 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2084};
2085
2086
2087class LTypeof: public LTemplateInstruction<1, 1, 0> {
2088 public:
2089 explicit LTypeof(LOperand* value) {
2090 inputs_[0] = value;
2091 }
2092
2093 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2094};
2095
2096
2097class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2098 public:
2099 explicit LTypeofIsAndBranch(LOperand* value) {
2100 inputs_[0] = value;
2101 }
2102
2103 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2104 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2105
2106 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2107
2108 virtual void PrintDataTo(StringStream* stream);
2109};
2110
2111
2112class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2113 public:
2114 explicit LIsConstructCallAndBranch(LOperand* temp) {
2115 temps_[0] = temp;
2116 }
2117
2118 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2119 "is-construct-call-and-branch")
2120};
2121
2122
2123class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2124 public:
2125 LDeleteProperty(LOperand* obj, LOperand* key) {
2126 inputs_[0] = obj;
2127 inputs_[1] = key;
2128 }
2129
2130 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
2131
2132 LOperand* object() { return inputs_[0]; }
2133 LOperand* key() { return inputs_[1]; }
2134};
2135
2136
2137class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2138 public:
2139 LOsrEntry();
2140
2141 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2142
2143 LOperand** SpilledRegisterArray() { return register_spills_; }
2144 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2145
2146 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2147 void MarkSpilledDoubleRegister(int allocation_index,
2148 LOperand* spill_operand);
2149
2150 private:
2151 // Arrays of spill slot operands for registers with an assigned spill
2152 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2153 // NULL if the register has no assigned spill slot. Indexed by allocation
2154 // index.
2155 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2156 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2157};
2158
2159
2160class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2161 public:
2162 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2163 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2164
2165 Label* done_label() { return &done_label_; }
2166
2167 private:
2168 Label done_label_;
2169};
2170
2171
2172class LIn: public LTemplateInstruction<1, 2, 0> {
2173 public:
2174 LIn(LOperand* key, LOperand* object) {
2175 inputs_[0] = key;
2176 inputs_[1] = object;
2177 }
2178
2179 LOperand* key() { return inputs_[0]; }
2180 LOperand* object() { return inputs_[1]; }
2181
2182 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2183};
2184
2185
ulan@chromium.org812308e2012-02-29 15:58:45 +00002186class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2187 public:
2188 explicit LForInPrepareMap(LOperand* object) {
2189 inputs_[0] = object;
2190 }
2191
2192 LOperand* object() { return inputs_[0]; }
2193
2194 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2195};
2196
2197
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002198class LForInCacheArray: public LTemplateInstruction<1, 1, 1> {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002199 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002200 explicit LForInCacheArray(LOperand* map, LOperand* scratch) {
ulan@chromium.org812308e2012-02-29 15:58:45 +00002201 inputs_[0] = map;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002202 temps_[0] = scratch;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002203 }
2204
2205 LOperand* map() { return inputs_[0]; }
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002206 LOperand* scratch() { return temps_[0]; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002207
2208 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2209
2210 int idx() {
2211 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2212 }
2213};
2214
2215
2216class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2217 public:
2218 LCheckMapValue(LOperand* value, LOperand* map) {
2219 inputs_[0] = value;
2220 inputs_[1] = map;
2221 }
2222
2223 LOperand* value() { return inputs_[0]; }
2224 LOperand* map() { return inputs_[1]; }
2225
2226 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2227};
2228
2229
2230class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2231 public:
2232 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2233 inputs_[0] = object;
2234 inputs_[1] = index;
2235 }
2236
2237 LOperand* object() { return inputs_[0]; }
2238 LOperand* index() { return inputs_[1]; }
2239
2240 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2241};
2242
2243
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002244class LChunkBuilder;
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002245class LPlatformChunk: public LChunk {
lrn@chromium.org7516f052011-03-30 08:52:27 +00002246 public:
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002247 LPlatformChunk(CompilationInfo* info, HGraph* graph)
2248 : LChunk(info, graph) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002249
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002250 int GetNextSpillIndex(bool is_double);
2251 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002252};
2253
2254
2255class LChunkBuilder BASE_EMBEDDED {
2256 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002257 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2258 : chunk_(NULL),
2259 info_(info),
2260 graph_(graph),
mmassi@chromium.org7028c052012-06-13 11:51:58 +00002261 zone_(graph->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002262 status_(UNUSED),
2263 current_instruction_(NULL),
2264 current_block_(NULL),
2265 next_block_(NULL),
2266 argument_count_(0),
2267 allocator_(allocator),
2268 position_(RelocInfo::kNoPosition),
2269 instruction_pending_deoptimization_environment_(NULL),
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002270 pending_deoptimization_ast_id_(BailoutId::None()) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002271
2272 // Build the sequence for the graph.
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002273 LPlatformChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002274
2275 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002276#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002277 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2278#undef DECLARE_DO
2279
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002280 private:
2281 enum Status {
2282 UNUSED,
2283 BUILDING,
2284 DONE,
2285 ABORTED
2286 };
2287
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002288 LPlatformChunk* chunk() const { return chunk_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002289 CompilationInfo* info() const { return info_; }
2290 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002291 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002292
2293 bool is_unused() const { return status_ == UNUSED; }
2294 bool is_building() const { return status_ == BUILDING; }
2295 bool is_done() const { return status_ == DONE; }
2296 bool is_aborted() const { return status_ == ABORTED; }
2297
yangguo@chromium.org46839fb2012-08-28 09:06:19 +00002298 void Abort(const char* reason);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002299
2300 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002301 LUnallocated* ToUnallocated(Register reg);
2302 LUnallocated* ToUnallocated(DoubleRegister reg);
2303
2304 // Methods for setting up define-use relationships.
2305 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2306 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2307 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2308 DoubleRegister fixed_register);
2309
2310 // A value that is guaranteed to be allocated to a register.
2311 // Operand created by UseRegister is guaranteed to be live until the end of
2312 // instruction. This means that register allocator will not reuse it's
2313 // register for any other operand inside instruction.
2314 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2315 // instruction start. Register allocator is free to assign the same register
2316 // to some other operand used inside instruction (i.e. temporary or
2317 // output).
2318 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2319 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2320
2321 // An input operand in a register that may be trashed.
2322 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2323
2324 // An input operand in a register or stack slot.
2325 MUST_USE_RESULT LOperand* Use(HValue* value);
2326 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2327
2328 // An input operand in a register, stack slot or a constant operand.
2329 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2330 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2331
2332 // An input operand in a register or a constant operand.
2333 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2334 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2335
2336 // An input operand in register, stack slot or a constant operand.
2337 // Will not be moved to a register even if one is freely available.
2338 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2339
2340 // Temporary operand that must be in a register.
2341 MUST_USE_RESULT LUnallocated* TempRegister();
2342 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2343 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2344
2345 // Methods for setting up define-use relationships.
2346 // Return the same instruction that they are passed.
2347 template<int I, int T>
2348 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2349 LUnallocated* result);
2350 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002351 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2352 template<int I, int T>
2353 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2354 int index);
2355 template<int I, int T>
2356 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2357 template<int I, int T>
2358 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2359 Register reg);
2360 template<int I, int T>
2361 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2362 DoubleRegister reg);
2363 LInstruction* AssignEnvironment(LInstruction* instr);
2364 LInstruction* AssignPointerMap(LInstruction* instr);
2365
2366 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2367
2368 // By default we assume that instruction sequences generated for calls
2369 // cannot deoptimize eagerly and we do not attach environment to this
2370 // instruction.
2371 LInstruction* MarkAsCall(
2372 LInstruction* instr,
2373 HInstruction* hinstr,
2374 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002375
2376 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2377 int* argument_index_accumulator);
2378
2379 void VisitInstruction(HInstruction* current);
2380
2381 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2382 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2383 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2384 LInstruction* DoArithmeticD(Token::Value op,
2385 HArithmeticBinaryOperation* instr);
2386 LInstruction* DoArithmeticT(Token::Value op,
2387 HArithmeticBinaryOperation* instr);
2388
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00002389 LPlatformChunk* chunk_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002390 CompilationInfo* info_;
2391 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002392 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002393 Status status_;
2394 HInstruction* current_instruction_;
2395 HBasicBlock* current_block_;
2396 HBasicBlock* next_block_;
2397 int argument_count_;
2398 LAllocator* allocator_;
2399 int position_;
2400 LInstruction* instruction_pending_deoptimization_environment_;
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +00002401 BailoutId pending_deoptimization_ast_id_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002402
lrn@chromium.org7516f052011-03-30 08:52:27 +00002403 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2404};
2405
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002406#undef DECLARE_HYDROGEN_ACCESSOR
2407#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002408
2409} } // namespace v8::internal
2410
2411#endif // V8_MIPS_LITHIUM_MIPS_H_