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

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

Issue 11474056: Store canonical type argments in a hash table instead of linear list. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 8 years 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 | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')
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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 bool Equals(const AbstractTypeArguments& other) const; 912 bool Equals(const AbstractTypeArguments& other) const;
913 913
914 // UNREACHABLEs as AbstractTypeArguments is an abstract class. 914 // UNREACHABLEs as AbstractTypeArguments is an abstract class.
915 virtual intptr_t Length() const; 915 virtual intptr_t Length() const;
916 virtual RawAbstractType* TypeAt(intptr_t index) const; 916 virtual RawAbstractType* TypeAt(intptr_t index) const;
917 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const; 917 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const;
918 virtual bool IsResolved() const; 918 virtual bool IsResolved() const;
919 virtual bool IsInstantiated() const; 919 virtual bool IsInstantiated() const;
920 virtual bool IsUninstantiatedIdentity() const; 920 virtual bool IsUninstantiatedIdentity() const;
921 921
922 virtual uword Hash() const;
Ivan Posva 2012/12/11 14:54:52 Hash is not an address, please use intptr_t.
Florian Schneider 2012/12/11 15:42:32 I think uword is appropiate also for things like s
923
922 private: 924 private:
923 // Check if this type argument vector consists solely of DynamicType, 925 // Check if this type argument vector consists solely of DynamicType,
924 // considering only a prefix of length 'len'. 926 // considering only a prefix of length 'len'.
925 // If raw_instantiated is true, consider each type parameter to be first 927 // If raw_instantiated is true, consider each type parameter to be first
926 // instantiated from a vector of dynamic types. 928 // instantiated from a vector of dynamic types.
927 bool IsDynamicTypes(bool raw_instantiated, intptr_t len) const; 929 bool IsDynamicTypes(bool raw_instantiated, intptr_t len) const;
928 930
929 // Check the subtype or 'more specific' relationship, considering only a 931 // Check the subtype or 'more specific' relationship, considering only a
930 // prefix of length 'len'. 932 // prefix of length 'len'.
931 bool TypeTest(TypeTestKind test_kind, 933 bool TypeTest(TypeTestKind test_kind,
(...skipping 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 virtual RawString* Name() const { 3244 virtual RawString* Name() const {
3243 return BuildName(kInternalName); 3245 return BuildName(kInternalName);
3244 } 3246 }
3245 3247
3246 // The name of this type, including the names of its type arguments, if any. 3248 // The name of this type, including the names of its type arguments, if any.
3247 // Names of internal classes are mapped to their public interfaces. 3249 // Names of internal classes are mapped to their public interfaces.
3248 virtual RawString* UserVisibleName() const { 3250 virtual RawString* UserVisibleName() const {
3249 return BuildName(kUserVisibleName); 3251 return BuildName(kUserVisibleName);
3250 } 3252 }
3251 3253
3254 virtual uword Hash() const;
Ivan Posva 2012/12/11 14:54:52 ditto
3255
3252 // The name of this type's class, i.e. without the type argument names of this 3256 // The name of this type's class, i.e. without the type argument names of this
3253 // type. 3257 // type.
3254 RawString* ClassName() const; 3258 RawString* ClassName() const;
3255 3259
3256 // Check if this type represents the 'dynamic' type. 3260 // Check if this type represents the 'dynamic' type.
3257 bool IsDynamicType() const { 3261 bool IsDynamicType() const {
3258 return HasResolvedTypeClass() && (type_class() == Object::dynamic_class()); 3262 return HasResolvedTypeClass() && (type_class() == Object::dynamic_class());
3259 } 3263 }
3260 3264
3261 // Check if this type represents the 'Null' type. 3265 // Check if this type represents the 'Null' type.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
3354 RawString* TypeClassName() const; 3358 RawString* TypeClassName() const;
3355 virtual RawAbstractTypeArguments* arguments() const; 3359 virtual RawAbstractTypeArguments* arguments() const;
3356 void set_arguments(const AbstractTypeArguments& value) const; 3360 void set_arguments(const AbstractTypeArguments& value) const;
3357 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 3361 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
3358 virtual bool IsInstantiated() const; 3362 virtual bool IsInstantiated() const;
3359 virtual bool Equals(const Instance& other) const; 3363 virtual bool Equals(const Instance& other) const;
3360 virtual RawAbstractType* InstantiateFrom( 3364 virtual RawAbstractType* InstantiateFrom(
3361 const AbstractTypeArguments& instantiator_type_arguments) const; 3365 const AbstractTypeArguments& instantiator_type_arguments) const;
3362 virtual RawAbstractType* Canonicalize() const; 3366 virtual RawAbstractType* Canonicalize() const;
3363 3367
3368 virtual uword Hash() const;
Ivan Posva 2012/12/11 14:54:52 ditto
3369
3364 static intptr_t InstanceSize() { 3370 static intptr_t InstanceSize() {
3365 return RoundedAllocationSize(sizeof(RawType)); 3371 return RoundedAllocationSize(sizeof(RawType));
3366 } 3372 }
3367 3373
3368 // The type of the literal 'null'. 3374 // The type of the literal 'null'.
3369 static RawType* NullType(); 3375 static RawType* NullType();
3370 3376
3371 // The 'dynamic' type. 3377 // The 'dynamic' type.
3372 static RawType* DynamicType(); 3378 static RawType* DynamicType();
3373 3379
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
3452 void set_index(intptr_t value) const; 3458 void set_index(intptr_t value) const;
3453 RawAbstractType* bound() const { return raw_ptr()->bound_; } 3459 RawAbstractType* bound() const { return raw_ptr()->bound_; }
3454 void set_bound(const AbstractType& value) const; 3460 void set_bound(const AbstractType& value) const;
3455 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 3461 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
3456 virtual bool IsInstantiated() const { return false; } 3462 virtual bool IsInstantiated() const { return false; }
3457 virtual bool Equals(const Instance& other) const; 3463 virtual bool Equals(const Instance& other) const;
3458 virtual RawAbstractType* InstantiateFrom( 3464 virtual RawAbstractType* InstantiateFrom(
3459 const AbstractTypeArguments& instantiator_type_arguments) const; 3465 const AbstractTypeArguments& instantiator_type_arguments) const;
3460 virtual RawAbstractType* Canonicalize() const { return raw(); } 3466 virtual RawAbstractType* Canonicalize() const { return raw(); }
3461 3467
3468 virtual uword Hash() const;
Ivan Posva 2012/12/11 14:54:52 ditto
3469
3462 static intptr_t InstanceSize() { 3470 static intptr_t InstanceSize() {
3463 return RoundedAllocationSize(sizeof(RawTypeParameter)); 3471 return RoundedAllocationSize(sizeof(RawTypeParameter));
3464 } 3472 }
3465 3473
3466 static RawTypeParameter* New(const Class& parameterized_class, 3474 static RawTypeParameter* New(const Class& parameterized_class,
3467 intptr_t index, 3475 intptr_t index,
3468 const String& name, 3476 const String& name,
3469 const AbstractType& bound, 3477 const AbstractType& bound,
3470 intptr_t token_pos); 3478 intptr_t token_pos);
3471 3479
(...skipping 2669 matching lines...) Expand 10 before | Expand all | Expand 10 after
6141 6149
6142 6150
6143 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6151 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6144 intptr_t index) { 6152 intptr_t index) {
6145 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6153 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6146 } 6154 }
6147 6155
6148 } // namespace dart 6156 } // namespace dart
6149 6157
6150 #endif // VM_OBJECT_H_ 6158 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698