Chromium Code Reviews| 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 #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 24 matching lines...) Expand all Loading... | |
| 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 if (class_id < kNumPredefinedCids) { | 44 if (class_id < kNumPredefinedCids) { |
| 45 ASSERT((class_id >= kInstanceCid) && (class_id <= kWeakPropertyCid)); | 45 ASSERT((class_id >= kInstanceCid) && (class_id <= kDartFunctionCid)); |
| 46 cls = reader->isolate()->class_table()->At(class_id); | 46 cls = reader->isolate()->class_table()->At(class_id); |
| 47 } else { | 47 } else { |
| 48 if (is_signature_class) { | 48 if (is_signature_class) { |
| 49 cls = New<Closure>(kIllegalCid); | 49 cls = New<Closure>(kIllegalCid); |
| 50 } else { | 50 } else { |
| 51 cls = New<Instance>(kIllegalCid); | 51 cls = New<Instance>(kIllegalCid); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 reader->AddBackRef(object_id, &cls, kIsDeserialized); | 55 reader->AddBackRef(object_id, &cls, kIsDeserialized); |
| 56 | |
|
regis
2012/08/23 03:53:10
Blank line removed by accident? Other functions ha
hausner
2012/08/23 18:34:10
Blankness restored to former glory.
| |
| 57 // Set the object tags. | 56 // Set the object tags. |
| 58 cls.set_tags(tags); | 57 cls.set_tags(tags); |
| 59 | 58 |
| 60 // Set all non object fields. | 59 // Set all non object fields. |
| 61 cls.set_instance_size(reader->ReadIntptrValue()); | 60 cls.set_instance_size(reader->ReadIntptrValue()); |
| 62 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue()); | 61 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue()); |
| 63 cls.set_next_field_offset(reader->ReadIntptrValue()); | 62 cls.set_next_field_offset(reader->ReadIntptrValue()); |
| 64 cls.set_num_native_fields(reader->ReadIntptrValue()); | 63 cls.set_num_native_fields(reader->ReadIntptrValue()); |
| 65 cls.set_token_pos(reader->ReadIntptrValue()); | 64 cls.set_token_pos(reader->ReadIntptrValue()); |
| 66 cls.set_state_bits(reader->Read<uint8_t>()); | 65 cls.set_state_bits(reader->Read<uint8_t>()); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 Snapshot::Kind kind) { | 177 Snapshot::Kind kind) { |
| 179 UNREACHABLE(); // AbstractType is an abstract class. | 178 UNREACHABLE(); // AbstractType is an abstract class. |
| 180 } | 179 } |
| 181 | 180 |
| 182 | 181 |
| 183 RawType* Type::ReadFrom(SnapshotReader* reader, | 182 RawType* Type::ReadFrom(SnapshotReader* reader, |
| 184 intptr_t object_id, | 183 intptr_t object_id, |
| 185 intptr_t tags, | 184 intptr_t tags, |
| 186 Snapshot::Kind kind) { | 185 Snapshot::Kind kind) { |
| 187 ASSERT(reader != NULL); | 186 ASSERT(reader != NULL); |
| 188 | |
|
regis
2012/08/23 03:53:10
ditto
hausner
2012/08/23 18:34:10
Done.
| |
| 189 // Allocate parameterized type object. | 187 // Allocate parameterized type object. |
| 190 Type& parameterized_type = Type::ZoneHandle( | 188 Type& parameterized_type = Type::ZoneHandle( |
| 191 reader->isolate(), NEW_OBJECT(Type)); | 189 reader->isolate(), NEW_OBJECT(Type)); |
| 192 reader->AddBackRef(object_id, ¶meterized_type, kIsDeserialized); | 190 reader->AddBackRef(object_id, ¶meterized_type, kIsDeserialized); |
| 193 | 191 |
| 194 // Set the object tags. | 192 // Set the object tags. |
| 195 parameterized_type.set_tags(tags); | 193 parameterized_type.set_tags(tags); |
| 196 | 194 |
| 197 // Set all non object fields. | 195 // Set all non object fields. |
| 198 parameterized_type.set_token_pos(reader->ReadIntptrValue()); | 196 parameterized_type.set_token_pos(reader->ReadIntptrValue()); |
| (...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1961 ptr()->length_, \ | 1959 ptr()->length_, \ |
| 1962 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); \ | 1960 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); \ |
| 1963 } \ | 1961 } \ |
| 1964 | 1962 |
| 1965 | 1963 |
| 1966 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_WRITE_TO) | 1964 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_WRITE_TO) |
| 1967 #undef BYTEARRAY_WRITE_TO | 1965 #undef BYTEARRAY_WRITE_TO |
| 1968 #undef BYTEARRAY_TYPE_LIST | 1966 #undef BYTEARRAY_TYPE_LIST |
| 1969 | 1967 |
| 1970 | 1968 |
| 1969 RawDartFunction* DartFunction::ReadFrom(SnapshotReader* reader, | |
| 1970 intptr_t object_id, | |
| 1971 intptr_t tags, | |
| 1972 Snapshot::Kind kind) { | |
| 1973 UNIMPLEMENTED(); | |
|
regis
2012/08/23 03:53:10
Better: UNREACHABLE(); // DartFunction is an abst
hausner
2012/08/23 18:34:10
Done.
| |
| 1974 return DartFunction::null(); | |
| 1975 } | |
| 1976 | |
| 1977 | |
| 1978 void RawDartFunction::WriteTo(SnapshotWriter* writer, | |
| 1979 intptr_t object_id, | |
| 1980 Snapshot::Kind kind) { | |
| 1981 UNIMPLEMENTED(); | |
|
regis
2012/08/23 03:53:10
ditto
hausner
2012/08/23 18:34:10
Done.
| |
| 1982 } | |
| 1983 | |
| 1984 | |
| 1971 RawClosure* Closure::ReadFrom(SnapshotReader* reader, | 1985 RawClosure* Closure::ReadFrom(SnapshotReader* reader, |
| 1972 intptr_t object_id, | 1986 intptr_t object_id, |
| 1973 intptr_t tags, | 1987 intptr_t tags, |
| 1974 Snapshot::Kind kind) { | 1988 Snapshot::Kind kind) { |
| 1975 UNIMPLEMENTED(); | 1989 UNIMPLEMENTED(); |
| 1976 return Closure::null(); | 1990 return Closure::null(); |
| 1977 } | 1991 } |
| 1978 | 1992 |
| 1979 | 1993 |
| 1980 void RawClosure::WriteTo(SnapshotWriter* writer, | 1994 void RawClosure::WriteTo(SnapshotWriter* writer, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2092 // Write out the class and tags information. | 2106 // Write out the class and tags information. |
| 2093 writer->WriteIndexedObject(kWeakPropertyCid); | 2107 writer->WriteIndexedObject(kWeakPropertyCid); |
| 2094 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2108 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 2095 | 2109 |
| 2096 // Write out all the other fields. | 2110 // Write out all the other fields. |
| 2097 writer->Write<RawObject*>(ptr()->key_); | 2111 writer->Write<RawObject*>(ptr()->key_); |
| 2098 writer->Write<RawObject*>(ptr()->value_); | 2112 writer->Write<RawObject*>(ptr()->value_); |
| 2099 } | 2113 } |
| 2100 | 2114 |
| 2101 } // namespace dart | 2115 } // namespace dart |
| OLD | NEW |