| Index: runtime/vm/intermediate_language_arm64.cc
|
| diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc
|
| index 99516776df31b4157960de85d6dcfae598d72a6d..ec073f7f5f641528cee0a856f01c76a9ed6b365e 100644
|
| --- a/runtime/vm/intermediate_language_arm64.cc
|
| +++ b/runtime/vm/intermediate_language_arm64.cc
|
| @@ -769,8 +769,11 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| // this is a redirection address that forces the simulator to call
|
| // into the runtime system.
|
| uword entry = reinterpret_cast<uword>(native_c_function());
|
| + const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
|
| + const bool is_leaf_call =
|
| + (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
|
| const ExternalLabel* stub_entry;
|
| - if (is_bootstrap_native()) {
|
| + if (is_bootstrap_native() || is_leaf_call) {
|
| stub_entry = &StubCode::CallBootstrapCFunctionLabel();
|
| #if defined(USING_SIMULATOR)
|
| entry = Simulator::RedirectExternalReference(
|
| @@ -789,7 +792,7 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| #endif
|
| }
|
| __ LoadImmediate(R5, entry, PP);
|
| - __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function()), PP);
|
| + __ LoadImmediate(R1, argc_tag, PP);
|
| compiler->GenerateCall(token_pos(),
|
| stub_entry,
|
| PcDescriptors::kOther,
|
|
|