v8/test/mjsunit/wasm/bigint-i64-to-imported-js-func.js
Sven Sauleau 227493b190 [wasm] split bigint.js test
This CL splits a specific test out the bigint.js test suite in order to
be, eventually, ignored by the wasm-bigint proposal 32-bit support CL.

Change-Id: I8ab673abfb53bac95952b11716fe4f29a4a7feaa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1543352
Commit-Queue: Sven Sauleau <ssauleau@igalia.com>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60510}
2019-03-28 14:48:12 +00:00

40 lines
893 B
JavaScript

// 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.
// Flags: --experimental-wasm-bigint
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestWasmI64ToJSBigIntImportedFunc() {
var builder = new WasmModuleBuilder();
var a_index = builder
.addImport("a", "a", kSig_l_l) // i64 -> i64
builder
.addFunction("fn", kSig_l_v) // () -> i64
.addBody([
kExprI64Const, 0x7,
kExprCallFunction, a_index
])
.exportFunc();
a_was_called = false;
var module = builder.instantiate({
a: {
a(param) {
assertEquals(typeof param, "bigint");
assertEquals(param, 7n);
a_was_called = true;
return 12n;
},
}
});
assertEquals(module.exports.fn(), 12n);
assertTrue(a_was_called);
})();