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

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

Issue 165523002: Avoid repeated resolution of types by marking them as resolved. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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/class_finalizer.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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 } 1280 }
1281 1281
1282 // Check if the vectors are equal. 1282 // Check if the vectors are equal.
1283 bool Equals(const TypeArguments& other) const { 1283 bool Equals(const TypeArguments& other) const {
1284 return IsEquivalent(other); 1284 return IsEquivalent(other);
1285 } 1285 }
1286 1286
1287 bool IsEquivalent(const TypeArguments& other, 1287 bool IsEquivalent(const TypeArguments& other,
1288 GrowableObjectArray* trail = NULL) const; 1288 GrowableObjectArray* trail = NULL) const;
1289 1289
1290 bool IsResolved() const;
1291 bool IsInstantiated(GrowableObjectArray* trail = NULL) const; 1290 bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
1292 bool IsUninstantiatedIdentity() const; 1291 bool IsUninstantiatedIdentity() const;
1293 bool CanShareInstantiatorTypeArguments(const Class& instantiator_class) const; 1292 bool CanShareInstantiatorTypeArguments(const Class& instantiator_class) const;
1294 1293
1295 // Returns true if all types of this vector are finalized. 1294 // Returns true if all types of this vector are respectively, resolved,
1295 // finalized, or bounded.
1296 bool IsResolved() const;
1296 bool IsFinalized() const; 1297 bool IsFinalized() const;
1297 bool IsBounded() const; 1298 bool IsBounded() const;
1298 1299
1299 // Clone this type argument vector and clone all unfinalized type arguments. 1300 // Clone this type argument vector and clone all unfinalized type arguments.
1300 // Finalized type arguments are shared. 1301 // Finalized type arguments are shared.
1301 RawTypeArguments* CloneUnfinalized() const; 1302 RawTypeArguments* CloneUnfinalized() const;
1302 1303
1303 // Canonicalize only if instantiated, otherwise returns 'this'. 1304 // Canonicalize only if instantiated, otherwise returns 'this'.
1304 RawTypeArguments* Canonicalize(GrowableObjectArray* trail = NULL) const; 1305 RawTypeArguments* Canonicalize(GrowableObjectArray* trail = NULL) const;
1305 1306
(...skipping 2879 matching lines...) Expand 10 before | Expand all | Expand 10 after
4185 // Caution: 'RawType*' denotes a 'raw' pointer to a VM object of class Type, as 4186 // Caution: 'RawType*' denotes a 'raw' pointer to a VM object of class Type, as
4186 // opposed to 'Type' denoting a 'handle' to the same object. 'RawType' does not 4187 // opposed to 'Type' denoting a 'handle' to the same object. 'RawType' does not
4187 // relate to a 'raw type', as opposed to a 'cooked type' or 'rare type'. 4188 // relate to a 'raw type', as opposed to a 'cooked type' or 'rare type'.
4188 class Type : public AbstractType { 4189 class Type : public AbstractType {
4189 public: 4190 public:
4190 static intptr_t type_class_offset() { 4191 static intptr_t type_class_offset() {
4191 return OFFSET_OF(RawType, type_class_); 4192 return OFFSET_OF(RawType, type_class_);
4192 } 4193 }
4193 virtual bool IsFinalized() const { 4194 virtual bool IsFinalized() const {
4194 return 4195 return
4195 (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) || 4196 (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) ||
4196 (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated); 4197 (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated);
4197 } 4198 }
4198 void SetIsFinalized() const; 4199 void SetIsFinalized() const;
4199 void ResetIsFinalized() const; // Ignore current state and set again. 4200 void ResetIsFinalized() const; // Ignore current state and set again.
4200 virtual bool IsBeingFinalized() const { 4201 virtual bool IsBeingFinalized() const {
4201 return raw_ptr()->type_state_ == RawType::kBeingFinalized; 4202 return raw_ptr()->type_state_ == RawType::kBeingFinalized;
4202 } 4203 }
4203 void set_is_being_finalized() const; 4204 void set_is_being_finalized() const;
4204 virtual bool IsMalformed() const; 4205 virtual bool IsMalformed() const;
4205 virtual bool IsMalbounded() const; 4206 virtual bool IsMalbounded() const;
4206 virtual bool IsMalformedOrMalbounded() const; 4207 virtual bool IsMalformedOrMalbounded() const;
4207 virtual RawLanguageError* error() const { return raw_ptr()->error_; } 4208 virtual RawLanguageError* error() const { return raw_ptr()->error_; }
4208 virtual void set_error(const LanguageError& value) const; 4209 virtual void set_error(const LanguageError& value) const;
4209 virtual bool IsResolved() const; // Class and all arguments classes resolved. 4210 virtual bool IsResolved() const {
4211 return raw_ptr()->type_state_ >= RawType::kResolved;
4212 }
4213 void set_is_resolved() const;
4210 virtual bool HasResolvedTypeClass() const; // Own type class resolved. 4214 virtual bool HasResolvedTypeClass() const; // Own type class resolved.
4211 virtual RawClass* type_class() const; 4215 virtual RawClass* type_class() const;
4212 void set_type_class(const Object& value) const; 4216 void set_type_class(const Object& value) const;
4213 virtual RawUnresolvedClass* unresolved_class() const; 4217 virtual RawUnresolvedClass* unresolved_class() const;
4214 virtual RawTypeArguments* arguments() const; 4218 virtual RawTypeArguments* arguments() const;
4215 void set_arguments(const TypeArguments& value) const; 4219 void set_arguments(const TypeArguments& value) const;
4216 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 4220 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
4217 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const; 4221 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
4218 virtual bool IsEquivalent(const Instance& other, 4222 virtual bool IsEquivalent(const Instance& other,
4219 GrowableObjectArray* trail = NULL) const; 4223 GrowableObjectArray* trail = NULL) const;
(...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after
6618 6622
6619 6623
6620 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6624 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6621 intptr_t index) { 6625 intptr_t index) {
6622 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6626 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6623 } 6627 }
6624 6628
6625 } // namespace dart 6629 } // namespace dart
6626 6630
6627 #endif // VM_OBJECT_H_ 6631 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698