Index: runtime/vm/stub_code_ia32.cc |
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc |
index ca70617824bf92fbfc39004256c45e44bdd276ba..ce6521d339ddb381173946cb60d402c2210b8d9d 100644 |
--- a/runtime/vm/stub_code_ia32.cc |
+++ b/runtime/vm/stub_code_ia32.cc |
@@ -351,8 +351,6 @@ static void PushArgumentsArray(Assembler* assembler) { |
// +------------------+ |
// | return-address | (deoptimization point) |
// +------------------+ |
-// | Saved CODE_REG | |
-// +------------------+ |
// | ... | <- SP of optimized frame |
// |
// Parts of the code cannot GC, part of the code can GC. |
@@ -462,15 +460,16 @@ static void GenerateDeoptimizationSequence(Assembler* assembler, |
__ popl(ECX); // Pop return address. |
__ addl(ESP, EBX); // Remove materialization arguments. |
__ pushl(ECX); // Push return address. |
- __ ret(); |
+ // The caller is responsible for emitting the return instruction. |
} |
// EAX: result, must be preserved |
void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { |
// Return address for "call" to deopt stub. |
- __ pushl(Immediate(0xe1e1e1e1)); |
+ __ pushl(Immediate(kZapReturnAddress)); |
GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); |
+ __ ret(); |
} |
@@ -478,13 +477,15 @@ void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { |
// EDX: stacktrace, must be preserved |
void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { |
// Return address for "call" to deopt stub. |
- __ pushl(Immediate(0xe1e1e1e1)); |
+ __ pushl(Immediate(kZapReturnAddress)); |
GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); |
+ __ ret(); |
} |
void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
GenerateDeoptimizationSequence(assembler, kEagerDeopt); |
+ __ ret(); |
} |
@@ -1835,6 +1836,22 @@ void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { |
} |
+// Deoptimize a frame on the call stack before rewinding. |
+// The arguments are stored in the Thread object. |
+// No result. |
+void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) { |
+ // Push the deopt pc. |
+ __ pushl(Address(THR, Thread::resume_pc_offset())); |
+ GenerateDeoptimizationSequence(assembler, kEagerDeopt); |
+ |
+ // After we have deoptimized, jump to the correct frame. |
+ __ EnterStubFrame(); |
+ __ CallRuntime(kRewindPostDeoptRuntimeEntry, 0); |
+ __ LeaveFrame(); |
+ __ int3(); |
+} |
+ |
+ |
// Calls to the runtime to optimize the given function. |
// EBX: function to be reoptimized. |
// EDX: argument descriptor (preserved). |