mirror of
https://github.com/nodejs/node.git
synced 2025-05-22 22:11:41 +00:00

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>
24 lines
677 B
JavaScript
24 lines
677 B
JavaScript
// Copyright 2023 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.
|
|
|
|
const gsab = new SharedArrayBuffer(100, {maxByteLength: 200});
|
|
const ta = new Int8Array(1);
|
|
class c extends Int8Array {
|
|
constructor() {
|
|
super(gsab);
|
|
}
|
|
}
|
|
ta.constructor = c;
|
|
const mapper_params = [];
|
|
function mapper(x) {
|
|
mapper_params.push(x);
|
|
return x + 1;
|
|
}
|
|
const mapped = ta.map(mapper);
|
|
assertEquals([0], mapper_params);
|
|
// `mapped` is length-tracking with `gsab` as a backing buffer.
|
|
assertEquals(gsab.byteLength, mapped.length);
|
|
assertEquals(1, mapped[0]);
|
|
assertEquals(gsab, mapped.buffer);
|