summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/regress/regress-crbug-1012301-1.js
blob: 9c2f87c4fed2aaee74e86501e42883b444a66616 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2019 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.

function get() {
  // Update the descriptor array now shared between the Foo map and the
  // (Foo + c) map.
  o1.c = 10;
  // Change the type of the field on the new descriptor array in-place to
  // Tagged. If Object.assign has a cached descriptor array, then it will point
  // to the old Foo map's descriptors, which still have .b as Double.
  o2.b = "string";
  return 1;
}

function Foo() {
  Object.defineProperty(this, "a", {get, enumerable: true});
  // Initialise Foo.b to have Double representation.
  this.b = 1.5;
}

var o1 = new Foo();
var o2 = new Foo();
var target = {};
Object.assign(target, o2);
// Make sure that target has the right representation after assignment.
assertEquals(target.b, "string");