| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 } else if (s->kind() == Snapshot::kFullJIT) { | 544 } else if (s->kind() == Snapshot::kFullJIT) { |
| 545 NOT_IN_PRECOMPILED(s->WriteRef(func->ptr()->unoptimized_code_)); | 545 NOT_IN_PRECOMPILED(s->WriteRef(func->ptr()->unoptimized_code_)); |
| 546 s->WriteRef(func->ptr()->code_); | 546 s->WriteRef(func->ptr()->code_); |
| 547 s->WriteRef(func->ptr()->ic_data_array_); | 547 s->WriteRef(func->ptr()->ic_data_array_); |
| 548 } | 548 } |
| 549 | 549 |
| 550 #if !defined(DART_PRECOMPILED_RUNTIME) | 550 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 551 if (kind != Snapshot::kFullAOT) { | 551 if (kind != Snapshot::kFullAOT) { |
| 552 s->WriteTokenPosition(func->ptr()->token_pos_); | 552 s->WriteTokenPosition(func->ptr()->token_pos_); |
| 553 s->WriteTokenPosition(func->ptr()->end_token_pos_); | 553 s->WriteTokenPosition(func->ptr()->end_token_pos_); |
| 554 s->Write<int32_t>(func->ptr()->kernel_offset_); |
| 554 } | 555 } |
| 555 #endif | 556 #endif |
| 556 s->Write<int16_t>(func->ptr()->num_fixed_parameters_); | 557 s->Write<int16_t>(func->ptr()->num_fixed_parameters_); |
| 557 s->Write<int16_t>(func->ptr()->num_optional_parameters_); | 558 s->Write<int16_t>(func->ptr()->num_optional_parameters_); |
| 558 s->Write<uint32_t>(func->ptr()->kind_tag_); | 559 s->Write<uint32_t>(func->ptr()->kind_tag_); |
| 559 if (kind == Snapshot::kFullAOT) { | 560 if (kind == Snapshot::kFullAOT) { |
| 560 // Omit fields used to support de/reoptimization. | 561 // Omit fields used to support de/reoptimization. |
| 561 } else if (!Snapshot::IncludesCode(kind)) { | 562 } else if (!Snapshot::IncludesCode(kind)) { |
| 562 #if !defined(DART_PRECOMPILED_RUNTIME) | 563 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 563 bool is_optimized = Code::IsOptimized(func->ptr()->code_); | 564 bool is_optimized = Code::IsOptimized(func->ptr()->code_); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 } | 619 } |
| 619 | 620 |
| 620 #if defined(DEBUG) | 621 #if defined(DEBUG) |
| 621 func->ptr()->entry_point_ = 0; | 622 func->ptr()->entry_point_ = 0; |
| 622 #endif | 623 #endif |
| 623 | 624 |
| 624 #if !defined(DART_PRECOMPILED_RUNTIME) | 625 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 625 if (kind != Snapshot::kFullAOT) { | 626 if (kind != Snapshot::kFullAOT) { |
| 626 func->ptr()->token_pos_ = d->ReadTokenPosition(); | 627 func->ptr()->token_pos_ = d->ReadTokenPosition(); |
| 627 func->ptr()->end_token_pos_ = d->ReadTokenPosition(); | 628 func->ptr()->end_token_pos_ = d->ReadTokenPosition(); |
| 629 func->ptr()->kernel_offset_ = d->Read<int32_t>(); |
| 628 } | 630 } |
| 629 #endif | 631 #endif |
| 630 func->ptr()->num_fixed_parameters_ = d->Read<int16_t>(); | 632 func->ptr()->num_fixed_parameters_ = d->Read<int16_t>(); |
| 631 func->ptr()->num_optional_parameters_ = d->Read<int16_t>(); | 633 func->ptr()->num_optional_parameters_ = d->Read<int16_t>(); |
| 632 func->ptr()->kind_tag_ = d->Read<uint32_t>(); | 634 func->ptr()->kind_tag_ = d->Read<uint32_t>(); |
| 633 if (kind == Snapshot::kFullAOT) { | 635 if (kind == Snapshot::kFullAOT) { |
| 634 // Omit fields used to support de/reoptimization. | 636 // Omit fields used to support de/reoptimization. |
| 635 } else { | 637 } else { |
| 636 #if !defined(DART_PRECOMPILED_RUNTIME) | 638 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 637 if (Snapshot::IncludesCode(kind)) { | 639 if (Snapshot::IncludesCode(kind)) { |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 s->WriteRef(field->ptr()->guarded_list_length_); | 1018 s->WriteRef(field->ptr()->guarded_list_length_); |
| 1017 } | 1019 } |
| 1018 if (kind == Snapshot::kFullJIT) { | 1020 if (kind == Snapshot::kFullJIT) { |
| 1019 s->WriteRef(field->ptr()->dependent_code_); | 1021 s->WriteRef(field->ptr()->dependent_code_); |
| 1020 } | 1022 } |
| 1021 | 1023 |
| 1022 if (kind != Snapshot::kFullAOT) { | 1024 if (kind != Snapshot::kFullAOT) { |
| 1023 s->WriteTokenPosition(field->ptr()->token_pos_); | 1025 s->WriteTokenPosition(field->ptr()->token_pos_); |
| 1024 s->WriteCid(field->ptr()->guarded_cid_); | 1026 s->WriteCid(field->ptr()->guarded_cid_); |
| 1025 s->WriteCid(field->ptr()->is_nullable_); | 1027 s->WriteCid(field->ptr()->is_nullable_); |
| 1028 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1029 s->Write<int32_t>(field->ptr()->kernel_offset_); |
| 1030 #endif |
| 1026 } | 1031 } |
| 1027 s->Write<uint8_t>(field->ptr()->kind_bits_); | 1032 s->Write<uint8_t>(field->ptr()->kind_bits_); |
| 1028 } | 1033 } |
| 1029 } | 1034 } |
| 1030 | 1035 |
| 1031 private: | 1036 private: |
| 1032 GrowableArray<RawField*> objects_; | 1037 GrowableArray<RawField*> objects_; |
| 1033 }; | 1038 }; |
| 1034 #endif // !DART_PRECOMPILED_RUNTIME | 1039 #endif // !DART_PRECOMPILED_RUNTIME |
| 1035 | 1040 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1063 *p = d->ReadRef(); | 1068 *p = d->ReadRef(); |
| 1064 } | 1069 } |
| 1065 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 1070 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
| 1066 *p = Object::null(); | 1071 *p = Object::null(); |
| 1067 } | 1072 } |
| 1068 | 1073 |
| 1069 if (kind != Snapshot::kFullAOT) { | 1074 if (kind != Snapshot::kFullAOT) { |
| 1070 field->ptr()->token_pos_ = d->ReadTokenPosition(); | 1075 field->ptr()->token_pos_ = d->ReadTokenPosition(); |
| 1071 field->ptr()->guarded_cid_ = d->ReadCid(); | 1076 field->ptr()->guarded_cid_ = d->ReadCid(); |
| 1072 field->ptr()->is_nullable_ = d->ReadCid(); | 1077 field->ptr()->is_nullable_ = d->ReadCid(); |
| 1078 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1079 field->ptr()->kernel_offset_ = d->Read<int32_t>(); |
| 1080 #endif |
| 1073 } | 1081 } |
| 1074 field->ptr()->kind_bits_ = d->Read<uint8_t>(); | 1082 field->ptr()->kind_bits_ = d->Read<uint8_t>(); |
| 1075 } | 1083 } |
| 1076 } | 1084 } |
| 1077 | 1085 |
| 1078 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { | 1086 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { |
| 1079 NOT_IN_PRODUCT(TimelineDurationScope tds( | 1087 NOT_IN_PRODUCT(TimelineDurationScope tds( |
| 1080 Thread::Current(), Timeline::GetIsolateStream(), "PostLoadField")); | 1088 Thread::Current(), Timeline::GetIsolateStream(), "PostLoadField")); |
| 1081 | 1089 |
| 1082 Field& field = Field::Handle(zone); | 1090 Field& field = Field::Handle(zone); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 RawScript* script = objects_[i]; | 1294 RawScript* script = objects_[i]; |
| 1287 RawObject** from = script->from(); | 1295 RawObject** from = script->from(); |
| 1288 RawObject** to = script->to_snapshot(kind); | 1296 RawObject** to = script->to_snapshot(kind); |
| 1289 for (RawObject** p = from; p <= to; p++) { | 1297 for (RawObject** p = from; p <= to; p++) { |
| 1290 s->WriteRef(*p); | 1298 s->WriteRef(*p); |
| 1291 } | 1299 } |
| 1292 | 1300 |
| 1293 s->Write<int32_t>(script->ptr()->line_offset_); | 1301 s->Write<int32_t>(script->ptr()->line_offset_); |
| 1294 s->Write<int32_t>(script->ptr()->col_offset_); | 1302 s->Write<int32_t>(script->ptr()->col_offset_); |
| 1295 s->Write<int8_t>(script->ptr()->kind_); | 1303 s->Write<int8_t>(script->ptr()->kind_); |
| 1304 s->Write<int32_t>(script->ptr()->kernel_script_index_); |
| 1296 } | 1305 } |
| 1297 } | 1306 } |
| 1298 | 1307 |
| 1299 private: | 1308 private: |
| 1300 GrowableArray<RawScript*> objects_; | 1309 GrowableArray<RawScript*> objects_; |
| 1301 }; | 1310 }; |
| 1302 #endif // !DART_PRECOMPILED_RUNTIME | 1311 #endif // !DART_PRECOMPILED_RUNTIME |
| 1303 | 1312 |
| 1304 class ScriptDeserializationCluster : public DeserializationCluster { | 1313 class ScriptDeserializationCluster : public DeserializationCluster { |
| 1305 public: | 1314 public: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1330 for (RawObject** p = from; p <= to_snapshot; p++) { | 1339 for (RawObject** p = from; p <= to_snapshot; p++) { |
| 1331 *p = d->ReadRef(); | 1340 *p = d->ReadRef(); |
| 1332 } | 1341 } |
| 1333 for (RawObject** p = to_snapshot + 1; p <= to; p++) { | 1342 for (RawObject** p = to_snapshot + 1; p <= to; p++) { |
| 1334 *p = Object::null(); | 1343 *p = Object::null(); |
| 1335 } | 1344 } |
| 1336 | 1345 |
| 1337 script->ptr()->line_offset_ = d->Read<int32_t>(); | 1346 script->ptr()->line_offset_ = d->Read<int32_t>(); |
| 1338 script->ptr()->col_offset_ = d->Read<int32_t>(); | 1347 script->ptr()->col_offset_ = d->Read<int32_t>(); |
| 1339 script->ptr()->kind_ = d->Read<int8_t>(); | 1348 script->ptr()->kind_ = d->Read<int8_t>(); |
| 1349 script->ptr()->kernel_script_index_ = d->Read<int32_t>(); |
| 1340 script->ptr()->load_timestamp_ = 0; | 1350 script->ptr()->load_timestamp_ = 0; |
| 1341 } | 1351 } |
| 1342 } | 1352 } |
| 1343 }; | 1353 }; |
| 1344 | 1354 |
| 1345 #if !defined(DART_PRECOMPILED_RUNTIME) | 1355 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1346 class LibrarySerializationCluster : public SerializationCluster { | 1356 class LibrarySerializationCluster : public SerializationCluster { |
| 1347 public: | 1357 public: |
| 1348 LibrarySerializationCluster() {} | 1358 LibrarySerializationCluster() {} |
| 1349 virtual ~LibrarySerializationCluster() {} | 1359 virtual ~LibrarySerializationCluster() {} |
| (...skipping 4181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5531 thread_->isolate()->SetupImagePage(data_buffer_, | 5541 thread_->isolate()->SetupImagePage(data_buffer_, |
| 5532 /* is_executable */ false); | 5542 /* is_executable */ false); |
| 5533 } | 5543 } |
| 5534 | 5544 |
| 5535 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); | 5545 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
| 5536 | 5546 |
| 5537 return ApiError::null(); | 5547 return ApiError::null(); |
| 5538 } | 5548 } |
| 5539 | 5549 |
| 5540 } // namespace dart | 5550 } // namespace dart |
| OLD | NEW |