OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 // Pass a pointer to the first argument in R2. | 930 // Pass a pointer to the first argument in R2. |
931 if (!function().HasOptionalParameters()) { | 931 if (!function().HasOptionalParameters()) { |
932 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + | 932 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
933 function().NumParameters()) * kWordSize); | 933 function().NumParameters()) * kWordSize); |
934 } else { | 934 } else { |
935 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); | 935 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); |
936 } | 936 } |
937 // Compute the effective address. When running under the simulator, | 937 // Compute the effective address. When running under the simulator, |
938 // this is a redirection address that forces the simulator to call | 938 // this is a redirection address that forces the simulator to call |
939 // into the runtime system. | 939 // into the runtime system. |
940 uword entry = reinterpret_cast<uword>(native_c_function()); | 940 uword entry; |
941 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 941 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
942 const bool is_leaf_call = | 942 const bool is_leaf_call = |
943 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | 943 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
944 const StubEntry* stub_entry = NULL; | 944 const StubEntry* stub_entry; |
945 if (is_bootstrap_native() || is_leaf_call) { | 945 if (link_lazily()) { |
946 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 946 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
| 947 entry = reinterpret_cast<uword>(&NativeEntry::LinkNativeCall); |
947 #if defined(USING_SIMULATOR) | 948 #if defined(USING_SIMULATOR) |
948 entry = Simulator::RedirectExternalReference( | 949 entry = Simulator::RedirectExternalReference( |
949 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 950 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
950 #endif | 951 #endif |
951 } else { | 952 } else { |
952 // In the case of non bootstrap native methods the CallNativeCFunction | 953 entry = reinterpret_cast<uword>(native_c_function()); |
953 // stub generates the redirection address when running under the simulator | 954 if (is_bootstrap_native() || is_leaf_call) { |
954 // and hence we do not change 'entry' here. | 955 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
955 stub_entry = StubCode::CallNativeCFunction_entry(); | |
956 #if defined(USING_SIMULATOR) | 956 #if defined(USING_SIMULATOR) |
957 if (!function().IsNativeAutoSetupScope()) { | |
958 entry = Simulator::RedirectExternalReference( | 957 entry = Simulator::RedirectExternalReference( |
959 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 958 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
| 959 #endif |
| 960 } else { |
| 961 // In the case of non bootstrap native methods the CallNativeCFunction |
| 962 // stub generates the redirection address when running under the simulator |
| 963 // and hence we do not change 'entry' here. |
| 964 stub_entry = StubCode::CallNativeCFunction_entry(); |
| 965 #if defined(USING_SIMULATOR) |
| 966 if (!function().IsNativeAutoSetupScope()) { |
| 967 entry = Simulator::RedirectExternalReference( |
| 968 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
| 969 } |
| 970 #endif |
960 } | 971 } |
961 #endif | |
962 } | 972 } |
| 973 __ LoadImmediate(R1, argc_tag); |
963 ExternalLabel label(entry); | 974 ExternalLabel label(entry); |
964 __ LoadExternalLabel(R5, &label, kNotPatchable); | 975 __ LoadExternalLabel(R5, &label, link_lazily() ? kPatchable : kNotPatchable); |
965 __ LoadImmediate(R1, argc_tag); | |
966 compiler->GenerateCall(token_pos(), | 976 compiler->GenerateCall(token_pos(), |
967 *stub_entry, | 977 *stub_entry, |
968 RawPcDescriptors::kOther, | 978 RawPcDescriptors::kOther, |
969 locs()); | 979 locs()); |
970 __ Pop(result); | 980 __ Pop(result); |
971 } | 981 } |
972 | 982 |
973 | 983 |
974 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone, | 984 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone, |
975 bool opt) const { | 985 bool opt) const { |
(...skipping 5876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6852 1, | 6862 1, |
6853 locs()); | 6863 locs()); |
6854 __ Drop(1); | 6864 __ Drop(1); |
6855 __ Pop(result); | 6865 __ Pop(result); |
6856 } | 6866 } |
6857 | 6867 |
6858 | 6868 |
6859 } // namespace dart | 6869 } // namespace dart |
6860 | 6870 |
6861 #endif // defined TARGET_ARCH_ARM | 6871 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |