Index: src/ic/x87/stub-cache-x87.cc |
diff --git a/src/ic/x87/stub-cache-x87.cc b/src/ic/x87/stub-cache-x87.cc |
index fba0c8e4d694193ab9e582c32bf744bcbccdf3e2..ef2246fc09e84899dba76d51a50bf213c79105e7 100644 |
--- a/src/ic/x87/stub-cache-x87.cc |
+++ b/src/ic/x87/stub-cache-x87.cc |
@@ -15,6 +15,7 @@ |
#define __ ACCESS_MASM(masm) |
static void ProbeTable(StubCache* stub_cache, MacroAssembler* masm, |
+ Code::Kind ic_kind, Code::Flags flags, |
StubCache::Table table, Register name, Register receiver, |
// Number of the cache entry pointer-size scaled. |
Register offset, Register extra) { |
@@ -25,7 +26,6 @@ |
ExternalReference::virtual_handler_register(masm->isolate()); |
Label miss; |
- Code::Kind ic_kind = stub_cache->ic_kind(); |
bool is_vector_store = |
IC::ICUseVector(ic_kind) && |
(ic_kind == Code::STORE_IC || ic_kind == Code::KEYED_STORE_IC); |
@@ -46,15 +46,13 @@ |
__ cmp(offset, FieldOperand(receiver, HeapObject::kMapOffset)); |
__ j(not_equal, &miss); |
-#ifdef DEBUG |
// Check that the flags match what we're looking for. |
- Code::Flags flags = Code::RemoveHolderFromFlags( |
- Code::ComputeHandlerFlags(stub_cache->ic_kind())); |
__ mov(offset, FieldOperand(extra, Code::kFlagsOffset)); |
__ and_(offset, ~Code::kFlagsNotUsedInLookup); |
__ cmp(offset, flags); |
- __ Check(equal, kUnexpectedValue); |
- |
+ __ j(not_equal, &miss); |
+ |
+#ifdef DEBUG |
if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) { |
__ jmp(&miss); |
} else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) { |
@@ -103,15 +101,13 @@ |
// Get the code entry from the cache. |
__ mov(offset, Operand::StaticArray(offset, times_1, value_offset)); |
-#ifdef DEBUG |
// Check that the flags match what we're looking for. |
- Code::Flags flags = Code::RemoveHolderFromFlags( |
- Code::ComputeHandlerFlags(stub_cache->ic_kind())); |
__ mov(offset, FieldOperand(offset, Code::kFlagsOffset)); |
__ and_(offset, ~Code::kFlagsNotUsedInLookup); |
__ cmp(offset, flags); |
- __ Check(equal, kUnexpectedValue); |
- |
+ __ j(not_equal, &miss); |
+ |
+#ifdef DEBUG |
if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) { |
__ jmp(&miss); |
} else if (FLAG_test_primary_stub_cache && table == StubCache::kSecondary) { |
@@ -148,6 +144,9 @@ |
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; |
// Assert that code is valid. The multiplying code relies on the entry size |
@@ -178,6 +177,7 @@ |
// Get the map of the receiver and compute the hash. |
__ mov(offset, FieldOperand(name, Name::kHashFieldOffset)); |
__ add(offset, FieldOperand(receiver, HeapObject::kMapOffset)); |
+ __ xor_(offset, flags); |
// We mask out the last two bits because they are not part of the hash and |
// they are always 01 for maps. Also in the two 'and' instructions below. |
__ and_(offset, (kPrimaryTableSize - 1) << kCacheIndexShift); |
@@ -186,17 +186,21 @@ |
DCHECK(kCacheIndexShift == kPointerSizeLog2); |
// Probe the primary table. |
- ProbeTable(this, masm, kPrimary, name, receiver, offset, extra); |
+ ProbeTable(this, masm, ic_kind_, flags, kPrimary, name, receiver, offset, |
+ extra); |
// Primary miss: Compute hash for secondary probe. |
__ mov(offset, FieldOperand(name, Name::kHashFieldOffset)); |
__ add(offset, FieldOperand(receiver, HeapObject::kMapOffset)); |
+ __ xor_(offset, flags); |
__ and_(offset, (kPrimaryTableSize - 1) << kCacheIndexShift); |
__ sub(offset, name); |
+ __ add(offset, Immediate(flags)); |
__ and_(offset, (kSecondaryTableSize - 1) << kCacheIndexShift); |
// Probe the secondary table. |
- ProbeTable(this, masm, kSecondary, name, receiver, offset, extra); |
+ ProbeTable(this, masm, ic_kind_, flags, kSecondary, name, receiver, offset, |
+ extra); |
// Cache miss: Fall-through and let caller handle the miss by |
// entering the runtime system. |