| 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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + | 935 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
| 936 function().NumParameters()) * kWordSize); | 936 function().NumParameters()) * kWordSize); |
| 937 } else { | 937 } else { |
| 938 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); | 938 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); |
| 939 } | 939 } |
| 940 // Compute the effective address. When running under the simulator, | 940 // Compute the effective address. When running under the simulator, |
| 941 // this is a redirection address that forces the simulator to call | 941 // this is a redirection address that forces the simulator to call |
| 942 // into the runtime system. | 942 // into the runtime system. |
| 943 uword entry; | 943 uword entry; |
| 944 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 944 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
| 945 const bool is_leaf_call = | |
| 946 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | |
| 947 const StubEntry* stub_entry; | 945 const StubEntry* stub_entry; |
| 948 if (link_lazily()) { | 946 if (link_lazily()) { |
| 949 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 947 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
| 950 entry = NativeEntry::LinkNativeCallEntry(); | 948 entry = NativeEntry::LinkNativeCallEntry(); |
| 951 } else { | 949 } else { |
| 952 entry = reinterpret_cast<uword>(native_c_function()); | 950 entry = reinterpret_cast<uword>(native_c_function()); |
| 953 if (is_bootstrap_native() || is_leaf_call) { | 951 if (is_bootstrap_native()) { |
| 954 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 952 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
| 955 #if defined(USING_SIMULATOR) | 953 #if defined(USING_SIMULATOR) |
| 956 entry = Simulator::RedirectExternalReference( | 954 entry = Simulator::RedirectExternalReference( |
| 957 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); | 955 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); |
| 958 #endif | 956 #endif |
| 959 } else { | 957 } else { |
| 960 // In the case of non bootstrap native methods the CallNativeCFunction | 958 // In the case of non bootstrap native methods the CallNativeCFunction |
| 961 // stub generates the redirection address when running under the simulator | 959 // stub generates the redirection address when running under the simulator |
| 962 // and hence we do not change 'entry' here. | 960 // and hence we do not change 'entry' here. |
| 963 stub_entry = StubCode::CallNativeCFunction_entry(); | 961 stub_entry = StubCode::CallNativeCFunction_entry(); |
| 964 #if defined(USING_SIMULATOR) | |
| 965 if (!function().IsNativeAutoSetupScope()) { | |
| 966 entry = Simulator::RedirectExternalReference( | |
| 967 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); | |
| 968 } | |
| 969 #endif | |
| 970 } | 962 } |
| 971 } | 963 } |
| 972 __ LoadImmediate(R1, argc_tag); | 964 __ LoadImmediate(R1, argc_tag); |
| 973 ExternalLabel label(entry); | 965 ExternalLabel label(entry); |
| 974 __ LoadNativeEntry(R9, &label, link_lazily() ? kPatchable : kNotPatchable); | 966 __ LoadNativeEntry(R9, &label, link_lazily() ? kPatchable : kNotPatchable); |
| 975 compiler->GenerateCall(token_pos(), | 967 compiler->GenerateCall(token_pos(), |
| 976 *stub_entry, | 968 *stub_entry, |
| 977 RawPcDescriptors::kOther, | 969 RawPcDescriptors::kOther, |
| 978 locs()); | 970 locs()); |
| 979 __ Pop(result); | 971 __ Pop(result); |
| (...skipping 5880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6860 1, | 6852 1, |
| 6861 locs()); | 6853 locs()); |
| 6862 __ Drop(1); | 6854 __ Drop(1); |
| 6863 __ Pop(result); | 6855 __ Pop(result); |
| 6864 } | 6856 } |
| 6865 | 6857 |
| 6866 | 6858 |
| 6867 } // namespace dart | 6859 } // namespace dart |
| 6868 | 6860 |
| 6869 #endif // defined TARGET_ARCH_ARM | 6861 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |