@@ -3014,8 +3014,7 @@ class LibraryPrefixDeserializationCluster : public DeserializationCluster {
3014
3014
#if !defined(DART_PRECOMPILED_RUNTIME)
3015
3015
class TypeSerializationCluster : public SerializationCluster {
3016
3016
public:
3017
- explicit TypeSerializationCluster (const TypeTestingStubFinder& ttsf)
3018
- : SerializationCluster(" Type" ), type_testing_stubs_(ttsf) {}
3017
+ TypeSerializationCluster () : SerializationCluster(" Type" ) {}
3019
3018
virtual ~TypeSerializationCluster () {}
3020
3019
3021
3020
void Trace (Serializer* s, RawObject* object) {
@@ -3070,12 +3069,6 @@ class TypeSerializationCluster : public SerializationCluster {
3070
3069
}
3071
3070
s->WriteTokenPosition (type->ptr ()->token_pos_ );
3072
3071
s->Write <int8_t >(type->ptr ()->type_state_ );
3073
- if (s->kind () == Snapshot::kFullAOT ) {
3074
- RawInstructions* instr = type_testing_stubs_.LookupByAddresss (
3075
- type->ptr ()->type_test_stub_entry_point_ );
3076
- const int32_t text_offset = s->GetTextOffset (instr, Code::null ());
3077
- s->Write <int32_t >(text_offset);
3078
- }
3079
3072
}
3080
3073
count = objects_.length ();
3081
3074
for (intptr_t i = 0 ; i < count; i++) {
@@ -3087,35 +3080,18 @@ class TypeSerializationCluster : public SerializationCluster {
3087
3080
}
3088
3081
s->WriteTokenPosition (type->ptr ()->token_pos_ );
3089
3082
s->Write <int8_t >(type->ptr ()->type_state_ );
3090
- if (s->kind () == Snapshot::kFullAOT ) {
3091
- RawInstructions* instr = type_testing_stubs_.LookupByAddresss (
3092
- type->ptr ()->type_test_stub_entry_point_ );
3093
- const int32_t text_offset = s->GetTextOffset (instr, Code::null ());
3094
- s->Write <int32_t >(text_offset);
3095
- }
3096
- }
3097
-
3098
- // The [Type::dynamic_type()] object is not serialized, so we manually send
3099
- // the type testing stub for it.
3100
- if (s->kind () == Snapshot::kFullAOT && s->for_vm_isolate ()) {
3101
- RawInstructions* instr = type_testing_stubs_.LookupByAddresss (
3102
- Type::dynamic_type ().type_test_stub_entry_point ());
3103
- const int32_t text_offset = s->GetTextOffset (instr, Code::null ());
3104
- s->Write <int32_t >(text_offset);
3105
3083
}
3106
3084
}
3107
3085
3108
3086
private:
3109
3087
GrowableArray<RawType*> canonical_objects_;
3110
3088
GrowableArray<RawType*> objects_;
3111
- const TypeTestingStubFinder& type_testing_stubs_;
3112
3089
};
3113
3090
#endif // !DART_PRECOMPILED_RUNTIME
3114
3091
3115
3092
class TypeDeserializationCluster : public DeserializationCluster {
3116
3093
public:
3117
- TypeDeserializationCluster ()
3118
- : type_(AbstractType::Handle()), instr_(Instructions::Handle()) {}
3094
+ TypeDeserializationCluster () {}
3119
3095
virtual ~TypeDeserializationCluster () {}
3120
3096
3121
3097
void ReadAlloc (Deserializer* d) {
@@ -3150,12 +3126,6 @@ class TypeDeserializationCluster : public DeserializationCluster {
3150
3126
}
3151
3127
type->ptr ()->token_pos_ = d->ReadTokenPosition ();
3152
3128
type->ptr ()->type_state_ = d->Read <int8_t >();
3153
- if (d->kind () == Snapshot::kFullAOT ) {
3154
- const int32_t text_offset = d->Read <int32_t >();
3155
- instr_ = d->GetInstructionsAt (text_offset);
3156
- type_ = type;
3157
- type_.SetTypeTestingStub (instr_);
3158
- }
3159
3129
}
3160
3130
3161
3131
for (intptr_t id = start_index_; id < stop_index_; id++) {
@@ -3169,53 +3139,18 @@ class TypeDeserializationCluster : public DeserializationCluster {
3169
3139
}
3170
3140
type->ptr ()->token_pos_ = d->ReadTokenPosition ();
3171
3141
type->ptr ()->type_state_ = d->Read <int8_t >();
3172
- if (d->kind () == Snapshot::kFullAOT ) {
3173
- const int32_t text_offset = d->Read <int32_t >();
3174
- instr_ = d->GetInstructionsAt (text_offset);
3175
- type_ = type;
3176
- type_.SetTypeTestingStub (instr_);
3177
- }
3178
- }
3179
-
3180
- // The [Type::dynamic_type()] object is not serialized, so we manually send
3181
- // the type testing stub for it.
3182
- if (d->kind () == Snapshot::kFullAOT && d->for_vm_isolate ()) {
3183
- const int32_t text_offset = d->Read <int32_t >();
3184
- Dart::vm_isolate ()->heap ()->WriteProtect (false );
3185
- instr_ = d->GetInstructionsAt (text_offset);
3186
- Type::dynamic_type ().SetTypeTestingStub (instr_);
3187
- Dart::vm_isolate ()->heap ()->WriteProtect (true );
3188
- }
3189
- }
3190
-
3191
- void PostLoad (const Array& refs, Snapshot::Kind kind, Zone* zone) {
3192
- if (kind != Snapshot::kFullAOT ) {
3193
- for (intptr_t id = canonical_start_index_; id < canonical_stop_index_;
3194
- id++) {
3195
- type_ ^= refs.At (id);
3196
- instr_ = TypeTestingStubGenerator::DefaultCodeForType (type_);
3197
- type_.SetTypeTestingStub (instr_);
3198
- }
3199
- for (intptr_t id = start_index_; id < stop_index_; id++) {
3200
- type_ ^= refs.At (id);
3201
- instr_ = TypeTestingStubGenerator::DefaultCodeForType (type_);
3202
- type_.SetTypeTestingStub (instr_);
3203
- }
3204
3142
}
3205
3143
}
3206
3144
3207
3145
private:
3208
3146
intptr_t canonical_start_index_;
3209
3147
intptr_t canonical_stop_index_;
3210
- AbstractType& type_;
3211
- Instructions& instr_;
3212
3148
};
3213
3149
3214
3150
#if !defined(DART_PRECOMPILED_RUNTIME)
3215
3151
class TypeRefSerializationCluster : public SerializationCluster {
3216
3152
public:
3217
- explicit TypeRefSerializationCluster (const TypeTestingStubFinder& ttsf)
3218
- : SerializationCluster(" TypeRef" ), type_testing_stubs_(ttsf) {}
3153
+ TypeRefSerializationCluster () : SerializationCluster(" TypeRef" ) {}
3219
3154
virtual ~TypeRefSerializationCluster () {}
3220
3155
3221
3156
void Trace (Serializer* s, RawObject* object) {
@@ -3248,25 +3183,17 @@ class TypeRefSerializationCluster : public SerializationCluster {
3248
3183
for (RawObject** p = from; p <= to; p++) {
3249
3184
s->WriteRef (*p);
3250
3185
}
3251
- if (s->kind () == Snapshot::kFullAOT ) {
3252
- RawInstructions* instr = type_testing_stubs_.LookupByAddresss (
3253
- type->ptr ()->type_test_stub_entry_point_ );
3254
- const int32_t text_offset = s->GetTextOffset (instr, Code::null ());
3255
- s->Write <int32_t >(text_offset);
3256
- }
3257
3186
}
3258
3187
}
3259
3188
3260
3189
private:
3261
3190
GrowableArray<RawTypeRef*> objects_;
3262
- const TypeTestingStubFinder& type_testing_stubs_;
3263
3191
};
3264
3192
#endif // !DART_PRECOMPILED_RUNTIME
3265
3193
3266
3194
class TypeRefDeserializationCluster : public DeserializationCluster {
3267
3195
public:
3268
- TypeRefDeserializationCluster ()
3269
- : type_(AbstractType::Handle()), instr_(Instructions::Handle()) {}
3196
+ TypeRefDeserializationCluster () {}
3270
3197
virtual ~TypeRefDeserializationCluster () {}
3271
3198
3272
3199
void ReadAlloc (Deserializer* d) {
@@ -3291,26 +3218,14 @@ class TypeRefDeserializationCluster : public DeserializationCluster {
3291
3218
for (RawObject** p = from; p <= to; p++) {
3292
3219
*p = d->ReadRef ();
3293
3220
}
3294
- if (d->kind () == Snapshot::kFullAOT ) {
3295
- const int32_t text_offset = d->Read <int32_t >();
3296
- instr_ = d->GetInstructionsAt (text_offset);
3297
- type_ = type;
3298
- type_.SetTypeTestingStub (instr_);
3299
- }
3300
3221
}
3301
3222
}
3302
-
3303
- private:
3304
- AbstractType& type_;
3305
- Instructions& instr_;
3306
3223
};
3307
3224
3308
3225
#if !defined(DART_PRECOMPILED_RUNTIME)
3309
3226
class TypeParameterSerializationCluster : public SerializationCluster {
3310
3227
public:
3311
- explicit TypeParameterSerializationCluster (const TypeTestingStubFinder& ttsf)
3312
- : SerializationCluster(" TypeParameter" ), type_testing_stubs_(ttsf) {}
3313
-
3228
+ TypeParameterSerializationCluster () : SerializationCluster(" TypeParameter" ) {}
3314
3229
virtual ~TypeParameterSerializationCluster () {}
3315
3230
3316
3231
void Trace (Serializer* s, RawObject* object) {
@@ -3348,25 +3263,17 @@ class TypeParameterSerializationCluster : public SerializationCluster {
3348
3263
s->WriteTokenPosition (type->ptr ()->token_pos_ );
3349
3264
s->Write <int16_t >(type->ptr ()->index_ );
3350
3265
s->Write <int8_t >(type->ptr ()->type_state_ );
3351
- if (s->kind () == Snapshot::kFullAOT ) {
3352
- RawInstructions* instr = type_testing_stubs_.LookupByAddresss (
3353
- type->ptr ()->type_test_stub_entry_point_ );
3354
- const int32_t text_offset = s->GetTextOffset (instr, Code::null ());
3355
- s->Write <int32_t >(text_offset);
3356
- }
3357
3266
}
3358
3267
}
3359
3268
3360
3269
private:
3361
3270
GrowableArray<RawTypeParameter*> objects_;
3362
- const TypeTestingStubFinder& type_testing_stubs_;
3363
3271
};
3364
3272
#endif // !DART_PRECOMPILED_RUNTIME
3365
3273
3366
3274
class TypeParameterDeserializationCluster : public DeserializationCluster {
3367
3275
public:
3368
- TypeParameterDeserializationCluster ()
3369
- : type_(AbstractType::Handle()), instr_(Instructions::Handle()) {}
3276
+ TypeParameterDeserializationCluster () {}
3370
3277
virtual ~TypeParameterDeserializationCluster () {}
3371
3278
3372
3279
void ReadAlloc (Deserializer* d) {
@@ -3396,28 +3303,8 @@ class TypeParameterDeserializationCluster : public DeserializationCluster {
3396
3303
type->ptr ()->token_pos_ = d->ReadTokenPosition ();
3397
3304
type->ptr ()->index_ = d->Read <int16_t >();
3398
3305
type->ptr ()->type_state_ = d->Read <int8_t >();
3399
- if (d->kind () == Snapshot::kFullAOT ) {
3400
- const int32_t text_offset = d->Read <int32_t >();
3401
- instr_ = d->GetInstructionsAt (text_offset);
3402
- type_ = type;
3403
- type_.SetTypeTestingStub (instr_);
3404
- }
3405
- }
3406
- }
3407
-
3408
- void PostLoad (const Array& refs, Snapshot::Kind kind, Zone* zone) {
3409
- if (kind != Snapshot::kFullAOT ) {
3410
- for (intptr_t id = start_index_; id < stop_index_; id++) {
3411
- type_ ^= refs.At (id);
3412
- instr_ = TypeTestingStubGenerator::DefaultCodeForType (type_);
3413
- type_.SetTypeTestingStub (instr_);
3414
- }
3415
3306
}
3416
3307
}
3417
-
3418
- private:
3419
- AbstractType& type_;
3420
- Instructions& instr_;
3421
3308
};
3422
3309
3423
3310
#if !defined(DART_PRECOMPILED_RUNTIME)
@@ -4669,8 +4556,7 @@ Serializer::Serializer(Thread* thread,
4669
4556
uint8_t ** buffer,
4670
4557
ReAlloc alloc,
4671
4558
intptr_t initial_size,
4672
- ImageWriter* image_writer,
4673
- bool vm_isolate)
4559
+ ImageWriter* image_writer)
4674
4560
: StackResource(thread),
4675
4561
heap_ (thread->isolate ()->heap()),
4676
4562
zone_(thread->zone ()),
@@ -4682,8 +4568,7 @@ Serializer::Serializer(Thread* thread,
4682
4568
num_cids_(0 ),
4683
4569
num_base_objects_(0 ),
4684
4570
num_written_objects_(0 ),
4685
- next_ref_index_(1 ),
4686
- vm_isolate_(vm_isolate)
4571
+ next_ref_index_(1 )
4687
4572
#if defined(SNAPSHOT_BACKTRACE)
4688
4573
,
4689
4574
current_parent_ (Object::null()),
@@ -4783,11 +4668,11 @@ SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) {
4783
4668
case kLibraryPrefixCid :
4784
4669
return new (Z) LibraryPrefixSerializationCluster ();
4785
4670
case kTypeCid :
4786
- return new (Z) TypeSerializationCluster (type_testing_stubs_ );
4671
+ return new (Z) TypeSerializationCluster ();
4787
4672
case kTypeRefCid :
4788
- return new (Z) TypeRefSerializationCluster (type_testing_stubs_ );
4673
+ return new (Z) TypeRefSerializationCluster ();
4789
4674
case kTypeParameterCid :
4790
- return new (Z) TypeParameterSerializationCluster (type_testing_stubs_ );
4675
+ return new (Z) TypeParameterSerializationCluster ();
4791
4676
case kBoundedTypeCid :
4792
4677
return new (Z) BoundedTypeSerializationCluster ();
4793
4678
case kClosureCid :
@@ -5235,8 +5120,7 @@ Deserializer::Deserializer(Thread* thread,
5235
5120
const uint8_t * buffer,
5236
5121
intptr_t size,
5237
5122
const uint8_t * instructions_buffer,
5238
- const uint8_t * data_buffer,
5239
- bool vm_isolate)
5123
+ const uint8_t * data_buffer)
5240
5124
: StackResource(thread),
5241
5125
heap_(thread->isolate ()->heap()),
5242
5126
zone_(thread->zone ()),
@@ -5245,8 +5129,7 @@ Deserializer::Deserializer(Thread* thread,
5245
5129
image_reader_(NULL ),
5246
5130
refs_(NULL ),
5247
5131
next_ref_index_(1 ),
5248
- clusters_(NULL ),
5249
- vm_isolate_(vm_isolate) {
5132
+ clusters_(NULL ) {
5250
5133
if (Snapshot::IncludesCode (kind)) {
5251
5134
ASSERT (instructions_buffer != NULL );
5252
5135
ASSERT (data_buffer != NULL );
@@ -5833,8 +5716,7 @@ intptr_t FullSnapshotWriter::WriteVMSnapshot() {
5833
5716
5834
5717
ASSERT (vm_snapshot_data_buffer_ != NULL );
5835
5718
Serializer serializer (thread (), kind_, vm_snapshot_data_buffer_, alloc_,
5836
- kInitialSize , vm_image_writer_,
5837
- /* vm_isolate=*/ true );
5719
+ kInitialSize , vm_image_writer_);
5838
5720
5839
5721
serializer.ReserveHeader ();
5840
5722
serializer.WriteVersionAndFeatures (true );
@@ -5864,8 +5746,7 @@ void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) {
5864
5746
thread (), Timeline::GetIsolateStream (), " WriteIsolateSnapshot" ));
5865
5747
5866
5748
Serializer serializer (thread (), kind_, isolate_snapshot_data_buffer_, alloc_,
5867
- kInitialSize , isolate_image_writer_,
5868
- /* vm_isolate=*/ false );
5749
+ kInitialSize , isolate_image_writer_);
5869
5750
ObjectStore* object_store = isolate ()->object_store ();
5870
5751
ASSERT (object_store != NULL );
5871
5752
@@ -5935,8 +5816,7 @@ FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot,
5935
5816
5936
5817
RawApiError* FullSnapshotReader::ReadVMSnapshot () {
5937
5818
Deserializer deserializer (thread_, kind_, buffer_, size_,
5938
- instructions_buffer_, data_buffer_,
5939
- /* vm_isolate=*/ true );
5819
+ instructions_buffer_, data_buffer_);
5940
5820
5941
5821
RawApiError* error = deserializer.VerifyVersionAndFeatures (/* isolate=*/ NULL );
5942
5822
if (error != ApiError::null ()) {
@@ -5960,8 +5840,7 @@ RawApiError* FullSnapshotReader::ReadVMSnapshot() {
5960
5840
5961
5841
RawApiError* FullSnapshotReader::ReadIsolateSnapshot () {
5962
5842
Deserializer deserializer (thread_, kind_, buffer_, size_,
5963
- instructions_buffer_, data_buffer_,
5964
- /* vm_isolate=*/ false );
5843
+ instructions_buffer_, data_buffer_);
5965
5844
5966
5845
RawApiError* error =
5967
5846
deserializer.VerifyVersionAndFeatures (thread_->isolate ());
0 commit comments