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

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

Issue 26682003: Cache number of type arguments in class object instead of recalculating it. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 bool is_mixin_typedef() const { 942 bool is_mixin_typedef() const {
943 return MixinTypedefBit::decode(raw_ptr()->state_bits_); 943 return MixinTypedefBit::decode(raw_ptr()->state_bits_);
944 } 944 }
945 void set_is_mixin_typedef() const; 945 void set_is_mixin_typedef() const;
946 946
947 bool is_mixin_type_applied() const { 947 bool is_mixin_type_applied() const {
948 return MixinTypeAppliedBit::decode(raw_ptr()->state_bits_); 948 return MixinTypeAppliedBit::decode(raw_ptr()->state_bits_);
949 } 949 }
950 void set_is_mixin_type_applied() const; 950 void set_is_mixin_type_applied() const;
951 951
952 int num_native_fields() const { 952 uint16_t num_native_fields() const {
953 return raw_ptr()->num_native_fields_; 953 return raw_ptr()->num_native_fields_;
954 } 954 }
955 void set_num_native_fields(int value) const { 955 void set_num_native_fields(uint16_t value) const {
956 raw_ptr()->num_native_fields_ = value; 956 raw_ptr()->num_native_fields_ = value;
957 } 957 }
958 static intptr_t num_native_fields_offset() {
959 return OFFSET_OF(RawClass, num_native_fields_);
960 }
961 958
962 RawCode* allocation_stub() const { 959 RawCode* allocation_stub() const {
963 return raw_ptr()->allocation_stub_; 960 return raw_ptr()->allocation_stub_;
964 } 961 }
965 void set_allocation_stub(const Code& value) const; 962 void set_allocation_stub(const Code& value) const;
966 963
967 RawArray* constants() const; 964 RawArray* constants() const;
968 965
969 RawFunction* GetInvocationDispatcher(const String& target_name, 966 RawFunction* GetInvocationDispatcher(const String& target_name,
970 const Array& args_desc, 967 const Array& args_desc,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 void set_canonical_types(const Array& value) const; 1066 void set_canonical_types(const Array& value) const;
1070 RawArray* canonical_types() const; 1067 RawArray* canonical_types() const;
1071 1068
1072 RawArray* invocation_dispatcher_cache() const; 1069 RawArray* invocation_dispatcher_cache() const;
1073 void set_invocation_dispatcher_cache(const Array& cache) const; 1070 void set_invocation_dispatcher_cache(const Array& cache) const;
1074 RawFunction* CreateInvocationDispatcher(const String& target_name, 1071 RawFunction* CreateInvocationDispatcher(const String& target_name,
1075 const Array& args_desc, 1072 const Array& args_desc,
1076 RawFunction::Kind kind) const; 1073 RawFunction::Kind kind) const;
1077 void CalculateFieldOffsets() const; 1074 void CalculateFieldOffsets() const;
1078 1075
1076 // Initial value for the cached number of type arguments.
1077 static const intptr_t kUnknownNumTypeArguments = -1;
1078
1079 int16_t num_type_arguments() const {
1080 return raw_ptr()->num_type_arguments_;
1081 }
1082 void set_num_type_arguments(intptr_t value) const;
1083
1084 int16_t num_own_type_arguments() const {
1085 return raw_ptr()->num_own_type_arguments_;
1086 }
1087 void set_num_own_type_arguments(intptr_t value) const;
1088
1079 // Assigns empty array to all raw class array fields. 1089 // Assigns empty array to all raw class array fields.
1080 void InitEmptyFields(); 1090 void InitEmptyFields();
1081 1091
1082 static RawFunction* CheckFunctionType(const Function& func, intptr_t type); 1092 static RawFunction* CheckFunctionType(const Function& func, intptr_t type);
1083 RawFunction* LookupFunction(const String& name, intptr_t type) const; 1093 RawFunction* LookupFunction(const String& name, intptr_t type) const;
1084 RawFunction* LookupFunctionAllowPrivate(const String& name, 1094 RawFunction* LookupFunctionAllowPrivate(const String& name,
1085 intptr_t type) const; 1095 intptr_t type) const;
1086 RawField* LookupField(const String& name, intptr_t type) const; 1096 RawField* LookupField(const String& name, intptr_t type) const;
1087 1097
1088 RawFunction* LookupAccessorFunction(const char* prefix, 1098 RawFunction* LookupAccessorFunction(const char* prefix,
(...skipping 5168 matching lines...) Expand 10 before | Expand all | Expand 10 after
6257 6267
6258 6268
6259 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6269 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6260 intptr_t index) { 6270 intptr_t index) {
6261 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6271 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6262 } 6272 }
6263 6273
6264 } // namespace dart 6274 } // namespace dart
6265 6275
6266 #endif // VM_OBJECT_H_ 6276 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698