Original commit message:
[rab/gsab] Remove --harmony-rab-gsab (has been on by default for a while)
Bug: v8:11111
Change-Id: Ie74e7737f3e2e8730820cf00f1cbc7ae02b515af
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5516580
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93848}
Refs: 9ebca66a57
PR-URL: https://github.com/nodejs/node/pull/53522
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/53755
Fixes: https://github.com/nodejs/node/issues/53579
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
// Copyright 2022 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 ab = new ArrayBuffer(3000);
|
|
const ta = new Uint16Array(ab);
|
|
|
|
function createOOBTA() {
|
|
const rab = new ArrayBuffer(3000, {"maxByteLength": 4000});
|
|
const ta = new Uint8Array(rab, 0, 3000);
|
|
rab.resize(0);
|
|
return ta;
|
|
}
|
|
|
|
Object.defineProperty(Uint16Array, Symbol.species,
|
|
{ configurable: true, enumerable: true,
|
|
get: () => { return createOOBTA; }});
|
|
assertThrows(() => { ta.slice(); }, TypeError);
|
|
|
|
function createDetachedTA() {
|
|
const rab = new ArrayBuffer(3000, {"maxByteLength": 4000});
|
|
const ta = new Uint8Array(rab, 0, 3000);
|
|
%ArrayBufferDetach(rab);
|
|
return ta;
|
|
}
|
|
|
|
Object.defineProperty(Uint16Array, Symbol.species,
|
|
{ configurable: true, enumerable: true,
|
|
get: () => { return createDetachedTA; }});
|
|
assertThrows(() => { ta.slice(); }, TypeError);
|
|
|
|
// But this works:
|
|
function createLengthTrackingTA() {
|
|
const rab = new ArrayBuffer(3000, {"maxByteLength": 4000});
|
|
const ta = new Uint16Array(rab, 0);
|
|
return ta;
|
|
}
|
|
|
|
Object.defineProperty(Uint16Array, Symbol.species,
|
|
{ configurable: true, enumerable: true,
|
|
get: () => { return createLengthTrackingTA; }});
|
|
|
|
ta.slice();
|