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 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2716 } else { | 2716 } else { |
2717 objects_.Add(type); | 2717 objects_.Add(type); |
2718 } | 2718 } |
2719 | 2719 |
2720 RawObject** from = type->from(); | 2720 RawObject** from = type->from(); |
2721 RawObject** to = type->to(); | 2721 RawObject** to = type->to(); |
2722 for (RawObject** p = from; p <= to; p++) { | 2722 for (RawObject** p = from; p <= to; p++) { |
2723 s->Push(*p); | 2723 s->Push(*p); |
2724 } | 2724 } |
2725 | 2725 |
| 2726 if (type->ptr()->type_class_id_->IsHeapObject()) { |
| 2727 // Type class is still an unresolved class. |
| 2728 UNREACHABLE(); |
| 2729 } |
| 2730 |
2726 RawSmi* raw_type_class_id = Smi::RawCast(type->ptr()->type_class_id_); | 2731 RawSmi* raw_type_class_id = Smi::RawCast(type->ptr()->type_class_id_); |
2727 RawClass* type_class = | 2732 RawClass* type_class = |
2728 s->isolate()->class_table()->At(Smi::Value(raw_type_class_id)); | 2733 s->isolate()->class_table()->At(Smi::Value(raw_type_class_id)); |
2729 s->Push(type_class); | 2734 s->Push(type_class); |
2730 } | 2735 } |
2731 | 2736 |
2732 void WriteAlloc(Serializer* s) { | 2737 void WriteAlloc(Serializer* s) { |
2733 s->WriteCid(kTypeCid); | 2738 s->WriteCid(kTypeCid); |
2734 intptr_t count = canonical_objects_.length(); | 2739 intptr_t count = canonical_objects_.length(); |
2735 s->Write<int32_t>(count); | 2740 s->Write<int32_t>(count); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2947 for (intptr_t i = 0; i < count; i++) { | 2952 for (intptr_t i = 0; i < count; i++) { |
2948 RawTypeParameter* type = objects_[i]; | 2953 RawTypeParameter* type = objects_[i]; |
2949 RawObject** from = type->from(); | 2954 RawObject** from = type->from(); |
2950 RawObject** to = type->to(); | 2955 RawObject** to = type->to(); |
2951 for (RawObject** p = from; p <= to; p++) { | 2956 for (RawObject** p = from; p <= to; p++) { |
2952 s->WriteRef(*p); | 2957 s->WriteRef(*p); |
2953 } | 2958 } |
2954 s->Write<int32_t>(type->ptr()->parameterized_class_id_); | 2959 s->Write<int32_t>(type->ptr()->parameterized_class_id_); |
2955 s->WriteTokenPosition(type->ptr()->token_pos_); | 2960 s->WriteTokenPosition(type->ptr()->token_pos_); |
2956 s->Write<int16_t>(type->ptr()->index_); | 2961 s->Write<int16_t>(type->ptr()->index_); |
| 2962 s->Write<uint8_t>(type->ptr()->parent_level_); |
2957 s->Write<int8_t>(type->ptr()->type_state_); | 2963 s->Write<int8_t>(type->ptr()->type_state_); |
2958 } | 2964 } |
2959 } | 2965 } |
2960 | 2966 |
2961 private: | 2967 private: |
2962 GrowableArray<RawTypeParameter*> objects_; | 2968 GrowableArray<RawTypeParameter*> objects_; |
2963 }; | 2969 }; |
2964 #endif // !DART_PRECOMPILED_RUNTIME | 2970 #endif // !DART_PRECOMPILED_RUNTIME |
2965 | 2971 |
2966 | 2972 |
(...skipping 22 matching lines...) Expand all Loading... |
2989 TypeParameter::InstanceSize(), | 2995 TypeParameter::InstanceSize(), |
2990 is_vm_object); | 2996 is_vm_object); |
2991 RawObject** from = type->from(); | 2997 RawObject** from = type->from(); |
2992 RawObject** to = type->to(); | 2998 RawObject** to = type->to(); |
2993 for (RawObject** p = from; p <= to; p++) { | 2999 for (RawObject** p = from; p <= to; p++) { |
2994 *p = d->ReadRef(); | 3000 *p = d->ReadRef(); |
2995 } | 3001 } |
2996 type->ptr()->parameterized_class_id_ = d->Read<int32_t>(); | 3002 type->ptr()->parameterized_class_id_ = d->Read<int32_t>(); |
2997 type->ptr()->token_pos_ = d->ReadTokenPosition(); | 3003 type->ptr()->token_pos_ = d->ReadTokenPosition(); |
2998 type->ptr()->index_ = d->Read<int16_t>(); | 3004 type->ptr()->index_ = d->Read<int16_t>(); |
| 3005 type->ptr()->parent_level_ = d->Read<uint8_t>(); |
2999 type->ptr()->type_state_ = d->Read<int8_t>(); | 3006 type->ptr()->type_state_ = d->Read<int8_t>(); |
3000 } | 3007 } |
3001 } | 3008 } |
3002 }; | 3009 }; |
3003 | 3010 |
3004 | 3011 |
3005 #if !defined(DART_PRECOMPILED_RUNTIME) | 3012 #if !defined(DART_PRECOMPILED_RUNTIME) |
3006 class BoundedTypeSerializationCluster : public SerializationCluster { | 3013 class BoundedTypeSerializationCluster : public SerializationCluster { |
3007 public: | 3014 public: |
3008 BoundedTypeSerializationCluster() { } | 3015 BoundedTypeSerializationCluster() { } |
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5120 | 5127 |
5121 deserializer.ReadVMSnapshot(); | 5128 deserializer.ReadVMSnapshot(); |
5122 | 5129 |
5123 Dart::set_instructions_snapshot_buffer(instructions_buffer_); | 5130 Dart::set_instructions_snapshot_buffer(instructions_buffer_); |
5124 Dart::set_data_snapshot_buffer(data_buffer_); | 5131 Dart::set_data_snapshot_buffer(data_buffer_); |
5125 | 5132 |
5126 return ApiError::null(); | 5133 return ApiError::null(); |
5127 } | 5134 } |
5128 | 5135 |
5129 } // namespace dart | 5136 } // namespace dart |
OLD | NEW |