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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, | 813 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, |
814 bool opt) const { | 814 bool opt) const { |
815 return MakeCallSummary(zone); | 815 return MakeCallSummary(zone); |
816 } | 816 } |
817 | 817 |
818 | 818 |
819 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 819 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
820 SetupNative(); | 820 SetupNative(); |
821 Register result = locs()->out(0).reg(); | 821 Register result = locs()->out(0).reg(); |
822 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); | 822 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); |
823 const bool is_leaf_call = | |
824 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; | |
825 | 823 |
826 // Push the result place holder initialized to NULL. | 824 // Push the result place holder initialized to NULL. |
827 __ PushObject(Object::null_object()); | 825 __ PushObject(Object::null_object()); |
828 // Pass a pointer to the first argument in EAX. | 826 // Pass a pointer to the first argument in EAX. |
829 if (!function().HasOptionalParameters()) { | 827 if (!function().HasOptionalParameters()) { |
830 __ leal(EAX, Address(EBP, (kParamEndSlotFromFp + | 828 __ leal(EAX, Address(EBP, (kParamEndSlotFromFp + |
831 function().NumParameters()) * kWordSize)); | 829 function().NumParameters()) * kWordSize)); |
832 } else { | 830 } else { |
833 __ leal(EAX, Address(EBP, kFirstLocalSlotFromFp * kWordSize)); | 831 __ leal(EAX, Address(EBP, kFirstLocalSlotFromFp * kWordSize)); |
834 } | 832 } |
835 __ movl(EDX, Immediate(argc_tag)); | 833 __ movl(EDX, Immediate(argc_tag)); |
836 | 834 |
837 const StubEntry* stub_entry; | 835 const StubEntry* stub_entry; |
838 if (link_lazily()) { | 836 if (link_lazily()) { |
839 stub_entry = StubCode::CallBootstrapCFunction_entry(); | 837 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
840 __ movl(ECX, Immediate(NativeEntry::LinkNativeCallEntry())); | 838 __ movl(ECX, Immediate(NativeEntry::LinkNativeCallEntry())); |
841 } else { | 839 } else { |
842 stub_entry = (is_bootstrap_native() || is_leaf_call) ? | 840 stub_entry = (is_bootstrap_native()) ? |
843 StubCode::CallBootstrapCFunction_entry() : | 841 StubCode::CallBootstrapCFunction_entry() : |
844 StubCode::CallNativeCFunction_entry(); | 842 StubCode::CallNativeCFunction_entry(); |
845 const ExternalLabel label(reinterpret_cast<uword>(native_c_function())); | 843 const ExternalLabel label(reinterpret_cast<uword>(native_c_function())); |
846 __ movl(ECX, Immediate(label.address())); | 844 __ movl(ECX, Immediate(label.address())); |
847 } | 845 } |
848 compiler->GenerateCall(token_pos(), | 846 compiler->GenerateCall(token_pos(), |
849 *stub_entry, | 847 *stub_entry, |
850 RawPcDescriptors::kOther, | 848 RawPcDescriptors::kOther, |
851 locs()); | 849 locs()); |
852 __ popl(result); | 850 __ popl(result); |
(...skipping 6017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6870 __ Drop(1); | 6868 __ Drop(1); |
6871 __ popl(result); | 6869 __ popl(result); |
6872 } | 6870 } |
6873 | 6871 |
6874 | 6872 |
6875 } // namespace dart | 6873 } // namespace dart |
6876 | 6874 |
6877 #undef __ | 6875 #undef __ |
6878 | 6876 |
6879 #endif // defined TARGET_ARCH_IA32 | 6877 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |