v8/test/mjsunit/regress/regress-6838-1.js
Michael Starzinger 63f9ee1645 [asm.js] Fix Math.min/max signatures to take signed.
This fixes the signature of "Math.min" and "Math.max" for integer values
from "(int, int...) -> signed" to "(signed, signed..) -> signed" which
properly distinguishes signed from unsigned values now. This is in sync
with the spec errata (and ECMAScript semantics).

R=clemensh@chromium.org
TEST=mjsunit/regress/regress-6838-1
BUG=v8:6838

Change-Id: Id72836513dd86e93472a22cf1ac2e2d382ed4f23
Reviewed-on: https://chromium-review.googlesource.com/681357
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48139}
2017-09-25 12:58:57 +00:00

34 lines
771 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
(function TestMathMaxOnLargeInt() {
function Module(stdlib) {
"use asm";
var max = stdlib.Math.max;
function f() {
return max(42,0xffffffff);
}
return f;
}
var f = Module(this);
assertEquals(0xffffffff, f());
assertFalse(%IsAsmWasmCode(Module));
})();
(function TestMathMinOnLargeInt() {
function Module(stdlib) {
"use asm";
var min = stdlib.Math.min;
function f() {
return min(42,0xffffffff);
}
return f;
}
var f = Module(this);
assertEquals(42, f());
assertFalse(%IsAsmWasmCode(Module));
})();