blob: c3065e329e257bcdf6ee8fdb152f33e318ba1702 [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) \
111 V(InvokeFunction) \
112 V(IsConstructCallAndBranch) \
113 V(IsNilAndBranch) \
114 V(IsObjectAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000115 V(IsStringAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000116 V(IsSmiAndBranch) \
117 V(IsUndetectableAndBranch) \
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000118 V(StringCompareAndBranch) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000119 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) \
135 V(ModI) \
136 V(MulI) \
137 V(NumberTagD) \
138 V(NumberTagI) \
139 V(NumberUntagD) \
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +0000140 V(ObjectLiteral) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000141 V(OsrEntry) \
142 V(OuterContext) \
143 V(Parameter) \
144 V(Power) \
145 V(PushArgument) \
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +0000146 V(Random) \
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000147 V(RegExpLiteral) \
148 V(Return) \
149 V(ShiftI) \
150 V(SmiTag) \
151 V(SmiUntag) \
152 V(StackCheck) \
153 V(StoreContextSlot) \
154 V(StoreGlobalCell) \
155 V(StoreGlobalGeneric) \
156 V(StoreKeyedFastDoubleElement) \
157 V(StoreKeyedFastElement) \
158 V(StoreKeyedGeneric) \
159 V(StoreKeyedSpecializedArrayElement) \
160 V(StoreNamedField) \
161 V(StoreNamedGeneric) \
162 V(StringAdd) \
163 V(StringCharCodeAt) \
164 V(StringCharFromCode) \
165 V(StringLength) \
166 V(SubI) \
167 V(TaggedToI) \
168 V(ThisFunction) \
169 V(Throw) \
170 V(ToFastProperties) \
171 V(TransitionElementsKind) \
172 V(Typeof) \
173 V(TypeofIsAndBranch) \
174 V(UnaryMathOperation) \
175 V(UnknownOSRValue) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000176 V(ValueOf) \
177 V(ForInPrepareMap) \
178 V(ForInCacheArray) \
179 V(CheckMapValue) \
yangguo@chromium.org154ff992012-03-13 08:09:54 +0000180 V(LoadFieldByIndex) \
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000181 V(DateField) \
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000182 V(WrapReceiver) \
183 V(Drop)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000184
185#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
186 virtual Opcode opcode() const { return LInstruction::k##type; } \
187 virtual void CompileToNative(LCodeGen* generator); \
188 virtual const char* Mnemonic() const { return mnemonic; } \
189 static L##type* cast(LInstruction* instr) { \
190 ASSERT(instr->Is##type()); \
191 return reinterpret_cast<L##type*>(instr); \
192 }
193
194
195#define DECLARE_HYDROGEN_ACCESSOR(type) \
196 H##type* hydrogen() const { \
197 return H##type::cast(hydrogen_value()); \
198 }
199
lrn@chromium.org7516f052011-03-30 08:52:27 +0000200
201class LInstruction: public ZoneObject {
202 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000203 LInstruction()
204 : environment_(NULL),
205 hydrogen_value_(NULL),
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000206 is_call_(false) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000207 virtual ~LInstruction() { }
208
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000209 virtual void CompileToNative(LCodeGen* generator) = 0;
210 virtual const char* Mnemonic() const = 0;
211 virtual void PrintTo(StringStream* stream);
mstarzinger@chromium.org88d326b2012-04-23 12:57:22 +0000212 virtual void PrintDataTo(StringStream* stream);
213 virtual void PrintOutputOperandTo(StringStream* stream);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000214
215 enum Opcode {
216 // Declare a unique enum value for each instruction.
217#define DECLARE_OPCODE(type) k##type,
218 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
219 kNumberOfInstructions
220#undef DECLARE_OPCODE
221 };
222
223 virtual Opcode opcode() const = 0;
224
225 // Declare non-virtual type testers for all leaf IR classes.
226#define DECLARE_PREDICATE(type) \
227 bool Is##type() const { return opcode() == k##type; }
228 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
229#undef DECLARE_PREDICATE
230
231 // Declare virtual predicates for instructions that don't have
232 // an opcode.
233 virtual bool IsGap() const { return false; }
234
235 virtual bool IsControl() const { return false; }
236
237 void set_environment(LEnvironment* env) { environment_ = env; }
238 LEnvironment* environment() const { return environment_; }
239 bool HasEnvironment() const { return environment_ != NULL; }
240
241 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
242 LPointerMap* pointer_map() const { return pointer_map_.get(); }
243 bool HasPointerMap() const { return pointer_map_.is_set(); }
244
245 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
246 HValue* hydrogen_value() const { return hydrogen_value_; }
247
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000248 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000249
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000250 void MarkAsCall() { is_call_ = true; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000251
252 // Interface to the register allocator and iterators.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000253 bool IsMarkedAsCall() const { return is_call_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000254
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000255 virtual bool HasResult() const = 0;
256 virtual LOperand* result() = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000257
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000258 virtual int InputCount() = 0;
259 virtual LOperand* InputAt(int i) = 0;
260 virtual int TempCount() = 0;
261 virtual LOperand* TempAt(int i) = 0;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000262
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000263 LOperand* FirstInput() { return InputAt(0); }
264 LOperand* Output() { return HasResult() ? result() : NULL; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000265
266#ifdef DEBUG
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000267 void VerifyCall();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000268#endif
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000269
270 private:
271 LEnvironment* environment_;
272 SetOncePointer<LPointerMap> pointer_map_;
273 HValue* hydrogen_value_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000274 bool is_call_;
275 bool is_save_doubles_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000276};
277
278
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000279// R = number of result operands (0 or 1).
280// I = number of input operands.
281// T = number of temporary operands.
282template<int R, int I, int T>
283class LTemplateInstruction: public LInstruction {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000284 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000285 // Allow 0 or 1 output operands.
286 STATIC_ASSERT(R == 0 || R == 1);
287 virtual bool HasResult() const { return R != 0; }
288 void set_result(LOperand* operand) { results_[0] = operand; }
289 LOperand* result() { return results_[0]; }
lrn@chromium.org7516f052011-03-30 08:52:27 +0000290
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000291 int InputCount() { return I; }
292 LOperand* InputAt(int i) { return inputs_[i]; }
293
294 int TempCount() { return T; }
295 LOperand* TempAt(int i) { return temps_[i]; }
296
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000297 protected:
298 EmbeddedContainer<LOperand*, R> results_;
299 EmbeddedContainer<LOperand*, I> inputs_;
300 EmbeddedContainer<LOperand*, T> temps_;
301};
302
303
304class LGap: public LTemplateInstruction<0, 0, 0> {
305 public:
306 explicit LGap(HBasicBlock* block)
307 : block_(block) {
308 parallel_moves_[BEFORE] = NULL;
309 parallel_moves_[START] = NULL;
310 parallel_moves_[END] = NULL;
311 parallel_moves_[AFTER] = NULL;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000312 }
313
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000314 // Can't use the DECLARE-macro here because of sub-classes.
315 virtual bool IsGap() const { return true; }
316 virtual void PrintDataTo(StringStream* stream);
317 static LGap* cast(LInstruction* instr) {
318 ASSERT(instr->IsGap());
319 return reinterpret_cast<LGap*>(instr);
320 }
321
322 bool IsRedundant() const;
323
324 HBasicBlock* block() const { return block_; }
325
lrn@chromium.org7516f052011-03-30 08:52:27 +0000326 enum InnerPosition {
327 BEFORE,
328 START,
329 END,
330 AFTER,
331 FIRST_INNER_POSITION = BEFORE,
332 LAST_INNER_POSITION = AFTER
333 };
334
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000335 LParallelMove* GetOrCreateParallelMove(InnerPosition pos) {
336 if (parallel_moves_[pos] == NULL) parallel_moves_[pos] = new LParallelMove;
337 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000338 }
339
340 LParallelMove* GetParallelMove(InnerPosition pos) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000341 return parallel_moves_[pos];
lrn@chromium.org7516f052011-03-30 08:52:27 +0000342 }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000343
344 private:
345 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
346 HBasicBlock* block_;
347};
348
349
350class LInstructionGap: public LGap {
351 public:
352 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
353
354 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
355};
356
357
358class LGoto: public LTemplateInstruction<0, 0, 0> {
359 public:
360 explicit LGoto(int block_id) : block_id_(block_id) { }
361
362 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
363 virtual void PrintDataTo(StringStream* stream);
364 virtual bool IsControl() const { return true; }
365
366 int block_id() const { return block_id_; }
367
368 private:
369 int block_id_;
370};
371
372
373class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
374 public:
375 LLazyBailout() : gap_instructions_size_(0) { }
376
377 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
378
379 void set_gap_instructions_size(int gap_instructions_size) {
380 gap_instructions_size_ = gap_instructions_size;
381 }
382 int gap_instructions_size() { return gap_instructions_size_; }
383
384 private:
385 int gap_instructions_size_;
386};
387
388
389class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
390 public:
391 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
lrn@chromium.org7516f052011-03-30 08:52:27 +0000392};
393
394
395class LLabel: public LGap {
396 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000397 explicit LLabel(HBasicBlock* block)
398 : LGap(block), replacement_(NULL) { }
399
400 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
401
402 virtual void PrintDataTo(StringStream* stream);
403
404 int block_id() const { return block()->block_id(); }
405 bool is_loop_header() const { return block()->IsLoopHeader(); }
406 Label* label() { return &label_; }
407 LLabel* replacement() const { return replacement_; }
408 void set_replacement(LLabel* label) { replacement_ = label; }
409 bool HasReplacement() const { return replacement_ != NULL; }
410
411 private:
412 Label label_;
413 LLabel* replacement_;
lrn@chromium.org7516f052011-03-30 08:52:27 +0000414};
415
416
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000417class LParameter: public LTemplateInstruction<1, 0, 0> {
lrn@chromium.org7516f052011-03-30 08:52:27 +0000418 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000419 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
420};
lrn@chromium.org7516f052011-03-30 08:52:27 +0000421
lrn@chromium.org7516f052011-03-30 08:52:27 +0000422
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000423class LCallStub: public LTemplateInstruction<1, 0, 0> {
424 public:
425 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
426 DECLARE_HYDROGEN_ACCESSOR(CallStub)
427
428 TranscendentalCache::Type transcendental_type() {
429 return hydrogen()->transcendental_type();
lrn@chromium.org7516f052011-03-30 08:52:27 +0000430 }
431};
432
433
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000434class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
435 public:
436 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
437};
438
439
440template<int I, int T>
441class LControlInstruction: public LTemplateInstruction<0, I, T> {
442 public:
443 virtual bool IsControl() const { return true; }
444
445 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
446 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
447 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
448 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
449
450 private:
451 HControlInstruction* hydrogen() {
452 return HControlInstruction::cast(this->hydrogen_value());
453 }
454};
455
456
rossberg@chromium.org2c067b12012-03-19 11:01:52 +0000457class LWrapReceiver: public LTemplateInstruction<1, 2, 0> {
458 public:
459 LWrapReceiver(LOperand* receiver, LOperand* function) {
460 inputs_[0] = receiver;
461 inputs_[1] = function;
462 }
463
464 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver, "wrap-receiver")
465
466 LOperand* receiver() { return inputs_[0]; }
467 LOperand* function() { return inputs_[1]; }
468};
469
470
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000471class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
472 public:
473 LApplyArguments(LOperand* function,
474 LOperand* receiver,
475 LOperand* length,
476 LOperand* elements) {
477 inputs_[0] = function;
478 inputs_[1] = receiver;
479 inputs_[2] = length;
480 inputs_[3] = elements;
481 }
482
483 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
484
485 LOperand* function() { return inputs_[0]; }
486 LOperand* receiver() { return inputs_[1]; }
487 LOperand* length() { return inputs_[2]; }
488 LOperand* elements() { return inputs_[3]; }
489};
490
491
492class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
493 public:
494 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
495 inputs_[0] = arguments;
496 inputs_[1] = length;
497 inputs_[2] = index;
498 }
499
500 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
501
502 LOperand* arguments() { return inputs_[0]; }
503 LOperand* length() { return inputs_[1]; }
504 LOperand* index() { return inputs_[2]; }
505
506 virtual void PrintDataTo(StringStream* stream);
507};
508
509
510class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
511 public:
512 explicit LArgumentsLength(LOperand* elements) {
513 inputs_[0] = elements;
514 }
515
516 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
517};
518
519
520class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
521 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000522 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
jkummerow@chromium.org28faa982012-04-13 09:58:30 +0000523 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000524};
525
526
527class LModI: public LTemplateInstruction<1, 2, 3> {
528 public:
529 // Used when the right hand is a constant power of 2.
530 LModI(LOperand* left,
531 LOperand* right) {
532 inputs_[0] = left;
533 inputs_[1] = right;
534 temps_[0] = NULL;
535 temps_[1] = NULL;
536 temps_[2] = NULL;
537 }
538
539 // Used for the standard case.
540 LModI(LOperand* left,
541 LOperand* right,
542 LOperand* temp1,
543 LOperand* temp2,
544 LOperand* temp3) {
545 inputs_[0] = left;
546 inputs_[1] = right;
547 temps_[0] = temp1;
548 temps_[1] = temp2;
549 temps_[2] = temp3;
550 }
551
552 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
553 DECLARE_HYDROGEN_ACCESSOR(Mod)
554};
555
556
557class LDivI: public LTemplateInstruction<1, 2, 0> {
558 public:
559 LDivI(LOperand* left, LOperand* right) {
560 inputs_[0] = left;
561 inputs_[1] = right;
562 }
563
564 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
565 DECLARE_HYDROGEN_ACCESSOR(Div)
566};
567
568
569class LMulI: public LTemplateInstruction<1, 2, 1> {
570 public:
571 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
572 inputs_[0] = left;
573 inputs_[1] = right;
574 temps_[0] = temp;
575 }
576
577 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
578 DECLARE_HYDROGEN_ACCESSOR(Mul)
579};
580
581
582class LCmpIDAndBranch: public LControlInstruction<2, 0> {
583 public:
584 LCmpIDAndBranch(LOperand* left, LOperand* right) {
585 inputs_[0] = left;
586 inputs_[1] = right;
587 }
588
589 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
590 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
591
592 Token::Value op() const { return hydrogen()->token(); }
593 bool is_double() const {
594 return hydrogen()->GetInputRepresentation().IsDouble();
595 }
596
597 virtual void PrintDataTo(StringStream* stream);
598};
599
600
601class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
602 public:
603 LUnaryMathOperation(LOperand* value, LOperand* temp) {
604 inputs_[0] = value;
605 temps_[0] = temp;
606 }
607
608 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
609 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
610
611 virtual void PrintDataTo(StringStream* stream);
612 BuiltinFunctionId op() const { return hydrogen()->op(); }
613};
614
615
616class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
617 public:
618 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
619 inputs_[0] = left;
620 inputs_[1] = right;
621 }
622
623 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
624 "cmp-object-eq-and-branch")
625 DECLARE_HYDROGEN_ACCESSOR(CompareObjectEqAndBranch)
626};
627
628
629class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
630 public:
631 explicit LCmpConstantEqAndBranch(LOperand* left) {
632 inputs_[0] = left;
633 }
634
635 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
636 "cmp-constant-eq-and-branch")
637 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
638};
639
640
641class LIsNilAndBranch: public LControlInstruction<1, 0> {
642 public:
643 explicit LIsNilAndBranch(LOperand* value) {
644 inputs_[0] = value;
645 }
646
647 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
648 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
649
650 EqualityKind kind() const { return hydrogen()->kind(); }
651 NilValue nil() const { return hydrogen()->nil(); }
652
653 virtual void PrintDataTo(StringStream* stream);
654};
655
656
657class LIsObjectAndBranch: public LControlInstruction<1, 1> {
658 public:
659 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
660 inputs_[0] = value;
661 temps_[0] = temp;
662 }
663
664 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
665 DECLARE_HYDROGEN_ACCESSOR(IsObjectAndBranch)
666
667 virtual void PrintDataTo(StringStream* stream);
668};
669
670
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000671class LIsStringAndBranch: public LControlInstruction<1, 1> {
672 public:
673 LIsStringAndBranch(LOperand* value, LOperand* temp) {
674 inputs_[0] = value;
675 temps_[0] = temp;
676 }
677
678 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
679 DECLARE_HYDROGEN_ACCESSOR(IsStringAndBranch)
680
681 virtual void PrintDataTo(StringStream* stream);
682};
683
684
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000685class LIsSmiAndBranch: public LControlInstruction<1, 0> {
686 public:
687 explicit LIsSmiAndBranch(LOperand* value) {
688 inputs_[0] = value;
689 }
690
691 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
692 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
693
694 virtual void PrintDataTo(StringStream* stream);
695};
696
697
698class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
699 public:
700 explicit LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
701 inputs_[0] = value;
702 temps_[0] = temp;
703 }
704
705 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
706 "is-undetectable-and-branch")
707 DECLARE_HYDROGEN_ACCESSOR(IsUndetectableAndBranch)
708
709 virtual void PrintDataTo(StringStream* stream);
710};
711
712
mstarzinger@chromium.orgf8c6bd52011-11-23 12:13:52 +0000713class LStringCompareAndBranch: public LControlInstruction<2, 0> {
714 public:
715 LStringCompareAndBranch(LOperand* left, LOperand* right) {
716 inputs_[0] = left;
717 inputs_[1] = right;
718 }
719
720 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
721 "string-compare-and-branch")
722 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
723
724 Token::Value op() const { return hydrogen()->token(); }
725
726 virtual void PrintDataTo(StringStream* stream);
727};
728
729
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000730class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
731 public:
732 explicit LHasInstanceTypeAndBranch(LOperand* value) {
733 inputs_[0] = value;
734 }
735
736 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
737 "has-instance-type-and-branch")
738 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
739
740 virtual void PrintDataTo(StringStream* stream);
741};
742
743
744class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
745 public:
746 explicit LGetCachedArrayIndex(LOperand* value) {
747 inputs_[0] = value;
748 }
749
750 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
751 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
752};
753
754
755class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
756 public:
757 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
758 inputs_[0] = value;
759 }
760
761 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
762 "has-cached-array-index-and-branch")
763 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndexAndBranch)
764
765 virtual void PrintDataTo(StringStream* stream);
766};
767
768
769class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
770 public:
771 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
772 inputs_[0] = value;
773 temps_[0] = temp;
774 }
775
776 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
777 "class-of-test-and-branch")
778 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
779
780 virtual void PrintDataTo(StringStream* stream);
781};
782
783
784class LCmpT: public LTemplateInstruction<1, 2, 0> {
785 public:
786 LCmpT(LOperand* left, LOperand* right) {
787 inputs_[0] = left;
788 inputs_[1] = right;
789 }
790
791 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
792 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
793
794 Token::Value op() const { return hydrogen()->token(); }
795};
796
797
798class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
799 public:
800 LInstanceOf(LOperand* left, LOperand* right) {
801 inputs_[0] = left;
802 inputs_[1] = right;
803 }
804
805 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
806};
807
808
809class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
810 public:
811 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
812 inputs_[0] = value;
813 temps_[0] = temp;
814 }
815
816 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
817 "instance-of-known-global")
818 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
819
820 Handle<JSFunction> function() const { return hydrogen()->function(); }
danno@chromium.org1044a4d2012-04-30 12:34:39 +0000821 LEnvironment* GetDeferredLazyDeoptimizationEnvironment() {
822 return lazy_deopt_env_;
823 }
824 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) {
825 lazy_deopt_env_ = env;
826 }
827
828 private:
829 LEnvironment* lazy_deopt_env_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +0000830};
831
832
833class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
834 public:
835 LBoundsCheck(LOperand* index, LOperand* length) {
836 inputs_[0] = index;
837 inputs_[1] = length;
838 }
839
840 LOperand* index() { return inputs_[0]; }
841 LOperand* length() { return inputs_[1]; }
842
843 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
844};
845
846
847class LBitI: public LTemplateInstruction<1, 2, 0> {
848 public:
849 LBitI(LOperand* left, LOperand* right) {
850 inputs_[0] = left;
851 inputs_[1] = right;
852 }
853
854 Token::Value op() const { return hydrogen()->op(); }
855
856 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
857 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
858};
859
860
861class LShiftI: public LTemplateInstruction<1, 2, 0> {
862 public:
863 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
864 : op_(op), can_deopt_(can_deopt) {
865 inputs_[0] = left;
866 inputs_[1] = right;
867 }
868
869 Token::Value op() const { return op_; }
870
871 bool can_deopt() const { return can_deopt_; }
872
873 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
874
875 private:
876 Token::Value op_;
877 bool can_deopt_;
878};
879
880
881class LSubI: public LTemplateInstruction<1, 2, 0> {
882 public:
883 LSubI(LOperand* left, LOperand* right) {
884 inputs_[0] = left;
885 inputs_[1] = right;
886 }
887
888 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
889 DECLARE_HYDROGEN_ACCESSOR(Sub)
890};
891
892
893class LConstantI: public LTemplateInstruction<1, 0, 0> {
894 public:
895 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
896 DECLARE_HYDROGEN_ACCESSOR(Constant)
897
898 int32_t value() const { return hydrogen()->Integer32Value(); }
899};
900
901
902class LConstantD: public LTemplateInstruction<1, 0, 0> {
903 public:
904 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
905 DECLARE_HYDROGEN_ACCESSOR(Constant)
906
907 double value() const { return hydrogen()->DoubleValue(); }
908};
909
910
911class LConstantT: public LTemplateInstruction<1, 0, 0> {
912 public:
913 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
914 DECLARE_HYDROGEN_ACCESSOR(Constant)
915
916 Handle<Object> value() const { return hydrogen()->handle(); }
917};
918
919
920class LBranch: public LControlInstruction<1, 0> {
921 public:
922 explicit LBranch(LOperand* value) {
923 inputs_[0] = value;
924 }
925
926 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
927 DECLARE_HYDROGEN_ACCESSOR(Branch)
928
929 virtual void PrintDataTo(StringStream* stream);
930};
931
932
933class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
934 public:
935 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
936 inputs_[0] = value;
937 temps_[0] = temp;
938 }
939
940 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
941 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
942
943 virtual bool IsControl() const { return true; }
944
945 Handle<Map> map() const { return hydrogen()->map(); }
946 int true_block_id() const {
947 return hydrogen()->FirstSuccessor()->block_id();
948 }
949 int false_block_id() const {
950 return hydrogen()->SecondSuccessor()->block_id();
951 }
952};
953
954
955class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
956 public:
957 explicit LJSArrayLength(LOperand* value) {
958 inputs_[0] = value;
959 }
960
961 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
962 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
963};
964
965
966class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
967 public:
968 explicit LFixedArrayBaseLength(LOperand* value) {
969 inputs_[0] = value;
970 }
971
972 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
973 "fixed-array-base-length")
974 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
975};
976
977
978class LElementsKind: public LTemplateInstruction<1, 1, 0> {
979 public:
980 explicit LElementsKind(LOperand* value) {
981 inputs_[0] = value;
982 }
983
984 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
985 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
986};
987
988
989class LValueOf: public LTemplateInstruction<1, 1, 1> {
990 public:
991 LValueOf(LOperand* value, LOperand* temp) {
992 inputs_[0] = value;
993 temps_[0] = temp;
994 }
995
996 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
997 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
998};
999
1000
yangguo@chromium.org154ff992012-03-13 08:09:54 +00001001class LDateField: public LTemplateInstruction<1, 1, 1> {
1002 public:
1003 LDateField(LOperand* date, LOperand* temp, Smi* index) : index_(index) {
1004 inputs_[0] = date;
1005 temps_[0] = temp;
1006 }
1007
1008 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "date-field")
1009 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1010 Smi* index() const { return index_; }
1011
1012 private:
1013 Smi* index_;
1014};
1015
1016
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001017class LThrow: public LTemplateInstruction<0, 1, 0> {
1018 public:
1019 explicit LThrow(LOperand* value) {
1020 inputs_[0] = value;
1021 }
1022
1023 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1024};
1025
1026
1027class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1028 public:
1029 explicit LBitNotI(LOperand* value) {
1030 inputs_[0] = value;
1031 }
1032
1033 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1034};
1035
1036
1037class LAddI: public LTemplateInstruction<1, 2, 0> {
1038 public:
1039 LAddI(LOperand* left, LOperand* right) {
1040 inputs_[0] = left;
1041 inputs_[1] = right;
1042 }
1043
1044 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1045 DECLARE_HYDROGEN_ACCESSOR(Add)
1046};
1047
1048
1049class LPower: public LTemplateInstruction<1, 2, 0> {
1050 public:
1051 LPower(LOperand* left, LOperand* right) {
1052 inputs_[0] = left;
1053 inputs_[1] = right;
1054 }
1055
1056 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1057 DECLARE_HYDROGEN_ACCESSOR(Power)
1058};
1059
1060
erik.corry@gmail.comf2038fb2012-01-16 11:42:08 +00001061class LRandom: public LTemplateInstruction<1, 1, 0> {
1062 public:
1063 explicit LRandom(LOperand* global_object) {
1064 inputs_[0] = global_object;
1065 }
1066
1067 DECLARE_CONCRETE_INSTRUCTION(Random, "random")
1068 DECLARE_HYDROGEN_ACCESSOR(Random)
1069};
1070
1071
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001072class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1073 public:
1074 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1075 : op_(op) {
1076 inputs_[0] = left;
1077 inputs_[1] = right;
1078 }
1079
1080 Token::Value op() const { return op_; }
1081
1082 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
1083 virtual void CompileToNative(LCodeGen* generator);
1084 virtual const char* Mnemonic() const;
1085
1086 private:
1087 Token::Value op_;
1088};
1089
1090
1091class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1092 public:
1093 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1094 : op_(op) {
1095 inputs_[0] = left;
1096 inputs_[1] = right;
1097 }
1098
1099 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
1100 virtual void CompileToNative(LCodeGen* generator);
1101 virtual const char* Mnemonic() const;
1102
1103 Token::Value op() const { return op_; }
1104
1105 private:
1106 Token::Value op_;
1107};
1108
1109
1110class LReturn: public LTemplateInstruction<0, 1, 0> {
1111 public:
1112 explicit LReturn(LOperand* value) {
1113 inputs_[0] = value;
1114 }
1115
1116 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1117};
1118
1119
1120class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1121 public:
1122 explicit LLoadNamedField(LOperand* object) {
1123 inputs_[0] = object;
1124 }
1125
1126 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1127 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1128};
1129
1130
1131class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 1, 0> {
1132 public:
1133 explicit LLoadNamedFieldPolymorphic(LOperand* object) {
1134 inputs_[0] = object;
1135 }
1136
1137 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1138 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
1139
1140 LOperand* object() { return inputs_[0]; }
1141};
1142
1143
1144class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1145 public:
1146 explicit LLoadNamedGeneric(LOperand* object) {
1147 inputs_[0] = object;
1148 }
1149
1150 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1151 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1152
1153 LOperand* object() { return inputs_[0]; }
1154 Handle<Object> name() const { return hydrogen()->name(); }
1155};
1156
1157
1158class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1159 public:
1160 explicit LLoadFunctionPrototype(LOperand* function) {
1161 inputs_[0] = function;
1162 }
1163
1164 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1165 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1166
1167 LOperand* function() { return inputs_[0]; }
1168};
1169
1170
1171class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1172 public:
1173 explicit LLoadElements(LOperand* object) {
1174 inputs_[0] = object;
1175 }
1176
1177 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1178};
1179
1180
1181class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
1182 public:
1183 explicit LLoadExternalArrayPointer(LOperand* object) {
1184 inputs_[0] = object;
1185 }
1186
1187 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1188 "load-external-array-pointer")
1189};
1190
1191
1192class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> {
1193 public:
1194 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1195 inputs_[0] = elements;
1196 inputs_[1] = key;
1197 }
1198
1199 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1200 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1201
1202 LOperand* elements() { return inputs_[0]; }
1203 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001204 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001205};
1206
1207
1208class LLoadKeyedFastDoubleElement: public LTemplateInstruction<1, 2, 0> {
1209 public:
1210 LLoadKeyedFastDoubleElement(LOperand* elements, LOperand* key) {
1211 inputs_[0] = elements;
1212 inputs_[1] = key;
1213 }
1214
1215 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement,
1216 "load-keyed-fast-double-element")
1217 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastDoubleElement)
1218
1219 LOperand* elements() { return inputs_[0]; }
1220 LOperand* key() { return inputs_[1]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001221 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001222};
1223
1224
1225class LLoadKeyedSpecializedArrayElement: public LTemplateInstruction<1, 2, 0> {
1226 public:
svenpanne@chromium.org830d30c2012-05-29 13:20:14 +00001227 LLoadKeyedSpecializedArrayElement(LOperand* external_pointer,
1228 LOperand* key) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001229 inputs_[0] = external_pointer;
1230 inputs_[1] = key;
1231 }
1232
1233 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement,
1234 "load-keyed-specialized-array-element")
1235 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedSpecializedArrayElement)
1236
1237 LOperand* external_pointer() { return inputs_[0]; }
1238 LOperand* key() { return inputs_[1]; }
1239 ElementsKind elements_kind() const {
1240 return hydrogen()->elements_kind();
1241 }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001242 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001243};
1244
1245
1246class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1247 public:
1248 LLoadKeyedGeneric(LOperand* obj, LOperand* key) {
1249 inputs_[0] = obj;
1250 inputs_[1] = key;
1251 }
1252
1253 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1254
1255 LOperand* object() { return inputs_[0]; }
1256 LOperand* key() { return inputs_[1]; }
1257};
1258
1259
1260class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
1261 public:
1262 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1263 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
1264};
1265
1266
1267class LLoadGlobalGeneric: public LTemplateInstruction<1, 1, 0> {
1268 public:
1269 explicit LLoadGlobalGeneric(LOperand* global_object) {
1270 inputs_[0] = global_object;
1271 }
1272
1273 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1274 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1275
1276 LOperand* global_object() { return inputs_[0]; }
1277 Handle<Object> name() const { return hydrogen()->name(); }
1278 bool for_typeof() const { return hydrogen()->for_typeof(); }
1279};
1280
1281
1282class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {
1283 public:
1284 LStoreGlobalCell(LOperand* value, LOperand* temp) {
1285 inputs_[0] = value;
1286 temps_[0] = temp;
1287 }
1288
1289 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1290 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
danno@chromium.orge78f9fc2011-12-21 08:29:34 +00001291
1292 LOperand* value() { return inputs_[0]; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001293};
1294
1295
1296class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
1297 public:
1298 explicit LStoreGlobalGeneric(LOperand* global_object,
1299 LOperand* value) {
1300 inputs_[0] = global_object;
1301 inputs_[1] = value;
1302 }
1303
1304 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1305 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1306
1307 LOperand* global_object() { return InputAt(0); }
1308 Handle<Object> name() const { return hydrogen()->name(); }
1309 LOperand* value() { return InputAt(1); }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001310 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001311};
1312
1313
1314class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1315 public:
1316 explicit LLoadContextSlot(LOperand* context) {
1317 inputs_[0] = context;
1318 }
1319
1320 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1321 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1322
1323 LOperand* context() { return InputAt(0); }
1324 int slot_index() { return hydrogen()->slot_index(); }
1325
1326 virtual void PrintDataTo(StringStream* stream);
1327};
1328
1329
1330class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> {
1331 public:
1332 LStoreContextSlot(LOperand* context, LOperand* value) {
1333 inputs_[0] = context;
1334 inputs_[1] = value;
1335 }
1336
1337 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1338 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1339
1340 LOperand* context() { return InputAt(0); }
1341 LOperand* value() { return InputAt(1); }
1342 int slot_index() { return hydrogen()->slot_index(); }
1343
1344 virtual void PrintDataTo(StringStream* stream);
1345};
1346
1347
1348class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1349 public:
1350 explicit LPushArgument(LOperand* value) {
1351 inputs_[0] = value;
1352 }
1353
1354 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1355};
1356
1357
jkummerow@chromium.org28faa982012-04-13 09:58:30 +00001358class LDrop: public LTemplateInstruction<0, 0, 0> {
1359 public:
1360 explicit LDrop(int count) : count_(count) { }
1361
1362 int count() const { return count_; }
1363
1364 DECLARE_CONCRETE_INSTRUCTION(Drop, "drop")
1365
1366 private:
1367 int count_;
1368};
1369
1370
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001371class LThisFunction: public LTemplateInstruction<1, 0, 0> {
1372 public:
1373 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
1374 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
1375};
1376
1377
1378class LContext: public LTemplateInstruction<1, 0, 0> {
1379 public:
1380 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1381};
1382
1383
1384class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1385 public:
1386 explicit LOuterContext(LOperand* context) {
1387 inputs_[0] = context;
1388 }
1389
1390 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
1391
1392 LOperand* context() { return InputAt(0); }
1393};
1394
1395
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001396class LDeclareGlobals: public LTemplateInstruction<0, 0, 0> {
1397 public:
1398 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals, "declare-globals")
1399 DECLARE_HYDROGEN_ACCESSOR(DeclareGlobals)
1400};
1401
1402
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001403class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1404 public:
1405 explicit LGlobalObject(LOperand* context) {
1406 inputs_[0] = context;
1407 }
1408
1409 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1410
1411 LOperand* context() { return InputAt(0); }
1412};
1413
1414
1415class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1416 public:
1417 explicit LGlobalReceiver(LOperand* global_object) {
1418 inputs_[0] = global_object;
1419 }
1420
1421 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1422
1423 LOperand* global() { return InputAt(0); }
1424};
1425
1426
1427class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1428 public:
1429 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1430 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1431
1432 virtual void PrintDataTo(StringStream* stream);
1433
1434 Handle<JSFunction> function() { return hydrogen()->function(); }
1435 int arity() const { return hydrogen()->argument_count() - 1; }
1436};
1437
1438
1439class LInvokeFunction: public LTemplateInstruction<1, 1, 0> {
1440 public:
1441 explicit LInvokeFunction(LOperand* function) {
1442 inputs_[0] = function;
1443 }
1444
1445 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1446 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1447
1448 LOperand* function() { return inputs_[0]; }
1449
1450 virtual void PrintDataTo(StringStream* stream);
1451
1452 int arity() const { return hydrogen()->argument_count() - 1; }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001453 Handle<JSFunction> known_function() { return hydrogen()->known_function(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001454};
1455
1456
1457class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1458 public:
1459 explicit LCallKeyed(LOperand* key) {
1460 inputs_[0] = key;
1461 }
1462
1463 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1464 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1465
1466 virtual void PrintDataTo(StringStream* stream);
1467
1468 int arity() const { return hydrogen()->argument_count() - 1; }
1469};
1470
1471
1472
1473class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1474 public:
1475 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1476 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1477
1478 virtual void PrintDataTo(StringStream* stream);
1479
1480 Handle<String> name() const { return hydrogen()->name(); }
1481 int arity() const { return hydrogen()->argument_count() - 1; }
1482};
1483
1484
danno@chromium.orgc612e022011-11-10 11:38:15 +00001485class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001486 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001487 explicit LCallFunction(LOperand* function) {
1488 inputs_[0] = function;
1489 }
1490
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001491 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1492 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1493
danno@chromium.orgc612e022011-11-10 11:38:15 +00001494 LOperand* function() { return inputs_[0]; }
1495 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001496};
1497
1498
1499class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1500 public:
1501 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1502 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1503
1504 virtual void PrintDataTo(StringStream* stream);
1505
1506 Handle<String> name() const {return hydrogen()->name(); }
1507 int arity() const { return hydrogen()->argument_count() - 1; }
1508};
1509
1510
1511class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1512 public:
1513 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1514 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1515
1516 virtual void PrintDataTo(StringStream* stream);
1517
1518 Handle<JSFunction> target() const { return hydrogen()->target(); }
1519 int arity() const { return hydrogen()->argument_count() - 1; }
1520};
1521
1522
1523class LCallNew: public LTemplateInstruction<1, 1, 0> {
1524 public:
1525 explicit LCallNew(LOperand* constructor) {
1526 inputs_[0] = constructor;
1527 }
1528
1529 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1530 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1531
1532 virtual void PrintDataTo(StringStream* stream);
1533
1534 int arity() const { return hydrogen()->argument_count() - 1; }
1535};
1536
1537
1538class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1539 public:
1540 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1541 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1542
1543 const Runtime::Function* function() const { return hydrogen()->function(); }
1544 int arity() const { return hydrogen()->argument_count(); }
1545};
1546
1547
1548class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1549 public:
1550 explicit LInteger32ToDouble(LOperand* value) {
1551 inputs_[0] = value;
1552 }
1553
1554 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1555};
1556
1557
1558class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1559 public:
1560 explicit LNumberTagI(LOperand* value) {
1561 inputs_[0] = value;
1562 }
1563
1564 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1565};
1566
1567
1568class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1569 public:
1570 LNumberTagD(LOperand* value, LOperand* temp1, LOperand* temp2) {
1571 inputs_[0] = value;
1572 temps_[0] = temp1;
1573 temps_[1] = temp2;
1574 }
1575
1576 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1577};
1578
1579
1580// Sometimes truncating conversion from a tagged value to an int32.
1581class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1582 public:
1583 LDoubleToI(LOperand* value, LOperand* temp1, LOperand* temp2) {
1584 inputs_[0] = value;
1585 temps_[0] = temp1;
1586 temps_[1] = temp2;
1587 }
1588
1589 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1590 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1591
1592 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1593};
1594
1595
1596// Truncating conversion from a tagged value to an int32.
1597class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1598 public:
1599 LTaggedToI(LOperand* value,
1600 LOperand* temp1,
1601 LOperand* temp2,
1602 LOperand* temp3) {
1603 inputs_[0] = value;
1604 temps_[0] = temp1;
1605 temps_[1] = temp2;
1606 temps_[2] = temp3;
1607 }
1608
1609 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1610 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1611
1612 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1613};
1614
1615
1616class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1617 public:
1618 explicit LSmiTag(LOperand* value) {
1619 inputs_[0] = value;
1620 }
1621
1622 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1623};
1624
1625
1626class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1627 public:
1628 explicit LNumberUntagD(LOperand* value) {
1629 inputs_[0] = value;
1630 }
1631
1632 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1633 DECLARE_HYDROGEN_ACCESSOR(Change)
1634};
1635
1636
1637class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1638 public:
1639 LSmiUntag(LOperand* value, bool needs_check)
1640 : needs_check_(needs_check) {
1641 inputs_[0] = value;
1642 }
1643
1644 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1645
1646 bool needs_check() const { return needs_check_; }
1647
1648 private:
1649 bool needs_check_;
1650};
1651
1652
verwaest@chromium.org37141392012-05-31 13:27:02 +00001653class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001654 public:
verwaest@chromium.org37141392012-05-31 13:27:02 +00001655 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001656 inputs_[0] = obj;
1657 inputs_[1] = val;
verwaest@chromium.org37141392012-05-31 13:27:02 +00001658 temps_[0] = temp;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001659 }
1660
1661 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1662 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1663
1664 virtual void PrintDataTo(StringStream* stream);
1665
1666 LOperand* object() { return inputs_[0]; }
1667 LOperand* value() { return inputs_[1]; }
1668
1669 Handle<Object> name() const { return hydrogen()->name(); }
1670 bool is_in_object() { return hydrogen()->is_in_object(); }
1671 int offset() { return hydrogen()->offset(); }
1672 Handle<Map> transition() const { return hydrogen()->transition(); }
1673};
1674
1675
1676class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1677 public:
1678 LStoreNamedGeneric(LOperand* obj, LOperand* val) {
1679 inputs_[0] = obj;
1680 inputs_[1] = val;
1681 }
1682
1683 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1684 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1685
1686 virtual void PrintDataTo(StringStream* stream);
1687
1688 LOperand* object() { return inputs_[0]; }
1689 LOperand* value() { return inputs_[1]; }
1690 Handle<Object> name() const { return hydrogen()->name(); }
1691 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001692};
1693
1694
1695class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
1696 public:
1697 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
1698 inputs_[0] = obj;
1699 inputs_[1] = key;
1700 inputs_[2] = val;
1701 }
1702
1703 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1704 "store-keyed-fast-element")
1705 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1706
1707 virtual void PrintDataTo(StringStream* stream);
1708
1709 LOperand* object() { return inputs_[0]; }
1710 LOperand* key() { return inputs_[1]; }
1711 LOperand* value() { return inputs_[2]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001712 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001713};
1714
1715
1716class LStoreKeyedFastDoubleElement: public LTemplateInstruction<0, 3, 0> {
1717 public:
1718 LStoreKeyedFastDoubleElement(LOperand* elements,
1719 LOperand* key,
1720 LOperand* val) {
1721 inputs_[0] = elements;
1722 inputs_[1] = key;
1723 inputs_[2] = val;
1724 }
1725
1726 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement,
1727 "store-keyed-fast-double-element")
1728 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastDoubleElement)
1729
1730 virtual void PrintDataTo(StringStream* stream);
1731
1732 LOperand* elements() { return inputs_[0]; }
1733 LOperand* key() { return inputs_[1]; }
1734 LOperand* value() { return inputs_[2]; }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001735 uint32_t additional_index() const { return hydrogen()->index_offset(); }
svenpanne@chromium.orgfb046332012-04-19 12:02:44 +00001736
1737 bool NeedsCanonicalization() { return hydrogen()->NeedsCanonicalization(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001738};
1739
1740
1741class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1742 public:
1743 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) {
1744 inputs_[0] = obj;
1745 inputs_[1] = key;
1746 inputs_[2] = val;
1747 }
1748
1749 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1750 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1751
1752 virtual void PrintDataTo(StringStream* stream);
1753
1754 LOperand* object() { return inputs_[0]; }
1755 LOperand* key() { return inputs_[1]; }
1756 LOperand* value() { return inputs_[2]; }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001757 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001758};
1759
1760class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> {
1761 public:
1762 LStoreKeyedSpecializedArrayElement(LOperand* external_pointer,
1763 LOperand* key,
1764 LOperand* val) {
1765 inputs_[0] = external_pointer;
1766 inputs_[1] = key;
1767 inputs_[2] = val;
1768 }
1769
1770 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
1771 "store-keyed-specialized-array-element")
1772 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement)
1773
1774 LOperand* external_pointer() { return inputs_[0]; }
1775 LOperand* key() { return inputs_[1]; }
1776 LOperand* value() { return inputs_[2]; }
1777 ElementsKind elements_kind() const {
1778 return hydrogen()->elements_kind();
1779 }
jkummerow@chromium.org777db6f2012-05-24 09:33:09 +00001780 uint32_t additional_index() const { return hydrogen()->index_offset(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001781};
1782
1783
1784class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1785 public:
1786 LTransitionElementsKind(LOperand* object,
1787 LOperand* new_map_temp,
1788 LOperand* temp_reg) {
1789 inputs_[0] = object;
1790 temps_[0] = new_map_temp;
1791 temps_[1] = temp_reg;
1792 }
1793
1794 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1795 "transition-elements-kind")
1796 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1797
1798 virtual void PrintDataTo(StringStream* stream);
1799
1800 LOperand* object() { return inputs_[0]; }
1801 LOperand* new_map_reg() { return temps_[0]; }
1802 LOperand* temp_reg() { return temps_[1]; }
1803 Handle<Map> original_map() { return hydrogen()->original_map(); }
1804 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
1805};
1806
1807
1808class LStringAdd: public LTemplateInstruction<1, 2, 0> {
1809 public:
1810 LStringAdd(LOperand* left, LOperand* right) {
1811 inputs_[0] = left;
1812 inputs_[1] = right;
1813 }
1814
1815 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1816 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
1817
1818 LOperand* left() { return inputs_[0]; }
1819 LOperand* right() { return inputs_[1]; }
1820};
1821
1822
1823
1824class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
1825 public:
1826 LStringCharCodeAt(LOperand* string, LOperand* index) {
1827 inputs_[0] = string;
1828 inputs_[1] = index;
1829 }
1830
1831 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1832 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
1833
1834 LOperand* string() { return inputs_[0]; }
1835 LOperand* index() { return inputs_[1]; }
1836};
1837
1838
1839class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
1840 public:
1841 explicit LStringCharFromCode(LOperand* char_code) {
1842 inputs_[0] = char_code;
1843 }
1844
1845 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
1846 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
1847
1848 LOperand* char_code() { return inputs_[0]; }
1849};
1850
1851
1852class LStringLength: public LTemplateInstruction<1, 1, 0> {
1853 public:
1854 explicit LStringLength(LOperand* string) {
1855 inputs_[0] = string;
1856 }
1857
1858 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1859 DECLARE_HYDROGEN_ACCESSOR(StringLength)
1860
1861 LOperand* string() { return inputs_[0]; }
1862};
1863
1864
1865class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
1866 public:
1867 explicit LCheckFunction(LOperand* value) {
1868 inputs_[0] = value;
1869 }
1870
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00001871 LOperand* value() { return InputAt(0); }
1872
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001873 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1874 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1875};
1876
1877
1878class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
1879 public:
1880 explicit LCheckInstanceType(LOperand* value) {
1881 inputs_[0] = value;
1882 }
1883
1884 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1885 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
1886};
1887
1888
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001889class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001890 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001891 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001892 inputs_[0] = value;
1893 }
1894
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001895 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
1896 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001897};
1898
1899
1900class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
1901 public:
1902 LCheckPrototypeMaps(LOperand* temp1, LOperand* temp2) {
1903 temps_[0] = temp1;
1904 temps_[1] = temp2;
1905 }
1906
1907 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1908 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1909
1910 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1911 Handle<JSObject> holder() const { return hydrogen()->holder(); }
1912};
1913
1914
1915class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
1916 public:
1917 explicit LCheckSmi(LOperand* value) {
1918 inputs_[0] = value;
1919 }
1920
1921 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
1922};
1923
1924
1925class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
1926 public:
1927 explicit LCheckNonSmi(LOperand* value) {
1928 inputs_[0] = value;
1929 }
1930
1931 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
1932};
1933
1934
1935class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
1936 public:
1937 LClampDToUint8(LOperand* value, LOperand* temp) {
1938 inputs_[0] = value;
1939 temps_[0] = temp;
1940 }
1941
1942 LOperand* unclamped() { return inputs_[0]; }
1943
1944 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
1945};
1946
1947
1948class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
1949 public:
1950 explicit LClampIToUint8(LOperand* value) {
1951 inputs_[0] = value;
1952 }
1953
1954 LOperand* unclamped() { return inputs_[0]; }
1955
1956 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
1957};
1958
1959
1960class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
1961 public:
1962 LClampTToUint8(LOperand* value, LOperand* temp) {
1963 inputs_[0] = value;
1964 temps_[0] = temp;
1965 }
1966
1967 LOperand* unclamped() { return inputs_[0]; }
1968
1969 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
1970};
1971
1972
fschneider@chromium.org35814e52012-03-01 15:43:35 +00001973class LAllocateObject: public LTemplateInstruction<1, 0, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00001974 public:
fschneider@chromium.org35814e52012-03-01 15:43:35 +00001975 LAllocateObject(LOperand* temp1, LOperand* temp2) {
1976 temps_[0] = temp1;
1977 temps_[1] = temp2;
1978 }
1979
ulan@chromium.org967e2702012-02-28 09:49:15 +00001980 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
1981 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
1982};
1983
1984
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001985class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
1986 public:
1987 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
1988 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
1989};
1990
1991
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001992class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
1993 public:
1994 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
1995 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
1996};
1997
1998
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001999class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002000 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00002001 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
2002 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002003};
2004
2005
2006class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2007 public:
2008 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2009 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2010};
2011
2012
2013class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2014 public:
2015 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2016 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2017
2018 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2019};
2020
2021
2022class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2023 public:
2024 explicit LToFastProperties(LOperand* value) {
2025 inputs_[0] = value;
2026 }
2027
2028 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2029 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2030};
2031
2032
2033class LTypeof: public LTemplateInstruction<1, 1, 0> {
2034 public:
2035 explicit LTypeof(LOperand* value) {
2036 inputs_[0] = value;
2037 }
2038
2039 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2040};
2041
2042
2043class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2044 public:
2045 explicit LTypeofIsAndBranch(LOperand* value) {
2046 inputs_[0] = value;
2047 }
2048
2049 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2050 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2051
2052 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2053
2054 virtual void PrintDataTo(StringStream* stream);
2055};
2056
2057
2058class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2059 public:
2060 explicit LIsConstructCallAndBranch(LOperand* temp) {
2061 temps_[0] = temp;
2062 }
2063
2064 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2065 "is-construct-call-and-branch")
2066};
2067
2068
2069class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2070 public:
2071 LDeleteProperty(LOperand* obj, LOperand* key) {
2072 inputs_[0] = obj;
2073 inputs_[1] = key;
2074 }
2075
2076 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
2077
2078 LOperand* object() { return inputs_[0]; }
2079 LOperand* key() { return inputs_[1]; }
2080};
2081
2082
2083class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2084 public:
2085 LOsrEntry();
2086
2087 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2088
2089 LOperand** SpilledRegisterArray() { return register_spills_; }
2090 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2091
2092 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2093 void MarkSpilledDoubleRegister(int allocation_index,
2094 LOperand* spill_operand);
2095
2096 private:
2097 // Arrays of spill slot operands for registers with an assigned spill
2098 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2099 // NULL if the register has no assigned spill slot. Indexed by allocation
2100 // index.
2101 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2102 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2103};
2104
2105
2106class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2107 public:
2108 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2109 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2110
2111 Label* done_label() { return &done_label_; }
2112
2113 private:
2114 Label done_label_;
2115};
2116
2117
2118class LIn: public LTemplateInstruction<1, 2, 0> {
2119 public:
2120 LIn(LOperand* key, LOperand* object) {
2121 inputs_[0] = key;
2122 inputs_[1] = object;
2123 }
2124
2125 LOperand* key() { return inputs_[0]; }
2126 LOperand* object() { return inputs_[1]; }
2127
2128 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2129};
2130
2131
ulan@chromium.org812308e2012-02-29 15:58:45 +00002132class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2133 public:
2134 explicit LForInPrepareMap(LOperand* object) {
2135 inputs_[0] = object;
2136 }
2137
2138 LOperand* object() { return inputs_[0]; }
2139
2140 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2141};
2142
2143
2144class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
2145 public:
2146 explicit LForInCacheArray(LOperand* map) {
2147 inputs_[0] = map;
2148 }
2149
2150 LOperand* map() { return inputs_[0]; }
2151
2152 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2153
2154 int idx() {
2155 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2156 }
2157};
2158
2159
2160class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2161 public:
2162 LCheckMapValue(LOperand* value, LOperand* map) {
2163 inputs_[0] = value;
2164 inputs_[1] = map;
2165 }
2166
2167 LOperand* value() { return inputs_[0]; }
2168 LOperand* map() { return inputs_[1]; }
2169
2170 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2171};
2172
2173
2174class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2175 public:
2176 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2177 inputs_[0] = object;
2178 inputs_[1] = index;
2179 }
2180
2181 LOperand* object() { return inputs_[0]; }
2182 LOperand* index() { return inputs_[1]; }
2183
2184 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2185};
2186
2187
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002188class LChunkBuilder;
lrn@chromium.org7516f052011-03-30 08:52:27 +00002189class LChunk: public ZoneObject {
2190 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002191 explicit LChunk(CompilationInfo* info, HGraph* graph);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002192
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002193 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
2194 LConstantOperand* DefineConstantOperand(HConstant* constant);
2195 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
2196 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
lrn@chromium.org7516f052011-03-30 08:52:27 +00002197
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002198 int GetNextSpillIndex(bool is_double);
2199 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002200
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002201 int ParameterAt(int index);
2202 int GetParameterStackSlot(int index) const;
2203 int spill_slot_count() const { return spill_slot_count_; }
2204 CompilationInfo* info() const { return info_; }
2205 HGraph* graph() const { return graph_; }
2206 const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
2207 void AddGapMove(int index, LOperand* from, LOperand* to);
2208 LGap* GetGapAt(int index) const;
2209 bool IsGapAt(int index) const;
2210 int NearestGapPos(int index) const;
2211 void MarkEmptyBlocks();
2212 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002213 LLabel* GetLabel(int block_id) const {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002214 HBasicBlock* block = graph_->blocks()->at(block_id);
2215 int first_instruction = block->first_instruction_index();
2216 return LLabel::cast(instructions_[first_instruction]);
2217 }
2218 int LookupDestination(int block_id) const {
2219 LLabel* cur = GetLabel(block_id);
2220 while (cur->replacement() != NULL) {
2221 cur = cur->replacement();
2222 }
2223 return cur->block_id();
2224 }
2225 Label* GetAssemblyLabel(int block_id) const {
2226 LLabel* label = GetLabel(block_id);
2227 ASSERT(!label->HasReplacement());
2228 return label->label();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002229 }
2230
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002231 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
2232 return &inlined_closures_;
lrn@chromium.org7516f052011-03-30 08:52:27 +00002233 }
2234
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002235 void AddInlinedClosure(Handle<JSFunction> closure) {
2236 inlined_closures_.Add(closure);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002237 }
2238
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002239 private:
2240 int spill_slot_count_;
2241 CompilationInfo* info_;
2242 HGraph* const graph_;
2243 ZoneList<LInstruction*> instructions_;
2244 ZoneList<LPointerMap*> pointer_maps_;
2245 ZoneList<Handle<JSFunction> > inlined_closures_;
lrn@chromium.org7516f052011-03-30 08:52:27 +00002246};
2247
2248
2249class LChunkBuilder BASE_EMBEDDED {
2250 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002251 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2252 : chunk_(NULL),
2253 info_(info),
2254 graph_(graph),
ulan@chromium.org812308e2012-02-29 15:58:45 +00002255 zone_(graph->isolate()->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002256 status_(UNUSED),
2257 current_instruction_(NULL),
2258 current_block_(NULL),
2259 next_block_(NULL),
2260 argument_count_(0),
2261 allocator_(allocator),
2262 position_(RelocInfo::kNoPosition),
2263 instruction_pending_deoptimization_environment_(NULL),
2264 pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002265
2266 // Build the sequence for the graph.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002267 LChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002268
2269 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002270#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002271 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2272#undef DECLARE_DO
2273
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002274 private:
2275 enum Status {
2276 UNUSED,
2277 BUILDING,
2278 DONE,
2279 ABORTED
2280 };
2281
2282 LChunk* chunk() const { return chunk_; }
2283 CompilationInfo* info() const { return info_; }
2284 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002285 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002286
2287 bool is_unused() const { return status_ == UNUSED; }
2288 bool is_building() const { return status_ == BUILDING; }
2289 bool is_done() const { return status_ == DONE; }
2290 bool is_aborted() const { return status_ == ABORTED; }
2291
2292 void Abort(const char* format, ...);
2293
2294 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002295 LUnallocated* ToUnallocated(Register reg);
2296 LUnallocated* ToUnallocated(DoubleRegister reg);
2297
2298 // Methods for setting up define-use relationships.
2299 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2300 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2301 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2302 DoubleRegister fixed_register);
2303
2304 // A value that is guaranteed to be allocated to a register.
2305 // Operand created by UseRegister is guaranteed to be live until the end of
2306 // instruction. This means that register allocator will not reuse it's
2307 // register for any other operand inside instruction.
2308 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2309 // instruction start. Register allocator is free to assign the same register
2310 // to some other operand used inside instruction (i.e. temporary or
2311 // output).
2312 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2313 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2314
2315 // An input operand in a register that may be trashed.
2316 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2317
2318 // An input operand in a register or stack slot.
2319 MUST_USE_RESULT LOperand* Use(HValue* value);
2320 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2321
2322 // An input operand in a register, stack slot or a constant operand.
2323 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2324 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2325
2326 // An input operand in a register or a constant operand.
2327 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2328 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2329
2330 // An input operand in register, stack slot or a constant operand.
2331 // Will not be moved to a register even if one is freely available.
2332 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2333
2334 // Temporary operand that must be in a register.
2335 MUST_USE_RESULT LUnallocated* TempRegister();
2336 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2337 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2338
2339 // Methods for setting up define-use relationships.
2340 // Return the same instruction that they are passed.
2341 template<int I, int T>
2342 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2343 LUnallocated* result);
2344 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002345 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2346 template<int I, int T>
2347 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2348 int index);
2349 template<int I, int T>
2350 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2351 template<int I, int T>
2352 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2353 Register reg);
2354 template<int I, int T>
2355 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2356 DoubleRegister reg);
2357 LInstruction* AssignEnvironment(LInstruction* instr);
2358 LInstruction* AssignPointerMap(LInstruction* instr);
2359
2360 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2361
2362 // By default we assume that instruction sequences generated for calls
2363 // cannot deoptimize eagerly and we do not attach environment to this
2364 // instruction.
2365 LInstruction* MarkAsCall(
2366 LInstruction* instr,
2367 HInstruction* hinstr,
2368 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002369
2370 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2371 int* argument_index_accumulator);
2372
2373 void VisitInstruction(HInstruction* current);
2374
2375 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2376 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2377 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2378 LInstruction* DoArithmeticD(Token::Value op,
2379 HArithmeticBinaryOperation* instr);
2380 LInstruction* DoArithmeticT(Token::Value op,
2381 HArithmeticBinaryOperation* instr);
2382
2383 LChunk* chunk_;
2384 CompilationInfo* info_;
2385 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002386 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002387 Status status_;
2388 HInstruction* current_instruction_;
2389 HBasicBlock* current_block_;
2390 HBasicBlock* next_block_;
2391 int argument_count_;
2392 LAllocator* allocator_;
2393 int position_;
2394 LInstruction* instruction_pending_deoptimization_environment_;
2395 int pending_deoptimization_ast_id_;
2396
lrn@chromium.org7516f052011-03-30 08:52:27 +00002397 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2398};
2399
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002400#undef DECLARE_HYDROGEN_ACCESSOR
2401#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002402
2403} } // namespace v8::internal
2404
2405#endif // V8_MIPS_LITHIUM_MIPS_H_