| 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..306e8f36ee6c3e25cd580aaac1a3a739e24a5655 100644
|
| --- a/runtime/vm/intermediate_language_x64.cc
|
| +++ b/runtime/vm/intermediate_language_x64.cc
|
| @@ -723,6 +723,9 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| ASSERT(locs()->temp(1).reg() == RBX);
|
| ASSERT(locs()->temp(2).reg() == R10);
|
| Register result = locs()->out(0).reg();
|
| + const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
|
| + const bool is_leaf_call =
|
| + (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
|
|
|
| // Push the result place holder initialized to NULL.
|
| __ PushObject(Object::ZoneHandle(), PP);
|
| @@ -737,10 +740,10 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| __ 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,
|
|
|