Index: src/ia32/builtins-ia32.cc |
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc |
index b90a17f6c3896d755ee926d3ba107424daec7c98..2a80294c5748f0fc7b372c1a0c797818757f44c8 100644 |
--- a/src/ia32/builtins-ia32.cc |
+++ b/src/ia32/builtins-ia32.cc |
@@ -1337,22 +1337,31 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
__ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
} |
- // If the result was -1 it means that we couldn't optimize the |
- // function. Just return and continue in the unoptimized version. |
Label skip; |
- __ cmp(eax, Immediate(Smi::FromInt(-1))); |
+ // If the code object is null, just return to the unoptimized code. |
+ __ cmp(eax, Immediate(0)); |
__ j(not_equal, &skip, Label::kNear); |
__ ret(0); |
__ bind(&skip); |
- // Untag the AST id and push it on the stack. |
- __ SmiUntag(eax); |
- __ push(eax); |
- |
- // Generate the code for doing the frame-to-frame translation using |
- // the deoptimizer infrastructure. |
- Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
- generator.Generate(); |
+ |
+ // Load deoptimization data from the code object. |
+ __ mov(ebx, Operand(eax, Code::kDeoptimizationDataOffset - kHeapObjectTag)); |
+ |
+ // Load the OSR entrypoint offset from the deoptimization data. |
+ __ mov(ebx, Operand(ebx, FixedArray::kHeaderSize + |
Michael Starzinger
2013/07/31 14:55:50
nit: Use the following instead, easier to read ...
|
+ DeoptimizationInputData::kOsrPcOffsetIndex * kPointerSize |
+ - kHeapObjectTag)); |
+ __ SmiUntag(ebx); |
+ |
+ // Compute the target address = code_obj + header_size + osr_offset |
+ __ lea(eax, Operand(eax, ebx, times_1, Code::kHeaderSize - kHeapObjectTag)); |
+ |
+ // Overwrite the return address on the stack. |
+ __ mov(Operand(esp, 0), eax); |
+ |
+ // And "return" to the OSR entry point of the function. |
+ __ ret(0); |
} |