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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 11783066: Optimize function at its entry instead of at exit. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « runtime/vm/object.cc ('k') | runtime/vm/stub_code_x64.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
===================================================================
--- runtime/vm/stub_code_ia32.cc (revision 16874)
+++ runtime/vm/stub_code_ia32.cc (working copy)
@@ -2020,17 +2020,24 @@
// Calls to runtime to ooptimized give function
-// EDX: function to be reoptimized.
-// EAX: result of function being optimized (preserved).
+// EDI: function to be reoptimized.
+// EDX: argument descriptor (preserved).
void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) {
+ const Immediate raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
AssemblerMacros::EnterStubFrame(assembler);
- __ pushl(EAX);
__ pushl(EDX);
+ __ pushl(raw_null); // Setup space on stack for return value.
+ __ pushl(EDI);
__ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
- __ popl(EDX);
- __ popl(EAX);
+ __ popl(EAX); // Discard argument.
+ __ popl(EAX); // Get Code object
+ __ popl(EDX); // Restore argument descriptor.
+ __ movl(EAX, FieldAddress(EAX, Code::instructions_offset()));
+ __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
__ LeaveFrame();
- __ ret();
+ __ jmp(EAX);
+ __ int3();
}
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698