f7d357b20a
It was shipped in Chrome 67. Bug: v8:6791, v8:8238 Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux_noi18n_rel_ng;master.tryserver.blink:linux_trusty_blink_rel Change-Id: I94d8f0aa18570452403a35dea270b18f155c970a Reviewed-on: https://chromium-review.googlesource.com/1253604 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org> Cr-Commit-Position: refs/heads/master@{#56310}
63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
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.
|
|
|
|
let TypedArrayConstructors = [
|
|
BigUint64Array,
|
|
BigInt64Array,
|
|
];
|
|
|
|
// Test KeyedStore in uninitialized and monomorphic states.
|
|
for (let C of TypedArrayConstructors) {
|
|
let keyedSta = function(array) {
|
|
var didRun = false;
|
|
array[0] = {
|
|
valueOf() {
|
|
didRun = true;
|
|
return 42n;
|
|
}
|
|
};
|
|
|
|
return { didRun, array };
|
|
};
|
|
|
|
for (var i = 0; i < 3; ++i) {
|
|
var { didRun, array } = keyedSta(new C(1));
|
|
assertTrue(didRun);
|
|
assertEquals(array[0], 42n);
|
|
|
|
// OOB store
|
|
// FIXME: Throw a TypeError when storing OOB in a TypedArray.
|
|
var { didRun } = keyedSta(new C);
|
|
assertTrue(didRun);
|
|
}
|
|
}
|
|
|
|
// Test KeyedStore in polymorphic and megamorphic states.
|
|
do {
|
|
let keyedSta = function(array) {
|
|
var didRun = false;
|
|
array[0] = {
|
|
valueOf() {
|
|
didRun = true;
|
|
return 42n;
|
|
}
|
|
};
|
|
|
|
return { didRun, array };
|
|
};
|
|
|
|
for (var i = 0; i < 3; ++i) {
|
|
for (var C of TypedArrayConstructors) {
|
|
var { didRun, array } = keyedSta(new C(1));
|
|
assertTrue(didRun);
|
|
assertEquals(array[0], 42n);
|
|
|
|
// OOB store
|
|
// FIXME: Throw a TypeError when storing OOB in a TypedArray.
|
|
var { didRun } = keyedSta(new C);
|
|
assertTrue(didRun);
|
|
}
|
|
}
|
|
} while (false);
|