Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: runtime/vm/intermediate_language_mips.cc

Issue 1294113004: VM: Link native calls lazily. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 // Pass a pointer to the first argument in A2. 981 // Pass a pointer to the first argument in A2.
982 if (!function().HasOptionalParameters()) { 982 if (!function().HasOptionalParameters()) {
983 __ AddImmediate(A2, FP, (kParamEndSlotFromFp + 983 __ AddImmediate(A2, FP, (kParamEndSlotFromFp +
984 function().NumParameters()) * kWordSize); 984 function().NumParameters()) * kWordSize);
985 } else { 985 } else {
986 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); 986 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize);
987 } 987 }
988 // Compute the effective address. When running under the simulator, 988 // Compute the effective address. When running under the simulator,
989 // this is a redirection address that forces the simulator to call 989 // this is a redirection address that forces the simulator to call
990 // into the runtime system. 990 // into the runtime system.
991 uword entry = reinterpret_cast<uword>(native_c_function()); 991 uword entry;
992 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); 992 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
993 const bool is_leaf_call = 993 const bool is_leaf_call =
994 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; 994 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
995 const StubEntry* stub_entry = NULL; 995 const StubEntry* stub_entry;
996 if (is_bootstrap_native() || is_leaf_call) { 996 if (link_lazily()) {
997 stub_entry = StubCode::CallBootstrapCFunction_entry(); 997 stub_entry = StubCode::CallBootstrapCFunction_entry();
998 entry = reinterpret_cast<uword>(&NativeEntry::LinkNativeCall);
998 #if defined(USING_SIMULATOR) 999 #if defined(USING_SIMULATOR)
999 entry = Simulator::RedirectExternalReference( 1000 entry = Simulator::RedirectExternalReference(
1000 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 1001 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
1001 #endif 1002 #endif
1002 } else { 1003 } else {
1003 // In the case of non bootstrap native methods the CallNativeCFunction 1004 entry = reinterpret_cast<uword>(native_c_function());
1004 // stub generates the redirection address when running under the simulator 1005 if (is_bootstrap_native() || is_leaf_call) {
1005 // and hence we do not change 'entry' here. 1006 stub_entry = StubCode::CallBootstrapCFunction_entry();
1006 stub_entry = StubCode::CallNativeCFunction_entry();
1007 #if defined(USING_SIMULATOR) 1007 #if defined(USING_SIMULATOR)
1008 if (!function().IsNativeAutoSetupScope()) {
1009 entry = Simulator::RedirectExternalReference( 1008 entry = Simulator::RedirectExternalReference(
1010 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 1009 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
1010 #endif
1011 } else {
1012 // In the case of non bootstrap native methods the CallNativeCFunction
1013 // stub generates the redirection address when running under the simulator
1014 // and hence we do not change 'entry' here.
1015 stub_entry = StubCode::CallNativeCFunction_entry();
1016 #if defined(USING_SIMULATOR)
1017 if (!function().IsNativeAutoSetupScope()) {
1018 entry = Simulator::RedirectExternalReference(
1019 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
1020 }
1021 #endif
1011 } 1022 }
1012 #endif
1013 } 1023 }
1024 __ LoadImmediate(A1, argc_tag);
1014 ExternalLabel label(entry); 1025 ExternalLabel label(entry);
1015 __ LoadExternalLabel(T5, &label, kNotPatchable); 1026 __ LoadExternalLabel(T5, &label, kNotPatchable);
1016 __ LoadImmediate(A1, argc_tag);
1017 compiler->GenerateCall(token_pos(), 1027 compiler->GenerateCall(token_pos(),
1018 *stub_entry, 1028 *stub_entry,
1019 RawPcDescriptors::kOther, 1029 RawPcDescriptors::kOther,
1020 locs()); 1030 locs());
1021 __ Pop(result); 1031 __ Pop(result);
1022 } 1032 }
1023 1033
1024 1034
1025 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone, 1035 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone,
1026 bool opt) const { 1036 bool opt) const {
(...skipping 4561 matching lines...) Expand 10 before | Expand all | Expand 10 after
5588 1, 5598 1,
5589 locs()); 5599 locs());
5590 __ lw(result, Address(SP, 1 * kWordSize)); 5600 __ lw(result, Address(SP, 1 * kWordSize));
5591 __ addiu(SP, SP, Immediate(2 * kWordSize)); 5601 __ addiu(SP, SP, Immediate(2 * kWordSize));
5592 } 5602 }
5593 5603
5594 5604
5595 } // namespace dart 5605 } // namespace dart
5596 5606
5597 #endif // defined TARGET_ARCH_MIPS 5607 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698