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

Side by Side Diff: runtime/vm/raw_object_snapshot.cc

Issue 8872037: Adjust index of type parameters at finalization time (fix issue 718). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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/raw_object.h ('k') | tests/language/src/Generics2Test.dart » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #include "vm/bigint_operations.h" 5 #include "vm/bigint_operations.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/visitor.h" 9 #include "vm/visitor.h"
10 10
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 Snapshot::Kind kind) { 204 Snapshot::Kind kind) {
205 ASSERT(reader != NULL); 205 ASSERT(reader != NULL);
206 206
207 // Allocate type parameter object. 207 // Allocate type parameter object.
208 TypeParameter& type_parameter = 208 TypeParameter& type_parameter =
209 TypeParameter::ZoneHandle(TypeParameter::New()); 209 TypeParameter::ZoneHandle(TypeParameter::New());
210 reader->AddBackwardReference(object_id, &type_parameter); 210 reader->AddBackwardReference(object_id, &type_parameter);
211 211
212 // Set all non object fields. 212 // Set all non object fields.
213 type_parameter.set_index(reader->Read<intptr_t>()); 213 type_parameter.set_index(reader->Read<intptr_t>());
214 type_parameter.set_type_state(reader->Read<int8_t>());
214 215
215 // Set all the object fields. 216 // Set all the object fields.
216 // TODO(5411462): Need to assert No GC can happen here, even though 217 // TODO(5411462): Need to assert No GC can happen here, even though
217 // allocations may happen. 218 // allocations may happen.
218 intptr_t num_flds = (type_parameter.raw()->to() - 219 intptr_t num_flds = (type_parameter.raw()->to() -
219 type_parameter.raw()->from()); 220 type_parameter.raw()->from());
220 for (intptr_t i = 0; i <= num_flds; i++) { 221 for (intptr_t i = 0; i <= num_flds; i++) {
221 *(type_parameter.raw()->from() + i) = reader->ReadObject(); 222 *(type_parameter.raw()->from() + i) = reader->ReadObject();
222 } 223 }
223 224
224 return type_parameter.raw(); 225 return type_parameter.raw();
225 } 226 }
226 227
227 228
228 void RawTypeParameter::WriteTo(SnapshotWriter* writer, 229 void RawTypeParameter::WriteTo(SnapshotWriter* writer,
229 intptr_t object_id, 230 intptr_t object_id,
230 Snapshot::Kind kind) { 231 Snapshot::Kind kind) {
231 ASSERT(writer != NULL); 232 ASSERT(writer != NULL);
232 SnapshotWriterVisitor visitor(writer); 233 SnapshotWriterVisitor visitor(writer);
233 234
234 // Write out the serialization header value for this object. 235 // Write out the serialization header value for this object.
235 writer->WriteObjectHeader(kInlined, object_id); 236 writer->WriteObjectHeader(kInlined, object_id);
236 237
237 // Write out the class information. 238 // Write out the class information.
238 writer->WriteObjectHeader(kObjectId, Object::kTypeParameterClass); 239 writer->WriteObjectHeader(kObjectId, Object::kTypeParameterClass);
239 240
241 // Write out all the non object pointer fields.
240 writer->Write<intptr_t>(ptr()->index_); 242 writer->Write<intptr_t>(ptr()->index_);
243 writer->Write<int8_t>(ptr()->type_state_);
241 244
242 // Write out all the object pointer fields. 245 // Write out all the object pointer fields.
243 visitor.VisitPointers(from(), to()); 246 visitor.VisitPointers(from(), to());
244 } 247 }
245 248
246 249
247 RawInstantiatedType* InstantiatedType::ReadFrom(SnapshotReader* reader, 250 RawInstantiatedType* InstantiatedType::ReadFrom(SnapshotReader* reader,
248 intptr_t object_id, 251 intptr_t object_id,
249 Snapshot::Kind kind) { 252 Snapshot::Kind kind) {
250 ASSERT(reader != NULL); 253 ASSERT(reader != NULL);
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 // Write out all the other fields. 1396 // Write out all the other fields.
1394 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 1397 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
1395 writer->WriteObject(ptr()->pattern_); 1398 writer->WriteObject(ptr()->pattern_);
1396 writer->Write<intptr_t>(ptr()->type_); 1399 writer->Write<intptr_t>(ptr()->type_);
1397 writer->Write<intptr_t>(ptr()->flags_); 1400 writer->Write<intptr_t>(ptr()->flags_);
1398 1401
1399 // Do not write out the data part which is native. 1402 // Do not write out the data part which is native.
1400 } 1403 }
1401 1404
1402 } // namespace dart 1405 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | tests/language/src/Generics2Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698