diff options
Diffstat (limited to 'deps/v8/test/inspector/debugger/wasm-gc-anyref.js')
-rw-r--r-- | deps/v8/test/inspector/debugger/wasm-gc-anyref.js | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/deps/v8/test/inspector/debugger/wasm-gc-anyref.js b/deps/v8/test/inspector/debugger/wasm-gc-anyref.js index 04750908cf..aa835e82e4 100644 --- a/deps/v8/test/inspector/debugger/wasm-gc-anyref.js +++ b/deps/v8/test/inspector/debugger/wasm-gc-anyref.js @@ -66,16 +66,19 @@ async function printPauseLocationsAndContinue(msg) { async function instantiateWasm() { var builder = new WasmModuleBuilder(); + builder.startRecGroup(); let struct_type = builder.addStruct([makeField(kWasmI32, false)]); let array_type = builder.addArray(kWasmI32); let imported_ref_table = - builder.addImportedTable('import', 'any_table', 3, 3, kWasmAnyRef); + builder.addImportedTable('import', 'any_table', 4, 4, kWasmAnyRef); let imported_func_table = builder.addImportedTable('import', 'func_table', 3, 3, kWasmFuncRef); let ref_table = builder.addTable(kWasmAnyRef, 4) .exportAs('exported_ref_table'); let func_table = builder.addTable(kWasmFuncRef, 3) .exportAs('exported_func_table'); + let i31ref_table = builder.addTable(kWasmI31Ref, 3) + .exportAs('exported_i31_table'); let func = builder.addFunction('my_func', kSig_v_v).addBody([kExprNop]); // Make the function "declared". @@ -88,19 +91,18 @@ async function instantiateWasm() { ...wasmI32Const(1), ...wasmI32Const(20), ...wasmI32Const(21), kGCPrefix, kExprArrayNewFixed, array_type, 2, kExprTableSet, ref_table.index, - // TODO(7748): Reactivate this test when JS interop between i31refs and - // JS SMIs is fixed. The problem right now is the 33-bit shift for i31ref - // values on non-pointer-compressed platforms, which means i31refs and - // Smis have different encodings there but it's impossible to tell them - // apart. - // ...wasmI32Const(2), ...wasmI32Const(30), - // kGCPrefix, kExprI31New, kExprTableSet, ref_table.index, + ...wasmI32Const(2), ...wasmI32Const(30), + kGCPrefix, kExprI31New, kExprTableSet, ref_table.index, // Fill imported any table. ...wasmI32Const(1), ...wasmI32Const(123), kGCPrefix, kExprStructNew, struct_type, kExprTableSet, imported_ref_table, + ...wasmI32Const(1), + ...wasmI32Const(321), kGCPrefix, kExprI31New, + kExprTableSet, imported_ref_table, + // Fill imported func table. ...wasmI32Const(1), kExprRefFunc, func.index, @@ -110,6 +112,15 @@ async function instantiateWasm() { ...wasmI32Const(1), kExprRefFunc, func.index, kExprTableSet, func_table.index, + + // Fill i31 table. + ...wasmI32Const(0), + ...wasmI32Const(123456), kGCPrefix, kExprI31New, + kExprTableSet, i31ref_table.index, + + ...wasmI32Const(1), + ...wasmI32Const(-123), kGCPrefix, kExprI31New, + kExprTableSet, i31ref_table.index, ]).exportFunc(); let body = [ @@ -121,12 +132,9 @@ async function instantiateWasm() { ...wasmI32Const(21), kGCPrefix, kExprArrayNewFixed, array_type, 1, kExprLocalSet, 1, - // Set local anyref_local_i31. - // TODO(7748): Reactivate this test when JS interop between i31refs and JS - // SMIs is fixed (same issue as above). - // ...wasmI32Const(30), - // kGCPrefix, kExprI31New, - // kExprLocalSet, 2, + ...wasmI32Const(30), + kGCPrefix, kExprI31New, + kExprLocalSet, 2, kExprNop, ]; let main = builder.addFunction('main', kSig_v_v) @@ -136,7 +144,7 @@ async function instantiateWasm() { .addLocals(kWasmAnyRef, 1, ['anyref_local_null']) .addBody(body) .exportFunc(); - + builder.endRecGroup(); var module_bytes = builder.toArray(); breakpointLocation = main.body_offset + body.length - 1; @@ -144,7 +152,7 @@ async function instantiateWasm() { let imports = `{'import' : { 'any_table': (() => { let js_table = - new WebAssembly.Table({element: 'anyref', initial: 3, maximum: 3}); + new WebAssembly.Table({element: 'anyref', initial: 4, maximum: 4}); js_table.set(0, ['JavaScript', 'value']); return js_table; })(), |