Commit 78e57631 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[CloneObjectIC] Avoid FieldType confusions

Do not propagate FieldTypes for kField properties.

Bug: chromium:881247
Change-Id: Ia6af451cd6f3ba22a9ced1f3b43fc4cfc8f7084e
Reviewed-on: https://chromium-review.googlesource.com/c/1288637
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56813}
parent 9c001573
...@@ -10180,15 +10180,22 @@ Handle<DescriptorArray> DescriptorArray::CopyForFastObjectClone( ...@@ -10180,15 +10180,22 @@ Handle<DescriptorArray> DescriptorArray::CopyForFastObjectClone(
Name* key = src->GetKey(i); Name* key = src->GetKey(i);
PropertyDetails details = src->GetDetails(i); PropertyDetails details = src->GetDetails(i);
SLOW_DCHECK(!key->IsPrivateField() && details.IsEnumerable() && DCHECK(!key->IsPrivateField());
details.kind() == kData); DCHECK(details.IsEnumerable());
DCHECK_EQ(details.kind(), kData);
// Ensure the ObjectClone property details are NONE, and that all source // Ensure the ObjectClone property details are NONE, and that all source
// details did not contain DONT_ENUM. // details did not contain DONT_ENUM.
PropertyDetails new_details(kData, NONE, details.location(), PropertyDetails new_details(kData, NONE, details.location(),
details.constness(), details.representation(), details.constness(), details.representation(),
details.field_index()); details.field_index());
descriptors->Set(i, key, src->GetValue(i), new_details); // Do not propagate the field type of normal object fields from the
// original descriptors since FieldType changes don't create new maps.
MaybeObject* type = src->GetValue(i);
if (details.location() == PropertyLocation::kField) {
type = MaybeObject::FromObject(FieldType::Any());
}
descriptors->Set(i, key, type, new_details);
} }
descriptors->Sort(); descriptors->Sort();
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
const resolvedPromise = Promise.resolve();
function spread() {
const result = { ...resolvedPromise };
%HeapObjectVerify(result);
return result;
}
resolvedPromise[undefined] = {a:1};
%HeapObjectVerify(resolvedPromise);
spread();
resolvedPromise[undefined] = undefined;
%HeapObjectVerify(resolvedPromise);
spread();
%HeapObjectVerify(resolvedPromise);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment