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

Unified Diff: src/ic/arm/stub-cache-arm.cc

Issue 2147433002: [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: Improved stub cache tests and the fixes. 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/code-stubs.h ('k') | src/ic/arm64/stub-cache-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/arm/stub-cache-arm.cc
diff --git a/src/ic/arm/stub-cache-arm.cc b/src/ic/arm/stub-cache-arm.cc
index ecf05c88c5999ba5c227db128aeb2065a2f49efd..d83025b0609fb2c5807ebf6e70e9ab3be87ef993 100644
--- a/src/ic/arm/stub-cache-arm.cc
+++ b/src/ic/arm/stub-cache-arm.cc
@@ -15,8 +15,7 @@ namespace internal {
#define __ ACCESS_MASM(masm)
static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm,
- Code::Flags flags, StubCache::Table table,
- Register receiver, Register name,
+ StubCache::Table table, Register receiver, Register name,
// Number of the cache entry, not scaled.
Register offset, Register scratch, Register scratch2,
Register offset_scratch) {
@@ -44,8 +43,7 @@ static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm,
__ add(offset_scratch, offset, Operand(offset, LSL, 1));
// Calculate the base address of the entry.
- __ mov(base_addr, Operand(key_offset));
- __ add(base_addr, base_addr, Operand(offset_scratch, LSL, kPointerSizeLog2));
+ __ add(base_addr, offset_scratch, Operand(key_offset));
// Check that the key in the entry matches the name.
__ ldr(ip, MemOperand(base_addr, 0));
@@ -63,19 +61,21 @@ static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm,
scratch2 = no_reg;
__ ldr(code, MemOperand(base_addr, value_off_addr - key_off_addr));
+#ifdef DEBUG
// Check that the flags match what we're looking for.
Register flags_reg = base_addr;
base_addr = no_reg;
__ ldr(flags_reg, FieldMemOperand(code, Code::kFlagsOffset));
// It's a nice optimization if this constant is encodable in the bic insn.
+ Code::Flags flags = Code::RemoveHolderFromFlags(
+ Code::ComputeHandlerFlags(stub_cache->ic_kind()));
uint32_t mask = Code::kFlagsNotUsedInLookup;
DCHECK(__ ImmediateFitsAddrMode1Instruction(mask));
__ bic(flags_reg, flags_reg, Operand(mask));
__ cmp(flags_reg, Operand(flags));
- __ b(ne, &miss);
+ __ Check(eq, kUnexpectedValue);
-#ifdef DEBUG
if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) {
__ jmp(&miss);
} else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) {
@@ -93,9 +93,6 @@ static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm,
void StubCache::GenerateProbe(MacroAssembler* masm, Register receiver,
Register name, Register scratch, Register extra,
Register extra2, Register extra3) {
- Code::Flags flags =
- Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(ic_kind_));
-
Label miss;
// Make sure that code is valid. The multiplying code relies on the
@@ -140,29 +137,22 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Register receiver,
__ ldr(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
__ ldr(ip, FieldMemOperand(receiver, HeapObject::kMapOffset));
__ add(scratch, scratch, Operand(ip));
- 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.
- __ mov(scratch, Operand(scratch, LSR, kCacheIndexShift));
- // Mask down the eor argument to the minimum to keep the immediate
- // ARM-encodable.
- __ eor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask));
- // Prefer and_ to ubfx here because ubfx takes 2 cycles.
- __ and_(scratch, scratch, Operand(mask));
+ __ mov(ip, Operand(kPrimaryTableSize - 1));
+ __ and_(scratch, scratch, Operand(ip, LSL, kCacheIndexShift));
// Probe the primary table.
- ProbeTable(this, masm, flags, kPrimary, receiver, name, scratch, extra,
- extra2, extra3);
+ ProbeTable(this, masm, kPrimary, receiver, name, scratch, extra, extra2,
+ extra3);
// Primary miss: Compute hash for secondary probe.
- __ sub(scratch, scratch, Operand(name, LSR, kCacheIndexShift));
- uint32_t mask2 = kSecondaryTableSize - 1;
- __ add(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2));
- __ and_(scratch, scratch, Operand(mask2));
+ __ sub(scratch, scratch, Operand(name));
+ __ add(scratch, scratch, Operand(kSecondaryMagic));
+ __ mov(ip, Operand(kSecondaryTableSize - 1));
+ __ and_(scratch, scratch, Operand(ip, LSL, kCacheIndexShift));
// Probe the secondary table.
- ProbeTable(this, masm, flags, kSecondary, receiver, name, scratch, extra,
- extra2, extra3);
+ ProbeTable(this, masm, kSecondary, receiver, name, scratch, extra, extra2,
+ extra3);
// Cache miss: Fall-through and let caller handle the miss by
// entering the runtime system.
« no previous file with comments | « src/code-stubs.h ('k') | src/ic/arm64/stub-cache-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698