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

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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 class EqualityCompareComp : public ComparisonComp { 679 class EqualityCompareComp : public ComparisonComp {
680 public: 680 public:
681 EqualityCompareComp(intptr_t token_pos, 681 EqualityCompareComp(intptr_t token_pos,
682 intptr_t try_index, 682 intptr_t try_index,
683 Token::Kind kind, 683 Token::Kind kind,
684 Value* left, 684 Value* left,
685 Value* right) 685 Value* right)
686 : ComparisonComp(kind, left, right), 686 : ComparisonComp(kind, left, right),
687 token_pos_(token_pos), 687 token_pos_(token_pos),
688 try_index_(try_index), 688 try_index_(try_index),
689 receiver_class_id_(kObjectCid) { 689 receiver_class_id_(kIllegalCid) {
690 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); 690 ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
691 } 691 }
692 692
693 DECLARE_COMPUTATION(EqualityCompare) 693 DECLARE_COMPUTATION(EqualityCompare)
694 694
695 intptr_t token_pos() const { return token_pos_; } 695 intptr_t token_pos() const { return token_pos_; }
696 intptr_t try_index() const { return try_index_; } 696 intptr_t try_index() const { return try_index_; }
697 697
698 // Receiver class id is computed from collected ICData.
698 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } 699 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; }
699 intptr_t receiver_class_id() const { return receiver_class_id_; } 700 intptr_t receiver_class_id() const { return receiver_class_id_; }
701
700 virtual void PrintOperandsTo(BufferFormatter* f) const; 702 virtual void PrintOperandsTo(BufferFormatter* f) const;
701 703
702 virtual bool CanDeoptimize() const { return true; } 704 virtual bool CanDeoptimize() const { return true; }
703 705
704 private: 706 private:
705 const intptr_t token_pos_; 707 const intptr_t token_pos_;
706 const intptr_t try_index_; 708 const intptr_t try_index_;
707 intptr_t receiver_class_id_; // Set by optimizer. 709 intptr_t receiver_class_id_; // Set by optimizer.
708 710
709 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); 711 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp);
710 }; 712 };
711 713
712 714
713 class RelationalOpComp : public ComparisonComp { 715 class RelationalOpComp : public ComparisonComp {
714 public: 716 public:
715 RelationalOpComp(intptr_t token_pos, 717 RelationalOpComp(intptr_t token_pos,
716 intptr_t try_index, 718 intptr_t try_index,
717 Token::Kind kind, 719 Token::Kind kind,
718 Value* left, 720 Value* left,
719 Value* right) 721 Value* right)
720 : ComparisonComp(kind, left, right), 722 : ComparisonComp(kind, left, right),
721 token_pos_(token_pos), 723 token_pos_(token_pos),
722 try_index_(try_index), 724 try_index_(try_index),
723 operands_class_id_(kObjectCid) { 725 operands_class_id_(kIllegalCid) {
724 ASSERT(Token::IsRelationalOperator(kind)); 726 ASSERT(Token::IsRelationalOperator(kind));
725 } 727 }
726 728
727 DECLARE_COMPUTATION(RelationalOp) 729 DECLARE_COMPUTATION(RelationalOp)
728 730
729 intptr_t token_pos() const { return token_pos_; } 731 intptr_t token_pos() const { return token_pos_; }
730 intptr_t try_index() const { return try_index_; } 732 intptr_t try_index() const { return try_index_; }
731 733
732 // TODO(srdjan): instead of class-id pass an enum that can differentiate 734 // TODO(srdjan): instead of class-id pass an enum that can differentiate
733 // between boxed and unboxed doubles and integers. 735 // between boxed and unboxed doubles and integers.
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 const GrowableArray<BlockEntryInstr*>& block_order_; 2907 const GrowableArray<BlockEntryInstr*>& block_order_;
2906 2908
2907 private: 2909 private:
2908 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2910 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2909 }; 2911 };
2910 2912
2911 2913
2912 } // namespace dart 2914 } // namespace dart
2913 2915
2914 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2916 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698