| 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 RUNTIME_VM_RAW_OBJECT_H_ | 5 #ifndef RUNTIME_VM_RAW_OBJECT_H_ |
| 6 #define RUNTIME_VM_RAW_OBJECT_H_ | 6 #define RUNTIME_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 16 matching lines...) Expand all Loading... |
| 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(ObjectPool) \ |
| 35 V(PcDescriptors) \ | 35 V(PcDescriptors) \ |
| 36 V(CodeSourceMap) \ | 36 V(CodeSourceMap) \ |
| 37 V(Stackmap) \ | 37 V(StackMap) \ |
| 38 V(LocalVarDescriptors) \ | 38 V(LocalVarDescriptors) \ |
| 39 V(ExceptionHandlers) \ | 39 V(ExceptionHandlers) \ |
| 40 V(Context) \ | 40 V(Context) \ |
| 41 V(ContextScope) \ | 41 V(ContextScope) \ |
| 42 V(SingleTargetCache) \ | 42 V(SingleTargetCache) \ |
| 43 V(UnlinkedCall) \ | 43 V(UnlinkedCall) \ |
| 44 V(ICData) \ | 44 V(ICData) \ |
| 45 V(MegamorphicCache) \ | 45 V(MegamorphicCache) \ |
| 46 V(SubtypeTestCache) \ | 46 V(SubtypeTestCache) \ |
| 47 V(Error) \ | 47 V(Error) \ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 67 V(Bool) \ | 67 V(Bool) \ |
| 68 V(GrowableObjectArray) \ | 68 V(GrowableObjectArray) \ |
| 69 V(Float32x4) \ | 69 V(Float32x4) \ |
| 70 V(Int32x4) \ | 70 V(Int32x4) \ |
| 71 V(Float64x2) \ | 71 V(Float64x2) \ |
| 72 V(TypedData) \ | 72 V(TypedData) \ |
| 73 V(ExternalTypedData) \ | 73 V(ExternalTypedData) \ |
| 74 V(Capability) \ | 74 V(Capability) \ |
| 75 V(ReceivePort) \ | 75 V(ReceivePort) \ |
| 76 V(SendPort) \ | 76 V(SendPort) \ |
| 77 V(Stacktrace) \ | 77 V(StackTrace) \ |
| 78 V(RegExp) \ | 78 V(RegExp) \ |
| 79 V(WeakProperty) \ | 79 V(WeakProperty) \ |
| 80 V(MirrorReference) \ | 80 V(MirrorReference) \ |
| 81 V(LinkedHashMap) \ | 81 V(LinkedHashMap) \ |
| 82 V(UserTag) | 82 V(UserTag) |
| 83 | 83 |
| 84 #define CLASS_LIST_ARRAYS(V) \ | 84 #define CLASS_LIST_ARRAYS(V) \ |
| 85 V(Array) \ | 85 V(Array) \ |
| 86 V(ImmutableArray) | 86 V(ImmutableArray) |
| 87 | 87 |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 int32_t length_; // Number of entries. | 1261 int32_t length_; // Number of entries. |
| 1262 | 1262 |
| 1263 // Variable length data follows here. | 1263 // Variable length data follows here. |
| 1264 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1264 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } |
| 1265 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1265 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } |
| 1266 | 1266 |
| 1267 friend class Object; | 1267 friend class Object; |
| 1268 }; | 1268 }; |
| 1269 | 1269 |
| 1270 | 1270 |
| 1271 // Stackmap is an immutable representation of the layout of the stack at a | 1271 // StackMap is an immutable representation of the layout of the stack at a |
| 1272 // PC. The stack map representation consists of a bit map which marks each | 1272 // PC. The stack map representation consists of a bit map which marks each |
| 1273 // live object index starting from the base of the frame. | 1273 // live object index starting from the base of the frame. |
| 1274 // | 1274 // |
| 1275 // The bit map representation is optimized for dense and small bit maps, without | 1275 // The bit map representation is optimized for dense and small bit maps, without |
| 1276 // any upper bound. | 1276 // any upper bound. |
| 1277 class RawStackmap : public RawObject { | 1277 class RawStackMap : public RawObject { |
| 1278 RAW_HEAP_OBJECT_IMPLEMENTATION(Stackmap); | 1278 RAW_HEAP_OBJECT_IMPLEMENTATION(StackMap); |
| 1279 | 1279 |
| 1280 // Regarding changing this to a bitfield: ARM64 requires register_bit_count_ | 1280 // Regarding changing this to a bitfield: ARM64 requires register_bit_count_ |
| 1281 // to be as large as 96, meaning 7 bits, leaving 25 bits for the length, or | 1281 // to be as large as 96, meaning 7 bits, leaving 25 bits for the length, or |
| 1282 // as large as ~33 million entries. If that is sufficient, then these two | 1282 // as large as ~33 million entries. If that is sufficient, then these two |
| 1283 // fields can be merged into a BitField. | 1283 // fields can be merged into a BitField. |
| 1284 int32_t length_; // Length of payload, in bits. | 1284 int32_t length_; // Length of payload, in bits. |
| 1285 int32_t slow_path_bit_count_; // Slow path live values, included in length_. | 1285 int32_t slow_path_bit_count_; // Slow path live values, included in length_. |
| 1286 | 1286 |
| 1287 // Offset from code entry point corresponding to this stack map | 1287 // Offset from code entry point corresponding to this stack map |
| 1288 // representation. | 1288 // representation. |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 RawSendPort* send_port_; | 2092 RawSendPort* send_port_; |
| 2093 RawInstance* handler_; | 2093 RawInstance* handler_; |
| 2094 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->handler_); } | 2094 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->handler_); } |
| 2095 }; | 2095 }; |
| 2096 | 2096 |
| 2097 | 2097 |
| 2098 // VM type for capturing stacktraces when exceptions are thrown, | 2098 // VM type for capturing stacktraces when exceptions are thrown, |
| 2099 // Currently we don't have any interface that this object is supposed | 2099 // Currently we don't have any interface that this object is supposed |
| 2100 // to implement so we just support the 'toString' method which | 2100 // to implement so we just support the 'toString' method which |
| 2101 // converts the stack trace into a string. | 2101 // converts the stack trace into a string. |
| 2102 class RawStacktrace : public RawInstance { | 2102 class RawStackTrace : public RawInstance { |
| 2103 RAW_HEAP_OBJECT_IMPLEMENTATION(Stacktrace); | 2103 RAW_HEAP_OBJECT_IMPLEMENTATION(StackTrace); |
| 2104 | 2104 |
| 2105 RawObject** from() { | 2105 RawObject** from() { |
| 2106 return reinterpret_cast<RawObject**>(&ptr()->code_array_); | 2106 return reinterpret_cast<RawObject**>(&ptr()->code_array_); |
| 2107 } | 2107 } |
| 2108 RawArray* code_array_; // Code object for each frame in the stack trace. | 2108 RawArray* code_array_; // Code object for each frame in the stack trace. |
| 2109 RawArray* pc_offset_array_; // Offset of PC for each frame. | 2109 RawArray* pc_offset_array_; // Offset of PC for each frame. |
| 2110 RawObject** to() { | 2110 RawObject** to() { |
| 2111 return reinterpret_cast<RawObject**>(&ptr()->pc_offset_array_); | 2111 return reinterpret_cast<RawObject**>(&ptr()->pc_offset_array_); |
| 2112 } | 2112 } |
| 2113 // False for pre-allocated stack trace (used in OOM and Stack overflow). | 2113 // False for pre-allocated stack trace (used in OOM and Stack overflow). |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 } | 2371 } |
| 2372 | 2372 |
| 2373 | 2373 |
| 2374 inline bool RawObject::IsVariableSizeClassId(intptr_t index) { | 2374 inline bool RawObject::IsVariableSizeClassId(intptr_t index) { |
| 2375 return (index == kArrayCid) || (index == kImmutableArrayCid) || | 2375 return (index == kArrayCid) || (index == kImmutableArrayCid) || |
| 2376 RawObject::IsOneByteStringClassId(index) || | 2376 RawObject::IsOneByteStringClassId(index) || |
| 2377 RawObject::IsTwoByteStringClassId(index) || | 2377 RawObject::IsTwoByteStringClassId(index) || |
| 2378 RawObject::IsTypedDataClassId(index) || (index == kContextCid) || | 2378 RawObject::IsTypedDataClassId(index) || (index == kContextCid) || |
| 2379 (index == kTypeArgumentsCid) || (index == kInstructionsCid) || | 2379 (index == kTypeArgumentsCid) || (index == kInstructionsCid) || |
| 2380 (index == kObjectPoolCid) || (index == kPcDescriptorsCid) || | 2380 (index == kObjectPoolCid) || (index == kPcDescriptorsCid) || |
| 2381 (index == kCodeSourceMapCid) || (index == kStackmapCid) || | 2381 (index == kCodeSourceMapCid) || (index == kStackMapCid) || |
| 2382 (index == kLocalVarDescriptorsCid) || | 2382 (index == kLocalVarDescriptorsCid) || |
| 2383 (index == kExceptionHandlersCid) || (index == kCodeCid) || | 2383 (index == kExceptionHandlersCid) || (index == kCodeCid) || |
| 2384 (index == kContextScopeCid) || (index == kInstanceCid) || | 2384 (index == kContextScopeCid) || (index == kInstanceCid) || |
| 2385 (index == kRegExpCid); | 2385 (index == kRegExpCid); |
| 2386 } | 2386 } |
| 2387 | 2387 |
| 2388 | 2388 |
| 2389 // This is a set of classes that are not Dart classes whose representation | 2389 // This is a set of classes that are not Dart classes whose representation |
| 2390 // is defined by the VM but are used in the VM code by computing the | 2390 // is defined by the VM but are used in the VM code by computing the |
| 2391 // implicit field offsets of the various fields in the dart object. | 2391 // implicit field offsets of the various fields in the dart object. |
| 2392 inline bool RawObject::IsImplicitFieldClassId(intptr_t index) { | 2392 inline bool RawObject::IsImplicitFieldClassId(intptr_t index) { |
| 2393 return (IsTypedDataViewClassId(index) || index == kByteBufferCid); | 2393 return (IsTypedDataViewClassId(index) || index == kByteBufferCid); |
| 2394 } | 2394 } |
| 2395 | 2395 |
| 2396 | 2396 |
| 2397 inline intptr_t RawObject::NumberOfTypedDataClasses() { | 2397 inline intptr_t RawObject::NumberOfTypedDataClasses() { |
| 2398 // Make sure this is updated when new TypedData types are added. | 2398 // Make sure this is updated when new TypedData types are added. |
| 2399 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); | 2399 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
| 2400 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2400 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 2401 kTypedDataInt8ArrayViewCid + 15); | 2401 kTypedDataInt8ArrayViewCid + 15); |
| 2402 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2402 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2403 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2403 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2404 return (kNullCid - kTypedDataInt8ArrayCid); | 2404 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2405 } | 2405 } |
| 2406 | 2406 |
| 2407 } // namespace dart | 2407 } // namespace dart |
| 2408 | 2408 |
| 2409 #endif // RUNTIME_VM_RAW_OBJECT_H_ | 2409 #endif // RUNTIME_VM_RAW_OBJECT_H_ |
| OLD | NEW |