Chromium Code Reviews| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 &slow); | 326 &slow); |
| 327 | 327 |
| 328 // If the receiver is a fast-case object, check the stub cache. Otherwise | 328 // If the receiver is a fast-case object, check the stub cache. Otherwise |
| 329 // probe the dictionary. | 329 // probe the dictionary. |
| 330 __ movp(rbx, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 330 __ movp(rbx, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
| 331 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), | 331 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), |
| 332 Heap::kHashTableMapRootIndex); | 332 Heap::kHashTableMapRootIndex); |
| 333 __ j(equal, &probe_dictionary); | 333 __ j(equal, &probe_dictionary); |
| 334 | 334 |
| 335 Register megamorphic_scratch = rdi; | 335 Register megamorphic_scratch = rdi; |
| 336 if (FLAG_vector_ics) { | 336 // The handlers in the stub cache expect a |
|
Toon Verwaest
2015/05/15 09:41:27
Copy from here (but reindent the comment ... :))
mvstanton
2015/05/15 13:05:28
Done.
| |
| 337 // When vector ics are in use, the handlers in the stub cache expect a | 337 // vector and slot. Since we won't change the IC from any downstream |
| 338 // vector and slot. Since we won't change the IC from any downstream | 338 // misses, a dummy vector can be used. |
| 339 // misses, a dummy vector can be used. | 339 Register vector = VectorLoadICDescriptor::VectorRegister(); |
| 340 Register vector = VectorLoadICDescriptor::VectorRegister(); | 340 Register slot = VectorLoadICDescriptor::SlotRegister(); |
| 341 Register slot = VectorLoadICDescriptor::SlotRegister(); | 341 DCHECK(!AreAliased(megamorphic_scratch, vector, slot)); |
| 342 DCHECK(!AreAliased(megamorphic_scratch, vector, slot)); | 342 Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast( |
| 343 Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast( | 343 masm->isolate()->factory()->keyed_load_dummy_vector()); |
| 344 masm->isolate()->factory()->keyed_load_dummy_vector()); | 344 int int_slot = dummy_vector->GetIndex(FeedbackVectorICSlot(0)); |
| 345 int int_slot = dummy_vector->GetIndex(FeedbackVectorICSlot(0)); | 345 __ Move(vector, dummy_vector); |
| 346 __ Move(vector, dummy_vector); | 346 __ Move(slot, Smi::FromInt(int_slot)); |
| 347 __ Move(slot, Smi::FromInt(int_slot)); | |
| 348 } | |
| 349 | 347 |
| 350 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 348 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
| 351 Code::ComputeHandlerFlags(Code::LOAD_IC)); | 349 Code::ComputeHandlerFlags(Code::LOAD_IC)); |
| 352 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::KEYED_LOAD_IC, flags, | 350 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::KEYED_LOAD_IC, flags, |
| 353 false, receiver, key, | 351 false, receiver, key, |
| 354 megamorphic_scratch, no_reg); | 352 megamorphic_scratch, no_reg); |
| 355 // Cache miss. | 353 // Cache miss. |
| 356 GenerateMiss(masm); | 354 GenerateMiss(masm); |
| 357 | 355 |
| 358 // Do a quick inline probe of the receiver's dictionary, if it | 356 // Do a quick inline probe of the receiver's dictionary, if it |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 | 728 |
| 731 // Dictionary load failed, go slow (but don't miss). | 729 // Dictionary load failed, go slow (but don't miss). |
| 732 __ bind(&slow); | 730 __ bind(&slow); |
| 733 GenerateRuntimeGetProperty(masm); | 731 GenerateRuntimeGetProperty(masm); |
| 734 } | 732 } |
| 735 | 733 |
| 736 | 734 |
| 737 static void LoadIC_PushArgs(MacroAssembler* masm) { | 735 static void LoadIC_PushArgs(MacroAssembler* masm) { |
| 738 Register receiver = LoadDescriptor::ReceiverRegister(); | 736 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 739 Register name = LoadDescriptor::NameRegister(); | 737 Register name = LoadDescriptor::NameRegister(); |
| 740 if (FLAG_vector_ics) { | 738 Register slot = VectorLoadICDescriptor::SlotRegister(); |
| 741 Register slot = VectorLoadICDescriptor::SlotRegister(); | 739 Register vector = VectorLoadICDescriptor::VectorRegister(); |
| 742 Register vector = VectorLoadICDescriptor::VectorRegister(); | 740 DCHECK(!rdi.is(receiver) && !rdi.is(name) && !rdi.is(slot) && |
| 743 DCHECK(!rdi.is(receiver) && !rdi.is(name) && !rdi.is(slot) && | 741 !rdi.is(vector)); |
| 744 !rdi.is(vector)); | |
| 745 | 742 |
| 746 __ PopReturnAddressTo(rdi); | 743 __ PopReturnAddressTo(rdi); |
| 747 __ Push(receiver); | 744 __ Push(receiver); |
| 748 __ Push(name); | 745 __ Push(name); |
| 749 __ Push(slot); | 746 __ Push(slot); |
| 750 __ Push(vector); | 747 __ Push(vector); |
| 751 __ PushReturnAddressFrom(rdi); | 748 __ PushReturnAddressFrom(rdi); |
| 752 } else { | |
| 753 DCHECK(!rbx.is(receiver) && !rbx.is(name)); | |
| 754 | |
| 755 __ PopReturnAddressTo(rbx); | |
| 756 __ Push(receiver); | |
| 757 __ Push(name); | |
| 758 __ PushReturnAddressFrom(rbx); | |
| 759 } | |
| 760 } | 749 } |
| 761 | 750 |
| 762 | 751 |
| 763 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 752 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
| 764 // The return address is on the stack. | 753 // The return address is on the stack. |
| 765 | 754 |
| 766 Counters* counters = masm->isolate()->counters(); | 755 Counters* counters = masm->isolate()->counters(); |
| 767 __ IncrementCounter(counters->load_miss(), 1); | 756 __ IncrementCounter(counters->load_miss(), 1); |
| 768 | 757 |
| 769 LoadIC_PushArgs(masm); | 758 LoadIC_PushArgs(masm); |
| 770 | 759 |
| 771 // Perform tail call to the entry. | 760 // Perform tail call to the entry. |
| 772 ExternalReference ref = | 761 ExternalReference ref = |
| 773 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); | 762 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); |
| 774 int arg_count = FLAG_vector_ics ? 4 : 2; | 763 int arg_count = 4; |
| 775 __ TailCallExternalReference(ref, arg_count, 1); | 764 __ TailCallExternalReference(ref, arg_count, 1); |
| 776 } | 765 } |
| 777 | 766 |
| 778 | 767 |
| 779 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 768 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 780 // The return address is on the stack. | 769 // The return address is on the stack. |
| 781 Register receiver = LoadDescriptor::ReceiverRegister(); | 770 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 782 Register name = LoadDescriptor::NameRegister(); | 771 Register name = LoadDescriptor::NameRegister(); |
| 783 DCHECK(!rbx.is(receiver) && !rbx.is(name)); | 772 DCHECK(!rbx.is(receiver) && !rbx.is(name)); |
| 784 | 773 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 795 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 784 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| 796 // The return address is on the stack. | 785 // The return address is on the stack. |
| 797 Counters* counters = masm->isolate()->counters(); | 786 Counters* counters = masm->isolate()->counters(); |
| 798 __ IncrementCounter(counters->keyed_load_miss(), 1); | 787 __ IncrementCounter(counters->keyed_load_miss(), 1); |
| 799 | 788 |
| 800 LoadIC_PushArgs(masm); | 789 LoadIC_PushArgs(masm); |
| 801 | 790 |
| 802 // Perform tail call to the entry. | 791 // Perform tail call to the entry. |
| 803 ExternalReference ref = | 792 ExternalReference ref = |
| 804 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); | 793 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
| 805 int arg_count = FLAG_vector_ics ? 4 : 2; | 794 int arg_count = 4; |
| 806 __ TailCallExternalReference(ref, arg_count, 1); | 795 __ TailCallExternalReference(ref, arg_count, 1); |
| 807 } | 796 } |
| 808 | 797 |
| 809 | 798 |
| 810 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 799 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
| 811 // The return address is on the stack. | 800 // The return address is on the stack. |
| 812 Register receiver = LoadDescriptor::ReceiverRegister(); | 801 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 813 Register name = LoadDescriptor::NameRegister(); | 802 Register name = LoadDescriptor::NameRegister(); |
| 814 DCHECK(!rbx.is(receiver) && !rbx.is(name)); | 803 DCHECK(!rbx.is(receiver) && !rbx.is(name)); |
| 815 | 804 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 Condition cc = | 951 Condition cc = |
| 963 (check == ENABLE_INLINED_SMI_CHECK) | 952 (check == ENABLE_INLINED_SMI_CHECK) |
| 964 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 953 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 965 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 954 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 966 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 955 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 967 } | 956 } |
| 968 } | 957 } |
| 969 } // namespace v8::internal | 958 } // namespace v8::internal |
| 970 | 959 |
| 971 #endif // V8_TARGET_ARCH_X64 | 960 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |