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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 11419073: Remove loading of function object in static calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/flow_graph_compiler_x64.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 15101)
+++ runtime/vm/stub_code_ia32.cc (working copy)
@@ -183,48 +183,19 @@
// Input parameters:
-// ECX: function object.
// EDX: arguments descriptor array (num_args is first Smi element).
void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) {
const Immediate raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
-
- __ movl(EAX, FieldAddress(ECX, Function::code_offset()));
- __ cmpl(EAX, raw_null);
- Label function_compiled;
- __ j(NOT_EQUAL, &function_compiled, Assembler::kNearJump);
-
- // Create a stub frame as we are pushing some objects on the stack before
- // calling into the runtime.
AssemblerMacros::EnterStubFrame(assembler);
-
__ pushl(EDX); // Preserve arguments descriptor array.
- __ pushl(ECX);
- __ CallRuntime(kCompileFunctionRuntimeEntry);
- __ popl(ECX); // Restore read-only function object argument in ECX.
- __ popl(EDX); // Restore arguments descriptor array.
- // Restore EAX.
- __ movl(EAX, FieldAddress(ECX, Function::code_offset()));
-
- // Remove the stub frame as we are about to jump to the dart function.
- __ LeaveFrame();
-
- __ Bind(&function_compiled);
- // Patch caller.
-
- // Create a stub frame as we are pushing some objects on the stack before
- // calling into the runtime.
- AssemblerMacros::EnterStubFrame(assembler);
-
- __ pushl(EDX); // Preserve arguments descriptor array.
- __ pushl(ECX); // Preserve function object.
+ __ pushl(raw_null); // Setup space on stack for return value.
__ CallRuntime(kPatchStaticCallRuntimeEntry);
- __ popl(ECX); // Restore function object argument in ECX.
+ __ popl(EAX); // Get Code object result.
__ popl(EDX); // Restore arguments descriptor array.
// Remove the stub frame as we are about to jump to the dart function.
__ LeaveFrame();
- __ movl(EAX, FieldAddress(ECX, Function::code_offset()));
__ movl(ECX, FieldAddress(EAX, Code::instructions_offset()));
__ addl(ECX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
__ jmp(ECX);
@@ -233,20 +204,18 @@
// Called from a static call only when an invalid code has been entered
// (invalid because its function was optimized or deoptimized).
-// ECX: function object.
// EDX: arguments descriptor array (num_args is first Smi element).
void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) {
+ const Immediate raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
// Create a stub frame as we are pushing some objects on the stack before
// calling into the runtime.
AssemblerMacros::EnterStubFrame(assembler);
__ pushl(EDX); // Preserve arguments descriptor array.
- __ pushl(ECX); // Preserve target function.
- __ pushl(ECX); // Target function.
+ __ pushl(raw_null); // Setup space on stack for return value.
__ CallRuntime(kFixCallersTargetRuntimeEntry);
- __ popl(EAX); // discard argument.
- __ popl(EAX); // Restore function.
+ __ popl(EAX); // Get Code object.
__ popl(EDX); // Restore arguments descriptor array.
- __ movl(EAX, FieldAddress(EAX, Function::code_offset()));
__ movl(EAX, FieldAddress(EAX, Code::instructions_offset()));
__ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
__ LeaveFrame();
@@ -1816,23 +1785,23 @@
}
-// ECX: Function object.
// EDX: Arguments array.
// TOS(0): return address (Dart code).
void StubCode::GenerateBreakpointStaticStub(Assembler* assembler) {
// Create a stub frame as we are pushing some objects on the stack before
// calling into the runtime.
AssemblerMacros::EnterStubFrame(assembler);
- __ pushl(EDX);
- __ pushl(ECX);
+ __ pushl(EDX); // Preserve arguments descriptor.
+ const Immediate raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ __ pushl(raw_null); // Room for result.
__ CallRuntime(kBreakpointStaticHandlerRuntimeEntry);
- __ popl(ECX);
- __ popl(EDX);
+ __ popl(EAX); // Code object.
+ __ popl(EDX); // Restore arguments descriptor.
__ LeaveFrame();
// Now call the static function. The breakpoint handler function
// ensures that the call target is compiled.
- __ movl(EAX, FieldAddress(ECX, Function::code_offset()));
__ movl(ECX, FieldAddress(EAX, Code::instructions_offset()));
__ addl(ECX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
__ jmp(ECX);
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698