| 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/native_entry.h" | 5 #include "vm/native_entry.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/stub_code.h" | 9 #include "vm/stub_code.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 // Write out the class and tags information. | 698 // Write out the class and tags information. |
| 699 writer->WriteVMIsolateObject(kFunctionCid); | 699 writer->WriteVMIsolateObject(kFunctionCid); |
| 700 writer->WriteTags(writer->GetObjectTags(this)); | 700 writer->WriteTags(writer->GetObjectTags(this)); |
| 701 | 701 |
| 702 // Write out the boolean is_in_fullsnapshot first as this will | 702 // Write out the boolean is_in_fullsnapshot first as this will |
| 703 // help the reader decide how the rest of the information needs | 703 // help the reader decide how the rest of the information needs |
| 704 // to be interpreted. | 704 // to be interpreted. |
| 705 writer->Write<bool>(is_in_fullsnapshot); | 705 writer->Write<bool>(is_in_fullsnapshot); |
| 706 | 706 |
| 707 if (kind == Snapshot::kFull || !is_in_fullsnapshot) { | 707 if (kind == Snapshot::kFull || !is_in_fullsnapshot) { |
| 708 bool is_optimized = Code::IsOptimized(ptr()->instructions_->ptr()->code_); | 708 bool is_optimized = Code::IsOptimized(ptr()->code_); |
| 709 | 709 |
| 710 // Write out all the non object fields. | 710 // Write out all the non object fields. |
| 711 writer->Write<int32_t>(ptr()->token_pos_); | 711 writer->Write<int32_t>(ptr()->token_pos_); |
| 712 writer->Write<int32_t>(ptr()->end_token_pos_); | 712 writer->Write<int32_t>(ptr()->end_token_pos_); |
| 713 if (is_optimized) { | 713 if (is_optimized) { |
| 714 writer->Write<int32_t>(FLAG_optimization_counter_threshold); | 714 writer->Write<int32_t>(FLAG_optimization_counter_threshold); |
| 715 } else { | 715 } else { |
| 716 writer->Write<int32_t>(0); | 716 writer->Write<int32_t>(0); |
| 717 } | 717 } |
| 718 writer->Write<int16_t>(ptr()->num_fixed_parameters_); | 718 writer->Write<int16_t>(ptr()->num_fixed_parameters_); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 intptr_t tags, | 1188 intptr_t tags, |
| 1189 Snapshot::Kind kind) { | 1189 Snapshot::Kind kind) { |
| 1190 ASSERT(reader->snapshot_code()); | 1190 ASSERT(reader->snapshot_code()); |
| 1191 ASSERT(kind == Snapshot::kFull); | 1191 ASSERT(kind == Snapshot::kFull); |
| 1192 | 1192 |
| 1193 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0)); | 1193 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0)); |
| 1194 reader->AddBackRef(object_id, &result, kIsDeserialized); | 1194 reader->AddBackRef(object_id, &result, kIsDeserialized); |
| 1195 | 1195 |
| 1196 result.set_compile_timestamp(reader->Read<int64_t>()); | 1196 result.set_compile_timestamp(reader->Read<int64_t>()); |
| 1197 result.set_state_bits(reader->Read<int32_t>()); | 1197 result.set_state_bits(reader->Read<int32_t>()); |
| 1198 result.set_entry_patch_pc_offset(reader->Read<int32_t>()); | |
| 1199 result.set_patch_code_pc_offset(reader->Read<int32_t>()); | |
| 1200 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>()); | 1198 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>()); |
| 1201 | 1199 |
| 1202 // Set all the object fields. | 1200 // Set all the object fields. |
| 1203 READ_OBJECT_FIELDS(result, | 1201 READ_OBJECT_FIELDS(result, |
| 1204 result.raw()->from(), result.raw()->to(), | 1202 result.raw()->from(), result.raw()->to(), |
| 1205 kAsInlinedObject); | 1203 kAsInlinedObject); |
| 1206 | 1204 |
| 1207 // Fix entry point. | 1205 // Fix entry point. |
| 1208 uword new_entry = result.EntryPoint(); | 1206 uword new_entry = result.EntryPoint(); |
| 1209 ASSERT(Dart::vm_isolate()->heap()->CodeContains(new_entry)); | 1207 ASSERT(Dart::vm_isolate()->heap()->CodeContains(new_entry)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1229 // Write out the serialization header value for this object. | 1227 // Write out the serialization header value for this object. |
| 1230 writer->WriteInlinedObjectHeader(object_id); | 1228 writer->WriteInlinedObjectHeader(object_id); |
| 1231 | 1229 |
| 1232 // Write out the class and tags information. | 1230 // Write out the class and tags information. |
| 1233 writer->WriteVMIsolateObject(kCodeCid); | 1231 writer->WriteVMIsolateObject(kCodeCid); |
| 1234 writer->WriteTags(writer->GetObjectTags(this)); | 1232 writer->WriteTags(writer->GetObjectTags(this)); |
| 1235 | 1233 |
| 1236 // Write out all the non object fields. | 1234 // Write out all the non object fields. |
| 1237 writer->Write<int64_t>(ptr()->compile_timestamp_); | 1235 writer->Write<int64_t>(ptr()->compile_timestamp_); |
| 1238 writer->Write<int32_t>(ptr()->state_bits_); | 1236 writer->Write<int32_t>(ptr()->state_bits_); |
| 1239 writer->Write<int32_t>(ptr()->entry_patch_pc_offset_); | |
| 1240 writer->Write<int32_t>(ptr()->patch_code_pc_offset_); | |
| 1241 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); | 1237 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); |
| 1242 | 1238 |
| 1243 // Write out all the object pointer fields. | 1239 // Write out all the object pointer fields. |
| 1244 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); | 1240 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); |
| 1245 visitor.VisitPointers(from(), to()); | 1241 visitor.VisitPointers(from(), to()); |
| 1246 | 1242 |
| 1247 writer->SetInstructionsCode(ptr()->instructions_, this); | 1243 writer->SetInstructionsCode(ptr()->instructions_, this); |
| 1248 } | 1244 } |
| 1249 | 1245 |
| 1250 | 1246 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1278 | 1274 |
| 1279 // Instructions will be written pre-marked and in the VM heap. Write out | 1275 // Instructions will be written pre-marked and in the VM heap. Write out |
| 1280 // the tags we expect to find when reading the snapshot for a sanity check | 1276 // the tags we expect to find when reading the snapshot for a sanity check |
| 1281 // that our offsets/alignment didn't get out of sync. | 1277 // that our offsets/alignment didn't get out of sync. |
| 1282 uword written_tags = writer->GetObjectTags(this); | 1278 uword written_tags = writer->GetObjectTags(this); |
| 1283 written_tags = RawObject::VMHeapObjectTag::update(true, written_tags); | 1279 written_tags = RawObject::VMHeapObjectTag::update(true, written_tags); |
| 1284 written_tags = RawObject::MarkBit::update(true, written_tags); | 1280 written_tags = RawObject::MarkBit::update(true, written_tags); |
| 1285 writer->Write<intptr_t>(written_tags); | 1281 writer->Write<intptr_t>(written_tags); |
| 1286 | 1282 |
| 1287 writer->Write<int32_t>(writer->GetInstructionsId(this)); | 1283 writer->Write<int32_t>(writer->GetInstructionsId(this)); |
| 1288 | |
| 1289 { | |
| 1290 // TODO(rmacnak): Drop after calling convention change. | |
| 1291 writer->WriteObjectImpl(ptr()->code_, kAsReference); | |
| 1292 writer->WriteObjectImpl(ptr()->object_pool_, kAsReference); | |
| 1293 } | |
| 1294 } | 1284 } |
| 1295 | 1285 |
| 1296 | 1286 |
| 1297 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, | 1287 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, |
| 1298 intptr_t object_id, | 1288 intptr_t object_id, |
| 1299 intptr_t tags, | 1289 intptr_t tags, |
| 1300 Snapshot::Kind kind) { | 1290 Snapshot::Kind kind) { |
| 1301 ASSERT(reader->snapshot_code()); | 1291 ASSERT(reader->snapshot_code()); |
| 1302 ASSERT(kind == Snapshot::kFull); | 1292 ASSERT(kind == Snapshot::kFull); |
| 1303 | 1293 |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3299 // We do not allow objects with native fields in an isolate message. | 3289 // We do not allow objects with native fields in an isolate message. |
| 3300 writer->SetWriteException(Exceptions::kArgument, | 3290 writer->SetWriteException(Exceptions::kArgument, |
| 3301 "Illegal argument in isolate message" | 3291 "Illegal argument in isolate message" |
| 3302 " : (object is a UserTag)"); | 3292 " : (object is a UserTag)"); |
| 3303 } else { | 3293 } else { |
| 3304 UNREACHABLE(); | 3294 UNREACHABLE(); |
| 3305 } | 3295 } |
| 3306 } | 3296 } |
| 3307 | 3297 |
| 3308 } // namespace dart | 3298 } // namespace dart |
| OLD | NEW |