v8/test/mjsunit/regress/wasm/regression-757217.js
Mircea Trofin 172d6f50e5 [wasm] Test and fix for module with no functions
Initialize the code table with a valid default (e.g. illegal builtin),
otherwise we're invalidating assumptions when relocating.

Bug: chromium:757217
Change-Id: I77890f1fe0e31534d9844d2e91694df1ec185110
Reviewed-on: https://chromium-review.googlesource.com/630097
Reviewed-by: Brad Nelson <bradnelson@chromium.org>
Commit-Queue: Brad Nelson <bradnelson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47560}
2017-08-24 00:10:52 +00:00

21 lines
671 B
JavaScript

// Copyright 2017 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.
load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
builder.addImport('','f', kSig_v_v);
builder.addExport('a', 0);
builder.addExport('b', 0);
var bytes = builder.toBuffer();
var m = new WebAssembly.Module(bytes);
assertTrue(m instanceof WebAssembly.Module);
assertPromiseResult(
WebAssembly.compile(bytes)
.then(async_result => assertTrue(async_result instanceof WebAssembly.Module),
assertUnreachable));