v8/test/mjsunit/es9/regress/regress-869342.js
Caitlin Potter 5caee70b66 Reland "Reland [CloneObjectIC] overwrite monomorphic/polymorphic feedback if deprecated"
An object with a deprecated Map which has already been cached in
CloneObjectIC feedback is still a valid Map for fast cloning --- but
to be consistent with other ICs, deprecated maps are ignored, and are
expected to be transitioned away from.

If the source object has a deprecated map, the instance is migrated.

BUG=v8:7611, chromium:867958, chromium:868586, chromium:869342, chromium:869347, chromium:869293
R=jkummerow@chromium.org, mvstanton@chromium.org

Reviewed-on: https://chromium-review.googlesource.com/1154143
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#54799}
Change-Id: I6e2f7b28c41bb9bd6255441da0f209a97bce5e8f
Reviewed-on: https://chromium-review.googlesource.com/1157142
Cr-Commit-Position: refs/heads/master@{#54830}
2018-08-01 00:30:11 +00:00

19 lines
596 B
JavaScript

// 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: --expose-gc
function spread(o) { return { ...o }; }
(function setupPolymorphicFeedback() {
function C1() { this.p0 = 1; }
function C2() { this.p1 = 2; this.p2 = 3; }
assertEquals({ p0: 1 }, spread(new C1));
assertEquals({ p1: 2, p2: 3 }, spread(new C2));
})();
gc(); // Clobber cached map in feedback[0], and check that we don't crash
function C3() { this.p0 = 3; }
assertEquals({ p0: 3 }, spread(new C3));