forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Original commit message: [LTS-M86][compiler][x64] Fix bug in InstructionSelector::ChangeInt32ToInt64 (cherry picked from commit 02f84c745fc0cae5927a66dc4a3e81334e8f60a6) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1196683 Change-Id: Ib4ea738b47b64edc81450583be4c80a41698c3d1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2820971 Commit-Queue: Georg Neis <[email protected]> Reviewed-by: Nico Hartmann <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#73903} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2821959 Commit-Queue: Jana Grill <[email protected]> Reviewed-by: Georg Neis <[email protected]> Reviewed-by: Victor-Gabriel Savu <[email protected]> Cr-Commit-Position: refs/branch-heads/8.6@{nodejs#75} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@3066b7b
- Loading branch information
Showing
3 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2021 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() { | ||
const arr = new Uint32Array([2**31]); | ||
function foo() { | ||
return (arr[0] ^ 0) + 1; | ||
} | ||
%PrepareFunctionForOptimization(foo); | ||
assertEquals(-(2**31) + 1, foo()); | ||
%OptimizeFunctionOnNextCall(foo); | ||
assertEquals(-(2**31) + 1, foo()); | ||
}); | ||
|
||
|
||
// The remaining tests already passed without the bugfix. | ||
|
||
|
||
(function() { | ||
const arr = new Uint16Array([2**15]); | ||
function foo() { | ||
return (arr[0] ^ 0) + 1; | ||
} | ||
%PrepareFunctionForOptimization(foo); | ||
assertEquals(2**15 + 1, foo()); | ||
%OptimizeFunctionOnNextCall(foo); | ||
assertEquals(2**15 + 1, foo()); | ||
})(); | ||
|
||
|
||
(function() { | ||
const arr = new Uint8Array([2**7]); | ||
function foo() { | ||
return (arr[0] ^ 0) + 1; | ||
} | ||
%PrepareFunctionForOptimization(foo); | ||
assertEquals(2**7 + 1, foo()); | ||
%OptimizeFunctionOnNextCall(foo); | ||
assertEquals(2**7 + 1, foo()); | ||
})(); | ||
|
||
|
||
(function() { | ||
const arr = new Int32Array([-(2**31)]); | ||
function foo() { | ||
return (arr[0] >>> 0) + 1; | ||
} | ||
%PrepareFunctionForOptimization(foo); | ||
assertEquals(2**31 + 1, foo()); | ||
%OptimizeFunctionOnNextCall(foo); | ||
assertEquals(2**31 + 1, foo()); | ||
})(); |