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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 10826285: Optimize equality for case when all targets are Object.equals. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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
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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 class EqualityCompareComp : public ComparisonComp { 667 class EqualityCompareComp : public ComparisonComp {
668 public: 668 public:
669 EqualityCompareComp(intptr_t token_pos, 669 EqualityCompareComp(intptr_t token_pos,
670 intptr_t try_index, 670 intptr_t try_index,
671 Token::Kind kind, 671 Token::Kind kind,
672 Value* left, 672 Value* left,
673 Value* right) 673 Value* right)
674 : ComparisonComp(kind, left, right), 674 : ComparisonComp(kind, left, right),
675 token_pos_(token_pos), 675 token_pos_(token_pos),
676 try_index_(try_index), 676 try_index_(try_index),
677 receiver_class_id_(kObjectCid) { 677 receiver_class_id_(kIllegalCid) {
678 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); 678 ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
679 } 679 }
680 680
681 DECLARE_COMPUTATION(EqualityCompare) 681 DECLARE_COMPUTATION(EqualityCompare)
682 682
683 intptr_t token_pos() const { return token_pos_; } 683 intptr_t token_pos() const { return token_pos_; }
684 intptr_t try_index() const { return try_index_; } 684 intptr_t try_index() const { return try_index_; }
685 685
686 // Receiver class id is computed from collected ICData.
686 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } 687 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; }
687 intptr_t receiver_class_id() const { return receiver_class_id_; } 688 intptr_t receiver_class_id() const { return receiver_class_id_; }
689
688 virtual void PrintOperandsTo(BufferFormatter* f) const; 690 virtual void PrintOperandsTo(BufferFormatter* f) const;
689 691
690 virtual bool CanDeoptimize() const { return true; } 692 virtual bool CanDeoptimize() const { return true; }
691 693
692 private: 694 private:
693 const intptr_t token_pos_; 695 const intptr_t token_pos_;
694 const intptr_t try_index_; 696 const intptr_t try_index_;
695 intptr_t receiver_class_id_; // Set by optimizer. 697 intptr_t receiver_class_id_; // Set by optimizer.
696 698
697 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); 699 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp);
698 }; 700 };
699 701
700 702
701 class RelationalOpComp : public ComparisonComp { 703 class RelationalOpComp : public ComparisonComp {
702 public: 704 public:
703 RelationalOpComp(intptr_t token_pos, 705 RelationalOpComp(intptr_t token_pos,
704 intptr_t try_index, 706 intptr_t try_index,
705 Token::Kind kind, 707 Token::Kind kind,
706 Value* left, 708 Value* left,
707 Value* right) 709 Value* right)
708 : ComparisonComp(kind, left, right), 710 : ComparisonComp(kind, left, right),
709 token_pos_(token_pos), 711 token_pos_(token_pos),
710 try_index_(try_index), 712 try_index_(try_index),
711 operands_class_id_(kObjectCid) { 713 operands_class_id_(kIllegalCid) {
712 ASSERT(Token::IsRelationalOperator(kind)); 714 ASSERT(Token::IsRelationalOperator(kind));
713 } 715 }
714 716
715 DECLARE_COMPUTATION(RelationalOp) 717 DECLARE_COMPUTATION(RelationalOp)
716 718
717 intptr_t token_pos() const { return token_pos_; } 719 intptr_t token_pos() const { return token_pos_; }
718 intptr_t try_index() const { return try_index_; } 720 intptr_t try_index() const { return try_index_; }
719 721
720 // TODO(srdjan): instead of class-id pass an enum that can differentiate 722 // TODO(srdjan): instead of class-id pass an enum that can differentiate
721 // between boxed and unboxed doubles and integers. 723 // between boxed and unboxed doubles and integers.
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 const GrowableArray<BlockEntryInstr*>& block_order_; 2895 const GrowableArray<BlockEntryInstr*>& block_order_;
2894 2896
2895 private: 2897 private:
2896 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2898 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2897 }; 2899 };
2898 2900
2899 2901
2900 } // namespace dart 2902 } // namespace dart
2901 2903
2902 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2904 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698