f383a92396
This is a reland of adceb45979
Redesign test to not be OS dependent.
Original change's description:
> [x64][ia32] Add stack overflow check in InvokePrologue
>
> In case of no arguments adaptor frame, we massage the arguments in InvokePrologue pushing undefined objects if the actual argument count is below the parameter count. This CL adds a stack overflow check before pushing these undefined objects to the stack.
>
> Change-Id: I2a88bf6fdfd17958f6f6884143a67d50ea842fd2
> Bug: v8:10201
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2491039
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#70927}
Bug: v8:10201
Change-Id: Ifab3413b748cdf3bb998a5080cd1fcb3b67a737b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2517921
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70973}
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
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: --stack-size=100 --no-opt
|
|
|
|
function f(
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
|
|
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x
|
|
) { }
|
|
|
|
function runNearStackLimit(f) {
|
|
let recursing_towards_stack_limit = true;
|
|
let f_succeeded = false;
|
|
|
|
function t() {
|
|
try {
|
|
t();
|
|
if (f_succeeded) return;
|
|
// Keep calling f until it stops throwing stack overflow exceptions.
|
|
f();
|
|
// f didn't throw, so we are done.
|
|
f_succeeded = true;
|
|
} catch(e) {
|
|
if (recursing_towards_stack_limit) {
|
|
recursing_towards_stack_limit = false;
|
|
// We reached the near stack limit state, call f first time.
|
|
f();
|
|
// f didn't throw, so we are done.
|
|
f_succeeded = true;
|
|
}
|
|
}
|
|
};
|
|
|
|
try {
|
|
t();
|
|
} catch(e) {}
|
|
}
|
|
|
|
runNearStackLimit(f);
|