45bbf8041d
This reverts commit 02595c60a3
.
Original CL: https://chromium-review.googlesource.com/c/494968/
Bug:
Change-Id: I7441ed91ebb4a087cdf437ae3239f9b021110a11
Reviewed-on: https://chromium-review.googlesource.com/500947
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45212}
38 lines
1019 B
JavaScript
38 lines
1019 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.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
load("test/mjsunit/wasm/wasm-constants.js");
|
|
load("test/mjsunit/wasm/wasm-module-builder.js");
|
|
|
|
%ResetWasmOverloads();
|
|
let buffer = (() => {
|
|
let builder = new WasmModuleBuilder();
|
|
builder.addFunction("f", kSig_i_v)
|
|
.addBody([kExprI32Const, 42])
|
|
.exportAs("f");
|
|
return builder.toBuffer();
|
|
})();
|
|
|
|
var module = new WebAssembly.Module(buffer);
|
|
var wrapper = [module];
|
|
|
|
assertPromiseResult(
|
|
WebAssembly.instantiate(wrapper),
|
|
assertUnreachable,
|
|
e => assertTrue(e instanceof TypeError));
|
|
|
|
assertPromiseResult(
|
|
(() => {
|
|
%SetWasmCompileFromPromiseOverload();
|
|
return WebAssembly.instantiate(wrapper);
|
|
})(),
|
|
pair => {
|
|
assertTrue(pair.instance instanceof WebAssembly.Instance);
|
|
assertTrue(pair.module instanceof WebAssembly.Module);
|
|
%ResetWasmOverloads();
|
|
},
|
|
assertUnreachable);
|