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

Unified Diff: vm/stub_code_ia32.cc

Issue 10664004: Fix issue 1968, replace usage of inline 'asm' constructs in 'stack alignment', 'jump to exception h… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 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 | « vm/stub_code_arm.cc ('k') | vm/stub_code_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/stub_code_ia32.cc
===================================================================
--- vm/stub_code_ia32.cc (revision 9040)
+++ vm/stub_code_ia32.cc (working copy)
@@ -1906,6 +1906,52 @@
GenerateSubtypeNTestCacheStub(assembler, 3);
}
+
+// Return the current stack pointer address, used to stack alignment
+// checks.
+// TOS + 0: return address
+// Result in EAX.
+void StubCode::GenerateGetStackPointerStub(Assembler* assembler) {
+ __ leal(EAX, Address(ESP, kWordSize));
+ __ ret();
+}
+
+
+// Jump to the exception handler.
+// TOS + 0: return address
+// TOS + 1: program_counter
+// TOS + 2: stack_pointer
+// TOS + 3: frame_pointer
+// TOS + 4: exception object
+// TOS + 5: stacktrace object
+// No Result.
+void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) {
+ ASSERT(kExceptionObjectReg == EAX);
+ ASSERT(kStackTraceObjectReg == EDX);
+ __ movl(kStackTraceObjectReg, Address(ESP, 5 * kWordSize));
+ __ movl(kExceptionObjectReg, Address(ESP, 4 * kWordSize));
+ __ 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.
+ __ jmp(EBX); // Jump to the exception handler code.
+}
+
+
+// Jump to the error handler.
+// TOS + 0: return address
+// TOS + 1: program_counter
+// TOS + 2: stack_pointer
+// TOS + 3: frame_pointer
+// TOS + 4: error object
+// No Result.
+void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) {
+ __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object.
+ __ 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.
+ __ jmp(EBX); // Jump to the exception handler code.
+}
+
} // namespace dart
#endif // defined TARGET_ARCH_IA32
« no previous file with comments | « vm/stub_code_arm.cc ('k') | vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698