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

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

Issue 14106013: Further improve type optimization reusing the type argument vector of the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/object.cc » ('j') | 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_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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 1017
1018 bool Equals(const AbstractTypeArguments& other) const; 1018 bool Equals(const AbstractTypeArguments& other) const;
1019 1019
1020 // UNREACHABLEs as AbstractTypeArguments is an abstract class. 1020 // UNREACHABLEs as AbstractTypeArguments is an abstract class.
1021 virtual intptr_t Length() const; 1021 virtual intptr_t Length() const;
1022 virtual RawAbstractType* TypeAt(intptr_t index) const; 1022 virtual RawAbstractType* TypeAt(intptr_t index) const;
1023 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const; 1023 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const;
1024 virtual bool IsResolved() const; 1024 virtual bool IsResolved() const;
1025 virtual bool IsInstantiated() const; 1025 virtual bool IsInstantiated() const;
1026 virtual bool IsUninstantiatedIdentity() const; 1026 virtual bool IsUninstantiatedIdentity() const;
1027 virtual bool CanShareInstantiatorTypeArguments(
1028 const Class& instantiator_class) const;
1027 virtual bool IsBounded() const; 1029 virtual bool IsBounded() const;
1028 1030
1029 virtual intptr_t Hash() const; 1031 virtual intptr_t Hash() const;
1030 1032
1031 private: 1033 private:
1032 // Check if this type argument vector consists solely of DynamicType, 1034 // Check if this type argument vector consists solely of DynamicType,
1033 // considering only a prefix of length 'len'. 1035 // considering only a prefix of length 'len'.
1034 // If raw_instantiated is true, consider each type parameter to be first 1036 // If raw_instantiated is true, consider each type parameter to be first
1035 // instantiated from a vector of dynamic types. 1037 // instantiated from a vector of dynamic types.
1036 bool IsDynamicTypes(bool raw_instantiated, intptr_t len) const; 1038 bool IsDynamicTypes(bool raw_instantiated, intptr_t len) const;
(...skipping 23 matching lines...) Expand all
1060 public: 1062 public:
1061 virtual intptr_t Length() const; 1063 virtual intptr_t Length() const;
1062 virtual RawAbstractType* TypeAt(intptr_t index) const; 1064 virtual RawAbstractType* TypeAt(intptr_t index) const;
1063 static intptr_t type_at_offset(intptr_t index) { 1065 static intptr_t type_at_offset(intptr_t index) {
1064 return OFFSET_OF(RawTypeArguments, types_) + index * kWordSize; 1066 return OFFSET_OF(RawTypeArguments, types_) + index * kWordSize;
1065 } 1067 }
1066 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const; 1068 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const;
1067 virtual bool IsResolved() const; 1069 virtual bool IsResolved() const;
1068 virtual bool IsInstantiated() const; 1070 virtual bool IsInstantiated() const;
1069 virtual bool IsUninstantiatedIdentity() const; 1071 virtual bool IsUninstantiatedIdentity() const;
1072 virtual bool CanShareInstantiatorTypeArguments(
1073 const Class& instantiator_class) const;
1070 virtual bool IsBounded() const; 1074 virtual bool IsBounded() const;
1071 // Canonicalize only if instantiated, otherwise returns 'this'. 1075 // Canonicalize only if instantiated, otherwise returns 'this'.
1072 virtual RawAbstractTypeArguments* Canonicalize() const; 1076 virtual RawAbstractTypeArguments* Canonicalize() const;
1073 1077
1074 virtual RawAbstractTypeArguments* InstantiateFrom( 1078 virtual RawAbstractTypeArguments* InstantiateFrom(
1075 const AbstractTypeArguments& instantiator_type_arguments, 1079 const AbstractTypeArguments& instantiator_type_arguments,
1076 Error* malformed_error) const; 1080 Error* malformed_error) const;
1077 1081
1078 static const intptr_t kBytesPerElement = kWordSize; 1082 static const intptr_t kBytesPerElement = kWordSize;
1079 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; 1083 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 // The second type argument vector is the instantiator, because each type 1120 // The second type argument vector is the instantiator, because each type
1117 // parameter with index i in the first vector can be substituted (or 1121 // parameter with index i in the first vector can be substituted (or
1118 // "instantiated") with the type at index i in the second type argument vector. 1122 // "instantiated") with the type at index i in the second type argument vector.
1119 class InstantiatedTypeArguments : public AbstractTypeArguments { 1123 class InstantiatedTypeArguments : public AbstractTypeArguments {
1120 public: 1124 public:
1121 virtual intptr_t Length() const; 1125 virtual intptr_t Length() const;
1122 virtual RawAbstractType* TypeAt(intptr_t index) const; 1126 virtual RawAbstractType* TypeAt(intptr_t index) const;
1123 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const; 1127 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const;
1124 virtual bool IsResolved() const { return true; } 1128 virtual bool IsResolved() const { return true; }
1125 virtual bool IsInstantiated() const { return true; } 1129 virtual bool IsInstantiated() const { return true; }
1126 virtual bool IsUninstantiatedIdentity() const { return false; } 1130 virtual bool IsUninstantiatedIdentity() const {
1131 UNREACHABLE();
1132 return false;
1133 }
1134 virtual bool CanShareInstantiatorTypeArguments(
1135 const Class& instantiator_class) const {
1136 UNREACHABLE();
1137 return false;
1138 }
1127 virtual bool IsBounded() const { return false; } // Bounds were checked. 1139 virtual bool IsBounded() const { return false; } // Bounds were checked.
1128 1140
1129 RawAbstractTypeArguments* uninstantiated_type_arguments() const { 1141 RawAbstractTypeArguments* uninstantiated_type_arguments() const {
1130 return raw_ptr()->uninstantiated_type_arguments_; 1142 return raw_ptr()->uninstantiated_type_arguments_;
1131 } 1143 }
1132 static intptr_t uninstantiated_type_arguments_offset() { 1144 static intptr_t uninstantiated_type_arguments_offset() {
1133 return OFFSET_OF(RawInstantiatedTypeArguments, 1145 return OFFSET_OF(RawInstantiatedTypeArguments,
1134 uninstantiated_type_arguments_); 1146 uninstantiated_type_arguments_);
1135 } 1147 }
1136 1148
(...skipping 4572 matching lines...) Expand 10 before | Expand all | Expand 10 after
5709 5721
5710 5722
5711 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 5723 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
5712 intptr_t index) { 5724 intptr_t index) {
5713 return array.At((index * kEntryLength) + kTargetFunctionIndex); 5725 return array.At((index * kEntryLength) + kTargetFunctionIndex);
5714 } 5726 }
5715 5727
5716 } // namespace dart 5728 } // namespace dart
5717 5729
5718 #endif // VM_OBJECT_H_ 5730 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698