summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/asm/call-stdlib.js
diff options
context:
space:
mode:
authorMyles Borins <mylesborins@google.com>2017-08-01 11:36:44 -0500
committerMyles Borins <mylesborins@google.com>2017-08-01 15:23:15 -0500
commit0a66b223e149a841669bfad5598e4254589730cb (patch)
tree5ec050f7f78aafbf5b1e0e50d639fb843141e162 /deps/v8/test/mjsunit/asm/call-stdlib.js
parent1782b3836ba58ef0da6b687f2bb970c0bd8199ad (diff)
downloadnode-new-0a66b223e149a841669bfad5598e4254589730cb.tar.gz
deps: update V8 to 6.0.286.52
PR-URL: https://github.com/nodejs/node/pull/14004 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/test/mjsunit/asm/call-stdlib.js')
-rw-r--r--deps/v8/test/mjsunit/asm/call-stdlib.js85
1 files changed, 85 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/asm/call-stdlib.js b/deps/v8/test/mjsunit/asm/call-stdlib.js
new file mode 100644
index 0000000000..5d883f324a
--- /dev/null
+++ b/deps/v8/test/mjsunit/asm/call-stdlib.js
@@ -0,0 +1,85 @@
+// 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 --validate-asm
+
+// This file contains test cases that are particularly interesting because they
+// omit the usual call-site coercion of function calls that target well-known
+// stdlib functions.
+
+(function SuccessStdlibWithoutAnnotation() {
+ function Module(stdlib, imports, heap) {
+ "use asm";
+ var imul = stdlib.Math.imul;
+ function f(a, b) {
+ a = a | 0;
+ b = b | 0;
+ var r = 0;
+ r = imul(a, b);
+ return r | 0;
+ }
+ return { f:f };
+ }
+ var m = Module(this);
+ assertTrue(%IsAsmWasmCode(Module));
+ assertEquals(966, m.f(23, 42));
+ assertEquals(-0x0fffffff, m.f(0x7ffffff, 0x7ffffff));
+})();
+
+(function SuccessStdlibWithoutAnnotationThenRound() {
+ function Module(stdlib, imports, heap) {
+ "use asm";
+ var fround = stdlib.Math.fround;
+ var imul = stdlib.Math.imul;
+ function f(a, b) {
+ a = a | 0;
+ b = b | 0;
+ var r = fround(0);
+ r = fround(imul(a, b));
+ return fround(r);
+ }
+ return { f:f };
+ }
+ var m = Module(this);
+ assertTrue(%IsAsmWasmCode(Module));
+ assertEquals(966, m.f(23, 42));
+ assertEquals(-0x0fffffff - 1, m.f(0x7ffffff, 0x7ffffff));
+})();
+
+(function FailureStdlibWithoutAnnotationMismatch() {
+ function Module(stdlib, imports, heap) {
+ "use asm";
+ var fround = stdlib.Math.fround;
+ var imul = stdlib.Math.imul;
+ function f(a, b) {
+ a = a | 0;
+ b = b | 0;
+ var r = fround(0);
+ r = imul(a, b);
+ return r | 0;
+ }
+ return { f:f };
+ }
+ var m = Module(this);
+ assertFalse(%IsAsmWasmCode(Module));
+ assertEquals(966, m.f(23, 42));
+ assertEquals(-0x0fffffff, m.f(0x7ffffff, 0x7ffffff));
+})();
+
+(function SuccessStdlibWithoutAnnotationUsedInReturn() {
+ function Module(stdlib, imports, heap) {
+ "use asm";
+ var imul = stdlib.Math.imul;
+ function f(a, b) {
+ a = a | 0;
+ b = b | 0;
+ return imul(a, b);
+ }
+ return { f:f };
+ }
+ var m = Module(this);
+ assertTrue(%IsAsmWasmCode(Module));
+ assertEquals(966, m.f(23, 42));
+ assertEquals(-0x0fffffff, m.f(0x7ffffff, 0x7ffffff));
+})();