| Index: runtime/vm/intermediate_language_x64.cc
|
| diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
|
| index f999bddfbcdc320f15ba3c5fa5d488e672545a59..d7b162da13f103154057e182eff5e63f8c070387 100644
|
| --- a/runtime/vm/intermediate_language_x64.cc
|
| +++ b/runtime/vm/intermediate_language_x64.cc
|
| @@ -734,13 +734,16 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| __ leaq(RAX,
|
| Address(RBP, kFirstLocalSlotFromFp * kWordSize));
|
| }
|
| + const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
|
| + const bool is_leaf_call =
|
| + (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
|
| __ LoadImmediate(
|
| RBX, Immediate(reinterpret_cast<uword>(native_c_function())), PP);
|
| __ LoadImmediate(
|
| - R10, Immediate(NativeArguments::ComputeArgcTag(function())), PP);
|
| - const ExternalLabel* stub_entry =
|
| - (is_bootstrap_native()) ? &StubCode::CallBootstrapCFunctionLabel() :
|
| - &StubCode::CallNativeCFunctionLabel();
|
| + R10, Immediate(argc_tag), PP);
|
| + const ExternalLabel* stub_entry = (is_bootstrap_native() || is_leaf_call) ?
|
| + &StubCode::CallBootstrapCFunctionLabel() :
|
| + &StubCode::CallNativeCFunctionLabel();
|
| compiler->GenerateCall(token_pos(),
|
| stub_entry,
|
| PcDescriptors::kOther,
|
|
|