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/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + | 789 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
790 function().NumParameters()) * kWordSize); | 790 function().NumParameters()) * kWordSize); |
791 } else { | 791 } else { |
792 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); | 792 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); |
793 } | 793 } |
794 // Compute the effective address. When running under the simulator, | 794 // Compute the effective address. When running under the simulator, |
795 // this is a redirection address that forces the simulator to call | 795 // this is a redirection address that forces the simulator to call |
796 // into the runtime system. | 796 // into the runtime system. |
797 uword entry; | 797 uword entry; |
798 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 798 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
799 const bool is_leaf_call = | |
800 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | |
801 const StubEntry* stub_entry; | 799 const StubEntry* stub_entry; |
802 if (link_lazily()) { | 800 if (link_lazily()) { |
803 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 801 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
804 entry = NativeEntry::LinkNativeCallEntry(); | 802 entry = NativeEntry::LinkNativeCallEntry(); |
805 } else { | 803 } else { |
806 entry = reinterpret_cast<uword>(native_c_function()); | 804 entry = reinterpret_cast<uword>(native_c_function()); |
807 if (is_bootstrap_native() || is_leaf_call) { | 805 if (is_bootstrap_native()) { |
808 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 806 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
809 #if defined(USING_SIMULATOR) | 807 #if defined(USING_SIMULATOR) |
810 entry = Simulator::RedirectExternalReference( | 808 entry = Simulator::RedirectExternalReference( |
811 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); | 809 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); |
812 #endif | 810 #endif |
813 } else { | 811 } else { |
814 // In the case of non bootstrap native methods the CallNativeCFunction | 812 // In the case of non bootstrap native methods the CallNativeCFunction |
815 // stub generates the redirection address when running under the simulator | 813 // stub generates the redirection address when running under the simulator |
816 // and hence we do not change 'entry' here. | 814 // and hence we do not change 'entry' here. |
817 stub_entry = StubCode::CallNativeCFunction_entry(); | 815 stub_entry = StubCode::CallNativeCFunction_entry(); |
818 #if defined(USING_SIMULATOR) | |
819 if (!function().IsNativeAutoSetupScope()) { | |
820 entry = Simulator::RedirectExternalReference( | |
821 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); | |
822 } | |
823 #endif | |
824 } | 816 } |
825 } | 817 } |
826 __ LoadImmediate(R1, argc_tag); | 818 __ LoadImmediate(R1, argc_tag); |
827 ExternalLabel label(entry); | 819 ExternalLabel label(entry); |
828 __ LoadNativeEntry(R5, &label); | 820 __ LoadNativeEntry(R5, &label); |
829 compiler->GenerateCall(token_pos(), | 821 compiler->GenerateCall(token_pos(), |
830 *stub_entry, | 822 *stub_entry, |
831 RawPcDescriptors::kOther, | 823 RawPcDescriptors::kOther, |
832 locs()); | 824 locs()); |
833 __ Pop(result); | 825 __ Pop(result); |
(...skipping 4788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5622 1, | 5614 1, |
5623 locs()); | 5615 locs()); |
5624 __ Drop(1); | 5616 __ Drop(1); |
5625 __ Pop(result); | 5617 __ Pop(result); |
5626 } | 5618 } |
5627 | 5619 |
5628 | 5620 |
5629 } // namespace dart | 5621 } // namespace dart |
5630 | 5622 |
5631 #endif // defined TARGET_ARCH_ARM64 | 5623 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |