v8/test/mjsunit/regress/regress-11810.js
Marja Hölttä b308c41a07 [ast] Fix de-duping "get 0 {}" and "0: ..." inside objects
This fix makes ObjectLiteral::CalculateEmitStore work correctly.

Bug: v8:11810
Change-Id: I60f3d5cb657f4b2ca574d5224c8f1cb7a8216354
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2917040
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74986}
2021-06-07 15:43:24 +00:00

30 lines
904 B
JavaScript

// Copyright 2021 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 test(object, property) {
assertEquals('pass', object[property]);
}
(function TestStringProperty() {
let o1 = {get foo() { return 'fail'}, 'foo':'pass'};
test(o1, 'foo');
let o2 = {'foo':'fail', get foo() { return 'pass'}, };
test(o2, 'foo');
})();
(function TestNumberProperty() {
let o1 = {get 0() { return 'fail'}, 0:'pass'};
test(o1, 0);
let o2 = {0:'fail', get 0() { return 'pass'}};
test(o2, 0);
})();
(function TestBigNumberProperty() {
// Test a number which is too big to be considered an array index.
let o1 = {get 50000000000() { return 'fail'}, 50000000000:'pass'};
test(o1, 50000000000);
let o2 = {50000000000:'fail', get 50000000000() { return 'pass'}};
test(o2, 50000000000);
})();