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

Side by Side Diff: src/ic/arm64/stub-cache-arm64.cc

Issue 2161153002: [ic] Fix megamorphic stub cache probing on some platforms. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
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/stub-cache.h" 9 #include "src/ic/stub-cache.h"
10 #include "src/interface-descriptors.h" 10 #include "src/interface-descriptors.h"
(...skipping 29 matching lines...) Expand all
40 uintptr_t map_off_addr = reinterpret_cast<uintptr_t>(map_offset.address()); 40 uintptr_t map_off_addr = reinterpret_cast<uintptr_t>(map_offset.address());
41 41
42 Label miss; 42 Label miss;
43 43
44 DCHECK(!AreAliased(name, offset, scratch, scratch2, scratch3)); 44 DCHECK(!AreAliased(name, offset, scratch, scratch2, scratch3));
45 45
46 // Multiply by 3 because there are 3 fields per entry. 46 // Multiply by 3 because there are 3 fields per entry.
47 __ Add(scratch3, offset, Operand(offset, LSL, 1)); 47 __ Add(scratch3, offset, Operand(offset, LSL, 1));
48 48
49 // Calculate the base address of the entry. 49 // Calculate the base address of the entry.
50 __ Mov(scratch, key_offset); 50 __ Mov(scratch, key_offset);
Jakob Kummerow 2016/07/20 12:09:45 Why is this instruction even needed? Wouldn't it s
Igor Sheludko 2016/07/20 13:40:26 Unfortunately we don't have such an instruction on
Jakob Kummerow 2016/07/20 13:50:01 Argh, my mistake. Somehow I thought |key_offset| w
51 __ Add(scratch, scratch, Operand(scratch3, LSL, kPointerSizeLog2)); 51 __ Add(
52 scratch, scratch,
53 Operand(scratch3, LSL, kPointerSizeLog2 - StubCache::kCacheIndexShift));
52 54
53 // Check that the key in the entry matches the name. 55 // Check that the key in the entry matches the name.
54 __ Ldr(scratch2, MemOperand(scratch)); 56 __ Ldr(scratch2, MemOperand(scratch));
55 __ Cmp(name, scratch2); 57 __ Cmp(name, scratch2);
56 __ B(ne, &miss); 58 __ B(ne, &miss);
57 59
58 // Check the map matches. 60 // Check the map matches.
59 __ Ldr(scratch2, MemOperand(scratch, map_off_addr - key_off_addr)); 61 __ Ldr(scratch2, MemOperand(scratch, map_off_addr - key_off_addr));
60 __ Ldr(scratch3, FieldMemOperand(receiver, HeapObject::kMapOffset)); 62 __ Ldr(scratch3, FieldMemOperand(receiver, HeapObject::kMapOffset));
61 __ Cmp(scratch2, scratch3); 63 __ Cmp(scratch2, scratch3);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 #endif 123 #endif
122 124
123 Counters* counters = masm->isolate()->counters(); 125 Counters* counters = masm->isolate()->counters();
124 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2, 126 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1, extra2,
125 extra3); 127 extra3);
126 128
127 // Check that the receiver isn't a smi. 129 // Check that the receiver isn't a smi.
128 __ JumpIfSmi(receiver, &miss); 130 __ JumpIfSmi(receiver, &miss);
129 131
130 // Compute the hash for primary table. 132 // Compute the hash for primary table.
131 __ Ldr(scratch, FieldMemOperand(name, Name::kHashFieldOffset)); 133 __ Ldr(scratch.W(), FieldMemOperand(name, Name::kHashFieldOffset));
132 __ Ldr(extra, FieldMemOperand(receiver, HeapObject::kMapOffset)); 134 __ Ldr(extra, FieldMemOperand(receiver, HeapObject::kMapOffset));
133 __ Add(scratch, scratch, extra); 135 __ Add(scratch, scratch, extra);
134 __ Eor(scratch, scratch, flags); 136 __ Eor(scratch, scratch, flags);
135 // We shift out the last two bits because they are not part of the hash. 137 __ Mov(extra, Operand(kPrimaryTableSize - 1));
136 __ Ubfx(scratch, scratch, kCacheIndexShift, 138 __ And(scratch, scratch, Operand(extra, LSL, kCacheIndexShift));
Jakob Kummerow 2016/07/20 12:09:45 IIUC, "And(scratch, scratch, Operand((kPrimaryTabl
Igor Sheludko 2016/07/20 13:40:26 Indeed. Done here and everywhere.
137 CountTrailingZeros(kPrimaryTableSize, 64));
138 139
139 // Probe the primary table. 140 // Probe the primary table.
140 ProbeTable(this, masm, flags, kPrimary, receiver, name, scratch, extra, 141 ProbeTable(this, masm, flags, kPrimary, receiver, name, scratch, extra,
141 extra2, extra3); 142 extra2, extra3);
142 143
143 // Primary miss: Compute hash for secondary table. 144 // Primary miss: Compute hash for secondary table.
144 __ Sub(scratch, scratch, Operand(name, LSR, kCacheIndexShift)); 145 __ Sub(scratch, scratch, Operand(name));
145 __ Add(scratch, scratch, flags >> kCacheIndexShift); 146 __ Add(scratch, scratch, Operand(flags));
146 __ And(scratch, scratch, kSecondaryTableSize - 1); 147 __ Mov(extra, Operand(kSecondaryTableSize - 1));
148 __ And(scratch, scratch, Operand(extra, LSL, kCacheIndexShift));
147 149
148 // Probe the secondary table. 150 // Probe the secondary table.
149 ProbeTable(this, masm, flags, kSecondary, receiver, name, scratch, extra, 151 ProbeTable(this, masm, flags, kSecondary, receiver, name, scratch, extra,
150 extra2, extra3); 152 extra2, extra3);
151 153
152 // Cache miss: Fall-through and let caller handle the miss by 154 // Cache miss: Fall-through and let caller handle the miss by
153 // entering the runtime system. 155 // entering the runtime system.
154 __ Bind(&miss); 156 __ Bind(&miss);
155 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, 157 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2,
156 extra3); 158 extra3);
157 } 159 }
158 } // namespace internal 160 } // namespace internal
159 } // namespace v8 161 } // namespace v8
160 162
161 #endif // V8_TARGET_ARCH_ARM64 163 #endif // V8_TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698