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 13 matching lines...) Expand all Loading... |
24 V(ClosureData) \ | 24 V(ClosureData) \ |
25 V(RedirectionData) \ | 25 V(RedirectionData) \ |
26 V(Field) \ | 26 V(Field) \ |
27 V(LiteralToken) \ | 27 V(LiteralToken) \ |
28 V(TokenStream) \ | 28 V(TokenStream) \ |
29 V(Script) \ | 29 V(Script) \ |
30 V(Library) \ | 30 V(Library) \ |
31 V(Namespace) \ | 31 V(Namespace) \ |
32 V(Code) \ | 32 V(Code) \ |
33 V(Instructions) \ | 33 V(Instructions) \ |
| 34 V(ObjectPool) \ |
34 V(PcDescriptors) \ | 35 V(PcDescriptors) \ |
35 V(Stackmap) \ | 36 V(Stackmap) \ |
36 V(LocalVarDescriptors) \ | 37 V(LocalVarDescriptors) \ |
37 V(ExceptionHandlers) \ | 38 V(ExceptionHandlers) \ |
38 V(Context) \ | 39 V(Context) \ |
39 V(ContextScope) \ | 40 V(ContextScope) \ |
40 V(ICData) \ | 41 V(ICData) \ |
41 V(MegamorphicCache) \ | 42 V(MegamorphicCache) \ |
42 V(SubtypeTestCache) \ | 43 V(SubtypeTestCache) \ |
43 V(Error) \ | 44 V(Error) \ |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 // Variable length data follows here. | 985 // Variable length data follows here. |
985 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); } | 986 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); } |
986 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); } | 987 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); } |
987 | 988 |
988 friend class StackFrame; | 989 friend class StackFrame; |
989 friend class MarkingVisitor; | 990 friend class MarkingVisitor; |
990 friend class Function; | 991 friend class Function; |
991 }; | 992 }; |
992 | 993 |
993 | 994 |
| 995 class RawObjectPool : public RawObject { |
| 996 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); |
| 997 |
| 998 intptr_t length_; |
| 999 intptr_t num_tagged_entries_; |
| 1000 |
| 1001 struct Entry { |
| 1002 union { |
| 1003 RawObject* raw_obj_; |
| 1004 uword raw_value_; |
| 1005 }; |
| 1006 }; |
| 1007 Entry* data() { OPEN_ARRAY_START(Entry, Entry); } |
| 1008 Entry const* data() const { OPEN_ARRAY_START(Entry, Entry); } |
| 1009 |
| 1010 Entry* from(); |
| 1011 Entry* to(); |
| 1012 |
| 1013 friend class Object; |
| 1014 }; |
| 1015 |
| 1016 |
994 class RawInstructions : public RawObject { | 1017 class RawInstructions : public RawObject { |
995 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); | 1018 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); |
996 | 1019 |
997 RawObject** from() { | 1020 RawObject** from() { |
998 return reinterpret_cast<RawObject**>(&ptr()->code_); | 1021 return reinterpret_cast<RawObject**>(&ptr()->code_); |
999 } | 1022 } |
1000 RawCode* code_; | 1023 RawCode* code_; |
1001 RawArray* object_pool_; | 1024 RawObjectPool* object_pool_; |
1002 RawObject** to() { | 1025 RawObject** to() { |
1003 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); | 1026 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); |
1004 } | 1027 } |
1005 int32_t size_; | 1028 int32_t size_; |
1006 | 1029 |
1007 // Variable length data follows here. | 1030 // Variable length data follows here. |
1008 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1031 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } |
1009 | 1032 |
1010 // Private helper function used while visiting stack frames. The | 1033 // Private helper function used while visiting stack frames. The |
1011 // code which iterates over dart frames is also called during GC and | 1034 // code which iterates over dart frames is also called during GC and |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 | 2114 |
2092 inline bool RawObject::IsVariableSizeClassId(intptr_t index) { | 2115 inline bool RawObject::IsVariableSizeClassId(intptr_t index) { |
2093 return (index == kArrayCid) || | 2116 return (index == kArrayCid) || |
2094 (index == kImmutableArrayCid) || | 2117 (index == kImmutableArrayCid) || |
2095 RawObject::IsOneByteStringClassId(index) || | 2118 RawObject::IsOneByteStringClassId(index) || |
2096 RawObject::IsTwoByteStringClassId(index) || | 2119 RawObject::IsTwoByteStringClassId(index) || |
2097 RawObject::IsTypedDataClassId(index) || | 2120 RawObject::IsTypedDataClassId(index) || |
2098 (index == kContextCid) || | 2121 (index == kContextCid) || |
2099 (index == kTypeArgumentsCid) || | 2122 (index == kTypeArgumentsCid) || |
2100 (index == kInstructionsCid) || | 2123 (index == kInstructionsCid) || |
| 2124 (index == kObjectPoolCid) || |
2101 (index == kPcDescriptorsCid) || | 2125 (index == kPcDescriptorsCid) || |
2102 (index == kStackmapCid) || | 2126 (index == kStackmapCid) || |
2103 (index == kLocalVarDescriptorsCid) || | 2127 (index == kLocalVarDescriptorsCid) || |
2104 (index == kExceptionHandlersCid) || | 2128 (index == kExceptionHandlersCid) || |
2105 (index == kCodeCid) || | 2129 (index == kCodeCid) || |
2106 (index == kContextScopeCid) || | 2130 (index == kContextScopeCid) || |
2107 (index == kInstanceCid) || | 2131 (index == kInstanceCid) || |
2108 (index == kJSRegExpCid); | 2132 (index == kJSRegExpCid); |
2109 } | 2133 } |
2110 | 2134 |
(...skipping 12 matching lines...) Expand all Loading... |
2123 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2147 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2124 kTypedDataInt8ArrayViewCid + 15); | 2148 kTypedDataInt8ArrayViewCid + 15); |
2125 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2149 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2126 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2150 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2127 return (kNullCid - kTypedDataInt8ArrayCid); | 2151 return (kNullCid - kTypedDataInt8ArrayCid); |
2128 } | 2152 } |
2129 | 2153 |
2130 } // namespace dart | 2154 } // namespace dart |
2131 | 2155 |
2132 #endif // VM_RAW_OBJECT_H_ | 2156 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |