PPC/s390: [builtins] Defer throw in InterpreterEntryTrampoline

Port dcf3b66349

R=solanes@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I92b18a10581e0d1b7977db6be8ed455ec621d537
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1827738
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#64012}
This commit is contained in:
Milad Farazmand 2019-09-26 15:26:50 -04:00 committed by Commit Bot
parent 36f2ec1fd8
commit 842f1ca0a2
2 changed files with 12 additions and 8 deletions

View File

@ -1149,19 +1149,17 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ Push(kInterpreterBytecodeArrayRegister, r3); __ Push(kInterpreterBytecodeArrayRegister, r3);
// Allocate the local and temporary register file on the stack. // Allocate the local and temporary register file on the stack.
Label stack_overflow;
{ {
// Load frame size (word) from the BytecodeArray object. // Load frame size (word) from the BytecodeArray object.
__ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister, __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kFrameSizeOffset)); BytecodeArray::kFrameSizeOffset));
// Do a stack check to ensure we don't go over the limit. // Do a stack check to ensure we don't go over the limit.
Label ok;
__ sub(r8, sp, r5); __ sub(r8, sp, r5);
LoadRealStackLimit(masm, r0); LoadRealStackLimit(masm, r0);
__ cmpl(r8, r0); __ cmpl(r8, r0);
__ bge(&ok); __ ble(&stack_overflow);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ bind(&ok);
// If ok, push undefined as the initial value for all register file entries. // If ok, push undefined as the initial value for all register file entries.
// TODO(rmcilroy): Consider doing more than one push per loop iteration. // TODO(rmcilroy): Consider doing more than one push per loop iteration.
@ -1234,6 +1232,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bind(&compile_lazy); __ bind(&compile_lazy);
GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
__ bkpt(0); // Should not return. __ bkpt(0); // Should not return.
__ bind(&stack_overflow);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ bkpt(0); // Should not return.
} }
static void Generate_InterpreterPushArgs(MacroAssembler* masm, static void Generate_InterpreterPushArgs(MacroAssembler* masm,

View File

@ -1202,18 +1202,16 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ Push(kInterpreterBytecodeArrayRegister, r4); __ Push(kInterpreterBytecodeArrayRegister, r4);
// Allocate the local and temporary register file on the stack. // Allocate the local and temporary register file on the stack.
Label stack_overflow;
{ {
// Load frame size (word) from the BytecodeArray object. // Load frame size (word) from the BytecodeArray object.
__ LoadlW(r4, FieldMemOperand(kInterpreterBytecodeArrayRegister, __ LoadlW(r4, FieldMemOperand(kInterpreterBytecodeArrayRegister,
BytecodeArray::kFrameSizeOffset)); BytecodeArray::kFrameSizeOffset));
// Do a stack check to ensure we don't go over the limit. // Do a stack check to ensure we don't go over the limit.
Label ok;
__ SubP(r8, sp, r4); __ SubP(r8, sp, r4);
__ CmpLogicalP(r8, RealStackLimitAsMemOperand(masm)); __ CmpLogicalP(r8, RealStackLimitAsMemOperand(masm));
__ bge(&ok); __ ble(&stack_overflow);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ bind(&ok);
// If ok, push undefined as the initial value for all register file entries. // If ok, push undefined as the initial value for all register file entries.
// TODO(rmcilroy): Consider doing more than one push per loop iteration. // TODO(rmcilroy): Consider doing more than one push per loop iteration.
@ -1288,6 +1286,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bind(&compile_lazy); __ bind(&compile_lazy);
GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
__ bkpt(0); // Should not return. __ bkpt(0); // Should not return.
__ bind(&stack_overflow);
__ CallRuntime(Runtime::kThrowStackOverflow);
__ bkpt(0); // Should not return.
} }
static void Generate_InterpreterPushArgs(MacroAssembler* masm, static void Generate_InterpreterPushArgs(MacroAssembler* masm,