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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 // Write out the class and tags information. | 694 // Write out the class and tags information. |
695 writer->WriteVMIsolateObject(kFunctionCid); | 695 writer->WriteVMIsolateObject(kFunctionCid); |
696 writer->WriteTags(writer->GetObjectTags(this)); | 696 writer->WriteTags(writer->GetObjectTags(this)); |
697 | 697 |
698 // Write out the boolean is_in_fullsnapshot first as this will | 698 // Write out the boolean is_in_fullsnapshot first as this will |
699 // help the reader decide how the rest of the information needs | 699 // help the reader decide how the rest of the information needs |
700 // to be interpreted. | 700 // to be interpreted. |
701 writer->Write<bool>(is_in_fullsnapshot); | 701 writer->Write<bool>(is_in_fullsnapshot); |
702 | 702 |
703 if (kind == Snapshot::kFull || !is_in_fullsnapshot) { | 703 if (kind == Snapshot::kFull || !is_in_fullsnapshot) { |
704 bool is_optimized = Code::IsOptimized(ptr()->code_); | 704 bool is_optimized = Code::IsOptimized(ptr()->instructions_->ptr()->code_); |
705 | 705 |
706 // Write out all the non object fields. | 706 // Write out all the non object fields. |
707 writer->Write<int32_t>(ptr()->token_pos_); | 707 writer->Write<int32_t>(ptr()->token_pos_); |
708 writer->Write<int32_t>(ptr()->end_token_pos_); | 708 writer->Write<int32_t>(ptr()->end_token_pos_); |
709 if (is_optimized) { | 709 if (is_optimized) { |
710 writer->Write<int32_t>(FLAG_optimization_counter_threshold); | 710 writer->Write<int32_t>(FLAG_optimization_counter_threshold); |
711 } else { | 711 } else { |
712 writer->Write<int32_t>(0); | 712 writer->Write<int32_t>(0); |
713 } | 713 } |
714 writer->Write<int16_t>(ptr()->num_fixed_parameters_); | 714 writer->Write<int16_t>(ptr()->num_fixed_parameters_); |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 intptr_t tags, | 1184 intptr_t tags, |
1185 Snapshot::Kind kind) { | 1185 Snapshot::Kind kind) { |
1186 ASSERT(reader->snapshot_code()); | 1186 ASSERT(reader->snapshot_code()); |
1187 ASSERT(kind == Snapshot::kFull); | 1187 ASSERT(kind == Snapshot::kFull); |
1188 | 1188 |
1189 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0)); | 1189 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0)); |
1190 reader->AddBackRef(object_id, &result, kIsDeserialized); | 1190 reader->AddBackRef(object_id, &result, kIsDeserialized); |
1191 | 1191 |
1192 result.set_compile_timestamp(reader->Read<int64_t>()); | 1192 result.set_compile_timestamp(reader->Read<int64_t>()); |
1193 result.set_state_bits(reader->Read<int32_t>()); | 1193 result.set_state_bits(reader->Read<int32_t>()); |
| 1194 result.set_entry_patch_pc_offset(reader->Read<int32_t>()); |
| 1195 result.set_patch_code_pc_offset(reader->Read<int32_t>()); |
1194 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>()); | 1196 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>()); |
1195 | 1197 |
1196 // Set all the object fields. | 1198 // Set all the object fields. |
1197 READ_OBJECT_FIELDS(result, | 1199 READ_OBJECT_FIELDS(result, |
1198 result.raw()->from(), result.raw()->to(), | 1200 result.raw()->from(), result.raw()->to(), |
1199 kAsReference); | 1201 kAsReference); |
1200 | 1202 |
1201 // TODO(rmacnak): Fix entry_point_. | 1203 // TODO(rmacnak): Fix entry_point_. |
1202 | 1204 |
1203 return result.raw(); | 1205 return result.raw(); |
(...skipping 16 matching lines...) Expand all Loading... |
1220 // Write out the serialization header value for this object. | 1222 // Write out the serialization header value for this object. |
1221 writer->WriteInlinedObjectHeader(object_id); | 1223 writer->WriteInlinedObjectHeader(object_id); |
1222 | 1224 |
1223 // Write out the class and tags information. | 1225 // Write out the class and tags information. |
1224 writer->WriteVMIsolateObject(kCodeCid); | 1226 writer->WriteVMIsolateObject(kCodeCid); |
1225 writer->WriteTags(writer->GetObjectTags(this)); | 1227 writer->WriteTags(writer->GetObjectTags(this)); |
1226 | 1228 |
1227 // Write out all the non object fields. | 1229 // Write out all the non object fields. |
1228 writer->Write<int64_t>(ptr()->compile_timestamp_); | 1230 writer->Write<int64_t>(ptr()->compile_timestamp_); |
1229 writer->Write<int32_t>(ptr()->state_bits_); | 1231 writer->Write<int32_t>(ptr()->state_bits_); |
| 1232 writer->Write<int32_t>(ptr()->entry_patch_pc_offset_); |
| 1233 writer->Write<int32_t>(ptr()->patch_code_pc_offset_); |
1230 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); | 1234 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); |
1231 | 1235 |
1232 // Write out all the object pointer fields. | 1236 // Write out all the object pointer fields. |
1233 SnapshotWriterVisitor visitor(writer); | 1237 SnapshotWriterVisitor visitor(writer); |
1234 visitor.VisitPointers(from(), to()); | 1238 visitor.VisitPointers(from(), to()); |
1235 | 1239 |
1236 writer->SetInstructionsCode(ptr()->instructions_, this); | 1240 writer->SetInstructionsCode(ptr()->instructions_, this); |
1237 } | 1241 } |
1238 | 1242 |
1239 | 1243 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 | 1280 |
1277 writer->Write<intptr_t>(writer->GetObjectTags(this)); // For sanity check. | 1281 writer->Write<intptr_t>(writer->GetObjectTags(this)); // For sanity check. |
1278 | 1282 |
1279 // Temporarily restore the object header for writing to the text section. | 1283 // Temporarily restore the object header for writing to the text section. |
1280 // TODO(asiva): Don't mutate object headers during serialization. | 1284 // TODO(asiva): Don't mutate object headers during serialization. |
1281 uword object_tags = writer->GetObjectTags(this); | 1285 uword object_tags = writer->GetObjectTags(this); |
1282 uword snapshot_tags = ptr()->tags_; | 1286 uword snapshot_tags = ptr()->tags_; |
1283 ptr()->tags_ = object_tags; | 1287 ptr()->tags_ = object_tags; |
1284 writer->Write<int32_t>(writer->GetInstructionsId(this)); | 1288 writer->Write<int32_t>(writer->GetInstructionsId(this)); |
1285 ptr()->tags_ = snapshot_tags; | 1289 ptr()->tags_ = snapshot_tags; |
| 1290 |
| 1291 { |
| 1292 // TODO(rmacnak): Drop after calling convention change. |
| 1293 writer->WriteObjectImpl(ptr()->code_, kAsReference); |
| 1294 writer->WriteObjectImpl(ptr()->object_pool_, kAsReference); |
| 1295 } |
1286 } | 1296 } |
1287 | 1297 |
1288 | 1298 |
1289 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, | 1299 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, |
1290 intptr_t object_id, | 1300 intptr_t object_id, |
1291 intptr_t tags, | 1301 intptr_t tags, |
1292 Snapshot::Kind kind) { | 1302 Snapshot::Kind kind) { |
1293 ASSERT(reader->snapshot_code()); | 1303 ASSERT(reader->snapshot_code()); |
1294 ASSERT(kind == Snapshot::kFull); | 1304 ASSERT(kind == Snapshot::kFull); |
1295 | 1305 |
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3291 // We do not allow objects with native fields in an isolate message. | 3301 // We do not allow objects with native fields in an isolate message. |
3292 writer->SetWriteException(Exceptions::kArgument, | 3302 writer->SetWriteException(Exceptions::kArgument, |
3293 "Illegal argument in isolate message" | 3303 "Illegal argument in isolate message" |
3294 " : (object is a UserTag)"); | 3304 " : (object is a UserTag)"); |
3295 } else { | 3305 } else { |
3296 UNREACHABLE(); | 3306 UNREACHABLE(); |
3297 } | 3307 } |
3298 } | 3308 } |
3299 | 3309 |
3300 } // namespace dart | 3310 } // namespace dart |
OLD | NEW |