| Index: src/ic/mips64/stub-cache-mips64.cc
|
| diff --git a/src/ic/mips64/stub-cache-mips64.cc b/src/ic/mips64/stub-cache-mips64.cc
|
| index b4333916465be8b8082fb7a715699a8c7d39aa92..9d03ec7e97ea9b2eacd84da3c354a4b2d0d837b4 100644
|
| --- a/src/ic/mips64/stub-cache-mips64.cc
|
| +++ b/src/ic/mips64/stub-cache-mips64.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) {
|
| @@ -45,7 +44,8 @@ static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm,
|
|
|
| // Calculate the base address of the entry.
|
| __ li(base_addr, Operand(key_offset));
|
| - __ Dlsa(base_addr, base_addr, offset_scratch, kPointerSizeLog2);
|
| + __ Dlsa(base_addr, base_addr, offset_scratch,
|
| + kPointerSizeLog2 - StubCache::kCacheIndexShift);
|
|
|
| // Check that the key in the entry matches the name.
|
| __ ld(at, MemOperand(base_addr, 0));
|
| @@ -63,14 +63,16 @@ static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm,
|
| __ ld(code, MemOperand(base_addr,
|
| static_cast<int32_t>(value_off_addr - key_off_addr)));
|
|
|
| +#ifdef DEBUG
|
| // Check that the flags match what we're looking for.
|
| + Code::Flags flags = Code::RemoveHolderFromFlags(
|
| + Code::ComputeHandlerFlags(stub_cache->ic_kind()));
|
| Register flags_reg = base_addr;
|
| base_addr = no_reg;
|
| __ lw(flags_reg, FieldMemOperand(code, Code::kFlagsOffset));
|
| __ And(flags_reg, flags_reg, Operand(~Code::kFlagsNotUsedInLookup));
|
| - __ Branch(&miss, ne, flags_reg, Operand(flags));
|
| + __ Check(eq, kUnexpectedValue, flags_reg, Operand(flags));
|
|
|
| -#ifdef DEBUG
|
| if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) {
|
| __ jmp(&miss);
|
| } else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) {
|
| @@ -89,9 +91,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
|
| @@ -134,30 +133,27 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Register receiver,
|
| __ JumpIfSmi(receiver, &miss);
|
|
|
| // Get the map of the receiver and compute the hash.
|
| - __ ld(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
|
| + __ lwu(scratch, FieldMemOperand(name, Name::kHashFieldOffset));
|
| __ ld(at, FieldMemOperand(receiver, HeapObject::kMapOffset));
|
| - __ Daddu(scratch, scratch, at);
|
| - uint64_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.
|
| - __ dsrl(scratch, scratch, kCacheIndexShift);
|
| - __ Xor(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask));
|
| - __ And(scratch, scratch, Operand(mask));
|
| + __ Addu(scratch, scratch, at);
|
| + __ li(at, Operand(kPrimaryTableSize - 1));
|
| + __ sll(at, at, kCacheIndexShift);
|
| + __ And(scratch, scratch, at);
|
|
|
| // 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.
|
| - __ dsrl(at, name, kCacheIndexShift);
|
| - __ Dsubu(scratch, scratch, at);
|
| - uint64_t mask2 = kSecondaryTableSize - 1;
|
| - __ Daddu(scratch, scratch, Operand((flags >> kCacheIndexShift) & mask2));
|
| - __ And(scratch, scratch, Operand(mask2));
|
| + __ Subu(scratch, scratch, name);
|
| + __ Addu(scratch, scratch, kSecondaryMagic);
|
| + __ li(at, Operand(kSecondaryTableSize - 1));
|
| + __ sll(at, at, kCacheIndexShift);
|
| + __ And(scratch, scratch, at);
|
|
|
| // 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.
|
|
|