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

Unified Diff: runtime/vm/stub_code_x64.cc

Issue 2506503002: Revert "Revert "JumpToFrame refactor"" + Fix (Closed)
Patch Set: new client Created 4 years, 1 month 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 | « runtime/vm/stub_code_mips.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_x64.cc
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 9ca6a6e2b27e0ed5a5fe162117d3c8e209cd8f9f..167154b0879d8c515d929e4a1b98c2cff9935c90 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -1845,33 +1845,17 @@ void StubCode::GenerateGetStackPointerStub(Assembler* assembler) {
}
-// Jump to the exception or error handler.
+// Jump to a frame on the call stack.
// TOS + 0: return address
// Arg1: program counter
// Arg2: stack pointer
// Arg3: frame_pointer
-// Arg4: exception object
-// Arg5: stacktrace object
-// Arg6: thread
+// Arg4: thread
// No Result.
-void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) {
- ASSERT(kExceptionObjectReg == RAX);
- ASSERT(kStackTraceObjectReg == RDX);
- ASSERT(CallingConventions::kArg4Reg != kStackTraceObjectReg);
- ASSERT(CallingConventions::kArg1Reg != kStackTraceObjectReg);
-
-#if defined(_WIN64)
- Register stacktrace_reg = RBX;
- __ movq(stacktrace_reg, Address(RSP, 5 * kWordSize));
- __ movq(THR, Address(RSP, 6 * kWordSize));
-#else
- Register stacktrace_reg = CallingConventions::kArg5Reg;
- __ movq(THR, CallingConventions::kArg6Reg);
-#endif
+void StubCode::GenerateJumpToFrameStub(Assembler* assembler) {
+ __ movq(THR, CallingConventions::kArg4Reg);
__ movq(RBP, CallingConventions::kArg3Reg);
__ movq(RSP, CallingConventions::kArg2Reg);
- __ movq(kStackTraceObjectReg, stacktrace_reg);
- __ movq(kExceptionObjectReg, CallingConventions::kArg4Reg);
// Set the tag.
__ movq(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId));
// Clear top exit frame.
@@ -1879,7 +1863,31 @@ void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) {
// Restore the pool pointer.
__ RestoreCodePointer();
__ LoadPoolPointer(PP);
- __ jmp(CallingConventions::kArg1Reg); // Jump to the exception handler code.
+ __ jmp(CallingConventions::kArg1Reg); // Jump to program counter.
+}
+
+
+// Run an exception handler. Execution comes from JumpToFrame stub.
+//
+// The arguments are stored in the Thread object.
+// No result.
+void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) {
+ ASSERT(kExceptionObjectReg == RAX);
+ ASSERT(kStackTraceObjectReg == RDX);
+ __ movq(CallingConventions::kArg1Reg,
+ Address(THR, Thread::resume_pc_offset()));
+
+ // Load the exception from the current thread.
+ Address exception_addr(THR, Thread::active_exception_offset());
+ __ movq(kExceptionObjectReg, exception_addr);
+ __ movq(exception_addr, Immediate(0));
+
+ // Load the stacktrace from the current thread.
+ Address stacktrace_addr(THR, Thread::active_stacktrace_offset());
+ __ movq(kStackTraceObjectReg, stacktrace_addr);
+ __ movq(stacktrace_addr, Immediate(0));
+
+ __ jmp(CallingConventions::kArg1Reg); // Jump to continuation point.
}
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698