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

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

Issue 2646073005: Precompiler: Rehash types after reassigning class ids. (Closed)
Patch Set: . Created 3 years, 11 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
« no previous file with comments | « no previous file | runtime/vm/precompiler.h » ('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 RUNTIME_VM_OBJECT_H_ 5 #ifndef RUNTIME_VM_OBJECT_H_
6 #define RUNTIME_VM_OBJECT_H_ 6 #define RUNTIME_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 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 RawArray* instantiations() const; 1738 RawArray* instantiations() const;
1739 void set_instantiations(const Array& value) const; 1739 void set_instantiations(const Array& value) const;
1740 RawAbstractType* const* TypeAddr(intptr_t index) const; 1740 RawAbstractType* const* TypeAddr(intptr_t index) const;
1741 void SetLength(intptr_t value) const; 1741 void SetLength(intptr_t value) const;
1742 // Number of fields in the raw object=3 (instantiations_, length_ and hash_). 1742 // Number of fields in the raw object=3 (instantiations_, length_ and hash_).
1743 static const int kNumFields = 3; 1743 static const int kNumFields = 3;
1744 1744
1745 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, Object); 1745 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, Object);
1746 friend class AbstractType; 1746 friend class AbstractType;
1747 friend class Class; 1747 friend class Class;
1748 friend class ClearTypeHashVisitor;
1748 }; 1749 };
1749 1750
1750 1751
1751 class PatchClass : public Object { 1752 class PatchClass : public Object {
1752 public: 1753 public:
1753 RawClass* patched_class() const { return raw_ptr()->patched_class_; } 1754 RawClass* patched_class() const { return raw_ptr()->patched_class_; }
1754 RawClass* origin_class() const { return raw_ptr()->origin_class_; } 1755 RawClass* origin_class() const { return raw_ptr()->origin_class_; }
1755 RawScript* script() const { return raw_ptr()->script_; } 1756 RawScript* script() const { return raw_ptr()->script_; }
1756 1757
1757 static intptr_t InstanceSize() { 1758 static intptr_t InstanceSize() {
(...skipping 4248 matching lines...) Expand 10 before | Expand all | Expand 10 after
6006 void SetHash(intptr_t value) const; 6007 void SetHash(intptr_t value) const;
6007 6008
6008 void set_token_pos(TokenPosition token_pos) const; 6009 void set_token_pos(TokenPosition token_pos) const;
6009 void set_type_state(int8_t state) const; 6010 void set_type_state(int8_t state) const;
6010 6011
6011 static RawType* New(Heap::Space space = Heap::kOld); 6012 static RawType* New(Heap::Space space = Heap::kOld);
6012 6013
6013 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); 6014 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType);
6014 friend class Class; 6015 friend class Class;
6015 friend class TypeArguments; 6016 friend class TypeArguments;
6017 friend class ClearTypeHashVisitor;
6016 }; 6018 };
6017 6019
6018 6020
6019 // A TypeRef is used to break cycles in the representation of recursive types. 6021 // A TypeRef is used to break cycles in the representation of recursive types.
6020 // Its only field is the recursive AbstractType it refers to. 6022 // Its only field is the recursive AbstractType it refers to.
6021 // Note that the cycle always involves type arguments. 6023 // Note that the cycle always involves type arguments.
6022 class TypeRef : public AbstractType { 6024 class TypeRef : public AbstractType {
6023 public: 6025 public:
6024 virtual bool IsFinalized() const { 6026 virtual bool IsFinalized() const {
6025 return AbstractType::Handle(type()).IsFinalized(); 6027 return AbstractType::Handle(type()).IsFinalized();
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
6178 void set_parameterized_function(const Function& value) const; 6180 void set_parameterized_function(const Function& value) const;
6179 void set_name(const String& value) const; 6181 void set_name(const String& value) const;
6180 void set_token_pos(TokenPosition token_pos) const; 6182 void set_token_pos(TokenPosition token_pos) const;
6181 void set_parent_level(uint8_t value) const; 6183 void set_parent_level(uint8_t value) const;
6182 void set_type_state(int8_t state) const; 6184 void set_type_state(int8_t state) const;
6183 6185
6184 static RawTypeParameter* New(); 6186 static RawTypeParameter* New();
6185 6187
6186 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); 6188 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType);
6187 friend class Class; 6189 friend class Class;
6190 friend class ClearTypeHashVisitor;
6188 }; 6191 };
6189 6192
6190 6193
6191 // A BoundedType represents a type instantiated at compile time from a type 6194 // A BoundedType represents a type instantiated at compile time from a type
6192 // parameter specifying a bound that either cannot be checked at compile time 6195 // parameter specifying a bound that either cannot be checked at compile time
6193 // because the type or the bound are still uninstantiated or can be checked and 6196 // because the type or the bound are still uninstantiated or can be checked and
6194 // would trigger a bound error in checked mode. The bound must be checked at 6197 // would trigger a bound error in checked mode. The bound must be checked at
6195 // runtime once the type and its bound are instantiated and when the execution 6198 // runtime once the type and its bound are instantiated and when the execution
6196 // mode is known to be checked mode. 6199 // mode is known to be checked mode.
6197 class BoundedType : public AbstractType { 6200 class BoundedType : public AbstractType {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
6269 void SetHash(intptr_t value) const; 6272 void SetHash(intptr_t value) const;
6270 6273
6271 void set_type(const AbstractType& value) const; 6274 void set_type(const AbstractType& value) const;
6272 void set_bound(const AbstractType& value) const; 6275 void set_bound(const AbstractType& value) const;
6273 void set_type_parameter(const TypeParameter& value) const; 6276 void set_type_parameter(const TypeParameter& value) const;
6274 6277
6275 static RawBoundedType* New(); 6278 static RawBoundedType* New();
6276 6279
6277 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType); 6280 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType);
6278 friend class Class; 6281 friend class Class;
6282 friend class ClearTypeHashVisitor;
6279 }; 6283 };
6280 6284
6281 6285
6282 // A MixinAppType represents a parsed mixin application clause, e.g. 6286 // A MixinAppType represents a parsed mixin application clause, e.g.
6283 // "S<T> with M<U>, N<V>". 6287 // "S<T> with M<U>, N<V>".
6284 // MixinAppType objects do not survive finalization, so they do not 6288 // MixinAppType objects do not survive finalization, so they do not
6285 // need to be written to and read from snapshots. 6289 // need to be written to and read from snapshots.
6286 // The class finalizer creates synthesized classes S&M and S&M&N if they do not 6290 // The class finalizer creates synthesized classes S&M and S&M&N if they do not
6287 // yet exist in the library declaring the mixin application clause. 6291 // yet exist in the library declaring the mixin application clause.
6288 class MixinAppType : public AbstractType { 6292 class MixinAppType : public AbstractType {
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
8945 8949
8946 inline void TypeArguments::SetHash(intptr_t value) const { 8950 inline void TypeArguments::SetHash(intptr_t value) const {
8947 // This is only safe because we create a new Smi, which does not cause 8951 // This is only safe because we create a new Smi, which does not cause
8948 // heap allocation. 8952 // heap allocation.
8949 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8953 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8950 } 8954 }
8951 8955
8952 } // namespace dart 8956 } // namespace dart
8953 8957
8954 #endif // RUNTIME_VM_OBJECT_H_ 8958 #endif // RUNTIME_VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698