898b8915b0
This reverts commitf442b03fe2
. Reason for reland: Wrongly reverted. Original change's description: > Revert "[turbofan] Fix bug in Number.Min/Max typings" > > This reverts commit4158af83db
. > > Reason for revert: causing UBSAN failures: > > https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20UBSan/10729? > > > Original change's description: > > [turbofan] Fix bug in Number.Min/Max typings > > > > They try to be very precise about when the result can be -0, > > but do so incorrectly. I'm changing the code to just do the > > simple thing instead. Let's see how that affects performance. > > > > Bug: chromium:1072171 > > Change-Id: I9737a84aa19d06685af5b7bca541e348dc37cca8 > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157028 > > Reviewed-by: Tobias Tebbi <tebbi@chromium.org> > > Commit-Queue: Georg Neis <neis@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#67246} > > TBR=neis@chromium.org,tebbi@chromium.org > > Change-Id: I0d9b312e27f5a8bbbebeccdc9819fa94f10af139 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: chromium:1072171 > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157646 > Reviewed-by: Francis McCabe <fgm@chromium.org> > Commit-Queue: Francis McCabe <fgm@chromium.org> > Cr-Commit-Position: refs/heads/master@{#67249} TBR=neis@chromium.org,tebbi@chromium.org,fgm@chromium.org Change-Id: Ida36ca584a5af5da887189328c8da195b26285d4 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:1072171 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2157368 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#67263}
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
// 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.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
function testMax1(b) {
|
|
const max = Math.max(-1, b ? -0 : 1);
|
|
return Object.is(max, -0);
|
|
}
|
|
%PrepareFunctionForOptimization(testMax1);
|
|
assertTrue(testMax1(true));
|
|
assertTrue(testMax1(true));
|
|
%OptimizeFunctionOnNextCall(testMax1);
|
|
assertTrue(testMax1(true));
|
|
|
|
function testMax2(b) {
|
|
const max = Math.max(b ? -0 : 1, -1);
|
|
return Object.is(max, -0);
|
|
}
|
|
%PrepareFunctionForOptimization(testMax2);
|
|
assertTrue(testMax2(true));
|
|
assertTrue(testMax2(true));
|
|
%OptimizeFunctionOnNextCall(testMax2);
|
|
assertTrue(testMax2(true));
|
|
|
|
function testMin1(b) {
|
|
const min = Math.min(1, b ? -0 : -1);
|
|
return Object.is(min, -0);
|
|
}
|
|
%PrepareFunctionForOptimization(testMin1);
|
|
assertTrue(testMin1(true));
|
|
assertTrue(testMin1(true));
|
|
%OptimizeFunctionOnNextCall(testMin1);
|
|
assertTrue(testMin1(true));
|
|
|
|
function testMin2(b) {
|
|
const min = Math.min(b ? -0 : -1, 1);
|
|
return Object.is(min, -0);
|
|
}
|
|
%PrepareFunctionForOptimization(testMin2);
|
|
assertTrue(testMin2(true));
|
|
assertTrue(testMin2(true));
|
|
%OptimizeFunctionOnNextCall(testMin2);
|
|
assertTrue(testMin2(true));
|