summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/regress/wasm/regress-crbug-1007608.js
blob: 37d5b2e4a2f700fb300ff1f9c96b123c4c065d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2019 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.

// Bug is in the C-to-Wasm entry, used e.g. by the Wasm interpreter.
// Flags: --wasm-interpret-all

load("test/mjsunit/wasm/wasm-module-builder.js");

let argc = 7;
let builder = new WasmModuleBuilder();
let types = new Array(argc).fill(kWasmI32);
let sig = makeSig(types, []);
let body = [];
for (let i = 0; i < argc; ++i) {
  body.push(kExprGetLocal, i);
}
body.push(kExprCallFunction, 0);
builder.addImport('', 'f', sig);
builder.addFunction("main", sig).addBody(body).exportAs('main');
let instance = builder.instantiate({
  '': {
    'f': function() { throw "don't crash"; }
  }
});
assertThrows(instance.exports.main);