| OLD | NEW |
| 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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 RawTypeArguments* type_parameters_; // Array of TypeParameter. | 702 RawTypeArguments* type_parameters_; // Array of TypeParameter. |
| 703 RawAbstractType* super_type_; | 703 RawAbstractType* super_type_; |
| 704 RawType* mixin_; // Generic mixin type, e.g. M<T>, not M<int>. | 704 RawType* mixin_; // Generic mixin type, e.g. M<T>, not M<int>. |
| 705 RawFunction* signature_function_; // Associated function for typedef class. | 705 RawFunction* signature_function_; // Associated function for typedef class. |
| 706 RawArray* constants_; // Canonicalized values of this class. | 706 RawArray* constants_; // Canonicalized values of this class. |
| 707 RawObject* canonical_types_; // An array of canonicalized types of this class | 707 RawObject* canonical_types_; // An array of canonicalized types of this class |
| 708 // or the canonical type. | 708 // or the canonical type. |
| 709 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions. | 709 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions. |
| 710 RawCode* allocation_stub_; // Stub code for allocation of instances. | 710 RawCode* allocation_stub_; // Stub code for allocation of instances. |
| 711 RawGrowableObjectArray* direct_subclasses_; // Array of Class. | 711 RawGrowableObjectArray* direct_subclasses_; // Array of Class. |
| 712 RawArray* cha_codes_; // CHA optimized codes. | 712 RawArray* dependent_code_; // CHA optimized codes. |
| 713 RawObject** to() { | 713 RawObject** to() { |
| 714 return reinterpret_cast<RawObject**>(&ptr()->cha_codes_); | 714 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); |
| 715 } |
| 716 RawObject** to_snapshot(Snapshot::Kind kind) { |
| 717 switch (kind) { |
| 718 case Snapshot::kCore: |
| 719 case Snapshot::kScript: |
| 720 case Snapshot::kAppWithJIT: |
| 721 case Snapshot::kAppNoJIT: |
| 722 return reinterpret_cast<RawObject**>(&ptr()->direct_subclasses_); |
| 723 case Snapshot::kMessage: |
| 724 break; |
| 725 } |
| 726 UNREACHABLE(); |
| 727 return NULL; |
| 715 } | 728 } |
| 716 | 729 |
| 717 cpp_vtable handle_vtable_; | 730 cpp_vtable handle_vtable_; |
| 718 TokenPosition token_pos_; | 731 TokenPosition token_pos_; |
| 719 int32_t instance_size_in_words_; // Size if fixed len or 0 if variable len. | 732 int32_t instance_size_in_words_; // Size if fixed len or 0 if variable len. |
| 720 int32_t type_arguments_field_offset_in_words_; // Offset of type args fld. | 733 int32_t type_arguments_field_offset_in_words_; // Offset of type args fld. |
| 721 int32_t next_field_offset_in_words_; // Offset of the next instance field. | 734 int32_t next_field_offset_in_words_; // Offset of the next instance field. |
| 722 classid_t id_; // Class Id, also index in the class table. | 735 classid_t id_; // Class Id, also index in the class table. |
| 723 int16_t num_type_arguments_; // Number of type arguments in flattened vector. | 736 int16_t num_type_arguments_; // Number of type arguments in flattened vector. |
| 724 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments. | 737 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 } value_; | 928 } value_; |
| 916 union { | 929 union { |
| 917 // When precompiling we need to save the static initializer function here | 930 // When precompiling we need to save the static initializer function here |
| 918 // so that code for it can be generated. | 931 // so that code for it can be generated. |
| 919 RawFunction* precompiled_; // Static initializer function - precompiling. | 932 RawFunction* precompiled_; // Static initializer function - precompiling. |
| 920 // When generating script snapshots after running the application it is | 933 // When generating script snapshots after running the application it is |
| 921 // necessary to save the initial value of static fields so that we can | 934 // necessary to save the initial value of static fields so that we can |
| 922 // restore the value back to the original initial value. | 935 // restore the value back to the original initial value. |
| 923 RawInstance* saved_value_; // Saved initial value - static fields. | 936 RawInstance* saved_value_; // Saved initial value - static fields. |
| 924 } initializer_; | 937 } initializer_; |
| 938 RawSmi* guarded_list_length_; |
| 925 RawArray* dependent_code_; | 939 RawArray* dependent_code_; |
| 926 RawSmi* guarded_list_length_; | |
| 927 RawObject** to() { | 940 RawObject** to() { |
| 928 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_); | 941 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); |
| 929 } | 942 } |
| 930 RawObject** to_snapshot(Snapshot::Kind kind) { | 943 RawObject** to_snapshot(Snapshot::Kind kind) { |
| 931 switch (kind) { | 944 switch (kind) { |
| 932 case Snapshot::kCore: | 945 case Snapshot::kCore: |
| 933 case Snapshot::kScript: | 946 case Snapshot::kScript: |
| 934 return to(); | |
| 935 case Snapshot::kAppWithJIT: | 947 case Snapshot::kAppWithJIT: |
| 948 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_); |
| 936 case Snapshot::kAppNoJIT: | 949 case Snapshot::kAppNoJIT: |
| 937 return reinterpret_cast<RawObject**>(&ptr()->initializer_); | 950 return reinterpret_cast<RawObject**>(&ptr()->initializer_); |
| 938 case Snapshot::kMessage: | 951 case Snapshot::kMessage: |
| 939 break; | 952 break; |
| 940 } | 953 } |
| 941 UNREACHABLE(); | 954 UNREACHABLE(); |
| 942 return NULL; | 955 return NULL; |
| 943 } | 956 } |
| 944 | 957 |
| 945 TokenPosition token_pos_; | 958 TokenPosition token_pos_; |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 RawArray* imports_; // Libraries imported with this prefix. | 1636 RawArray* imports_; // Libraries imported with this prefix. |
| 1624 RawArray* dependent_code_; // Code that refers to deferred, unloaded | 1637 RawArray* dependent_code_; // Code that refers to deferred, unloaded |
| 1625 // library prefix. | 1638 // library prefix. |
| 1626 RawObject** to() { | 1639 RawObject** to() { |
| 1627 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); | 1640 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); |
| 1628 } | 1641 } |
| 1629 RawObject** to_snapshot(Snapshot::Kind kind) { | 1642 RawObject** to_snapshot(Snapshot::Kind kind) { |
| 1630 switch (kind) { | 1643 switch (kind) { |
| 1631 case Snapshot::kCore: | 1644 case Snapshot::kCore: |
| 1632 case Snapshot::kScript: | 1645 case Snapshot::kScript: |
| 1633 return to(); | |
| 1634 case Snapshot::kAppWithJIT: | 1646 case Snapshot::kAppWithJIT: |
| 1647 return reinterpret_cast<RawObject**>(&ptr()->imports_); |
| 1635 case Snapshot::kAppNoJIT: | 1648 case Snapshot::kAppNoJIT: |
| 1636 return reinterpret_cast<RawObject**>(&ptr()->importer_); | 1649 return reinterpret_cast<RawObject**>(&ptr()->importer_); |
| 1637 case Snapshot::kMessage: | 1650 case Snapshot::kMessage: |
| 1638 break; | 1651 break; |
| 1639 } | 1652 } |
| 1640 UNREACHABLE(); | 1653 UNREACHABLE(); |
| 1641 return NULL; | 1654 return NULL; |
| 1642 } | 1655 } |
| 1643 uint16_t num_imports_; // Number of library entries in libraries_. | 1656 uint16_t num_imports_; // Number of library entries in libraries_. |
| 1644 bool is_deferred_load_; | 1657 bool is_deferred_load_; |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2416 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2429 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 2417 kTypedDataInt8ArrayViewCid + 15); | 2430 kTypedDataInt8ArrayViewCid + 15); |
| 2418 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2431 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2419 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2432 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2420 return (kNullCid - kTypedDataInt8ArrayCid); | 2433 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2421 } | 2434 } |
| 2422 | 2435 |
| 2423 } // namespace dart | 2436 } // namespace dart |
| 2424 | 2437 |
| 2425 #endif // VM_RAW_OBJECT_H_ | 2438 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |