// 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.// Flags: --experimental-wasm-gcd8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');varbuilder=newWasmModuleBuilder();letarray_index=builder.addArray(kWasmI64,true);letsig_index=builder.addType(kSig_v_v);letmain=builder.addFunction("main",kSig_v_i);letother=builder.addFunction("other",sig_index).addBody([]);lettable=builder.addTable(kWasmAnyFunc,1,1);builder.addActiveElementSegment(0,// tableWasmInitExpr.I32Const(0),// offset[1]);// valuesmain.addBody([kExprI64Const,0x33,kExprLocalGet,0,kGCPrefix,kExprRttCanon,array_index,kGCPrefix,kExprArrayNewWithRtt,array_index,kExprDrop,kExprI32Const,0,kExprCallIndirect,sig_index,table.index,]).exportFunc();varinstance=builder.instantiate();assertThrows(()=>instance.exports.main(1<<29),WebAssembly.RuntimeError,'requested new array is too large');