Reviewers: Weiliang,
Message:
PTAL.
Description:
X87: [turbofan] Implement throwing exceptions into TurboFan code.
port 1382879f29bd71c36aeda2421e867c4cdd232a0d (r27016).
oringinal commit message:
[turbofan] Implement throwing exceptions into TurboFan code.
This extends the stack unwinding logic to respect optimized frames
and perform a lookup in the handler table to find handlers. It also
contains fixes to the API call stubs to allow a stack walk while
promoting scheduled exceptions.
BUG=
Please review this at https://codereview.chromium.org/1023943002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+12, -15 lines):
M src/x87/code-stubs-x87.cc
Index: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index
a46f35b2cbfb43c2f6720bc6c270de4f22c469f8..da1334f1c1dffb42004d8d051fb6bb899e0467d0
100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -4546,7 +4546,6 @@ static void CallApiFunctionAndReturn(MacroAssembler*
masm,
__ mov(eax, return_value_operand);
Label promote_scheduled_exception;
- Label exception_handled;
Label delete_allocated_handles;
Label leave_exit_frame;
@@ -4558,7 +4557,17 @@ static void CallApiFunctionAndReturn(MacroAssembler*
masm,
__ Assert(above_equal, kInvalidHandleScopeLevel);
__ cmp(edi, Operand::StaticVariable(limit_address));
__ j(not_equal, &delete_allocated_handles);
+
+ // Leave the API exit frame.
__ bind(&leave_exit_frame);
+ bool restore_context = context_restore_operand != NULL;
+ if (restore_context) {
+ __ mov(esi, *context_restore_operand);
+ }
+ if (stack_space_operand != nullptr) {
+ __ mov(ebx, *stack_space_operand);
+ }
+ __ LeaveApiExitFrame(!restore_context);
// Check if the function scheduled an exception.
ExternalReference scheduled_exception_address =
@@ -4566,7 +4575,6 @@ static void CallApiFunctionAndReturn(MacroAssembler*
masm,
__ cmp(Operand::StaticVariable(scheduled_exception_address),
Immediate(isolate->factory()->the_hole_value()));
__ j(not_equal, &promote_scheduled_exception);
- __ bind(&exception_handled);
#if DEBUG
// Check if the function returned a valid JavaScript value.
@@ -4603,14 +4611,6 @@ static void CallApiFunctionAndReturn(MacroAssembler*
masm,
__ bind(&ok);
#endif
- bool restore_context = context_restore_operand != NULL;
- if (restore_context) {
- __ mov(esi, *context_restore_operand);
- }
- if (stack_space_operand != nullptr) {
- __ mov(ebx, *stack_space_operand);
- }
- __ LeaveApiExitFrame(!restore_context);
if (stack_space_operand != nullptr) {
DCHECK_EQ(0, stack_space);
__ pop(ecx);
@@ -4620,12 +4620,9 @@ static void CallApiFunctionAndReturn(MacroAssembler*
masm,
__ ret(stack_space * kPointerSize);
}
+ // Re-throw by promoting a scheduled exception.
__ bind(&promote_scheduled_exception);
- {
- FrameScope frame(masm, StackFrame::INTERNAL);
- __ CallRuntime(Runtime::kPromoteScheduledException, 0);
- }
- __ jmp(&exception_handled);
+ __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1);
// HandleScope limit has changed. Delete allocated extensions.
ExternalReference delete_extensions =
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.