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