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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 friend class GCMarker; | 564 friend class GCMarker; |
565 friend class ExternalTypedData; | 565 friend class ExternalTypedData; |
566 friend class ForwardList; | 566 friend class ForwardList; |
567 friend class GrowableObjectArray; // StorePointer | 567 friend class GrowableObjectArray; // StorePointer |
568 friend class Heap; | 568 friend class Heap; |
569 friend class HeapMapAsJSONVisitor; | 569 friend class HeapMapAsJSONVisitor; |
570 friend class ClassStatsVisitor; | 570 friend class ClassStatsVisitor; |
571 friend class MarkingVisitor; | 571 friend class MarkingVisitor; |
572 friend class Object; | 572 friend class Object; |
573 friend class OneByteString; // StoreSmi | 573 friend class OneByteString; // StoreSmi |
| 574 friend class RawCode; |
574 friend class RawExternalTypedData; | 575 friend class RawExternalTypedData; |
575 friend class RawInstructions; | 576 friend class RawInstructions; |
576 friend class RawInstance; | 577 friend class RawInstance; |
577 friend class RawTypedData; | 578 friend class RawTypedData; |
578 friend class Scavenger; | 579 friend class Scavenger; |
579 friend class ScavengerVisitor; | 580 friend class ScavengerVisitor; |
580 friend class SizeExcludingClassVisitor; // GetClassId | 581 friend class SizeExcludingClassVisitor; // GetClassId |
581 friend class SnapshotReader; | 582 friend class SnapshotReader; |
582 friend class SnapshotWriter; | 583 friend class SnapshotWriter; |
583 friend class String; | 584 friend class String; |
584 friend class TypedData; | 585 friend class TypedData; |
585 friend class TypedDataView; | 586 friend class TypedDataView; |
586 friend class WeakProperty; // StorePointer | 587 friend class WeakProperty; // StorePointer |
587 friend class Instance; // StorePointer | 588 friend class Instance; // StorePointer |
| 589 friend class StackFrame; // GetCodeObject assertion. |
588 | 590 |
589 DISALLOW_ALLOCATION(); | 591 DISALLOW_ALLOCATION(); |
590 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); | 592 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); |
591 }; | 593 }; |
592 | 594 |
593 | 595 |
594 class RawClass : public RawObject { | 596 class RawClass : public RawObject { |
595 public: | 597 public: |
596 enum ClassFinalizedState { | 598 enum ClassFinalizedState { |
597 kAllocated = 0, // Initial state. | 599 kAllocated = 0, // Initial state. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 RawArray* parameter_names_; | 756 RawArray* parameter_names_; |
755 RawObject* data_; // Additional data specific to the function kind. | 757 RawObject* data_; // Additional data specific to the function kind. |
756 RawObject** to_snapshot() { | 758 RawObject** to_snapshot() { |
757 return reinterpret_cast<RawObject**>(&ptr()->data_); | 759 return reinterpret_cast<RawObject**>(&ptr()->data_); |
758 } | 760 } |
759 // Fields below are not part of the snapshot. | 761 // Fields below are not part of the snapshot. |
760 RawArray* ic_data_array_; // ICData of unoptimized code. | 762 RawArray* ic_data_array_; // ICData of unoptimized code. |
761 RawObject** to_no_code() { | 763 RawObject** to_no_code() { |
762 return reinterpret_cast<RawObject**>(&ptr()->ic_data_array_); | 764 return reinterpret_cast<RawObject**>(&ptr()->ic_data_array_); |
763 } | 765 } |
764 RawInstructions* instructions_; // Instructions of currently active code. | 766 RawCode* code_; // Currently active code. |
765 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. | 767 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. |
766 RawObject** to() { | 768 RawObject** to() { |
767 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_); | 769 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_); |
768 } | 770 } |
769 | 771 |
770 int32_t token_pos_; | 772 int32_t token_pos_; |
771 int32_t end_token_pos_; | 773 int32_t end_token_pos_; |
772 int32_t usage_counter_; // Incremented while function is running. | 774 int32_t usage_counter_; // Incremented while function is running. |
773 int16_t num_fixed_parameters_; | 775 int16_t num_fixed_parameters_; |
774 int16_t num_optional_parameters_; // > 0: positional; < 0: named. | 776 int16_t num_optional_parameters_; // > 0: positional; < 0: named. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 kInlinedIdToFunctionIndex = 1, | 972 kInlinedIdToFunctionIndex = 1, |
971 kInlinedMetadataSize = 2, | 973 kInlinedMetadataSize = 2, |
972 }; | 974 }; |
973 | 975 |
974 RAW_HEAP_OBJECT_IMPLEMENTATION(Code); | 976 RAW_HEAP_OBJECT_IMPLEMENTATION(Code); |
975 | 977 |
976 RawObject** from() { | 978 RawObject** from() { |
977 return reinterpret_cast<RawObject**>(&ptr()->instructions_); | 979 return reinterpret_cast<RawObject**>(&ptr()->instructions_); |
978 } | 980 } |
979 RawInstructions* instructions_; | 981 RawInstructions* instructions_; |
| 982 RawObjectPool* object_pool_; |
980 // If owner_ is Function::null() the owner is a regular stub. | 983 // If owner_ is Function::null() the owner is a regular stub. |
981 // If owner_ is a Class the owner is the allocation stub for that class. | 984 // If owner_ is a Class the owner is the allocation stub for that class. |
982 // Else, owner_ is a regular Dart Function. | 985 // Else, owner_ is a regular Dart Function. |
983 RawObject* owner_; // Function, Null, or a Class. | 986 RawObject* owner_; // Function, Null, or a Class. |
984 RawExceptionHandlers* exception_handlers_; | 987 RawExceptionHandlers* exception_handlers_; |
985 RawPcDescriptors* pc_descriptors_; | 988 RawPcDescriptors* pc_descriptors_; |
986 RawArray* deopt_info_array_; | 989 RawArray* deopt_info_array_; |
987 RawArray* static_calls_target_table_; // (code-offset, function, code). | 990 RawArray* static_calls_target_table_; // (code-offset, function, code). |
988 RawArray* stackmaps_; | 991 RawArray* stackmaps_; |
989 RawLocalVarDescriptors* var_descriptors_; | 992 RawLocalVarDescriptors* var_descriptors_; |
(...skipping 17 matching lines...) Expand all Loading... |
1007 | 1010 |
1008 // PC offsets for code patching. | 1011 // PC offsets for code patching. |
1009 int32_t entry_patch_pc_offset_; | 1012 int32_t entry_patch_pc_offset_; |
1010 int32_t patch_code_pc_offset_; | 1013 int32_t patch_code_pc_offset_; |
1011 int32_t lazy_deopt_pc_offset_; | 1014 int32_t lazy_deopt_pc_offset_; |
1012 | 1015 |
1013 // Variable length data follows here. | 1016 // Variable length data follows here. |
1014 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); } | 1017 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); } |
1015 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); } | 1018 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); } |
1016 | 1019 |
| 1020 static bool ContainsPC(RawObject* raw_obj, uword pc); |
| 1021 |
1017 friend class Function; | 1022 friend class Function; |
1018 friend class MarkingVisitor; | 1023 friend class MarkingVisitor; |
1019 friend class StackFrame; | 1024 friend class StackFrame; |
1020 }; | 1025 }; |
1021 | 1026 |
1022 | 1027 |
1023 class RawObjectPool : public RawObject { | 1028 class RawObjectPool : public RawObject { |
1024 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); | 1029 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); |
1025 | 1030 |
1026 intptr_t length_; | 1031 intptr_t length_; |
(...skipping 10 matching lines...) Expand all Loading... |
1037 | 1042 |
1038 Entry* first_entry() { return &ptr()->data()[0]; } | 1043 Entry* first_entry() { return &ptr()->data()[0]; } |
1039 | 1044 |
1040 friend class Object; | 1045 friend class Object; |
1041 }; | 1046 }; |
1042 | 1047 |
1043 | 1048 |
1044 class RawInstructions : public RawObject { | 1049 class RawInstructions : public RawObject { |
1045 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); | 1050 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); |
1046 | 1051 |
1047 RawObject** from() { | |
1048 return reinterpret_cast<RawObject**>(&ptr()->code_); | |
1049 } | |
1050 RawCode* code_; | |
1051 RawObjectPool* object_pool_; | |
1052 RawObject** to() { | |
1053 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); | |
1054 } | |
1055 int32_t size_; | 1052 int32_t size_; |
1056 | 1053 |
1057 // Variable length data follows here. | 1054 // Variable length data follows here. |
1058 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1055 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } |
1059 | 1056 |
1060 // Private helper function used while visiting stack frames. The | 1057 // Private helper function used while visiting stack frames. The |
1061 // code which iterates over dart frames is also called during GC and | 1058 // code which iterates over dart frames is also called during GC and |
1062 // is not allowed to create handles. | 1059 // is not allowed to create handles. |
1063 static bool ContainsPC(RawObject* raw_obj, uword pc); | 1060 static bool ContainsPC(RawObject* raw_obj, uword pc); |
1064 | 1061 |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2179 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2176 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2180 kTypedDataInt8ArrayViewCid + 15); | 2177 kTypedDataInt8ArrayViewCid + 15); |
2181 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2178 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2182 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2179 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2183 return (kNullCid - kTypedDataInt8ArrayCid); | 2180 return (kNullCid - kTypedDataInt8ArrayCid); |
2184 } | 2181 } |
2185 | 2182 |
2186 } // namespace dart | 2183 } // namespace dart |
2187 | 2184 |
2188 #endif // VM_RAW_OBJECT_H_ | 2185 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |