// 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: --harmony-rab-gsab --allow-natives-syntax'use strict';d8.file.execute('test/mjsunit/typedarray-helpers.js');(functionArrayConcatDefault(){for(letctorofctors){constrab=CreateResizableArrayBuffer(4*ctor.BYTES_PER_ELEMENT,8*ctor.BYTES_PER_ELEMENT);constfixedLength=newctor(rab,0,4);consttaWrite=newctor(rab);for(leti=0;i<4;++i){WriteToTypedArray(taWrite,i,i+1);}// Orig. array: [1, 2, 3, 4]// [1, 2, 3, 4] << fixedLengthfunctionhelper(receiver,...params){returnToNumbers(Array.prototype.concat.call(receiver,...params));}// TypedArrays aren't concat spreadable by default.assertEquals([fixedLength,5,6,7],helper(fixedLength,[5,6],[7]));// OOBness doesn't matter since the TA is added as a single item.rab.resize(0);assertEquals([fixedLength,5,6,7],helper(fixedLength,[5,6],[7]));// The same for detached buffers.%ArrayBufferDetach(rab);assertEquals([fixedLength,5,6,7],helper(fixedLength,[5,6],[7]));}})();