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

Side by Side Diff: vm/intermediate_language.h

Issue 10829098: Eliminate unnecessary deoptimization environments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« vm/flow_graph_compiler.cc ('K') | « vm/flow_graph_compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr) = 0; 139 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr) = 0;
140 140
141 virtual intptr_t InputCount() const = 0; 141 virtual intptr_t InputCount() const = 0;
142 virtual Value* InputAt(intptr_t i) const = 0; 142 virtual Value* InputAt(intptr_t i) const = 0;
143 virtual void SetInputAt(intptr_t i, Value* value) = 0; 143 virtual void SetInputAt(intptr_t i, Value* value) = 0;
144 144
145 // Call computations override this function and return the 145 // Call computations override this function and return the
146 // number of pushed arguments. 146 // number of pushed arguments.
147 virtual intptr_t ArgumentCount() const = 0; 147 virtual intptr_t ArgumentCount() const = 0;
148 148
149 // Returns true, if this computation can deoptimize. By default
150 // we assume every computation can deoptimize.
srdjan 2012/07/31 15:53:15 The comment (by default we return true) does not m
Florian Schneider 2012/08/01 11:46:36 Done.
151 virtual bool CanDeoptimize() const = 0;
152
149 // Static type of the computation. 153 // Static type of the computation.
150 virtual RawAbstractType* StaticType() const = 0; 154 virtual RawAbstractType* StaticType() const = 0;
151 155
152 // Mutate assigned_vars to add the local variable index for all 156 // Mutate assigned_vars to add the local variable index for all
153 // frame-allocated locals assigned to by the computation. 157 // frame-allocated locals assigned to by the computation.
154 virtual void RecordAssignedVars(BitVector* assigned_vars, 158 virtual void RecordAssignedVars(BitVector* assigned_vars,
155 intptr_t fixed_parameter_count); 159 intptr_t fixed_parameter_count);
156 160
157 virtual const char* DebugName() const = 0; 161 virtual const char* DebugName() const = 0;
158 162
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 public: 349 public:
346 explicit UseVal(Definition* definition) : definition_(definition) {} 350 explicit UseVal(Definition* definition) : definition_(definition) {}
347 351
348 DECLARE_VALUE(Use) 352 DECLARE_VALUE(Use)
349 353
350 inline Definition* definition() const; 354 inline Definition* definition() const;
351 void set_definition(Definition* definition) { 355 void set_definition(Definition* definition) {
352 definition_ = definition; 356 definition_ = definition;
353 } 357 }
354 358
359 virtual bool CanDeoptimize() const { return false; }
360
355 private: 361 private:
356 Definition* definition_; 362 Definition* definition_;
357 363
358 DISALLOW_COPY_AND_ASSIGN(UseVal); 364 DISALLOW_COPY_AND_ASSIGN(UseVal);
359 }; 365 };
360 366
361 367
362 class ConstantVal: public Value { 368 class ConstantVal: public Value {
363 public: 369 public:
364 explicit ConstantVal(const Object& value) 370 explicit ConstantVal(const Object& value)
365 : value_(value) { 371 : value_(value) {
366 ASSERT(value.IsZoneHandle()); 372 ASSERT(value.IsZoneHandle());
367 ASSERT(value.IsSmi() || value.IsOld()); 373 ASSERT(value.IsSmi() || value.IsOld());
368 } 374 }
369 375
370 DECLARE_VALUE(Constant) 376 DECLARE_VALUE(Constant)
371 377
372 const Object& value() const { return value_; } 378 const Object& value() const { return value_; }
373 379
380 virtual bool CanDeoptimize() const { return false; }
381
374 private: 382 private:
375 const Object& value_; 383 const Object& value_;
376 384
377 DISALLOW_COPY_AND_ASSIGN(ConstantVal); 385 DISALLOW_COPY_AND_ASSIGN(ConstantVal);
378 }; 386 };
379 387
380 #undef DECLARE_VALUE 388 #undef DECLARE_VALUE
381 389
382 390
383 class AssertAssignableComp : public TemplateComputation<3> { 391 class AssertAssignableComp : public TemplateComputation<3> {
(...skipping 25 matching lines...) Expand all
409 Value* instantiator() const { return inputs_[1]; } 417 Value* instantiator() const { return inputs_[1]; }
410 Value* instantiator_type_arguments() const { return inputs_[2]; } 418 Value* instantiator_type_arguments() const { return inputs_[2]; }
411 419
412 intptr_t token_pos() const { return token_pos_; } 420 intptr_t token_pos() const { return token_pos_; }
413 intptr_t try_index() const { return try_index_; } 421 intptr_t try_index() const { return try_index_; }
414 const AbstractType& dst_type() const { return dst_type_; } 422 const AbstractType& dst_type() const { return dst_type_; }
415 const String& dst_name() const { return dst_name_; } 423 const String& dst_name() const { return dst_name_; }
416 424
417 virtual void PrintOperandsTo(BufferFormatter* f) const; 425 virtual void PrintOperandsTo(BufferFormatter* f) const;
418 426
427 virtual bool CanDeoptimize() const { return false; }
428
419 private: 429 private:
420 const intptr_t token_pos_; 430 const intptr_t token_pos_;
421 const intptr_t try_index_; 431 const intptr_t try_index_;
422 const AbstractType& dst_type_; 432 const AbstractType& dst_type_;
423 const String& dst_name_; 433 const String& dst_name_;
424 434
425 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); 435 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp);
426 }; 436 };
427 437
428 438
429 class AssertBooleanComp : public TemplateComputation<1> { 439 class AssertBooleanComp : public TemplateComputation<1> {
430 public: 440 public:
431 AssertBooleanComp(intptr_t token_pos, 441 AssertBooleanComp(intptr_t token_pos,
432 intptr_t try_index, 442 intptr_t try_index,
433 Value* value) 443 Value* value)
434 : token_pos_(token_pos), 444 : token_pos_(token_pos),
435 try_index_(try_index) { 445 try_index_(try_index) {
436 ASSERT(value != NULL); 446 ASSERT(value != NULL);
437 inputs_[0] = value; 447 inputs_[0] = value;
438 } 448 }
439 449
440 DECLARE_COMPUTATION(AssertBoolean) 450 DECLARE_COMPUTATION(AssertBoolean)
441 451
442 intptr_t token_pos() const { return token_pos_; } 452 intptr_t token_pos() const { return token_pos_; }
443 intptr_t try_index() const { return try_index_; } 453 intptr_t try_index() const { return try_index_; }
444 Value* value() const { return inputs_[0]; } 454 Value* value() const { return inputs_[0]; }
445 455
456 virtual bool CanDeoptimize() const { return false; }
457
446 private: 458 private:
447 const intptr_t token_pos_; 459 const intptr_t token_pos_;
448 const intptr_t try_index_; 460 const intptr_t try_index_;
449 461
450 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); 462 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp);
451 }; 463 };
452 464
453 465
454 // Denotes the current context, normally held in a register. This is 466 // Denotes the current context, normally held in a register. This is
455 // a computation, not a value, because it's mutable. 467 // a computation, not a value, because it's mutable.
456 class CurrentContextComp : public TemplateComputation<0> { 468 class CurrentContextComp : public TemplateComputation<0> {
457 public: 469 public:
458 CurrentContextComp() { } 470 CurrentContextComp() { }
459 471
460 DECLARE_COMPUTATION(CurrentContext) 472 DECLARE_COMPUTATION(CurrentContext)
461 473
474 virtual bool CanDeoptimize() const { return false; }
475
462 private: 476 private:
463 DISALLOW_COPY_AND_ASSIGN(CurrentContextComp); 477 DISALLOW_COPY_AND_ASSIGN(CurrentContextComp);
464 }; 478 };
465 479
466 480
467 class StoreContextComp : public TemplateComputation<1> { 481 class StoreContextComp : public TemplateComputation<1> {
468 public: 482 public:
469 explicit StoreContextComp(Value* value) { 483 explicit StoreContextComp(Value* value) {
470 ASSERT(value != NULL); 484 ASSERT(value != NULL);
471 inputs_[0] = value; 485 inputs_[0] = value;
472 } 486 }
473 487
474 DECLARE_COMPUTATION(StoreContext); 488 DECLARE_COMPUTATION(StoreContext);
475 489
476 Value* value() const { return inputs_[0]; } 490 Value* value() const { return inputs_[0]; }
477 491
492 virtual bool CanDeoptimize() const { return false; }
493
478 private: 494 private:
479 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); 495 DISALLOW_COPY_AND_ASSIGN(StoreContextComp);
480 }; 496 };
481 497
482 498
483 class ClosureCallComp : public Computation { 499 class ClosureCallComp : public Computation {
484 public: 500 public:
485 ClosureCallComp(ClosureCallNode* node, 501 ClosureCallComp(ClosureCallNode* node,
486 intptr_t try_index, 502 intptr_t try_index,
487 ZoneGrowableArray<PushArgumentInstr*>* arguments) 503 ZoneGrowableArray<PushArgumentInstr*>* arguments)
488 : ast_node_(*node), 504 : ast_node_(*node),
489 try_index_(try_index), 505 try_index_(try_index),
490 arguments_(arguments) { } 506 arguments_(arguments) { }
491 507
492 DECLARE_CALL_COMPUTATION(ClosureCall) 508 DECLARE_CALL_COMPUTATION(ClosureCall)
493 509
494 const Array& argument_names() const { return ast_node_.arguments()->names(); } 510 const Array& argument_names() const { return ast_node_.arguments()->names(); }
495 intptr_t token_pos() const { return ast_node_.token_pos(); } 511 intptr_t token_pos() const { return ast_node_.token_pos(); }
496 intptr_t try_index() const { return try_index_; } 512 intptr_t try_index() const { return try_index_; }
497 513
498 intptr_t ArgumentCount() const { return arguments_->length(); } 514 intptr_t ArgumentCount() const { return arguments_->length(); }
499 PushArgumentInstr* ArgumentAt(intptr_t index) const { 515 PushArgumentInstr* ArgumentAt(intptr_t index) const {
500 return (*arguments_)[index]; 516 return (*arguments_)[index];
501 } 517 }
502 518
503 virtual void PrintOperandsTo(BufferFormatter* f) const; 519 virtual void PrintOperandsTo(BufferFormatter* f) const;
504 520
521 virtual bool CanDeoptimize() const { return false; }
srdjan 2012/07/31 19:49:28 All calls have to return true (future work).
Florian Schneider 2012/08/01 11:46:36 Yes. It will have to change once we have something
522
505 private: 523 private:
506 const ClosureCallNode& ast_node_; 524 const ClosureCallNode& ast_node_;
507 const intptr_t try_index_; 525 const intptr_t try_index_;
508 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 526 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
509 527
510 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); 528 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp);
511 }; 529 };
512 530
513 531
514 class InstanceCallComp : public Computation { 532 class InstanceCallComp : public Computation {
(...skipping 29 matching lines...) Expand all
544 Token::Kind token_kind() const { return token_kind_; } 562 Token::Kind token_kind() const { return token_kind_; }
545 intptr_t ArgumentCount() const { return arguments_->length(); } 563 intptr_t ArgumentCount() const { return arguments_->length(); }
546 PushArgumentInstr* ArgumentAt(intptr_t index) const { 564 PushArgumentInstr* ArgumentAt(intptr_t index) const {
547 return (*arguments_)[index]; 565 return (*arguments_)[index];
548 } 566 }
549 const Array& argument_names() const { return argument_names_; } 567 const Array& argument_names() const { return argument_names_; }
550 intptr_t checked_argument_count() const { return checked_argument_count_; } 568 intptr_t checked_argument_count() const { return checked_argument_count_; }
551 569
552 virtual void PrintOperandsTo(BufferFormatter* f) const; 570 virtual void PrintOperandsTo(BufferFormatter* f) const;
553 571
572 virtual bool CanDeoptimize() const { return false; }
573
554 private: 574 private:
555 const intptr_t token_pos_; 575 const intptr_t token_pos_;
556 const intptr_t try_index_; 576 const intptr_t try_index_;
557 const String& function_name_; 577 const String& function_name_;
558 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. 578 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL.
559 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 579 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
560 const Array& argument_names_; 580 const Array& argument_names_;
561 const intptr_t checked_argument_count_; 581 const intptr_t checked_argument_count_;
562 582
563 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); 583 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp);
(...skipping 13 matching lines...) Expand all
577 virtual Value* InputAt(intptr_t i) const { 597 virtual Value* InputAt(intptr_t i) const {
578 UNREACHABLE(); 598 UNREACHABLE();
579 return NULL; 599 return NULL;
580 } 600 }
581 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } 601 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
582 602
583 void PrintTo(BufferFormatter* f) const; 603 void PrintTo(BufferFormatter* f) const;
584 604
585 DECLARE_COMPUTATION(PolymorphicInstanceCall) 605 DECLARE_COMPUTATION(PolymorphicInstanceCall)
586 606
607 virtual bool CanDeoptimize() const { return true; }
608
587 private: 609 private:
588 InstanceCallComp* instance_call_; 610 InstanceCallComp* instance_call_;
589 611
590 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallComp); 612 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallComp);
591 }; 613 };
592 614
593 615
594 class ComparisonComp : public TemplateComputation<2> { 616 class ComparisonComp : public TemplateComputation<2> {
595 public: 617 public:
596 ComparisonComp(Token::Kind kind, Value* left, Value* right) : kind_(kind) { 618 ComparisonComp(Token::Kind kind, Value* left, Value* right) : kind_(kind) {
(...skipping 19 matching lines...) Expand all
616 public: 638 public:
617 StrictCompareComp(Token::Kind kind, Value* left, Value* right) 639 StrictCompareComp(Token::Kind kind, Value* left, Value* right)
618 : ComparisonComp(kind, left, right) { 640 : ComparisonComp(kind, left, right) {
619 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); 641 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT));
620 } 642 }
621 643
622 DECLARE_COMPUTATION(StrictCompare) 644 DECLARE_COMPUTATION(StrictCompare)
623 645
624 virtual void PrintOperandsTo(BufferFormatter* f) const; 646 virtual void PrintOperandsTo(BufferFormatter* f) const;
625 647
648 virtual bool CanDeoptimize() const { return false; }
649
626 private: 650 private:
627 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); 651 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp);
628 }; 652 };
629 653
630 654
631 class EqualityCompareComp : public ComparisonComp { 655 class EqualityCompareComp : public ComparisonComp {
632 public: 656 public:
633 EqualityCompareComp(intptr_t token_pos, 657 EqualityCompareComp(intptr_t token_pos,
634 intptr_t try_index, 658 intptr_t try_index,
635 Token::Kind kind, 659 Token::Kind kind,
636 Value* left, 660 Value* left,
637 Value* right) 661 Value* right)
638 : ComparisonComp(kind, left, right), 662 : ComparisonComp(kind, left, right),
639 token_pos_(token_pos), 663 token_pos_(token_pos),
640 try_index_(try_index), 664 try_index_(try_index),
641 receiver_class_id_(kObject) { 665 receiver_class_id_(kObject) {
642 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); 666 ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
643 } 667 }
644 668
645 DECLARE_COMPUTATION(EqualityCompare) 669 DECLARE_COMPUTATION(EqualityCompare)
646 670
647 intptr_t token_pos() const { return token_pos_; } 671 intptr_t token_pos() const { return token_pos_; }
648 intptr_t try_index() const { return try_index_; } 672 intptr_t try_index() const { return try_index_; }
649 673
650 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } 674 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; }
651 intptr_t receiver_class_id() const { return receiver_class_id_; } 675 intptr_t receiver_class_id() const { return receiver_class_id_; }
652 virtual void PrintOperandsTo(BufferFormatter* f) const; 676 virtual void PrintOperandsTo(BufferFormatter* f) const;
653 677
678 virtual bool CanDeoptimize() const { return true; }
679
654 private: 680 private:
655 const intptr_t token_pos_; 681 const intptr_t token_pos_;
656 const intptr_t try_index_; 682 const intptr_t try_index_;
657 intptr_t receiver_class_id_; // Set by optimizer. 683 intptr_t receiver_class_id_; // Set by optimizer.
658 684
659 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); 685 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp);
660 }; 686 };
661 687
662 688
663 class RelationalOpComp : public ComparisonComp { 689 class RelationalOpComp : public ComparisonComp {
(...skipping 18 matching lines...) Expand all
682 // TODO(srdjan): instead of class-id pass an enum that can differentiate 708 // TODO(srdjan): instead of class-id pass an enum that can differentiate
683 // between boxed and unboxed doubles and integers. 709 // between boxed and unboxed doubles and integers.
684 void set_operands_class_id(intptr_t value) { 710 void set_operands_class_id(intptr_t value) {
685 operands_class_id_ = value; 711 operands_class_id_ = value;
686 } 712 }
687 713
688 intptr_t operands_class_id() const { return operands_class_id_; } 714 intptr_t operands_class_id() const { return operands_class_id_; }
689 715
690 virtual void PrintOperandsTo(BufferFormatter* f) const; 716 virtual void PrintOperandsTo(BufferFormatter* f) const;
691 717
718 virtual bool CanDeoptimize() const { return true; }
719
692 private: 720 private:
693 const intptr_t token_pos_; 721 const intptr_t token_pos_;
694 const intptr_t try_index_; 722 const intptr_t try_index_;
695 intptr_t operands_class_id_; // class id of both operands. 723 intptr_t operands_class_id_; // class id of both operands.
696 724
697 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); 725 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp);
698 }; 726 };
699 727
700 728
701 class StaticCallComp : public Computation { 729 class StaticCallComp : public Computation {
(...skipping 24 matching lines...) Expand all
726 intptr_t ArgumentCount() const { return arguments_->length(); } 754 intptr_t ArgumentCount() const { return arguments_->length(); }
727 PushArgumentInstr* ArgumentAt(intptr_t index) const { 755 PushArgumentInstr* ArgumentAt(intptr_t index) const {
728 return (*arguments_)[index]; 756 return (*arguments_)[index];
729 } 757 }
730 758
731 MethodRecognizer::Kind recognized() const { return recognized_; } 759 MethodRecognizer::Kind recognized() const { return recognized_; }
732 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; } 760 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; }
733 761
734 virtual void PrintOperandsTo(BufferFormatter* f) const; 762 virtual void PrintOperandsTo(BufferFormatter* f) const;
735 763
764 virtual bool CanDeoptimize() const { return false; }
765
736 private: 766 private:
737 const intptr_t token_pos_; 767 const intptr_t token_pos_;
738 const intptr_t try_index_; 768 const intptr_t try_index_;
739 const Function& function_; 769 const Function& function_;
740 const Array& argument_names_; 770 const Array& argument_names_;
741 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 771 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
742 MethodRecognizer::Kind recognized_; 772 MethodRecognizer::Kind recognized_;
743 773
744 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); 774 DISALLOW_COPY_AND_ASSIGN(StaticCallComp);
745 }; 775 };
746 776
747 777
748 class LoadLocalComp : public TemplateComputation<0> { 778 class LoadLocalComp : public TemplateComputation<0> {
749 public: 779 public:
750 LoadLocalComp(const LocalVariable& local, intptr_t context_level) 780 LoadLocalComp(const LocalVariable& local, intptr_t context_level)
751 : local_(local), 781 : local_(local),
752 context_level_(context_level) { } 782 context_level_(context_level) { }
753 783
754 DECLARE_COMPUTATION(LoadLocal) 784 DECLARE_COMPUTATION(LoadLocal)
755 785
756 const LocalVariable& local() const { return local_; } 786 const LocalVariable& local() const { return local_; }
757 intptr_t context_level() const { return context_level_; } 787 intptr_t context_level() const { return context_level_; }
758 788
759 virtual void PrintOperandsTo(BufferFormatter* f) const; 789 virtual void PrintOperandsTo(BufferFormatter* f) const;
760 790
791 virtual bool CanDeoptimize() const { return false; }
792
761 private: 793 private:
762 const LocalVariable& local_; 794 const LocalVariable& local_;
763 const intptr_t context_level_; 795 const intptr_t context_level_;
764 796
765 DISALLOW_COPY_AND_ASSIGN(LoadLocalComp); 797 DISALLOW_COPY_AND_ASSIGN(LoadLocalComp);
766 }; 798 };
767 799
768 800
769 class StoreLocalComp : public TemplateComputation<1> { 801 class StoreLocalComp : public TemplateComputation<1> {
770 public: 802 public:
771 StoreLocalComp(const LocalVariable& local, 803 StoreLocalComp(const LocalVariable& local,
772 Value* value, 804 Value* value,
773 intptr_t context_level) 805 intptr_t context_level)
774 : local_(local), 806 : local_(local),
775 context_level_(context_level) { 807 context_level_(context_level) {
776 inputs_[0] = value; 808 inputs_[0] = value;
777 } 809 }
778 810
779 DECLARE_COMPUTATION(StoreLocal) 811 DECLARE_COMPUTATION(StoreLocal)
780 812
781 const LocalVariable& local() const { return local_; } 813 const LocalVariable& local() const { return local_; }
782 Value* value() const { return inputs_[0]; } 814 Value* value() const { return inputs_[0]; }
783 intptr_t context_level() const { return context_level_; } 815 intptr_t context_level() const { return context_level_; }
784 816
785 virtual void RecordAssignedVars(BitVector* assigned_vars, 817 virtual void RecordAssignedVars(BitVector* assigned_vars,
786 intptr_t fixed_parameter_count); 818 intptr_t fixed_parameter_count);
787 819
788 virtual void PrintOperandsTo(BufferFormatter* f) const; 820 virtual void PrintOperandsTo(BufferFormatter* f) const;
789 821
822 virtual bool CanDeoptimize() const { return false; }
823
790 private: 824 private:
791 const LocalVariable& local_; 825 const LocalVariable& local_;
792 const intptr_t context_level_; 826 const intptr_t context_level_;
793 827
794 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp); 828 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp);
795 }; 829 };
796 830
797 831
798 class NativeCallComp : public TemplateComputation<0> { 832 class NativeCallComp : public TemplateComputation<0> {
799 public: 833 public:
(...skipping 18 matching lines...) Expand all
818 bool has_optional_parameters() const { 852 bool has_optional_parameters() const {
819 return ast_node_.has_optional_parameters(); 853 return ast_node_.has_optional_parameters();
820 } 854 }
821 855
822 bool is_native_instance_closure() const { 856 bool is_native_instance_closure() const {
823 return ast_node_.is_native_instance_closure(); 857 return ast_node_.is_native_instance_closure();
824 } 858 }
825 859
826 virtual void PrintOperandsTo(BufferFormatter* f) const; 860 virtual void PrintOperandsTo(BufferFormatter* f) const;
827 861
862 virtual bool CanDeoptimize() const { return false; }
863
828 private: 864 private:
829 const NativeBodyNode& ast_node_; 865 const NativeBodyNode& ast_node_;
830 const intptr_t try_index_; 866 const intptr_t try_index_;
831 867
832 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); 868 DISALLOW_COPY_AND_ASSIGN(NativeCallComp);
833 }; 869 };
834 870
835 871
836 class LoadInstanceFieldComp : public TemplateComputation<1> { 872 class LoadInstanceFieldComp : public TemplateComputation<1> {
837 public: 873 public:
838 LoadInstanceFieldComp(const Field& field, 874 LoadInstanceFieldComp(const Field& field,
839 Value* instance, 875 Value* instance,
840 InstanceCallComp* original) // Maybe NULL. 876 InstanceCallComp* original) // Maybe NULL.
841 : field_(field), original_(original) { 877 : field_(field), original_(original) {
842 ASSERT(instance != NULL); 878 ASSERT(instance != NULL);
843 inputs_[0] = instance; 879 inputs_[0] = instance;
844 } 880 }
845 881
846 DECLARE_COMPUTATION(LoadInstanceField) 882 DECLARE_COMPUTATION(LoadInstanceField)
847 883
848 const Field& field() const { return field_; } 884 const Field& field() const { return field_; }
849 Value* instance() const { return inputs_[0]; } 885 Value* instance() const { return inputs_[0]; }
850 const InstanceCallComp* original() const { return original_; } 886 const InstanceCallComp* original() const { return original_; }
851 887
852 virtual void PrintOperandsTo(BufferFormatter* f) const; 888 virtual void PrintOperandsTo(BufferFormatter* f) const;
853 889
890 virtual bool CanDeoptimize() const { return true; }
891
854 private: 892 private:
855 const Field& field_; 893 const Field& field_;
856 const InstanceCallComp* original_; // For optimizations. 894 const InstanceCallComp* original_; // For optimizations.
857 895
858 DISALLOW_COPY_AND_ASSIGN(LoadInstanceFieldComp); 896 DISALLOW_COPY_AND_ASSIGN(LoadInstanceFieldComp);
859 }; 897 };
860 898
861 899
862 class StoreInstanceFieldComp : public TemplateComputation<2> { 900 class StoreInstanceFieldComp : public TemplateComputation<2> {
863 public: 901 public:
(...skipping 12 matching lines...) Expand all
876 914
877 const Field& field() const { return field_; } 915 const Field& field() const { return field_; }
878 916
879 Value* instance() const { return inputs_[0]; } 917 Value* instance() const { return inputs_[0]; }
880 Value* value() const { return inputs_[1]; } 918 Value* value() const { return inputs_[1]; }
881 919
882 const InstanceSetterComp* original() const { return original_; } 920 const InstanceSetterComp* original() const { return original_; }
883 921
884 virtual void PrintOperandsTo(BufferFormatter* f) const; 922 virtual void PrintOperandsTo(BufferFormatter* f) const;
885 923
924 virtual bool CanDeoptimize() const { return true; }
925
886 private: 926 private:
887 const Field& field_; 927 const Field& field_;
888 const InstanceSetterComp* original_; // For optimizations. 928 const InstanceSetterComp* original_; // For optimizations.
889 929
890 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldComp); 930 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldComp);
891 }; 931 };
892 932
893 933
894 class LoadStaticFieldComp : public TemplateComputation<0> { 934 class LoadStaticFieldComp : public TemplateComputation<0> {
895 public: 935 public:
896 explicit LoadStaticFieldComp(const Field& field) : field_(field) {} 936 explicit LoadStaticFieldComp(const Field& field) : field_(field) {}
897 937
898 DECLARE_COMPUTATION(LoadStaticField); 938 DECLARE_COMPUTATION(LoadStaticField);
899 939
900 const Field& field() const { return field_; } 940 const Field& field() const { return field_; }
901 941
902 virtual void PrintOperandsTo(BufferFormatter* f) const; 942 virtual void PrintOperandsTo(BufferFormatter* f) const;
903 943
944 virtual bool CanDeoptimize() const { return false; }
945
904 private: 946 private:
905 const Field& field_; 947 const Field& field_;
906 948
907 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldComp); 949 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldComp);
908 }; 950 };
909 951
910 952
911 class StoreStaticFieldComp : public TemplateComputation<1> { 953 class StoreStaticFieldComp : public TemplateComputation<1> {
912 public: 954 public:
913 StoreStaticFieldComp(const Field& field, Value* value) 955 StoreStaticFieldComp(const Field& field, Value* value)
914 : field_(field) { 956 : field_(field) {
915 ASSERT(field.IsZoneHandle()); 957 ASSERT(field.IsZoneHandle());
916 ASSERT(value != NULL); 958 ASSERT(value != NULL);
917 inputs_[0] = value; 959 inputs_[0] = value;
918 } 960 }
919 961
920 DECLARE_COMPUTATION(StoreStaticField); 962 DECLARE_COMPUTATION(StoreStaticField);
921 963
922 const Field& field() const { return field_; } 964 const Field& field() const { return field_; }
923 Value* value() const { return inputs_[0]; } 965 Value* value() const { return inputs_[0]; }
924 966
925 virtual void PrintOperandsTo(BufferFormatter* f) const; 967 virtual void PrintOperandsTo(BufferFormatter* f) const;
926 968
969 virtual bool CanDeoptimize() const { return false; }
970
927 private: 971 private:
928 const Field& field_; 972 const Field& field_;
929 973
930 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp); 974 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp);
931 }; 975 };
932 976
933 977
934 class LoadIndexedComp : public TemplateComputation<2> { 978 class LoadIndexedComp : public TemplateComputation<2> {
935 public: 979 public:
936 LoadIndexedComp(intptr_t token_pos, 980 LoadIndexedComp(intptr_t token_pos,
(...skipping 17 matching lines...) Expand all
954 Value* index() const { return inputs_[1]; } 998 Value* index() const { return inputs_[1]; }
955 999
956 void set_receiver_type(ObjectKind receiver_type) { 1000 void set_receiver_type(ObjectKind receiver_type) {
957 receiver_type_ = receiver_type; 1001 receiver_type_ = receiver_type;
958 } 1002 }
959 1003
960 ObjectKind receiver_type() const { 1004 ObjectKind receiver_type() const {
961 return receiver_type_; 1005 return receiver_type_;
962 } 1006 }
963 1007
1008 virtual bool CanDeoptimize() const { return true; }
1009
964 private: 1010 private:
965 const intptr_t token_pos_; 1011 const intptr_t token_pos_;
966 const intptr_t try_index_; 1012 const intptr_t try_index_;
967 ObjectKind receiver_type_; 1013 ObjectKind receiver_type_;
968 1014
969 DISALLOW_COPY_AND_ASSIGN(LoadIndexedComp); 1015 DISALLOW_COPY_AND_ASSIGN(LoadIndexedComp);
970 }; 1016 };
971 1017
972 1018
973 // Not simply an InstanceCall because it has somewhat more complicated 1019 // Not simply an InstanceCall because it has somewhat more complicated
(...skipping 22 matching lines...) Expand all
996 Value* value() const { return inputs_[2]; } 1042 Value* value() const { return inputs_[2]; }
997 1043
998 void set_receiver_type(ObjectKind receiver_type) { 1044 void set_receiver_type(ObjectKind receiver_type) {
999 receiver_type_ = receiver_type; 1045 receiver_type_ = receiver_type;
1000 } 1046 }
1001 1047
1002 ObjectKind receiver_type() const { 1048 ObjectKind receiver_type() const {
1003 return receiver_type_; 1049 return receiver_type_;
1004 } 1050 }
1005 1051
1052 virtual bool CanDeoptimize() const { return true; }
1053
1006 private: 1054 private:
1007 const intptr_t token_pos_; 1055 const intptr_t token_pos_;
1008 const intptr_t try_index_; 1056 const intptr_t try_index_;
1009 ObjectKind receiver_type_; 1057 ObjectKind receiver_type_;
1010 1058
1011 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp); 1059 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp);
1012 }; 1060 };
1013 1061
1014 1062
1015 // Not simply an InstanceCall because it has somewhat more complicated 1063 // Not simply an InstanceCall because it has somewhat more complicated
(...skipping 13 matching lines...) Expand all
1029 } 1077 }
1030 1078
1031 DECLARE_COMPUTATION(InstanceSetter) 1079 DECLARE_COMPUTATION(InstanceSetter)
1032 1080
1033 intptr_t token_pos() const { return token_pos_; } 1081 intptr_t token_pos() const { return token_pos_; }
1034 intptr_t try_index() const { return try_index_; } 1082 intptr_t try_index() const { return try_index_; }
1035 const String& field_name() const { return field_name_; } 1083 const String& field_name() const { return field_name_; }
1036 Value* receiver() const { return inputs_[0]; } 1084 Value* receiver() const { return inputs_[0]; }
1037 Value* value() const { return inputs_[1]; } 1085 Value* value() const { return inputs_[1]; }
1038 1086
1087 virtual bool CanDeoptimize() const { return true; }
1088
1039 private: 1089 private:
1040 const intptr_t token_pos_; 1090 const intptr_t token_pos_;
1041 const intptr_t try_index_; 1091 const intptr_t try_index_;
1042 const String& field_name_; 1092 const String& field_name_;
1043 1093
1044 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp); 1094 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp);
1045 }; 1095 };
1046 1096
1047 1097
1048 // Not simply a StaticCall because it has somewhat more complicated 1098 // Not simply a StaticCall because it has somewhat more complicated
(...skipping 10 matching lines...) Expand all
1059 inputs_[0] = value; 1109 inputs_[0] = value;
1060 } 1110 }
1061 1111
1062 DECLARE_COMPUTATION(StaticSetter) 1112 DECLARE_COMPUTATION(StaticSetter)
1063 1113
1064 intptr_t token_pos() const { return token_pos_; } 1114 intptr_t token_pos() const { return token_pos_; }
1065 intptr_t try_index() const { return try_index_; } 1115 intptr_t try_index() const { return try_index_; }
1066 const Function& setter_function() const { return setter_function_; } 1116 const Function& setter_function() const { return setter_function_; }
1067 Value* value() const { return inputs_[0]; } 1117 Value* value() const { return inputs_[0]; }
1068 1118
1119 virtual bool CanDeoptimize() const { return false; }
1120
1069 private: 1121 private:
1070 const intptr_t token_pos_; 1122 const intptr_t token_pos_;
1071 const intptr_t try_index_; 1123 const intptr_t try_index_;
1072 const Function& setter_function_; 1124 const Function& setter_function_;
1073 1125
1074 DISALLOW_COPY_AND_ASSIGN(StaticSetterComp); 1126 DISALLOW_COPY_AND_ASSIGN(StaticSetterComp);
1075 }; 1127 };
1076 1128
1077 1129
1078 // Note overrideable, built-in: value? false : true. 1130 // Note overrideable, built-in: value? false : true.
1079 class BooleanNegateComp : public TemplateComputation<1> { 1131 class BooleanNegateComp : public TemplateComputation<1> {
1080 public: 1132 public:
1081 explicit BooleanNegateComp(Value* value) { 1133 explicit BooleanNegateComp(Value* value) {
1082 inputs_[0] = value; 1134 inputs_[0] = value;
1083 } 1135 }
1084 1136
1085 DECLARE_COMPUTATION(BooleanNegate) 1137 DECLARE_COMPUTATION(BooleanNegate)
1086 1138
1087 Value* value() const { return inputs_[0]; } 1139 Value* value() const { return inputs_[0]; }
1088 1140
1141 virtual bool CanDeoptimize() const { return false; }
1142
1089 private: 1143 private:
1090 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp); 1144 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp);
1091 }; 1145 };
1092 1146
1093 1147
1094 class InstanceOfComp : public TemplateComputation<3> { 1148 class InstanceOfComp : public TemplateComputation<3> {
1095 public: 1149 public:
1096 InstanceOfComp(intptr_t token_pos, 1150 InstanceOfComp(intptr_t token_pos,
1097 intptr_t try_index, 1151 intptr_t try_index,
1098 Value* value, 1152 Value* value,
(...skipping 20 matching lines...) Expand all
1119 Value* instantiator() const { return inputs_[1]; } 1173 Value* instantiator() const { return inputs_[1]; }
1120 Value* instantiator_type_arguments() const { return inputs_[2]; } 1174 Value* instantiator_type_arguments() const { return inputs_[2]; }
1121 1175
1122 bool negate_result() const { return negate_result_; } 1176 bool negate_result() const { return negate_result_; }
1123 const AbstractType& type() const { return type_; } 1177 const AbstractType& type() const { return type_; }
1124 intptr_t token_pos() const { return token_pos_; } 1178 intptr_t token_pos() const { return token_pos_; }
1125 intptr_t try_index() const { return try_index_; } 1179 intptr_t try_index() const { return try_index_; }
1126 1180
1127 virtual void PrintOperandsTo(BufferFormatter* f) const; 1181 virtual void PrintOperandsTo(BufferFormatter* f) const;
1128 1182
1183 virtual bool CanDeoptimize() const { return false; }
1184
1129 private: 1185 private:
1130 const intptr_t token_pos_; 1186 const intptr_t token_pos_;
1131 const intptr_t try_index_; 1187 const intptr_t try_index_;
1132 Value* value_; 1188 Value* value_;
1133 Value* instantiator_; 1189 Value* instantiator_;
1134 Value* type_arguments_; 1190 Value* type_arguments_;
1135 const AbstractType& type_; 1191 const AbstractType& type_;
1136 const bool negate_result_; 1192 const bool negate_result_;
1137 1193
1138 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp); 1194 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp);
(...skipping 18 matching lines...) Expand all
1157 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; } 1213 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; }
1158 1214
1159 virtual intptr_t InputCount() const; 1215 virtual intptr_t InputCount() const;
1160 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; } 1216 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; }
1161 virtual void SetInputAt(intptr_t i, Value* value) { 1217 virtual void SetInputAt(intptr_t i, Value* value) {
1162 (*arguments_)[i] = value; 1218 (*arguments_)[i] = value;
1163 } 1219 }
1164 1220
1165 virtual void PrintOperandsTo(BufferFormatter* f) const; 1221 virtual void PrintOperandsTo(BufferFormatter* f) const;
1166 1222
1223 virtual bool CanDeoptimize() const { return false; }
1224
1167 private: 1225 private:
1168 const ConstructorCallNode& ast_node_; 1226 const ConstructorCallNode& ast_node_;
1169 const intptr_t try_index_; 1227 const intptr_t try_index_;
1170 ZoneGrowableArray<Value*>* const arguments_; 1228 ZoneGrowableArray<Value*>* const arguments_;
1171 DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp); 1229 DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp);
1172 }; 1230 };
1173 1231
1174 1232
1175 class AllocateObjectWithBoundsCheckComp : public Computation { 1233 class AllocateObjectWithBoundsCheckComp : public Computation {
1176 public: 1234 public:
(...skipping 13 matching lines...) Expand all
1190 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; } 1248 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; }
1191 1249
1192 virtual intptr_t InputCount() const; 1250 virtual intptr_t InputCount() const;
1193 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; } 1251 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; }
1194 virtual void SetInputAt(intptr_t i, Value* value) { 1252 virtual void SetInputAt(intptr_t i, Value* value) {
1195 (*arguments_)[i] = value; 1253 (*arguments_)[i] = value;
1196 } 1254 }
1197 1255
1198 virtual void PrintOperandsTo(BufferFormatter* f) const; 1256 virtual void PrintOperandsTo(BufferFormatter* f) const;
1199 1257
1258 virtual bool CanDeoptimize() const { return false; }
1259
1200 private: 1260 private:
1201 const ConstructorCallNode& ast_node_; 1261 const ConstructorCallNode& ast_node_;
1202 const intptr_t try_index_; 1262 const intptr_t try_index_;
1203 ZoneGrowableArray<Value*>* const arguments_; 1263 ZoneGrowableArray<Value*>* const arguments_;
1204 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); 1264 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp);
1205 }; 1265 };
1206 1266
1207 1267
1208 class CreateArrayComp : public TemplateComputation<1> { 1268 class CreateArrayComp : public TemplateComputation<1> {
1209 public: 1269 public:
(...skipping 20 matching lines...) Expand all
1230 intptr_t ElementCount() const { return elements_->length(); } 1290 intptr_t ElementCount() const { return elements_->length(); }
1231 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; } 1291 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; }
1232 Value* element_type() const { return inputs_[0]; } 1292 Value* element_type() const { return inputs_[0]; }
1233 1293
1234 virtual intptr_t InputCount() const; 1294 virtual intptr_t InputCount() const;
1235 virtual Value* InputAt(intptr_t i) const; 1295 virtual Value* InputAt(intptr_t i) const;
1236 virtual void SetInputAt(intptr_t i, Value* value); 1296 virtual void SetInputAt(intptr_t i, Value* value);
1237 1297
1238 virtual void PrintOperandsTo(BufferFormatter* f) const; 1298 virtual void PrintOperandsTo(BufferFormatter* f) const;
1239 1299
1300 virtual bool CanDeoptimize() const { return false; }
1301
1240 private: 1302 private:
1241 const intptr_t token_pos_; 1303 const intptr_t token_pos_;
1242 const intptr_t try_index_; 1304 const intptr_t try_index_;
1243 ZoneGrowableArray<Value*>* const elements_; 1305 ZoneGrowableArray<Value*>* const elements_;
1244 1306
1245 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); 1307 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp);
1246 }; 1308 };
1247 1309
1248 1310
1249 class CreateClosureComp : public Computation { 1311 class CreateClosureComp : public Computation {
(...skipping 11 matching lines...) Expand all
1261 intptr_t try_index() const { return try_index_; } 1323 intptr_t try_index() const { return try_index_; }
1262 const Function& function() const { return ast_node_.function(); } 1324 const Function& function() const { return ast_node_.function(); }
1263 1325
1264 intptr_t ArgumentCount() const { return arguments_->length(); } 1326 intptr_t ArgumentCount() const { return arguments_->length(); }
1265 PushArgumentInstr* ArgumentAt(intptr_t index) const { 1327 PushArgumentInstr* ArgumentAt(intptr_t index) const {
1266 return (*arguments_)[index]; 1328 return (*arguments_)[index];
1267 } 1329 }
1268 1330
1269 virtual void PrintOperandsTo(BufferFormatter* f) const; 1331 virtual void PrintOperandsTo(BufferFormatter* f) const;
1270 1332
1333 virtual bool CanDeoptimize() const { return false; }
1334
1271 private: 1335 private:
1272 const ClosureNode& ast_node_; 1336 const ClosureNode& ast_node_;
1273 const intptr_t try_index_; 1337 const intptr_t try_index_;
1274 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 1338 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
1275 1339
1276 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp); 1340 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp);
1277 }; 1341 };
1278 1342
1279 1343
1280 class LoadVMFieldComp : public TemplateComputation<1> { 1344 class LoadVMFieldComp : public TemplateComputation<1> {
(...skipping 12 matching lines...) Expand all
1293 DECLARE_COMPUTATION(LoadVMField) 1357 DECLARE_COMPUTATION(LoadVMField)
1294 1358
1295 Value* value() const { return inputs_[0]; } 1359 Value* value() const { return inputs_[0]; }
1296 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 1360 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
1297 const AbstractType& type() const { return type_; } 1361 const AbstractType& type() const { return type_; }
1298 const InstanceCallComp* original() const { return original_; } 1362 const InstanceCallComp* original() const { return original_; }
1299 void set_original(InstanceCallComp* value) { original_ = value; } 1363 void set_original(InstanceCallComp* value) { original_ = value; }
1300 1364
1301 virtual void PrintOperandsTo(BufferFormatter* f) const; 1365 virtual void PrintOperandsTo(BufferFormatter* f) const;
1302 1366
1367 virtual bool CanDeoptimize() const { return true; }
1368
1303 private: 1369 private:
1304 const intptr_t offset_in_bytes_; 1370 const intptr_t offset_in_bytes_;
1305 const AbstractType& type_; 1371 const AbstractType& type_;
1306 const InstanceCallComp* original_; // For optimizations. 1372 const InstanceCallComp* original_; // For optimizations.
1307 // If non-NULL, the instruction is valid only for the class ids listed. 1373 // If non-NULL, the instruction is valid only for the class ids listed.
1308 1374
1309 DISALLOW_COPY_AND_ASSIGN(LoadVMFieldComp); 1375 DISALLOW_COPY_AND_ASSIGN(LoadVMFieldComp);
1310 }; 1376 };
1311 1377
1312 1378
(...skipping 12 matching lines...) Expand all
1325 1391
1326 DECLARE_COMPUTATION(StoreVMField) 1392 DECLARE_COMPUTATION(StoreVMField)
1327 1393
1328 Value* value() const { return inputs_[0]; } 1394 Value* value() const { return inputs_[0]; }
1329 Value* dest() const { return inputs_[1]; } 1395 Value* dest() const { return inputs_[1]; }
1330 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 1396 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
1331 const AbstractType& type() const { return type_; } 1397 const AbstractType& type() const { return type_; }
1332 1398
1333 virtual void PrintOperandsTo(BufferFormatter* f) const; 1399 virtual void PrintOperandsTo(BufferFormatter* f) const;
1334 1400
1401 virtual bool CanDeoptimize() const { return false; }
1402
1335 private: 1403 private:
1336 const intptr_t offset_in_bytes_; 1404 const intptr_t offset_in_bytes_;
1337 const AbstractType& type_; 1405 const AbstractType& type_;
1338 1406
1339 DISALLOW_COPY_AND_ASSIGN(StoreVMFieldComp); 1407 DISALLOW_COPY_AND_ASSIGN(StoreVMFieldComp);
1340 }; 1408 };
1341 1409
1342 1410
1343 class InstantiateTypeArgumentsComp : public TemplateComputation<1> { 1411 class InstantiateTypeArgumentsComp : public TemplateComputation<1> {
1344 public: 1412 public:
(...skipping 12 matching lines...) Expand all
1357 1425
1358 Value* instantiator() const { return inputs_[0]; } 1426 Value* instantiator() const { return inputs_[0]; }
1359 const AbstractTypeArguments& type_arguments() const { 1427 const AbstractTypeArguments& type_arguments() const {
1360 return type_arguments_; 1428 return type_arguments_;
1361 } 1429 }
1362 intptr_t token_pos() const { return token_pos_; } 1430 intptr_t token_pos() const { return token_pos_; }
1363 intptr_t try_index() const { return try_index_; } 1431 intptr_t try_index() const { return try_index_; }
1364 1432
1365 virtual void PrintOperandsTo(BufferFormatter* f) const; 1433 virtual void PrintOperandsTo(BufferFormatter* f) const;
1366 1434
1435 virtual bool CanDeoptimize() const { return false; }
1436
1367 private: 1437 private:
1368 const intptr_t token_pos_; 1438 const intptr_t token_pos_;
1369 const intptr_t try_index_; 1439 const intptr_t try_index_;
1370 const AbstractTypeArguments& type_arguments_; 1440 const AbstractTypeArguments& type_arguments_;
1371 1441
1372 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp); 1442 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp);
1373 }; 1443 };
1374 1444
1375 1445
1376 class ExtractConstructorTypeArgumentsComp : public TemplateComputation<1> { 1446 class ExtractConstructorTypeArgumentsComp : public TemplateComputation<1> {
(...skipping 14 matching lines...) Expand all
1391 1461
1392 Value* instantiator() const { return inputs_[0]; } 1462 Value* instantiator() const { return inputs_[0]; }
1393 const AbstractTypeArguments& type_arguments() const { 1463 const AbstractTypeArguments& type_arguments() const {
1394 return type_arguments_; 1464 return type_arguments_;
1395 } 1465 }
1396 intptr_t token_pos() const { return token_pos_; } 1466 intptr_t token_pos() const { return token_pos_; }
1397 intptr_t try_index() const { return try_index_; } 1467 intptr_t try_index() const { return try_index_; }
1398 1468
1399 virtual void PrintOperandsTo(BufferFormatter* f) const; 1469 virtual void PrintOperandsTo(BufferFormatter* f) const;
1400 1470
1471 virtual bool CanDeoptimize() const { return false; }
1472
1401 private: 1473 private:
1402 const intptr_t token_pos_; 1474 const intptr_t token_pos_;
1403 const intptr_t try_index_; 1475 const intptr_t try_index_;
1404 const AbstractTypeArguments& type_arguments_; 1476 const AbstractTypeArguments& type_arguments_;
1405 1477
1406 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsComp); 1478 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsComp);
1407 }; 1479 };
1408 1480
1409 1481
1410 class ExtractConstructorInstantiatorComp : public TemplateComputation<1> { 1482 class ExtractConstructorInstantiatorComp : public TemplateComputation<1> {
1411 public: 1483 public:
1412 ExtractConstructorInstantiatorComp(ConstructorCallNode* ast_node, 1484 ExtractConstructorInstantiatorComp(ConstructorCallNode* ast_node,
1413 Value* instantiator) 1485 Value* instantiator)
1414 : ast_node_(*ast_node) { 1486 : ast_node_(*ast_node) {
1415 ASSERT(instantiator != NULL); 1487 ASSERT(instantiator != NULL);
1416 inputs_[0] = instantiator; 1488 inputs_[0] = instantiator;
1417 } 1489 }
1418 1490
1419 DECLARE_COMPUTATION(ExtractConstructorInstantiator) 1491 DECLARE_COMPUTATION(ExtractConstructorInstantiator)
1420 1492
1421 Value* instantiator() const { return inputs_[0]; } 1493 Value* instantiator() const { return inputs_[0]; }
1422 const AbstractTypeArguments& type_arguments() const { 1494 const AbstractTypeArguments& type_arguments() const {
1423 return ast_node_.type_arguments(); 1495 return ast_node_.type_arguments();
1424 } 1496 }
1425 const Function& constructor() const { return ast_node_.constructor(); } 1497 const Function& constructor() const { return ast_node_.constructor(); }
1426 intptr_t token_pos() const { return ast_node_.token_pos(); } 1498 intptr_t token_pos() const { return ast_node_.token_pos(); }
1427 1499
1500 virtual bool CanDeoptimize() const { return false; }
1501
1428 private: 1502 private:
1429 const ConstructorCallNode& ast_node_; 1503 const ConstructorCallNode& ast_node_;
1430 1504
1431 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorComp); 1505 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorComp);
1432 }; 1506 };
1433 1507
1434 1508
1435 class AllocateContextComp : public TemplateComputation<0> { 1509 class AllocateContextComp : public TemplateComputation<0> {
1436 public: 1510 public:
1437 AllocateContextComp(intptr_t token_pos, 1511 AllocateContextComp(intptr_t token_pos,
1438 intptr_t try_index, 1512 intptr_t try_index,
1439 intptr_t num_context_variables) 1513 intptr_t num_context_variables)
1440 : token_pos_(token_pos), 1514 : token_pos_(token_pos),
1441 try_index_(try_index), 1515 try_index_(try_index),
1442 num_context_variables_(num_context_variables) {} 1516 num_context_variables_(num_context_variables) {}
1443 1517
1444 DECLARE_COMPUTATION(AllocateContext); 1518 DECLARE_COMPUTATION(AllocateContext);
1445 1519
1446 intptr_t token_pos() const { return token_pos_; } 1520 intptr_t token_pos() const { return token_pos_; }
1447 intptr_t try_index() const { return try_index_; } 1521 intptr_t try_index() const { return try_index_; }
1448 intptr_t num_context_variables() const { return num_context_variables_; } 1522 intptr_t num_context_variables() const { return num_context_variables_; }
1449 1523
1450 virtual void PrintOperandsTo(BufferFormatter* f) const; 1524 virtual void PrintOperandsTo(BufferFormatter* f) const;
1451 1525
1526 virtual bool CanDeoptimize() const { return false; }
1527
1452 private: 1528 private:
1453 const intptr_t token_pos_; 1529 const intptr_t token_pos_;
1454 const intptr_t try_index_; 1530 const intptr_t try_index_;
1455 const intptr_t num_context_variables_; 1531 const intptr_t num_context_variables_;
1456 1532
1457 DISALLOW_COPY_AND_ASSIGN(AllocateContextComp); 1533 DISALLOW_COPY_AND_ASSIGN(AllocateContextComp);
1458 }; 1534 };
1459 1535
1460 1536
1461 class ChainContextComp : public TemplateComputation<1> { 1537 class ChainContextComp : public TemplateComputation<1> {
1462 public: 1538 public:
1463 explicit ChainContextComp(Value* context_value) { 1539 explicit ChainContextComp(Value* context_value) {
1464 ASSERT(context_value != NULL); 1540 ASSERT(context_value != NULL);
1465 inputs_[0] = context_value; 1541 inputs_[0] = context_value;
1466 } 1542 }
1467 1543
1468 DECLARE_COMPUTATION(ChainContext) 1544 DECLARE_COMPUTATION(ChainContext)
1469 1545
1470 Value* context_value() const { return inputs_[0]; } 1546 Value* context_value() const { return inputs_[0]; }
1471 1547
1548 virtual bool CanDeoptimize() const { return false; }
1549
1472 private: 1550 private:
1473 DISALLOW_COPY_AND_ASSIGN(ChainContextComp); 1551 DISALLOW_COPY_AND_ASSIGN(ChainContextComp);
1474 }; 1552 };
1475 1553
1476 1554
1477 class CloneContextComp : public TemplateComputation<1> { 1555 class CloneContextComp : public TemplateComputation<1> {
1478 public: 1556 public:
1479 CloneContextComp(intptr_t token_pos, 1557 CloneContextComp(intptr_t token_pos,
1480 intptr_t try_index, 1558 intptr_t try_index,
1481 Value* context_value) 1559 Value* context_value)
1482 : token_pos_(token_pos), 1560 : token_pos_(token_pos),
1483 try_index_(try_index) { 1561 try_index_(try_index) {
1484 ASSERT(context_value != NULL); 1562 ASSERT(context_value != NULL);
1485 inputs_[0] = context_value; 1563 inputs_[0] = context_value;
1486 } 1564 }
1487 1565
1488 intptr_t token_pos() const { return token_pos_; } 1566 intptr_t token_pos() const { return token_pos_; }
1489 intptr_t try_index() const { return try_index_; } 1567 intptr_t try_index() const { return try_index_; }
1490 Value* context_value() const { return inputs_[0]; } 1568 Value* context_value() const { return inputs_[0]; }
1491 1569
1492 DECLARE_COMPUTATION(CloneContext) 1570 DECLARE_COMPUTATION(CloneContext)
1493 1571
1572 virtual bool CanDeoptimize() const { return false; }
1573
1494 private: 1574 private:
1495 const intptr_t token_pos_; 1575 const intptr_t token_pos_;
1496 const intptr_t try_index_; 1576 const intptr_t try_index_;
1497 1577
1498 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); 1578 DISALLOW_COPY_AND_ASSIGN(CloneContextComp);
1499 }; 1579 };
1500 1580
1501 1581
1502 class CatchEntryComp : public TemplateComputation<0> { 1582 class CatchEntryComp : public TemplateComputation<0> {
1503 public: 1583 public:
1504 CatchEntryComp(const LocalVariable& exception_var, 1584 CatchEntryComp(const LocalVariable& exception_var,
1505 const LocalVariable& stacktrace_var) 1585 const LocalVariable& stacktrace_var)
1506 : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {} 1586 : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {}
1507 1587
1508 const LocalVariable& exception_var() const { return exception_var_; } 1588 const LocalVariable& exception_var() const { return exception_var_; }
1509 const LocalVariable& stacktrace_var() const { return stacktrace_var_; } 1589 const LocalVariable& stacktrace_var() const { return stacktrace_var_; }
1510 1590
1511 DECLARE_COMPUTATION(CatchEntry) 1591 DECLARE_COMPUTATION(CatchEntry)
1512 1592
1513 virtual void PrintOperandsTo(BufferFormatter* f) const; 1593 virtual void PrintOperandsTo(BufferFormatter* f) const;
1514 1594
1595 virtual bool CanDeoptimize() const { return false; }
1596
1515 private: 1597 private:
1516 const LocalVariable& exception_var_; 1598 const LocalVariable& exception_var_;
1517 const LocalVariable& stacktrace_var_; 1599 const LocalVariable& stacktrace_var_;
1518 1600
1519 DISALLOW_COPY_AND_ASSIGN(CatchEntryComp); 1601 DISALLOW_COPY_AND_ASSIGN(CatchEntryComp);
1520 }; 1602 };
1521 1603
1522 1604
1523 class BinaryOpComp : public TemplateComputation<2> { 1605 class BinaryOpComp : public TemplateComputation<2> {
1524 public: 1606 public:
(...skipping 24 matching lines...) Expand all
1549 Token::Kind op_kind() const { return op_kind_; } 1631 Token::Kind op_kind() const { return op_kind_; }
1550 1632
1551 OperandsType operands_type() const { return operands_type_; } 1633 OperandsType operands_type() const { return operands_type_; }
1552 1634
1553 InstanceCallComp* instance_call() const { return instance_call_; } 1635 InstanceCallComp* instance_call() const { return instance_call_; }
1554 1636
1555 virtual void PrintOperandsTo(BufferFormatter* f) const; 1637 virtual void PrintOperandsTo(BufferFormatter* f) const;
1556 1638
1557 DECLARE_COMPUTATION(BinaryOp) 1639 DECLARE_COMPUTATION(BinaryOp)
1558 1640
1641 virtual bool CanDeoptimize() const { return true; }
1642
1559 private: 1643 private:
1560 const Token::Kind op_kind_; 1644 const Token::Kind op_kind_;
1561 const OperandsType operands_type_; 1645 const OperandsType operands_type_;
1562 InstanceCallComp* instance_call_; 1646 InstanceCallComp* instance_call_;
1563 1647
1564 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp); 1648 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp);
1565 }; 1649 };
1566 1650
1567 1651
1568 // Handles both Smi operations: BIT_OR and NEGATE. 1652 // Handles both Smi operations: BIT_OR and NEGATE.
1569 class UnarySmiOpComp : public TemplateComputation<1> { 1653 class UnarySmiOpComp : public TemplateComputation<1> {
1570 public: 1654 public:
1571 UnarySmiOpComp(Token::Kind op_kind, 1655 UnarySmiOpComp(Token::Kind op_kind,
1572 InstanceCallComp* instance_call, 1656 InstanceCallComp* instance_call,
1573 Value* value) 1657 Value* value)
1574 : op_kind_(op_kind), instance_call_(instance_call) { 1658 : op_kind_(op_kind), instance_call_(instance_call) {
1575 ASSERT(value != NULL); 1659 ASSERT(value != NULL);
1576 inputs_[0] = value; 1660 inputs_[0] = value;
1577 } 1661 }
1578 1662
1579 Value* value() const { return inputs_[0]; } 1663 Value* value() const { return inputs_[0]; }
1580 Token::Kind op_kind() const { return op_kind_; } 1664 Token::Kind op_kind() const { return op_kind_; }
1581 1665
1582 InstanceCallComp* instance_call() const { return instance_call_; } 1666 InstanceCallComp* instance_call() const { return instance_call_; }
1583 1667
1584 virtual void PrintOperandsTo(BufferFormatter* f) const; 1668 virtual void PrintOperandsTo(BufferFormatter* f) const;
1585 1669
1586 DECLARE_COMPUTATION(UnarySmiOp) 1670 DECLARE_COMPUTATION(UnarySmiOp)
1587 1671
1672 virtual bool CanDeoptimize() const { return true; }
1673
1588 private: 1674 private:
1589 const Token::Kind op_kind_; 1675 const Token::Kind op_kind_;
1590 InstanceCallComp* instance_call_; 1676 InstanceCallComp* instance_call_;
1591 1677
1592 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpComp); 1678 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpComp);
1593 }; 1679 };
1594 1680
1595 1681
1596 // Handles non-Smi NEGATE operations 1682 // Handles non-Smi NEGATE operations
1597 class NumberNegateComp : public TemplateComputation<1> { 1683 class NumberNegateComp : public TemplateComputation<1> {
1598 public: 1684 public:
1599 NumberNegateComp(InstanceCallComp* instance_call, 1685 NumberNegateComp(InstanceCallComp* instance_call,
1600 Value* value) : instance_call_(instance_call) { 1686 Value* value) : instance_call_(instance_call) {
1601 ASSERT(value != NULL); 1687 ASSERT(value != NULL);
1602 inputs_[0] = value; 1688 inputs_[0] = value;
1603 } 1689 }
1604 1690
1605 Value* value() const { return inputs_[0]; } 1691 Value* value() const { return inputs_[0]; }
1606 1692
1607 InstanceCallComp* instance_call() const { return instance_call_; } 1693 InstanceCallComp* instance_call() const { return instance_call_; }
1608 1694
1609 DECLARE_COMPUTATION(NumberNegate) 1695 DECLARE_COMPUTATION(NumberNegate)
1610 1696
1697 virtual bool CanDeoptimize() const { return true; }
1698
1611 private: 1699 private:
1612 InstanceCallComp* instance_call_; 1700 InstanceCallComp* instance_call_;
1613 1701
1614 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); 1702 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp);
1615 }; 1703 };
1616 1704
1617 1705
1618 class CheckStackOverflowComp : public TemplateComputation<0> { 1706 class CheckStackOverflowComp : public TemplateComputation<0> {
1619 public: 1707 public:
1620 CheckStackOverflowComp(intptr_t token_pos, intptr_t try_index) 1708 CheckStackOverflowComp(intptr_t token_pos, intptr_t try_index)
1621 : token_pos_(token_pos), 1709 : token_pos_(token_pos),
1622 try_index_(try_index) {} 1710 try_index_(try_index) {}
1623 1711
1624 intptr_t token_pos() const { return token_pos_; } 1712 intptr_t token_pos() const { return token_pos_; }
1625 intptr_t try_index() const { return try_index_; } 1713 intptr_t try_index() const { return try_index_; }
1626 1714
1627 DECLARE_COMPUTATION(CheckStackOverflow) 1715 DECLARE_COMPUTATION(CheckStackOverflow)
1628 1716
1717 virtual bool CanDeoptimize() const { return false; }
1718
1629 private: 1719 private:
1630 const intptr_t token_pos_; 1720 const intptr_t token_pos_;
1631 const intptr_t try_index_; 1721 const intptr_t try_index_;
1632 1722
1633 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); 1723 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp);
1634 }; 1724 };
1635 1725
1636 1726
1637 class ToDoubleComp : public TemplateComputation<1> { 1727 class ToDoubleComp : public TemplateComputation<1> {
1638 public: 1728 public:
1639 ToDoubleComp(Value* value, 1729 ToDoubleComp(Value* value,
1640 ObjectKind from, 1730 ObjectKind from,
1641 InstanceCallComp* instance_call) 1731 InstanceCallComp* instance_call)
1642 : from_(from), instance_call_(instance_call) { 1732 : from_(from), instance_call_(instance_call) {
1643 ASSERT(value != NULL); 1733 ASSERT(value != NULL);
1644 inputs_[0] = value; 1734 inputs_[0] = value;
1645 } 1735 }
1646 1736
1647 Value* value() const { return inputs_[0]; } 1737 Value* value() const { return inputs_[0]; }
1648 ObjectKind from() const { return from_; } 1738 ObjectKind from() const { return from_; }
1649 1739
1650 InstanceCallComp* instance_call() const { return instance_call_; } 1740 InstanceCallComp* instance_call() const { return instance_call_; }
1651 1741
1652 virtual void PrintOperandsTo(BufferFormatter* f) const; 1742 virtual void PrintOperandsTo(BufferFormatter* f) const;
1653 1743
1654 DECLARE_COMPUTATION(ToDouble) 1744 DECLARE_COMPUTATION(ToDouble)
1655 1745
1746 virtual bool CanDeoptimize() const { return true; }
1747
1656 private: 1748 private:
1657 const ObjectKind from_; 1749 const ObjectKind from_;
1658 InstanceCallComp* instance_call_; 1750 InstanceCallComp* instance_call_;
1659 1751
1660 DISALLOW_COPY_AND_ASSIGN(ToDoubleComp); 1752 DISALLOW_COPY_AND_ASSIGN(ToDoubleComp);
1661 }; 1753 };
1662 1754
1663 1755
1664 #undef DECLARE_COMPUTATION 1756 #undef DECLARE_COMPUTATION
1665 1757
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 virtual Definition* AsDefinition() { return NULL; } 1844 virtual Definition* AsDefinition() { return NULL; }
1753 1845
1754 virtual intptr_t InputCount() const = 0; 1846 virtual intptr_t InputCount() const = 0;
1755 virtual Value* InputAt(intptr_t i) const = 0; 1847 virtual Value* InputAt(intptr_t i) const = 0;
1756 virtual void SetInputAt(intptr_t i, Value* value) = 0; 1848 virtual void SetInputAt(intptr_t i, Value* value) = 0;
1757 1849
1758 // Call instructions override this function and return the 1850 // Call instructions override this function and return the
1759 // number of pushed arguments. 1851 // number of pushed arguments.
1760 virtual intptr_t ArgumentCount() const = 0; 1852 virtual intptr_t ArgumentCount() const = 0;
1761 1853
1854 // Returns true, if this instruction can deoptimize.
1855 virtual bool CanDeoptimize() const = 0;
1856
1762 // Visiting support. 1857 // Visiting support.
1763 virtual void Accept(FlowGraphVisitor* visitor) = 0; 1858 virtual void Accept(FlowGraphVisitor* visitor) = 0;
1764 1859
1765 Instruction* previous() const { return previous_; } 1860 Instruction* previous() const { return previous_; }
1766 void set_previous(Instruction* instr) { 1861 void set_previous(Instruction* instr) {
1767 ASSERT(!IsBlockEntry()); 1862 ASSERT(!IsBlockEntry());
1768 previous_ = instr; 1863 previous_ = instr;
1769 } 1864 }
1770 1865
1771 Instruction* next() const { return next_; } 1866 Instruction* next() const { return next_; }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 BlockEntryInstr* current_block, 2027 BlockEntryInstr* current_block,
1933 GrowableArray<BlockEntryInstr*>* preorder, 2028 GrowableArray<BlockEntryInstr*>* preorder,
1934 GrowableArray<BlockEntryInstr*>* postorder, 2029 GrowableArray<BlockEntryInstr*>* postorder,
1935 GrowableArray<intptr_t>* parent, 2030 GrowableArray<intptr_t>* parent,
1936 GrowableArray<BitVector*>* assigned_vars, 2031 GrowableArray<BitVector*>* assigned_vars,
1937 intptr_t variable_count, 2032 intptr_t variable_count,
1938 intptr_t fixed_parameter_count); 2033 intptr_t fixed_parameter_count);
1939 2034
1940 virtual intptr_t ArgumentCount() const { return 0; } 2035 virtual intptr_t ArgumentCount() const { return 0; }
1941 2036
2037 virtual bool CanDeoptimize() const { return false; }
2038
1942 protected: 2039 protected:
1943 BlockEntryInstr() 2040 BlockEntryInstr()
1944 : preorder_number_(-1), 2041 : preorder_number_(-1),
1945 postorder_number_(-1), 2042 postorder_number_(-1),
1946 block_id_(-1), 2043 block_id_(-1),
1947 dominator_(NULL), 2044 dominator_(NULL),
1948 dominated_blocks_(1), 2045 dominated_blocks_(1),
1949 last_instruction_(NULL) { } 2046 last_instruction_(NULL) { }
1950 2047
1951 private: 2048 private:
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 : computation_(computation), is_used_(used != kUnused) { 2291 : computation_(computation), is_used_(used != kUnused) {
2195 ASSERT(computation != NULL); 2292 ASSERT(computation != NULL);
2196 } 2293 }
2197 2294
2198 DECLARE_INSTRUCTION(Bind) 2295 DECLARE_INSTRUCTION(Bind)
2199 2296
2200 virtual intptr_t ArgumentCount() const { 2297 virtual intptr_t ArgumentCount() const {
2201 return computation()->ArgumentCount(); 2298 return computation()->ArgumentCount();
2202 } 2299 }
2203 2300
2301 virtual bool CanDeoptimize() const { return computation()->CanDeoptimize(); }
2302
2204 Computation* computation() const { return computation_; } 2303 Computation* computation() const { return computation_; }
2205 void set_computation(Computation* value) { computation_ = value; } 2304 void set_computation(Computation* value) { computation_ = value; }
2206 bool is_used() const { return is_used_; } 2305 bool is_used() const { return is_used_; }
2207 2306
2208 // Static type of the underlying computation. 2307 // Static type of the underlying computation.
2209 virtual RawAbstractType* StaticType() const { 2308 virtual RawAbstractType* StaticType() const {
2210 return computation()->StaticType(); 2309 return computation()->StaticType();
2211 } 2310 }
2212 2311
2213 virtual void RecordAssignedVars(BitVector* assigned_vars, 2312 virtual void RecordAssignedVars(BitVector* assigned_vars,
(...skipping 19 matching lines...) Expand all
2233 for (intptr_t i = 0; i < num_inputs; ++i) { 2332 for (intptr_t i = 0; i < num_inputs; ++i) {
2234 inputs_.Add(NULL); 2333 inputs_.Add(NULL);
2235 } 2334 }
2236 } 2335 }
2237 2336
2238 // Least upper bound of the static types of the inputs. 2337 // Least upper bound of the static types of the inputs.
2239 virtual RawAbstractType* StaticType() const; 2338 virtual RawAbstractType* StaticType() const;
2240 2339
2241 virtual intptr_t ArgumentCount() const { return 0; } 2340 virtual intptr_t ArgumentCount() const { return 0; }
2242 2341
2342 virtual bool CanDeoptimize() const { return false; }
2343
2243 DECLARE_INSTRUCTION(Phi) 2344 DECLARE_INSTRUCTION(Phi)
2244 2345
2245 private: 2346 private:
2246 GrowableArray<Value*> inputs_; 2347 GrowableArray<Value*> inputs_;
2247 2348
2248 DISALLOW_COPY_AND_ASSIGN(PhiInstr); 2349 DISALLOW_COPY_AND_ASSIGN(PhiInstr);
2249 }; 2350 };
2250 2351
2251 2352
2252 class ParameterInstr : public Definition { 2353 class ParameterInstr : public Definition {
2253 public: 2354 public:
2254 explicit ParameterInstr(intptr_t index) : index_(index) { } 2355 explicit ParameterInstr(intptr_t index) : index_(index) { }
2255 2356
2357 DECLARE_INSTRUCTION(Parameter)
2358
2256 intptr_t index() const { return index_; } 2359 intptr_t index() const { return index_; }
2257 2360
2258 // Static type of the passed-in parameter. 2361 // Static type of the passed-in parameter.
2259 virtual RawAbstractType* StaticType() const; 2362 virtual RawAbstractType* StaticType() const;
2260 2363
2261 virtual intptr_t ArgumentCount() const { return 0; } 2364 virtual intptr_t ArgumentCount() const { return 0; }
2262 2365
2263 DECLARE_INSTRUCTION(Parameter) 2366 virtual bool CanDeoptimize() const { return false; }
2264 2367
2265 private: 2368 private:
2266 const intptr_t index_; 2369 const intptr_t index_;
2267 2370
2268 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); 2371 DISALLOW_COPY_AND_ASSIGN(ParameterInstr);
2269 }; 2372 };
2270 2373
2271 2374
2272 class PushArgumentInstr : public InstructionWithInputs { 2375 class PushArgumentInstr : public InstructionWithInputs {
2273 public: 2376 public:
2274 explicit PushArgumentInstr(Value* value) : value_(value) { } 2377 explicit PushArgumentInstr(Value* value) : value_(value) { }
2275 2378
2276 DECLARE_INSTRUCTION(PushArgument) 2379 DECLARE_INSTRUCTION(PushArgument)
2277 2380
2278 Value* value() const { return value_; } 2381 Value* value() const { return value_; }
2279 2382
2280 virtual LocationSummary* MakeLocationSummary() const; 2383 virtual LocationSummary* MakeLocationSummary() const;
2281 2384
2282 virtual void EmitNativeCode(FlowGraphCompiler* compiler); 2385 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
2283 2386
2387 virtual bool CanDeoptimize() const { return false; }
2388
2284 private: 2389 private:
2285 Value* value_; 2390 Value* value_;
2286 2391
2287 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); 2392 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr);
2288 }; 2393 };
2289 2394
2290 2395
2291 class ReturnInstr : public InstructionWithInputs { 2396 class ReturnInstr : public InstructionWithInputs {
2292 public: 2397 public:
2293 ReturnInstr(intptr_t token_pos, Value* value) 2398 ReturnInstr(intptr_t token_pos, Value* value)
2294 : InstructionWithInputs(), token_pos_(token_pos), value_(value) { 2399 : InstructionWithInputs(), token_pos_(token_pos), value_(value) {
2295 ASSERT(value_ != NULL); 2400 ASSERT(value_ != NULL);
2296 } 2401 }
2297 2402
2298 DECLARE_INSTRUCTION(Return) 2403 DECLARE_INSTRUCTION(Return)
2299 2404
2300 Value* value() const { return value_; } 2405 Value* value() const { return value_; }
2301 intptr_t token_pos() const { return token_pos_; } 2406 intptr_t token_pos() const { return token_pos_; }
2302 2407
2303 virtual LocationSummary* MakeLocationSummary() const; 2408 virtual LocationSummary* MakeLocationSummary() const;
2304 2409
2305 virtual void EmitNativeCode(FlowGraphCompiler* compiler); 2410 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
2306 2411
2412 virtual bool CanDeoptimize() const { return false; }
2413
2307 private: 2414 private:
2308 const intptr_t token_pos_; 2415 const intptr_t token_pos_;
2309 Value* value_; 2416 Value* value_;
2310 2417
2311 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 2418 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
2312 }; 2419 };
2313 2420
2314 2421
2315 class ThrowInstr : public InstructionWithInputs { 2422 class ThrowInstr : public InstructionWithInputs {
2316 public: 2423 public:
(...skipping 10 matching lines...) Expand all
2327 DECLARE_INSTRUCTION(Throw) 2434 DECLARE_INSTRUCTION(Throw)
2328 2435
2329 intptr_t token_pos() const { return token_pos_; } 2436 intptr_t token_pos() const { return token_pos_; }
2330 intptr_t try_index() const { return try_index_; } 2437 intptr_t try_index() const { return try_index_; }
2331 Value* exception() const { return exception_; } 2438 Value* exception() const { return exception_; }
2332 2439
2333 virtual LocationSummary* MakeLocationSummary() const; 2440 virtual LocationSummary* MakeLocationSummary() const;
2334 2441
2335 virtual void EmitNativeCode(FlowGraphCompiler* compiler); 2442 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
2336 2443
2444 virtual bool CanDeoptimize() const { return false; }
2445
2337 private: 2446 private:
2338 const intptr_t token_pos_; 2447 const intptr_t token_pos_;
2339 const intptr_t try_index_; 2448 const intptr_t try_index_;
2340 Value* exception_; 2449 Value* exception_;
2341 2450
2342 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 2451 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
2343 }; 2452 };
2344 2453
2345 2454
2346 class ReThrowInstr : public InstructionWithInputs { 2455 class ReThrowInstr : public InstructionWithInputs {
(...skipping 15 matching lines...) Expand all
2362 2471
2363 intptr_t token_pos() const { return token_pos_; } 2472 intptr_t token_pos() const { return token_pos_; }
2364 intptr_t try_index() const { return try_index_; } 2473 intptr_t try_index() const { return try_index_; }
2365 Value* exception() const { return exception_; } 2474 Value* exception() const { return exception_; }
2366 Value* stack_trace() const { return stack_trace_; } 2475 Value* stack_trace() const { return stack_trace_; }
2367 2476
2368 virtual LocationSummary* MakeLocationSummary() const; 2477 virtual LocationSummary* MakeLocationSummary() const;
2369 2478
2370 virtual void EmitNativeCode(FlowGraphCompiler* compiler); 2479 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
2371 2480
2481 virtual bool CanDeoptimize() const { return false; }
2482
2372 private: 2483 private:
2373 const intptr_t token_pos_; 2484 const intptr_t token_pos_;
2374 const intptr_t try_index_; 2485 const intptr_t try_index_;
2375 Value* exception_; 2486 Value* exception_;
2376 Value* stack_trace_; 2487 Value* stack_trace_;
2377 2488
2378 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); 2489 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
2379 }; 2490 };
2380 2491
2381 2492
2382 class GotoInstr : public InstructionWithInputs { 2493 class GotoInstr : public InstructionWithInputs {
2383 public: 2494 public:
2384 explicit GotoInstr(JoinEntryInstr* entry) : successor_(entry) { } 2495 explicit GotoInstr(JoinEntryInstr* entry) : successor_(entry) { }
2385 2496
2386 DECLARE_INSTRUCTION(Goto) 2497 DECLARE_INSTRUCTION(Goto)
2387 2498
2388 JoinEntryInstr* successor() const { return successor_; } 2499 JoinEntryInstr* successor() const { return successor_; }
2389 void set_successor(JoinEntryInstr* successor) { successor_ = successor; } 2500 void set_successor(JoinEntryInstr* successor) { successor_ = successor; }
2390 virtual intptr_t SuccessorCount() const; 2501 virtual intptr_t SuccessorCount() const;
2391 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; 2502 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
2392 2503
2393 virtual LocationSummary* MakeLocationSummary() const; 2504 virtual LocationSummary* MakeLocationSummary() const;
2394 2505
2395 virtual void EmitNativeCode(FlowGraphCompiler* compiler); 2506 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
2396 2507
2508 virtual bool CanDeoptimize() const { return false; }
2509
2397 private: 2510 private:
2398 JoinEntryInstr* successor_; 2511 JoinEntryInstr* successor_;
2399 }; 2512 };
2400 2513
2401 2514
2402 class BranchInstr : public InstructionWithInputs { 2515 class BranchInstr : public InstructionWithInputs {
2403 public: 2516 public:
2404 BranchInstr(intptr_t token_pos, 2517 BranchInstr(intptr_t token_pos,
2405 intptr_t try_index, 2518 intptr_t try_index,
2406 Value* left, 2519 Value* left,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 intptr_t variable_count, 2566 intptr_t variable_count,
2454 intptr_t fixed_parameter_count); 2567 intptr_t fixed_parameter_count);
2455 2568
2456 virtual LocationSummary* MakeLocationSummary() const; 2569 virtual LocationSummary* MakeLocationSummary() const;
2457 2570
2458 virtual void EmitNativeCode(FlowGraphCompiler* compiler); 2571 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
2459 2572
2460 void EmitBranchOnCondition(FlowGraphCompiler* compiler, 2573 void EmitBranchOnCondition(FlowGraphCompiler* compiler,
2461 Condition true_condition); 2574 Condition true_condition);
2462 2575
2576 virtual bool CanDeoptimize() const { return true; }
2577
2463 private: 2578 private:
2464 const intptr_t token_pos_; 2579 const intptr_t token_pos_;
2465 const intptr_t try_index_; 2580 const intptr_t try_index_;
2466 Value* left_; 2581 Value* left_;
2467 Value* right_; 2582 Value* right_;
2468 Token::Kind kind_; 2583 Token::Kind kind_;
2469 TargetEntryInstr* true_successor_; 2584 TargetEntryInstr* true_successor_;
2470 TargetEntryInstr* false_successor_; 2585 TargetEntryInstr* false_successor_;
2471 2586
2472 DISALLOW_COPY_AND_ASSIGN(BranchInstr); 2587 DISALLOW_COPY_AND_ASSIGN(BranchInstr);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 return move; 2661 return move;
2547 } 2662 }
2548 2663
2549 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; } 2664 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; }
2550 2665
2551 void SetSrcSlotAt(intptr_t index, const Location& loc); 2666 void SetSrcSlotAt(intptr_t index, const Location& loc);
2552 void SetDestSlotAt(intptr_t index, const Location& loc); 2667 void SetDestSlotAt(intptr_t index, const Location& loc);
2553 2668
2554 intptr_t NumMoves() const { return moves_.length(); } 2669 intptr_t NumMoves() const { return moves_.length(); }
2555 2670
2671 virtual bool CanDeoptimize() const { return false; }
2672
2556 private: 2673 private:
2557 GrowableArray<MoveOperands*> moves_; // Elements cannot be null. 2674 GrowableArray<MoveOperands*> moves_; // Elements cannot be null.
2558 2675
2559 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); 2676 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr);
2560 }; 2677 };
2561 2678
2562 #undef DECLARE_INSTRUCTION 2679 #undef DECLARE_INSTRUCTION
2563 2680
2564 2681
2565 class Environment : public ZoneAllocated { 2682 class Environment : public ZoneAllocated {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 const GrowableArray<BlockEntryInstr*>& block_order_; 2754 const GrowableArray<BlockEntryInstr*>& block_order_;
2638 2755
2639 private: 2756 private:
2640 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2757 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2641 }; 2758 };
2642 2759
2643 2760
2644 } // namespace dart 2761 } // namespace dart
2645 2762
2646 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2763 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« vm/flow_graph_compiler.cc ('K') | « vm/flow_graph_compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698