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

Unified Diff: runtime/vm/stub_code_x64.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_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_x64.cc
===================================================================
--- runtime/vm/stub_code_x64.cc (revision 34916)
+++ runtime/vm/stub_code_x64.cc (working copy)
@@ -693,81 +693,6 @@
}
-// Input parameters:
-// R10: 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.
-void StubCode::GenerateCallClosureFunctionStub(Assembler* assembler) {
- // Load num_args.
- __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
- // Load closure object in R13.
- __ movq(R13, Address(RSP, RAX, TIMES_4, 0)); // RAX is a Smi.
-
- __ LoadObject(R12, Object::null_object(), PP);
-
- // Verify that R13 is a closure by checking its class.
- Label not_closure;
- __ cmpq(R13, R12);
- // Not a closure, but null object.
- __ j(EQUAL, &not_closure);
- __ testq(R13, Immediate(kSmiTagMask));
- __ j(ZERO, &not_closure); // 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(RAX, R13);
- __ movq(RAX, FieldAddress(RAX, Class::signature_function_offset()));
- __ cmpq(RAX, R12);
- // Actual class is not a closure class.
- __ j(EQUAL, &not_closure, Assembler::kNearJump);
-
- // RAX is just the signature function. Load the actual closure function.
- __ movq(RAX, FieldAddress(R13, Closure::function_offset()));
-
- // Load closure context in CTX; note that CTX has already been preserved.
- __ movq(CTX, FieldAddress(R13, Closure::context_offset()));
-
- // Load closure function code in RAX.
- __ movq(RCX, FieldAddress(RAX, Function::code_offset()));
-
- // RAX: Function.
- // R10: Arguments descriptor array.
- // RBX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
- __ xorq(RBX, RBX);
- __ movq(RCX, FieldAddress(RCX, Code::instructions_offset()));
- __ addq(RCX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
- __ jmp(RCX);
-
- __ 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.
- // R13: non-closure object.
- // R10: arguments descriptor array.
-
- // Create a stub frame as we are pushing some objects on the stack before
- // calling into the runtime.
- __ EnterStubFrame();
- // Setup space on stack for result from call.
- __ pushq(R12);
- __ pushq(R10); // Arguments descriptor.
- // Load smi-tagged arguments array length, including the non-closure.
- __ movq(R10, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
- PushArgumentsArray(assembler);
-
- __ CallRuntime(kInvokeNonClosureRuntimeEntry, 2);
-
- // Remove arguments.
- __ Drop(2);
- __ popq(RAX); // Get result into RAX.
-
- // Remove the stub frame as we are about to return.
- __ LeaveStubFrame();
- __ ret();
-}
-
-
// Called when invoking Dart code from C++ (VM code).
// Input parameters:
// RSP : points to return address.
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698