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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
9 #include "src/ic/ic-compiler.h" | 9 #include "src/ic/ic-compiler.h" |
10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 TypeFeedbackVector::DummyVector(masm->isolate()); | 575 TypeFeedbackVector::DummyVector(masm->isolate()); |
576 int slot_index = dummy_vector->GetIndex( | 576 int slot_index = dummy_vector->GetIndex( |
577 FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot)); | 577 FeedbackVectorICSlot(TypeFeedbackVector::kDummyKeyedStoreICSlot)); |
578 __ Move(vector, dummy_vector); | 578 __ Move(vector, dummy_vector); |
579 __ Move(slot, Smi::FromInt(slot_index)); | 579 __ Move(slot, Smi::FromInt(slot_index)); |
580 } | 580 } |
581 | 581 |
582 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 582 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
583 Code::ComputeHandlerFlags(Code::STORE_IC)); | 583 Code::ComputeHandlerFlags(Code::STORE_IC)); |
584 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags, | 584 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags, |
585 receiver, key, r9, no_reg); | 585 receiver, key, rbx, no_reg); |
586 // Cache miss. | 586 // Cache miss. |
587 __ jmp(&miss); | 587 __ jmp(&miss); |
588 | 588 |
589 // Extra capacity case: Check if there is extra capacity to | 589 // Extra capacity case: Check if there is extra capacity to |
590 // perform the store and update the length. Used for adding one | 590 // perform the store and update the length. Used for adding one |
591 // element to the array by writing to array[array.length]. | 591 // element to the array by writing to array[array.length]. |
592 __ bind(&extra); | 592 __ bind(&extra); |
593 // receiver is a JSArray. | 593 // receiver is a JSArray. |
594 // rbx: receiver's elements array (a FixedArray) | 594 // rbx: receiver's elements array (a FixedArray) |
595 // flags: smicompare (receiver.length(), rbx) | 595 // flags: smicompare (receiver.length(), rbx) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 __ PushReturnAddressFrom(rbx); | 728 __ PushReturnAddressFrom(rbx); |
729 | 729 |
730 // Do tail-call to runtime routine. | 730 // Do tail-call to runtime routine. |
731 __ TailCallRuntime(is_strong(language_mode) ? Runtime::kKeyedGetPropertyStrong | 731 __ TailCallRuntime(is_strong(language_mode) ? Runtime::kKeyedGetPropertyStrong |
732 : Runtime::kKeyedGetProperty, | 732 : Runtime::kKeyedGetProperty, |
733 2, 1); | 733 2, 1); |
734 } | 734 } |
735 | 735 |
736 | 736 |
737 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 737 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
738 if (FLAG_vector_stores) { | 738 // The return address is on the stack. |
739 // This shouldn't be called. | |
740 __ int3(); | |
741 return; | |
742 } | |
743 | 739 |
744 // The return address is on the stack. | |
745 // Get the receiver from the stack and probe the stub cache. | 740 // Get the receiver from the stack and probe the stub cache. |
746 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 741 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
747 Code::ComputeHandlerFlags(Code::STORE_IC)); | 742 Code::ComputeHandlerFlags(Code::STORE_IC)); |
748 masm->isolate()->stub_cache()->GenerateProbe( | 743 masm->isolate()->stub_cache()->GenerateProbe( |
749 masm, Code::STORE_IC, flags, StoreDescriptor::ReceiverRegister(), | 744 masm, Code::STORE_IC, flags, StoreDescriptor::ReceiverRegister(), |
750 StoreDescriptor::NameRegister(), rbx, no_reg); | 745 StoreDescriptor::NameRegister(), rbx, no_reg); |
751 | 746 |
752 // Cache miss: Jump to runtime. | 747 // Cache miss: Jump to runtime. |
753 GenerateMiss(masm); | 748 GenerateMiss(masm); |
754 } | 749 } |
(...skipping 28 matching lines...) Expand all Loading... |
783 // Perform tail call to the entry. | 778 // Perform tail call to the entry. |
784 int args = FLAG_vector_stores ? 5 : 3; | 779 int args = FLAG_vector_stores ? 5 : 3; |
785 __ TailCallRuntime(Runtime::kStoreIC_Miss, args, 1); | 780 __ TailCallRuntime(Runtime::kStoreIC_Miss, args, 1); |
786 } | 781 } |
787 | 782 |
788 | 783 |
789 void StoreIC::GenerateNormal(MacroAssembler* masm) { | 784 void StoreIC::GenerateNormal(MacroAssembler* masm) { |
790 Register receiver = StoreDescriptor::ReceiverRegister(); | 785 Register receiver = StoreDescriptor::ReceiverRegister(); |
791 Register name = StoreDescriptor::NameRegister(); | 786 Register name = StoreDescriptor::NameRegister(); |
792 Register value = StoreDescriptor::ValueRegister(); | 787 Register value = StoreDescriptor::ValueRegister(); |
793 Register dictionary = r11; | 788 Register dictionary = rbx; |
794 DCHECK(!FLAG_vector_stores || | |
795 !AreAliased(dictionary, VectorStoreICDescriptor::VectorRegister(), | |
796 VectorStoreICDescriptor::SlotRegister())); | |
797 | 789 |
798 Label miss; | 790 Label miss; |
799 | 791 |
800 __ movp(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 792 __ movp(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
801 GenerateDictionaryStore(masm, &miss, dictionary, name, value, r8, r9); | 793 GenerateDictionaryStore(masm, &miss, dictionary, name, value, r8, r9); |
802 Counters* counters = masm->isolate()->counters(); | 794 Counters* counters = masm->isolate()->counters(); |
803 __ IncrementCounter(counters->store_normal_hit(), 1); | 795 __ IncrementCounter(counters->store_normal_hit(), 1); |
804 __ ret(0); | 796 __ ret(0); |
805 | 797 |
806 __ bind(&miss); | 798 __ bind(&miss); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 Condition cc = | 878 Condition cc = |
887 (check == ENABLE_INLINED_SMI_CHECK) | 879 (check == ENABLE_INLINED_SMI_CHECK) |
888 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 880 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
889 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 881 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
890 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 882 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
891 } | 883 } |
892 } // namespace internal | 884 } // namespace internal |
893 } // namespace v8 | 885 } // namespace v8 |
894 | 886 |
895 #endif // V8_TARGET_ARCH_X64 | 887 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |