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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 __ AddImmediate(A2, FP, (kParamEndSlotFromFp + | 986 __ AddImmediate(A2, FP, (kParamEndSlotFromFp + |
987 function().NumParameters()) * kWordSize); | 987 function().NumParameters()) * kWordSize); |
988 } else { | 988 } else { |
989 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); | 989 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); |
990 } | 990 } |
991 // Compute the effective address. When running under the simulator, | 991 // Compute the effective address. When running under the simulator, |
992 // this is a redirection address that forces the simulator to call | 992 // this is a redirection address that forces the simulator to call |
993 // into the runtime system. | 993 // into the runtime system. |
994 uword entry; | 994 uword entry; |
995 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 995 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
996 const bool is_leaf_call = | |
997 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | |
998 const StubEntry* stub_entry; | 996 const StubEntry* stub_entry; |
999 if (link_lazily()) { | 997 if (link_lazily()) { |
1000 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 998 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
1001 entry = NativeEntry::LinkNativeCallEntry(); | 999 entry = NativeEntry::LinkNativeCallEntry(); |
1002 } else { | 1000 } else { |
1003 entry = reinterpret_cast<uword>(native_c_function()); | 1001 entry = reinterpret_cast<uword>(native_c_function()); |
1004 if (is_bootstrap_native() || is_leaf_call) { | 1002 if (is_bootstrap_native()) { |
1005 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 1003 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
1006 #if defined(USING_SIMULATOR) | 1004 #if defined(USING_SIMULATOR) |
1007 entry = Simulator::RedirectExternalReference( | 1005 entry = Simulator::RedirectExternalReference( |
1008 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); | 1006 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); |
1009 #endif | 1007 #endif |
1010 } else { | 1008 } else { |
1011 // In the case of non bootstrap native methods the CallNativeCFunction | 1009 // In the case of non bootstrap native methods the CallNativeCFunction |
1012 // stub generates the redirection address when running under the simulator | 1010 // stub generates the redirection address when running under the simulator |
1013 // and hence we do not change 'entry' here. | 1011 // and hence we do not change 'entry' here. |
1014 stub_entry = StubCode::CallNativeCFunction_entry(); | 1012 stub_entry = StubCode::CallNativeCFunction_entry(); |
1015 #if defined(USING_SIMULATOR) | |
1016 if (!function().IsNativeAutoSetupScope()) { | |
1017 entry = Simulator::RedirectExternalReference( | |
1018 entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments); | |
1019 } | |
1020 #endif | |
1021 } | 1013 } |
1022 } | 1014 } |
1023 __ LoadImmediate(A1, argc_tag); | 1015 __ LoadImmediate(A1, argc_tag); |
1024 ExternalLabel label(entry); | 1016 ExternalLabel label(entry); |
1025 __ LoadNativeEntry(T5, &label, kNotPatchable); | 1017 __ LoadNativeEntry(T5, &label, kNotPatchable); |
1026 compiler->GenerateCall(token_pos(), | 1018 compiler->GenerateCall(token_pos(), |
1027 *stub_entry, | 1019 *stub_entry, |
1028 RawPcDescriptors::kOther, | 1020 RawPcDescriptors::kOther, |
1029 locs()); | 1021 locs()); |
1030 __ Pop(result); | 1022 __ Pop(result); |
(...skipping 4566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5597 1, | 5589 1, |
5598 locs()); | 5590 locs()); |
5599 __ lw(result, Address(SP, 1 * kWordSize)); | 5591 __ lw(result, Address(SP, 1 * kWordSize)); |
5600 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5592 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5601 } | 5593 } |
5602 | 5594 |
5603 | 5595 |
5604 } // namespace dart | 5596 } // namespace dart |
5605 | 5597 |
5606 #endif // defined TARGET_ARCH_MIPS | 5598 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |