Index: vm/intermediate_language_x64.cc |
=================================================================== |
--- vm/intermediate_language_x64.cc (revision 8752) |
+++ vm/intermediate_language_x64.cc (working copy) |
@@ -578,14 +578,18 @@ |
// Push the result place holder initialized to NULL. |
__ PushObject(Object::ZoneHandle()); |
// Pass a pointer to the first argument in RAX. |
- if (!has_optional_parameters()) { |
- __ leaq(RAX, Address(RBP, (1 + argument_count()) * kWordSize)); |
+ intptr_t arg_count = argument_count(); |
+ if (is_native_instance_closure()) { |
+ arg_count += 1; |
+ } |
+ if (!has_optional_parameters() && !is_native_instance_closure()) { |
+ __ leaq(RAX, Address(RBP, (1 + arg_count) * kWordSize)); |
} else { |
__ leaq(RAX, |
Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); |
} |
__ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
- __ movq(R10, Immediate(argument_count())); |
+ __ movq(R10, Immediate(arg_count)); |
compiler->GenerateCall(token_index(), |
try_index(), |
&StubCode::CallNativeCFunctionLabel(), |