Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Side by Side Diff: src/arm/lithium-arm.h

Issue 6597029: [Isolates] Merge r 6300:6500 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/jump-target-arm.cc ('k') | src/arm/lithium-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 25 matching lines...) Expand all
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 // Forward declarations. 39 // Forward declarations.
40 class LCodeGen; 40 class LCodeGen;
41 41
42 42
43 // Type hierarchy: 43 // Type hierarchy:
44 // 44 //
45 // LInstruction 45 // LInstruction
46 // LAccessArgumentsAt 46 // LTemplateInstruction
47 // LArgumentsElements 47 // LControlInstruction
48 // LArgumentsLength 48 // LBranch
49 // LBinaryOperation 49 // LClassOfTestAndBranch
50 // LCmpJSObjectEqAndBranch
51 // LCmpIDAndBranch
52 // LHasCachedArrayIndexAndBranch
53 // LHasInstanceTypeAndBranch
54 // LInstanceOfAndBranch
55 // LIsNullAndBranch
56 // LIsObjectAndBranch
57 // LIsSmiAndBranch
58 // LTypeofIsAndBranch
59 // LAccessArgumentsAt
60 // LArgumentsElements
61 // LArgumentsLength
50 // LAddI 62 // LAddI
51 // LApplyArguments 63 // LApplyArguments
52 // LArithmeticD 64 // LArithmeticD
53 // LArithmeticT 65 // LArithmeticT
54 // LBitI 66 // LBitI
55 // LBoundsCheck 67 // LBoundsCheck
56 // LCmpID 68 // LCmpID
57 // LCmpIDAndBranch
58 // LCmpJSObjectEq 69 // LCmpJSObjectEq
59 // LCmpJSObjectEqAndBranch
60 // LCmpT 70 // LCmpT
61 // LDivI 71 // LDivI
62 // LInstanceOf 72 // LInstanceOf
63 // LInstanceOfAndBranch
64 // LInstanceOfKnownGlobal 73 // LInstanceOfKnownGlobal
65 // LLoadKeyedFastElement 74 // LLoadKeyedFastElement
66 // LLoadKeyedGeneric 75 // LLoadKeyedGeneric
67 // LModI 76 // LModI
68 // LMulI 77 // LMulI
78 // LPower
69 // LShiftI 79 // LShiftI
70 // LSubI 80 // LSubI
71 // LCallConstantFunction 81 // LCallConstantFunction
72 // LCallFunction 82 // LCallFunction
73 // LCallGlobal 83 // LCallGlobal
74 // LCallKeyed 84 // LCallKeyed
75 // LCallKnownGlobal 85 // LCallKnownGlobal
76 // LCallNamed 86 // LCallNamed
77 // LCallRuntime 87 // LCallRuntime
78 // LCallStub 88 // LCallStub
79 // LCheckPrototypeMaps 89 // LConstant
80 // LConstant 90 // LConstantD
81 // LConstantD 91 // LConstantI
82 // LConstantI 92 // LConstantT
83 // LConstantT 93 // LDeoptimize
84 // LDeoptimize 94 // LFunctionLiteral
85 // LFunctionLiteral 95 // LGap
86 // LGlobalObject 96 // LLabel
87 // LGlobalReceiver 97 // LGlobalObject
88 // LLabel 98 // LGlobalReceiver
89 // LLayzBailout 99 // LGoto
90 // LLoadGlobal 100 // LLazyBailout
91 // LMaterializedLiteral 101 // LLoadGlobal
102 // LCheckPrototypeMaps
103 // LLoadContextSlot
92 // LArrayLiteral 104 // LArrayLiteral
93 // LObjectLiteral 105 // LObjectLiteral
94 // LRegExpLiteral 106 // LRegExpLiteral
95 // LOsrEntry 107 // LOsrEntry
96 // LParameter 108 // LParameter
97 // LStackCheck 109 // LRegExpConstructResult
98 // LStoreKeyed 110 // LStackCheck
99 // LStoreKeyedFastElement 111 // LStoreKeyed
100 // LStoreKeyedGeneric 112 // LStoreKeyedFastElement
101 // LStoreNamed 113 // LStoreKeyedGeneric
102 // LStoreNamedField 114 // LStoreNamed
103 // LStoreNamedGeneric 115 // LStoreNamedField
104 // LUnaryOperation 116 // LStoreNamedGeneric
105 // LJSArrayLength 117 // LStringCharCodeAt
106 // LFixedArrayLength
107 // LBitNotI 118 // LBitNotI
108 // LBranch
109 // LCallNew 119 // LCallNew
110 // LCheckFunction 120 // LCheckFunction
121 // LCheckPrototypeMaps
111 // LCheckInstanceType 122 // LCheckInstanceType
112 // LCheckMap 123 // LCheckMap
113 // LCheckSmi 124 // LCheckSmi
114 // LClassOfTest 125 // LClassOfTest
115 // LClassOfTestAndBranch
116 // LDeleteProperty 126 // LDeleteProperty
117 // LDoubleToI 127 // LDoubleToI
128 // LFixedArrayLength
118 // LHasCachedArrayIndex 129 // LHasCachedArrayIndex
119 // LHasCachedArrayIndexAndBranch
120 // LHasInstanceType 130 // LHasInstanceType
121 // LHasInstanceTypeAndBranch
122 // LInteger32ToDouble 131 // LInteger32ToDouble
123 // LIsNull 132 // LIsNull
124 // LIsNullAndBranch
125 // LIsObject 133 // LIsObject
126 // LIsObjectAndBranch
127 // LIsSmi 134 // LIsSmi
128 // LIsSmiAndBranch 135 // LJSArrayLength
129 // LLoadNamedField 136 // LLoadNamedField
130 // LLoadNamedGeneric 137 // LLoadNamedGeneric
131 // LLoadFunctionPrototype 138 // LLoadFunctionPrototype
132 // LNumberTagD 139 // LNumberTagD
133 // LNumberTagI 140 // LNumberTagI
134 // LPushArgument 141 // LPushArgument
135 // LReturn 142 // LReturn
136 // LSmiTag 143 // LSmiTag
137 // LStoreGlobal 144 // LStoreGlobal
145 // LStringLength
138 // LTaggedToI 146 // LTaggedToI
139 // LThrow 147 // LThrow
140 // LTypeof 148 // LTypeof
141 // LTypeofIs 149 // LTypeofIs
142 // LTypeofIsAndBranch
143 // LUnaryMathOperation 150 // LUnaryMathOperation
144 // LValueOf 151 // LValueOf
145 // LUnknownOSRValue 152 // LUnknownOSRValue
146 153
147 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ 154 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
148 V(BinaryOperation) \ 155 V(ControlInstruction) \
149 V(Constant) \ 156 V(Constant) \
150 V(Call) \ 157 V(Call) \
151 V(MaterializedLiteral) \
152 V(StoreKeyed) \ 158 V(StoreKeyed) \
153 V(StoreNamed) \ 159 V(StoreNamed) \
154 V(UnaryOperation) \
155 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) 160 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
156 161
157 162
158 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ 163 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
159 V(AccessArgumentsAt) \ 164 V(AccessArgumentsAt) \
160 V(AddI) \ 165 V(AddI) \
161 V(ApplyArguments) \ 166 V(ApplyArguments) \
162 V(ArgumentsElements) \ 167 V(ArgumentsElements) \
163 V(ArgumentsLength) \ 168 V(ArgumentsLength) \
164 V(ArithmeticD) \ 169 V(ArithmeticD) \
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 V(IsSmiAndBranch) \ 219 V(IsSmiAndBranch) \
215 V(JSArrayLength) \ 220 V(JSArrayLength) \
216 V(HasInstanceType) \ 221 V(HasInstanceType) \
217 V(HasInstanceTypeAndBranch) \ 222 V(HasInstanceTypeAndBranch) \
218 V(HasCachedArrayIndex) \ 223 V(HasCachedArrayIndex) \
219 V(HasCachedArrayIndexAndBranch) \ 224 V(HasCachedArrayIndexAndBranch) \
220 V(ClassOfTest) \ 225 V(ClassOfTest) \
221 V(ClassOfTestAndBranch) \ 226 V(ClassOfTestAndBranch) \
222 V(Label) \ 227 V(Label) \
223 V(LazyBailout) \ 228 V(LazyBailout) \
229 V(LoadContextSlot) \
224 V(LoadElements) \ 230 V(LoadElements) \
225 V(LoadGlobal) \ 231 V(LoadGlobal) \
226 V(LoadKeyedFastElement) \ 232 V(LoadKeyedFastElement) \
227 V(LoadKeyedGeneric) \ 233 V(LoadKeyedGeneric) \
228 V(LoadNamedField) \ 234 V(LoadNamedField) \
229 V(LoadNamedGeneric) \ 235 V(LoadNamedGeneric) \
230 V(LoadFunctionPrototype) \ 236 V(LoadFunctionPrototype) \
231 V(ModI) \ 237 V(ModI) \
232 V(MulI) \ 238 V(MulI) \
233 V(NumberTagD) \ 239 V(NumberTagD) \
234 V(NumberTagI) \ 240 V(NumberTagI) \
235 V(NumberUntagD) \ 241 V(NumberUntagD) \
236 V(ObjectLiteral) \ 242 V(ObjectLiteral) \
237 V(OsrEntry) \ 243 V(OsrEntry) \
238 V(Parameter) \ 244 V(Parameter) \
239 V(PushArgument) \ 245 V(PushArgument) \
240 V(RegExpLiteral) \ 246 V(RegExpLiteral) \
241 V(Return) \ 247 V(Return) \
242 V(ShiftI) \ 248 V(ShiftI) \
243 V(SmiTag) \ 249 V(SmiTag) \
244 V(SmiUntag) \ 250 V(SmiUntag) \
245 V(StackCheck) \ 251 V(StackCheck) \
246 V(StoreGlobal) \ 252 V(StoreGlobal) \
247 V(StoreKeyedFastElement) \ 253 V(StoreKeyedFastElement) \
248 V(StoreKeyedGeneric) \ 254 V(StoreKeyedGeneric) \
249 V(StoreNamedField) \ 255 V(StoreNamedField) \
250 V(StoreNamedGeneric) \ 256 V(StoreNamedGeneric) \
251 V(SubI) \ 257 V(SubI) \
258 V(StringCharCodeAt) \
259 V(StringLength) \
252 V(TaggedToI) \ 260 V(TaggedToI) \
253 V(Throw) \ 261 V(Throw) \
254 V(Typeof) \ 262 V(Typeof) \
255 V(TypeofIs) \ 263 V(TypeofIs) \
256 V(TypeofIsAndBranch) \ 264 V(TypeofIsAndBranch) \
257 V(UnaryMathOperation) \ 265 V(UnaryMathOperation) \
258 V(UnknownOSRValue) \ 266 V(UnknownOSRValue) \
259 V(ValueOf) 267 V(ValueOf)
260 268
261 269
(...skipping 18 matching lines...) Expand all
280 288
281 289
282 class LInstruction: public ZoneObject { 290 class LInstruction: public ZoneObject {
283 public: 291 public:
284 LInstruction() 292 LInstruction()
285 : hydrogen_value_(NULL) { } 293 : hydrogen_value_(NULL) { }
286 virtual ~LInstruction() { } 294 virtual ~LInstruction() { }
287 295
288 virtual void CompileToNative(LCodeGen* generator) = 0; 296 virtual void CompileToNative(LCodeGen* generator) = 0;
289 virtual const char* Mnemonic() const = 0; 297 virtual const char* Mnemonic() const = 0;
290 virtual void PrintTo(StringStream* stream) const; 298 virtual void PrintTo(StringStream* stream);
291 virtual void PrintDataTo(StringStream* stream) const { } 299 virtual void PrintDataTo(StringStream* stream) = 0;
300 virtual void PrintOutputOperandTo(StringStream* stream) = 0;
292 301
293 // Declare virtual type testers. 302 // Declare virtual type testers.
294 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } 303 #define DECLARE_DO(type) virtual bool Is##type() const { return false; }
295 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO) 304 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
296 #undef DECLARE_DO 305 #undef DECLARE_DO
306
297 virtual bool IsControl() const { return false; } 307 virtual bool IsControl() const { return false; }
308 virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
298 309
299 void set_environment(LEnvironment* env) { environment_.set(env); } 310 void set_environment(LEnvironment* env) { environment_.set(env); }
300 LEnvironment* environment() const { return environment_.get(); } 311 LEnvironment* environment() const { return environment_.get(); }
301 bool HasEnvironment() const { return environment_.is_set(); } 312 bool HasEnvironment() const { return environment_.is_set(); }
302 313
303 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } 314 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
304 LPointerMap* pointer_map() const { return pointer_map_.get(); } 315 LPointerMap* pointer_map() const { return pointer_map_.get(); }
305 bool HasPointerMap() const { return pointer_map_.is_set(); } 316 bool HasPointerMap() const { return pointer_map_.is_set(); }
306 317
307 void set_result(LOperand* operand) { result_.set(operand); } 318 virtual bool HasResult() const = 0;
308 LOperand* result() const { return result_.get(); }
309 bool HasResult() const { return result_.is_set(); }
310 319
311 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } 320 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
312 HValue* hydrogen_value() const { return hydrogen_value_; } 321 HValue* hydrogen_value() const { return hydrogen_value_; }
313 322
314 void set_deoptimization_environment(LEnvironment* env) { 323 void set_deoptimization_environment(LEnvironment* env) {
315 deoptimization_environment_.set(env); 324 deoptimization_environment_.set(env);
316 } 325 }
317 LEnvironment* deoptimization_environment() const { 326 LEnvironment* deoptimization_environment() const {
318 return deoptimization_environment_.get(); 327 return deoptimization_environment_.get();
319 } 328 }
320 bool HasDeoptimizationEnvironment() const { 329 bool HasDeoptimizationEnvironment() const {
321 return deoptimization_environment_.is_set(); 330 return deoptimization_environment_.is_set();
322 } 331 }
323 332
324 private: 333 private:
325 SetOncePointer<LEnvironment> environment_; 334 SetOncePointer<LEnvironment> environment_;
326 SetOncePointer<LPointerMap> pointer_map_; 335 SetOncePointer<LPointerMap> pointer_map_;
327 SetOncePointer<LOperand> result_;
328 HValue* hydrogen_value_; 336 HValue* hydrogen_value_;
329 SetOncePointer<LEnvironment> deoptimization_environment_; 337 SetOncePointer<LEnvironment> deoptimization_environment_;
330 }; 338 };
331 339
332 340
333 class LGap: public LInstruction { 341 template<typename ElementType, int NumElements>
342 class OperandContainer {
343 public:
344 OperandContainer() {
345 for (int i = 0; i < NumElements; i++) elems_[i] = NULL;
346 }
347 int length() { return NumElements; }
348 ElementType& operator[](int i) {
349 ASSERT(i < length());
350 return elems_[i];
351 }
352 void PrintOperandsTo(StringStream* stream);
353
354 private:
355 ElementType elems_[NumElements];
356 };
357
358
359 template<typename ElementType>
360 class OperandContainer<ElementType, 0> {
361 public:
362 int length() { return 0; }
363 void PrintOperandsTo(StringStream* stream) { }
364 };
365
366
367 // R = number of result operands (0 or 1).
368 // I = number of input operands.
369 // T = number of temporary operands.
370 template<int R, int I, int T>
371 class LTemplateInstruction: public LInstruction {
372 public:
373 // Allow 0 or 1 output operands.
374 STATIC_ASSERT(R == 0 || R == 1);
375 virtual bool HasResult() const { return R != 0; }
376 void set_result(LOperand* operand) { results_[0] = operand; }
377 LOperand* result() { return results_[0]; }
378
379 int InputCount() { return I; }
380 LOperand* InputAt(int i) { return inputs_[i]; }
381
382 int TempCount() { return T; }
383 LOperand* TempAt(int i) { return temps_[i]; }
384
385 virtual void PrintDataTo(StringStream* stream);
386 virtual void PrintOutputOperandTo(StringStream* stream);
387
388 protected:
389 OperandContainer<LOperand*, R> results_;
390 OperandContainer<LOperand*, I> inputs_;
391 OperandContainer<LOperand*, T> temps_;
392 };
393
394
395 class LGap: public LTemplateInstruction<0, 0, 0> {
334 public: 396 public:
335 explicit LGap(HBasicBlock* block) 397 explicit LGap(HBasicBlock* block)
336 : block_(block) { 398 : block_(block) {
337 parallel_moves_[BEFORE] = NULL; 399 parallel_moves_[BEFORE] = NULL;
338 parallel_moves_[START] = NULL; 400 parallel_moves_[START] = NULL;
339 parallel_moves_[END] = NULL; 401 parallel_moves_[END] = NULL;
340 parallel_moves_[AFTER] = NULL; 402 parallel_moves_[AFTER] = NULL;
341 } 403 }
342 404
343 DECLARE_CONCRETE_INSTRUCTION(Gap, "gap") 405 DECLARE_CONCRETE_INSTRUCTION(Gap, "gap")
(...skipping 20 matching lines...) Expand all
364 LParallelMove* GetParallelMove(InnerPosition pos) { 426 LParallelMove* GetParallelMove(InnerPosition pos) {
365 return parallel_moves_[pos]; 427 return parallel_moves_[pos];
366 } 428 }
367 429
368 private: 430 private:
369 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; 431 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
370 HBasicBlock* block_; 432 HBasicBlock* block_;
371 }; 433 };
372 434
373 435
374 class LGoto: public LInstruction { 436 class LGoto: public LTemplateInstruction<0, 0, 0> {
375 public: 437 public:
376 LGoto(int block_id, bool include_stack_check = false) 438 LGoto(int block_id, bool include_stack_check = false)
377 : block_id_(block_id), include_stack_check_(include_stack_check) { } 439 : block_id_(block_id), include_stack_check_(include_stack_check) { }
378 440
379 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") 441 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
380 virtual void PrintDataTo(StringStream* stream) const; 442 virtual void PrintDataTo(StringStream* stream);
381 virtual bool IsControl() const { return true; } 443 virtual bool IsControl() const { return true; }
382 444
383 int block_id() const { return block_id_; } 445 int block_id() const { return block_id_; }
384 bool include_stack_check() const { return include_stack_check_; } 446 bool include_stack_check() const { return include_stack_check_; }
385 447
386 private: 448 private:
387 int block_id_; 449 int block_id_;
388 bool include_stack_check_; 450 bool include_stack_check_;
389 }; 451 };
390 452
391 453
392 class LLazyBailout: public LInstruction { 454 class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
393 public: 455 public:
394 LLazyBailout() : gap_instructions_size_(0) { } 456 LLazyBailout() : gap_instructions_size_(0) { }
395 457
396 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout") 458 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
397 459
398 void set_gap_instructions_size(int gap_instructions_size) { 460 void set_gap_instructions_size(int gap_instructions_size) {
399 gap_instructions_size_ = gap_instructions_size; 461 gap_instructions_size_ = gap_instructions_size;
400 } 462 }
401 int gap_instructions_size() { return gap_instructions_size_; } 463 int gap_instructions_size() { return gap_instructions_size_; }
402 464
403 private: 465 private:
404 int gap_instructions_size_; 466 int gap_instructions_size_;
405 }; 467 };
406 468
407 469
408 class LDeoptimize: public LInstruction { 470 class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
409 public: 471 public:
410 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") 472 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
411 }; 473 };
412 474
413 475
414 class LLabel: public LGap { 476 class LLabel: public LGap {
415 public: 477 public:
416 explicit LLabel(HBasicBlock* block) 478 explicit LLabel(HBasicBlock* block)
417 : LGap(block), replacement_(NULL) { } 479 : LGap(block), replacement_(NULL) { }
418 480
419 DECLARE_CONCRETE_INSTRUCTION(Label, "label") 481 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
420 482
421 virtual void PrintDataTo(StringStream* stream) const; 483 virtual void PrintDataTo(StringStream* stream);
422 484
423 int block_id() const { return block()->block_id(); } 485 int block_id() const { return block()->block_id(); }
424 bool is_loop_header() const { return block()->IsLoopHeader(); } 486 bool is_loop_header() const { return block()->IsLoopHeader(); }
425 Label* label() { return &label_; } 487 Label* label() { return &label_; }
426 LLabel* replacement() const { return replacement_; } 488 LLabel* replacement() const { return replacement_; }
427 void set_replacement(LLabel* label) { replacement_ = label; } 489 void set_replacement(LLabel* label) { replacement_ = label; }
428 bool HasReplacement() const { return replacement_ != NULL; } 490 bool HasReplacement() const { return replacement_ != NULL; }
429 491
430 private: 492 private:
431 Label label_; 493 Label label_;
432 LLabel* replacement_; 494 LLabel* replacement_;
433 }; 495 };
434 496
435 497
436 class LParameter: public LInstruction { 498 class LParameter: public LTemplateInstruction<1, 0, 0> {
437 public: 499 public:
438 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter") 500 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
439 }; 501 };
440 502
441 503
442 class LCallStub: public LInstruction { 504 class LCallStub: public LTemplateInstruction<1, 0, 0> {
443 public: 505 public:
444 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub") 506 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
445 DECLARE_HYDROGEN_ACCESSOR(CallStub) 507 DECLARE_HYDROGEN_ACCESSOR(CallStub)
446 508
447 TranscendentalCache::Type transcendental_type() { 509 TranscendentalCache::Type transcendental_type() {
448 return hydrogen()->transcendental_type(); 510 return hydrogen()->transcendental_type();
449 } 511 }
450 }; 512 };
451 513
452 514
453 class LUnknownOSRValue: public LInstruction { 515 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
454 public: 516 public:
455 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") 517 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
456 }; 518 };
457 519
458 520
459 class LUnaryOperation: public LInstruction { 521 template<int I, int T>
522 class LControlInstruction: public LTemplateInstruction<0, I, T> {
460 public: 523 public:
461 explicit LUnaryOperation(LOperand* input) : input_(input) { } 524 DECLARE_INSTRUCTION(ControlInstruction)
525 virtual bool IsControl() const { return true; }
462 526
463 DECLARE_INSTRUCTION(UnaryOperation) 527 int true_block_id() const { return true_block_id_; }
464 528 int false_block_id() const { return false_block_id_; }
465 LOperand* input() const { return input_; } 529 void SetBranchTargets(int true_block_id, int false_block_id) {
466 530 true_block_id_ = true_block_id;
467 virtual void PrintDataTo(StringStream* stream) const; 531 false_block_id_ = false_block_id;
532 }
468 533
469 private: 534 private:
470 LOperand* input_; 535 int true_block_id_;
536 int false_block_id_;
471 }; 537 };
472 538
473 539
474 class LBinaryOperation: public LInstruction { 540 class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
475 public:
476 LBinaryOperation(LOperand* left, LOperand* right)
477 : left_(left), right_(right) { }
478
479 DECLARE_INSTRUCTION(BinaryOperation)
480
481 LOperand* left() const { return left_; }
482 LOperand* right() const { return right_; }
483 virtual void PrintDataTo(StringStream* stream) const;
484
485 private:
486 LOperand* left_;
487 LOperand* right_;
488 };
489
490
491 class LApplyArguments: public LBinaryOperation {
492 public: 541 public:
493 LApplyArguments(LOperand* function, 542 LApplyArguments(LOperand* function,
494 LOperand* receiver, 543 LOperand* receiver,
495 LOperand* length, 544 LOperand* length,
496 LOperand* elements) 545 LOperand* elements) {
497 : LBinaryOperation(function, receiver), 546 inputs_[0] = function;
498 length_(length), 547 inputs_[1] = receiver;
499 elements_(elements) { } 548 inputs_[2] = length;
549 inputs_[3] = elements;
550 }
500 551
501 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments") 552 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
502 553
503 LOperand* function() const { return left(); } 554 LOperand* function() { return inputs_[0]; }
504 LOperand* receiver() const { return right(); } 555 LOperand* receiver() { return inputs_[1]; }
505 LOperand* length() const { return length_; } 556 LOperand* length() { return inputs_[2]; }
506 LOperand* elements() const { return elements_; } 557 LOperand* elements() { return inputs_[3]; }
507
508 private:
509 LOperand* length_;
510 LOperand* elements_;
511 }; 558 };
512 559
513 560
514 class LAccessArgumentsAt: public LInstruction { 561 class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
515 public: 562 public:
516 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) 563 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
517 : arguments_(arguments), length_(length), index_(index) { } 564 inputs_[0] = arguments;
565 inputs_[1] = length;
566 inputs_[2] = index;
567 }
518 568
519 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at") 569 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
520 570
521 LOperand* arguments() const { return arguments_; } 571 LOperand* arguments() { return inputs_[0]; }
522 LOperand* length() const { return length_; } 572 LOperand* length() { return inputs_[1]; }
523 LOperand* index() const { return index_; } 573 LOperand* index() { return inputs_[2]; }
524 574
525 virtual void PrintDataTo(StringStream* stream) const; 575 virtual void PrintDataTo(StringStream* stream);
526
527 private:
528 LOperand* arguments_;
529 LOperand* length_;
530 LOperand* index_;
531 }; 576 };
532 577
533 578
534 class LArgumentsLength: public LUnaryOperation { 579 class LArgumentsLength: public LTemplateInstruction<1, 1, 0> {
535 public: 580 public:
536 explicit LArgumentsLength(LOperand* elements) : LUnaryOperation(elements) {} 581 explicit LArgumentsLength(LOperand* elements) {
582 inputs_[0] = elements;
583 }
537 584
538 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length") 585 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
539 }; 586 };
540 587
541 588
542 class LArgumentsElements: public LInstruction { 589 class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
543 public: 590 public:
544 LArgumentsElements() { } 591 LArgumentsElements() { }
545 592
546 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements") 593 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
547 }; 594 };
548 595
549 596
550 class LModI: public LBinaryOperation { 597 class LModI: public LTemplateInstruction<1, 2, 0> {
551 public: 598 public:
552 LModI(LOperand* left, LOperand* right) : LBinaryOperation(left, right) { } 599 LModI(LOperand* left, LOperand* right) {
600 inputs_[0] = left;
601 inputs_[1] = right;
602 }
553 603
554 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") 604 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
555 DECLARE_HYDROGEN_ACCESSOR(Mod) 605 DECLARE_HYDROGEN_ACCESSOR(Mod)
556 }; 606 };
557 607
558 608
559 class LDivI: public LBinaryOperation { 609 class LDivI: public LTemplateInstruction<1, 2, 0> {
560 public: 610 public:
561 LDivI(LOperand* left, LOperand* right) 611 LDivI(LOperand* left, LOperand* right) {
562 : LBinaryOperation(left, right) { } 612 inputs_[0] = left;
613 inputs_[1] = right;
614 }
563 615
564 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") 616 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
565 DECLARE_HYDROGEN_ACCESSOR(Div) 617 DECLARE_HYDROGEN_ACCESSOR(Div)
566 }; 618 };
567 619
568 620
569 class LMulI: public LBinaryOperation { 621 class LMulI: public LTemplateInstruction<1, 2, 1> {
570 public: 622 public:
571 LMulI(LOperand* left, LOperand* right, LOperand* temp) 623 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
572 : LBinaryOperation(left, right), temp_(temp) { } 624 inputs_[0] = left;
625 inputs_[1] = right;
626 temps_[0] = temp;
627 }
573 628
574 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") 629 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
575 DECLARE_HYDROGEN_ACCESSOR(Mul) 630 DECLARE_HYDROGEN_ACCESSOR(Mul)
576 631 };
577 LOperand* temp() const { return temp_; } 632
578 633
579 private: 634 class LCmpID: public LTemplateInstruction<1, 2, 0> {
580 LOperand* temp_; 635 public:
581 }; 636 LCmpID(LOperand* left, LOperand* right) {
582 637 inputs_[0] = left;
583 638 inputs_[1] = right;
584 class LCmpID: public LBinaryOperation { 639 }
585 public: 640
586 LCmpID(LOperand* left, LOperand* right) 641 DECLARE_CONCRETE_INSTRUCTION(CmpID, "cmp-id")
587 : LBinaryOperation(left, right) { } 642 DECLARE_HYDROGEN_ACCESSOR(Compare)
588 643
589 Token::Value op() const { return hydrogen()->token(); } 644 Token::Value op() const { return hydrogen()->token(); }
590 bool is_double() const { 645 bool is_double() const {
591 return hydrogen()->GetInputRepresentation().IsDouble(); 646 return hydrogen()->GetInputRepresentation().IsDouble();
592 } 647 }
593 648 };
594 DECLARE_CONCRETE_INSTRUCTION(CmpID, "cmp-id") 649
650
651 class LCmpIDAndBranch: public LControlInstruction<2, 0> {
652 public:
653 LCmpIDAndBranch(LOperand* left, LOperand* right) {
654 inputs_[0] = left;
655 inputs_[1] = right;
656 }
657
658 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch")
595 DECLARE_HYDROGEN_ACCESSOR(Compare) 659 DECLARE_HYDROGEN_ACCESSOR(Compare)
596 }; 660
597 661 Token::Value op() const { return hydrogen()->token(); }
598 662 bool is_double() const {
599 class LCmpIDAndBranch: public LCmpID { 663 return hydrogen()->GetInputRepresentation().IsDouble();
600 public: 664 }
601 LCmpIDAndBranch(LOperand* left, 665
602 LOperand* right, 666 virtual void PrintDataTo(StringStream* stream);
603 int true_block_id, 667 };
604 int false_block_id) 668
605 : LCmpID(left, right), 669
606 true_block_id_(true_block_id), 670 class LUnaryMathOperation: public LTemplateInstruction<1, 1, 1> {
607 false_block_id_(false_block_id) { } 671 public:
608 672 LUnaryMathOperation(LOperand* value, LOperand* temp) {
609 DECLARE_CONCRETE_INSTRUCTION(CmpIDAndBranch, "cmp-id-and-branch") 673 inputs_[0] = value;
610 virtual void PrintDataTo(StringStream* stream) const; 674 temps_[0] = temp;
611 virtual bool IsControl() const { return true; } 675 }
612
613 int true_block_id() const { return true_block_id_; }
614 int false_block_id() const { return false_block_id_; }
615
616 private:
617 int true_block_id_;
618 int false_block_id_;
619 };
620
621
622 class LUnaryMathOperation: public LUnaryOperation {
623 public:
624 explicit LUnaryMathOperation(LOperand* value, LOperand* temp)
625 : LUnaryOperation(value), temp_(temp) { }
626 676
627 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation") 677 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
628 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) 678 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
629 679
630 virtual void PrintDataTo(StringStream* stream) const; 680 virtual void PrintDataTo(StringStream* stream);
631 BuiltinFunctionId op() const { return hydrogen()->op(); } 681 BuiltinFunctionId op() const { return hydrogen()->op(); }
632 LOperand* temp() const { return temp_; } 682 };
633 683
634 private: 684
635 LOperand* temp_; 685 class LCmpJSObjectEq: public LTemplateInstruction<1, 2, 0> {
636 }; 686 public:
637 687 LCmpJSObjectEq(LOperand* left, LOperand* right) {
638 688 inputs_[0] = left;
639 class LCmpJSObjectEq: public LBinaryOperation { 689 inputs_[1] = right;
640 public: 690 }
641 LCmpJSObjectEq(LOperand* left, LOperand* right)
642 : LBinaryOperation(left, right) {}
643 691
644 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEq, "cmp-jsobject-eq") 692 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEq, "cmp-jsobject-eq")
645 }; 693 };
646 694
647 695
648 class LCmpJSObjectEqAndBranch: public LCmpJSObjectEq { 696 class LCmpJSObjectEqAndBranch: public LControlInstruction<2, 0> {
649 public: 697 public:
650 LCmpJSObjectEqAndBranch(LOperand* left, 698 LCmpJSObjectEqAndBranch(LOperand* left, LOperand* right) {
651 LOperand* right, 699 inputs_[0] = left;
652 int true_block_id, 700 inputs_[1] = right;
653 int false_block_id) 701 }
654 : LCmpJSObjectEq(left, right),
655 true_block_id_(true_block_id),
656 false_block_id_(false_block_id) { }
657 702
658 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEqAndBranch, 703 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEqAndBranch,
659 "cmp-jsobject-eq-and-branch") 704 "cmp-jsobject-eq-and-branch")
660 705 };
661 int true_block_id() const { return true_block_id_; } 706
662 int false_block_id() const { return false_block_id_; } 707
663 708 class LIsNull: public LTemplateInstruction<1, 1, 0> {
664 private: 709 public:
665 int true_block_id_; 710 explicit LIsNull(LOperand* value) {
666 int false_block_id_; 711 inputs_[0] = value;
667 }; 712 }
668
669
670 class LIsNull: public LUnaryOperation {
671 public:
672 explicit LIsNull(LOperand* value) : LUnaryOperation(value) {}
673 713
674 DECLARE_CONCRETE_INSTRUCTION(IsNull, "is-null") 714 DECLARE_CONCRETE_INSTRUCTION(IsNull, "is-null")
675 DECLARE_HYDROGEN_ACCESSOR(IsNull); 715 DECLARE_HYDROGEN_ACCESSOR(IsNull)
676 716
677 bool is_strict() const { return hydrogen()->is_strict(); } 717 bool is_strict() const { return hydrogen()->is_strict(); }
678 }; 718 };
679 719
680 720 class LIsNullAndBranch: public LControlInstruction<1, 0> {
681 class LIsNullAndBranch: public LIsNull { 721 public:
682 public: 722 explicit LIsNullAndBranch(LOperand* value) {
683 LIsNullAndBranch(LOperand* value, 723 inputs_[0] = value;
684 int true_block_id, 724 }
685 int false_block_id)
686 : LIsNull(value),
687 true_block_id_(true_block_id),
688 false_block_id_(false_block_id) { }
689 725
690 DECLARE_CONCRETE_INSTRUCTION(IsNullAndBranch, "is-null-and-branch") 726 DECLARE_CONCRETE_INSTRUCTION(IsNullAndBranch, "is-null-and-branch")
691 virtual void PrintDataTo(StringStream* stream) const; 727 DECLARE_HYDROGEN_ACCESSOR(IsNull)
692 virtual bool IsControl() const { return true; } 728
693 729 bool is_strict() const { return hydrogen()->is_strict(); }
694 int true_block_id() const { return true_block_id_; } 730
695 int false_block_id() const { return false_block_id_; } 731 virtual void PrintDataTo(StringStream* stream);
696 732 };
697 private: 733
698 int true_block_id_; 734
699 int false_block_id_; 735 class LIsObject: public LTemplateInstruction<1, 1, 1> {
700 }; 736 public:
701 737 explicit LIsObject(LOperand* value) {
702 738 inputs_[0] = value;
703 class LIsObject: public LUnaryOperation { 739 }
704 public:
705 LIsObject(LOperand* value, LOperand* temp)
706 : LUnaryOperation(value), temp_(temp) {}
707 740
708 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is-object") 741 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is-object")
709 742 };
710 LOperand* temp() const { return temp_; } 743
711 744
712 private: 745 class LIsObjectAndBranch: public LControlInstruction<1, 2> {
713 LOperand* temp_; 746 public:
714 }; 747 LIsObjectAndBranch(LOperand* value, LOperand* temp) {
715 748 inputs_[0] = value;
716 749 temps_[0] = temp;
717 class LIsObjectAndBranch: public LIsObject { 750 }
718 public:
719 LIsObjectAndBranch(LOperand* value,
720 LOperand* temp,
721 LOperand* temp2,
722 int true_block_id,
723 int false_block_id)
724 : LIsObject(value, temp),
725 temp2_(temp2),
726 true_block_id_(true_block_id),
727 false_block_id_(false_block_id) { }
728 751
729 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch") 752 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch, "is-object-and-branch")
730 virtual void PrintDataTo(StringStream* stream) const; 753
731 virtual bool IsControl() const { return true; } 754 virtual void PrintDataTo(StringStream* stream);
732 755 };
733 int true_block_id() const { return true_block_id_; } 756
734 int false_block_id() const { return false_block_id_; } 757
735 758 class LIsSmi: public LTemplateInstruction<1, 1, 0> {
736 LOperand* temp2() const { return temp2_; } 759 public:
737 760 explicit LIsSmi(LOperand* value) {
738 private: 761 inputs_[0] = value;
739 LOperand* temp2_; 762 }
740 int true_block_id_;
741 int false_block_id_;
742 };
743
744
745 class LIsSmi: public LUnaryOperation {
746 public:
747 explicit LIsSmi(LOperand* value) : LUnaryOperation(value) {}
748 763
749 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is-smi") 764 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is-smi")
750 DECLARE_HYDROGEN_ACCESSOR(IsSmi) 765 DECLARE_HYDROGEN_ACCESSOR(IsSmi)
751 }; 766 };
752 767
753 768
754 class LIsSmiAndBranch: public LIsSmi { 769 class LIsSmiAndBranch: public LControlInstruction<1, 0> {
755 public: 770 public:
756 LIsSmiAndBranch(LOperand* value, 771 explicit LIsSmiAndBranch(LOperand* value) {
757 int true_block_id, 772 inputs_[0] = value;
758 int false_block_id) 773 }
759 : LIsSmi(value),
760 true_block_id_(true_block_id),
761 false_block_id_(false_block_id) { }
762 774
763 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch") 775 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch, "is-smi-and-branch")
764 virtual void PrintDataTo(StringStream* stream) const; 776
765 virtual bool IsControl() const { return true; } 777 virtual void PrintDataTo(StringStream* stream);
766 778 };
767 int true_block_id() const { return true_block_id_; } 779
768 int false_block_id() const { return false_block_id_; } 780
769 781 class LHasInstanceType: public LTemplateInstruction<1, 1, 0> {
770 private: 782 public:
771 int true_block_id_; 783 explicit LHasInstanceType(LOperand* value) {
772 int false_block_id_; 784 inputs_[0] = value;
773 }; 785 }
774
775
776 class LHasInstanceType: public LUnaryOperation {
777 public:
778 explicit LHasInstanceType(LOperand* value)
779 : LUnaryOperation(value) { }
780 786
781 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has-instance-type") 787 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has-instance-type")
782 DECLARE_HYDROGEN_ACCESSOR(HasInstanceType) 788 DECLARE_HYDROGEN_ACCESSOR(HasInstanceType)
783 789 };
784 InstanceType TestType(); // The type to test against when generating code. 790
785 Condition BranchCondition(); // The branch condition for 'true'. 791
786 }; 792 class LHasInstanceTypeAndBranch: public LControlInstruction<1, 0> {
787 793 public:
788 794 explicit LHasInstanceTypeAndBranch(LOperand* value) {
789 class LHasInstanceTypeAndBranch: public LHasInstanceType { 795 inputs_[0] = value;
790 public: 796 }
791 LHasInstanceTypeAndBranch(LOperand* value,
792 int true_block_id,
793 int false_block_id)
794 : LHasInstanceType(value),
795 true_block_id_(true_block_id),
796 false_block_id_(false_block_id) { }
797 797
798 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch, 798 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch,
799 "has-instance-type-and-branch") 799 "has-instance-type-and-branch")
800 virtual void PrintDataTo(StringStream* stream) const; 800 DECLARE_HYDROGEN_ACCESSOR(HasInstanceType)
801 virtual bool IsControl() const { return true; } 801
802 802 virtual void PrintDataTo(StringStream* stream);
803 int true_block_id() const { return true_block_id_; } 803 };
804 int false_block_id() const { return false_block_id_; } 804
805 805
806 private: 806 class LHasCachedArrayIndex: public LTemplateInstruction<1, 1, 0> {
807 int true_block_id_; 807 public:
808 int false_block_id_; 808 explicit LHasCachedArrayIndex(LOperand* value) {
809 }; 809 inputs_[0] = value;
810 810 }
811
812 class LHasCachedArrayIndex: public LUnaryOperation {
813 public:
814 explicit LHasCachedArrayIndex(LOperand* value) : LUnaryOperation(value) {}
815 811
816 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has-cached-array-index") 812 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has-cached-array-index")
817 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndex) 813 DECLARE_HYDROGEN_ACCESSOR(HasCachedArrayIndex)
818 }; 814 };
819 815
820 816
821 class LHasCachedArrayIndexAndBranch: public LHasCachedArrayIndex { 817 class LHasCachedArrayIndexAndBranch: public LControlInstruction<1, 0> {
822 public: 818 public:
823 LHasCachedArrayIndexAndBranch(LOperand* value, 819 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
824 int true_block_id, 820 inputs_[0] = value;
825 int false_block_id) 821 }
826 : LHasCachedArrayIndex(value),
827 true_block_id_(true_block_id),
828 false_block_id_(false_block_id) { }
829 822
830 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch, 823 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
831 "has-cached-array-index-and-branch") 824 "has-cached-array-index-and-branch")
832 virtual void PrintDataTo(StringStream* stream) const; 825 virtual void PrintDataTo(StringStream* stream);
833 virtual bool IsControl() const { return true; } 826 };
834 827
835 int true_block_id() const { return true_block_id_; } 828
836 int false_block_id() const { return false_block_id_; } 829 class LClassOfTest: public LTemplateInstruction<1, 1, 0> {
837 830 public:
838 private: 831 explicit LClassOfTest(LOperand* value) {
839 int true_block_id_; 832 inputs_[0] = value;
840 int false_block_id_; 833 }
841 };
842
843
844 class LClassOfTest: public LUnaryOperation {
845 public:
846 explicit LClassOfTest(LOperand* value) : LUnaryOperation(value) {}
847 834
848 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class-of-test") 835 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class-of-test")
849 DECLARE_HYDROGEN_ACCESSOR(ClassOfTest) 836 DECLARE_HYDROGEN_ACCESSOR(ClassOfTest)
850 837
851 virtual void PrintDataTo(StringStream* stream) const; 838 virtual void PrintDataTo(StringStream* stream);
852 }; 839 };
853 840
854 841
855 class LClassOfTestAndBranch: public LClassOfTest { 842 class LClassOfTestAndBranch: public LControlInstruction<1, 1> {
856 public: 843 public:
857 LClassOfTestAndBranch(LOperand* value, 844 LClassOfTestAndBranch(LOperand* value, LOperand* temp) {
858 LOperand* temporary, 845 inputs_[0] = value;
859 int true_block_id, 846 temps_[0] = temp;
860 int false_block_id) 847 }
861 : LClassOfTest(value),
862 temporary_(temporary),
863 true_block_id_(true_block_id),
864 false_block_id_(false_block_id) { }
865 848
866 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch, 849 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch,
867 "class-of-test-and-branch") 850 "class-of-test-and-branch")
868 virtual void PrintDataTo(StringStream* stream) const; 851 DECLARE_HYDROGEN_ACCESSOR(ClassOfTest)
869 virtual bool IsControl() const { return true; } 852
870 853 virtual void PrintDataTo(StringStream* stream);
871 int true_block_id() const { return true_block_id_; } 854 };
872 int false_block_id() const { return false_block_id_; } 855
873 LOperand* temporary() { return temporary_; } 856
874 857 class LCmpT: public LTemplateInstruction<1, 2, 0> {
875 private: 858 public:
876 LOperand* temporary_; 859 LCmpT(LOperand* left, LOperand* right) {
877 int true_block_id_; 860 inputs_[0] = left;
878 int false_block_id_; 861 inputs_[1] = right;
879 }; 862 }
880
881
882 class LCmpT: public LBinaryOperation {
883 public:
884 LCmpT(LOperand* left, LOperand* right) : LBinaryOperation(left, right) {}
885 863
886 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") 864 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
887 DECLARE_HYDROGEN_ACCESSOR(Compare) 865 DECLARE_HYDROGEN_ACCESSOR(Compare)
888 866
889 Token::Value op() const { return hydrogen()->token(); } 867 Token::Value op() const { return hydrogen()->token(); }
890 }; 868 };
891 869
892 870
893 class LCmpTAndBranch: public LCmpT { 871 class LCmpTAndBranch: public LControlInstruction<2, 0> {
894 public: 872 public:
895 LCmpTAndBranch(LOperand* left, 873 LCmpTAndBranch(LOperand* left, LOperand* right) {
896 LOperand* right, 874 inputs_[0] = left;
897 int true_block_id, 875 inputs_[1] = right;
898 int false_block_id) 876 }
899 : LCmpT(left, right),
900 true_block_id_(true_block_id),
901 false_block_id_(false_block_id) { }
902 877
903 DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch") 878 DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch")
879 DECLARE_HYDROGEN_ACCESSOR(Compare)
904 880
905 int true_block_id() const { return true_block_id_; } 881 Token::Value op() const { return hydrogen()->token(); }
906 int false_block_id() const { return false_block_id_; }
907
908 private:
909 int true_block_id_;
910 int false_block_id_;
911 }; 882 };
912 883
913 884
914 class LInstanceOf: public LBinaryOperation { 885 class LInstanceOf: public LTemplateInstruction<1, 2, 0> {
915 public: 886 public:
916 LInstanceOf(LOperand* left, LOperand* right) 887 LInstanceOf(LOperand* left, LOperand* right) {
917 : LBinaryOperation(left, right) { } 888 inputs_[0] = left;
889 inputs_[1] = right;
890 }
918 891
919 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of") 892 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
920 }; 893 };
921 894
922 895
923 class LInstanceOfAndBranch: public LInstanceOf { 896 class LInstanceOfAndBranch: public LControlInstruction<2, 0> {
924 public: 897 public:
925 LInstanceOfAndBranch(LOperand* left, 898 LInstanceOfAndBranch(LOperand* left, LOperand* right) {
926 LOperand* right, 899 inputs_[0] = left;
927 int true_block_id, 900 inputs_[1] = right;
928 int false_block_id) 901 }
929 : LInstanceOf(left, right),
930 true_block_id_(true_block_id),
931 false_block_id_(false_block_id) { }
932 902
933 DECLARE_CONCRETE_INSTRUCTION(InstanceOfAndBranch, "instance-of-and-branch") 903 DECLARE_CONCRETE_INSTRUCTION(InstanceOfAndBranch, "instance-of-and-branch")
934
935 int true_block_id() const { return true_block_id_; }
936 int false_block_id() const { return false_block_id_; }
937
938 private:
939 int true_block_id_;
940 int false_block_id_;
941 }; 904 };
942 905
943 906
944 class LInstanceOfKnownGlobal: public LUnaryOperation { 907 class LInstanceOfKnownGlobal: public LTemplateInstruction<1, 1, 1> {
945 public: 908 public:
946 explicit LInstanceOfKnownGlobal(LOperand* left) 909 LInstanceOfKnownGlobal(LOperand* value, LOperand* temp) {
947 : LUnaryOperation(left) { } 910 inputs_[0] = value;
911 temps_[0] = temp;
912 }
948 913
949 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal, 914 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal,
950 "instance-of-known-global") 915 "instance-of-known-global")
951 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) 916 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
952 917
953 Handle<JSFunction> function() const { return hydrogen()->function(); } 918 Handle<JSFunction> function() const { return hydrogen()->function(); }
954 }; 919 };
955 920
956 921
957 class LBoundsCheck: public LBinaryOperation { 922 class LBoundsCheck: public LTemplateInstruction<0, 2, 0> {
958 public: 923 public:
959 LBoundsCheck(LOperand* index, LOperand* length) 924 LBoundsCheck(LOperand* index, LOperand* length) {
960 : LBinaryOperation(index, length) { } 925 inputs_[0] = index;
926 inputs_[1] = length;
927 }
961 928
962 LOperand* index() const { return left(); } 929 LOperand* index() { return inputs_[0]; }
963 LOperand* length() const { return right(); } 930 LOperand* length() { return inputs_[1]; }
964 931
965 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check") 932 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
966 }; 933 };
967 934
968 935
969 class LBitI: public LBinaryOperation { 936 class LBitI: public LTemplateInstruction<1, 2, 0> {
970 public: 937 public:
971 LBitI(Token::Value op, LOperand* left, LOperand* right) 938 LBitI(Token::Value op, LOperand* left, LOperand* right)
972 : LBinaryOperation(left, right), op_(op) { } 939 : op_(op) {
940 inputs_[0] = left;
941 inputs_[1] = right;
942 }
973 943
974 Token::Value op() const { return op_; } 944 Token::Value op() const { return op_; }
975 945
976 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i") 946 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
977 947
978 private: 948 private:
979 Token::Value op_; 949 Token::Value op_;
980 }; 950 };
981 951
982 952
983 class LShiftI: public LBinaryOperation { 953 class LShiftI: public LTemplateInstruction<1, 2, 0> {
984 public: 954 public:
985 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt) 955 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
986 : LBinaryOperation(left, right), op_(op), can_deopt_(can_deopt) { } 956 : op_(op), can_deopt_(can_deopt) {
957 inputs_[0] = left;
958 inputs_[1] = right;
959 }
987 960
988 Token::Value op() const { return op_; } 961 Token::Value op() const { return op_; }
989 962
990 bool can_deopt() const { return can_deopt_; } 963 bool can_deopt() const { return can_deopt_; }
991 964
992 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i") 965 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
993 966
994 private: 967 private:
995 Token::Value op_; 968 Token::Value op_;
996 bool can_deopt_; 969 bool can_deopt_;
997 }; 970 };
998 971
999 972
1000 class LSubI: public LBinaryOperation { 973 class LSubI: public LTemplateInstruction<1, 2, 0> {
1001 public: 974 public:
1002 LSubI(LOperand* left, LOperand* right) 975 LSubI(LOperand* left, LOperand* right) {
1003 : LBinaryOperation(left, right) { } 976 inputs_[0] = left;
977 inputs_[1] = right;
978 }
1004 979
1005 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") 980 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1006 DECLARE_HYDROGEN_ACCESSOR(Sub) 981 DECLARE_HYDROGEN_ACCESSOR(Sub)
1007 }; 982 };
1008 983
1009 984
1010 class LConstant: public LInstruction { 985 class LConstant: public LTemplateInstruction<1, 0, 0> {
1011 DECLARE_INSTRUCTION(Constant) 986 DECLARE_INSTRUCTION(Constant)
1012 }; 987 };
1013 988
1014 989
1015 class LConstantI: public LConstant { 990 class LConstantI: public LConstant {
1016 public: 991 public:
1017 explicit LConstantI(int32_t value) : value_(value) { } 992 explicit LConstantI(int32_t value) : value_(value) { }
1018 int32_t value() const { return value_; } 993 int32_t value() const { return value_; }
1019 994
1020 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") 995 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
(...skipping 20 matching lines...) Expand all
1041 explicit LConstantT(Handle<Object> value) : value_(value) { } 1016 explicit LConstantT(Handle<Object> value) : value_(value) { }
1042 Handle<Object> value() const { return value_; } 1017 Handle<Object> value() const { return value_; }
1043 1018
1044 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") 1019 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1045 1020
1046 private: 1021 private:
1047 Handle<Object> value_; 1022 Handle<Object> value_;
1048 }; 1023 };
1049 1024
1050 1025
1051 class LBranch: public LUnaryOperation { 1026 class LBranch: public LControlInstruction<1, 0> {
1052 public: 1027 public:
1053 LBranch(LOperand* input, int true_block_id, int false_block_id) 1028 explicit LBranch(LOperand* value) {
1054 : LUnaryOperation(input), 1029 inputs_[0] = value;
1055 true_block_id_(true_block_id), 1030 }
1056 false_block_id_(false_block_id) { }
1057 1031
1058 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") 1032 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1059 DECLARE_HYDROGEN_ACCESSOR(Value) 1033 DECLARE_HYDROGEN_ACCESSOR(Value)
1060 1034
1061 virtual void PrintDataTo(StringStream* stream) const; 1035 virtual void PrintDataTo(StringStream* stream);
1062 virtual bool IsControl() const { return true; }
1063
1064 int true_block_id() const { return true_block_id_; }
1065 int false_block_id() const { return false_block_id_; }
1066
1067 private:
1068 int true_block_id_;
1069 int false_block_id_;
1070 }; 1036 };
1071 1037
1072 1038
1073 class LCmpMapAndBranch: public LUnaryOperation { 1039 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> {
1074 public: 1040 public:
1075 LCmpMapAndBranch(LOperand* value, LOperand* temp) 1041 LCmpMapAndBranch(LOperand* value, LOperand* temp) {
1076 : LUnaryOperation(value), temp_(temp) { } 1042 inputs_[0] = value;
1043 temps_[0] = temp;
1044 }
1077 1045
1078 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") 1046 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1079 DECLARE_HYDROGEN_ACCESSOR(CompareMapAndBranch) 1047 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1080 1048
1081 virtual bool IsControl() const { return true; } 1049 virtual bool IsControl() const { return true; }
1082 1050
1083 LOperand* temp() const { return temp_; }
1084 Handle<Map> map() const { return hydrogen()->map(); } 1051 Handle<Map> map() const { return hydrogen()->map(); }
1085 int true_block_id() const { 1052 int true_block_id() const {
1086 return hydrogen()->true_destination()->block_id(); 1053 return hydrogen()->FirstSuccessor()->block_id();
1087 } 1054 }
1088 int false_block_id() const { 1055 int false_block_id() const {
1089 return hydrogen()->false_destination()->block_id(); 1056 return hydrogen()->SecondSuccessor()->block_id();
1090 } 1057 }
1091
1092 private:
1093 LOperand* temp_;
1094 }; 1058 };
1095 1059
1096 1060
1097 class LJSArrayLength: public LUnaryOperation { 1061 class LJSArrayLength: public LTemplateInstruction<1, 1, 0> {
1098 public: 1062 public:
1099 explicit LJSArrayLength(LOperand* input) : LUnaryOperation(input) { } 1063 explicit LJSArrayLength(LOperand* value) {
1064 inputs_[0] = value;
1065 }
1100 1066
1101 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length") 1067 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js-array-length")
1102 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength) 1068 DECLARE_HYDROGEN_ACCESSOR(JSArrayLength)
1103 }; 1069 };
1104 1070
1105 1071
1106 class LFixedArrayLength: public LUnaryOperation { 1072 class LFixedArrayLength: public LTemplateInstruction<1, 1, 0> {
1107 public: 1073 public:
1108 explicit LFixedArrayLength(LOperand* input) : LUnaryOperation(input) { } 1074 explicit LFixedArrayLength(LOperand* value) {
1075 inputs_[0] = value;
1076 }
1109 1077
1110 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed-array-length") 1078 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed-array-length")
1111 DECLARE_HYDROGEN_ACCESSOR(FixedArrayLength) 1079 DECLARE_HYDROGEN_ACCESSOR(FixedArrayLength)
1112 }; 1080 };
1113 1081
1114 1082
1115 class LValueOf: public LUnaryOperation { 1083 class LValueOf: public LTemplateInstruction<1, 1, 1> {
1116 public: 1084 public:
1117 LValueOf(LOperand* input, LOperand* temporary) 1085 LValueOf(LOperand* value, LOperand* temp) {
1118 : LUnaryOperation(input), temporary_(temporary) { } 1086 inputs_[0] = value;
1119 1087 temps_[0] = temp;
1120 LOperand* temporary() const { return temporary_; } 1088 }
1121 1089
1122 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of") 1090 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value-of")
1123 DECLARE_HYDROGEN_ACCESSOR(ValueOf) 1091 DECLARE_HYDROGEN_ACCESSOR(ValueOf)
1124
1125 private:
1126 LOperand* temporary_;
1127 }; 1092 };
1128 1093
1129 1094
1130 class LThrow: public LUnaryOperation { 1095 class LThrow: public LTemplateInstruction<0, 1, 0> {
1131 public: 1096 public:
1132 explicit LThrow(LOperand* value) : LUnaryOperation(value) { } 1097 explicit LThrow(LOperand* value) {
1098 inputs_[0] = value;
1099 }
1133 1100
1134 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 1101 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1135 }; 1102 };
1136 1103
1137 1104
1138 class LBitNotI: public LUnaryOperation { 1105 class LBitNotI: public LTemplateInstruction<1, 1, 0> {
1139 public: 1106 public:
1140 explicit LBitNotI(LOperand* use) : LUnaryOperation(use) { } 1107 explicit LBitNotI(LOperand* value) {
1108 inputs_[0] = value;
1109 }
1141 1110
1142 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i") 1111 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1143 }; 1112 };
1144 1113
1145 1114
1146 class LAddI: public LBinaryOperation { 1115 class LAddI: public LTemplateInstruction<1, 2, 0> {
1147 public: 1116 public:
1148 LAddI(LOperand* left, LOperand* right) 1117 LAddI(LOperand* left, LOperand* right) {
1149 : LBinaryOperation(left, right) { } 1118 inputs_[0] = left;
1119 inputs_[1] = right;
1120 }
1150 1121
1151 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i") 1122 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1152 DECLARE_HYDROGEN_ACCESSOR(Add) 1123 DECLARE_HYDROGEN_ACCESSOR(Add)
1153 }; 1124 };
1154 1125
1155 1126
1156 class LArithmeticD: public LBinaryOperation { 1127 class LArithmeticD: public LTemplateInstruction<1, 2, 0> {
1157 public: 1128 public:
1158 LArithmeticD(Token::Value op, LOperand* left, LOperand* right) 1129 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1159 : LBinaryOperation(left, right), op_(op) { } 1130 : op_(op) {
1131 inputs_[0] = left;
1132 inputs_[1] = right;
1133 }
1160 1134
1161 Token::Value op() const { return op_; } 1135 Token::Value op() const { return op_; }
1162 1136
1163 virtual void CompileToNative(LCodeGen* generator); 1137 virtual void CompileToNative(LCodeGen* generator);
1164 virtual const char* Mnemonic() const; 1138 virtual const char* Mnemonic() const;
1165 1139
1166 private: 1140 private:
1167 Token::Value op_; 1141 Token::Value op_;
1168 }; 1142 };
1169 1143
1170 1144
1171 class LArithmeticT: public LBinaryOperation { 1145 class LArithmeticT: public LTemplateInstruction<1, 2, 0> {
1172 public: 1146 public:
1173 LArithmeticT(Token::Value op, LOperand* left, LOperand* right) 1147 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1174 : LBinaryOperation(left, right), op_(op) { } 1148 : op_(op) {
1149 inputs_[0] = left;
1150 inputs_[1] = right;
1151 }
1175 1152
1176 virtual void CompileToNative(LCodeGen* generator); 1153 virtual void CompileToNative(LCodeGen* generator);
1177 virtual const char* Mnemonic() const; 1154 virtual const char* Mnemonic() const;
1178 1155
1179 Token::Value op() const { return op_; } 1156 Token::Value op() const { return op_; }
1180 1157
1181 private: 1158 private:
1182 Token::Value op_; 1159 Token::Value op_;
1183 }; 1160 };
1184 1161
1185 1162
1186 class LReturn: public LUnaryOperation { 1163 class LReturn: public LTemplateInstruction<0, 1, 0> {
1187 public: 1164 public:
1188 explicit LReturn(LOperand* use) : LUnaryOperation(use) { } 1165 explicit LReturn(LOperand* value) {
1166 inputs_[0] = value;
1167 }
1189 1168
1190 DECLARE_CONCRETE_INSTRUCTION(Return, "return") 1169 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
1191 }; 1170 };
1192 1171
1193 1172
1194 class LLoadNamedField: public LUnaryOperation { 1173 class LLoadNamedField: public LTemplateInstruction<1, 1, 0> {
1195 public: 1174 public:
1196 explicit LLoadNamedField(LOperand* object) : LUnaryOperation(object) { } 1175 explicit LLoadNamedField(LOperand* object) {
1176 inputs_[0] = object;
1177 }
1197 1178
1198 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field") 1179 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load-named-field")
1199 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField) 1180 DECLARE_HYDROGEN_ACCESSOR(LoadNamedField)
1200 }; 1181 };
1201 1182
1202 1183
1203 class LLoadNamedGeneric: public LUnaryOperation { 1184 class LLoadNamedGeneric: public LTemplateInstruction<1, 1, 0> {
1204 public: 1185 public:
1205 explicit LLoadNamedGeneric(LOperand* object) : LUnaryOperation(object) { } 1186 explicit LLoadNamedGeneric(LOperand* object) {
1187 inputs_[0] = object;
1188 }
1206 1189
1207 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic") 1190 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load-named-generic")
1208 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric) 1191 DECLARE_HYDROGEN_ACCESSOR(LoadNamedGeneric)
1209 1192
1210 LOperand* object() const { return input(); } 1193 LOperand* object() { return inputs_[0]; }
1211 Handle<Object> name() const { return hydrogen()->name(); } 1194 Handle<Object> name() const { return hydrogen()->name(); }
1212 }; 1195 };
1213 1196
1214 1197
1215 class LLoadFunctionPrototype: public LUnaryOperation { 1198 class LLoadFunctionPrototype: public LTemplateInstruction<1, 1, 0> {
1216 public: 1199 public:
1217 explicit LLoadFunctionPrototype(LOperand* function) 1200 explicit LLoadFunctionPrototype(LOperand* function) {
1218 : LUnaryOperation(function) { } 1201 inputs_[0] = function;
1202 }
1219 1203
1220 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype") 1204 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load-function-prototype")
1221 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype) 1205 DECLARE_HYDROGEN_ACCESSOR(LoadFunctionPrototype)
1222 1206
1223 LOperand* function() const { return input(); } 1207 LOperand* function() { return inputs_[0]; }
1224 }; 1208 };
1225 1209
1226 1210
1227 class LLoadElements: public LUnaryOperation { 1211 class LLoadElements: public LTemplateInstruction<1, 1, 0> {
1228 public: 1212 public:
1229 explicit LLoadElements(LOperand* obj) : LUnaryOperation(obj) { } 1213 explicit LLoadElements(LOperand* object) {
1214 inputs_[0] = object;
1215 }
1230 1216
1231 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") 1217 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1232 }; 1218 };
1233 1219
1234 1220
1235 class LLoadKeyedFastElement: public LBinaryOperation { 1221 class LLoadKeyedFastElement: public LTemplateInstruction<1, 2, 0> {
1236 public: 1222 public:
1237 LLoadKeyedFastElement(LOperand* elements, LOperand* key) 1223 LLoadKeyedFastElement(LOperand* elements, LOperand* key) {
1238 : LBinaryOperation(elements, key) { } 1224 inputs_[0] = elements;
1225 inputs_[1] = key;
1226 }
1239 1227
1240 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element") 1228 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1241 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement) 1229 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1242 1230
1243 LOperand* elements() const { return left(); } 1231 LOperand* elements() { return inputs_[0]; }
1244 LOperand* key() const { return right(); } 1232 LOperand* key() { return inputs_[1]; }
1245 }; 1233 };
1246 1234
1247 1235
1248 class LLoadKeyedGeneric: public LBinaryOperation { 1236 class LLoadKeyedGeneric: public LTemplateInstruction<1, 2, 0> {
1249 public: 1237 public:
1250 LLoadKeyedGeneric(LOperand* obj, LOperand* key) 1238 LLoadKeyedGeneric(LOperand* obj, LOperand* key) {
1251 : LBinaryOperation(obj, key) { } 1239 inputs_[0] = obj;
1240 inputs_[1] = key;
1241 }
1252 1242
1253 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") 1243 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1254 1244
1255 LOperand* object() const { return left(); } 1245 LOperand* object() { return inputs_[0]; }
1256 LOperand* key() const { return right(); } 1246 LOperand* key() { return inputs_[1]; }
1257 }; 1247 };
1258 1248
1259 1249
1260 class LLoadGlobal: public LInstruction { 1250 class LLoadGlobal: public LTemplateInstruction<1, 0, 0> {
1261 public: 1251 public:
1262 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global") 1252 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global")
1263 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal) 1253 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal)
1264 }; 1254 };
1265 1255
1266 1256
1267 class LStoreGlobal: public LUnaryOperation { 1257 class LStoreGlobal: public LTemplateInstruction<0, 1, 0> {
1268 public: 1258 public:
1269 explicit LStoreGlobal(LOperand* value) : LUnaryOperation(value) {} 1259 explicit LStoreGlobal(LOperand* value) {
1260 inputs_[0] = value;
1261 }
1270 1262
1271 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global") 1263 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global")
1272 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal) 1264 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal)
1273 }; 1265 };
1274 1266
1275 1267
1276 class LPushArgument: public LUnaryOperation { 1268 class LLoadContextSlot: public LTemplateInstruction<1, 0, 0> {
1277 public: 1269 public:
1278 explicit LPushArgument(LOperand* argument) : LUnaryOperation(argument) {} 1270 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1271 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1272
1273 int context_chain_length() { return hydrogen()->context_chain_length(); }
1274 int slot_index() { return hydrogen()->slot_index(); }
1275
1276 virtual void PrintDataTo(StringStream* stream);
1277 };
1278
1279
1280 class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1281 public:
1282 explicit LPushArgument(LOperand* value) {
1283 inputs_[0] = value;
1284 }
1279 1285
1280 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") 1286 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1281 }; 1287 };
1282 1288
1283 1289
1284 class LGlobalObject: public LInstruction { 1290 class LGlobalObject: public LTemplateInstruction<1, 0, 0> {
1285 public: 1291 public:
1286 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object") 1292 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1287 }; 1293 };
1288 1294
1289 1295
1290 class LGlobalReceiver: public LInstruction { 1296 class LGlobalReceiver: public LTemplateInstruction<1, 0, 0> {
1291 public: 1297 public:
1292 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") 1298 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1293 }; 1299 };
1294 1300
1295 1301
1296 class LCallConstantFunction: public LInstruction { 1302 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1297 public: 1303 public:
1298 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") 1304 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1299 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) 1305 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1300 1306
1301 virtual void PrintDataTo(StringStream* stream) const; 1307 virtual void PrintDataTo(StringStream* stream);
1302 1308
1303 Handle<JSFunction> function() const { return hydrogen()->function(); } 1309 Handle<JSFunction> function() { return hydrogen()->function(); }
1304 int arity() const { return hydrogen()->argument_count() - 1; } 1310 int arity() const { return hydrogen()->argument_count() - 1; }
1305 }; 1311 };
1306 1312
1307 1313
1308 class LCallKeyed: public LInstruction { 1314 class LCallKeyed: public LTemplateInstruction<1, 1, 0> {
1309 public: 1315 public:
1316 explicit LCallKeyed(LOperand* key) {
1317 inputs_[0] = key;
1318 }
1319
1310 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") 1320 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1311 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) 1321 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1312 1322
1313 virtual void PrintDataTo(StringStream* stream) const; 1323 virtual void PrintDataTo(StringStream* stream);
1314 1324
1315 int arity() const { return hydrogen()->argument_count() - 1; } 1325 int arity() const { return hydrogen()->argument_count() - 1; }
1316 }; 1326 };
1317 1327
1318 1328
1319 class LCallNamed: public LInstruction { 1329
1330 class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1320 public: 1331 public:
1321 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") 1332 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1322 DECLARE_HYDROGEN_ACCESSOR(CallNamed) 1333 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1323 1334
1324 virtual void PrintDataTo(StringStream* stream) const; 1335 virtual void PrintDataTo(StringStream* stream);
1325 1336
1326 Handle<String> name() const { return hydrogen()->name(); } 1337 Handle<String> name() const { return hydrogen()->name(); }
1327 int arity() const { return hydrogen()->argument_count() - 1; } 1338 int arity() const { return hydrogen()->argument_count() - 1; }
1328 }; 1339 };
1329 1340
1330 1341
1331 class LCallFunction: public LInstruction { 1342 class LCallFunction: public LTemplateInstruction<1, 0, 0> {
1332 public: 1343 public:
1333 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") 1344 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1334 DECLARE_HYDROGEN_ACCESSOR(CallFunction) 1345 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1335 1346
1336 int arity() const { return hydrogen()->argument_count() - 2; } 1347 int arity() const { return hydrogen()->argument_count() - 2; }
1337 }; 1348 };
1338 1349
1339 1350
1340 class LCallGlobal: public LInstruction { 1351 class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1341 public: 1352 public:
1342 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") 1353 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1343 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) 1354 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1344 1355
1345 virtual void PrintDataTo(StringStream* stream) const; 1356 virtual void PrintDataTo(StringStream* stream);
1346 1357
1347 Handle<String> name() const {return hydrogen()->name(); } 1358 Handle<String> name() const {return hydrogen()->name(); }
1348 int arity() const { return hydrogen()->argument_count() - 1; } 1359 int arity() const { return hydrogen()->argument_count() - 1; }
1349 }; 1360 };
1350 1361
1351 1362
1352 class LCallKnownGlobal: public LInstruction { 1363 class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1353 public: 1364 public:
1354 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") 1365 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1355 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) 1366 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1356 1367
1357 virtual void PrintDataTo(StringStream* stream) const; 1368 virtual void PrintDataTo(StringStream* stream);
1358 1369
1359 Handle<JSFunction> target() const { return hydrogen()->target(); } 1370 Handle<JSFunction> target() const { return hydrogen()->target(); }
1360 int arity() const { return hydrogen()->argument_count() - 1; } 1371 int arity() const { return hydrogen()->argument_count() - 1; }
1361 }; 1372 };
1362 1373
1363 1374
1364 class LCallNew: public LUnaryOperation { 1375 class LCallNew: public LTemplateInstruction<1, 1, 0> {
1365 public: 1376 public:
1366 explicit LCallNew(LOperand* constructor) : LUnaryOperation(constructor) { } 1377 explicit LCallNew(LOperand* constructor) {
1378 inputs_[0] = constructor;
1379 }
1367 1380
1368 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") 1381 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1369 DECLARE_HYDROGEN_ACCESSOR(CallNew) 1382 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1370 1383
1371 virtual void PrintDataTo(StringStream* stream) const; 1384 virtual void PrintDataTo(StringStream* stream);
1372 1385
1373 int arity() const { return hydrogen()->argument_count() - 1; } 1386 int arity() const { return hydrogen()->argument_count() - 1; }
1374 }; 1387 };
1375 1388
1376 1389
1377 class LCallRuntime: public LInstruction { 1390 class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1378 public: 1391 public:
1379 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime") 1392 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1380 DECLARE_HYDROGEN_ACCESSOR(CallRuntime) 1393 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1381 1394
1382 const Runtime::Function* function() const { return hydrogen()->function(); } 1395 const Runtime::Function* function() const { return hydrogen()->function(); }
1383 int arity() const { return hydrogen()->argument_count(); } 1396 int arity() const { return hydrogen()->argument_count(); }
1384 }; 1397 };
1385 1398
1386 1399
1387 class LInteger32ToDouble: public LUnaryOperation { 1400 class LInteger32ToDouble: public LTemplateInstruction<1, 1, 0> {
1388 public: 1401 public:
1389 explicit LInteger32ToDouble(LOperand* use) : LUnaryOperation(use) { } 1402 explicit LInteger32ToDouble(LOperand* value) {
1403 inputs_[0] = value;
1404 }
1390 1405
1391 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double") 1406 DECLARE_CONCRETE_INSTRUCTION(Integer32ToDouble, "int32-to-double")
1392 }; 1407 };
1393 1408
1394 1409
1395 class LNumberTagI: public LUnaryOperation { 1410 class LNumberTagI: public LTemplateInstruction<1, 1, 0> {
1396 public: 1411 public:
1397 explicit LNumberTagI(LOperand* use) : LUnaryOperation(use) { } 1412 explicit LNumberTagI(LOperand* value) {
1413 inputs_[0] = value;
1414 }
1398 1415
1399 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i") 1416 DECLARE_CONCRETE_INSTRUCTION(NumberTagI, "number-tag-i")
1400 }; 1417 };
1401 1418
1402 1419
1403 class LNumberTagD: public LUnaryOperation { 1420 class LNumberTagD: public LTemplateInstruction<1, 1, 2> {
1404 public: 1421 public:
1405 LNumberTagD(LOperand* value, LOperand* temp1, LOperand* temp2) 1422 LNumberTagD(LOperand* value, LOperand* temp1, LOperand* temp2) {
1406 : LUnaryOperation(value), temp1_(temp1), temp2_(temp2) { } 1423 inputs_[0] = value;
1424 temps_[0] = temp1;
1425 temps_[1] = temp2;
1426 }
1407 1427
1408 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d") 1428 DECLARE_CONCRETE_INSTRUCTION(NumberTagD, "number-tag-d")
1409
1410 LOperand* temp1() const { return temp1_; }
1411 LOperand* temp2() const { return temp2_; }
1412
1413 private:
1414 LOperand* temp1_;
1415 LOperand* temp2_;
1416 }; 1429 };
1417 1430
1418 1431
1419 // Sometimes truncating conversion from a tagged value to an int32. 1432 // Sometimes truncating conversion from a tagged value to an int32.
1420 class LDoubleToI: public LUnaryOperation { 1433 class LDoubleToI: public LTemplateInstruction<1, 1, 0> {
1421 public: 1434 public:
1422 explicit LDoubleToI(LOperand* value) : LUnaryOperation(value) { } 1435 explicit LDoubleToI(LOperand* value) {
1436 inputs_[0] = value;
1437 }
1423 1438
1424 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i") 1439 DECLARE_CONCRETE_INSTRUCTION(DoubleToI, "double-to-i")
1425 DECLARE_HYDROGEN_ACCESSOR(Change) 1440 DECLARE_HYDROGEN_ACCESSOR(Change)
1426 1441
1427 bool truncating() { return hydrogen()->CanTruncateToInt32(); } 1442 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1428 }; 1443 };
1429 1444
1430 1445
1431 // Truncating conversion from a tagged value to an int32. 1446 // Truncating conversion from a tagged value to an int32.
1432 class LTaggedToI: public LUnaryOperation { 1447 class LTaggedToI: public LTemplateInstruction<1, 1, 1> {
1433 public: 1448 public:
1434 LTaggedToI(LOperand* value, LOperand* temp) 1449 LTaggedToI(LOperand* value, LOperand* temp) {
1435 : LUnaryOperation(value), temp_(temp) { } 1450 inputs_[0] = value;
1451 temps_[0] = temp;
1452 }
1436 1453
1437 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i") 1454 DECLARE_CONCRETE_INSTRUCTION(TaggedToI, "tagged-to-i")
1438 DECLARE_HYDROGEN_ACCESSOR(Change) 1455 DECLARE_HYDROGEN_ACCESSOR(Change)
1439 1456
1440 bool truncating() { return hydrogen()->CanTruncateToInt32(); } 1457 bool truncating() { return hydrogen()->CanTruncateToInt32(); }
1441 LOperand* temp() const { return temp_; }
1442
1443 private:
1444 LOperand* temp_;
1445 }; 1458 };
1446 1459
1447 1460
1448 class LSmiTag: public LUnaryOperation { 1461 class LSmiTag: public LTemplateInstruction<1, 1, 0> {
1449 public: 1462 public:
1450 explicit LSmiTag(LOperand* use) : LUnaryOperation(use) { } 1463 explicit LSmiTag(LOperand* value) {
1464 inputs_[0] = value;
1465 }
1451 1466
1452 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag") 1467 DECLARE_CONCRETE_INSTRUCTION(SmiTag, "smi-tag")
1453 }; 1468 };
1454 1469
1455 1470
1456 class LNumberUntagD: public LUnaryOperation { 1471 class LNumberUntagD: public LTemplateInstruction<1, 1, 0> {
1457 public: 1472 public:
1458 explicit LNumberUntagD(LOperand* value) : LUnaryOperation(value) { } 1473 explicit LNumberUntagD(LOperand* value) {
1474 inputs_[0] = value;
1475 }
1459 1476
1460 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") 1477 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag")
1461 }; 1478 };
1462 1479
1463 1480
1464 class LSmiUntag: public LUnaryOperation { 1481 class LSmiUntag: public LTemplateInstruction<1, 1, 0> {
1465 public: 1482 public:
1466 LSmiUntag(LOperand* use, bool needs_check) 1483 LSmiUntag(LOperand* value, bool needs_check)
1467 : LUnaryOperation(use), needs_check_(needs_check) { } 1484 : needs_check_(needs_check) {
1485 inputs_[0] = value;
1486 }
1468 1487
1469 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") 1488 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1470 1489
1471 bool needs_check() const { return needs_check_; } 1490 bool needs_check() const { return needs_check_; }
1472 1491
1473 private: 1492 private:
1474 bool needs_check_; 1493 bool needs_check_;
1475 }; 1494 };
1476 1495
1477 1496
1478 class LStoreNamed: public LInstruction { 1497 class LStoreNamed: public LTemplateInstruction<0, 2, 0> {
1479 public: 1498 public:
1480 LStoreNamed(LOperand* obj, LOperand* val) 1499 LStoreNamed(LOperand* obj, LOperand* val) {
1481 : object_(obj), value_(val) { } 1500 inputs_[0] = obj;
1501 inputs_[1] = val;
1502 }
1482 1503
1483 DECLARE_INSTRUCTION(StoreNamed) 1504 DECLARE_INSTRUCTION(StoreNamed)
1484 DECLARE_HYDROGEN_ACCESSOR(StoreNamed) 1505 DECLARE_HYDROGEN_ACCESSOR(StoreNamed)
1485 1506
1486 virtual void PrintDataTo(StringStream* stream) const; 1507 virtual void PrintDataTo(StringStream* stream);
1487 1508
1488 LOperand* object() const { return object_; } 1509 LOperand* object() { return inputs_[0]; }
1510 LOperand* value() { return inputs_[1]; }
1489 Handle<Object> name() const { return hydrogen()->name(); } 1511 Handle<Object> name() const { return hydrogen()->name(); }
1490 LOperand* value() const { return value_; }
1491
1492 private:
1493 LOperand* object_;
1494 LOperand* value_;
1495 }; 1512 };
1496 1513
1497 1514
1498 class LStoreNamedField: public LStoreNamed { 1515 class LStoreNamedField: public LStoreNamed {
1499 public: 1516 public:
1500 LStoreNamedField(LOperand* obj, LOperand* val) 1517 LStoreNamedField(LOperand* obj, LOperand* val)
1501 : LStoreNamed(obj, val) { } 1518 : LStoreNamed(obj, val) { }
1502 1519
1503 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field") 1520 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1504 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField) 1521 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1505 1522
1506 bool is_in_object() { return hydrogen()->is_in_object(); } 1523 bool is_in_object() { return hydrogen()->is_in_object(); }
1507 int offset() { return hydrogen()->offset(); } 1524 int offset() { return hydrogen()->offset(); }
1508 bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } 1525 bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
1509 Handle<Map> transition() { return hydrogen()->transition(); } 1526 Handle<Map> transition() const { return hydrogen()->transition(); }
1510 }; 1527 };
1511 1528
1512 1529
1513 class LStoreNamedGeneric: public LStoreNamed { 1530 class LStoreNamedGeneric: public LStoreNamed {
1514 public: 1531 public:
1515 LStoreNamedGeneric(LOperand* obj, LOperand* val) 1532 LStoreNamedGeneric(LOperand* obj, LOperand* val)
1516 : LStoreNamed(obj, val) { } 1533 : LStoreNamed(obj, val) { }
1517 1534
1518 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") 1535 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1519 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) 1536 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1520 }; 1537 };
1521 1538
1522 1539
1523 class LStoreKeyed: public LInstruction { 1540 class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
1524 public: 1541 public:
1525 LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) 1542 LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) {
1526 : object_(obj), key_(key), value_(val) { } 1543 inputs_[0] = obj;
1544 inputs_[1] = key;
1545 inputs_[2] = val;
1546 }
1527 1547
1528 DECLARE_INSTRUCTION(StoreKeyed) 1548 DECLARE_INSTRUCTION(StoreKeyed)
1529 1549
1530 virtual void PrintDataTo(StringStream* stream) const; 1550 virtual void PrintDataTo(StringStream* stream);
1531 1551
1532 LOperand* object() const { return object_; } 1552 LOperand* object() { return inputs_[0]; }
1533 LOperand* key() const { return key_; } 1553 LOperand* key() { return inputs_[1]; }
1534 LOperand* value() const { return value_; } 1554 LOperand* value() { return inputs_[2]; }
1535
1536 private:
1537 LOperand* object_;
1538 LOperand* key_;
1539 LOperand* value_;
1540 }; 1555 };
1541 1556
1542 1557
1543 class LStoreKeyedFastElement: public LStoreKeyed { 1558 class LStoreKeyedFastElement: public LStoreKeyed {
1544 public: 1559 public:
1545 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) 1560 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val)
1546 : LStoreKeyed(obj, key, val) {} 1561 : LStoreKeyed(obj, key, val) {}
1547 1562
1548 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, 1563 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1549 "store-keyed-fast-element") 1564 "store-keyed-fast-element")
1550 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement) 1565 DECLARE_HYDROGEN_ACCESSOR(StoreKeyedFastElement)
1551 }; 1566 };
1552 1567
1553 1568
1554 class LStoreKeyedGeneric: public LStoreKeyed { 1569 class LStoreKeyedGeneric: public LStoreKeyed {
1555 public: 1570 public:
1556 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val) 1571 LStoreKeyedGeneric(LOperand* obj, LOperand* key, LOperand* val)
1557 : LStoreKeyed(obj, key, val) { } 1572 : LStoreKeyed(obj, key, val) { }
1558 1573
1559 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic") 1574 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store-keyed-generic")
1560 }; 1575 };
1561 1576
1562 1577
1563 class LCheckFunction: public LUnaryOperation { 1578 class LStringCharCodeAt: public LTemplateInstruction<1, 2, 0> {
1564 public: 1579 public:
1565 explicit LCheckFunction(LOperand* use) : LUnaryOperation(use) { } 1580 LStringCharCodeAt(LOperand* string, LOperand* index) {
1581 inputs_[0] = string;
1582 inputs_[1] = index;
1583 }
1584
1585 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string-char-code-at")
1586 DECLARE_HYDROGEN_ACCESSOR(StringCharCodeAt)
1587
1588 LOperand* string() { return inputs_[0]; }
1589 LOperand* index() { return inputs_[1]; }
1590 };
1591
1592
1593 class LStringLength: public LTemplateInstruction<1, 1, 0> {
1594 public:
1595 explicit LStringLength(LOperand* string) {
1596 inputs_[0] = string;
1597 }
1598
1599 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length")
1600 DECLARE_HYDROGEN_ACCESSOR(StringLength)
1601
1602 LOperand* string() { return inputs_[0]; }
1603 };
1604
1605
1606 class LCheckFunction: public LTemplateInstruction<0, 1, 0> {
1607 public:
1608 explicit LCheckFunction(LOperand* value) {
1609 inputs_[0] = value;
1610 }
1566 1611
1567 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") 1612 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function")
1568 DECLARE_HYDROGEN_ACCESSOR(CheckFunction) 1613 DECLARE_HYDROGEN_ACCESSOR(CheckFunction)
1569 }; 1614 };
1570 1615
1571 1616
1572 class LCheckInstanceType: public LUnaryOperation { 1617 class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
1573 public: 1618 public:
1574 explicit LCheckInstanceType(LOperand* use) : LUnaryOperation(use) { } 1619 explicit LCheckInstanceType(LOperand* value) {
1620 inputs_[0] = value;
1621 }
1575 1622
1576 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type") 1623 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
1577 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType) 1624 DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
1578
1579 LOperand* temp() const { return temp_; }
1580
1581 private:
1582 LOperand* temp_;
1583 }; 1625 };
1584 1626
1585 1627
1586 class LCheckMap: public LUnaryOperation { 1628 class LCheckMap: public LTemplateInstruction<0, 1, 0> {
1587 public: 1629 public:
1588 explicit LCheckMap(LOperand* use) : LUnaryOperation(use) { } 1630 explicit LCheckMap(LOperand* value) {
1631 inputs_[0] = value;
1632 }
1589 1633
1590 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map") 1634 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map")
1591 DECLARE_HYDROGEN_ACCESSOR(CheckMap) 1635 DECLARE_HYDROGEN_ACCESSOR(CheckMap)
1592 }; 1636 };
1593 1637
1594 1638
1595 class LCheckPrototypeMaps: public LInstruction { 1639 class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 2> {
1596 public: 1640 public:
1597 LCheckPrototypeMaps(LOperand* temp1, LOperand* temp2) 1641 LCheckPrototypeMaps(LOperand* temp1, LOperand* temp2) {
1598 : temp1_(temp1), temp2_(temp2) { } 1642 temps_[0] = temp1;
1643 temps_[1] = temp2;
1644 }
1599 1645
1600 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps") 1646 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1601 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps) 1647 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1602 1648
1603 Handle<JSObject> prototype() const { return hydrogen()->prototype(); } 1649 Handle<JSObject> prototype() const { return hydrogen()->prototype(); }
1604 Handle<JSObject> holder() const { return hydrogen()->holder(); } 1650 Handle<JSObject> holder() const { return hydrogen()->holder(); }
1605
1606 LOperand* temp1() const { return temp1_; }
1607 LOperand* temp2() const { return temp2_; }
1608
1609 private:
1610 LOperand* temp1_;
1611 LOperand* temp2_;
1612 }; 1651 };
1613 1652
1614 1653
1615 class LCheckSmi: public LUnaryOperation { 1654 class LCheckSmi: public LTemplateInstruction<0, 1, 0> {
1616 public: 1655 public:
1617 LCheckSmi(LOperand* use, Condition condition) 1656 LCheckSmi(LOperand* value, Condition condition)
1618 : LUnaryOperation(use), condition_(condition) { } 1657 : condition_(condition) {
1658 inputs_[0] = value;
1659 }
1619 1660
1620 Condition condition() const { return condition_; } 1661 Condition condition() const { return condition_; }
1621 1662
1622 virtual void CompileToNative(LCodeGen* generator); 1663 virtual void CompileToNative(LCodeGen* generator);
1623 virtual const char* Mnemonic() const { 1664 virtual const char* Mnemonic() const {
1624 return (condition_ == eq) ? "check-non-smi" : "check-smi"; 1665 return (condition_ == eq) ? "check-non-smi" : "check-smi";
1625 } 1666 }
1626 1667
1627 private: 1668 private:
1628 Condition condition_; 1669 Condition condition_;
1629 }; 1670 };
1630 1671
1631 1672
1632 class LMaterializedLiteral: public LInstruction { 1673 class LArrayLiteral: public LTemplateInstruction<1, 0, 0> {
1633 public:
1634 DECLARE_INSTRUCTION(MaterializedLiteral)
1635 };
1636
1637
1638 class LArrayLiteral: public LMaterializedLiteral {
1639 public: 1674 public:
1640 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal") 1675 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
1641 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral) 1676 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
1642 }; 1677 };
1643 1678
1644 1679
1645 class LObjectLiteral: public LMaterializedLiteral { 1680 class LObjectLiteral: public LTemplateInstruction<1, 0, 0> {
1646 public: 1681 public:
1647 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal") 1682 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
1648 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral) 1683 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
1649 }; 1684 };
1650 1685
1651 1686
1652 class LRegExpLiteral: public LMaterializedLiteral { 1687 class LRegExpLiteral: public LTemplateInstruction<1, 0, 0> {
1653 public: 1688 public:
1654 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal") 1689 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
1655 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral) 1690 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
1656 }; 1691 };
1657 1692
1658 1693
1659 class LFunctionLiteral: public LInstruction { 1694 class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
1660 public: 1695 public:
1661 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") 1696 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
1662 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) 1697 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
1663 1698
1664 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); } 1699 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
1665 }; 1700 };
1666 1701
1667 1702
1668 class LTypeof: public LUnaryOperation { 1703 class LTypeof: public LTemplateInstruction<1, 1, 0> {
1669 public: 1704 public:
1670 explicit LTypeof(LOperand* input) : LUnaryOperation(input) { } 1705 explicit LTypeof(LOperand* value) {
1706 inputs_[0] = value;
1707 }
1671 1708
1672 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") 1709 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
1673 }; 1710 };
1674 1711
1675 1712
1676 class LTypeofIs: public LUnaryOperation { 1713 class LTypeofIs: public LTemplateInstruction<1, 1, 0> {
1677 public: 1714 public:
1678 explicit LTypeofIs(LOperand* input) : LUnaryOperation(input) { } 1715 explicit LTypeofIs(LOperand* value) {
1679 virtual void PrintDataTo(StringStream* stream) const; 1716 inputs_[0] = value;
1717 }
1680 1718
1681 DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof-is") 1719 DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof-is")
1682 DECLARE_HYDROGEN_ACCESSOR(TypeofIs) 1720 DECLARE_HYDROGEN_ACCESSOR(TypeofIs)
1683 1721
1684 Handle<String> type_literal() { return hydrogen()->type_literal(); } 1722 Handle<String> type_literal() { return hydrogen()->type_literal(); }
1723
1724 virtual void PrintDataTo(StringStream* stream);
1685 }; 1725 };
1686 1726
1687 1727
1688 class LTypeofIsAndBranch: public LTypeofIs { 1728 class LTypeofIsAndBranch: public LControlInstruction<1, 0> {
1689 public: 1729 public:
1690 LTypeofIsAndBranch(LOperand* value, 1730 explicit LTypeofIsAndBranch(LOperand* value) {
1691 int true_block_id, 1731 inputs_[0] = value;
1692 int false_block_id) 1732 }
1693 : LTypeofIs(value),
1694 true_block_id_(true_block_id),
1695 false_block_id_(false_block_id) { }
1696 1733
1697 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch") 1734 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch, "typeof-is-and-branch")
1735 DECLARE_HYDROGEN_ACCESSOR(TypeofIs)
1698 1736
1699 virtual void PrintDataTo(StringStream* stream) const; 1737 Handle<String> type_literal() { return hydrogen()->type_literal(); }
1700 virtual bool IsControl() const { return true; }
1701 1738
1702 int true_block_id() const { return true_block_id_; } 1739 virtual void PrintDataTo(StringStream* stream);
1703 int false_block_id() const { return false_block_id_; }
1704
1705 private:
1706 int true_block_id_;
1707 int false_block_id_;
1708 }; 1740 };
1709 1741
1710 1742
1711 class LDeleteProperty: public LBinaryOperation { 1743 class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
1712 public: 1744 public:
1713 LDeleteProperty(LOperand* obj, LOperand* key) : LBinaryOperation(obj, key) {} 1745 LDeleteProperty(LOperand* obj, LOperand* key) {
1746 inputs_[0] = obj;
1747 inputs_[1] = key;
1748 }
1714 1749
1715 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") 1750 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
1716 1751
1717 LOperand* object() const { return left(); } 1752 LOperand* object() { return inputs_[0]; }
1718 LOperand* key() const { return right(); } 1753 LOperand* key() { return inputs_[1]; }
1719 }; 1754 };
1720 1755
1721 1756
1722 class LOsrEntry: public LInstruction { 1757 class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
1723 public: 1758 public:
1724 LOsrEntry(); 1759 LOsrEntry();
1725 1760
1726 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") 1761 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
1727 1762
1728 LOperand** SpilledRegisterArray() { return register_spills_; } 1763 LOperand** SpilledRegisterArray() { return register_spills_; }
1729 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; } 1764 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
1730 1765
1731 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand); 1766 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
1732 void MarkSpilledDoubleRegister(int allocation_index, 1767 void MarkSpilledDoubleRegister(int allocation_index,
1733 LOperand* spill_operand); 1768 LOperand* spill_operand);
1734 1769
1735 private: 1770 private:
1736 // Arrays of spill slot operands for registers with an assigned spill 1771 // Arrays of spill slot operands for registers with an assigned spill
1737 // slot, i.e., that must also be restored to the spill slot on OSR entry. 1772 // slot, i.e., that must also be restored to the spill slot on OSR entry.
1738 // NULL if the register has no assigned spill slot. Indexed by allocation 1773 // NULL if the register has no assigned spill slot. Indexed by allocation
1739 // index. 1774 // index.
1740 LOperand* register_spills_[Register::kNumAllocatableRegisters]; 1775 LOperand* register_spills_[Register::kNumAllocatableRegisters];
1741 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters]; 1776 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
1742 }; 1777 };
1743 1778
1744 1779
1745 class LStackCheck: public LInstruction { 1780 class LStackCheck: public LTemplateInstruction<0, 0, 0> {
1746 public: 1781 public:
1747 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") 1782 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
1748 }; 1783 };
1749 1784
1750 1785
1751 class LChunkBuilder; 1786 class LChunkBuilder;
1752 class LChunk: public ZoneObject { 1787 class LChunk: public ZoneObject {
1753 public: 1788 public:
1754 explicit LChunk(HGraph* graph); 1789 explicit LChunk(HGraph* graph);
1755 1790
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 } 1826 }
1792 1827
1793 const ZoneList<Handle<JSFunction> >* inlined_closures() const { 1828 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
1794 return &inlined_closures_; 1829 return &inlined_closures_;
1795 } 1830 }
1796 1831
1797 void AddInlinedClosure(Handle<JSFunction> closure) { 1832 void AddInlinedClosure(Handle<JSFunction> closure) {
1798 inlined_closures_.Add(closure); 1833 inlined_closures_.Add(closure);
1799 } 1834 }
1800 1835
1801 void Verify() const;
1802
1803 private: 1836 private:
1804 int spill_slot_count_; 1837 int spill_slot_count_;
1805 HGraph* const graph_; 1838 HGraph* const graph_;
1806 ZoneList<LInstruction*> instructions_; 1839 ZoneList<LInstruction*> instructions_;
1807 ZoneList<LPointerMap*> pointer_maps_; 1840 ZoneList<LPointerMap*> pointer_maps_;
1808 ZoneList<Handle<JSFunction> > inlined_closures_; 1841 ZoneList<Handle<JSFunction> > inlined_closures_;
1809 }; 1842 };
1810 1843
1811 1844
1812 class LChunkBuilder BASE_EMBEDDED { 1845 class LChunkBuilder BASE_EMBEDDED {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 bool is_aborted() const { return status_ == ABORTED; } 1882 bool is_aborted() const { return status_ == ABORTED; }
1850 1883
1851 void Abort(const char* format, ...); 1884 void Abort(const char* format, ...);
1852 1885
1853 // Methods for getting operands for Use / Define / Temp. 1886 // Methods for getting operands for Use / Define / Temp.
1854 LRegister* ToOperand(Register reg); 1887 LRegister* ToOperand(Register reg);
1855 LUnallocated* ToUnallocated(Register reg); 1888 LUnallocated* ToUnallocated(Register reg);
1856 LUnallocated* ToUnallocated(DoubleRegister reg); 1889 LUnallocated* ToUnallocated(DoubleRegister reg);
1857 1890
1858 // Methods for setting up define-use relationships. 1891 // Methods for setting up define-use relationships.
1859 LOperand* Use(HValue* value, LUnallocated* operand); 1892 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand);
1860 LOperand* UseFixed(HValue* value, Register fixed_register); 1893 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register);
1861 LOperand* UseFixedDouble(HValue* value, DoubleRegister fixed_register); 1894 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value,
1895 DoubleRegister fixed_register);
1862 1896
1863 // A value that is guaranteed to be allocated to a register. 1897 // A value that is guaranteed to be allocated to a register.
1864 // Operand created by UseRegister is guaranteed to be live until the end of 1898 // Operand created by UseRegister is guaranteed to be live until the end of
1865 // instruction. This means that register allocator will not reuse it's 1899 // instruction. This means that register allocator will not reuse it's
1866 // register for any other operand inside instruction. 1900 // register for any other operand inside instruction.
1867 // Operand created by UseRegisterAtStart is guaranteed to be live only at 1901 // Operand created by UseRegisterAtStart is guaranteed to be live only at
1868 // instruction start. Register allocator is free to assign the same register 1902 // instruction start. Register allocator is free to assign the same register
1869 // to some other operand used inside instruction (i.e. temporary or 1903 // to some other operand used inside instruction (i.e. temporary or
1870 // output). 1904 // output).
1871 LOperand* UseRegister(HValue* value); 1905 MUST_USE_RESULT LOperand* UseRegister(HValue* value);
1872 LOperand* UseRegisterAtStart(HValue* value); 1906 MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
1873 1907
1874 // A value in a register that may be trashed. 1908 // An input operand in a register that may be trashed.
1875 LOperand* UseTempRegister(HValue* value); 1909 MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
1876 LOperand* Use(HValue* value); 1910
1877 LOperand* UseAtStart(HValue* value); 1911 // An input operand in a register or stack slot.
1878 LOperand* UseOrConstant(HValue* value); 1912 MUST_USE_RESULT LOperand* Use(HValue* value);
1879 LOperand* UseOrConstantAtStart(HValue* value); 1913 MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
1880 LOperand* UseRegisterOrConstant(HValue* value); 1914
1881 LOperand* UseRegisterOrConstantAtStart(HValue* value); 1915 // An input operand in a register, stack slot or a constant operand.
1916 MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
1917 MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
1918
1919 // An input operand in a register or a constant operand.
1920 MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
1921 MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
1922
1923 // An input operand in register, stack slot or a constant operand.
1924 // Will not be moved to a register even if one is freely available.
1925 MUST_USE_RESULT LOperand* UseAny(HValue* value);
1926
1927 // Temporary operand that must be in a register.
1928 MUST_USE_RESULT LUnallocated* TempRegister();
1929 MUST_USE_RESULT LOperand* FixedTemp(Register reg);
1930 MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);
1882 1931
1883 // Methods for setting up define-use relationships. 1932 // Methods for setting up define-use relationships.
1884 // Return the same instruction that they are passed. 1933 // Return the same instruction that they are passed.
1885 LInstruction* Define(LInstruction* instr, LUnallocated* result); 1934 template<int I, int T>
1886 LInstruction* Define(LInstruction* instr); 1935 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
1887 LInstruction* DefineAsRegister(LInstruction* instr); 1936 LUnallocated* result);
1888 LInstruction* DefineAsSpilled(LInstruction* instr, int index); 1937 template<int I, int T>
1889 LInstruction* DefineSameAsFirst(LInstruction* instr); 1938 LInstruction* Define(LTemplateInstruction<1, I, T>* instr);
1890 LInstruction* DefineFixed(LInstruction* instr, Register reg); 1939 template<int I, int T>
1891 LInstruction* DefineFixedDouble(LInstruction* instr, DoubleRegister reg); 1940 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
1941 template<int I, int T>
1942 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
1943 int index);
1944 template<int I, int T>
1945 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
1946 template<int I, int T>
1947 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
1948 Register reg);
1949 template<int I, int T>
1950 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
1951 DoubleRegister reg);
1892 LInstruction* AssignEnvironment(LInstruction* instr); 1952 LInstruction* AssignEnvironment(LInstruction* instr);
1893 LInstruction* AssignPointerMap(LInstruction* instr); 1953 LInstruction* AssignPointerMap(LInstruction* instr);
1894 1954
1895 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; 1955 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
1896 1956
1897 // By default we assume that instruction sequences generated for calls 1957 // By default we assume that instruction sequences generated for calls
1898 // cannot deoptimize eagerly and we do not attach environment to this 1958 // cannot deoptimize eagerly and we do not attach environment to this
1899 // instruction. 1959 // instruction.
1900 LInstruction* MarkAsCall( 1960 LInstruction* MarkAsCall(
1901 LInstruction* instr, 1961 LInstruction* instr,
1902 HInstruction* hinstr, 1962 HInstruction* hinstr,
1903 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); 1963 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
1964 LInstruction* MarkAsSaveDoubles(LInstruction* instr);
1904 1965
1905 LInstruction* SetInstructionPendingDeoptimizationEnvironment( 1966 LInstruction* SetInstructionPendingDeoptimizationEnvironment(
1906 LInstruction* instr, int ast_id); 1967 LInstruction* instr, int ast_id);
1907 void ClearInstructionPendingDeoptimizationEnvironment(); 1968 void ClearInstructionPendingDeoptimizationEnvironment();
1908 1969
1909 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env); 1970 LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env);
1910 1971
1911 // Temporary operand that must be in a register.
1912 LUnallocated* TempRegister();
1913 LOperand* FixedTemp(Register reg);
1914 LOperand* FixedTemp(DoubleRegister reg);
1915
1916 void VisitInstruction(HInstruction* current); 1972 void VisitInstruction(HInstruction* current);
1917 1973
1918 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); 1974 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block);
1919 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr); 1975 LInstruction* DoBit(Token::Value op, HBitwiseBinaryOperation* instr);
1920 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); 1976 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr);
1921 LInstruction* DoArithmeticD(Token::Value op, 1977 LInstruction* DoArithmeticD(Token::Value op,
1922 HArithmeticBinaryOperation* instr); 1978 HArithmeticBinaryOperation* instr);
1923 LInstruction* DoArithmeticT(Token::Value op, 1979 LInstruction* DoArithmeticT(Token::Value op,
1924 HArithmeticBinaryOperation* instr); 1980 HArithmeticBinaryOperation* instr);
1925 1981
(...skipping 12 matching lines...) Expand all
1938 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 1994 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
1939 }; 1995 };
1940 1996
1941 #undef DECLARE_HYDROGEN_ACCESSOR 1997 #undef DECLARE_HYDROGEN_ACCESSOR
1942 #undef DECLARE_INSTRUCTION 1998 #undef DECLARE_INSTRUCTION
1943 #undef DECLARE_CONCRETE_INSTRUCTION 1999 #undef DECLARE_CONCRETE_INSTRUCTION
1944 2000
1945 } } // namespace v8::internal 2001 } } // namespace v8::internal
1946 2002
1947 #endif // V8_ARM_LITHIUM_ARM_H_ 2003 #endif // V8_ARM_LITHIUM_ARM_H_
OLDNEW
« no previous file with comments | « src/arm/jump-target-arm.cc ('k') | src/arm/lithium-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698