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

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

Issue 11048032: Support for mixed null/smi equality: do not deoptimize, emit same optimized code as if that was smi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 2717 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 } 2728 }
2729 2729
2730 static intptr_t ic_data_offset() { 2730 static intptr_t ic_data_offset() {
2731 return OFFSET_OF(RawICData, ic_data_); 2731 return OFFSET_OF(RawICData, ic_data_);
2732 } 2732 }
2733 2733
2734 static intptr_t function_offset() { 2734 static intptr_t function_offset() {
2735 return OFFSET_OF(RawICData, function_); 2735 return OFFSET_OF(RawICData, function_);
2736 } 2736 }
2737 2737
2738 // Adding checks.
2739
2738 // Adds one more class test to ICData. Length of 'classes' must be equal to 2740 // Adds one more class test to ICData. Length of 'classes' must be equal to
2739 // the number of arguments tested. Use only for num_args_tested > 1. 2741 // the number of arguments tested. Use only for num_args_tested > 1.
2740 void AddCheck(const GrowableArray<intptr_t>& class_ids, 2742 void AddCheck(const GrowableArray<intptr_t>& class_ids,
2741 const Function& target) const; 2743 const Function& target) const;
2742 // Adds sorted so that Smi is the first class-id. Use only for 2744 // Adds sorted so that Smi is the first class-id. Use only for
2743 // num_args_tested == 1. 2745 // num_args_tested == 1.
2744 void AddReceiverCheck(intptr_t receiver_class_id, 2746 void AddReceiverCheck(intptr_t receiver_class_id,
2745 const Function& target) const; 2747 const Function& target) const;
2748
2749 // Retrieving checks.
2750
2746 void GetCheckAt(intptr_t index, 2751 void GetCheckAt(intptr_t index,
2747 GrowableArray<intptr_t>* class_ids, 2752 GrowableArray<intptr_t>* class_ids,
2748 Function* target) const; 2753 Function* target) const;
2749 void GetOneClassCheckAt( 2754 void GetOneClassCheckAt(intptr_t index,
2750 int index, intptr_t* class_id, Function* target) const; 2755 intptr_t* class_id,
2756 Function* target) const;
2757 intptr_t GetReceiverClassIdAt(intptr_t index) const;
2758 intptr_t GetClassIdAt(intptr_t index, intptr_t arg_nr) const;
2751 2759
2752 intptr_t GetReceiverClassIdAt(intptr_t index) const;
2753 RawFunction* GetTargetAt(intptr_t index) const; 2760 RawFunction* GetTargetAt(intptr_t index) const;
2754 RawFunction* GetTargetForReceiverClassId(intptr_t class_id) const; 2761 RawFunction* GetTargetForReceiverClassId(intptr_t class_id) const;
2755 2762
2756 // Returns this->raw() if num_args_tested == 1, otherwise returns a new 2763 // Returns this->raw() if num_args_tested == 1 and arg_nr == 1, otherwise
2757 // ICData object containing only unique arg0 checks. 2764 // returns a new ICData object containing only unique arg_nr checks.
2758 RawICData* AsUnaryClassChecks() const; 2765 RawICData* AsUnaryClassChecksForArgNr(intptr_t arg_nr) const;
2766 RawICData* AsUnaryClassChecks() const {
2767 return AsUnaryClassChecksForArgNr(0);
2768 }
2759 2769
2760 bool AllTargetsHaveSameOwner(intptr_t owner_cid) const; 2770 bool AllTargetsHaveSameOwner(intptr_t owner_cid) const;
2761 bool AllReceiversAreNumbers() const; 2771 bool AllReceiversAreNumbers() const;
2762 bool HasOneTarget() const; 2772 bool HasOneTarget() const;
2763 2773
2764 static RawICData* New(const Function& caller_function, 2774 static RawICData* New(const Function& caller_function,
2765 const String& target_name, 2775 const String& target_name,
2766 intptr_t deopt_id, 2776 intptr_t deopt_id,
2767 intptr_t num_args_tested); 2777 intptr_t num_args_tested);
2768 2778
2769 private: 2779 private:
2770 RawArray* ic_data() const { 2780 RawArray* ic_data() const {
2771 return raw_ptr()->ic_data_; 2781 return raw_ptr()->ic_data_;
2772 } 2782 }
2773 2783
2774 void set_function(const Function& value) const; 2784 void set_function(const Function& value) const;
2775 void set_target_name(const String& value) const; 2785 void set_target_name(const String& value) const;
2776 void set_deopt_id(intptr_t value) const; 2786 void set_deopt_id(intptr_t value) const;
2777 void set_num_args_tested(intptr_t value) const; 2787 void set_num_args_tested(intptr_t value) const;
2778 void set_ic_data(const Array& value) const; 2788 void set_ic_data(const Array& value) const;
2779 2789
2790 // Used in asserts to verify that a check is not added twice.
2791 bool HasCheck(const GrowableArray<intptr_t>& cids) const;
2792
2780 intptr_t TestEntryLength() const; 2793 intptr_t TestEntryLength() const;
2781 void WriteSentinel() const; 2794 void WriteSentinel() const;
2782 2795
2783 HEAP_OBJECT_IMPLEMENTATION(ICData, Object); 2796 HEAP_OBJECT_IMPLEMENTATION(ICData, Object);
2784 friend class Class; 2797 friend class Class;
2785 }; 2798 };
2786 2799
2787 2800
2788 class SubtypeTestCache : public Object { 2801 class SubtypeTestCache : public Object {
2789 public: 2802 public:
(...skipping 2923 matching lines...) Expand 10 before | Expand all | Expand 10 after
5713 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5726 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5714 return false; 5727 return false;
5715 } 5728 }
5716 } 5729 }
5717 return true; 5730 return true;
5718 } 5731 }
5719 5732
5720 } // namespace dart 5733 } // namespace dart
5721 5734
5722 #endif // VM_OBJECT_H_ 5735 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698