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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 774 |
775 // Push the result place holder initialized to NULL. | 775 // Push the result place holder initialized to NULL. |
776 __ PushObject(Object::null_object()); | 776 __ PushObject(Object::null_object()); |
777 // Pass a pointer to the first argument in RAX. | 777 // Pass a pointer to the first argument in RAX. |
778 if (!function().HasOptionalParameters()) { | 778 if (!function().HasOptionalParameters()) { |
779 __ leaq(RAX, Address(RBP, (kParamEndSlotFromFp + | 779 __ leaq(RAX, Address(RBP, (kParamEndSlotFromFp + |
780 function().NumParameters()) * kWordSize)); | 780 function().NumParameters()) * kWordSize)); |
781 } else { | 781 } else { |
782 __ leaq(RAX, Address(RBP, kFirstLocalSlotFromFp * kWordSize)); | 782 __ leaq(RAX, Address(RBP, kFirstLocalSlotFromFp * kWordSize)); |
783 } | 783 } |
784 ExternalLabel label(reinterpret_cast<uword>(native_c_function())); | |
785 __ LoadExternalLabel(RBX, &label, kNotPatchable); | |
786 __ LoadImmediate(R10, Immediate(argc_tag)); | 784 __ LoadImmediate(R10, Immediate(argc_tag)); |
787 const StubEntry& stub_entry = (is_bootstrap_native() || is_leaf_call) ? | 785 const StubEntry* stub_entry; |
788 *StubCode::CallBootstrapCFunction_entry() : | 786 if (link_lazily()) { |
789 *StubCode::CallNativeCFunction_entry(); | 787 stub_entry = StubCode::CallBootstrapCFunction_entry(); |
| 788 __ LoadExternalLabel( |
| 789 RBX, &NativeEntry::LinkNativeCallLabel(), kPatchable); |
| 790 } else { |
| 791 stub_entry = (is_bootstrap_native() || is_leaf_call) |
| 792 ? StubCode::CallBootstrapCFunction_entry() |
| 793 : StubCode::CallNativeCFunction_entry(); |
| 794 const ExternalLabel label(reinterpret_cast<uword>(native_c_function())); |
| 795 __ LoadExternalLabel(RBX, &label, kNotPatchable); |
| 796 } |
790 compiler->GenerateCall(token_pos(), | 797 compiler->GenerateCall(token_pos(), |
791 stub_entry, | 798 *stub_entry, |
792 RawPcDescriptors::kOther, | 799 RawPcDescriptors::kOther, |
793 locs()); | 800 locs()); |
794 __ popq(result); | 801 __ popq(result); |
795 } | 802 } |
796 | 803 |
797 | 804 |
798 static bool CanBeImmediateIndex(Value* index, intptr_t cid) { | 805 static bool CanBeImmediateIndex(Value* index, intptr_t cid) { |
799 if (!index->definition()->IsConstant()) return false; | 806 if (!index->definition()->IsConstant()) return false; |
800 const Object& constant = index->definition()->AsConstant()->value(); | 807 const Object& constant = index->definition()->AsConstant()->value(); |
801 if (!constant.IsSmi()) return false; | 808 if (!constant.IsSmi()) return false; |
(...skipping 5631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6433 __ Drop(1); | 6440 __ Drop(1); |
6434 __ popq(result); | 6441 __ popq(result); |
6435 } | 6442 } |
6436 | 6443 |
6437 | 6444 |
6438 } // namespace dart | 6445 } // namespace dart |
6439 | 6446 |
6440 #undef __ | 6447 #undef __ |
6441 | 6448 |
6442 #endif // defined TARGET_ARCH_X64 | 6449 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |