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

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

Issue 2147213004: Revert of [ic] [stubs] Don't use Code::flags in megamorphic stub cache hash computations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@split-stub-cache
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
« no previous file with comments | « src/ic/mips/stub-cache-mips.cc ('k') | src/ic/ppc/stub-cache-ppc.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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 #define __ ACCESS_MASM(masm) 15 #define __ ACCESS_MASM(masm)
16 16
17 static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm, 17 static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm,
18 StubCache::Table table, Register receiver, Register name, 18 Code::Flags flags, StubCache::Table table,
19 Register receiver, Register name,
19 // Number of the cache entry, not scaled. 20 // Number of the cache entry, not scaled.
20 Register offset, Register scratch, Register scratch2, 21 Register offset, Register scratch, Register scratch2,
21 Register offset_scratch) { 22 Register offset_scratch) {
22 ExternalReference key_offset(stub_cache->key_reference(table)); 23 ExternalReference key_offset(stub_cache->key_reference(table));
23 ExternalReference value_offset(stub_cache->value_reference(table)); 24 ExternalReference value_offset(stub_cache->value_reference(table));
24 ExternalReference map_offset(stub_cache->map_reference(table)); 25 ExternalReference map_offset(stub_cache->map_reference(table));
25 26
26 uint64_t key_off_addr = reinterpret_cast<uint64_t>(key_offset.address()); 27 uint64_t key_off_addr = reinterpret_cast<uint64_t>(key_offset.address());
27 uint64_t value_off_addr = reinterpret_cast<uint64_t>(value_offset.address()); 28 uint64_t value_off_addr = reinterpret_cast<uint64_t>(value_offset.address());
28 uint64_t map_off_addr = reinterpret_cast<uint64_t>(map_offset.address()); 29 uint64_t map_off_addr = reinterpret_cast<uint64_t>(map_offset.address());
(...skipping 26 matching lines...) Expand all
55 static_cast<int32_t>(map_off_addr - key_off_addr))); 56 static_cast<int32_t>(map_off_addr - key_off_addr)));
56 __ ld(scratch2, FieldMemOperand(receiver, HeapObject::kMapOffset)); 57 __ ld(scratch2, FieldMemOperand(receiver, HeapObject::kMapOffset));
57 __ Branch(&miss, ne, at, Operand(scratch2)); 58 __ Branch(&miss, ne, at, Operand(scratch2));
58 59
59 // Get the code entry from the cache. 60 // Get the code entry from the cache.
60 Register code = scratch2; 61 Register code = scratch2;
61 scratch2 = no_reg; 62 scratch2 = no_reg;
62 __ ld(code, MemOperand(base_addr, 63 __ ld(code, MemOperand(base_addr,
63 static_cast<int32_t>(value_off_addr - key_off_addr))); 64 static_cast<int32_t>(value_off_addr - key_off_addr)));
64 65
65 #ifdef DEBUG
66 // Check that the flags match what we're looking for. 66 // Check that the flags match what we're looking for.
67 Code::Flags flags = Code::RemoveHolderFromFlags(
68 Code::ComputeHandlerFlags(stub_cache->ic_kind()));
69 Register flags_reg = base_addr; 67 Register flags_reg = base_addr;
70 base_addr = no_reg; 68 base_addr = no_reg;
71 __ lw(flags_reg, FieldMemOperand(code, Code::kFlagsOffset)); 69 __ lw(flags_reg, FieldMemOperand(code, Code::kFlagsOffset));
72 __ And(flags_reg, flags_reg, Operand(~Code::kFlagsNotUsedInLookup)); 70 __ And(flags_reg, flags_reg, Operand(~Code::kFlagsNotUsedInLookup));
73 __ Check(eq, kUnexpectedValue, flags_reg, Operand(flags)); 71 __ Branch(&miss, ne, flags_reg, Operand(flags));
74 72
73 #ifdef DEBUG
75 if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) { 74 if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) {
76 __ jmp(&miss); 75 __ jmp(&miss);
77 } else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) { 76 } else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) {
78 __ jmp(&miss); 77 __ jmp(&miss);
79 } 78 }
80 #endif 79 #endif
81 80
82 // Jump to the first instruction in the code stub. 81 // Jump to the first instruction in the code stub.
83 __ Daddu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag)); 82 __ Daddu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag));
84 __ Jump(at); 83 __ Jump(at);
85 84
86 // Miss: fall through. 85 // Miss: fall through.
87 __ bind(&miss); 86 __ bind(&miss);
88 } 87 }
89 88
90 void StubCache::GenerateProbe(MacroAssembler* masm, Register receiver, 89 void StubCache::GenerateProbe(MacroAssembler* masm, Register receiver,
91 Register name, Register scratch, Register extra, 90 Register name, Register scratch, Register extra,
92 Register extra2, Register extra3) { 91 Register extra2, Register extra3) {
92 Code::Flags flags =
93 Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(ic_kind_));
94
93 Label miss; 95 Label miss;
94 96
95 // Make sure that code is valid. The multiplying code relies on the 97 // Make sure that code is valid. The multiplying code relies on the
96 // entry size being 12. 98 // entry size being 12.
97 // DCHECK(sizeof(Entry) == 12); 99 // DCHECK(sizeof(Entry) == 12);
98 // DCHECK(sizeof(Entry) == 3 * kPointerSize); 100 // DCHECK(sizeof(Entry) == 3 * kPointerSize);
99 101
100 // Make sure that there are no register conflicts. 102 // Make sure that there are no register conflicts.
101 DCHECK(!AreAliased(receiver, name, scratch, extra, extra2, extra3)); 103 DCHECK(!AreAliased(receiver, name, scratch, extra, extra2, extra3));
102 104
(...skipping 29 matching lines...) Expand all
132 __ JumpIfSmi(receiver, &miss); 134 __ JumpIfSmi(receiver, &miss);
133 135
134 // Get the map of the receiver and compute the hash. 136 // Get the map of the receiver and compute the hash.
135 __ ld(scratch, FieldMemOperand(name, Name::kHashFieldOffset)); 137 __ ld(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
136 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset)); 138 __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset));
137 __ Daddu(scratch, scratch, at); 139 __ Daddu(scratch, scratch, at);
138 uint64_t mask = kPrimaryTableSize - 1; 140 uint64_t mask = kPrimaryTableSize - 1;
139 // We shift out the last two bits because they are not part of the hash and 141 // We shift out the last two bits because they are not part of the hash and
140 // they are always 01 for maps. 142 // they are always 01 for maps.
141 __ dsrl(scratch, scratch, kCacheIndexShift); 143 __ dsrl(scratch, scratch, kCacheIndexShift);
144 __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask));
142 __ And(scratch, scratch, Operand(mask)); 145 __ And(scratch, scratch, Operand(mask));
143 146
144 // Probe the primary table. 147 // Probe the primary table.
145 ProbeTable(this, masm, kPrimary, receiver, name, scratch, extra, extra2, 148 ProbeTable(this, masm, flags, kPrimary, receiver, name, scratch, extra,
146 extra3); 149 extra2, extra3);
147 150
148 // Primary miss: Compute hash for secondary probe. 151 // Primary miss: Compute hash for secondary probe.
149 __ dsrl(at, name, kCacheIndexShift); 152 __ dsrl(at, name, kCacheIndexShift);
150 __ Dsubu(scratch, scratch, at); 153 __ Dsubu(scratch, scratch, at);
151 uint64_t mask2 = kSecondaryTableSize - 1; 154 uint64_t mask2 = kSecondaryTableSize - 1;
155 __ Daddu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2));
152 __ And(scratch, scratch, Operand(mask2)); 156 __ And(scratch, scratch, Operand(mask2));
153 157
154 // Probe the secondary table. 158 // Probe the secondary table.
155 ProbeTable(this, masm, kSecondary, receiver, name, scratch, extra, extra2, 159 ProbeTable(this, masm, flags, kSecondary, receiver, name, scratch, extra,
156 extra3); 160 extra2, extra3);
157 161
158 // Cache miss: Fall-through and let caller handle the miss by 162 // Cache miss: Fall-through and let caller handle the miss by
159 // entering the runtime system. 163 // entering the runtime system.
160 __ bind(&miss); 164 __ bind(&miss);
161 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2, 165 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, extra2,
162 extra3); 166 extra3);
163 } 167 }
164 168
165 169
166 #undef __ 170 #undef __
167 } // namespace internal 171 } // namespace internal
168 } // namespace v8 172 } // namespace v8
169 173
170 #endif // V8_TARGET_ARCH_MIPS64 174 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/ic/mips/stub-cache-mips.cc ('k') | src/ic/ppc/stub-cache-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698