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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 | 823 |
824 | 824 |
825 class RawField : public RawObject { | 825 class RawField : public RawObject { |
826 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); | 826 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); |
827 | 827 |
828 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 828 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
829 RawString* name_; | 829 RawString* name_; |
830 RawObject* owner_; // Class or patch class or mixin class | 830 RawObject* owner_; // Class or patch class or mixin class |
831 // where this field is defined. | 831 // where this field is defined. |
832 RawAbstractType* type_; | 832 RawAbstractType* type_; |
833 RawInstance* value_; // Offset in words for instance and value for static. | 833 union { |
| 834 RawInstance* static_value_; // Value for static fields. |
| 835 RawSmi* offset_; // Offset in words for instance fields. |
| 836 } value_; |
834 RawArray* dependent_code_; | 837 RawArray* dependent_code_; |
835 RawFunction* initializer_; | 838 union { |
| 839 // When precompiling we need to save the static initializer function here |
| 840 // so that code for it can be generated. |
| 841 RawFunction* precompiled_; // Static initializer function - precompiling. |
| 842 // When generating script snapshots after running the application it is |
| 843 // necessary to save the initial value of static fields so that we can |
| 844 // restore the value back to the original initial value. |
| 845 RawInstance* saved_value_; // Saved initial value - static fields. |
| 846 } initializer_; |
836 RawSmi* guarded_list_length_; | 847 RawSmi* guarded_list_length_; |
837 RawObject** to() { | 848 RawObject** to() { |
838 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_); | 849 return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_); |
839 } | 850 } |
840 | 851 |
841 int32_t token_pos_; | 852 int32_t token_pos_; |
842 classid_t guarded_cid_; | 853 classid_t guarded_cid_; |
843 classid_t is_nullable_; // kNullCid if field can contain null value and | 854 classid_t is_nullable_; // kNullCid if field can contain null value and |
844 // any other value otherwise. | 855 // any other value otherwise. |
845 // Offset to the guarded length field inside an instance of class matching | 856 // Offset to the guarded length field inside an instance of class matching |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2213 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2224 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2214 kTypedDataInt8ArrayViewCid + 15); | 2225 kTypedDataInt8ArrayViewCid + 15); |
2215 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2226 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2216 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2227 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2217 return (kNullCid - kTypedDataInt8ArrayCid); | 2228 return (kNullCid - kTypedDataInt8ArrayCid); |
2218 } | 2229 } |
2219 | 2230 |
2220 } // namespace dart | 2231 } // namespace dart |
2221 | 2232 |
2222 #endif // VM_RAW_OBJECT_H_ | 2233 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |