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

Unified Diff: src/ic/mips/stub-cache-mips.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: Addressing comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic/ia32/stub-cache-ia32.cc ('k') | src/ic/mips64/stub-cache-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/mips/stub-cache-mips.cc
diff --git a/src/ic/mips/stub-cache-mips.cc b/src/ic/mips/stub-cache-mips.cc
index e4dbcc6cd4d3500e0c2107b081f726c7dae38568..638cb5999d5e76d39f51e0cac40112d629241a42 100644
--- a/src/ic/mips/stub-cache-mips.cc
+++ b/src/ic/mips/stub-cache-mips.cc
@@ -17,7 +17,8 @@ namespace internal {
static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm,
Code::Flags flags, StubCache::Table table,
Register receiver, Register name,
- // Number of the cache entry, not scaled.
+ // The offset is scaled by 4, based on
+ // kCacheIndexShift, which is two bits
Register offset, Register scratch, Register scratch2,
Register offset_scratch) {
ExternalReference key_offset(stub_cache->key_reference(table));
@@ -45,7 +46,7 @@ static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm,
// Calculate the base address of the entry.
__ li(base_addr, Operand(key_offset));
- __ Lsa(base_addr, base_addr, offset_scratch, kPointerSizeLog2);
+ __ Addu(base_addr, base_addr, offset_scratch);
// Check that the key in the entry matches the name.
__ lw(at, MemOperand(base_addr, 0));
@@ -134,23 +135,19 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Register receiver,
__ lw(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
__ lw(at, FieldMemOperand(receiver, HeapObject::kMapOffset));
__ Addu(scratch, scratch, at);
- uint32_t mask = kPrimaryTableSize - 1;
- // We shift out the last two bits because they are not part of the hash and
- // they are always 01 for maps.
- __ srl(scratch, scratch, kCacheIndexShift);
- __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask));
- __ And(scratch, scratch, Operand(mask));
+ __ Xor(scratch, scratch, Operand(flags));
+ __ And(scratch, scratch,
+ Operand((kPrimaryTableSize - 1) << kCacheIndexShift));
// Probe the primary table.
ProbeTable(this, masm, flags, kPrimary, receiver, name, scratch, extra,
extra2, extra3);
// Primary miss: Compute hash for secondary probe.
- __ srl(at, name, kCacheIndexShift);
- __ Subu(scratch, scratch, at);
- uint32_t mask2 = kSecondaryTableSize - 1;
- __ Addu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2));
- __ And(scratch, scratch, Operand(mask2));
+ __ Subu(scratch, scratch, name);
+ __ Addu(scratch, scratch, Operand(flags));
+ __ And(scratch, scratch,
+ Operand((kSecondaryTableSize - 1) << kCacheIndexShift));
// Probe the secondary table.
ProbeTable(this, masm, flags, kSecondary, receiver, name, scratch, extra,
« no previous file with comments | « src/ic/ia32/stub-cache-ia32.cc ('k') | src/ic/mips64/stub-cache-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698