OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 } | 772 } |
773 | 773 |
774 | 774 |
775 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, | 775 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, |
776 bool opt) const { | 776 bool opt) const { |
777 return MakeCallSummary(zone); | 777 return MakeCallSummary(zone); |
778 } | 778 } |
779 | 779 |
780 | 780 |
781 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 781 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 782 SetupNative(); |
782 const Register result = locs()->out(0).reg(); | 783 const Register result = locs()->out(0).reg(); |
783 | 784 |
784 // Push the result place holder initialized to NULL. | 785 // Push the result place holder initialized to NULL. |
785 __ PushObject(Object::null_object()); | 786 __ PushObject(Object::null_object()); |
786 // Pass a pointer to the first argument in R2. | 787 // Pass a pointer to the first argument in R2. |
787 if (!function().HasOptionalParameters()) { | 788 if (!function().HasOptionalParameters()) { |
788 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + | 789 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
789 function().NumParameters()) * kWordSize); | 790 function().NumParameters()) * kWordSize); |
790 } else { | 791 } else { |
791 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); | 792 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); |
792 } | 793 } |
793 // Compute the effective address. When running under the simulator, | 794 // Compute the effective address. When running under the simulator, |
794 // this is a redirection address that forces the simulator to call | 795 // this is a redirection address that forces the simulator to call |
795 // into the runtime system. | 796 // into the runtime system. |
796 uword entry; | 797 uword entry; |
797 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 798 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
798 const bool is_leaf_call = | 799 const bool is_leaf_call = |
799 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | 800 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; |
800 const StubEntry* stub_entry; | 801 const StubEntry* stub_entry; |
801 if (link_lazily()) { | 802 if (link_lazily()) { |
802 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 803 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
803 entry = NativeEntry::LinkNativeCallEntry(); | 804 entry = NativeEntry::LinkNativeCallEntry(); |
804 } else { | 805 } else { |
805 entry = reinterpret_cast<uword>(native_c_function()); | 806 entry = reinterpret_cast<uword>(native_c_function()); |
806 if (is_bootstrap_native() || is_leaf_call) { | 807 if (is_bootstrap_native() || is_leaf_call) { |
807 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 808 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
808 #if defined(USING_SIMULATOR) | 809 #if defined(USING_SIMULATOR) |
809 entry = Simulator::RedirectExternalReference( | 810 entry = Simulator::RedirectExternalReference( |
(...skipping 4812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5622 1, | 5623 1, |
5623 locs()); | 5624 locs()); |
5624 __ Drop(1); | 5625 __ Drop(1); |
5625 __ Pop(result); | 5626 __ Pop(result); |
5626 } | 5627 } |
5627 | 5628 |
5628 | 5629 |
5629 } // namespace dart | 5630 } // namespace dart |
5630 | 5631 |
5631 #endif // defined TARGET_ARCH_ARM64 | 5632 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |