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

Side by Side Diff: vm/raw_object_snapshot.cc

Issue 11275336: Do not try to write ContextScope into a snapshot. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 1 month 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 | « no previous file | vm/snapshot.h » ('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 #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/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 ASSERT((kind != Snapshot::kMessage) && 498 ASSERT((kind != Snapshot::kMessage) &&
499 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); 499 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)));
500 500
501 // Write out the serialization header value for this object. 501 // Write out the serialization header value for this object.
502 writer->WriteInlinedObjectHeader(object_id); 502 writer->WriteInlinedObjectHeader(object_id);
503 503
504 // Write out the class and tags information. 504 // Write out the class and tags information.
505 writer->WriteVMIsolateObject(kClosureDataCid); 505 writer->WriteVMIsolateObject(kClosureDataCid);
506 writer->WriteIntptrValue(writer->GetObjectTags(this)); 506 writer->WriteIntptrValue(writer->GetObjectTags(this));
507 507
508 // Write out all the object pointer fields. 508 // Context scope.
509 SnapshotWriterVisitor visitor(writer); 509 // We don't write the context scope in the snapshot.
510 visitor.VisitPointers(from(), to()); 510 writer->WriteObjectImpl(Object::null());
511
512 // Parent function.
513 writer->WriteObjectImpl(ptr()->parent_function_);
514
515 // Signature class.
516 writer->WriteObjectImpl(ptr()->signature_class_);
517
518 // Static closure/Closure allocation stub.
519 // We don't write the closure or allocation stub in the snapshot.
520 writer->WriteObjectImpl(Object::null());
511 } 521 }
512 522
513 523
514 RawRedirectionData* RedirectionData::ReadFrom(SnapshotReader* reader, 524 RawRedirectionData* RedirectionData::ReadFrom(SnapshotReader* reader,
515 intptr_t object_id, 525 intptr_t object_id,
516 intptr_t tags, 526 intptr_t tags,
517 Snapshot::Kind kind) { 527 Snapshot::Kind kind) {
518 ASSERT(reader != NULL); 528 ASSERT(reader != NULL);
519 ASSERT((kind != Snapshot::kMessage) && 529 ASSERT((kind != Snapshot::kMessage) &&
520 !RawObject::IsCreatedFromSnapshot(tags)); 530 !RawObject::IsCreatedFromSnapshot(tags));
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 // Write out all the object pointer fields. 1216 // Write out all the object pointer fields.
1207 SnapshotWriterVisitor visitor(writer); 1217 SnapshotWriterVisitor visitor(writer);
1208 visitor.VisitPointers(from(), to(ptr()->num_variables_)); 1218 visitor.VisitPointers(from(), to(ptr()->num_variables_));
1209 } 1219 }
1210 1220
1211 1221
1212 RawContextScope* ContextScope::ReadFrom(SnapshotReader* reader, 1222 RawContextScope* ContextScope::ReadFrom(SnapshotReader* reader,
1213 intptr_t object_id, 1223 intptr_t object_id,
1214 intptr_t tags, 1224 intptr_t tags,
1215 Snapshot::Kind kind) { 1225 Snapshot::Kind kind) {
1216 ASSERT(reader != NULL); 1226 UNREACHABLE();
1217 ASSERT(kind == Snapshot::kMessage); 1227 return NULL;
1218
1219 // Allocate context scope object.
1220 intptr_t num_vars = reader->ReadIntptrValue();
1221 ContextScope& scope = ContextScope::ZoneHandle(reader->isolate(),
1222 ContextScope::New(num_vars));
1223 reader->AddBackRef(object_id, &scope, kIsDeserialized);
1224
1225 // Set the object tags.
1226 scope.set_tags(tags);
1227
1228 // Set all the object fields.
1229 // TODO(5411462): Need to assert No GC can happen here, even though
1230 // allocations may happen.
1231 intptr_t num_flds = (scope.raw()->to(num_vars) - scope.raw()->from());
1232 for (intptr_t i = 0; i <= num_flds; i++) {
1233 scope.StorePointer((scope.raw()->from() + i), reader->ReadObjectRef());
1234 }
1235
1236 return scope.raw();
1237 } 1228 }
1238 1229
1239 1230
1240 void RawContextScope::WriteTo(SnapshotWriter* writer, 1231 void RawContextScope::WriteTo(SnapshotWriter* writer,
1241 intptr_t object_id, 1232 intptr_t object_id,
1242 Snapshot::Kind kind) { 1233 Snapshot::Kind kind) {
1243 ASSERT(writer != NULL); 1234 UNREACHABLE();
1244 ASSERT(kind == Snapshot::kMessage);
1245
1246 // Write out the serialization header value for this object.
1247 writer->WriteInlinedObjectHeader(object_id);
1248
1249 // Write out the class and tags information.
1250 writer->WriteVMIsolateObject(kContextScopeCid);
1251 writer->WriteIntptrValue(writer->GetObjectTags(this));
1252
1253 // Serialize number of variables.
1254 writer->WriteIntptrValue(ptr()->num_variables_);
1255
1256 // Write out all the object pointer fields.
1257 SnapshotWriterVisitor visitor(writer);
1258 visitor.VisitPointers(from(), to(ptr()->num_variables_));
1259 } 1235 }
1260 1236
1261 1237
1262 RawICData* ICData::ReadFrom(SnapshotReader* reader, 1238 RawICData* ICData::ReadFrom(SnapshotReader* reader,
1263 intptr_t object_id, 1239 intptr_t object_id,
1264 intptr_t tags, 1240 intptr_t tags,
1265 Snapshot::Kind kind) { 1241 Snapshot::Kind kind) {
1266 UNREACHABLE(); 1242 UNREACHABLE();
1267 return NULL; 1243 return NULL;
1268 } 1244 }
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 // Write out the class and tags information. 2210 // Write out the class and tags information.
2235 writer->WriteIndexedObject(kWeakPropertyCid); 2211 writer->WriteIndexedObject(kWeakPropertyCid);
2236 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2212 writer->WriteIntptrValue(writer->GetObjectTags(this));
2237 2213
2238 // Write out all the other fields. 2214 // Write out all the other fields.
2239 writer->Write<RawObject*>(ptr()->key_); 2215 writer->Write<RawObject*>(ptr()->key_);
2240 writer->Write<RawObject*>(ptr()->value_); 2216 writer->Write<RawObject*>(ptr()->value_);
2241 } 2217 }
2242 2218
2243 } // namespace dart 2219 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698