| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/clustered_snapshot.h" | 5 #include "vm/clustered_snapshot.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 void WriteClass(Serializer* s, RawClass* cls) { | 108 void WriteClass(Serializer* s, RawClass* cls) { |
| 109 Snapshot::Kind kind = s->kind(); | 109 Snapshot::Kind kind = s->kind(); |
| 110 RawObject** from = cls->from(); | 110 RawObject** from = cls->from(); |
| 111 RawObject** to = cls->to_snapshot(kind); | 111 RawObject** to = cls->to_snapshot(kind); |
| 112 for (RawObject** p = from; p <= to; p++) { | 112 for (RawObject** p = from; p <= to; p++) { |
| 113 s->WriteRef(*p); | 113 s->WriteRef(*p); |
| 114 } | 114 } |
| 115 intptr_t class_id = cls->ptr()->id_; | 115 intptr_t class_id = cls->ptr()->id_; |
| 116 ASSERT(class_id != kIllegalCid); | 116 if (class_id == kIllegalCid) { |
| 117 FATAL1("Attempting to serialize class with illegal cid: %s\n", |
| 118 Class::Handle(cls).ToCString()); |
| 119 } |
| 117 s->WriteCid(class_id); | 120 s->WriteCid(class_id); |
| 118 s->Write<int32_t>(cls->ptr()->instance_size_in_words_); | 121 s->Write<int32_t>(cls->ptr()->instance_size_in_words_); |
| 119 s->Write<int32_t>(cls->ptr()->next_field_offset_in_words_); | 122 s->Write<int32_t>(cls->ptr()->next_field_offset_in_words_); |
| 120 s->Write<int32_t>(cls->ptr()->type_arguments_field_offset_in_words_); | 123 s->Write<int32_t>(cls->ptr()->type_arguments_field_offset_in_words_); |
| 121 s->Write<uint16_t>(cls->ptr()->num_type_arguments_); | 124 s->Write<uint16_t>(cls->ptr()->num_type_arguments_); |
| 122 s->Write<uint16_t>(cls->ptr()->num_own_type_arguments_); | 125 s->Write<uint16_t>(cls->ptr()->num_own_type_arguments_); |
| 123 s->Write<uint16_t>(cls->ptr()->num_native_fields_); | 126 s->Write<uint16_t>(cls->ptr()->num_native_fields_); |
| 124 s->WriteTokenPosition(cls->ptr()->token_pos_); | 127 s->WriteTokenPosition(cls->ptr()->token_pos_); |
| 125 s->Write<uint16_t>(cls->ptr()->state_bits_); | 128 s->Write<uint16_t>(cls->ptr()->state_bits_); |
| 126 } | 129 } |
| (...skipping 5419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5546 thread_->isolate()->SetupImagePage(data_buffer_, | 5549 thread_->isolate()->SetupImagePage(data_buffer_, |
| 5547 /* is_executable */ false); | 5550 /* is_executable */ false); |
| 5548 } | 5551 } |
| 5549 | 5552 |
| 5550 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); | 5553 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
| 5551 | 5554 |
| 5552 return ApiError::null(); | 5555 return ApiError::null(); |
| 5553 } | 5556 } |
| 5554 | 5557 |
| 5555 } // namespace dart | 5558 } // namespace dart |
| OLD | NEW |