v8/test/mjsunit/asm/call-stdlib.js
Michael Starzinger 3a47312226 [asm.js] Remove deprecated --fast-validate-asm flag.
R=clemensh@chromium.org
BUG=v8:6127

Change-Id: I104bf807d3da6a9f269e4f729b254bc6a0d2f0df
Reviewed-on: https://chromium-review.googlesource.com/496206
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45098}
2017-05-04 13:52:39 +00:00

86 lines
2.2 KiB
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 --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));
})();