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

Unified Diff: src/code-stub-assembler.cc

Issue 2167493003: [ic] [stubs] Don't use Code::flags in megamorphic stub cache hash computations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@stub-cache-fix
Patch Set: Rebasing 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-stub-assembler.h ('k') | src/code-stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index 3bf07277044e05fb093777627b32c100556629ad..947a187bd238fe1b357297d745bb499ec12fa5a2 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -2863,7 +2863,6 @@ void CodeStubAssembler::HandlePolymorphicCase(
}
compiler::Node* CodeStubAssembler::StubCachePrimaryOffset(compiler::Node* name,
- Code::Flags flags,
compiler::Node* map) {
// See v8::internal::StubCache::PrimaryOffset().
STATIC_ASSERT(StubCache::kCacheIndexShift == Name::kHashShift);
@@ -2877,28 +2876,20 @@ compiler::Node* CodeStubAssembler::StubCachePrimaryOffset(compiler::Node* name,
// risk of collision even if the heap is spread over an area larger than
// 4Gb (and not at all if it isn't).
Node* hash = Int32Add(hash_field, map);
- // We always set the in_loop bit to zero when generating the lookup code
- // so do it here too so the hash codes match.
- uint32_t iflags =
- (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup);
- // Base the offset on a simple combination of name, flags, and map.
- hash = Word32Xor(hash, Int32Constant(iflags));
+ // Base the offset on a simple combination of name and map.
+ hash = Word32Xor(hash, Int32Constant(StubCache::kPrimaryMagic));
uint32_t mask = (StubCache::kPrimaryTableSize - 1)
<< StubCache::kCacheIndexShift;
return Word32And(hash, Int32Constant(mask));
}
compiler::Node* CodeStubAssembler::StubCacheSecondaryOffset(
- compiler::Node* name, Code::Flags flags, compiler::Node* seed) {
+ compiler::Node* name, compiler::Node* seed) {
// See v8::internal::StubCache::SecondaryOffset().
// Use the seed from the primary cache in the secondary cache.
Node* hash = Int32Sub(seed, name);
- // We always set the in_loop bit to zero when generating the lookup code
- // so do it here too so the hash codes match.
- uint32_t iflags =
- (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup);
- hash = Int32Add(hash, Int32Constant(iflags));
+ hash = Int32Add(hash, Int32Constant(StubCache::kSecondaryMagic));
int32_t mask = (StubCache::kSecondaryTableSize - 1)
<< StubCache::kCacheIndexShift;
return Word32And(hash, Int32Constant(mask));
@@ -2911,9 +2902,8 @@ enum CodeStubAssembler::StubCacheTable : int {
void CodeStubAssembler::TryProbeStubCacheTable(
StubCache* stub_cache, StubCacheTable table_id,
- compiler::Node* entry_offset, compiler::Node* name, Code::Flags flags,
- compiler::Node* map, Label* if_handler, Variable* var_handler,
- Label* if_miss) {
+ compiler::Node* entry_offset, compiler::Node* name, compiler::Node* map,
+ Label* if_handler, Variable* var_handler, Label* if_miss) {
StubCache::Table table = static_cast<StubCache::Table>(table_id);
#ifdef DEBUG
if (FLAG_test_secondary_stub_cache && table == StubCache::kPrimary) {
@@ -2943,19 +2933,11 @@ void CodeStubAssembler::TryProbeStubCacheTable(
Int32Add(entry_offset, Int32Constant(kPointerSize * 2)));
GotoIf(WordNotEqual(map, entry_map), if_miss);
- // Check that the flags match what we're looking for.
DCHECK_EQ(kPointerSize, stub_cache->value_reference(table).address() -
stub_cache->key_reference(table).address());
Node* code = Load(MachineType::Pointer(), key_base,
Int32Add(entry_offset, Int32Constant(kPointerSize)));
- Node* code_flags =
- LoadObjectField(code, Code::kFlagsOffset, MachineType::Uint32());
- GotoIf(Word32NotEqual(Int32Constant(flags),
- Word32And(code_flags,
- Int32Constant(~Code::kFlagsNotUsedInLookup))),
- if_miss);
-
// We found the handler.
var_handler->Bind(code);
Goto(if_handler);
@@ -2964,9 +2946,6 @@ void CodeStubAssembler::TryProbeStubCacheTable(
void CodeStubAssembler::TryProbeStubCache(
StubCache* stub_cache, compiler::Node* receiver, compiler::Node* name,
Label* if_handler, Variable* var_handler, Label* if_miss) {
- Code::Flags flags = Code::RemoveHolderFromFlags(
- Code::ComputeHandlerFlags(stub_cache->ic_kind()));
-
Label try_secondary(this), miss(this);
Counters* counters = isolate()->counters();
@@ -2978,17 +2957,16 @@ void CodeStubAssembler::TryProbeStubCache(
Node* receiver_map = LoadMap(receiver);
// Probe the primary table.
- Node* primary_offset = StubCachePrimaryOffset(name, flags, receiver_map);
- TryProbeStubCacheTable(stub_cache, kPrimary, primary_offset, name, flags,
+ Node* primary_offset = StubCachePrimaryOffset(name, receiver_map);
+ TryProbeStubCacheTable(stub_cache, kPrimary, primary_offset, name,
receiver_map, if_handler, var_handler, &try_secondary);
Bind(&try_secondary);
{
// Probe the secondary table.
- Node* secondary_offset =
- StubCacheSecondaryOffset(name, flags, primary_offset);
+ Node* secondary_offset = StubCacheSecondaryOffset(name, primary_offset);
TryProbeStubCacheTable(stub_cache, kSecondary, secondary_offset, name,
- flags, receiver_map, if_handler, var_handler, &miss);
+ receiver_map, if_handler, var_handler, &miss);
}
Bind(&miss);
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698