Commit b9a2cf9e authored by verwaest's avatar verwaest Committed by Commit bot

Don't use the keyed slow stub for named handlers.

Otherwise the megamorphic stubcache will miss. It only probes for
non-keyed handlers.

BUG=

Review URL: https://codereview.chromium.org/1883533003

Cr-Commit-Position: refs/heads/master@{#35492}
parent 5af0a684
......@@ -685,7 +685,7 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(
masm, Code::STORE_IC, flags, receiver, key, r5, temporary2, r6, r9);
masm, Code::KEYED_STORE_IC, flags, receiver, key, r5, temporary2, r6, r9);
// Cache miss.
__ b(&miss);
......
......@@ -14,10 +14,9 @@ namespace internal {
#define __ ACCESS_MASM(masm)
static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
Code::Kind ic_kind, Code::Flags flags,
StubCache::Table table, Register receiver, Register name,
Code::Flags flags, StubCache::Table table,
Register receiver, Register name,
// Number of the cache entry, not scaled.
Register offset, Register scratch, Register scratch2,
Register offset_scratch) {
......@@ -151,8 +150,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
__ and_(scratch, scratch, Operand(mask));
// Probe the primary table.
ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch, extra,
extra2, extra3);
// Primary miss: Compute hash for secondary probe.
__ sub(scratch, scratch, Operand(name, LSR, kCacheIndexShift));
......@@ -161,8 +160,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
__ and_(scratch, scratch, Operand(mask2));
// Probe the secondary table.
ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch, extra,
extra2, extra3);
// Cache miss: Fall-through and let caller handle the miss by
// entering the runtime system.
......
......@@ -675,8 +675,8 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags,
receiver, key, x5, x6, x7, x8);
masm->isolate()->stub_cache()->GenerateProbe(
masm, Code::KEYED_STORE_IC, flags, receiver, key, x5, x6, x7, x8);
// Cache miss.
__ B(&miss);
......
......@@ -23,10 +23,9 @@ namespace internal {
//
// 'receiver', 'name' and 'offset' registers are preserved on miss.
static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
Code::Kind ic_kind, Code::Flags flags,
StubCache::Table table, Register receiver, Register name,
Register offset, Register scratch, Register scratch2,
Register scratch3) {
Code::Flags flags, StubCache::Table table,
Register receiver, Register name, Register offset,
Register scratch, Register scratch2, Register scratch3) {
// Some code below relies on the fact that the Entry struct contains
// 3 pointers (name, code, map).
STATIC_ASSERT(sizeof(StubCache::Entry) == (3 * kPointerSize));
......@@ -137,8 +136,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
CountTrailingZeros(kPrimaryTableSize, 64));
// Probe the primary table.
ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch, extra,
extra2, extra3);
// Primary miss: Compute hash for secondary table.
__ Sub(scratch, scratch, Operand(name, LSR, kCacheIndexShift));
......@@ -146,8 +145,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
__ And(scratch, scratch, kSecondaryTableSize - 1);
// Probe the secondary table.
ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch, extra,
extra2, extra3);
// Cache miss: Fall-through and let caller handle the miss by
// entering the runtime system.
......
......@@ -565,8 +565,8 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags,
receiver, key, edi, no_reg);
masm->isolate()->stub_cache()->GenerateProbe(
masm, Code::KEYED_STORE_IC, flags, receiver, key, edi, no_reg);
__ pop(VectorStoreICDescriptor::VectorRegister());
__ pop(VectorStoreICDescriptor::SlotRegister());
......
......@@ -1437,12 +1437,7 @@ Handle<Code> StoreIC::initialize_stub_in_optimized_code(
}
Handle<Code> StoreIC::slow_stub() const {
if (kind() == Code::STORE_IC) {
return isolate()->builtins()->StoreIC_Slow();
} else {
DCHECK(kind() == Code::KEYED_STORE_IC);
return isolate()->builtins()->KeyedStoreIC_Slow();
}
}
......
......@@ -301,12 +301,7 @@ class LoadIC : public IC {
protected:
Handle<Code> slow_stub() const {
if (kind() == Code::LOAD_IC) {
return isolate()->builtins()->LoadIC_Slow();
} else {
DCHECK_EQ(Code::KEYED_LOAD_IC, kind());
return isolate()->builtins()->KeyedLoadIC_Slow();
}
}
// Update the inline cache and the global stub cache based on the
......
......@@ -421,7 +421,7 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) {
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::LOAD_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::LOAD_IC, flags,
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::KEYED_LOAD_IC, flags,
receiver, key, t0, t1, t2, t5);
// Cache miss.
GenerateMiss(masm);
......@@ -665,8 +665,8 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags,
receiver, key, t1, t2, t4, t5);
masm->isolate()->stub_cache()->GenerateProbe(
masm, Code::KEYED_STORE_IC, flags, receiver, key, t1, t2, t4, t5);
// Cache miss.
__ Branch(&miss);
......
......@@ -14,10 +14,9 @@ namespace internal {
#define __ ACCESS_MASM(masm)
static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
Code::Kind ic_kind, Code::Flags flags,
StubCache::Table table, Register receiver, Register name,
Code::Flags flags, StubCache::Table table,
Register receiver, Register name,
// Number of the cache entry, not scaled.
Register offset, Register scratch, Register scratch2,
Register offset_scratch) {
......@@ -142,8 +141,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
__ And(scratch, scratch, Operand(mask));
// Probe the primary table.
ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch, extra,
extra2, extra3);
// Primary miss: Compute hash for secondary probe.
__ srl(at, name, kCacheIndexShift);
......@@ -153,8 +152,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
__ And(scratch, scratch, Operand(mask2));
// Probe the secondary table.
ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch, extra,
extra2, extra3);
// Cache miss: Fall-through and let caller handle the miss by
// entering the runtime system.
......
......@@ -420,7 +420,7 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) {
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::LOAD_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::LOAD_IC, flags,
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::KEYED_LOAD_IC, flags,
receiver, key, a4, a5, a6, t1);
// Cache miss.
GenerateMiss(masm);
......@@ -669,8 +669,8 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags,
receiver, key, a5, a6, a7, t0);
masm->isolate()->stub_cache()->GenerateProbe(
masm, Code::KEYED_STORE_IC, flags, receiver, key, a5, a6, a7, t0);
// Cache miss.
__ Branch(&miss);
......
......@@ -14,10 +14,9 @@ namespace internal {
#define __ ACCESS_MASM(masm)
static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
Code::Kind ic_kind, Code::Flags flags,
StubCache::Table table, Register receiver, Register name,
Code::Flags flags, StubCache::Table table,
Register receiver, Register name,
// Number of the cache entry, not scaled.
Register offset, Register scratch, Register scratch2,
Register offset_scratch) {
......@@ -145,8 +144,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
__ And(scratch, scratch, Operand(mask));
// Probe the primary table.
ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch, extra,
extra2, extra3);
// Primary miss: Compute hash for secondary probe.
__ dsrl(at, name, kCacheIndexShift);
......@@ -156,8 +155,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
__ And(scratch, scratch, Operand(mask2));
// Probe the secondary table.
ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch, extra,
extra2, extra3);
// Cache miss: Fall-through and let caller handle the miss by
// entering the runtime system.
......
......@@ -688,8 +688,8 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags,
receiver, key, r8, r9, r10, r11);
masm->isolate()->stub_cache()->GenerateProbe(
masm, Code::KEYED_STORE_IC, flags, receiver, key, r8, r9, r10, r11);
// Cache miss.
__ b(&miss);
......
......@@ -14,10 +14,9 @@ namespace internal {
#define __ ACCESS_MASM(masm)
static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
Code::Kind ic_kind, Code::Flags flags,
StubCache::Table table, Register receiver, Register name,
Code::Flags flags, StubCache::Table table,
Register receiver, Register name,
// Number of the cache entry, not scaled.
Register offset, Register scratch, Register scratch2,
Register offset_scratch) {
......@@ -163,8 +162,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
Operand((kPrimaryTableSize - 1) << kCacheIndexShift));
// Probe the primary table.
ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch, extra,
extra2, extra3);
// Primary miss: Compute hash for secondary probe.
__ sub(scratch, scratch, name);
......@@ -173,8 +172,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
Operand((kSecondaryTableSize - 1) << kCacheIndexShift));
// Probe the secondary table.
ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch, extra,
extra2, extra3);
// Cache miss: Fall-through and let caller handle the miss by
// entering the runtime system.
......
......@@ -673,8 +673,8 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags,
receiver, key, r7, r8, r9, ip);
masm->isolate()->stub_cache()->GenerateProbe(
masm, Code::KEYED_STORE_IC, flags, receiver, key, r7, r8, r9, ip);
// Cache miss.
__ b(&miss);
......
......@@ -15,8 +15,8 @@ namespace internal {
#define __ ACCESS_MASM(masm)
static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
Code::Kind ic_kind, Code::Flags flags,
StubCache::Table table, Register receiver, Register name,
Code::Flags flags, StubCache::Table table,
Register receiver, Register name,
// Number of the cache entry, not scaled.
Register offset, Register scratch, Register scratch2,
Register offset_scratch) {
......@@ -157,8 +157,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
Operand((kPrimaryTableSize - 1) << kCacheIndexShift));
// Probe the primary table.
ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch, extra,
extra2, extra3);
// Primary miss: Compute hash for secondary probe.
__ SubP(scratch, scratch, name);
......@@ -167,8 +167,8 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
Operand((kSecondaryTableSize - 1) << kCacheIndexShift));
// Probe the secondary table.
ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name, scratch,
extra, extra2, extra3);
ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch, extra,
extra2, extra3);
// Cache miss: Fall-through and let caller handle the miss by
// entering the runtime system.
......
......@@ -569,8 +569,8 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags,
receiver, key, r9, no_reg);
masm->isolate()->stub_cache()->GenerateProbe(
masm, Code::KEYED_STORE_IC, flags, receiver, key, r9, no_reg);
// Cache miss.
__ jmp(&miss);
......
......@@ -14,10 +14,9 @@ namespace internal {
#define __ ACCESS_MASM(masm)
static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
Code::Kind ic_kind, Code::Flags flags,
StubCache::Table table, Register receiver, Register name,
Code::Flags flags, StubCache::Table table,
Register receiver, Register name,
// The offset is scaled by 4, based on
// kCacheIndexShift, which is two bits
Register offset) {
......@@ -136,7 +135,7 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
__ andp(scratch, Immediate((kPrimaryTableSize - 1) << kCacheIndexShift));
// Probe the primary table.
ProbeTable(isolate, masm, ic_kind, flags, kPrimary, receiver, name, scratch);
ProbeTable(isolate, masm, flags, kPrimary, receiver, name, scratch);
// Primary miss: Compute hash for secondary probe.
__ movl(scratch, FieldOperand(name, Name::kHashFieldOffset));
......@@ -148,8 +147,7 @@ void StubCache::GenerateProbe(MacroAssembler* masm, Code::Kind ic_kind,
__ andp(scratch, Immediate((kSecondaryTableSize - 1) << kCacheIndexShift));
// Probe the secondary table.
ProbeTable(isolate, masm, ic_kind, flags, kSecondary, receiver, name,
scratch);
ProbeTable(isolate, masm, flags, kSecondary, receiver, name, scratch);
// Cache miss: Fall-through and let caller handle the miss by
// entering the runtime system.
......
......@@ -565,8 +565,8 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
Code::Flags flags =
Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::STORE_IC));
masm->isolate()->stub_cache()->GenerateProbe(masm, Code::STORE_IC, flags,
receiver, key, edi, no_reg);
masm->isolate()->stub_cache()->GenerateProbe(
masm, Code::KEYED_STORE_IC, flags, receiver, key, edi, no_reg);
__ pop(VectorStoreICDescriptor::VectorRegister());
__ pop(VectorStoreICDescriptor::SlotRegister());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment