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_DART_API_MESSAGE_H_ | 5 #ifndef VM_DART_API_MESSAGE_H_ |
6 #define VM_DART_API_MESSAGE_H_ | 6 #define VM_DART_API_MESSAGE_H_ |
7 | 7 |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/snapshot.h" | 9 #include "vm/snapshot.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 // Use this C structure for reading internal objects in the serialized | 13 // Use this C structure for reading internal objects in the serialized |
14 // data. These are objects that we need to process in order to | 14 // data. These are objects that we need to process in order to |
15 // generate the Dart_CObject graph but that we don't want to expose in | 15 // generate the Dart_CObject graph but that we don't want to expose in |
16 // that graph. | 16 // that graph. |
17 // TODO(sjesse): Remove this when message serialization format is | 17 // TODO(sjesse): Remove this when message serialization format is |
Mads Ager (google)
2013/04/11 05:57:04
Update this TODO with a bug report with more infor
Søren Gjesse
2013/04/11 06:47:27
I removed the TODO. At some point there where rumo
| |
18 // updated. | 18 // updated. |
19 struct Dart_CObject_Internal : public Dart_CObject { | 19 struct Dart_CObject_Internal : public Dart_CObject { |
20 enum Type { | 20 enum Type { |
21 kTypeArguments = Dart_CObject::kNumberOfTypes, | 21 kTypeArguments = Dart_CObject::kNumberOfTypes, |
22 kDynamicType, | 22 kDynamicType, |
23 kClass, | |
24 kView, | |
25 kUninitialized, | |
23 }; | 26 }; |
27 struct Dart_CObject_Internal* cls; | |
28 union { | |
29 struct { | |
30 struct _Dart_CObject* library_url; | |
31 struct _Dart_CObject* class_name; | |
32 } as_class; | |
33 struct { | |
34 struct _Dart_CObject* buffer; | |
35 int offset_in_bytes; | |
36 int length; | |
37 } as_view; | |
38 } internal; | |
24 }; | 39 }; |
25 | 40 |
26 | 41 |
27 // Reads a message snapshot into a C structure. | 42 // Reads a message snapshot into a C structure. |
28 class ApiMessageReader : public BaseReader { | 43 class ApiMessageReader : public BaseReader { |
29 public: | 44 public: |
30 // The allocator passed is used to allocate memory for the C structure used | 45 // The allocator passed is used to allocate memory for the C structure used |
31 // to represent the message snapshot. This allocator must keep track of the | 46 // to represent the message snapshot. This allocator must keep track of the |
32 // memory allocated as there is no way to run through the resulting C | 47 // memory allocated as there is no way to run through the resulting C |
33 // structure and free the individual pieces. Using a zone based allocator is | 48 // structure and free the individual pieces. Using a zone based allocator is |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 // Allocates a Dart_CObject object for bigint data. | 87 // Allocates a Dart_CObject object for bigint data. |
73 Dart_CObject* AllocateDartCObjectBigint(intptr_t length); | 88 Dart_CObject* AllocateDartCObjectBigint(intptr_t length); |
74 // Allocates a Dart_CObject object for a double. | 89 // Allocates a Dart_CObject object for a double. |
75 Dart_CObject* AllocateDartCObjectDouble(double value); | 90 Dart_CObject* AllocateDartCObjectDouble(double value); |
76 // Allocates a Dart_CObject object for string data. | 91 // Allocates a Dart_CObject object for string data. |
77 Dart_CObject* AllocateDartCObjectString(intptr_t length); | 92 Dart_CObject* AllocateDartCObjectString(intptr_t length); |
78 // Allocates a C Dart_CObject object for byte data. | 93 // Allocates a C Dart_CObject object for byte data. |
79 Dart_CObject* AllocateDartCObjectUint8Array(intptr_t length); | 94 Dart_CObject* AllocateDartCObjectUint8Array(intptr_t length); |
80 // Allocates a C array of Dart_CObject objects. | 95 // Allocates a C array of Dart_CObject objects. |
81 Dart_CObject* AllocateDartCObjectArray(intptr_t length); | 96 Dart_CObject* AllocateDartCObjectArray(intptr_t length); |
97 // Allocates a Dart_CObject_Internal object with the specified type. | |
98 Dart_CObject_Internal* AllocateDartCObjectInternal( | |
99 Dart_CObject_Internal::Type type); | |
100 // Allocates a Dart_CObject_Internal object for a class object. | |
101 Dart_CObject_Internal* AllocateDartCObjectClass(); | |
82 // Allocates a backwards reference node. | 102 // Allocates a backwards reference node. |
83 BackRefNode* AllocateBackRefNode(Dart_CObject* ref, DeserializeState state); | 103 BackRefNode* AllocateBackRefNode(Dart_CObject* ref, DeserializeState state); |
84 | 104 |
85 void Init(); | 105 void Init(); |
86 | 106 |
87 intptr_t LookupInternalClass(intptr_t class_header); | 107 intptr_t LookupInternalClass(intptr_t class_header); |
88 Dart_CObject* ReadVMIsolateObject(intptr_t value); | 108 Dart_CObject* ReadVMIsolateObject(intptr_t value); |
89 Dart_CObject* ReadInternalVMObject(intptr_t class_id, intptr_t object_id); | 109 Dart_CObject* ReadInternalVMObject(intptr_t class_id, intptr_t object_id); |
90 Dart_CObject* ReadInlinedObject(intptr_t object_id); | 110 Dart_CObject* ReadInlinedObject(intptr_t object_id); |
91 Dart_CObject* ReadObjectImpl(); | 111 Dart_CObject* ReadObjectImpl(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 Dart_CObject** forward_list_; | 184 Dart_CObject** forward_list_; |
165 intptr_t forward_list_length_; | 185 intptr_t forward_list_length_; |
166 intptr_t forward_id_; | 186 intptr_t forward_id_; |
167 | 187 |
168 DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter); | 188 DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter); |
169 }; | 189 }; |
170 | 190 |
171 } // namespace dart | 191 } // namespace dart |
172 | 192 |
173 #endif // VM_DART_API_MESSAGE_H_ | 193 #endif // VM_DART_API_MESSAGE_H_ |
OLD | NEW |