| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 if (!function().HasOptionalParameters()) { | 762 if (!function().HasOptionalParameters()) { |
| 763 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + | 763 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
| 764 function().NumParameters()) * kWordSize, PP); | 764 function().NumParameters()) * kWordSize, PP); |
| 765 } else { | 765 } else { |
| 766 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize, PP); | 766 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize, PP); |
| 767 } | 767 } |
| 768 // Compute the effective address. When running under the simulator, | 768 // Compute the effective address. When running under the simulator, |
| 769 // this is a redirection address that forces the simulator to call | 769 // this is a redirection address that forces the simulator to call |
| 770 // into the runtime system. | 770 // into the runtime system. |
| 771 uword entry = reinterpret_cast<uword>(native_c_function()); | 771 uword entry = reinterpret_cast<uword>(native_c_function()); |
| 772 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
| 773 const bool is_leaf_call = |
| 774 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
| 772 const ExternalLabel* stub_entry; | 775 const ExternalLabel* stub_entry; |
| 773 if (is_bootstrap_native()) { | 776 if (is_bootstrap_native() || is_leaf_call) { |
| 774 stub_entry = &StubCode::CallBootstrapCFunctionLabel(); | 777 stub_entry = &StubCode::CallBootstrapCFunctionLabel(); |
| 775 #if defined(USING_SIMULATOR) | 778 #if defined(USING_SIMULATOR) |
| 776 entry = Simulator::RedirectExternalReference( | 779 entry = Simulator::RedirectExternalReference( |
| 777 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 780 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
| 778 #endif | 781 #endif |
| 779 } else { | 782 } else { |
| 780 // In the case of non bootstrap native methods the CallNativeCFunction | 783 // In the case of non bootstrap native methods the CallNativeCFunction |
| 781 // stub generates the redirection address when running under the simulator | 784 // stub generates the redirection address when running under the simulator |
| 782 // and hence we do not change 'entry' here. | 785 // and hence we do not change 'entry' here. |
| 783 stub_entry = &StubCode::CallNativeCFunctionLabel(); | 786 stub_entry = &StubCode::CallNativeCFunctionLabel(); |
| 784 #if defined(USING_SIMULATOR) | 787 #if defined(USING_SIMULATOR) |
| 785 if (!function().IsNativeAutoSetupScope()) { | 788 if (!function().IsNativeAutoSetupScope()) { |
| 786 entry = Simulator::RedirectExternalReference( | 789 entry = Simulator::RedirectExternalReference( |
| 787 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 790 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
| 788 } | 791 } |
| 789 #endif | 792 #endif |
| 790 } | 793 } |
| 791 __ LoadImmediate(R5, entry, PP); | 794 __ LoadImmediate(R5, entry, PP); |
| 792 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function()), PP); | 795 __ LoadImmediate(R1, argc_tag, PP); |
| 793 compiler->GenerateCall(token_pos(), | 796 compiler->GenerateCall(token_pos(), |
| 794 stub_entry, | 797 stub_entry, |
| 795 PcDescriptors::kOther, | 798 PcDescriptors::kOther, |
| 796 locs()); | 799 locs()); |
| 797 __ Pop(result); | 800 __ Pop(result); |
| 798 } | 801 } |
| 799 | 802 |
| 800 | 803 |
| 801 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate, | 804 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate, |
| 802 bool opt) const { | 805 bool opt) const { |
| (...skipping 4519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5322 compiler->GenerateCall(token_pos(), | 5325 compiler->GenerateCall(token_pos(), |
| 5323 &label, | 5326 &label, |
| 5324 PcDescriptors::kOther, | 5327 PcDescriptors::kOther, |
| 5325 locs()); | 5328 locs()); |
| 5326 __ Drop(ArgumentCount()); // Discard arguments. | 5329 __ Drop(ArgumentCount()); // Discard arguments. |
| 5327 } | 5330 } |
| 5328 | 5331 |
| 5329 } // namespace dart | 5332 } // namespace dart |
| 5330 | 5333 |
| 5331 #endif // defined TARGET_ARCH_ARM64 | 5334 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |