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