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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 227723002: VM: Implement closure calls as instance calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: adjust inlining of dispatchers Created 6 years, 8 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/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.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 34916)
+++ runtime/vm/stub_code_ia32.cc (working copy)
@@ -700,82 +700,6 @@
}
-// Input parameters:
-// EDX: Arguments descriptor array.
-// Note: The closure object is the first argument to the function being
-// called, the stub accesses the closure from this location directly
-// when trying to resolve the call.
-// Uses EDI.
-void StubCode::GenerateCallClosureFunctionStub(Assembler* assembler) {
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
-
- // Load num_args.
- __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
- // Load closure object in EDI.
- __ movl(EDI, Address(ESP, EAX, TIMES_2, 0)); // EAX is a Smi.
-
- // Verify that EDI is a closure by checking its class.
- Label not_closure;
- __ cmpl(EDI, raw_null);
- // Not a closure, but null object.
- __ j(EQUAL, &not_closure, Assembler::kNearJump);
- __ testl(EDI, Immediate(kSmiTagMask));
- __ j(ZERO, &not_closure, Assembler::kNearJump); // Not a closure, but a smi.
- // Verify that the class of the object is a closure class by checking that
- // class.signature_function() is not null.
- __ LoadClass(EAX, EDI, ECX);
- __ movl(EAX, FieldAddress(EAX, Class::signature_function_offset()));
- __ cmpl(EAX, raw_null);
- // Actual class is not a closure class.
- __ j(EQUAL, &not_closure, Assembler::kNearJump);
-
- // EAX is just the signature function. Load the actual closure function.
- __ movl(EAX, FieldAddress(EDI, Closure::function_offset()));
-
- // Load closure context in CTX; note that CTX has already been preserved.
- __ movl(CTX, FieldAddress(EDI, Closure::context_offset()));
-
- // EBX: Code (compiled code or lazy compile stub).
- __ movl(EBX, FieldAddress(EAX, Function::code_offset()));
-
- // EAX: Function.
- // EDX: Arguments descriptor array.
- // ECX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
- __ xorl(ECX, ECX);
- __ movl(EBX, FieldAddress(EBX, Code::instructions_offset()));
- __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
- __ jmp(EBX);
-
- __ Bind(&not_closure);
- // Call runtime to attempt to resolve and invoke a call method on a
- // non-closure object, passing the non-closure object and its arguments array,
- // returning here.
- // If no call method exists, throw a NoSuchMethodError.
- // EDI: non-closure object.
- // EDX: arguments descriptor array.
-
- // Create a stub frame as we are pushing some objects on the stack before
- // calling into the runtime.
- __ EnterStubFrame();
-
- __ pushl(raw_null); // Setup space on stack for result from error reporting.
- __ pushl(EDX); // Arguments descriptor.
- // Load smi-tagged arguments array length, including the non-closure.
- __ movl(EDX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
- PushArgumentsArray(assembler);
-
- __ CallRuntime(kInvokeNonClosureRuntimeEntry, 2);
- // Remove arguments.
- __ Drop(2);
- __ popl(EAX); // Get result into EAX.
-
- // Remove the stub frame as we are about to return.
- __ LeaveFrame();
- __ ret();
-}
-
-
// Called when invoking dart code from C++ (VM code).
// Input parameters:
// ESP : points to return address.
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698