Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: runtime/vm/dart_api_message.h

Issue 1123813002: Move symbol table from per isolate snapshot to vm isolate snapshot, this reduces the per isolate in… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "vm/dart_api_state.h" 9 #include "vm/dart_api_state.h"
10 #include "vm/snapshot.h" 10 #include "vm/snapshot.h"
(...skipping 28 matching lines...) Expand all
39 39
40 40
41 // Reads a message snapshot into a C structure. 41 // Reads a message snapshot into a C structure.
42 class ApiMessageReader : public BaseReader { 42 class ApiMessageReader : public BaseReader {
43 public: 43 public:
44 // The allocator passed is used to allocate memory for the C structure used 44 // The allocator passed is used to allocate memory for the C structure used
45 // to represent the message snapshot. This allocator must keep track of the 45 // to represent the message snapshot. This allocator must keep track of the
46 // memory allocated as there is no way to run through the resulting C 46 // memory allocated as there is no way to run through the resulting C
47 // structure and free the individual pieces. Using a zone based allocator is 47 // structure and free the individual pieces. Using a zone based allocator is
48 // recommended. 48 // recommended.
49 ApiMessageReader(const uint8_t* buffer, intptr_t length, ReAlloc alloc); 49 ApiMessageReader(const uint8_t* buffer,
50 intptr_t length,
51 ReAlloc alloc,
52 bool use_vm_isolate_snapshot = true);
50 ~ApiMessageReader() { } 53 ~ApiMessageReader() { }
51 54
52 Dart_CObject* ReadMessage(); 55 Dart_CObject* ReadMessage();
53 56
54 private: 57 private:
55 class BackRefNode { 58 class BackRefNode {
56 public: 59 public:
57 BackRefNode(Dart_CObject* reference, DeserializeState state) 60 BackRefNode(Dart_CObject* reference, DeserializeState state)
58 : reference_(reference), state_(state) {} 61 : reference_(reference), state_(state) {}
59 Dart_CObject* reference() const { return reference_; } 62 Dart_CObject* reference() const { return reference_; }
(...skipping 27 matching lines...) Expand all
87 Dart_CObject* AllocateDartCObjectBigint(); 90 Dart_CObject* AllocateDartCObjectBigint();
88 // Allocates a Dart_CObject object for a double. 91 // Allocates a Dart_CObject object for a double.
89 Dart_CObject* AllocateDartCObjectDouble(double value); 92 Dart_CObject* AllocateDartCObjectDouble(double value);
90 // Allocates a Dart_CObject object for string data. 93 // Allocates a Dart_CObject object for string data.
91 Dart_CObject* AllocateDartCObjectString(intptr_t length); 94 Dart_CObject* AllocateDartCObjectString(intptr_t length);
92 // Allocates a C Dart_CObject object for a typed data. 95 // Allocates a C Dart_CObject object for a typed data.
93 Dart_CObject* AllocateDartCObjectTypedData( 96 Dart_CObject* AllocateDartCObjectTypedData(
94 Dart_TypedData_Type type, intptr_t length); 97 Dart_TypedData_Type type, intptr_t length);
95 // Allocates a C array of Dart_CObject objects. 98 // Allocates a C array of Dart_CObject objects.
96 Dart_CObject* AllocateDartCObjectArray(intptr_t length); 99 Dart_CObject* AllocateDartCObjectArray(intptr_t length);
100 // Allocate a C Dart_CObject object for a VM isolate object.
101 Dart_CObject* AllocateDartCObjectVmIsolateObj(intptr_t id);
97 // Allocates a Dart_CObject_Internal object with the specified type. 102 // Allocates a Dart_CObject_Internal object with the specified type.
98 Dart_CObject_Internal* AllocateDartCObjectInternal( 103 Dart_CObject_Internal* AllocateDartCObjectInternal(
99 Dart_CObject_Internal::Type type); 104 Dart_CObject_Internal::Type type);
100 // Allocates a Dart_CObject_Internal object for a class object. 105 // Allocates a Dart_CObject_Internal object for a class object.
101 Dart_CObject_Internal* AllocateDartCObjectClass(); 106 Dart_CObject_Internal* AllocateDartCObjectClass();
102 // Allocates a backwards reference node. 107 // Allocates a backwards reference node.
103 BackRefNode* AllocateBackRefNode(Dart_CObject* ref, DeserializeState state); 108 BackRefNode* AllocateBackRefNode(Dart_CObject* ref, DeserializeState state);
104 109
105 void Init(); 110 void Init();
106 111
(...skipping 13 matching lines...) Expand all
120 // Get an object from the backward references list. 125 // Get an object from the backward references list.
121 Dart_CObject* GetBackRef(intptr_t id); 126 Dart_CObject* GetBackRef(intptr_t id);
122 127
123 intptr_t NextAvailableObjectId() const; 128 intptr_t NextAvailableObjectId() const;
124 129
125 Dart_CObject_Internal* AsInternal(Dart_CObject* object) { 130 Dart_CObject_Internal* AsInternal(Dart_CObject* object) {
126 ASSERT(object->type >= Dart_CObject_kNumberOfTypes); 131 ASSERT(object->type >= Dart_CObject_kNumberOfTypes);
127 return reinterpret_cast<Dart_CObject_Internal*>(object); 132 return reinterpret_cast<Dart_CObject_Internal*>(object);
128 } 133 }
129 134
135 RawObject* VmIsolateSnapshotObject(intptr_t index) const {
136 return Object::vm_isolate_snapshot_object_table().At(index);
137 }
138
139 Dart_CObject* CreateDartCObjectString(RawObject* raw);
140
130 // Allocation of the structures for the decoded message happens 141 // Allocation of the structures for the decoded message happens
131 // either in the supplied zone or using the supplied allocation 142 // either in the supplied zone or using the supplied allocation
132 // function. 143 // function.
133 ReAlloc alloc_; 144 ReAlloc alloc_;
134 ApiGrowableArray<BackRefNode*> backward_references_; 145 ApiGrowableArray<BackRefNode*> backward_references_;
135 Dart_CObject** vm_symbol_references_; 146 Dart_CObject** vm_symbol_references_;
147 intptr_t max_vm_isolate_object_id_;
136 148
137 Dart_CObject type_arguments_marker; 149 Dart_CObject type_arguments_marker;
138 Dart_CObject dynamic_type_marker; 150 Dart_CObject dynamic_type_marker;
139 static _Dart_CObject* singleton_uint32_typed_data_; 151 static _Dart_CObject* singleton_uint32_typed_data_;
140 }; 152 };
141 153
142 154
143 class ApiMessageWriter : public BaseWriter { 155 class ApiMessageWriter : public BaseWriter {
144 public: 156 public:
145 static const intptr_t kInitialSize = 512; 157 static const intptr_t kInitialSize = 512;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void WriteInlinedHeader(Dart_CObject* object); 192 void WriteInlinedHeader(Dart_CObject* object);
181 bool WriteCObject(Dart_CObject* object); 193 bool WriteCObject(Dart_CObject* object);
182 bool WriteCObjectRef(Dart_CObject* object); 194 bool WriteCObjectRef(Dart_CObject* object);
183 bool WriteForwardedCObject(Dart_CObject* object); 195 bool WriteForwardedCObject(Dart_CObject* object);
184 bool WriteCObjectInlined(Dart_CObject* object, Dart_CObject_Type type); 196 bool WriteCObjectInlined(Dart_CObject* object, Dart_CObject_Type type);
185 197
186 intptr_t object_id_; 198 intptr_t object_id_;
187 Dart_CObject** forward_list_; 199 Dart_CObject** forward_list_;
188 intptr_t forward_list_length_; 200 intptr_t forward_list_length_;
189 intptr_t forward_id_; 201 intptr_t forward_id_;
202 intptr_t max_vm_isolate_object_id_;
190 203
191 DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter); 204 DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter);
192 }; 205 };
193 206
194 } // namespace dart 207 } // namespace dart
195 208
196 #endif // VM_DART_API_MESSAGE_H_ 209 #endif // VM_DART_API_MESSAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698