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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 } | 918 } |
919 | 919 |
920 | 920 |
921 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, | 921 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, |
922 bool opt) const { | 922 bool opt) const { |
923 return MakeCallSummary(zone); | 923 return MakeCallSummary(zone); |
924 } | 924 } |
925 | 925 |
926 | 926 |
927 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 927 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 928 SetupNative(); |
928 const Register result = locs()->out(0).reg(); | 929 const Register result = locs()->out(0).reg(); |
929 | 930 |
930 // Push the result place holder initialized to NULL. | 931 // Push the result place holder initialized to NULL. |
931 __ PushObject(Object::null_object()); | 932 __ PushObject(Object::null_object()); |
932 // Pass a pointer to the first argument in R2. | 933 // Pass a pointer to the first argument in R2. |
933 if (!function().HasOptionalParameters()) { | 934 if (!function().HasOptionalParameters()) { |
934 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + | 935 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
935 function().NumParameters()) * kWordSize); | 936 function().NumParameters()) * kWordSize); |
936 } else { | 937 } else { |
937 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); | 938 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); |
938 } | 939 } |
939 // Compute the effective address. When running under the simulator, | 940 // Compute the effective address. When running under the simulator, |
940 // this is a redirection address that forces the simulator to call | 941 // this is a redirection address that forces the simulator to call |
941 // into the runtime system. | 942 // into the runtime system. |
942 uword entry; | 943 uword entry; |
943 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 944 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
944 const bool is_leaf_call = | 945 const bool is_leaf_call = |
945 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | 946 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
946 const StubEntry* stub_entry; | 947 const StubEntry* stub_entry; |
947 if (link_lazily()) { | 948 if (link_lazily()) { |
948 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 949 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
949 entry = NativeEntry::LinkNativeCallEntry(); | 950 entry = NativeEntry::LinkNativeCallEntry(); |
950 } else { | 951 } else { |
951 entry = reinterpret_cast<uword>(native_c_function()); | 952 entry = reinterpret_cast<uword>(native_c_function()); |
952 if (is_bootstrap_native() || is_leaf_call) { | 953 if (is_bootstrap_native() || is_leaf_call) { |
953 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 954 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
954 #if defined(USING_SIMULATOR) | 955 #if defined(USING_SIMULATOR) |
955 entry = Simulator::RedirectExternalReference( | 956 entry = Simulator::RedirectExternalReference( |
(...skipping 5904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6860 1, | 6861 1, |
6861 locs()); | 6862 locs()); |
6862 __ Drop(1); | 6863 __ Drop(1); |
6863 __ Pop(result); | 6864 __ Pop(result); |
6864 } | 6865 } |
6865 | 6866 |
6866 | 6867 |
6867 } // namespace dart | 6868 } // namespace dart |
6868 | 6869 |
6869 #endif // defined TARGET_ARCH_ARM | 6870 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |