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

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

Issue 1965493004: Canonicalize generic types in an isolate specific hash table (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-merge-conflicts Created 4 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
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | runtime/vm/service.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_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 RawArray* functions_hash_table_; 691 RawArray* functions_hash_table_;
692 RawArray* fields_; 692 RawArray* fields_;
693 RawArray* offset_in_words_to_field_; 693 RawArray* offset_in_words_to_field_;
694 RawArray* interfaces_; // Array of AbstractType. 694 RawArray* interfaces_; // Array of AbstractType.
695 RawScript* script_; 695 RawScript* script_;
696 RawLibrary* library_; 696 RawLibrary* library_;
697 RawTypeArguments* type_parameters_; // Array of TypeParameter. 697 RawTypeArguments* type_parameters_; // Array of TypeParameter.
698 RawAbstractType* super_type_; 698 RawAbstractType* super_type_;
699 RawType* mixin_; // Generic mixin type, e.g. M<T>, not M<int>. 699 RawType* mixin_; // Generic mixin type, e.g. M<T>, not M<int>.
700 RawFunction* signature_function_; // Associated function for typedef class. 700 RawFunction* signature_function_; // Associated function for typedef class.
701 RawArray* constants_; // Canonicalized values of this class. 701 RawArray* constants_; // Canonicalized const instances of this class.
702 RawObject* canonical_types_; // An array of canonicalized types of this class 702 RawType* canonical_type_; // Canonical type for this class.
703 // or the canonical type.
704 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions. 703 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions.
705 RawCode* allocation_stub_; // Stub code for allocation of instances. 704 RawCode* allocation_stub_; // Stub code for allocation of instances.
706 RawGrowableObjectArray* direct_subclasses_; // Array of Class. 705 RawGrowableObjectArray* direct_subclasses_; // Array of Class.
707 RawArray* dependent_code_; // CHA optimized codes. 706 RawArray* dependent_code_; // CHA optimized codes.
708 RawObject** to() { 707 RawObject** to() {
709 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); 708 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_);
710 } 709 }
711 RawObject** to_snapshot(Snapshot::Kind kind) { 710 RawObject** to_snapshot(Snapshot::Kind kind) {
712 switch (kind) { 711 switch (kind) {
713 case Snapshot::kCore: 712 case Snapshot::kCore:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 RawObject** from() { 765 RawObject** from() {
767 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); 766 return reinterpret_cast<RawObject**>(&ptr()->instantiations_);
768 } 767 }
769 // The instantiations_ array remains empty for instantiated type arguments. 768 // The instantiations_ array remains empty for instantiated type arguments.
770 RawArray* instantiations_; // Array of paired canonical vectors: 769 RawArray* instantiations_; // Array of paired canonical vectors:
771 // Even index: instantiator. 770 // Even index: instantiator.
772 // Odd index: instantiated (without bound error). 771 // Odd index: instantiated (without bound error).
773 // Instantiations leading to bound errors do not get cached. 772 // Instantiations leading to bound errors do not get cached.
774 RawSmi* length_; 773 RawSmi* length_;
775 774
775 RawSmi* hash_;
776
776 // Variable length data follows here. 777 // Variable length data follows here.
777 RawAbstractType* const* types() const { 778 RawAbstractType* const* types() const {
778 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); 779 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*);
779 } 780 }
780 RawAbstractType** types() { 781 RawAbstractType** types() {
781 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); 782 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*);
782 } 783 }
783 RawObject** to(intptr_t length) { 784 RawObject** to(intptr_t length) {
784 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]); 785 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]);
785 } 786 }
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 class RawType : public RawAbstractType { 1685 class RawType : public RawAbstractType {
1685 private: 1686 private:
1686 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); 1687 RAW_HEAP_OBJECT_IMPLEMENTATION(Type);
1687 1688
1688 RawObject** from() { 1689 RawObject** from() {
1689 return reinterpret_cast<RawObject**>(&ptr()->type_class_id_); 1690 return reinterpret_cast<RawObject**>(&ptr()->type_class_id_);
1690 } 1691 }
1691 // Either the id of the resolved class as a Smi or an UnresolvedClass. 1692 // Either the id of the resolved class as a Smi or an UnresolvedClass.
1692 RawObject* type_class_id_; 1693 RawObject* type_class_id_;
1693 RawTypeArguments* arguments_; 1694 RawTypeArguments* arguments_;
1695 RawSmi* hash_;
1694 // This type object represents a function type if its signature field is a 1696 // This type object represents a function type if its signature field is a
1695 // non-null function object. 1697 // non-null function object.
1696 // If this type is malformed or malbounded, the signature field gets 1698 // If this type is malformed or malbounded, the signature field gets
1697 // overwritten by the error object in order to save space. If the type is a 1699 // overwritten by the error object in order to save space. If the type is a
1698 // function type, its signature is lost, but the message in the error object 1700 // function type, its signature is lost, but the message in the error object
1699 // can describe the issue without needing the signature. 1701 // can describe the issue without needing the signature.
1700 union { 1702 union {
1701 RawFunction* signature_; // If not null, this type is a function type. 1703 RawFunction* signature_; // If not null, this type is a function type.
1702 RawLanguageError* error_; // If not null, type is malformed or malbounded. 1704 RawLanguageError* error_; // If not null, type is malformed or malbounded.
1703 } sig_or_err_; 1705 } sig_or_err_;
(...skipping 20 matching lines...) Expand all
1724 1726
1725 1727
1726 class RawTypeParameter : public RawAbstractType { 1728 class RawTypeParameter : public RawAbstractType {
1727 private: 1729 private:
1728 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); 1730 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter);
1729 1731
1730 RawObject** from() { 1732 RawObject** from() {
1731 return reinterpret_cast<RawObject**>(&ptr()->name_); 1733 return reinterpret_cast<RawObject**>(&ptr()->name_);
1732 } 1734 }
1733 RawString* name_; 1735 RawString* name_;
1736 RawSmi* hash_;
1734 RawAbstractType* bound_; // ObjectType if no explicit bound specified. 1737 RawAbstractType* bound_; // ObjectType if no explicit bound specified.
1735 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); } 1738 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); }
1736 classid_t parameterized_class_id_; 1739 classid_t parameterized_class_id_;
1737 TokenPosition token_pos_; 1740 TokenPosition token_pos_;
1738 int16_t index_; 1741 int16_t index_;
1739 int8_t type_state_; 1742 int8_t type_state_;
1740 }; 1743 };
1741 1744
1742 1745
1743 class RawBoundedType : public RawAbstractType { 1746 class RawBoundedType : public RawAbstractType {
1744 private: 1747 private:
1745 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); 1748 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType);
1746 1749
1747 RawObject** from() { 1750 RawObject** from() {
1748 return reinterpret_cast<RawObject**>(&ptr()->type_); 1751 return reinterpret_cast<RawObject**>(&ptr()->type_);
1749 } 1752 }
1750 RawAbstractType* type_; 1753 RawAbstractType* type_;
1751 RawAbstractType* bound_; 1754 RawAbstractType* bound_;
1755 RawSmi* hash_;
1752 RawTypeParameter* type_parameter_; // For more detailed error reporting. 1756 RawTypeParameter* type_parameter_; // For more detailed error reporting.
1753 RawObject** to() { 1757 RawObject** to() {
1754 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_); 1758 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_);
1755 } 1759 }
1756 }; 1760 };
1757 1761
1758 1762
1759 class RawMixinAppType : public RawAbstractType { 1763 class RawMixinAppType : public RawAbstractType {
1760 private: 1764 private:
1761 RAW_HEAP_OBJECT_IMPLEMENTATION(MixinAppType); 1765 RAW_HEAP_OBJECT_IMPLEMENTATION(MixinAppType);
1762 1766
1763 RawObject** from() { 1767 RawObject** from() {
1764 return reinterpret_cast<RawObject**>(&ptr()->super_type_); 1768 return reinterpret_cast<RawObject**>(&ptr()->super_type_);
1765 } 1769 }
1766 RawAbstractType* super_type_; 1770 RawAbstractType* super_type_;
1771 RawSmi* hash_;
1767 RawArray* mixin_types_; // Array of AbstractType. 1772 RawArray* mixin_types_; // Array of AbstractType.
1768 RawObject** to() { 1773 RawObject** to() {
1769 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_); 1774 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_);
1770 } 1775 }
1771 }; 1776 };
1772 1777
1773 1778
1774 class RawClosure : public RawInstance { 1779 class RawClosure : public RawInstance {
1775 private: 1780 private:
1776 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); 1781 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure);
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2440 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2436 kTypedDataInt8ArrayViewCid + 15); 2441 kTypedDataInt8ArrayViewCid + 15);
2437 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2442 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2438 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2443 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2439 return (kNullCid - kTypedDataInt8ArrayCid); 2444 return (kNullCid - kTypedDataInt8ArrayCid);
2440 } 2445 }
2441 2446
2442 } // namespace dart 2447 } // namespace dart
2443 2448
2444 #endif // VM_RAW_OBJECT_H_ 2449 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698