70d665026d
TypeGuard nodes interpret their inputs to be of a given type, which might not be reflected in the graph and hence may lead to a type conflict being reported by the Simplified Lowering Verifier. This CL adds an additional SLVerifierHint node to preserve this type information for the verification step. Bug: v8:12619, chromium:1370398 Change-Id: I5e4117d6b3ada053249bc000ba98d04021395ce1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3948704 Reviewed-by: Darius Mercadier <dmercadier@chromium.org> Commit-Queue: Nico Hartmann <nicohartmann@chromium.org> Cr-Commit-Position: refs/heads/main@{#83739}
74 lines
1.4 KiB
JavaScript
74 lines
1.4 KiB
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
|
|
|
|
function WarmupAndOptimize(f) {
|
|
%PrepareFunctionForOptimization(f);
|
|
f(1n, 1n);
|
|
%OptimizeFunctionOnNextCall(f);
|
|
f(1n, 1n);
|
|
assertOptimized(f);
|
|
}
|
|
%NeverOptimizeFunction(WarmupAndOptimize);
|
|
|
|
function TestBinary(f) {
|
|
WarmupAndOptimize(f);
|
|
assertThrows(() => { f(1, 1n); }, TypeError);
|
|
// Recompile in case the above deopts.
|
|
WarmupAndOptimize(f);
|
|
assertThrows(() => { f(1n, 1); }, TypeError);
|
|
}
|
|
%NeverOptimizeFunction(TestBinary);
|
|
|
|
function Add(a, b) {
|
|
let [c] = [1n];
|
|
let temp = 0n;
|
|
temp = a + c;
|
|
temp = c + b;
|
|
temp = 42n;
|
|
result = temp;
|
|
}
|
|
TestBinary(Add);
|
|
|
|
function Subtract(a, b) {
|
|
let [c] = [1n];
|
|
let temp = 0n;
|
|
temp = a - c;
|
|
temp = c - b;
|
|
temp = 42n;
|
|
result = temp;
|
|
}
|
|
TestBinary(Subtract);
|
|
|
|
function Multiply(a, b) {
|
|
let [c] = [1n];
|
|
let temp = 0n;
|
|
temp = a * c;
|
|
temp = c * b;
|
|
temp = 42n;
|
|
result = temp;
|
|
}
|
|
TestBinary(Multiply);
|
|
|
|
function Divide(a, b) {
|
|
let [c] = [1n];
|
|
let temp = 0n;
|
|
temp = a / c;
|
|
temp = c / b;
|
|
temp = 42n;
|
|
result = temp;
|
|
}
|
|
TestBinary(Divide);
|
|
|
|
function BitwiseAnd(a, b) {
|
|
let [c] = [1n];
|
|
let temp = 0n;
|
|
temp = a & c;
|
|
temp = c & b;
|
|
temp = 42n;
|
|
result = temp;
|
|
}
|
|
TestBinary(BitwiseAnd);
|