v8/test/mjsunit/regress/regress-crbug-1028593.js
Jakob Kummerow 16342a4b73 [turbofan] Fix bigint-to-word64 constant folding
Replacing a constant BigInt with a constant int64 is only valid
when the use site has truncating semantics. (For non-constant
values, the representation changer did correctly check for this.)

Bug: chromium:1028593
Change-Id: Ib58b16ece6f21ba30153fd6cfa0560cc2d78d6a2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1940263
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65262}
2019-11-29 12:44:09 +00:00

18 lines
401 B
JavaScript

// Copyright 2019 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 foo() {
try {
return "number".charCodeAt(0n);
} catch(e) {}
}
%PrepareFunctionForOptimization(foo);
for (let i = 0; i < 3; i++) {
foo();
}
%OptimizeFunctionOnNextCall(foo);
foo();