[ VM ] Fix issue where Field::RecordStore was attempting to record a sentinel for non-initialized late fields.

Change-Id: If77b39765e025989f83ef5f689b723984878df0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134803
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Ben Konyi 2020-02-06 23:44:24 +00:00 committed by commit-bot@chromium.org
parent 8f5b1ea9bb
commit d4a1a474d8
2 changed files with 5 additions and 1 deletions

View file

@ -10060,6 +10060,9 @@ void Field::RecordStore(const Object& value) const {
return;
}
// We should never try to record a sentinel.
ASSERT(value.raw() != Object::sentinel().raw());
if ((guarded_cid() == kDynamicCid) ||
(is_nullable() && value.raw() == Object::null())) {
// Nothing to do: the field is not guarded or we are storing null into

View file

@ -631,7 +631,8 @@ RawObject* SnapshotReader::ReadInstance(intptr_t object_id,
pobj_ = ReadObjectImpl(read_as_reference);
result->SetFieldAtOffset(offset, pobj_);
if ((offset != type_argument_field_offset) &&
(kind_ == Snapshot::kMessage) && isolate()->use_field_guards()) {
(kind_ == Snapshot::kMessage) && isolate()->use_field_guards() &&
(pobj_.raw() != Object::sentinel().raw())) {
// TODO(fschneider): Consider hoisting these lookups out of the loop.
// This would involve creating a handle, since cls_ can't be reused
// across the call to ReadObjectImpl.