Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/debugging/wasm/gdb-server/test_files/test_float.js')
-rw-r--r--deps/v8/test/debugging/wasm/gdb-server/test_files/test_float.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/deps/v8/test/debugging/wasm/gdb-server/test_files/test_float.js b/deps/v8/test/debugging/wasm/gdb-server/test_files/test_float.js
new file mode 100644
index 00000000000..e1f45e5aa67
--- /dev/null
+++ b/deps/v8/test/debugging/wasm/gdb-server/test_files/test_float.js
@@ -0,0 +1,31 @@
+// Copyright 2020 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-module-builder.js');
+
+var builder = new WasmModuleBuilder();
+builder
+ .addFunction('mul', kSig_f_ff)
+ // input is 2 args of type float and output is float
+ .addBody([
+ kExprLocalGet, 0, // local.get f0
+ kExprLocalGet, 1, // local.get f1
+ kExprF32Mul, // f32.mul i0 i1
+ ])
+ .exportFunc();
+
+const instance = builder.instantiate();
+const wasm_f = instance.exports.mul;
+
+function f() {
+ var result = wasm_f(12.0, 3.5);
+ return result;
+}
+
+try {
+ let val = f();
+ print('float result: ' + val);
+} catch (e) {
+ print('*exception:* ' + e);
+}