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

Unified Diff: src/x64/macro-assembler-x64.cc

Issue 960273002: Move stack unwinding logic into the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Win64 (finally). Created 5 years, 10 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/x64/macro-assembler-x64.h ('k') | test/mjsunit/regexp-stack-overflow.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index 5d11886603c359497667797a835ac4ebff69ae0e..8e4448d46fceeacfd090b749d86e1e3b98c5a8f1 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -2972,106 +2972,6 @@ void MacroAssembler::PopTryHandler() {
}
-void MacroAssembler::JumpToHandlerEntry() {
- // Compute the handler entry address and jump to it. The handler table is
- // a fixed array of (smi-tagged) code offsets.
- // rax = exception, rdi = code object, rdx = state.
- movp(rbx, FieldOperand(rdi, Code::kHandlerTableOffset));
- shrp(rdx, Immediate(StackHandler::kKindWidth));
- movp(rdx,
- FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize));
- SmiToInteger64(rdx, rdx);
- leap(rdi, FieldOperand(rdi, rdx, times_1, Code::kHeaderSize));
- jmp(rdi);
-}
-
-
-void MacroAssembler::Throw(Register value) {
- // Adjust this code if not the case.
- STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize +
- kFPOnStackSize);
- STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
- STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize);
- STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize);
- STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize);
- STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize);
-
- // The exception is expected in rax.
- if (!value.is(rax)) {
- movp(rax, value);
- }
- // Drop the stack pointer to the top of the top handler.
- ExternalReference handler_address(Isolate::kHandlerAddress, isolate());
- movp(rsp, ExternalOperand(handler_address));
- // Restore the next handler.
- Pop(ExternalOperand(handler_address));
-
- // Remove the code object and state, compute the handler address in rdi.
- Pop(rdi); // Code object.
- Pop(rdx); // Offset and state.
-
- // Restore the context and frame pointer.
- Pop(rsi); // Context.
- popq(rbp); // Frame pointer.
-
- // If the handler is a JS frame, restore the context to the frame.
- // (kind == ENTRY) == (rbp == 0) == (rsi == 0), so we could test either
- // rbp or rsi.
- Label skip;
- testp(rsi, rsi);
- j(zero, &skip, Label::kNear);
- movp(Operand(rbp, StandardFrameConstants::kContextOffset), rsi);
- bind(&skip);
-
- JumpToHandlerEntry();
-}
-
-
-void MacroAssembler::ThrowUncatchable(Register value) {
- // Adjust this code if not the case.
- STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize +
- kFPOnStackSize);
- STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
- STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize);
- STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize);
- STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize);
- STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize);
-
- // The exception is expected in rax.
- if (!value.is(rax)) {
- movp(rax, value);
- }
- // Drop the stack pointer to the top of the top stack handler.
- ExternalReference handler_address(Isolate::kHandlerAddress, isolate());
- Load(rsp, handler_address);
-
- // Unwind the handlers until the top ENTRY handler is found.
- Label fetch_next, check_kind;
- jmp(&check_kind, Label::kNear);
- bind(&fetch_next);
- movp(rsp, Operand(rsp, StackHandlerConstants::kNextOffset));
-
- bind(&check_kind);
- STATIC_ASSERT(StackHandler::JS_ENTRY == 0);
- testl(Operand(rsp, StackHandlerConstants::kStateOffset),
- Immediate(StackHandler::KindField::kMask));
- j(not_zero, &fetch_next);
-
- // Set the top handler address to next handler past the top ENTRY handler.
- Pop(ExternalOperand(handler_address));
-
- // Remove the code object and state, compute the handler address in rdi.
- Pop(rdi); // Code object.
- Pop(rdx); // Offset and state.
-
- // Clear the context pointer and frame pointer (0 was saved in the handler).
- Pop(rsi);
- popq(rbp);
-
- JumpToHandlerEntry();
-}
-
-
void MacroAssembler::Ret() {
ret(0);
}
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/mjsunit/regexp-stack-overflow.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698