46ed47e66a
In typed-optimization, Turbofan optimized NumberFloor(NumberDivide(...)) patterns where both inputs are known to be of Unsigned32 type, but the replacement couldn't be typed consistently. This CL introduces a new operator Unsigned32Divide, which has the same semantics, but can be typed consistently and thus allows the simplified lowering verifier to validate the graph correctly. Bug: v8:12619 Change-Id: Iad77154d3d840c94edfd3ab91ffa37c840da0bc9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3644790 Commit-Queue: Nico Hartmann <nicohartmann@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/main@{#80967}
21 lines
458 B
JavaScript
21 lines
458 B
JavaScript
// Copyright 2022 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 --turbofan
|
|
|
|
let g;
|
|
|
|
function test() {
|
|
const ten = 10;
|
|
const x = 10 / ten;
|
|
const y = Math.floor(x);
|
|
g = x;
|
|
return y + 1;
|
|
}
|
|
|
|
%PrepareFunctionForOptimization(test);
|
|
assertEquals(2, test());
|
|
%OptimizeFunctionOnNextCall(test);
|
|
assertEquals(2, test());
|