Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 2424433002: [ic] Delete old KeyedLoadIC code (Closed)
Patch Set: fix failing test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 3659 matching lines...) Expand 10 before | Expand all | Expand 10 after
3670 movp(map, FieldOperand(heap_object, HeapObject::kMapOffset)); 3670 movp(map, FieldOperand(heap_object, HeapObject::kMapOffset));
3671 CmpInstanceType(map, type); 3671 CmpInstanceType(map, type);
3672 } 3672 }
3673 3673
3674 3674
3675 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) { 3675 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) {
3676 cmpb(FieldOperand(map, Map::kInstanceTypeOffset), 3676 cmpb(FieldOperand(map, Map::kInstanceTypeOffset),
3677 Immediate(static_cast<int8_t>(type))); 3677 Immediate(static_cast<int8_t>(type)));
3678 } 3678 }
3679 3679
3680
3681 void MacroAssembler::CheckFastElements(Register map,
3682 Label* fail,
3683 Label::Distance distance) {
3684 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
3685 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
3686 STATIC_ASSERT(FAST_ELEMENTS == 2);
3687 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
3688 cmpb(FieldOperand(map, Map::kBitField2Offset),
3689 Immediate(Map::kMaximumBitField2FastHoleyElementValue));
3690 j(above, fail, distance);
3691 }
3692
3693
3694 void MacroAssembler::CheckFastObjectElements(Register map, 3680 void MacroAssembler::CheckFastObjectElements(Register map,
3695 Label* fail, 3681 Label* fail,
3696 Label::Distance distance) { 3682 Label::Distance distance) {
3697 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 3683 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0);
3698 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); 3684 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
3699 STATIC_ASSERT(FAST_ELEMENTS == 2); 3685 STATIC_ASSERT(FAST_ELEMENTS == 2);
3700 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); 3686 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
3701 cmpb(FieldOperand(map, Map::kBitField2Offset), 3687 cmpb(FieldOperand(map, Map::kBitField2Offset),
3702 Immediate(Map::kMaximumBitField2FastHoleySmiElementValue)); 3688 Immediate(Map::kMaximumBitField2FastHoleySmiElementValue));
3703 j(below_equal, fail, distance); 3689 j(below_equal, fail, distance);
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
4793 xorl(r0, scratch); 4779 xorl(r0, scratch);
4794 // hash = hash * 2057; 4780 // hash = hash * 2057;
4795 imull(r0, r0, Immediate(2057)); 4781 imull(r0, r0, Immediate(2057));
4796 // hash = hash ^ (hash >> 16); 4782 // hash = hash ^ (hash >> 16);
4797 movl(scratch, r0); 4783 movl(scratch, r0);
4798 shrl(scratch, Immediate(16)); 4784 shrl(scratch, Immediate(16));
4799 xorl(r0, scratch); 4785 xorl(r0, scratch);
4800 andl(r0, Immediate(0x3fffffff)); 4786 andl(r0, Immediate(0x3fffffff));
4801 } 4787 }
4802 4788
4803
4804
4805 void MacroAssembler::LoadFromNumberDictionary(Label* miss,
4806 Register elements,
4807 Register key,
4808 Register r0,
4809 Register r1,
4810 Register r2,
4811 Register result) {
4812 // Register use:
4813 //
4814 // elements - holds the slow-case elements of the receiver on entry.
4815 // Unchanged unless 'result' is the same register.
4816 //
4817 // key - holds the smi key on entry.
4818 // Unchanged unless 'result' is the same register.
4819 //
4820 // Scratch registers:
4821 //
4822 // r0 - holds the untagged key on entry and holds the hash once computed.
4823 //
4824 // r1 - used to hold the capacity mask of the dictionary
4825 //
4826 // r2 - used for the index into the dictionary.
4827 //
4828 // result - holds the result on exit if the load succeeded.
4829 // Allowed to be the same as 'key' or 'result'.
4830 // Unchanged on bailout so 'key' or 'result' can be used
4831 // in further computation.
4832
4833 Label done;
4834
4835 GetNumberHash(r0, r1);
4836
4837 // Compute capacity mask.
4838 SmiToInteger32(r1, FieldOperand(elements,
4839 SeededNumberDictionary::kCapacityOffset));
4840 decl(r1);
4841
4842 // Generate an unrolled loop that performs a few probes before giving up.
4843 for (int i = 0; i < kNumberDictionaryProbes; i++) {
4844 // Use r2 for index calculations and keep the hash intact in r0.
4845 movp(r2, r0);
4846 // Compute the masked index: (hash + i + i * i) & mask.
4847 if (i > 0) {
4848 addl(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i)));
4849 }
4850 andp(r2, r1);
4851
4852 // Scale the index by multiplying by the entry size.
4853 DCHECK(SeededNumberDictionary::kEntrySize == 3);
4854 leap(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3
4855
4856 // Check if the key matches.
4857 cmpp(key, FieldOperand(elements,
4858 r2,
4859 times_pointer_size,
4860 SeededNumberDictionary::kElementsStartOffset));
4861 if (i != (kNumberDictionaryProbes - 1)) {
4862 j(equal, &done);
4863 } else {
4864 j(not_equal, miss);
4865 }
4866 }
4867
4868 bind(&done);
4869 // Check that the value is a field property.
4870 const int kDetailsOffset =
4871 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize;
4872 DCHECK_EQ(DATA, 0);
4873 Test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset),
4874 Smi::FromInt(PropertyDetails::TypeField::kMask));
4875 j(not_zero, miss);
4876
4877 // Get the value at the masked, scaled index.
4878 const int kValueOffset =
4879 SeededNumberDictionary::kElementsStartOffset + kPointerSize;
4880 movp(result, FieldOperand(elements, r2, times_pointer_size, kValueOffset));
4881 }
4882
4883
4884 void MacroAssembler::LoadAllocationTopHelper(Register result, 4789 void MacroAssembler::LoadAllocationTopHelper(Register result,
4885 Register scratch, 4790 Register scratch,
4886 AllocationFlags flags) { 4791 AllocationFlags flags) {
4887 ExternalReference allocation_top = 4792 ExternalReference allocation_top =
4888 AllocationUtils::GetAllocationTopReference(isolate(), flags); 4793 AllocationUtils::GetAllocationTopReference(isolate(), flags);
4889 4794
4890 // Just return if allocation top is already known. 4795 // Just return if allocation top is already known.
4891 if ((flags & RESULT_CONTAINS_TOP) != 0) { 4796 if ((flags & RESULT_CONTAINS_TOP) != 0) {
4892 // No use of scratch if allocation top is provided. 4797 // No use of scratch if allocation top is provided.
4893 DCHECK(!scratch.is_valid()); 4798 DCHECK(!scratch.is_valid());
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
5822 movl(rax, dividend); 5727 movl(rax, dividend);
5823 shrl(rax, Immediate(31)); 5728 shrl(rax, Immediate(31));
5824 addl(rdx, rax); 5729 addl(rdx, rax);
5825 } 5730 }
5826 5731
5827 5732
5828 } // namespace internal 5733 } // namespace internal
5829 } // namespace v8 5734 } // namespace v8
5830 5735
5831 #endif // V8_TARGET_ARCH_X64 5736 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698