| Index: runtime/vm/parser.cc
|
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
|
| index 7819cd780ac26f66bf7a1621d56cd8d5c8611bac..bd63ed5ea9ff023a5c58fb771a5fa148ea980a6a 100644
|
| --- a/runtime/vm/parser.cc
|
| +++ b/runtime/vm/parser.cc
|
| @@ -161,12 +161,29 @@ void ParsedFunction::AddToGuardedFields(const Field* field) const {
|
| (field->guarded_cid() == kIllegalCid)) {
|
| return;
|
| }
|
| +
|
| for (intptr_t j = 0; j < guarded_fields_->length(); j++) {
|
| - if ((*guarded_fields_)[j]->raw() == field->raw()) {
|
| + const Field* other = (*guarded_fields_)[j];
|
| + if (field->Original() == other->Original()) {
|
| + // Abort background compilation early if the guarded state of this field
|
| + // has changed during compilation. We will not be able to commit
|
| + // the resulting code anyway.
|
| + if (Compiler::IsBackgroundCompilation()) {
|
| + if (!other->IsConsistentWith(*field)) {
|
| + Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId,
|
| + "Field's guarded state changed during compilation");
|
| + }
|
| + }
|
| return;
|
| }
|
| }
|
| - guarded_fields_->Add(&Field::ZoneHandle(Z, field->Original()));
|
| +
|
| + // Note: the list of guarded fields must contain copies during background
|
| + // compilation because we will look at their guarded_cid when copying
|
| + // the array of guarded fields from callee into the caller during
|
| + // inlining.
|
| + ASSERT(!field->IsOriginal() || Thread::Current()->IsMutatorThread());
|
| + guarded_fields_->Add(&Field::ZoneHandle(Z, field->raw()));
|
| }
|
|
|
|
|
|
|