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

Side by Side Diff: vm/raw_object_snapshot.cc

Issue 10861023: Currently we use a generated number as the class id for object class, this change tries to pin it t… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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
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 23 matching lines...) Expand all
34 if ((kind == Snapshot::kFull) || 34 if ((kind == Snapshot::kFull) ||
35 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) { 35 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) {
36 // Read in the base information. 36 // Read in the base information.
37 intptr_t class_id = reader->ReadIntptrValue(); 37 intptr_t class_id = reader->ReadIntptrValue();
38 bool is_signature_class = reader->Read<bool>(); 38 bool is_signature_class = reader->Read<bool>();
39 39
40 // Allocate class object of specified kind. 40 // Allocate class object of specified kind.
41 if (kind == Snapshot::kFull) { 41 if (kind == Snapshot::kFull) {
42 cls = reader->NewClass(class_id, is_signature_class); 42 cls = reader->NewClass(class_id, is_signature_class);
43 } else { 43 } else {
44 cls = Class::GetClass(class_id, is_signature_class); 44 if (class_id < kNumPredefinedCids) {
45 ASSERT(class_id >= kInstanceCid && class_id <= kWeakPropertyCid);
srdjan 2012/08/21 00:57:39 Add parenthesis.
siva 2012/08/21 01:23:29 Done.
46 cls = reader->isolate()->class_table()->At(class_id);
47 } else {
48 if (is_signature_class) {
49 cls = Class::New<Closure>(kIllegalCid);
50 } else {
51 cls = Class::New<Instance>(kIllegalCid);
52 }
53 }
45 } 54 }
46 reader->AddBackRef(object_id, &cls, kIsDeserialized); 55 reader->AddBackRef(object_id, &cls, kIsDeserialized);
47 56
48 // Set the object tags. 57 // Set the object tags.
49 cls.set_tags(tags); 58 cls.set_tags(tags);
50 59
51 // Set all non object fields. 60 // Set all non object fields.
52 cls.set_instance_size(reader->ReadIntptrValue()); 61 cls.set_instance_size(reader->ReadIntptrValue());
53 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue()); 62 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue());
54 cls.set_next_field_offset(reader->ReadIntptrValue()); 63 cls.set_next_field_offset(reader->ReadIntptrValue());
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 // Write out the class and tags information. 2092 // Write out the class and tags information.
2084 writer->WriteIndexedObject(kWeakPropertyCid); 2093 writer->WriteIndexedObject(kWeakPropertyCid);
2085 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2094 writer->WriteIntptrValue(writer->GetObjectTags(this));
2086 2095
2087 // Write out all the other fields. 2096 // Write out all the other fields.
2088 writer->Write<RawObject*>(ptr()->key_); 2097 writer->Write<RawObject*>(ptr()->key_);
2089 writer->Write<RawObject*>(ptr()->value_); 2098 writer->Write<RawObject*>(ptr()->value_);
2090 } 2099 }
2091 2100
2092 } // namespace dart 2101 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698