[builtins] Defer throw in InterpreterEntryTrampoline

Bug: v8:9771
Change-Id: I6ffa794e1b3e22f2c584a9959222b63c84a47374
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1825222
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Auto-Submit: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63994}
This commit is contained in:
Santiago Aboy Solanes 2019-09-26 15:11:51 +01:00 committed by Commit Bot
parent be1164775f
commit dcf3b66349
3 changed files with 18 additions and 12 deletions

View File

@ -1121,19 +1121,17 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ Push(kInterpreterBytecodeArrayRegister, r0);
// Allocate the local and temporary register file on the stack.
Label stack_overflow;
{
// Load frame size from the BytecodeArray object.
__ ldr(r4, FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kFrameSizeOffset));
// Do a stack check to ensure we don't go over the limit.
Label ok;
__ sub(r9, sp, Operand(r4));
LoadRealStackLimit(masm, r2);
__ cmp(r9, Operand(r2));
__ b(hs, &ok);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ bind(&ok);
__ b(lo, &stack_overflow);
// If ok, push undefined as the initial value for all register file entries.
Label loop_header;
@ -1201,6 +1199,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bind(&compile_lazy);
GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
__ bkpt(0); // Should not return.
__ bind(&stack_overflow);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ bkpt(0); // Should not return.
}
static void Generate_InterpreterPushArgs(MacroAssembler* masm,

View File

@ -1248,13 +1248,13 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ Push(kInterpreterBytecodeArrayRegister, x0);
// Allocate the local and temporary register file on the stack.
Label stack_overflow;
{
// Load frame size from the BytecodeArray object.
__ Ldr(w11, FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kFrameSizeOffset));
// Do a stack check to ensure we don't go over the limit.
Label ok;
__ Sub(x10, sp, Operand(x11));
{
UseScratchRegisterScope temps(masm);
@ -1262,9 +1262,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
LoadRealStackLimit(masm, scratch);
__ Cmp(x10, scratch);
}
__ B(hs, &ok);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ Bind(&ok);
__ B(lo, &stack_overflow);
// If ok, push undefined as the initial value for all register file entries.
// Note: there should always be at least one stack slot for the return
@ -1335,6 +1333,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bind(&compile_lazy);
GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
__ Unreachable(); // Should not return.
__ bind(&stack_overflow);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ Unreachable(); // Should not return.
}
static void Generate_InterpreterPushArgs(MacroAssembler* masm,

View File

@ -1137,19 +1137,17 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ Push(rcx);
// Allocate the local and temporary register file on the stack.
Label stack_overflow;
{
// Load frame size from the BytecodeArray object.
__ movl(rcx, FieldOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kFrameSizeOffset));
// Do a stack check to ensure we don't go over the limit.
Label ok;
__ movq(rax, rsp);
__ subq(rax, rcx);
__ cmpq(rax, RealStackLimitAsOperand(masm));
__ j(above_equal, &ok, Label::kNear);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ bind(&ok);
__ j(below, &stack_overflow);
// If ok, push undefined as the initial value for all register file entries.
Label loop_header;
@ -1222,6 +1220,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bind(&compile_lazy);
GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
__ int3(); // Should not return.
__ bind(&stack_overflow);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ int3(); // Should not return.
}
static void Generate_InterpreterPushArgs(MacroAssembler* masm,