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

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

Issue 315223003: Use CallBootstrapC stub for leaf native calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 if (!function().HasOptionalParameters()) { 872 if (!function().HasOptionalParameters()) {
873 __ AddImmediate(A2, FP, (kParamEndSlotFromFp + 873 __ AddImmediate(A2, FP, (kParamEndSlotFromFp +
874 function().NumParameters()) * kWordSize); 874 function().NumParameters()) * kWordSize);
875 } else { 875 } else {
876 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); 876 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize);
877 } 877 }
878 // Compute the effective address. When running under the simulator, 878 // Compute the effective address. When running under the simulator,
879 // this is a redirection address that forces the simulator to call 879 // this is a redirection address that forces the simulator to call
880 // into the runtime system. 880 // into the runtime system.
881 uword entry = reinterpret_cast<uword>(native_c_function()); 881 uword entry = reinterpret_cast<uword>(native_c_function());
882 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
883 const bool is_leaf_call =
884 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
882 const ExternalLabel* stub_entry; 885 const ExternalLabel* stub_entry;
883 if (is_bootstrap_native()) { 886 if (is_bootstrap_native() || is_leaf_call) {
884 stub_entry = &StubCode::CallBootstrapCFunctionLabel(); 887 stub_entry = &StubCode::CallBootstrapCFunctionLabel();
885 #if defined(USING_SIMULATOR) 888 #if defined(USING_SIMULATOR)
886 entry = Simulator::RedirectExternalReference( 889 entry = Simulator::RedirectExternalReference(
887 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 890 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
888 #endif 891 #endif
889 } else { 892 } else {
890 // In the case of non bootstrap native methods the CallNativeCFunction 893 // In the case of non bootstrap native methods the CallNativeCFunction
891 // stub generates the redirection address when running under the simulator 894 // stub generates the redirection address when running under the simulator
892 // and hence we do not change 'entry' here. 895 // and hence we do not change 'entry' here.
893 stub_entry = &StubCode::CallNativeCFunctionLabel(); 896 stub_entry = &StubCode::CallNativeCFunctionLabel();
894 #if defined(USING_SIMULATOR) 897 #if defined(USING_SIMULATOR)
895 if (!function().IsNativeAutoSetupScope()) { 898 if (!function().IsNativeAutoSetupScope()) {
896 entry = Simulator::RedirectExternalReference( 899 entry = Simulator::RedirectExternalReference(
897 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); 900 entry, Simulator::kBootstrapNativeCall, function().NumParameters());
898 } 901 }
899 #endif 902 #endif
900 } 903 }
901 __ LoadImmediate(T5, entry); 904 __ LoadImmediate(T5, entry);
902 __ LoadImmediate(A1, NativeArguments::ComputeArgcTag(function())); 905 __ LoadImmediate(A1, argc_tag);
903 compiler->GenerateCall(token_pos(), 906 compiler->GenerateCall(token_pos(),
904 stub_entry, 907 stub_entry,
905 PcDescriptors::kOther, 908 PcDescriptors::kOther,
906 locs()); 909 locs());
907 __ Pop(result); 910 __ Pop(result);
908 } 911 }
909 912
910 913
911 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate, 914 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Isolate* isolate,
912 bool opt) const { 915 bool opt) const {
(...skipping 3762 matching lines...) Expand 10 before | Expand all | Expand 10 after
4675 compiler->GenerateCall(token_pos(), 4678 compiler->GenerateCall(token_pos(),
4676 &label, 4679 &label,
4677 PcDescriptors::kOther, 4680 PcDescriptors::kOther,
4678 locs()); 4681 locs());
4679 __ Drop(ArgumentCount()); // Discard arguments. 4682 __ Drop(ArgumentCount()); // Discard arguments.
4680 } 4683 }
4681 4684
4682 } // namespace dart 4685 } // namespace dart
4683 4686
4684 #endif // defined TARGET_ARCH_MIPS 4687 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698