| 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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 | 930 |
| 931 void Trace(Serializer* s, RawObject* object) { | 931 void Trace(Serializer* s, RawObject* object) { |
| 932 RawField* field = Field::RawCast(object); | 932 RawField* field = Field::RawCast(object); |
| 933 objects_.Add(field); | 933 objects_.Add(field); |
| 934 | 934 |
| 935 Snapshot::Kind kind = s->kind(); | 935 Snapshot::Kind kind = s->kind(); |
| 936 | 936 |
| 937 s->Push(field->ptr()->name_); | 937 s->Push(field->ptr()->name_); |
| 938 s->Push(field->ptr()->owner_); | 938 s->Push(field->ptr()->owner_); |
| 939 s->Push(field->ptr()->type_); | 939 s->Push(field->ptr()->type_); |
| 940 s->Push(field->ptr()->kernel_data_); |
| 940 // Write out the initial static value or field offset. | 941 // Write out the initial static value or field offset. |
| 941 if (Field::StaticBit::decode(field->ptr()->kind_bits_)) { | 942 if (Field::StaticBit::decode(field->ptr()->kind_bits_)) { |
| 942 if (kind == Snapshot::kFullAOT) { | 943 if (kind == Snapshot::kFullAOT) { |
| 943 // For precompiled static fields, the value was already reset and | 944 // For precompiled static fields, the value was already reset and |
| 944 // initializer_ now contains a Function. | 945 // initializer_ now contains a Function. |
| 945 s->Push(field->ptr()->value_.static_value_); | 946 s->Push(field->ptr()->value_.static_value_); |
| 946 } else if (Field::ConstBit::decode(field->ptr()->kind_bits_)) { | 947 } else if (Field::ConstBit::decode(field->ptr()->kind_bits_)) { |
| 947 // Do not reset const fields. | 948 // Do not reset const fields. |
| 948 s->Push(field->ptr()->value_.static_value_); | 949 s->Push(field->ptr()->value_.static_value_); |
| 949 } else { | 950 } else { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 980 | 981 |
| 981 void WriteFill(Serializer* s) { | 982 void WriteFill(Serializer* s) { |
| 982 Snapshot::Kind kind = s->kind(); | 983 Snapshot::Kind kind = s->kind(); |
| 983 intptr_t count = objects_.length(); | 984 intptr_t count = objects_.length(); |
| 984 for (intptr_t i = 0; i < count; i++) { | 985 for (intptr_t i = 0; i < count; i++) { |
| 985 RawField* field = objects_[i]; | 986 RawField* field = objects_[i]; |
| 986 | 987 |
| 987 s->WriteRef(field->ptr()->name_); | 988 s->WriteRef(field->ptr()->name_); |
| 988 s->WriteRef(field->ptr()->owner_); | 989 s->WriteRef(field->ptr()->owner_); |
| 989 s->WriteRef(field->ptr()->type_); | 990 s->WriteRef(field->ptr()->type_); |
| 991 s->WriteRef(field->ptr()->kernel_data_); |
| 990 // Write out the initial static value or field offset. | 992 // Write out the initial static value or field offset. |
| 991 if (Field::StaticBit::decode(field->ptr()->kind_bits_)) { | 993 if (Field::StaticBit::decode(field->ptr()->kind_bits_)) { |
| 992 if (kind == Snapshot::kFullAOT) { | 994 if (kind == Snapshot::kFullAOT) { |
| 993 // For precompiled static fields, the value was already reset and | 995 // For precompiled static fields, the value was already reset and |
| 994 // initializer_ now contains a Function. | 996 // initializer_ now contains a Function. |
| 995 s->WriteRef(field->ptr()->value_.static_value_); | 997 s->WriteRef(field->ptr()->value_.static_value_); |
| 996 } else if (Field::ConstBit::decode(field->ptr()->kind_bits_)) { | 998 } else if (Field::ConstBit::decode(field->ptr()->kind_bits_)) { |
| 997 // Do not reset const fields. | 999 // Do not reset const fields. |
| 998 s->WriteRef(field->ptr()->value_.static_value_); | 1000 s->WriteRef(field->ptr()->value_.static_value_); |
| 999 } else { | 1001 } else { |
| (...skipping 4533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5533 thread_->isolate()->SetupImagePage(data_buffer_, | 5535 thread_->isolate()->SetupImagePage(data_buffer_, |
| 5534 /* is_executable */ false); | 5536 /* is_executable */ false); |
| 5535 } | 5537 } |
| 5536 | 5538 |
| 5537 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); | 5539 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
| 5538 | 5540 |
| 5539 return ApiError::null(); | 5541 return ApiError::null(); |
| 5540 } | 5542 } |
| 5541 | 5543 |
| 5542 } // namespace dart | 5544 } // namespace dart |
| OLD | NEW |