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

Unified Diff: runtime/vm/stub_code_arm.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.h ('k') | runtime/vm/stub_code_arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_arm.cc
===================================================================
--- runtime/vm/stub_code_arm.cc (revision 34916)
+++ runtime/vm/stub_code_arm.cc (working copy)
@@ -729,83 +729,6 @@
}
-// Input parameters:
-// LR: return address.
-// SP: address of last argument.
-// R4: 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.
- __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
- __ sub(R0, R0, ShifterOperand(Smi::RawValue(1)));
- // Load closure object in R1.
- __ ldr(R1, Address(SP, R0, LSL, 1)); // R0 (num_args - 1) is a Smi.
-
- // Verify that R1 is a closure by checking its class.
- Label not_closure;
- __ LoadImmediate(R8, reinterpret_cast<intptr_t>(Object::null()));
- __ cmp(R1, ShifterOperand(R8));
- // Not a closure, but null object.
- __ b(&not_closure, EQ);
- __ tst(R1, ShifterOperand(kSmiTagMask));
- __ b(&not_closure, EQ); // 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(R0, R1, R2);
- __ ldr(R0, FieldAddress(R0, Class::signature_function_offset()));
- __ cmp(R0, ShifterOperand(R8)); // R8 is raw null.
- // Actual class is not a closure class.
- __ b(&not_closure, EQ);
-
- // R0 is just the signature function. Load the actual closure function.
- __ ldr(R0, FieldAddress(R1, Closure::function_offset()));
-
- // Load closure context in CTX; note that CTX has already been preserved.
- __ ldr(CTX, FieldAddress(R1, Closure::context_offset()));
-
- // R4: Arguments descriptor.
- // R0: Function.
- __ ldr(R2, FieldAddress(R0, Function::code_offset()));
-
- // R2: code.
- // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
- __ LoadImmediate(R5, 0);
- __ ldr(R2, FieldAddress(R2, Code::instructions_offset()));
- __ AddImmediate(R2, Instructions::HeaderSize() - kHeapObjectTag);
- __ bx(R2);
-
- __ 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.
- // R1: non-closure object.
- // R4: 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 error reporting.
- __ PushList((1 << R4) | (1 << R8)); // Arguments descriptor and raw null.
-
- // Load smi-tagged arguments array length, including the non-closure.
- __ ldr(R2, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
- PushArgumentsArray(assembler);
-
- __ CallRuntime(kInvokeNonClosureRuntimeEntry, 2);
- // Remove arguments.
- __ Drop(2);
- __ Pop(R0); // Get result into R0.
-
- // Remove the stub frame as we are about to return.
- __ LeaveStubFrame();
- __ Ret();
-}
-
-
// Called when invoking Dart code from C++ (VM code).
// Input parameters:
// LR : points to return address.
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/stub_code_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698