v8/test/mjsunit/regress/regress-crbug-1406774.js
Jakob Kummerow b4ae834223 [bigint] Implement NoSideEffectsToString
When our various debugging and error reporting facilities want to
perform a side effect free conversion of a value (which could be
a BigInt) to a String, then the usual BigInt::ToString is not a
great fit because it reacts to termination requests.
This patch adds a method BigInt::NoSideEffectsToString, which uses
a low upper bound instead of termination requests.

Fixed: chromium:1406774
Change-Id: Ibc5d37027823e4a03c470f1dd0a63c16c552850c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4177099
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85433}
2023-01-23 13:47:15 +00:00

24 lines
701 B
JavaScript

// Copyright 2023 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: --stack-size=100
function worker_code(arr) {
postMessage("worker starting");
const large_bigint = 2n ** 100_000n;
function f() {
// Run until near the stack limit.
try { f(); } catch (e) {
postMessage("stack limit reached");
postMessage(arr[large_bigint]);
}
}
onmessage = f;
}
let w = new Worker(worker_code, { "arguments": [], "type": "function" });
assertEquals("worker starting", w.getMessage());
w.postMessage("");
assertEquals("stack limit reached", w.getMessage());
w.terminate();