Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: src/arm64/code-stubs-arm64.cc

Issue 1012103002: Delegate throwing in RegExpExecStub to CEntryStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ported to all the architectures. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/code-stubs-arm64.cc
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
index cc499d18442dc8cf0b8db531aa3f38be5676ea7a..7b53e5d8c24e26d8d5f6ed598bc85294b547e2b7 100644
--- a/src/arm64/code-stubs-arm64.cc
+++ b/src/arm64/code-stubs-arm64.cc
@@ -1022,66 +1022,6 @@ void CEntryStub::GenerateAheadOfTime(Isolate* isolate) {
}
-static void ThrowPendingException(MacroAssembler* masm, Register scratch1,
- Register scratch2) {
- Isolate* isolate = masm->isolate();
-
- ExternalReference pending_handler_context_address(
- Isolate::kPendingHandlerContextAddress, isolate);
- ExternalReference pending_handler_code_address(
- Isolate::kPendingHandlerCodeAddress, isolate);
- ExternalReference pending_handler_offset_address(
- Isolate::kPendingHandlerOffsetAddress, isolate);
- ExternalReference pending_handler_fp_address(
- Isolate::kPendingHandlerFPAddress, isolate);
- ExternalReference pending_handler_sp_address(
- Isolate::kPendingHandlerSPAddress, isolate);
-
- // Ask the runtime for help to determine the handler. This will set x0 to
- // contain the current pending exception, don't clobber it.
- ExternalReference find_handler(Runtime::kFindExceptionHandler, isolate);
- DCHECK(csp.Is(masm->StackPointer()));
- {
- FrameScope scope(masm, StackFrame::MANUAL);
- __ Mov(x0, 0); // argc.
- __ Mov(x1, 0); // argv.
- __ Mov(x2, ExternalReference::isolate_address(isolate));
- __ CallCFunction(find_handler, 3);
- }
-
- // We didn't execute a return case, so the stack frame hasn't been updated
- // (except for the return address slot). However, we don't need to initialize
- // jssp because the throw method will immediately overwrite it when it
- // unwinds the stack.
- __ SetStackPointer(jssp);
-
- // Retrieve the handler context, SP and FP.
- __ Mov(cp, Operand(pending_handler_context_address));
- __ Ldr(cp, MemOperand(cp));
- __ Mov(jssp, Operand(pending_handler_sp_address));
- __ Ldr(jssp, MemOperand(jssp));
- __ Mov(fp, Operand(pending_handler_fp_address));
- __ Ldr(fp, MemOperand(fp));
-
- // If the handler is a JS frame, restore the context to the frame.
- // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp
- // or cp.
- Label not_js_frame;
- __ Cbz(cp, &not_js_frame);
- __ Str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
- __ Bind(&not_js_frame);
-
- // Compute the handler entry address and jump to it.
- __ Mov(scratch1, Operand(pending_handler_code_address));
- __ Ldr(scratch1, MemOperand(scratch1));
- __ Mov(scratch2, Operand(pending_handler_offset_address));
- __ Ldr(scratch2, MemOperand(scratch2));
- __ Add(scratch1, scratch1, Code::kHeaderSize - kHeapObjectTag);
- __ Add(scratch1, scratch1, scratch2);
- __ Br(scratch1);
-}
-
-
void CEntryStub::Generate(MacroAssembler* masm) {
// The Abort mechanism relies on CallRuntime, which in turn relies on
// CEntryStub, so until this stub has been generated, we have to use a
@@ -1248,7 +1188,60 @@ void CEntryStub::Generate(MacroAssembler* masm) {
// Handling of exception.
__ Bind(&exception_returned);
- ThrowPendingException(masm, x10, x11);
+
+ ExternalReference pending_handler_context_address(
+ Isolate::kPendingHandlerContextAddress, isolate());
+ ExternalReference pending_handler_code_address(
+ Isolate::kPendingHandlerCodeAddress, isolate());
+ ExternalReference pending_handler_offset_address(
+ Isolate::kPendingHandlerOffsetAddress, isolate());
+ ExternalReference pending_handler_fp_address(
+ Isolate::kPendingHandlerFPAddress, isolate());
+ ExternalReference pending_handler_sp_address(
+ Isolate::kPendingHandlerSPAddress, isolate());
+
+ // Ask the runtime for help to determine the handler. This will set x0 to
+ // contain the current pending exception, don't clobber it.
+ ExternalReference find_handler(Runtime::kFindExceptionHandler, isolate());
+ DCHECK(csp.Is(masm->StackPointer()));
+ {
+ FrameScope scope(masm, StackFrame::MANUAL);
+ __ Mov(x0, 0); // argc.
+ __ Mov(x1, 0); // argv.
+ __ Mov(x2, ExternalReference::isolate_address(isolate()));
+ __ CallCFunction(find_handler, 3);
+ }
+
+ // We didn't execute a return case, so the stack frame hasn't been updated
+ // (except for the return address slot). However, we don't need to initialize
+ // jssp because the throw method will immediately overwrite it when it
+ // unwinds the stack.
+ __ SetStackPointer(jssp);
+
+ // Retrieve the handler context, SP and FP.
+ __ Mov(cp, Operand(pending_handler_context_address));
+ __ Ldr(cp, MemOperand(cp));
+ __ Mov(jssp, Operand(pending_handler_sp_address));
+ __ Ldr(jssp, MemOperand(jssp));
+ __ Mov(fp, Operand(pending_handler_fp_address));
+ __ Ldr(fp, MemOperand(fp));
+
+ // If the handler is a JS frame, restore the context to the frame.
+ // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp
+ // or cp.
+ Label not_js_frame;
+ __ Cbz(cp, &not_js_frame);
+ __ Str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
+ __ Bind(&not_js_frame);
+
+ // Compute the handler entry address and jump to it.
+ __ Mov(x10, Operand(pending_handler_code_address));
+ __ Ldr(x10, MemOperand(x10));
+ __ Mov(x11, Operand(pending_handler_offset_address));
+ __ Ldr(x11, MemOperand(x11));
+ __ Add(x10, x10, Code::kHeaderSize - kHeapObjectTag);
+ __ Add(x10, x10, x11);
+ __ Br(x10);
}
@@ -2682,8 +2675,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
__ B(eq, &runtime);
// For exception, throw the exception again.
- __ EnterExitFrame(false, x10);
- ThrowPendingException(masm, x10, x11);
+ __ TailCallRuntime(Runtime::kRegExpExecReThrow, 4, 1);
__ Bind(&failure);
__ Mov(x0, Operand(isolate()->factory()->null_value()));
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698