[maglev][arm64] Fix scratch register shortage on funs with many args
The Sub macro sometimes needs a scratch register when the 2nd operand is too large to be encoded in the instruction. The prologue was already reserving 2 scratch registers, which made Sub crash on a DCHECK when trying to reserve one more scratch register. Bug: v8:7700 Change-Id: I995689b8b16e3ef216641f0b6cadbf58f7f3740b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4128554 Commit-Queue: Darius Mercadier <dmercadier@chromium.org> Reviewed-by: Jakob Linke <jgruber@chromium.org> Cr-Commit-Position: refs/heads/main@{#85029}
This commit is contained in:
parent
b8b136cb36
commit
0f3036ce09
@ -235,7 +235,6 @@ void MaglevAssembler::Prologue(Graph* graph) {
|
||||
// after building the frame we can quickly precheck both at once.
|
||||
UseScratchRegisterScope temps(this);
|
||||
Register stack_slots_size = temps.AcquireX();
|
||||
Register interrupt_stack_limit = temps.AcquireX();
|
||||
Mov(stack_slots_size, fp);
|
||||
// Round up the stack slots and max call args separately, since both will be
|
||||
// padded by their respective uses.
|
||||
@ -245,6 +244,7 @@ void MaglevAssembler::Prologue(Graph* graph) {
|
||||
std::max(static_cast<int>(graph->max_deopted_stack_size()),
|
||||
max_stack_slots_used * kSystemPointerSize);
|
||||
Sub(stack_slots_size, stack_slots_size, Immediate(max_stack_size));
|
||||
Register interrupt_stack_limit = temps.AcquireX();
|
||||
LoadStackLimit(interrupt_stack_limit, StackLimitKind::kInterruptStackLimit);
|
||||
Cmp(stack_slots_size, interrupt_stack_limit);
|
||||
|
||||
|
46
test/mjsunit/maglev/lots-of-args.js
Normal file
46
test/mjsunit/maglev/lots-of-args.js
Normal file
@ -0,0 +1,46 @@
|
||||
// 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 --maglev
|
||||
|
||||
function foo(
|
||||
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,
|
||||
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
|
||||
) { }
|
||||
|
||||
%PrepareFunctionForOptimization(foo);
|
||||
foo();
|
||||
foo();
|
||||
%OptimizeMaglevOnNextCall(foo);
|
||||
foo();
|
Loading…
Reference in New Issue
Block a user