@@ -33,10 +33,6 @@ static RawObject* AllocateUninitialized(PageSpace* old_space, intptr_t size) {
33
33
return RawObject::FromAddr (address);
34
34
}
35
35
36
- static bool SnapshotContainsTypeTestingStubs (Snapshot::Kind kind) {
37
- return kind == Snapshot::kFullAOT || kind == Snapshot::kFullJIT ;
38
- }
39
-
40
36
void Deserializer::InitializeHeader (RawObject* raw,
41
37
intptr_t class_id,
42
38
intptr_t size,
@@ -3062,8 +3058,6 @@ class TypeSerializationCluster : public SerializationCluster {
3062
3058
3063
3059
void WriteFill (Serializer* s) {
3064
3060
const bool is_vm_isolate = s->isolate () == Dart::vm_isolate ();
3065
- const bool should_write_type_testing_stub =
3066
- SnapshotContainsTypeTestingStubs (s->kind ());
3067
3061
3068
3062
intptr_t count = canonical_objects_.length ();
3069
3063
for (intptr_t i = 0 ; i < count; i++) {
@@ -3075,7 +3069,7 @@ class TypeSerializationCluster : public SerializationCluster {
3075
3069
}
3076
3070
s->WriteTokenPosition (type->ptr ()->token_pos_ );
3077
3071
s->Write <int8_t >(type->ptr ()->type_state_ );
3078
- if (should_write_type_testing_stub ) {
3072
+ if (s-> kind () == Snapshot:: kFullAOT ) {
3079
3073
RawInstructions* instr = type_testing_stubs_.LookupByAddresss (
3080
3074
type->ptr ()->type_test_stub_entry_point_ );
3081
3075
s->WriteInstructions (instr, Code::null ());
@@ -3091,7 +3085,7 @@ class TypeSerializationCluster : public SerializationCluster {
3091
3085
}
3092
3086
s->WriteTokenPosition (type->ptr ()->token_pos_ );
3093
3087
s->Write <int8_t >(type->ptr ()->type_state_ );
3094
- if (should_write_type_testing_stub ) {
3088
+ if (s-> kind () == Snapshot:: kFullAOT ) {
3095
3089
RawInstructions* instr = type_testing_stubs_.LookupByAddresss (
3096
3090
type->ptr ()->type_test_stub_entry_point_ );
3097
3091
s->WriteInstructions (instr, Code::null ());
@@ -3100,7 +3094,7 @@ class TypeSerializationCluster : public SerializationCluster {
3100
3094
3101
3095
// The dynamic/void objects are not serialized, so we manually send
3102
3096
// the type testing stub for it.
3103
- if (should_write_type_testing_stub && is_vm_isolate) {
3097
+ if (s-> kind () == Snapshot:: kFullAOT && is_vm_isolate) {
3104
3098
RawInstructions* dynamic_instr = type_testing_stubs_.LookupByAddresss (
3105
3099
Type::dynamic_type ().type_test_stub_entry_point ());
3106
3100
s->WriteInstructions (dynamic_instr, Code::null ());
@@ -3143,8 +3137,6 @@ class TypeDeserializationCluster : public DeserializationCluster {
3143
3137
3144
3138
void ReadFill (Deserializer* d) {
3145
3139
const bool is_vm_isolate = d->isolate () == Dart::vm_isolate ();
3146
- const bool should_read_type_testing_stub =
3147
- SnapshotContainsTypeTestingStubs (d->kind ());
3148
3140
3149
3141
for (intptr_t id = canonical_start_index_; id < canonical_stop_index_;
3150
3142
id++) {
@@ -3158,7 +3150,7 @@ class TypeDeserializationCluster : public DeserializationCluster {
3158
3150
}
3159
3151
type->ptr ()->token_pos_ = d->ReadTokenPosition ();
3160
3152
type->ptr ()->type_state_ = d->Read <int8_t >();
3161
- if (should_read_type_testing_stub ) {
3153
+ if (d-> kind () == Snapshot:: kFullAOT ) {
3162
3154
instr_ = d->ReadInstructions ();
3163
3155
type_ = type;
3164
3156
type_.SetTypeTestingStub (instr_);
@@ -3176,7 +3168,7 @@ class TypeDeserializationCluster : public DeserializationCluster {
3176
3168
}
3177
3169
type->ptr ()->token_pos_ = d->ReadTokenPosition ();
3178
3170
type->ptr ()->type_state_ = d->Read <int8_t >();
3179
- if (should_read_type_testing_stub ) {
3171
+ if (d-> kind () == Snapshot:: kFullAOT ) {
3180
3172
instr_ = d->ReadInstructions ();
3181
3173
type_ = type;
3182
3174
type_.SetTypeTestingStub (instr_);
@@ -3185,7 +3177,7 @@ class TypeDeserializationCluster : public DeserializationCluster {
3185
3177
3186
3178
// The dynamic/void objects are not serialized, so we manually send
3187
3179
// the type testing stub for it.
3188
- if (should_read_type_testing_stub && is_vm_isolate) {
3180
+ if (d-> kind () == Snapshot:: kFullAOT && is_vm_isolate) {
3189
3181
instr_ = d->ReadInstructions ();
3190
3182
Type::dynamic_type ().SetTypeTestingStub (instr_);
3191
3183
instr_ = d->ReadInstructions ();
@@ -3194,7 +3186,7 @@ class TypeDeserializationCluster : public DeserializationCluster {
3194
3186
}
3195
3187
3196
3188
void PostLoad (const Array& refs, Snapshot::Kind kind, Zone* zone) {
3197
- if (! SnapshotContainsTypeTestingStubs ( kind) ) {
3189
+ if (kind != Snapshot:: kFullAOT ) {
3198
3190
for (intptr_t id = canonical_start_index_; id < canonical_stop_index_;
3199
3191
id++) {
3200
3192
type_ ^= refs.At (id);
@@ -3245,9 +3237,6 @@ class TypeRefSerializationCluster : public SerializationCluster {
3245
3237
}
3246
3238
3247
3239
void WriteFill (Serializer* s) {
3248
- const bool should_write_type_testing_stub =
3249
- SnapshotContainsTypeTestingStubs (s->kind ());
3250
-
3251
3240
intptr_t count = objects_.length ();
3252
3241
for (intptr_t i = 0 ; i < count; i++) {
3253
3242
RawTypeRef* type = objects_[i];
@@ -3256,7 +3245,7 @@ class TypeRefSerializationCluster : public SerializationCluster {
3256
3245
for (RawObject** p = from; p <= to; p++) {
3257
3246
s->WriteRef (*p);
3258
3247
}
3259
- if (should_write_type_testing_stub ) {
3248
+ if (s-> kind () == Snapshot:: kFullAOT ) {
3260
3249
RawInstructions* instr = type_testing_stubs_.LookupByAddresss (
3261
3250
type->ptr ()->type_test_stub_entry_point_ );
3262
3251
s->WriteInstructions (instr, Code::null ());
@@ -3287,9 +3276,7 @@ class TypeRefDeserializationCluster : public DeserializationCluster {
3287
3276
}
3288
3277
3289
3278
void ReadFill (Deserializer* d) {
3290
- const bool is_vm_object = d->isolate () == Dart::vm_isolate ();
3291
- const bool should_read_type_testing_stub =
3292
- SnapshotContainsTypeTestingStubs (d->kind ());
3279
+ bool is_vm_object = d->isolate () == Dart::vm_isolate ();
3293
3280
3294
3281
for (intptr_t id = start_index_; id < stop_index_; id++) {
3295
3282
RawTypeRef* type = reinterpret_cast <RawTypeRef*>(d->Ref (id));
@@ -3300,24 +3287,14 @@ class TypeRefDeserializationCluster : public DeserializationCluster {
3300
3287
for (RawObject** p = from; p <= to; p++) {
3301
3288
*p = d->ReadRef ();
3302
3289
}
3303
- if (should_read_type_testing_stub ) {
3290
+ if (d-> kind () == Snapshot:: kFullAOT ) {
3304
3291
instr_ = d->ReadInstructions ();
3305
3292
type_ = type;
3306
3293
type_.SetTypeTestingStub (instr_);
3307
3294
}
3308
3295
}
3309
3296
}
3310
3297
3311
- void PostLoad (const Array& refs, Snapshot::Kind kind, Zone* zone) {
3312
- if (!SnapshotContainsTypeTestingStubs (kind)) {
3313
- for (intptr_t id = start_index_; id < stop_index_; id++) {
3314
- type_ ^= refs.At (id);
3315
- instr_ = TypeTestingStubGenerator::DefaultCodeForType (type_);
3316
- type_.SetTypeTestingStub (instr_);
3317
- }
3318
- }
3319
- }
3320
-
3321
3298
private:
3322
3299
AbstractType& type_;
3323
3300
Instructions& instr_;
@@ -3354,9 +3331,6 @@ class TypeParameterSerializationCluster : public SerializationCluster {
3354
3331
}
3355
3332
3356
3333
void WriteFill (Serializer* s) {
3357
- const bool should_write_type_testing_stub =
3358
- SnapshotContainsTypeTestingStubs (s->kind ());
3359
-
3360
3334
intptr_t count = objects_.length ();
3361
3335
for (intptr_t i = 0 ; i < count; i++) {
3362
3336
RawTypeParameter* type = objects_[i];
@@ -3369,7 +3343,7 @@ class TypeParameterSerializationCluster : public SerializationCluster {
3369
3343
s->WriteTokenPosition (type->ptr ()->token_pos_ );
3370
3344
s->Write <int16_t >(type->ptr ()->index_ );
3371
3345
s->Write <int8_t >(type->ptr ()->type_state_ );
3372
- if (should_write_type_testing_stub ) {
3346
+ if (s-> kind () == Snapshot:: kFullAOT ) {
3373
3347
RawInstructions* instr = type_testing_stubs_.LookupByAddresss (
3374
3348
type->ptr ()->type_test_stub_entry_point_ );
3375
3349
s->WriteInstructions (instr, Code::null ());
@@ -3402,8 +3376,6 @@ class TypeParameterDeserializationCluster : public DeserializationCluster {
3402
3376
3403
3377
void ReadFill (Deserializer* d) {
3404
3378
bool is_vm_object = d->isolate () == Dart::vm_isolate ();
3405
- const bool should_read_type_testing_stub =
3406
- SnapshotContainsTypeTestingStubs (d->kind ());
3407
3379
3408
3380
for (intptr_t id = start_index_; id < stop_index_; id++) {
3409
3381
RawTypeParameter* type = reinterpret_cast <RawTypeParameter*>(d->Ref (id));
@@ -3418,7 +3390,7 @@ class TypeParameterDeserializationCluster : public DeserializationCluster {
3418
3390
type->ptr ()->token_pos_ = d->ReadTokenPosition ();
3419
3391
type->ptr ()->index_ = d->Read <int16_t >();
3420
3392
type->ptr ()->type_state_ = d->Read <int8_t >();
3421
- if (should_read_type_testing_stub ) {
3393
+ if (d-> kind () == Snapshot:: kFullAOT ) {
3422
3394
instr_ = d->ReadInstructions ();
3423
3395
type_ = type;
3424
3396
type_.SetTypeTestingStub (instr_);
@@ -3427,7 +3399,7 @@ class TypeParameterDeserializationCluster : public DeserializationCluster {
3427
3399
}
3428
3400
3429
3401
void PostLoad (const Array& refs, Snapshot::Kind kind, Zone* zone) {
3430
- if (! SnapshotContainsTypeTestingStubs ( kind) ) {
3402
+ if (kind != Snapshot:: kFullAOT ) {
3431
3403
for (intptr_t id = start_index_; id < stop_index_; id++) {
3432
3404
type_ ^= refs.At (id);
3433
3405
instr_ = TypeTestingStubGenerator::DefaultCodeForType (type_);
0 commit comments