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