v8/test/mjsunit/regress/regress-1038573.js
Nico Hartmann 947142734a Fixes lost TypeError for BigInts
The optimized code for String.charCodeAt(BigInt.asUintN(64, 10n)) did
not throw a TypeError due to how lowering of CheckBounds triggers
RepresentationChanger.

Bug: chromium:1038573
Change-Id: Ie0f9ca95de5af5fd3701841ab169e11ccc77216c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1986003
Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65632}
2020-01-08 13:41:15 +00:00

31 lines
715 B
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(){
function f(x) {
return "abcd".charCodeAt(BigInt.asUintN(64, 10n));
}
%PrepareFunctionForOptimization(f);
try { f(1); } catch(e) {}
try { f(1); } catch(e) {}
%OptimizeFunctionOnNextCall(f);
assertThrows(f, TypeError);
})();
(function(){
function f(x) {
return "abcd".charCodeAt(BigInt.asUintN(2, 10n));
}
%PrepareFunctionForOptimization(f);
try { f(1); } catch(e) {}
try { f(1); } catch(e) {}
%OptimizeFunctionOnNextCall(f);
assertThrows(f, TypeError);
})();