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). |