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