| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 GenerateDictionaryLoad(masm, &slow, dictionary, | 755 GenerateDictionaryLoad(masm, &slow, dictionary, |
| 756 LoadDescriptor::NameRegister(), rbx, rdi, rax); | 756 LoadDescriptor::NameRegister(), rbx, rdi, rax); |
| 757 __ ret(0); | 757 __ ret(0); |
| 758 | 758 |
| 759 // Dictionary load failed, go slow (but don't miss). | 759 // Dictionary load failed, go slow (but don't miss). |
| 760 __ bind(&slow); | 760 __ bind(&slow); |
| 761 GenerateRuntimeGetProperty(masm); | 761 GenerateRuntimeGetProperty(masm); |
| 762 } | 762 } |
| 763 | 763 |
| 764 | 764 |
| 765 // A register that isn't one of the parameters to the load ic. | 765 static void LoadIC_PushArgs(MacroAssembler* masm) { |
| 766 static const Register LoadIC_TempRegister() { return rbx; } | 766 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 767 Register name = LoadDescriptor::NameRegister(); |
| 768 if (FLAG_vector_ics) { |
| 769 Register slot = VectorLoadICDescriptor::SlotRegister(); |
| 770 Register vector = VectorLoadICDescriptor::VectorRegister(); |
| 771 DCHECK(!rdi.is(receiver) && !rdi.is(name) && !rdi.is(slot) && |
| 772 !rdi.is(vector)); |
| 767 | 773 |
| 774 __ PopReturnAddressTo(rdi); |
| 775 __ Push(receiver); |
| 776 __ Push(name); |
| 777 __ Push(slot); |
| 778 __ Push(vector); |
| 779 __ PushReturnAddressFrom(rdi); |
| 780 } else { |
| 781 DCHECK(!rbx.is(receiver) && !rbx.is(name)); |
| 768 | 782 |
| 769 static const Register KeyedLoadIC_TempRegister() { return rbx; } | 783 __ PopReturnAddressTo(rbx); |
| 784 __ Push(receiver); |
| 785 __ Push(name); |
| 786 __ PushReturnAddressFrom(rbx); |
| 787 } |
| 788 } |
| 770 | 789 |
| 771 | 790 |
| 772 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 791 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
| 773 // The return address is on the stack. | 792 // The return address is on the stack. |
| 774 | 793 |
| 775 Counters* counters = masm->isolate()->counters(); | 794 Counters* counters = masm->isolate()->counters(); |
| 776 __ IncrementCounter(counters->load_miss(), 1); | 795 __ IncrementCounter(counters->load_miss(), 1); |
| 777 | 796 |
| 778 __ PopReturnAddressTo(LoadIC_TempRegister()); | 797 LoadIC_PushArgs(masm); |
| 779 __ Push(LoadDescriptor::ReceiverRegister()); // receiver | |
| 780 __ Push(LoadDescriptor::NameRegister()); // name | |
| 781 __ PushReturnAddressFrom(LoadIC_TempRegister()); | |
| 782 | 798 |
| 783 // Perform tail call to the entry. | 799 // Perform tail call to the entry. |
| 784 ExternalReference ref = | 800 ExternalReference ref = |
| 785 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); | 801 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); |
| 786 __ TailCallExternalReference(ref, 2, 1); | 802 int arg_count = FLAG_vector_ics ? 4 : 2; |
| 803 __ TailCallExternalReference(ref, arg_count, 1); |
| 787 } | 804 } |
| 788 | 805 |
| 789 | 806 |
| 790 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 807 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 791 // The return address is on the stack. | 808 // The return address is on the stack. |
| 809 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 810 Register name = LoadDescriptor::NameRegister(); |
| 811 DCHECK(!rbx.is(receiver) && !rbx.is(name)); |
| 792 | 812 |
| 793 __ PopReturnAddressTo(LoadIC_TempRegister()); | 813 __ PopReturnAddressTo(rbx); |
| 794 __ Push(LoadDescriptor::ReceiverRegister()); // receiver | 814 __ Push(receiver); |
| 795 __ Push(LoadDescriptor::NameRegister()); // name | 815 __ Push(name); |
| 796 __ PushReturnAddressFrom(LoadIC_TempRegister()); | 816 __ PushReturnAddressFrom(rbx); |
| 797 | 817 |
| 798 // Perform tail call to the entry. | 818 // Perform tail call to the entry. |
| 799 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); | 819 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
| 800 } | 820 } |
| 801 | 821 |
| 802 | 822 |
| 803 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 823 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| 804 // The return address is on the stack. | 824 // The return address is on the stack. |
| 805 Counters* counters = masm->isolate()->counters(); | 825 Counters* counters = masm->isolate()->counters(); |
| 806 __ IncrementCounter(counters->keyed_load_miss(), 1); | 826 __ IncrementCounter(counters->keyed_load_miss(), 1); |
| 807 | 827 |
| 808 __ PopReturnAddressTo(KeyedLoadIC_TempRegister()); | 828 LoadIC_PushArgs(masm); |
| 809 __ Push(LoadDescriptor::ReceiverRegister()); // receiver | |
| 810 __ Push(LoadDescriptor::NameRegister()); // name | |
| 811 __ PushReturnAddressFrom(KeyedLoadIC_TempRegister()); | |
| 812 | 829 |
| 813 // Perform tail call to the entry. | 830 // Perform tail call to the entry. |
| 814 ExternalReference ref = | 831 ExternalReference ref = |
| 815 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); | 832 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
| 816 __ TailCallExternalReference(ref, 2, 1); | 833 int arg_count = FLAG_vector_ics ? 4 : 2; |
| 834 __ TailCallExternalReference(ref, arg_count, 1); |
| 817 } | 835 } |
| 818 | 836 |
| 819 | 837 |
| 820 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 838 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 821 // The return address is on the stack. | 839 // The return address is on the stack. |
| 840 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 841 Register name = LoadDescriptor::NameRegister(); |
| 842 DCHECK(!rbx.is(receiver) && !rbx.is(name)); |
| 822 | 843 |
| 823 __ PopReturnAddressTo(KeyedLoadIC_TempRegister()); | 844 __ PopReturnAddressTo(rbx); |
| 824 __ Push(LoadDescriptor::ReceiverRegister()); // receiver | 845 __ Push(receiver); |
| 825 __ Push(LoadDescriptor::NameRegister()); // name | 846 __ Push(name); |
| 826 __ PushReturnAddressFrom(KeyedLoadIC_TempRegister()); | 847 __ PushReturnAddressFrom(rbx); |
| 827 | 848 |
| 828 // Perform tail call to the entry. | 849 // Perform tail call to the entry. |
| 829 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); | 850 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); |
| 830 } | 851 } |
| 831 | 852 |
| 832 | 853 |
| 833 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 854 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
| 834 // The return address is on the stack. | 855 // The return address is on the stack. |
| 835 | 856 |
| 836 // Get the receiver from the stack and probe the stub cache. | 857 // Get the receiver from the stack and probe the stub cache. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 Condition cc = | 990 Condition cc = |
| 970 (check == ENABLE_INLINED_SMI_CHECK) | 991 (check == ENABLE_INLINED_SMI_CHECK) |
| 971 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 992 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 972 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 993 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 973 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 994 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 974 } | 995 } |
| 975 } | 996 } |
| 976 } // namespace v8::internal | 997 } // namespace v8::internal |
| 977 | 998 |
| 978 #endif // V8_TARGET_ARCH_X64 | 999 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |