| 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, rbx, no_reg); | 585 receiver, key, r9, 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) { |
| 739 // This shouldn't be called. |
| 740 __ int3(); |
| 741 return; |
| 742 } |
| 743 |
| 738 // The return address is on the stack. | 744 // The return address is on the stack. |
| 739 | |
| 740 // Get the receiver from the stack and probe the stub cache. | 745 // Get the receiver from the stack and probe the stub cache. |
| 741 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 746 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
| 742 Code::ComputeHandlerFlags(Code::STORE_IC)); | 747 Code::ComputeHandlerFlags(Code::STORE_IC)); |
| 743 masm->isolate()->stub_cache()->GenerateProbe( | 748 masm->isolate()->stub_cache()->GenerateProbe( |
| 744 masm, Code::STORE_IC, flags, StoreDescriptor::ReceiverRegister(), | 749 masm, Code::STORE_IC, flags, StoreDescriptor::ReceiverRegister(), |
| 745 StoreDescriptor::NameRegister(), rbx, no_reg); | 750 StoreDescriptor::NameRegister(), rbx, no_reg); |
| 746 | 751 |
| 747 // Cache miss: Jump to runtime. | 752 // Cache miss: Jump to runtime. |
| 748 GenerateMiss(masm); | 753 GenerateMiss(masm); |
| 749 } | 754 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 778 // Perform tail call to the entry. | 783 // Perform tail call to the entry. |
| 779 int args = FLAG_vector_stores ? 5 : 3; | 784 int args = FLAG_vector_stores ? 5 : 3; |
| 780 __ TailCallRuntime(Runtime::kStoreIC_Miss, args, 1); | 785 __ TailCallRuntime(Runtime::kStoreIC_Miss, args, 1); |
| 781 } | 786 } |
| 782 | 787 |
| 783 | 788 |
| 784 void StoreIC::GenerateNormal(MacroAssembler* masm) { | 789 void StoreIC::GenerateNormal(MacroAssembler* masm) { |
| 785 Register receiver = StoreDescriptor::ReceiverRegister(); | 790 Register receiver = StoreDescriptor::ReceiverRegister(); |
| 786 Register name = StoreDescriptor::NameRegister(); | 791 Register name = StoreDescriptor::NameRegister(); |
| 787 Register value = StoreDescriptor::ValueRegister(); | 792 Register value = StoreDescriptor::ValueRegister(); |
| 788 Register dictionary = rbx; | 793 Register dictionary = r11; |
| 794 DCHECK(!FLAG_vector_stores || |
| 795 !AreAliased(dictionary, VectorStoreICDescriptor::VectorRegister(), |
| 796 VectorStoreICDescriptor::SlotRegister())); |
| 789 | 797 |
| 790 Label miss; | 798 Label miss; |
| 791 | 799 |
| 792 __ movp(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 800 __ movp(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
| 793 GenerateDictionaryStore(masm, &miss, dictionary, name, value, r8, r9); | 801 GenerateDictionaryStore(masm, &miss, dictionary, name, value, r8, r9); |
| 794 Counters* counters = masm->isolate()->counters(); | 802 Counters* counters = masm->isolate()->counters(); |
| 795 __ IncrementCounter(counters->store_normal_hit(), 1); | 803 __ IncrementCounter(counters->store_normal_hit(), 1); |
| 796 __ ret(0); | 804 __ ret(0); |
| 797 | 805 |
| 798 __ bind(&miss); | 806 __ bind(&miss); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 Condition cc = | 886 Condition cc = |
| 879 (check == ENABLE_INLINED_SMI_CHECK) | 887 (check == ENABLE_INLINED_SMI_CHECK) |
| 880 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 888 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 881 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 889 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 882 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 890 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 883 } | 891 } |
| 884 } // namespace internal | 892 } // namespace internal |
| 885 } // namespace v8 | 893 } // namespace v8 |
| 886 | 894 |
| 887 #endif // V8_TARGET_ARCH_X64 | 895 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |