blob: 51706472258beb38902e4aebcc72664540a5af35 [file] [log] [blame]
Ben Murdoch086aeea2011-05-13 15:57:08 +01001// Copyright 2011 the V8 project authors. All rights reserved.
Ben Murdochb0fe1622011-05-05 13:52:32 +01002// 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_IA32_LITHIUM_IA32_H_
29#define V8_IA32_LITHIUM_IA32_H_
30
31#include "hydrogen.h"
32#include "lithium-allocator.h"
Ben Murdoch086aeea2011-05-13 15:57:08 +010033#include "lithium.h"
Ben Murdochb0fe1622011-05-05 13:52:32 +010034#include "safepoint-table.h"
Ben Murdoch3fb3ca82011-12-02 17:19:32 +000035#include "utils.h"
Ben Murdochb0fe1622011-05-05 13:52:32 +010036
37namespace v8 {
38namespace internal {
39
40// Forward declarations.
41class LCodeGen;
Ben Murdochb0fe1622011-05-05 13:52:32 +010042
Ben Murdochb0fe1622011-05-05 13:52:32 +010043#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
44 V(AccessArgumentsAt) \
45 V(AddI) \
46 V(ApplyArguments) \
47 V(ArgumentsElements) \
48 V(ArgumentsLength) \
49 V(ArithmeticD) \
50 V(ArithmeticT) \
Ben Murdochb0fe1622011-05-05 13:52:32 +010051 V(ArrayLiteral) \
52 V(BitI) \
53 V(BitNotI) \
54 V(BoundsCheck) \
55 V(Branch) \
56 V(CallConstantFunction) \
57 V(CallFunction) \
58 V(CallGlobal) \
59 V(CallKeyed) \
60 V(CallKnownGlobal) \
61 V(CallNamed) \
62 V(CallNew) \
63 V(CallRuntime) \
64 V(CallStub) \
65 V(CheckFunction) \
66 V(CheckInstanceType) \
67 V(CheckMap) \
Steve Block44f0eee2011-05-26 01:26:41 +010068 V(CheckNonSmi) \
Ben Murdochb0fe1622011-05-05 13:52:32 +010069 V(CheckPrototypeMaps) \
70 V(CheckSmi) \
Ben Murdoch257744e2011-11-30 15:57:28 +000071 V(ClampDToUint8) \
72 V(ClampIToUint8) \
73 V(ClampTToUint8) \
Steve Block1e0659c2011-05-24 12:43:12 +010074 V(ClassOfTestAndBranch) \
Ben Murdochb0fe1622011-05-05 13:52:32 +010075 V(CmpIDAndBranch) \
Ben Murdoch3fb3ca82011-12-02 17:19:32 +000076 V(CmpObjectEqAndBranch) \
Ben Murdochb0fe1622011-05-05 13:52:32 +010077 V(CmpMapAndBranch) \
78 V(CmpT) \
Ben Murdoch3fb3ca82011-12-02 17:19:32 +000079 V(CmpConstantEqAndBranch) \
Ben Murdochb0fe1622011-05-05 13:52:32 +010080 V(ConstantD) \
81 V(ConstantI) \
82 V(ConstantT) \
Steve Block1e0659c2011-05-24 12:43:12 +010083 V(Context) \
Ben Murdochb0fe1622011-05-05 13:52:32 +010084 V(DeleteProperty) \
85 V(Deoptimize) \
86 V(DivI) \
87 V(DoubleToI) \
Ben Murdoch3fb3ca82011-12-02 17:19:32 +000088 V(ElementsKind) \
Ben Murdoch69a99ed2011-11-30 16:03:39 +000089 V(FixedArrayBaseLength) \
Ben Murdochb0fe1622011-05-05 13:52:32 +010090 V(FunctionLiteral) \
Ben Murdoche0cee9b2011-05-25 10:26:03 +010091 V(GetCachedArrayIndex) \
Ben Murdochb0fe1622011-05-05 13:52:32 +010092 V(GlobalObject) \
93 V(GlobalReceiver) \
94 V(Goto) \
Steve Block1e0659c2011-05-24 12:43:12 +010095 V(HasCachedArrayIndexAndBranch) \
Steve Block1e0659c2011-05-24 12:43:12 +010096 V(HasInstanceTypeAndBranch) \
Ben Murdoch257744e2011-11-30 15:57:28 +000097 V(In) \
Ben Murdochb0fe1622011-05-05 13:52:32 +010098 V(InstanceOf) \
Ben Murdoch086aeea2011-05-13 15:57:08 +010099 V(InstanceOfKnownGlobal) \
Ben Murdoch257744e2011-11-30 15:57:28 +0000100 V(InstructionGap) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100101 V(Integer32ToDouble) \
Ben Murdoch257744e2011-11-30 15:57:28 +0000102 V(InvokeFunction) \
Ben Murdoch257744e2011-11-30 15:57:28 +0000103 V(IsConstructCallAndBranch) \
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000104 V(IsNilAndBranch) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100105 V(IsObjectAndBranch) \
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000106 V(IsStringAndBranch) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100107 V(IsSmiAndBranch) \
Ben Murdoch257744e2011-11-30 15:57:28 +0000108 V(IsUndetectableAndBranch) \
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000109 V(StringCompareAndBranch) \
Steve Block9fac8402011-05-12 15:51:54 +0100110 V(JSArrayLength) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100111 V(Label) \
112 V(LazyBailout) \
Ben Murdochb8e0da22011-05-16 14:20:40 +0100113 V(LoadContextSlot) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100114 V(LoadElements) \
Steve Block44f0eee2011-05-26 01:26:41 +0100115 V(LoadExternalArrayPointer) \
Steve Block1e0659c2011-05-24 12:43:12 +0100116 V(LoadFunctionPrototype) \
Ben Murdoch8b112d22011-06-08 16:22:53 +0100117 V(LoadGlobalCell) \
118 V(LoadGlobalGeneric) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100119 V(LoadKeyedFastElement) \
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000120 V(LoadKeyedFastDoubleElement) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100121 V(LoadKeyedGeneric) \
Steve Block44f0eee2011-05-26 01:26:41 +0100122 V(LoadKeyedSpecializedArrayElement) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100123 V(LoadNamedField) \
Steve Block44f0eee2011-05-26 01:26:41 +0100124 V(LoadNamedFieldPolymorphic) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100125 V(LoadNamedGeneric) \
126 V(ModI) \
127 V(MulI) \
128 V(NumberTagD) \
129 V(NumberTagI) \
130 V(NumberUntagD) \
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000131 V(ObjectLiteralFast) \
132 V(ObjectLiteralGeneric) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100133 V(OsrEntry) \
Steve Block1e0659c2011-05-24 12:43:12 +0100134 V(OuterContext) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100135 V(Parameter) \
136 V(Power) \
137 V(PushArgument) \
138 V(RegExpLiteral) \
139 V(Return) \
140 V(ShiftI) \
141 V(SmiTag) \
142 V(SmiUntag) \
143 V(StackCheck) \
Steve Block1e0659c2011-05-24 12:43:12 +0100144 V(StoreContextSlot) \
Ben Murdoch8b112d22011-06-08 16:22:53 +0100145 V(StoreGlobalCell) \
146 V(StoreGlobalGeneric) \
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000147 V(StoreKeyedFastDoubleElement) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100148 V(StoreKeyedFastElement) \
149 V(StoreKeyedGeneric) \
Steve Block44f0eee2011-05-26 01:26:41 +0100150 V(StoreKeyedSpecializedArrayElement) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100151 V(StoreNamedField) \
152 V(StoreNamedGeneric) \
Ben Murdoch257744e2011-11-30 15:57:28 +0000153 V(StringAdd) \
Steve Block1e0659c2011-05-24 12:43:12 +0100154 V(StringCharCodeAt) \
Steve Block44f0eee2011-05-26 01:26:41 +0100155 V(StringCharFromCode) \
Steve Block1e0659c2011-05-24 12:43:12 +0100156 V(StringLength) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100157 V(SubI) \
158 V(TaggedToI) \
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000159 V(ThisFunction) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100160 V(Throw) \
Steve Block44f0eee2011-05-26 01:26:41 +0100161 V(ToFastProperties) \
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000162 V(TransitionElementsKind) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100163 V(Typeof) \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100164 V(TypeofIsAndBranch) \
165 V(UnaryMathOperation) \
166 V(UnknownOSRValue) \
167 V(ValueOf)
168
169
Ben Murdoch257744e2011-11-30 15:57:28 +0000170#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
171 virtual Opcode opcode() const { return LInstruction::k##type; } \
172 virtual void CompileToNative(LCodeGen* generator); \
173 virtual const char* Mnemonic() const { return mnemonic; } \
174 static L##type* cast(LInstruction* instr) { \
175 ASSERT(instr->Is##type()); \
176 return reinterpret_cast<L##type*>(instr); \
Ben Murdochb0fe1622011-05-05 13:52:32 +0100177 }
178
179
Ben Murdochb0fe1622011-05-05 13:52:32 +0100180#define DECLARE_HYDROGEN_ACCESSOR(type) \
181 H##type* hydrogen() const { \
182 return H##type::cast(hydrogen_value()); \
183 }
184
185
186class LInstruction: public ZoneObject {
187 public:
188 LInstruction()
Steve Block1e0659c2011-05-24 12:43:12 +0100189 : environment_(NULL),
190 hydrogen_value_(NULL),
191 is_call_(false),
192 is_save_doubles_(false) { }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100193 virtual ~LInstruction() { }
194
195 virtual void CompileToNative(LCodeGen* generator) = 0;
196 virtual const char* Mnemonic() const = 0;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100197 virtual void PrintTo(StringStream* stream);
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000198 virtual void PrintDataTo(StringStream* stream);
199 virtual void PrintOutputOperandTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100200
Ben Murdoch257744e2011-11-30 15:57:28 +0000201 enum Opcode {
202 // Declare a unique enum value for each instruction.
203#define DECLARE_OPCODE(type) k##type,
204 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
205 kNumberOfInstructions
206#undef DECLARE_OPCODE
207 };
208
209 virtual Opcode opcode() const = 0;
210
211 // Declare non-virtual type testers for all leaf IR classes.
212#define DECLARE_PREDICATE(type) \
213 bool Is##type() const { return opcode() == k##type; }
214 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
215#undef DECLARE_PREDICATE
216
217 // Declare virtual predicates for instructions that don't have
218 // an opcode.
219 virtual bool IsGap() const { return false; }
Ben Murdochb8e0da22011-05-16 14:20:40 +0100220
Ben Murdochb0fe1622011-05-05 13:52:32 +0100221 virtual bool IsControl() const { return false; }
222
Steve Block1e0659c2011-05-24 12:43:12 +0100223 void set_environment(LEnvironment* env) { environment_ = env; }
224 LEnvironment* environment() const { return environment_; }
225 bool HasEnvironment() const { return environment_ != NULL; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100226
227 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
228 LPointerMap* pointer_map() const { return pointer_map_.get(); }
229 bool HasPointerMap() const { return pointer_map_.is_set(); }
230
Ben Murdochb0fe1622011-05-05 13:52:32 +0100231
232 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
233 HValue* hydrogen_value() const { return hydrogen_value_; }
234
235 void set_deoptimization_environment(LEnvironment* env) {
236 deoptimization_environment_.set(env);
237 }
238 LEnvironment* deoptimization_environment() const {
239 return deoptimization_environment_.get();
240 }
241 bool HasDeoptimizationEnvironment() const {
242 return deoptimization_environment_.is_set();
243 }
244
Steve Block1e0659c2011-05-24 12:43:12 +0100245 void MarkAsCall() { is_call_ = true; }
246 void MarkAsSaveDoubles() { is_save_doubles_ = true; }
247
248 // Interface to the register allocator and iterators.
249 bool IsMarkedAsCall() const { return is_call_; }
250 bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; }
251
252 virtual bool HasResult() const = 0;
253 virtual LOperand* result() = 0;
254
255 virtual int InputCount() = 0;
256 virtual LOperand* InputAt(int i) = 0;
257 virtual int TempCount() = 0;
258 virtual LOperand* TempAt(int i) = 0;
259
260 LOperand* FirstInput() { return InputAt(0); }
261 LOperand* Output() { return HasResult() ? result() : NULL; }
262
263#ifdef DEBUG
264 void VerifyCall();
265#endif
266
Ben Murdochb0fe1622011-05-05 13:52:32 +0100267 private:
Steve Block1e0659c2011-05-24 12:43:12 +0100268 LEnvironment* environment_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100269 SetOncePointer<LPointerMap> pointer_map_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100270 HValue* hydrogen_value_;
271 SetOncePointer<LEnvironment> deoptimization_environment_;
Steve Block1e0659c2011-05-24 12:43:12 +0100272 bool is_call_;
273 bool is_save_doubles_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100274};
275
276
Steve Block1e0659c2011-05-24 12:43:12 +0100277// R = number of result operands (0 or 1).
278// I = number of input operands.
279// T = number of temporary operands.
280template<int R, int I, int T>
Ben Murdochb8e0da22011-05-16 14:20:40 +0100281class LTemplateInstruction: public LInstruction {
282 public:
283 // Allow 0 or 1 output operands.
284 STATIC_ASSERT(R == 0 || R == 1);
285 virtual bool HasResult() const { return R != 0; }
286 void set_result(LOperand* operand) { results_[0] = operand; }
287 LOperand* result() { return results_[0]; }
288
289 int InputCount() { return I; }
290 LOperand* InputAt(int i) { return inputs_[i]; }
291
292 int TempCount() { return T; }
293 LOperand* TempAt(int i) { return temps_[i]; }
294
Ben Murdochb8e0da22011-05-16 14:20:40 +0100295 protected:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000296 EmbeddedContainer<LOperand*, R> results_;
297 EmbeddedContainer<LOperand*, I> inputs_;
298 EmbeddedContainer<LOperand*, T> temps_;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100299};
300
301
302class LGap: public LTemplateInstruction<0, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100303 public:
Ben Murdoch257744e2011-11-30 15:57:28 +0000304 explicit LGap(HBasicBlock* block) : block_(block) {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100305 parallel_moves_[BEFORE] = NULL;
306 parallel_moves_[START] = NULL;
307 parallel_moves_[END] = NULL;
308 parallel_moves_[AFTER] = NULL;
309 }
310
Ben Murdoch257744e2011-11-30 15:57:28 +0000311 // Can't use the DECLARE-macro here because of sub-classes.
312 virtual bool IsGap() const { return true; }
Ben Murdochb8e0da22011-05-16 14:20:40 +0100313 virtual void PrintDataTo(StringStream* stream);
Ben Murdoch257744e2011-11-30 15:57:28 +0000314 static LGap* cast(LInstruction* instr) {
315 ASSERT(instr->IsGap());
316 return reinterpret_cast<LGap*>(instr);
317 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100318
319 bool IsRedundant() const;
320
321 HBasicBlock* block() const { return block_; }
322
323 enum InnerPosition {
324 BEFORE,
325 START,
326 END,
327 AFTER,
328 FIRST_INNER_POSITION = BEFORE,
329 LAST_INNER_POSITION = AFTER
330 };
331
332 LParallelMove* GetOrCreateParallelMove(InnerPosition pos) {
333 if (parallel_moves_[pos] == NULL) parallel_moves_[pos] = new LParallelMove;
334 return parallel_moves_[pos];
335 }
336
337 LParallelMove* GetParallelMove(InnerPosition pos) {
338 return parallel_moves_[pos];
339 }
340
341 private:
342 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
343 HBasicBlock* block_;
344};
345
346
Ben Murdoch257744e2011-11-30 15:57:28 +0000347class LInstructionGap: public LGap {
348 public:
349 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { }
350
351 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap")
352};
353
354
Ben Murdochb8e0da22011-05-16 14:20:40 +0100355class LGoto: public LTemplateInstruction<0, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100356 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000357 explicit LGoto(int block_id) : block_id_(block_id) { }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100358
359 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
Ben Murdochb8e0da22011-05-16 14:20:40 +0100360 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100361 virtual bool IsControl() const { return true; }
362
363 int block_id() const { return block_id_; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100364
365 private:
366 int block_id_;
Ben Murdochb0fe1622011-05-05 13:52:32 +0100367};
368
369
Ben Murdochb8e0da22011-05-16 14:20:40 +0100370class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100371 public:
Ben Murdochb0fe1622011-05-05 13:52:32 +0100372 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
Ben Murdochb0fe1622011-05-05 13:52:32 +0100373};
374
375
Ben Murdochb8e0da22011-05-16 14:20:40 +0100376class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100377 public:
378 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
379};
380
381
382class LLabel: public LGap {
383 public:
384 explicit LLabel(HBasicBlock* block)
385 : LGap(block), replacement_(NULL) { }
386
387 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
388
Ben Murdochb8e0da22011-05-16 14:20:40 +0100389 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100390
391 int block_id() const { return block()->block_id(); }
392 bool is_loop_header() const { return block()->IsLoopHeader(); }
393 Label* label() { return &label_; }
394 LLabel* replacement() const { return replacement_; }
395 void set_replacement(LLabel* label) { replacement_ = label; }
396 bool HasReplacement() const { return replacement_ != NULL; }
397
398 private:
399 Label label_;
400 LLabel* replacement_;
401};
402
403
Ben Murdochb8e0da22011-05-16 14:20:40 +0100404class LParameter: public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100405 public:
406 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
407};
408
409
Steve Block1e0659c2011-05-24 12:43:12 +0100410class LCallStub: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100411 public:
Steve Block1e0659c2011-05-24 12:43:12 +0100412 explicit LCallStub(LOperand* context) {
413 inputs_[0] = context;
414 }
415
Ben Murdochb0fe1622011-05-05 13:52:32 +0100416 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
417 DECLARE_HYDROGEN_ACCESSOR(CallStub)
418
Steve Block1e0659c2011-05-24 12:43:12 +0100419 LOperand* context() { return inputs_[0]; }
420
Ben Murdochb0fe1622011-05-05 13:52:32 +0100421 TranscendentalCache::Type transcendental_type() {
422 return hydrogen()->transcendental_type();
423 }
424};
425
426
Ben Murdochb8e0da22011-05-16 14:20:40 +0100427class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100428 public:
429 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
430};
431
432
Steve Block1e0659c2011-05-24 12:43:12 +0100433template<int I, int T>
Ben Murdochb8e0da22011-05-16 14:20:40 +0100434class LControlInstruction: public LTemplateInstruction<0, I, T> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100435 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100436 virtual bool IsControl() const { return true; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100437
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000438 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
439 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
440 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); }
441 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100442
443 private:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000444 HControlInstruction* hydrogen() {
445 return HControlInstruction::cast(this->hydrogen_value());
446 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100447};
448
449
Steve Block1e0659c2011-05-24 12:43:12 +0100450class LApplyArguments: public LTemplateInstruction<1, 4, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100451 public:
452 LApplyArguments(LOperand* function,
453 LOperand* receiver,
454 LOperand* length,
Steve Block1e0659c2011-05-24 12:43:12 +0100455 LOperand* elements,
456 LOperand* temp) {
Ben Murdochb8e0da22011-05-16 14:20:40 +0100457 inputs_[0] = function;
458 inputs_[1] = receiver;
459 inputs_[2] = length;
460 inputs_[3] = elements;
Steve Block1e0659c2011-05-24 12:43:12 +0100461 temps_[0] = temp;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100462 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100463
464 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
465
Ben Murdochb8e0da22011-05-16 14:20:40 +0100466 LOperand* function() { return inputs_[0]; }
467 LOperand* receiver() { return inputs_[1]; }
468 LOperand* length() { return inputs_[2]; }
469 LOperand* elements() { return inputs_[3]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100470};
471
472
Ben Murdochb8e0da22011-05-16 14:20:40 +0100473class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100474 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100475 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
476 inputs_[0] = arguments;
477 inputs_[1] = length;
478 inputs_[2] = index;
479 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100480
481 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
482
Ben Murdochb8e0da22011-05-16 14:20:40 +0100483 LOperand* arguments() { return inputs_[0]; }
484 LOperand* length() { return inputs_[1]; }
485 LOperand* index() { return inputs_[2]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100486
Ben Murdochb8e0da22011-05-16 14:20:40 +0100487 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100488};
489
490
Steve Block1e0659c2011-05-24 12:43:12 +0100491class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100492 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100493 explicit LArgumentsLength(LOperand* elements) {
494 inputs_[0] = elements;
495 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100496
497 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
498};
499
500
Ben Murdochb8e0da22011-05-16 14:20:40 +0100501class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100502 public:
503 LArgumentsElements() { }
504
505 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
506};
507
508
Ben Murdochb8e0da22011-05-16 14:20:40 +0100509class LModI: public LTemplateInstruction<1, 2, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100510 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100511 LModI(LOperand* left, LOperand* right, LOperand* temp) {
512 inputs_[0] = left;
513 inputs_[1] = right;
514 temps_[0] = temp;
515 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100516
517 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
518 DECLARE_HYDROGEN_ACCESSOR(Mod)
519};
520
521
Ben Murdochb8e0da22011-05-16 14:20:40 +0100522class LDivI: public LTemplateInstruction<1, 2, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100523 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100524 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
525 inputs_[0] = left;
526 inputs_[1] = right;
527 temps_[0] = temp;
528 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100529
530 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
531 DECLARE_HYDROGEN_ACCESSOR(Div)
532};
533
534
Ben Murdochb8e0da22011-05-16 14:20:40 +0100535class LMulI: public LTemplateInstruction<1, 2, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100536 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100537 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
538 inputs_[0] = left;
539 inputs_[1] = right;
540 temps_[0] = temp;
541 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100542
543 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
544 DECLARE_HYDROGEN_ACCESSOR(Mul)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100545};
546
547
Steve Block1e0659c2011-05-24 12:43:12 +0100548class LCmpIDAndBranch: public LControlInstruction<2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100549 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100550 LCmpIDAndBranch(LOperand* left, LOperand* right) {
551 inputs_[0] = left;
552 inputs_[1] = right;
553 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100554
555 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000556 DECLARE_HYDROGEN_ACCESSOR(CompareIDAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100557
Ben Murdochb8e0da22011-05-16 14:20:40 +0100558 Token::Value op() const { return hydrogen()->token(); }
559 bool is_double() const {
560 return hydrogen()->GetInputRepresentation().IsDouble();
561 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100562
Ben Murdochb8e0da22011-05-16 14:20:40 +0100563 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100564};
565
566
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000567class LUnaryMathOperation: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100568 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000569 LUnaryMathOperation(LOperand* context, LOperand* value) {
570 inputs_[1] = context;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100571 inputs_[0] = value;
572 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100573
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000574 LOperand* context() { return inputs_[1]; }
575 LOperand* value() { return inputs_[0]; }
576
Ben Murdochb0fe1622011-05-05 13:52:32 +0100577 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
578 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
579
Ben Murdochb8e0da22011-05-16 14:20:40 +0100580 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100581 BuiltinFunctionId op() const { return hydrogen()->op(); }
582};
583
584
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000585class LCmpObjectEqAndBranch: public LControlInstruction<2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100586 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000587 LCmpObjectEqAndBranch(LOperand* left, LOperand* right) {
Ben Murdochb8e0da22011-05-16 14:20:40 +0100588 inputs_[0] = left;
589 inputs_[1] = right;
590 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100591
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000592 DECLARE_CONCRETE_INSTRUCTION(CmpObjectEqAndBranch,
593 "cmp-object-eq-and-branch")
Ben Murdochb0fe1622011-05-05 13:52:32 +0100594};
595
596
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000597class LCmpConstantEqAndBranch: public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100598 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000599 explicit LCmpConstantEqAndBranch(LOperand* left) {
Ben Murdochb8e0da22011-05-16 14:20:40 +0100600 inputs_[0] = left;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100601 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100602
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000603 DECLARE_CONCRETE_INSTRUCTION(CmpConstantEqAndBranch,
604 "cmp-constant-eq-and-branch")
605 DECLARE_HYDROGEN_ACCESSOR(CompareConstantEqAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100606};
607
608
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000609class LIsNilAndBranch: public LControlInstruction<1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100610 public:
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000611 LIsNilAndBranch(LOperand* value, LOperand* temp) {
Ben Murdochb8e0da22011-05-16 14:20:40 +0100612 inputs_[0] = value;
613 temps_[0] = temp;
614 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100615
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000616 DECLARE_CONCRETE_INSTRUCTION(IsNilAndBranch, "is-nil-and-branch")
617 DECLARE_HYDROGEN_ACCESSOR(IsNilAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100618
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000619 EqualityKind kind() const { return hydrogen()->kind(); }
620 NilValue nil() const { return hydrogen()->nil(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100621
Ben Murdochb8e0da22011-05-16 14:20:40 +0100622 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100623};
624
625
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000626class LIsObjectAndBranch: public LControlInstruction<1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100627 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000628 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
Ben Murdochb8e0da22011-05-16 14:20:40 +0100629 inputs_[0] = value;
630 temps_[0] = temp;
631 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100632
Ben Murdochb0fe1622011-05-05 13:52:32 +0100633 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
Ben Murdochb0fe1622011-05-05 13:52:32 +0100634
Ben Murdochb8e0da22011-05-16 14:20:40 +0100635 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100636};
637
638
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000639class LIsStringAndBranch: public LControlInstruction<1, 1> {
640 public:
641 LIsStringAndBranch(LOperand* value, LOperand* temp) {
642 inputs_[0] = value;
643 temps_[0] = temp;
644 }
645
646 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch, "is-string-and-branch")
647
648 virtual void PrintDataTo(StringStream* stream);
649};
650
651
Steve Block1e0659c2011-05-24 12:43:12 +0100652class LIsSmiAndBranch: public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100653 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100654 explicit LIsSmiAndBranch(LOperand* value) {
655 inputs_[0] = value;
656 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100657
658 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000659 DECLARE_HYDROGEN_ACCESSOR(IsSmiAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100660
Ben Murdochb8e0da22011-05-16 14:20:40 +0100661 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100662};
663
664
Ben Murdoch257744e2011-11-30 15:57:28 +0000665class LIsUndetectableAndBranch: public LControlInstruction<1, 1> {
666 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000667 LIsUndetectableAndBranch(LOperand* value, LOperand* temp) {
Ben Murdoch257744e2011-11-30 15:57:28 +0000668 inputs_[0] = value;
669 temps_[0] = temp;
670 }
671
672 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch,
673 "is-undetectable-and-branch")
674
675 virtual void PrintDataTo(StringStream* stream);
676};
677
678
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000679class LStringCompareAndBranch: public LControlInstruction<3, 0> {
680 public:
681 LStringCompareAndBranch(LOperand* context, LOperand* left, LOperand* right) {
682 inputs_[0] = context;
683 inputs_[1] = left;
684 inputs_[2] = right;
685 }
686
687 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
688 "string-compare-and-branch")
689 DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
690
691 virtual void PrintDataTo(StringStream* stream);
692
693 Token::Value op() const { return hydrogen()->token(); }
694};
695
696
Ben Murdochb8e0da22011-05-16 14:20:40 +0100697class LHasInstanceTypeAndBranch: public LControlInstruction<1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100698 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100699 LHasInstanceTypeAndBranch(LOperand* value, LOperand* temp) {
700 inputs_[0] = value;
701 temps_[0] = temp;
702 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100703
704 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
705 "has-instance-type-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000706 DECLARE_HYDROGEN_ACCESSOR(HasInstanceTypeAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100707
Ben Murdochb8e0da22011-05-16 14:20:40 +0100708 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100709};
710
711
Ben Murdoche0cee9b2011-05-25 10:26:03 +0100712class LGetCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
713 public:
714 explicit LGetCachedArrayIndex(LOperand* value) {
715 inputs_[0] = value;
716 }
717
718 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get-cached-array-index")
719 DECLARE_HYDROGEN_ACCESSOR(GetCachedArrayIndex)
720};
721
722
Steve Block1e0659c2011-05-24 12:43:12 +0100723class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100724 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100725 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
726 inputs_[0] = value;
727 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100728
729 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
730 "has-cached-array-index-and-branch")
Ben Murdochb8e0da22011-05-16 14:20:40 +0100731 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100732};
733
734
Steve Block1e0659c2011-05-24 12:43:12 +0100735class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
736 public:
737 explicit LIsConstructCallAndBranch(LOperand* temp) {
738 temps_[0] = temp;
739 }
740
741 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
742 "is-construct-call-and-branch")
743};
744
745
Ben Murdochb8e0da22011-05-16 14:20:40 +0100746class LClassOfTestAndBranch: public LControlInstruction<1, 2> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100747 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100748 LClassOfTestAndBranch(LOperand* value, LOperand* temp, LOperand* temp2) {
749 inputs_[0] = value;
750 temps_[0] = temp;
751 temps_[1] = temp2;
752 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100753
754 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
755 "class-of-test-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000756 DECLARE_HYDROGEN_ACCESSOR(ClassOfTestAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100757
Ben Murdochb8e0da22011-05-16 14:20:40 +0100758 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100759};
760
761
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000762class LCmpT: public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100763 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000764 LCmpT(LOperand* context, LOperand* left, LOperand* right) {
765 inputs_[0] = context;
766 inputs_[1] = left;
767 inputs_[2] = right;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100768 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100769
770 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000771 DECLARE_HYDROGEN_ACCESSOR(CompareGeneric)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100772
Ben Murdochb8e0da22011-05-16 14:20:40 +0100773 Token::Value op() const { return hydrogen()->token(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100774};
775
776
Steve Block1e0659c2011-05-24 12:43:12 +0100777class LInstanceOf: public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100778 public:
Steve Block1e0659c2011-05-24 12:43:12 +0100779 LInstanceOf(LOperand* context, LOperand* left, LOperand* right) {
780 inputs_[0] = context;
781 inputs_[1] = left;
782 inputs_[2] = right;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100783 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100784
785 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
Steve Block1e0659c2011-05-24 12:43:12 +0100786
787 LOperand* context() { return inputs_[0]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100788};
789
790
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000791class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 2, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100792 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000793 LInstanceOfKnownGlobal(LOperand* context, LOperand* value, LOperand* temp) {
Steve Block1e0659c2011-05-24 12:43:12 +0100794 inputs_[0] = context;
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000795 inputs_[1] = value;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100796 temps_[0] = temp;
797 }
Ben Murdoch086aeea2011-05-13 15:57:08 +0100798
799 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
800 "instance-of-known-global")
801 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
802
803 Handle<JSFunction> function() const { return hydrogen()->function(); }
Ben Murdoch086aeea2011-05-13 15:57:08 +0100804};
805
806
Ben Murdochb8e0da22011-05-16 14:20:40 +0100807class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100808 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100809 LBoundsCheck(LOperand* index, LOperand* length) {
810 inputs_[0] = index;
811 inputs_[1] = length;
812 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100813
Ben Murdochb8e0da22011-05-16 14:20:40 +0100814 LOperand* index() { return inputs_[0]; }
815 LOperand* length() { return inputs_[1]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100816
817 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
818};
819
820
Steve Block1e0659c2011-05-24 12:43:12 +0100821class LBitI: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100822 public:
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000823 LBitI(LOperand* left, LOperand* right) {
Ben Murdochb8e0da22011-05-16 14:20:40 +0100824 inputs_[0] = left;
825 inputs_[1] = right;
826 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100827
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000828 Token::Value op() const { return hydrogen()->op(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100829
830 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
Ben Murdoch592a9fc2012-03-05 11:04:45 +0000831 DECLARE_HYDROGEN_ACCESSOR(Bitwise)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100832};
833
834
Steve Block1e0659c2011-05-24 12:43:12 +0100835class LShiftI: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100836 public:
837 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
Ben Murdochb8e0da22011-05-16 14:20:40 +0100838 : op_(op), can_deopt_(can_deopt) {
839 inputs_[0] = left;
840 inputs_[1] = right;
841 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100842
843 Token::Value op() const { return op_; }
844
845 bool can_deopt() const { return can_deopt_; }
846
847 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
848
849 private:
850 Token::Value op_;
851 bool can_deopt_;
852};
853
854
Steve Block1e0659c2011-05-24 12:43:12 +0100855class LSubI: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100856 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100857 LSubI(LOperand* left, LOperand* right) {
858 inputs_[0] = left;
859 inputs_[1] = right;
860 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100861
862 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
863 DECLARE_HYDROGEN_ACCESSOR(Sub)
864};
865
866
Steve Block1e0659c2011-05-24 12:43:12 +0100867class LConstantI: public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100868 public:
Ben Murdochb0fe1622011-05-05 13:52:32 +0100869 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
Steve Block1e0659c2011-05-24 12:43:12 +0100870 DECLARE_HYDROGEN_ACCESSOR(Constant)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100871
Steve Block1e0659c2011-05-24 12:43:12 +0100872 int32_t value() const { return hydrogen()->Integer32Value(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100873};
874
875
Steve Block1e0659c2011-05-24 12:43:12 +0100876class LConstantD: public LTemplateInstruction<1, 0, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100877 public:
Steve Block1e0659c2011-05-24 12:43:12 +0100878 explicit LConstantD(LOperand* temp) {
879 temps_[0] = temp;
880 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100881
882 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
Steve Block1e0659c2011-05-24 12:43:12 +0100883 DECLARE_HYDROGEN_ACCESSOR(Constant)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100884
Steve Block1e0659c2011-05-24 12:43:12 +0100885 double value() const { return hydrogen()->DoubleValue(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100886};
887
888
Steve Block1e0659c2011-05-24 12:43:12 +0100889class LConstantT: public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100890 public:
Ben Murdochb0fe1622011-05-05 13:52:32 +0100891 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
Steve Block1e0659c2011-05-24 12:43:12 +0100892 DECLARE_HYDROGEN_ACCESSOR(Constant)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100893
Steve Block1e0659c2011-05-24 12:43:12 +0100894 Handle<Object> value() const { return hydrogen()->handle(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100895};
896
897
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000898class LBranch: public LControlInstruction<1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100899 public:
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000900 explicit LBranch(LOperand* value, LOperand* temp) {
Ben Murdochb8e0da22011-05-16 14:20:40 +0100901 inputs_[0] = value;
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000902 temps_[0] = temp;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100903 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100904
905 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000906 DECLARE_HYDROGEN_ACCESSOR(Branch)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100907
Ben Murdochb8e0da22011-05-16 14:20:40 +0100908 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +0100909};
910
911
Steve Block1e0659c2011-05-24 12:43:12 +0100912class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100913 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100914 explicit LCmpMapAndBranch(LOperand* value) {
915 inputs_[0] = value;
916 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100917
918 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
Steve Block1e0659c2011-05-24 12:43:12 +0100919 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100920
921 virtual bool IsControl() const { return true; }
922
Ben Murdoch086aeea2011-05-13 15:57:08 +0100923 Handle<Map> map() const { return hydrogen()->map(); }
924 int true_block_id() const {
Steve Block1e0659c2011-05-24 12:43:12 +0100925 return hydrogen()->FirstSuccessor()->block_id();
Ben Murdoch086aeea2011-05-13 15:57:08 +0100926 }
927 int false_block_id() const {
Steve Block1e0659c2011-05-24 12:43:12 +0100928 return hydrogen()->SecondSuccessor()->block_id();
Ben Murdoch086aeea2011-05-13 15:57:08 +0100929 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100930};
931
932
Steve Block1e0659c2011-05-24 12:43:12 +0100933class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100934 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100935 explicit LJSArrayLength(LOperand* value) {
936 inputs_[0] = value;
937 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100938
Steve Block9fac8402011-05-12 15:51:54 +0100939 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
940 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
941};
Ben Murdochb0fe1622011-05-05 13:52:32 +0100942
Ben Murdochb0fe1622011-05-05 13:52:32 +0100943
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000944class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
Steve Block1e0659c2011-05-24 12:43:12 +0100945 public:
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000946 explicit LFixedArrayBaseLength(LOperand* value) {
Steve Block1e0659c2011-05-24 12:43:12 +0100947 inputs_[0] = value;
948 }
949
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000950 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength,
951 "fixed-array-base-length")
952 DECLARE_HYDROGEN_ACCESSOR(FixedArrayBaseLength)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100953};
954
955
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000956class LElementsKind: public LTemplateInstruction<1, 1, 0> {
957 public:
958 explicit LElementsKind(LOperand* value) {
959 inputs_[0] = value;
960 }
961
962 DECLARE_CONCRETE_INSTRUCTION(ElementsKind, "elements-kind")
963 DECLARE_HYDROGEN_ACCESSOR(ElementsKind)
964};
965
966
Ben Murdochb8e0da22011-05-16 14:20:40 +0100967class LValueOf: public LTemplateInstruction<1, 1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100968 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100969 LValueOf(LOperand* value, LOperand* temp) {
970 inputs_[0] = value;
971 temps_[0] = temp;
972 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100973
974 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
975 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
Ben Murdochb0fe1622011-05-05 13:52:32 +0100976};
977
978
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000979class LThrow: public LTemplateInstruction<0, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100980 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000981 LThrow(LOperand* context, LOperand* value) {
982 inputs_[0] = context;
983 inputs_[1] = value;
Ben Murdochb8e0da22011-05-16 14:20:40 +0100984 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100985
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000986 LOperand* context() { return inputs_[0]; }
987 LOperand* value() { return inputs_[1]; }
988
Ben Murdochb0fe1622011-05-05 13:52:32 +0100989 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
990};
991
992
Steve Block1e0659c2011-05-24 12:43:12 +0100993class LBitNotI: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +0100994 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +0100995 explicit LBitNotI(LOperand* value) {
996 inputs_[0] = value;
997 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100998
999 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1000};
1001
1002
Steve Block1e0659c2011-05-24 12:43:12 +01001003class LAddI: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001004 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001005 LAddI(LOperand* left, LOperand* right) {
1006 inputs_[0] = left;
1007 inputs_[1] = right;
1008 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001009
1010 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1011 DECLARE_HYDROGEN_ACCESSOR(Add)
1012};
1013
1014
Steve Block1e0659c2011-05-24 12:43:12 +01001015class LPower: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001016 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001017 LPower(LOperand* left, LOperand* right) {
1018 inputs_[0] = left;
1019 inputs_[1] = right;
1020 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001021
1022 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1023 DECLARE_HYDROGEN_ACCESSOR(Power)
1024};
1025
1026
Steve Block1e0659c2011-05-24 12:43:12 +01001027class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001028 public:
1029 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
Ben Murdochb8e0da22011-05-16 14:20:40 +01001030 : op_(op) {
1031 inputs_[0] = left;
1032 inputs_[1] = right;
1033 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001034
1035 Token::Value op() const { return op_; }
1036
Ben Murdoch257744e2011-11-30 15:57:28 +00001037 virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001038 virtual void CompileToNative(LCodeGen* generator);
1039 virtual const char* Mnemonic() const;
1040
1041 private:
1042 Token::Value op_;
1043};
1044
1045
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001046class LArithmeticT: public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001047 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001048 LArithmeticT(Token::Value op,
1049 LOperand* context,
1050 LOperand* left,
1051 LOperand* right)
Ben Murdochb8e0da22011-05-16 14:20:40 +01001052 : op_(op) {
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001053 inputs_[0] = context;
1054 inputs_[1] = left;
1055 inputs_[2] = right;
Ben Murdochb8e0da22011-05-16 14:20:40 +01001056 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001057
Ben Murdoch257744e2011-11-30 15:57:28 +00001058 virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001059 virtual void CompileToNative(LCodeGen* generator);
1060 virtual const char* Mnemonic() const;
1061
1062 Token::Value op() const { return op_; }
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001063 LOperand* context() { return inputs_[0]; }
1064 LOperand* left() { return inputs_[1]; }
1065 LOperand* right() { return inputs_[2]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001066
1067 private:
1068 Token::Value op_;
1069};
1070
1071
Steve Block1e0659c2011-05-24 12:43:12 +01001072class LReturn: public LTemplateInstruction<0, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001073 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001074 explicit LReturn(LOperand* value) {
1075 inputs_[0] = value;
1076 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001077
1078 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1079};
1080
1081
Steve Block1e0659c2011-05-24 12:43:12 +01001082class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001083 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001084 explicit LLoadNamedField(LOperand* object) {
1085 inputs_[0] = object;
1086 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001087
1088 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1089 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
Steve Block44f0eee2011-05-26 01:26:41 +01001090
1091 LOperand* object() { return inputs_[0]; }
1092};
1093
1094
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001095class LLoadNamedFieldPolymorphic: public LTemplateInstruction<1, 2, 0> {
Steve Block44f0eee2011-05-26 01:26:41 +01001096 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001097 LLoadNamedFieldPolymorphic(LOperand* context, LOperand* object) {
1098 inputs_[0] = context;
1099 inputs_[1] = object;
Steve Block44f0eee2011-05-26 01:26:41 +01001100 }
1101
1102 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field-polymorphic")
1103 DECLARE_HYDROGEN_ACCESSOR(LoadNamedFieldPolymorphic)
1104
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001105 LOperand* context() { return inputs_[0]; }
1106 LOperand* object() { return inputs_[1]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001107};
1108
1109
Steve Block1e0659c2011-05-24 12:43:12 +01001110class LLoadNamedGeneric: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001111 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001112 LLoadNamedGeneric(LOperand* context, LOperand* object) {
1113 inputs_[0] = context;
1114 inputs_[1] = object;
Ben Murdochb8e0da22011-05-16 14:20:40 +01001115 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001116
1117 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1118 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1119
Steve Block1e0659c2011-05-24 12:43:12 +01001120 LOperand* context() { return inputs_[0]; }
1121 LOperand* object() { return inputs_[1]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001122 Handle<Object> name() const { return hydrogen()->name(); }
1123};
1124
1125
Ben Murdochb8e0da22011-05-16 14:20:40 +01001126class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 1> {
Steve Block9fac8402011-05-12 15:51:54 +01001127 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001128 LLoadFunctionPrototype(LOperand* function, LOperand* temp) {
1129 inputs_[0] = function;
1130 temps_[0] = temp;
1131 }
Steve Block9fac8402011-05-12 15:51:54 +01001132
1133 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1134 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1135
Ben Murdochb8e0da22011-05-16 14:20:40 +01001136 LOperand* function() { return inputs_[0]; }
Steve Block9fac8402011-05-12 15:51:54 +01001137};
1138
1139
Steve Block1e0659c2011-05-24 12:43:12 +01001140class LLoadElements: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001141 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001142 explicit LLoadElements(LOperand* object) {
1143 inputs_[0] = object;
1144 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001145
1146 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1147};
1148
1149
Steve Block44f0eee2011-05-26 01:26:41 +01001150class LLoadExternalArrayPointer: public LTemplateInstruction<1, 1, 0> {
Steve Block1e0659c2011-05-24 12:43:12 +01001151 public:
Steve Block44f0eee2011-05-26 01:26:41 +01001152 explicit LLoadExternalArrayPointer(LOperand* object) {
Steve Block1e0659c2011-05-24 12:43:12 +01001153 inputs_[0] = object;
1154 }
1155
Steve Block44f0eee2011-05-26 01:26:41 +01001156 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer,
1157 "load-external-array-pointer")
Steve Block1e0659c2011-05-24 12:43:12 +01001158};
1159
1160
1161class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001162 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001163 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1164 inputs_[0] = elements;
1165 inputs_[1] = key;
1166 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001167
1168 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1169 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1170
Ben Murdochb8e0da22011-05-16 14:20:40 +01001171 LOperand* elements() { return inputs_[0]; }
1172 LOperand* key() { return inputs_[1]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001173};
1174
1175
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001176class LLoadKeyedFastDoubleElement: public LTemplateInstruction<1, 2, 0> {
1177 public:
1178 LLoadKeyedFastDoubleElement(LOperand* elements,
1179 LOperand* key) {
1180 inputs_[0] = elements;
1181 inputs_[1] = key;
1182 }
1183
1184 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastDoubleElement,
1185 "load-keyed-fast-double-element")
1186 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastDoubleElement)
1187
1188 LOperand* elements() { return inputs_[0]; }
1189 LOperand* key() { return inputs_[1]; }
1190};
1191
1192
Steve Block44f0eee2011-05-26 01:26:41 +01001193class LLoadKeyedSpecializedArrayElement: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001194 public:
Steve Block44f0eee2011-05-26 01:26:41 +01001195 LLoadKeyedSpecializedArrayElement(LOperand* external_pointer,
1196 LOperand* key) {
Steve Block1e0659c2011-05-24 12:43:12 +01001197 inputs_[0] = external_pointer;
Ben Murdochb8e0da22011-05-16 14:20:40 +01001198 inputs_[1] = key;
1199 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001200
Steve Block44f0eee2011-05-26 01:26:41 +01001201 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement,
1202 "load-keyed-specialized-array-element")
1203 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedSpecializedArrayElement)
Steve Block1e0659c2011-05-24 12:43:12 +01001204
1205 LOperand* external_pointer() { return inputs_[0]; }
1206 LOperand* key() { return inputs_[1]; }
Ben Murdoch589d6972011-11-30 16:04:58 +00001207 ElementsKind elements_kind() const {
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001208 return hydrogen()->elements_kind();
Steve Block44f0eee2011-05-26 01:26:41 +01001209 }
Steve Block1e0659c2011-05-24 12:43:12 +01001210};
1211
1212
1213class LLoadKeyedGeneric: public LTemplateInstruction<1, 3, 0> {
1214 public:
1215 LLoadKeyedGeneric(LOperand* context, LOperand* obj, LOperand* key) {
1216 inputs_[0] = context;
1217 inputs_[1] = obj;
1218 inputs_[2] = key;
1219 }
1220
Ben Murdochb0fe1622011-05-05 13:52:32 +01001221 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1222
Steve Block1e0659c2011-05-24 12:43:12 +01001223 LOperand* context() { return inputs_[0]; }
1224 LOperand* object() { return inputs_[1]; }
1225 LOperand* key() { return inputs_[2]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001226};
1227
1228
Ben Murdoch8b112d22011-06-08 16:22:53 +01001229class LLoadGlobalCell: public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001230 public:
Ben Murdoch8b112d22011-06-08 16:22:53 +01001231 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load-global-cell")
1232 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalCell)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001233};
1234
1235
Ben Murdoch8b112d22011-06-08 16:22:53 +01001236class LLoadGlobalGeneric: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001237 public:
Ben Murdoch8b112d22011-06-08 16:22:53 +01001238 LLoadGlobalGeneric(LOperand* context, LOperand* global_object) {
1239 inputs_[0] = context;
1240 inputs_[1] = global_object;
1241 }
1242
1243 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load-global-generic")
1244 DECLARE_HYDROGEN_ACCESSOR(LoadGlobalGeneric)
1245
1246 LOperand* context() { return inputs_[0]; }
1247 LOperand* global_object() { return inputs_[1]; }
1248 Handle<Object> name() const { return hydrogen()->name(); }
1249 bool for_typeof() const { return hydrogen()->for_typeof(); }
1250};
1251
1252
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001253class LStoreGlobalCell: public LTemplateInstruction<0, 1, 2> {
Ben Murdoch8b112d22011-06-08 16:22:53 +01001254 public:
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001255 explicit LStoreGlobalCell(LOperand* value, LOperand* temp1, LOperand* temp2) {
Ben Murdochb8e0da22011-05-16 14:20:40 +01001256 inputs_[0] = value;
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001257 temps_[0] = temp1;
1258 temps_[1] = temp2;
Ben Murdochb8e0da22011-05-16 14:20:40 +01001259 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001260
Ben Murdoch8b112d22011-06-08 16:22:53 +01001261 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
1262 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)
1263};
1264
1265
1266class LStoreGlobalGeneric: public LTemplateInstruction<0, 3, 0> {
1267 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001268 LStoreGlobalGeneric(LOperand* context,
1269 LOperand* global_object,
1270 LOperand* value) {
Ben Murdoch8b112d22011-06-08 16:22:53 +01001271 inputs_[0] = context;
1272 inputs_[1] = global_object;
1273 inputs_[2] = value;
1274 }
1275
1276 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic")
1277 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric)
1278
1279 LOperand* context() { return InputAt(0); }
1280 LOperand* global_object() { return InputAt(1); }
1281 Handle<Object> name() const { return hydrogen()->name(); }
1282 LOperand* value() { return InputAt(2); }
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001283 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001284};
1285
1286
Steve Block1e0659c2011-05-24 12:43:12 +01001287class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001288 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001289 explicit LLoadContextSlot(LOperand* context) {
1290 inputs_[0] = context;
1291 }
1292
Ben Murdochb8e0da22011-05-16 14:20:40 +01001293 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1294 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1295
Steve Block1e0659c2011-05-24 12:43:12 +01001296 LOperand* context() { return InputAt(0); }
Ben Murdochb8e0da22011-05-16 14:20:40 +01001297 int slot_index() { return hydrogen()->slot_index(); }
1298
1299 virtual void PrintDataTo(StringStream* stream);
1300};
1301
1302
Steve Block1e0659c2011-05-24 12:43:12 +01001303class LStoreContextSlot: public LTemplateInstruction<0, 2, 1> {
1304 public:
1305 LStoreContextSlot(LOperand* context, LOperand* value, LOperand* temp) {
1306 inputs_[0] = context;
1307 inputs_[1] = value;
1308 temps_[0] = temp;
1309 }
1310
1311 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1312 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1313
1314 LOperand* context() { return InputAt(0); }
1315 LOperand* value() { return InputAt(1); }
1316 int slot_index() { return hydrogen()->slot_index(); }
Steve Block1e0659c2011-05-24 12:43:12 +01001317
1318 virtual void PrintDataTo(StringStream* stream);
1319};
1320
1321
1322class LPushArgument: public LTemplateInstruction<0, 1, 0> {
Ben Murdochb8e0da22011-05-16 14:20:40 +01001323 public:
1324 explicit LPushArgument(LOperand* value) {
1325 inputs_[0] = value;
1326 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001327
1328 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1329};
1330
1331
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001332class LThisFunction: public LTemplateInstruction<1, 0, 0> {
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001333 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001334 DECLARE_CONCRETE_INSTRUCTION(ThisFunction, "this-function")
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001335 DECLARE_HYDROGEN_ACCESSOR(ThisFunction)
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001336};
1337
1338
Steve Block1e0659c2011-05-24 12:43:12 +01001339class LContext: public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001340 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001341 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
Ben Murdochb0fe1622011-05-05 13:52:32 +01001342};
1343
1344
Steve Block1e0659c2011-05-24 12:43:12 +01001345class LOuterContext: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001346 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001347 explicit LOuterContext(LOperand* context) {
1348 inputs_[0] = context;
1349 }
1350
1351 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
1352
1353 LOperand* context() { return InputAt(0); }
1354};
1355
1356
1357class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1358 public:
1359 explicit LGlobalObject(LOperand* context) {
1360 inputs_[0] = context;
1361 }
1362
1363 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1364
1365 LOperand* context() { return InputAt(0); }
1366};
1367
1368
1369class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1370 public:
1371 explicit LGlobalReceiver(LOperand* global_object) {
1372 inputs_[0] = global_object;
1373 }
1374
Ben Murdochb0fe1622011-05-05 13:52:32 +01001375 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
Steve Block1e0659c2011-05-24 12:43:12 +01001376
1377 LOperand* global() { return InputAt(0); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001378};
1379
1380
Ben Murdochb8e0da22011-05-16 14:20:40 +01001381class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001382 public:
1383 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1384 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1385
Ben Murdochb8e0da22011-05-16 14:20:40 +01001386 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +01001387
Ben Murdochb8e0da22011-05-16 14:20:40 +01001388 Handle<JSFunction> function() { return hydrogen()->function(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001389 int arity() const { return hydrogen()->argument_count() - 1; }
1390};
1391
1392
Ben Murdoch257744e2011-11-30 15:57:28 +00001393class LInvokeFunction: public LTemplateInstruction<1, 2, 0> {
1394 public:
1395 LInvokeFunction(LOperand* context, LOperand* function) {
1396 inputs_[0] = context;
1397 inputs_[1] = function;
1398 }
1399
1400 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction, "invoke-function")
1401 DECLARE_HYDROGEN_ACCESSOR(InvokeFunction)
1402
1403 LOperand* context() { return inputs_[0]; }
1404 LOperand* function() { return inputs_[1]; }
1405
1406 virtual void PrintDataTo(StringStream* stream);
1407
1408 int arity() const { return hydrogen()->argument_count() - 1; }
1409};
1410
1411
Steve Block1e0659c2011-05-24 12:43:12 +01001412class LCallKeyed: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001413 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001414 LCallKeyed(LOperand* context, LOperand* key) {
1415 inputs_[0] = context;
1416 inputs_[1] = key;
Ben Murdochb8e0da22011-05-16 14:20:40 +01001417 }
1418
Ben Murdochb0fe1622011-05-05 13:52:32 +01001419 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1420 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1421
Steve Block1e0659c2011-05-24 12:43:12 +01001422 LOperand* context() { return inputs_[0]; }
1423 LOperand* key() { return inputs_[1]; }
1424
Ben Murdochb8e0da22011-05-16 14:20:40 +01001425 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +01001426
1427 int arity() const { return hydrogen()->argument_count() - 1; }
1428};
1429
1430
Steve Block1e0659c2011-05-24 12:43:12 +01001431class LCallNamed: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001432 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001433 explicit LCallNamed(LOperand* context) {
1434 inputs_[0] = context;
1435 }
1436
Ben Murdochb0fe1622011-05-05 13:52:32 +01001437 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1438 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1439
Ben Murdochb8e0da22011-05-16 14:20:40 +01001440 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +01001441
Steve Block1e0659c2011-05-24 12:43:12 +01001442 LOperand* context() { return inputs_[0]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001443 Handle<String> name() const { return hydrogen()->name(); }
1444 int arity() const { return hydrogen()->argument_count() - 1; }
1445};
1446
1447
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001448class LCallFunction: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001449 public:
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001450 explicit LCallFunction(LOperand* context, LOperand* function) {
Steve Block1e0659c2011-05-24 12:43:12 +01001451 inputs_[0] = context;
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001452 inputs_[1] = function;
Steve Block1e0659c2011-05-24 12:43:12 +01001453 }
1454
Ben Murdochb0fe1622011-05-05 13:52:32 +01001455 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1456 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1457
Steve Block1e0659c2011-05-24 12:43:12 +01001458 LOperand* context() { return inputs_[0]; }
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001459 LOperand* function() { return inputs_[1]; }
1460 int arity() const { return hydrogen()->argument_count() - 1; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001461};
1462
1463
Steve Block1e0659c2011-05-24 12:43:12 +01001464class LCallGlobal: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001465 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001466 explicit LCallGlobal(LOperand* context) {
1467 inputs_[0] = context;
1468 }
1469
Ben Murdochb0fe1622011-05-05 13:52:32 +01001470 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1471 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1472
Ben Murdochb8e0da22011-05-16 14:20:40 +01001473 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +01001474
Steve Block1e0659c2011-05-24 12:43:12 +01001475 LOperand* context() { return inputs_[0]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001476 Handle<String> name() const {return hydrogen()->name(); }
1477 int arity() const { return hydrogen()->argument_count() - 1; }
1478};
1479
1480
Ben Murdochb8e0da22011-05-16 14:20:40 +01001481class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001482 public:
1483 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1484 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1485
Ben Murdochb8e0da22011-05-16 14:20:40 +01001486 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +01001487
1488 Handle<JSFunction> target() const { return hydrogen()->target(); }
1489 int arity() const { return hydrogen()->argument_count() - 1; }
1490};
1491
1492
Steve Block1e0659c2011-05-24 12:43:12 +01001493class LCallNew: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001494 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001495 LCallNew(LOperand* context, LOperand* constructor) {
1496 inputs_[0] = context;
1497 inputs_[1] = constructor;
Ben Murdochb8e0da22011-05-16 14:20:40 +01001498 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001499
1500 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1501 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1502
Ben Murdochb8e0da22011-05-16 14:20:40 +01001503 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +01001504
Steve Block1e0659c2011-05-24 12:43:12 +01001505 LOperand* context() { return inputs_[0]; }
1506 LOperand* constructor() { return inputs_[1]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001507 int arity() const { return hydrogen()->argument_count() - 1; }
1508};
1509
1510
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001511class LCallRuntime: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001512 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001513 explicit LCallRuntime(LOperand* context) {
1514 inputs_[0] = context;
1515 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001516 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1517 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1518
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001519 LOperand* context() { return inputs_[0]; }
Steve Block44f0eee2011-05-26 01:26:41 +01001520 const Runtime::Function* function() const { return hydrogen()->function(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001521 int arity() const { return hydrogen()->argument_count(); }
1522};
1523
1524
Steve Block1e0659c2011-05-24 12:43:12 +01001525class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001526 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001527 explicit LInteger32ToDouble(LOperand* value) {
1528 inputs_[0] = value;
1529 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001530
1531 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1532};
1533
1534
Steve Block1e0659c2011-05-24 12:43:12 +01001535class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001536 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001537 explicit LNumberTagI(LOperand* value) {
1538 inputs_[0] = value;
1539 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001540
1541 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1542};
1543
1544
Ben Murdochb8e0da22011-05-16 14:20:40 +01001545class LNumberTagD: public LTemplateInstruction<1, 1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001546 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001547 LNumberTagD(LOperand* value, LOperand* temp) {
Ben Murdochb8e0da22011-05-16 14:20:40 +01001548 inputs_[0] = value;
1549 temps_[0] = temp;
1550 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001551
1552 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
Ben Murdochb0fe1622011-05-05 13:52:32 +01001553};
1554
1555
1556// Sometimes truncating conversion from a tagged value to an int32.
Ben Murdochb8e0da22011-05-16 14:20:40 +01001557class LDoubleToI: public LTemplateInstruction<1, 1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001558 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001559 LDoubleToI(LOperand* value, LOperand* temp) {
1560 inputs_[0] = value;
1561 temps_[0] = temp;
1562 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001563
1564 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001565 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001566
1567 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1568};
1569
1570
1571// Truncating conversion from a tagged value to an int32.
Ben Murdochb8e0da22011-05-16 14:20:40 +01001572class LTaggedToI: public LTemplateInstruction<1, 1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001573 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001574 LTaggedToI(LOperand* value, LOperand* temp) {
1575 inputs_[0] = value;
1576 temps_[0] = temp;
1577 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001578
1579 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001580 DECLARE_HYDROGEN_ACCESSOR(UnaryOperation)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001581
1582 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001583};
1584
1585
Steve Block1e0659c2011-05-24 12:43:12 +01001586class LSmiTag: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001587 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001588 explicit LSmiTag(LOperand* value) {
1589 inputs_[0] = value;
1590 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001591
1592 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1593};
1594
1595
Steve Block1e0659c2011-05-24 12:43:12 +01001596class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001597 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001598 explicit LNumberUntagD(LOperand* value) {
1599 inputs_[0] = value;
1600 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001601
1602 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
Ben Murdoch7d3e7fc2011-07-12 16:37:06 +01001603 DECLARE_HYDROGEN_ACCESSOR(Change);
Ben Murdochb0fe1622011-05-05 13:52:32 +01001604};
1605
1606
Steve Block1e0659c2011-05-24 12:43:12 +01001607class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001608 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001609 LSmiUntag(LOperand* value, bool needs_check)
1610 : needs_check_(needs_check) {
1611 inputs_[0] = value;
1612 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001613
1614 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1615
1616 bool needs_check() const { return needs_check_; }
1617
1618 private:
1619 bool needs_check_;
1620};
1621
1622
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001623class LStoreNamedField: public LTemplateInstruction<0, 2, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001624 public:
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001625 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) {
Ben Murdochb8e0da22011-05-16 14:20:40 +01001626 inputs_[0] = obj;
1627 inputs_[1] = val;
Ben Murdochb8e0da22011-05-16 14:20:40 +01001628 temps_[0] = temp;
1629 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001630
1631 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
Ben Murdochb8e0da22011-05-16 14:20:40 +01001632 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001633
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001634 virtual void PrintDataTo(StringStream* stream);
1635
1636 LOperand* object() { return inputs_[0]; }
1637 LOperand* value() { return inputs_[1]; }
1638
1639 Handle<Object> name() const { return hydrogen()->name(); }
Ben Murdochb8e0da22011-05-16 14:20:40 +01001640 bool is_in_object() { return hydrogen()->is_in_object(); }
1641 int offset() { return hydrogen()->offset(); }
Ben Murdochb8e0da22011-05-16 14:20:40 +01001642 Handle<Map> transition() const { return hydrogen()->transition(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001643};
1644
1645
Steve Block1e0659c2011-05-24 12:43:12 +01001646class LStoreNamedGeneric: public LTemplateInstruction<0, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001647 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001648 LStoreNamedGeneric(LOperand* context, LOperand* object, LOperand* value) {
1649 inputs_[0] = context;
1650 inputs_[1] = object;
1651 inputs_[2] = value;
1652 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001653
1654 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
Ben Murdochb8e0da22011-05-16 14:20:40 +01001655 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
Steve Block1e0659c2011-05-24 12:43:12 +01001656
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001657 virtual void PrintDataTo(StringStream* stream);
1658
Steve Block1e0659c2011-05-24 12:43:12 +01001659 LOperand* context() { return inputs_[0]; }
1660 LOperand* object() { return inputs_[1]; }
1661 LOperand* value() { return inputs_[2]; }
1662 Handle<Object> name() const { return hydrogen()->name(); }
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001663 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001664};
1665
1666
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001667class LStoreKeyedFastElement: public LTemplateInstruction<0, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001668 public:
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001669 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) {
Ben Murdochb8e0da22011-05-16 14:20:40 +01001670 inputs_[0] = obj;
1671 inputs_[1] = key;
1672 inputs_[2] = val;
1673 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001674
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001675 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1676 "store-keyed-fast-element")
1677 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001678
Ben Murdochb8e0da22011-05-16 14:20:40 +01001679 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +01001680
Ben Murdochb8e0da22011-05-16 14:20:40 +01001681 LOperand* object() { return inputs_[0]; }
1682 LOperand* key() { return inputs_[1]; }
1683 LOperand* value() { return inputs_[2]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001684};
1685
1686
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001687class LStoreKeyedFastDoubleElement: public LTemplateInstruction<0, 3, 0> {
1688 public:
1689 LStoreKeyedFastDoubleElement(LOperand* elements,
1690 LOperand* key,
1691 LOperand* val) {
1692 inputs_[0] = elements;
1693 inputs_[1] = key;
1694 inputs_[2] = val;
1695 }
1696
1697 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement,
1698 "store-keyed-fast-double-element")
1699 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastDoubleElement)
1700
1701 virtual void PrintDataTo(StringStream* stream);
1702
1703 LOperand* elements() { return inputs_[0]; }
1704 LOperand* key() { return inputs_[1]; }
1705 LOperand* value() { return inputs_[2]; }
1706};
1707
1708
Ben Murdoch257744e2011-11-30 15:57:28 +00001709class LStoreKeyedSpecializedArrayElement: public LTemplateInstruction<0, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001710 public:
Steve Block44f0eee2011-05-26 01:26:41 +01001711 LStoreKeyedSpecializedArrayElement(LOperand* external_pointer,
1712 LOperand* key,
Ben Murdoch257744e2011-11-30 15:57:28 +00001713 LOperand* val) {
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001714 inputs_[0] = external_pointer;
1715 inputs_[1] = key;
1716 inputs_[2] = val;
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001717 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001718
Steve Block44f0eee2011-05-26 01:26:41 +01001719 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
1720 "store-keyed-specialized-array-element")
1721 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedSpecializedArrayElement)
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001722
1723 LOperand* external_pointer() { return inputs_[0]; }
1724 LOperand* key() { return inputs_[1]; }
1725 LOperand* value() { return inputs_[2]; }
Ben Murdoch589d6972011-11-30 16:04:58 +00001726 ElementsKind elements_kind() const {
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001727 return hydrogen()->elements_kind();
Steve Block44f0eee2011-05-26 01:26:41 +01001728 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001729};
1730
1731
Steve Block1e0659c2011-05-24 12:43:12 +01001732class LStoreKeyedGeneric: public LTemplateInstruction<0, 4, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001733 public:
Steve Block1e0659c2011-05-24 12:43:12 +01001734 LStoreKeyedGeneric(LOperand* context,
1735 LOperand* object,
1736 LOperand* key,
1737 LOperand* value) {
1738 inputs_[0] = context;
1739 inputs_[1] = object;
1740 inputs_[2] = key;
1741 inputs_[3] = value;
1742 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001743
1744 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
Ben Murdoch8b112d22011-06-08 16:22:53 +01001745 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedGeneric)
Steve Block1e0659c2011-05-24 12:43:12 +01001746
Ben Murdoche0cee9b2011-05-25 10:26:03 +01001747 virtual void PrintDataTo(StringStream* stream);
1748
Steve Block1e0659c2011-05-24 12:43:12 +01001749 LOperand* context() { return inputs_[0]; }
1750 LOperand* object() { return inputs_[1]; }
1751 LOperand* key() { return inputs_[2]; }
1752 LOperand* value() { return inputs_[3]; }
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001753 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); }
1754};
1755
1756
1757class LTransitionElementsKind: public LTemplateInstruction<1, 1, 2> {
1758 public:
1759 LTransitionElementsKind(LOperand* object,
1760 LOperand* new_map_temp,
1761 LOperand* temp_reg) {
1762 inputs_[0] = object;
1763 temps_[0] = new_map_temp;
1764 temps_[1] = temp_reg;
1765 }
1766
1767 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind,
1768 "transition-elements-kind")
1769 DECLARE_HYDROGEN_ACCESSOR(TransitionElementsKind)
1770
1771 virtual void PrintDataTo(StringStream* stream);
1772
1773 LOperand* object() { return inputs_[0]; }
1774 LOperand* new_map_reg() { return temps_[0]; }
1775 LOperand* temp_reg() { return temps_[1]; }
1776 Handle<Map> original_map() { return hydrogen()->original_map(); }
1777 Handle<Map> transitioned_map() { return hydrogen()->transitioned_map(); }
Ben Murdoch8b112d22011-06-08 16:22:53 +01001778};
1779
1780
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001781class LStringAdd: public LTemplateInstruction<1, 3, 0> {
Ben Murdoch257744e2011-11-30 15:57:28 +00001782 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001783 LStringAdd(LOperand* context, LOperand* left, LOperand* right) {
1784 inputs_[0] = context;
1785 inputs_[1] = left;
1786 inputs_[2] = right;
Ben Murdoch257744e2011-11-30 15:57:28 +00001787 }
1788
1789 DECLARE_CONCRETE_INSTRUCTION(StringAdd, "string-add")
1790 DECLARE_HYDROGEN_ACCESSOR(StringAdd)
1791
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001792 LOperand* context() { return inputs_[0]; }
1793 LOperand* left() { return inputs_[1]; }
1794 LOperand* right() { return inputs_[2]; }
Ben Murdoch257744e2011-11-30 15:57:28 +00001795};
1796
1797
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001798class LStringCharCodeAt: public LTemplateInstruction<1, 3, 0> {
Steve Block1e0659c2011-05-24 12:43:12 +01001799 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001800 LStringCharCodeAt(LOperand* context, LOperand* string, LOperand* index) {
1801 inputs_[0] = context;
1802 inputs_[1] = string;
1803 inputs_[2] = index;
Steve Block1e0659c2011-05-24 12:43:12 +01001804 }
1805
1806 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1807 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
1808
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001809 LOperand* context() { return inputs_[0]; }
1810 LOperand* string() { return inputs_[1]; }
1811 LOperand* index() { return inputs_[2]; }
Steve Block1e0659c2011-05-24 12:43:12 +01001812};
1813
1814
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001815class LStringCharFromCode: public LTemplateInstruction<1, 2, 0> {
Steve Block44f0eee2011-05-26 01:26:41 +01001816 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001817 LStringCharFromCode(LOperand* context, LOperand* char_code) {
1818 inputs_[0] = context;
1819 inputs_[1] = char_code;
Steve Block44f0eee2011-05-26 01:26:41 +01001820 }
1821
1822 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code")
1823 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode)
1824
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001825 LOperand* context() { return inputs_[0]; }
1826 LOperand* char_code() { return inputs_[1]; }
Steve Block44f0eee2011-05-26 01:26:41 +01001827};
1828
1829
Steve Block1e0659c2011-05-24 12:43:12 +01001830class LStringLength: public LTemplateInstruction<1, 1, 0> {
1831 public:
1832 explicit LStringLength(LOperand* string) {
1833 inputs_[0] = string;
1834 }
1835
1836 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1837 DECLARE_HYDROGEN_ACCESSOR(StringLength)
1838
1839 LOperand* string() { return inputs_[0]; }
1840};
1841
1842
1843class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001844 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001845 explicit LCheckFunction(LOperand* value) {
1846 inputs_[0] = value;
1847 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001848
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001849 LOperand* value() { return inputs_[0]; }
1850
Ben Murdochb0fe1622011-05-05 13:52:32 +01001851 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1852 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1853};
1854
1855
Ben Murdochb8e0da22011-05-16 14:20:40 +01001856class LCheckInstanceType: public LTemplateInstruction<0, 1, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001857 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001858 LCheckInstanceType(LOperand* value, LOperand* temp) {
1859 inputs_[0] = value;
1860 temps_[0] = temp;
1861 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001862
1863 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1864 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001865};
1866
1867
Steve Block1e0659c2011-05-24 12:43:12 +01001868class LCheckMap: public LTemplateInstruction<0, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001869 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001870 explicit LCheckMap(LOperand* value) {
1871 inputs_[0] = value;
1872 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001873
1874 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map")
1875 DECLARE_HYDROGEN_ACCESSOR(CheckMap)
1876};
1877
1878
Ben Murdochb8e0da22011-05-16 14:20:40 +01001879class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 1> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001880 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01001881 explicit LCheckPrototypeMaps(LOperand* temp) {
1882 temps_[0] = temp;
1883 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001884
1885 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
Ben Murdochb8e0da22011-05-16 14:20:40 +01001886 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001887
Ben Murdochb8e0da22011-05-16 14:20:40 +01001888 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1889 Handle<JSObject> holder() const { return hydrogen()->holder(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001890};
1891
1892
Steve Block1e0659c2011-05-24 12:43:12 +01001893class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001894 public:
Steve Block44f0eee2011-05-26 01:26:41 +01001895 explicit LCheckSmi(LOperand* value) {
Ben Murdochb8e0da22011-05-16 14:20:40 +01001896 inputs_[0] = value;
1897 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01001898
Steve Block44f0eee2011-05-26 01:26:41 +01001899 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check-smi")
1900};
Ben Murdochb0fe1622011-05-05 13:52:32 +01001901
Steve Block44f0eee2011-05-26 01:26:41 +01001902
Ben Murdoch257744e2011-11-30 15:57:28 +00001903class LClampDToUint8: public LTemplateInstruction<1, 1, 0> {
1904 public:
1905 explicit LClampDToUint8(LOperand* value) {
1906 inputs_[0] = value;
1907 }
1908
1909 LOperand* unclamped() { return inputs_[0]; }
1910
1911 DECLARE_CONCRETE_INSTRUCTION(ClampDToUint8, "clamp-d-to-uint8")
1912};
1913
1914
1915class LClampIToUint8: public LTemplateInstruction<1, 1, 0> {
1916 public:
1917 explicit LClampIToUint8(LOperand* value) {
1918 inputs_[0] = value;
1919 }
1920
1921 LOperand* unclamped() { return inputs_[0]; }
1922
1923 DECLARE_CONCRETE_INSTRUCTION(ClampIToUint8, "clamp-i-to-uint8")
1924};
1925
1926
1927class LClampTToUint8: public LTemplateInstruction<1, 1, 1> {
1928 public:
1929 LClampTToUint8(LOperand* value, LOperand* temp) {
1930 inputs_[0] = value;
1931 temps_[0] = temp;
1932 }
1933
1934 LOperand* unclamped() { return inputs_[0]; }
1935
1936 DECLARE_CONCRETE_INSTRUCTION(ClampTToUint8, "clamp-t-to-uint8")
1937};
1938
1939
Steve Block44f0eee2011-05-26 01:26:41 +01001940class LCheckNonSmi: public LTemplateInstruction<0, 1, 0> {
1941 public:
1942 explicit LCheckNonSmi(LOperand* value) {
1943 inputs_[0] = value;
Ben Murdochb0fe1622011-05-05 13:52:32 +01001944 }
1945
Steve Block44f0eee2011-05-26 01:26:41 +01001946 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi")
Ben Murdochb0fe1622011-05-05 13:52:32 +01001947};
1948
1949
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001950class LArrayLiteral: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001951 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001952 explicit LArrayLiteral(LOperand* context) {
1953 inputs_[0] = context;
1954 }
1955
1956 LOperand* context() { return inputs_[0]; }
1957
Ben Murdochb0fe1622011-05-05 13:52:32 +01001958 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
1959 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
1960};
1961
1962
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001963class LObjectLiteralFast: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001964 public:
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001965 explicit LObjectLiteralFast(LOperand* context) {
Steve Block1e0659c2011-05-24 12:43:12 +01001966 inputs_[0] = context;
1967 }
1968
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001969 LOperand* context() { return inputs_[0]; }
1970
Ben Murdoch592a9fc2012-03-05 11:04:45 +00001971 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralFast, "object-literal-fast")
1972 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteralFast)
1973};
1974
1975
1976class LObjectLiteralGeneric: public LTemplateInstruction<1, 1, 0> {
1977 public:
1978 explicit LObjectLiteralGeneric(LOperand* context) {
1979 inputs_[0] = context;
1980 }
1981
1982 LOperand* context() { return inputs_[0]; }
1983
1984 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralGeneric, "object-literal-generic")
1985 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteralGeneric)
Ben Murdochb0fe1622011-05-05 13:52:32 +01001986};
1987
1988
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001989class LRegExpLiteral: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01001990 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001991 explicit LRegExpLiteral(LOperand* context) {
1992 inputs_[0] = context;
1993 }
1994
1995 LOperand* context() { return inputs_[0]; }
1996
Ben Murdochb0fe1622011-05-05 13:52:32 +01001997 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
1998 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
1999};
2000
2001
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002002class LFunctionLiteral: public LTemplateInstruction<1, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002003 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002004 explicit LFunctionLiteral(LOperand* context) {
2005 inputs_[0] = context;
2006 }
2007
2008 LOperand* context() { return inputs_[0]; }
2009
Ben Murdochb0fe1622011-05-05 13:52:32 +01002010 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
2011 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
2012
2013 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
2014};
2015
2016
Steve Block44f0eee2011-05-26 01:26:41 +01002017class LToFastProperties: public LTemplateInstruction<1, 1, 0> {
2018 public:
2019 explicit LToFastProperties(LOperand* value) {
2020 inputs_[0] = value;
2021 }
2022
2023 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties, "to-fast-properties")
2024 DECLARE_HYDROGEN_ACCESSOR(ToFastProperties)
2025};
2026
2027
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002028class LTypeof: public LTemplateInstruction<1, 2, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002029 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002030 LTypeof(LOperand* context, LOperand* value) {
2031 inputs_[0] = context;
2032 inputs_[1] = value;
Ben Murdochb8e0da22011-05-16 14:20:40 +01002033 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002034
2035 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
2036};
2037
2038
Steve Block1e0659c2011-05-24 12:43:12 +01002039class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002040 public:
Ben Murdochb8e0da22011-05-16 14:20:40 +01002041 explicit LTypeofIsAndBranch(LOperand* value) {
2042 inputs_[0] = value;
2043 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002044
2045 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002046 DECLARE_HYDROGEN_ACCESSOR(TypeofIsAndBranch)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002047
Ben Murdochb8e0da22011-05-16 14:20:40 +01002048 Handle<String> type_literal() { return hydrogen()->type_literal(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002049
Ben Murdochb8e0da22011-05-16 14:20:40 +01002050 virtual void PrintDataTo(StringStream* stream);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002051};
2052
2053
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002054class LDeleteProperty: public LTemplateInstruction<1, 3, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002055 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002056 LDeleteProperty(LOperand* context, LOperand* obj, LOperand* key) {
2057 inputs_[0] = context;
2058 inputs_[1] = obj;
2059 inputs_[2] = key;
Ben Murdochb8e0da22011-05-16 14:20:40 +01002060 }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002061
2062 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
2063
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002064 LOperand* context() { return inputs_[0]; }
2065 LOperand* object() { return inputs_[1]; }
2066 LOperand* key() { return inputs_[2]; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002067};
2068
2069
Ben Murdochb8e0da22011-05-16 14:20:40 +01002070class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002071 public:
2072 LOsrEntry();
2073
2074 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
2075
2076 LOperand** SpilledRegisterArray() { return register_spills_; }
2077 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
2078
2079 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
2080 void MarkSpilledDoubleRegister(int allocation_index,
2081 LOperand* spill_operand);
2082
2083 private:
2084 // Arrays of spill slot operands for registers with an assigned spill
2085 // slot, i.e., that must also be restored to the spill slot on OSR entry.
2086 // NULL if the register has no assigned spill slot. Indexed by allocation
2087 // index.
2088 LOperand* register_spills_[Register::kNumAllocatableRegisters];
2089 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
2090};
2091
2092
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002093class LStackCheck: public LTemplateInstruction<0, 1, 0> {
Ben Murdochb0fe1622011-05-05 13:52:32 +01002094 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002095 explicit LStackCheck(LOperand* context) {
2096 inputs_[0] = context;
2097 }
2098
2099 LOperand* context() { return inputs_[0]; }
2100
Ben Murdochb0fe1622011-05-05 13:52:32 +01002101 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002102 DECLARE_HYDROGEN_ACCESSOR(StackCheck)
2103
2104 Label* done_label() { return &done_label_; }
2105
2106 private:
2107 Label done_label_;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002108};
2109
2110
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002111class LIn: public LTemplateInstruction<1, 3, 0> {
Ben Murdoch257744e2011-11-30 15:57:28 +00002112 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002113 LIn(LOperand* context, LOperand* key, LOperand* object) {
2114 inputs_[0] = context;
2115 inputs_[1] = key;
2116 inputs_[2] = object;
Ben Murdoch257744e2011-11-30 15:57:28 +00002117 }
2118
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002119 LOperand* context() { return inputs_[0]; }
2120 LOperand* key() { return inputs_[1]; }
2121 LOperand* object() { return inputs_[2]; }
Ben Murdoch257744e2011-11-30 15:57:28 +00002122
2123 DECLARE_CONCRETE_INSTRUCTION(In, "in")
2124};
2125
2126
Ben Murdochb0fe1622011-05-05 13:52:32 +01002127class LChunkBuilder;
2128class LChunk: public ZoneObject {
2129 public:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00002130 LChunk(CompilationInfo* info, HGraph* graph)
Ben Murdoch086aeea2011-05-13 15:57:08 +01002131 : spill_slot_count_(0),
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002132 info_(info),
Ben Murdoch086aeea2011-05-13 15:57:08 +01002133 graph_(graph),
2134 instructions_(32),
2135 pointer_maps_(8),
Ben Murdoch592a9fc2012-03-05 11:04:45 +00002136 num_double_slots_(0),
Ben Murdoch086aeea2011-05-13 15:57:08 +01002137 inlined_closures_(1) { }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002138
Steve Block1e0659c2011-05-24 12:43:12 +01002139 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002140 LConstantOperand* DefineConstantOperand(HConstant* constant);
2141 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
2142 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
2143
2144 int GetNextSpillIndex(bool is_double);
2145 LOperand* GetNextSpillSlot(bool is_double);
2146
2147 int ParameterAt(int index);
2148 int GetParameterStackSlot(int index) const;
2149 int spill_slot_count() const { return spill_slot_count_; }
Ben Murdoch592a9fc2012-03-05 11:04:45 +00002150 int num_double_slots() const { return num_double_slots_; }
2151
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002152 CompilationInfo* info() const { return info_; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002153 HGraph* graph() const { return graph_; }
2154 const ZoneList<LInstruction*>* instructions() const { return &instructions_; }
2155 void AddGapMove(int index, LOperand* from, LOperand* to);
2156 LGap* GetGapAt(int index) const;
2157 bool IsGapAt(int index) const;
2158 int NearestGapPos(int index) const;
2159 void MarkEmptyBlocks();
2160 const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; }
2161 LLabel* GetLabel(int block_id) const {
2162 HBasicBlock* block = graph_->blocks()->at(block_id);
2163 int first_instruction = block->first_instruction_index();
2164 return LLabel::cast(instructions_[first_instruction]);
2165 }
2166 int LookupDestination(int block_id) const {
2167 LLabel* cur = GetLabel(block_id);
2168 while (cur->replacement() != NULL) {
2169 cur = cur->replacement();
2170 }
2171 return cur->block_id();
2172 }
2173 Label* GetAssemblyLabel(int block_id) const {
2174 LLabel* label = GetLabel(block_id);
2175 ASSERT(!label->HasReplacement());
2176 return label->label();
2177 }
2178
2179 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
2180 return &inlined_closures_;
2181 }
2182
2183 void AddInlinedClosure(Handle<JSFunction> closure) {
2184 inlined_closures_.Add(closure);
2185 }
2186
Ben Murdochb0fe1622011-05-05 13:52:32 +01002187 private:
2188 int spill_slot_count_;
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002189 CompilationInfo* info_;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002190 HGraph* const graph_;
2191 ZoneList<LInstruction*> instructions_;
2192 ZoneList<LPointerMap*> pointer_maps_;
Ben Murdoch592a9fc2012-03-05 11:04:45 +00002193 int num_double_slots_;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002194 ZoneList<Handle<JSFunction> > inlined_closures_;
2195};
2196
2197
2198class LChunkBuilder BASE_EMBEDDED {
2199 public:
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002200 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator)
Ben Murdochb0fe1622011-05-05 13:52:32 +01002201 : chunk_(NULL),
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002202 info_(info),
Ben Murdochb0fe1622011-05-05 13:52:32 +01002203 graph_(graph),
Ben Murdoch592a9fc2012-03-05 11:04:45 +00002204 isolate_(graph->isolate()),
Ben Murdochb0fe1622011-05-05 13:52:32 +01002205 status_(UNUSED),
2206 current_instruction_(NULL),
2207 current_block_(NULL),
2208 next_block_(NULL),
2209 argument_count_(0),
2210 allocator_(allocator),
2211 position_(RelocInfo::kNoPosition),
Steve Block1e0659c2011-05-24 12:43:12 +01002212 instruction_pending_deoptimization_environment_(NULL),
Ben Murdochb0fe1622011-05-05 13:52:32 +01002213 pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
2214
2215 // Build the sequence for the graph.
2216 LChunk* Build();
2217
2218 // Declare methods that deal with the individual node types.
2219#define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2220 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2221#undef DECLARE_DO
2222
2223 private:
2224 enum Status {
2225 UNUSED,
2226 BUILDING,
2227 DONE,
2228 ABORTED
2229 };
2230
2231 LChunk* chunk() const { return chunk_; }
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002232 CompilationInfo* info() const { return info_; }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002233 HGraph* graph() const { return graph_; }
Ben Murdoch592a9fc2012-03-05 11:04:45 +00002234 Zone* zone() { return isolate_->zone(); }
Ben Murdochb0fe1622011-05-05 13:52:32 +01002235
2236 bool is_unused() const { return status_ == UNUSED; }
2237 bool is_building() const { return status_ == BUILDING; }
2238 bool is_done() const { return status_ == DONE; }
2239 bool is_aborted() const { return status_ == ABORTED; }
2240
2241 void Abort(const char* format, ...);
2242
2243 // Methods for getting operands for Use / Define / Temp.
2244 LRegister* ToOperand(Register reg);
2245 LUnallocated* ToUnallocated(Register reg);
2246 LUnallocated* ToUnallocated(XMMRegister reg);
2247
2248 // Methods for setting up define-use relationships.
Ben Murdochb8e0da22011-05-16 14:20:40 +01002249 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
2250 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
2251 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
2252 XMMRegister fixed_register);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002253
2254 // A value that is guaranteed to be allocated to a register.
2255 // Operand created by UseRegister is guaranteed to be live until the end of
2256 // instruction. This means that register allocator will not reuse it's
2257 // register for any other operand inside instruction.
2258 // Operand created by UseRegisterAtStart is guaranteed to be live only at
2259 // instruction start. Register allocator is free to assign the same register
2260 // to some other operand used inside instruction (i.e. temporary or
2261 // output).
Ben Murdochb8e0da22011-05-16 14:20:40 +01002262 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
2263 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002264
Ben Murdochb8e0da22011-05-16 14:20:40 +01002265 // An input operand in a register that may be trashed.
2266 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
2267
2268 // An input operand in a register or stack slot.
2269 MUST_USE_RESULT LOperand* Use(HValue* value);
2270 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
2271
2272 // An input operand in a register, stack slot or a constant operand.
2273 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
2274 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
2275
2276 // An input operand in a register or a constant operand.
2277 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
2278 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
2279
2280 // An input operand in register, stack slot or a constant operand.
2281 // Will not be moved to a register even if one is freely available.
2282 MUST_USE_RESULT LOperand* UseAny(HValue* value);
2283
2284 // Temporary operand that must be in a register.
2285 MUST_USE_RESULT LUnallocated* TempRegister();
2286 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
2287 MUST_USE_RESULT LOperand* FixedTemp(XMMRegister reg);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002288
2289 // Methods for setting up define-use relationships.
2290 // Return the same instruction that they are passed.
Ben Murdochb8e0da22011-05-16 14:20:40 +01002291 template<int I, int T>
2292 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2293 LUnallocated* result);
2294 template<int I, int T>
2295 LInstruction* Define(LTemplateInstruction<1, I, T>* instr);
2296 template<int I, int T>
2297 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2298 template<int I, int T>
2299 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2300 int index);
2301 template<int I, int T>
2302 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2303 template<int I, int T>
2304 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2305 Register reg);
2306 template<int I, int T>
2307 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2308 XMMRegister reg);
Ben Murdoch69a99ed2011-11-30 16:03:39 +00002309 // Assigns an environment to an instruction. An instruction which can
2310 // deoptimize must have an environment.
Ben Murdochb0fe1622011-05-05 13:52:32 +01002311 LInstruction* AssignEnvironment(LInstruction* instr);
Ben Murdoch69a99ed2011-11-30 16:03:39 +00002312 // Assigns a pointer map to an instruction. An instruction which can
2313 // trigger a GC or a lazy deoptimization must have a pointer map.
Ben Murdochb0fe1622011-05-05 13:52:32 +01002314 LInstruction* AssignPointerMap(LInstruction* instr);
2315
2316 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2317
Ben Murdoch69a99ed2011-11-30 16:03:39 +00002318 // Marks a call for the register allocator. Assigns a pointer map to
2319 // support GC and lazy deoptimization. Assigns an environment to support
2320 // eager deoptimization if CAN_DEOPTIMIZE_EAGERLY.
Ben Murdochb0fe1622011-05-05 13:52:32 +01002321 LInstruction* MarkAsCall(
2322 LInstruction* instr,
2323 HInstruction* hinstr,
2324 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
Ben Murdoch086aeea2011-05-13 15:57:08 +01002325 LInstruction* MarkAsSaveDoubles(LInstruction* instr);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002326
2327 LInstruction* SetInstructionPendingDeoptimizationEnvironment(
2328 LInstruction* instr, int ast_id);
2329 void ClearInstructionPendingDeoptimizationEnvironment();
2330
Ben Murdoch592a9fc2012-03-05 11:04:45 +00002331 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env,
2332 int* argument_index_accumulator);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002333
Ben Murdochb0fe1622011-05-05 13:52:32 +01002334 void VisitInstruction(HInstruction* current);
2335
2336 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
Ben Murdochb0fe1622011-05-05 13:52:32 +01002337 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
2338 LInstruction* DoArithmeticD(Token::Value op,
2339 HArithmeticBinaryOperation* instr);
2340 LInstruction* DoArithmeticT(Token::Value op,
2341 HArithmeticBinaryOperation* instr);
2342
2343 LChunk* chunk_;
Ben Murdoche0cee9b2011-05-25 10:26:03 +01002344 CompilationInfo* info_;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002345 HGraph* const graph_;
Ben Murdoch592a9fc2012-03-05 11:04:45 +00002346 Isolate* isolate_;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002347 Status status_;
2348 HInstruction* current_instruction_;
2349 HBasicBlock* current_block_;
2350 HBasicBlock* next_block_;
2351 int argument_count_;
2352 LAllocator* allocator_;
2353 int position_;
Steve Block1e0659c2011-05-24 12:43:12 +01002354 LInstruction* instruction_pending_deoptimization_environment_;
Ben Murdochb0fe1622011-05-05 13:52:32 +01002355 int pending_deoptimization_ast_id_;
2356
2357 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2358};
2359
2360#undef DECLARE_HYDROGEN_ACCESSOR
Ben Murdochb0fe1622011-05-05 13:52:32 +01002361#undef DECLARE_CONCRETE_INSTRUCTION
2362
2363} } // namespace v8::internal
2364
2365#endif // V8_IA32_LITHIUM_IA32_H_