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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 2503653002: JumpToFrame refactor (Closed)
Patch Set: code review 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_dbc.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_ia32.cc
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 1de178a8c7d97d2d5e3fdfadf8d4634a5f18f760..ca70617824bf92fbfc39004256c45e44bdd276ba 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -1792,21 +1792,15 @@ void StubCode::GenerateGetStackPointerStub(Assembler* assembler) {
}
-// Jump to the exception or error handler.
+// Jump to a frame on the call stack.
// TOS + 0: return address
// TOS + 1: program_counter
// TOS + 2: stack_pointer
// TOS + 3: frame_pointer
-// TOS + 4: exception object
-// TOS + 5: stacktrace object
-// TOS + 6: thread
+// TOS + 4: thread
// No Result.
-void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) {
- ASSERT(kExceptionObjectReg == EAX);
- ASSERT(kStackTraceObjectReg == EDX);
- __ movl(THR, Address(ESP, 6 * kWordSize)); // Load target thread.
- __ movl(kStackTraceObjectReg, Address(ESP, 5 * kWordSize));
- __ movl(kExceptionObjectReg, Address(ESP, 4 * kWordSize));
+void StubCode::GenerateJumpToFrameStub(Assembler* assembler) {
+ __ movl(THR, Address(ESP, 4 * kWordSize)); // Load target thread.
__ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer.
__ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX.
__ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer.
@@ -1818,6 +1812,29 @@ void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) {
}
+// 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 == EAX);
+ ASSERT(kStackTraceObjectReg == EDX);
+ __ movl(EBX, Address(THR, Thread::resume_pc_offset()));
+
+ // Load the exception from the current thread.
+ Address exception_addr(THR, Thread::active_exception_offset());
+ __ movl(kExceptionObjectReg, exception_addr);
+ __ movl(exception_addr, Immediate(0));
+
+ // Load the stacktrace from the current thread.
+ Address stacktrace_addr(THR, Thread::active_stacktrace_offset());
+ __ movl(kStackTraceObjectReg, stacktrace_addr);
+ __ movl(stacktrace_addr, Immediate(0));
+
+ __ jmp(EBX); // Jump to continuation point.
+}
+
+
// Calls to the runtime to optimize the given function.
// EBX: function to be reoptimized.
// EDX: argument descriptor (preserved).
« no previous file with comments | « runtime/vm/stub_code_dbc.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698