blob: 46e9eaff742e52ab046c85d4e11f57796086c5f1 [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; }
1456};
1457
1458
1459class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1460 public:
1461 explicit LCallKeyed(LOperand* key) {
1462 inputs_[0] = key;
1463 }
1464
1465 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1466 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1467
1468 virtual void PrintDataTo(StringStream* stream);
1469
1470 int arity() const { return hydrogen()->argument_count() - 1; }
1471};
1472
1473
1474
1475class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1476 public:
1477 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1478 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1479
1480 virtual void PrintDataTo(StringStream* stream);
1481
1482 Handle<String> name() const { return hydrogen()->name(); }
1483 int arity() const { return hydrogen()->argument_count() - 1; }
1484};
1485
1486
danno@chromium.orgc612e022011-11-10 11:38:15 +00001487class LCallFunction: public LTemplateInstruction<1, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001488 public:
danno@chromium.orgc612e022011-11-10 11:38:15 +00001489 explicit LCallFunction(LOperand* function) {
1490 inputs_[0] = function;
1491 }
1492
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001493 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1494 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1495
danno@chromium.orgc612e022011-11-10 11:38:15 +00001496 LOperand* function() { return inputs_[0]; }
1497 int arity() const { return hydrogen()->argument_count() - 1; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001498};
1499
1500
1501class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1502 public:
1503 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1504 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1505
1506 virtual void PrintDataTo(StringStream* stream);
1507
1508 Handle<String> name() const {return hydrogen()->name(); }
1509 int arity() const { return hydrogen()->argument_count() - 1; }
1510};
1511
1512
1513class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1514 public:
1515 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1516 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1517
1518 virtual void PrintDataTo(StringStream* stream);
1519
1520 Handle<JSFunction> target() const { return hydrogen()->target(); }
1521 int arity() const { return hydrogen()->argument_count() - 1; }
1522};
1523
1524
1525class LCallNew: public LTemplateInstruction<1, 1, 0> {
1526 public:
1527 explicit LCallNew(LOperand* constructor) {
1528 inputs_[0] = constructor;
1529 }
1530
1531 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1532 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1533
1534 virtual void PrintDataTo(StringStream* stream);
1535
1536 int arity() const { return hydrogen()->argument_count() - 1; }
1537};
1538
1539
1540class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1541 public:
1542 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1543 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1544
1545 const Runtime::Function* function() const { return hydrogen()->function(); }
1546 int arity() const { return hydrogen()->argument_count(); }
1547};
1548
1549
1550class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1551 public:
1552 explicit LInteger32ToDouble(LOperand* value) {
1553 inputs_[0] = value;
1554 }
1555
1556 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1557};
1558
1559
1560class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1561 public:
1562 explicit LNumberTagI(LOperand* value) {
1563 inputs_[0] = value;
1564 }
1565
1566 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1567};
1568
1569
1570class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1571 public:
1572 LNumberTagD(LOperand* value, LOperand* temp1, LOperand* temp2) {
1573 inputs_[0] = value;
1574 temps_[0] = temp1;
1575 temps_[1] = temp2;
1576 }
1577
1578 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1579};
1580
1581
1582// Sometimes truncating conversion from a tagged value to an int32.
1583class LDoubleToI: public LTemplateInstruction<1, 1, 2> {
1584 public:
1585 LDoubleToI(LOperand* value, LOperand* temp1, LOperand* temp2) {
1586 inputs_[0] = value;
1587 temps_[0] = temp1;
1588 temps_[1] = temp2;
1589 }
1590
1591 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1592 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1593
1594 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1595};
1596
1597
1598// Truncating conversion from a tagged value to an int32.
1599class LTaggedToI: public LTemplateInstruction<1, 1, 3> {
1600 public:
1601 LTaggedToI(LOperand* value,
1602 LOperand* temp1,
1603 LOperand* temp2,
1604 LOperand* temp3) {
1605 inputs_[0] = value;
1606 temps_[0] = temp1;
1607 temps_[1] = temp2;
1608 temps_[2] = temp3;
1609 }
1610
1611 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1612 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
1613
1614 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1615};
1616
1617
1618class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1619 public:
1620 explicit LSmiTag(LOperand* value) {
1621 inputs_[0] = value;
1622 }
1623
1624 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1625};
1626
1627
1628class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1629 public:
1630 explicit LNumberUntagD(LOperand* value) {
1631 inputs_[0] = value;
1632 }
1633
1634 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1635 DECLARE_HYDROGEN_ACCESSOR(Change)
1636};
1637
1638
1639class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1640 public:
1641 LSmiUntag(LOperand* value, bool needs_check)
1642 : needs_check_(needs_check) {
1643 inputs_[0] = value;
1644 }
1645
1646 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1647
1648 bool needs_check() const { return needs_check_; }
1649
1650 private:
1651 bool needs_check_;
1652};
1653
1654
1655class LStoreNamedField: public LTemplateInstruction<0, 2, 0> {
1656 public:
1657 LStoreNamedField(LOperand* obj, LOperand* val) {
1658 inputs_[0] = obj;
1659 inputs_[1] = val;
1660 }
1661
1662 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1663 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1664
1665 virtual void PrintDataTo(StringStream* stream);
1666
1667 LOperand* object() { return inputs_[0]; }
1668 LOperand* value() { return inputs_[1]; }
1669
1670 Handle<Object> name() const { return hydrogen()->name(); }
1671 bool is_in_object() { return hydrogen()->is_in_object(); }
1672 int offset() { return hydrogen()->offset(); }
1673 Handle<Map> transition() const { return hydrogen()->transition(); }
1674};
1675
1676
1677class LStoreNamedGeneric: public LTemplateInstruction<0, 2, 0> {
1678 public:
1679 LStoreNamedGeneric(LOperand* obj, LOperand* val) {
1680 inputs_[0] = obj;
1681 inputs_[1] = val;
1682 }
1683
1684 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1685 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1686
1687 virtual void PrintDataTo(StringStream* stream);
1688
1689 LOperand* object() { return inputs_[0]; }
1690 LOperand* value() { return inputs_[1]; }
1691 Handle<Object> name() const { return hydrogen()->name(); }
1692 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001693};
1694
1695
1696class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
1697 public:
1698 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
1699 inputs_[0] = obj;
1700 inputs_[1] = key;
1701 inputs_[2] = val;
1702 }
1703
1704 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1705 "store-keyed-fast-element")
1706 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1707
1708 virtual void PrintDataTo(StringStream* stream);
1709
1710 LOperand* object() { return inputs_[0]; }
1711 LOperand* key() { return inputs_[1]; }
1712 LOperand* value() { return inputs_[2]; }
1713};
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]; }
1735};
1736
1737
1738class LStoreKeyedGeneric: public LTemplateInstruction<0, 3, 0> {
1739 public:
1740 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) {
1741 inputs_[0] = obj;
1742 inputs_[1] = key;
1743 inputs_[2] = val;
1744 }
1745
1746 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1747 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
1748
1749 virtual void PrintDataTo(StringStream* stream);
1750
1751 LOperand* object() { return inputs_[0]; }
1752 LOperand* key() { return inputs_[1]; }
1753 LOperand* value() { return inputs_[2]; }
mstarzinger@chromium.org1b3afd12011-11-29 14:28:56 +00001754 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001755};
1756
1757class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> {
1758 public:
1759 LStoreKeyedSpecializedArrayElement(LOperand* external_pointer,
1760 LOperand* key,
1761 LOperand* val) {
1762 inputs_[0] = external_pointer;
1763 inputs_[1] = key;
1764 inputs_[2] = val;
1765 }
1766
1767 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
1768 "store-keyed-specialized-array-element")
1769 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement)
1770
1771 LOperand* external_pointer() { return inputs_[0]; }
1772 LOperand* key() { return inputs_[1]; }
1773 LOperand* value() { return inputs_[2]; }
1774 ElementsKind elements_kind() const {
1775 return hydrogen()->elements_kind();
1776 }
1777};
1778
1779
1780class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1781 public:
1782 LTransitionElementsKind(LOperand* object,
1783 LOperand* new_map_temp,
1784 LOperand* temp_reg) {
1785 inputs_[0] = object;
1786 temps_[0] = new_map_temp;
1787 temps_[1] = temp_reg;
1788 }
1789
1790 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1791 "transition-elements-kind")
1792 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1793
1794 virtual void PrintDataTo(StringStream* stream);
1795
1796 LOperand* object() { return inputs_[0]; }
1797 LOperand* new_map_reg() { return temps_[0]; }
1798 LOperand* temp_reg() { return temps_[1]; }
1799 Handle<Map> original_map() { return hydrogen()->original_map(); }
1800 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
1801};
1802
1803
1804class LStringAdd: public LTemplateInstruction<1, 2, 0> {
1805 public:
1806 LStringAdd(LOperand* left, LOperand* right) {
1807 inputs_[0] = left;
1808 inputs_[1] = right;
1809 }
1810
1811 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1812 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
1813
1814 LOperand* left() { return inputs_[0]; }
1815 LOperand* right() { return inputs_[1]; }
1816};
1817
1818
1819
1820class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
1821 public:
1822 LStringCharCodeAt(LOperand* string, LOperand* index) {
1823 inputs_[0] = string;
1824 inputs_[1] = index;
1825 }
1826
1827 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1828 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
1829
1830 LOperand* string() { return inputs_[0]; }
1831 LOperand* index() { return inputs_[1]; }
1832};
1833
1834
1835class LStringCharFromCode: public LTemplateInstruction<1, 1, 0> {
1836 public:
1837 explicit LStringCharFromCode(LOperand* char_code) {
1838 inputs_[0] = char_code;
1839 }
1840
1841 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
1842 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
1843
1844 LOperand* char_code() { return inputs_[0]; }
1845};
1846
1847
1848class LStringLength: public LTemplateInstruction<1, 1, 0> {
1849 public:
1850 explicit LStringLength(LOperand* string) {
1851 inputs_[0] = string;
1852 }
1853
1854 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1855 DECLARE_HYDROGEN_ACCESSOR(StringLength)
1856
1857 LOperand* string() { return inputs_[0]; }
1858};
1859
1860
1861class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
1862 public:
1863 explicit LCheckFunction(LOperand* value) {
1864 inputs_[0] = value;
1865 }
1866
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +00001867 LOperand* value() { return InputAt(0); }
1868
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001869 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1870 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1871};
1872
1873
1874class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
1875 public:
1876 explicit LCheckInstanceType(LOperand* value) {
1877 inputs_[0] = value;
1878 }
1879
1880 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1881 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
1882};
1883
1884
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001885class LCheckMaps: public LTemplateInstruction<0, 1, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001886 public:
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001887 explicit LCheckMaps(LOperand* value) {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001888 inputs_[0] = value;
1889 }
1890
jkummerow@chromium.org1456e702012-03-30 08:38:13 +00001891 DECLARE_CONCRETE_INSTRUCTION(CheckMaps, "check-maps")
1892 DECLARE_HYDROGEN_ACCESSOR(CheckMaps)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001893};
1894
1895
1896class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
1897 public:
1898 LCheckPrototypeMaps(LOperand* temp1, LOperand* temp2) {
1899 temps_[0] = temp1;
1900 temps_[1] = temp2;
1901 }
1902
1903 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1904 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1905
1906 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1907 Handle<JSObject> holder() const { return hydrogen()->holder(); }
1908};
1909
1910
1911class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
1912 public:
1913 explicit LCheckSmi(LOperand* value) {
1914 inputs_[0] = value;
1915 }
1916
1917 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
1918};
1919
1920
1921class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
1922 public:
1923 explicit LCheckNonSmi(LOperand* value) {
1924 inputs_[0] = value;
1925 }
1926
1927 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
1928};
1929
1930
1931class LClampDToUint8: public LTemplateInstruction<1, 1, 1> {
1932 public:
1933 LClampDToUint8(LOperand* value, LOperand* temp) {
1934 inputs_[0] = value;
1935 temps_[0] = temp;
1936 }
1937
1938 LOperand* unclamped() { return inputs_[0]; }
1939
1940 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
1941};
1942
1943
1944class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
1945 public:
1946 explicit LClampIToUint8(LOperand* value) {
1947 inputs_[0] = value;
1948 }
1949
1950 LOperand* unclamped() { return inputs_[0]; }
1951
1952 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
1953};
1954
1955
1956class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
1957 public:
1958 LClampTToUint8(LOperand* value, LOperand* temp) {
1959 inputs_[0] = value;
1960 temps_[0] = temp;
1961 }
1962
1963 LOperand* unclamped() { return inputs_[0]; }
1964
1965 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
1966};
1967
1968
fschneider@chromium.org35814e52012-03-01 15:43:35 +00001969class LAllocateObject: public LTemplateInstruction<1, 0, 2> {
ulan@chromium.org967e2702012-02-28 09:49:15 +00001970 public:
fschneider@chromium.org35814e52012-03-01 15:43:35 +00001971 LAllocateObject(LOperand* temp1, LOperand* temp2) {
1972 temps_[0] = temp1;
1973 temps_[1] = temp2;
1974 }
1975
ulan@chromium.org967e2702012-02-28 09:49:15 +00001976 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object")
1977 DECLARE_HYDROGEN_ACCESSOR(AllocateObject)
1978};
1979
1980
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001981class LFastLiteral: public LTemplateInstruction<1, 0, 0> {
1982 public:
1983 DECLARE_CONCRETE_INSTRUCTION(FastLiteral, "fast-literal")
1984 DECLARE_HYDROGEN_ACCESSOR(FastLiteral)
1985};
1986
1987
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001988class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
1989 public:
1990 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
1991 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
1992};
1993
1994
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001995class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001996 public:
jkummerow@chromium.orgf7a58842012-02-21 10:08:21 +00001997 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
1998 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00001999};
2000
2001
2002class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
2003 public:
2004 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
2005 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
2006};
2007
2008
2009class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
2010 public:
2011 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2012 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2013
2014 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2015};
2016
2017
2018class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2019 public:
2020 explicit LToFastProperties(LOperand* value) {
2021 inputs_[0] = value;
2022 }
2023
2024 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2025 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2026};
2027
2028
2029class LTypeof: public LTemplateInstruction<1, 1, 0> {
2030 public:
2031 explicit LTypeof(LOperand* value) {
2032 inputs_[0] = value;
2033 }
2034
2035 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2036};
2037
2038
2039class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
2040 public:
2041 explicit LTypeofIsAndBranch(LOperand* value) {
2042 inputs_[0] = value;
2043 }
2044
2045 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
2046 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
2047
2048 Handle<String> type_literal() { return hydrogen()->type_literal(); }
2049
2050 virtual void PrintDataTo(StringStream* stream);
2051};
2052
2053
2054class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
2055 public:
2056 explicit LIsConstructCallAndBranch(LOperand* temp) {
2057 temps_[0] = temp;
2058 }
2059
2060 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
2061 "is-construct-call-and-branch")
2062};
2063
2064
2065class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
2066 public:
2067 LDeleteProperty(LOperand* obj, LOperand* key) {
2068 inputs_[0] = obj;
2069 inputs_[1] = key;
2070 }
2071
2072 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
2073
2074 LOperand* object() { return inputs_[0]; }
2075 LOperand* key() { return inputs_[1]; }
2076};
2077
2078
2079class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
2080 public:
2081 LOsrEntry();
2082
2083 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2084
2085 LOperand** SpilledRegisterArray() { return register_spills_; }
2086 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2087
2088 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2089 void MarkSpilledDoubleRegister(int allocation_index,
2090 LOperand* spill_operand);
2091
2092 private:
2093 // Arrays of spill slot operands for registers with an assigned spill
2094 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2095 // NULL if the register has no assigned spill slot. Indexed by allocation
2096 // index.
2097 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2098 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2099};
2100
2101
2102class LStackCheck: public LTemplateInstruction<0, 0, 0> {
2103 public:
2104 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
2105 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2106
2107 Label* done_label() { return &done_label_; }
2108
2109 private:
2110 Label done_label_;
2111};
2112
2113
2114class LIn: public LTemplateInstruction<1, 2, 0> {
2115 public:
2116 LIn(LOperand* key, LOperand* object) {
2117 inputs_[0] = key;
2118 inputs_[1] = object;
2119 }
2120
2121 LOperand* key() { return inputs_[0]; }
2122 LOperand* object() { return inputs_[1]; }
2123
2124 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2125};
2126
2127
ulan@chromium.org812308e2012-02-29 15:58:45 +00002128class LForInPrepareMap: public LTemplateInstruction<1, 1, 0> {
2129 public:
2130 explicit LForInPrepareMap(LOperand* object) {
2131 inputs_[0] = object;
2132 }
2133
2134 LOperand* object() { return inputs_[0]; }
2135
2136 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap, "for-in-prepare-map")
2137};
2138
2139
2140class LForInCacheArray: public LTemplateInstruction<1, 1, 0> {
2141 public:
2142 explicit LForInCacheArray(LOperand* map) {
2143 inputs_[0] = map;
2144 }
2145
2146 LOperand* map() { return inputs_[0]; }
2147
2148 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray, "for-in-cache-array")
2149
2150 int idx() {
2151 return HForInCacheArray::cast(this->hydrogen_value())->idx();
2152 }
2153};
2154
2155
2156class LCheckMapValue: public LTemplateInstruction<0, 2, 0> {
2157 public:
2158 LCheckMapValue(LOperand* value, LOperand* map) {
2159 inputs_[0] = value;
2160 inputs_[1] = map;
2161 }
2162
2163 LOperand* value() { return inputs_[0]; }
2164 LOperand* map() { return inputs_[1]; }
2165
2166 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue, "check-map-value")
2167};
2168
2169
2170class LLoadFieldByIndex: public LTemplateInstruction<1, 2, 0> {
2171 public:
2172 LLoadFieldByIndex(LOperand* object, LOperand* index) {
2173 inputs_[0] = object;
2174 inputs_[1] = index;
2175 }
2176
2177 LOperand* object() { return inputs_[0]; }
2178 LOperand* index() { return inputs_[1]; }
2179
2180 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index")
2181};
2182
2183
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002184class LChunkBuilder;
lrn@chromium.org7516f052011-03-30 08:52:27 +00002185class LChunk: public ZoneObject {
2186 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002187 explicit LChunk(CompilationInfo* info, HGraph* graph);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002188
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002189 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
2190 LConstantOperand* DefineConstantOperand(HConstant* constant);
2191 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
2192 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
lrn@chromium.org7516f052011-03-30 08:52:27 +00002193
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002194 int GetNextSpillIndex(bool is_double);
2195 LOperand* GetNextSpillSlot(bool is_double);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002196
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002197 int ParameterAt(int index);
2198 int GetParameterStackSlot(int index) const;
2199 int spill_slot_count() const { return spill_slot_count_; }
2200 CompilationInfo* info() const { return info_; }
2201 HGraph* graph() const { return graph_; }
2202 const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
2203 void AddGapMove(int index, LOperand* from, LOperand* to);
2204 LGap* GetGapAt(int index) const;
2205 bool IsGapAt(int index) const;
2206 int NearestGapPos(int index) const;
2207 void MarkEmptyBlocks();
2208 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002209 LLabel* GetLabel(int block_id) const {
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002210 HBasicBlock* block = graph_->blocks()->at(block_id);
2211 int first_instruction = block->first_instruction_index();
2212 return LLabel::cast(instructions_[first_instruction]);
2213 }
2214 int LookupDestination(int block_id) const {
2215 LLabel* cur = GetLabel(block_id);
2216 while (cur->replacement() != NULL) {
2217 cur = cur->replacement();
2218 }
2219 return cur->block_id();
2220 }
2221 Label* GetAssemblyLabel(int block_id) const {
2222 LLabel* label = GetLabel(block_id);
2223 ASSERT(!label->HasReplacement());
2224 return label->label();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002225 }
2226
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002227 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
2228 return &inlined_closures_;
lrn@chromium.org7516f052011-03-30 08:52:27 +00002229 }
2230
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002231 void AddInlinedClosure(Handle<JSFunction> closure) {
2232 inlined_closures_.Add(closure);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002233 }
2234
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002235 private:
2236 int spill_slot_count_;
2237 CompilationInfo* info_;
2238 HGraph* const graph_;
2239 ZoneList<LInstruction*> instructions_;
2240 ZoneList<LPointerMap*> pointer_maps_;
2241 ZoneList<Handle<JSFunction> > inlined_closures_;
lrn@chromium.org7516f052011-03-30 08:52:27 +00002242};
2243
2244
2245class LChunkBuilder BASE_EMBEDDED {
2246 public:
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002247 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
2248 : chunk_(NULL),
2249 info_(info),
2250 graph_(graph),
ulan@chromium.org812308e2012-02-29 15:58:45 +00002251 zone_(graph->isolate()->zone()),
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002252 status_(UNUSED),
2253 current_instruction_(NULL),
2254 current_block_(NULL),
2255 next_block_(NULL),
2256 argument_count_(0),
2257 allocator_(allocator),
2258 position_(RelocInfo::kNoPosition),
2259 instruction_pending_deoptimization_environment_(NULL),
2260 pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
lrn@chromium.org7516f052011-03-30 08:52:27 +00002261
2262 // Build the sequence for the graph.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002263 LChunk* Build();
lrn@chromium.org7516f052011-03-30 08:52:27 +00002264
2265 // Declare methods that deal with the individual node types.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002266#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
lrn@chromium.org7516f052011-03-30 08:52:27 +00002267 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2268#undef DECLARE_DO
2269
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002270 private:
2271 enum Status {
2272 UNUSED,
2273 BUILDING,
2274 DONE,
2275 ABORTED
2276 };
2277
2278 LChunk* chunk() const { return chunk_; }
2279 CompilationInfo* info() const { return info_; }
2280 HGraph* graph() const { return graph_; }
ulan@chromium.org812308e2012-02-29 15:58:45 +00002281 Zone* zone() const { return zone_; }
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002282
2283 bool is_unused() const { return status_ == UNUSED; }
2284 bool is_building() const { return status_ == BUILDING; }
2285 bool is_done() const { return status_ == DONE; }
2286 bool is_aborted() const { return status_ == ABORTED; }
2287
2288 void Abort(const char* format, ...);
2289
2290 // Methods for getting operands for Use / Define / Temp.
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002291 LUnallocated* ToUnallocated(Register reg);
2292 LUnallocated* ToUnallocated(DoubleRegister reg);
2293
2294 // Methods for setting up define-use relationships.
2295 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2296 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2297 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2298 DoubleRegister fixed_register);
2299
2300 // A value that is guaranteed to be allocated to a register.
2301 // Operand created by UseRegister is guaranteed to be live until the end of
2302 // instruction. This means that register allocator will not reuse it's
2303 // register for any other operand inside instruction.
2304 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2305 // instruction start. Register allocator is free to assign the same register
2306 // to some other operand used inside instruction (i.e. temporary or
2307 // output).
2308 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2309 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
2310
2311 // An input operand in a register that may be trashed.
2312 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2313
2314 // An input operand in a register or stack slot.
2315 MUST_USE_RESULT LOperand* Use(HValue* value);
2316 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2317
2318 // An input operand in a register, stack slot or a constant operand.
2319 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2320 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2321
2322 // An input operand in a register or a constant operand.
2323 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2324 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2325
2326 // An input operand in register, stack slot or a constant operand.
2327 // Will not be moved to a register even if one is freely available.
2328 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2329
2330 // Temporary operand that must be in a register.
2331 MUST_USE_RESULT LUnallocated* TempRegister();
2332 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2333 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
2334
2335 // Methods for setting up define-use relationships.
2336 // Return the same instruction that they are passed.
2337 template<int I, int T>
2338 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2339 LUnallocated* result);
2340 template<int I, int T>
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002341 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2342 template<int I, int T>
2343 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2344 int index);
2345 template<int I, int T>
2346 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2347 template<int I, int T>
2348 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2349 Register reg);
2350 template<int I, int T>
2351 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2352 DoubleRegister reg);
2353 LInstruction* AssignEnvironment(LInstruction* instr);
2354 LInstruction* AssignPointerMap(LInstruction* instr);
2355
2356 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2357
2358 // By default we assume that instruction sequences generated for calls
2359 // cannot deoptimize eagerly and we do not attach environment to this
2360 // instruction.
2361 LInstruction* MarkAsCall(
2362 LInstruction* instr,
2363 HInstruction* hinstr,
2364 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
2365 LInstruction* MarkAsSaveDoubles(LInstruction* instr);
2366
2367 LInstruction* SetInstructionPendingDeoptimizationEnvironment(
2368 LInstruction* instr, int ast_id);
2369 void ClearInstructionPendingDeoptimizationEnvironment();
2370
2371 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2372 int* argument_index_accumulator);
2373
2374 void VisitInstruction(HInstruction* current);
2375
2376 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
2377 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
2378 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2379 LInstruction* DoArithmeticD(Token::Value op,
2380 HArithmeticBinaryOperation* instr);
2381 LInstruction* DoArithmeticT(Token::Value op,
2382 HArithmeticBinaryOperation* instr);
2383
2384 LChunk* chunk_;
2385 CompilationInfo* info_;
2386 HGraph* const graph_;
ulan@chromium.org812308e2012-02-29 15:58:45 +00002387 Zone* zone_;
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002388 Status status_;
2389 HInstruction* current_instruction_;
2390 HBasicBlock* current_block_;
2391 HBasicBlock* next_block_;
2392 int argument_count_;
2393 LAllocator* allocator_;
2394 int position_;
2395 LInstruction* instruction_pending_deoptimization_environment_;
2396 int pending_deoptimization_ast_id_;
2397
lrn@chromium.org7516f052011-03-30 08:52:27 +00002398 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2399};
2400
jkummerow@chromium.orgc3b37122011-11-07 10:14:12 +00002401#undef DECLARE_HYDROGEN_ACCESSOR
2402#undef DECLARE_CONCRETE_INSTRUCTION
lrn@chromium.org7516f052011-03-30 08:52:27 +00002403
2404} } // namespace v8::internal
2405
2406#endif // V8_MIPS_LITHIUM_MIPS_H_