Chromium Code Reviews| Index: src/stub-cache.cc |
| diff --git a/src/stub-cache.cc b/src/stub-cache.cc |
| index 63748779b11c59a75f08aa77eb778ecc3f367277..9e6f01515f87d76909b4ecc144d90d564dcf7e09 100644 |
| --- a/src/stub-cache.cc |
| +++ b/src/stub-cache.cc |
| @@ -1058,46 +1058,51 @@ void StubCache::Clear() { |
| } |
| +static void AddMapIfMissing(Handle<Map> map, SmallMapList* list, |
|
danno
2013/05/02 14:29:30
We already have this in type-info.cc. Any way to s
Toon Verwaest
2013/05/02 15:22:40
Done.
|
| + Zone* zone) { |
| + map = Map::Update(map); |
| + for (int i = 0; i < list->length(); ++i) { |
| + if (list->at(i).is_identical_to(map)) return; |
| + } |
| + list->Add(map, zone); |
| +} |
| + |
| + |
| void StubCache::CollectMatchingMaps(SmallMapList* types, |
| - Name* name, |
| + Handle<Name> name, |
| Code::Flags flags, |
| Handle<Context> native_context, |
| Zone* zone) { |
| for (int i = 0; i < kPrimaryTableSize; i++) { |
| - if (primary_[i].key == name) { |
| + if (primary_[i].key == *name) { |
| Map* map = primary_[i].map; |
| // Map can be NULL, if the stub is constant function call |
| // with a primitive receiver. |
| if (map == NULL) continue; |
| - int offset = PrimaryOffset(name, flags, map); |
| + int offset = PrimaryOffset(*name, flags, map); |
| if (entry(primary_, offset) == &primary_[i] && |
| !TypeFeedbackOracle::CanRetainOtherContext(map, *native_context)) { |
| - types->Add(Handle<Map>(map), zone); |
| + AddMapIfMissing(Handle<Map>(map), types, zone); |
| } |
| } |
| } |
| for (int i = 0; i < kSecondaryTableSize; i++) { |
| - if (secondary_[i].key == name) { |
| + if (secondary_[i].key == *name) { |
| Map* map = secondary_[i].map; |
| // Map can be NULL, if the stub is constant function call |
| // with a primitive receiver. |
| if (map == NULL) continue; |
| // Lookup in primary table and skip duplicates. |
| - int primary_offset = PrimaryOffset(name, flags, map); |
| - Entry* primary_entry = entry(primary_, primary_offset); |
| - if (primary_entry->key == name) { |
| - Map* primary_map = primary_entry->map; |
| - if (map == primary_map) continue; |
| - } |
| + int primary_offset = PrimaryOffset(*name, flags, map); |
| // Lookup in secondary table and add matches. |
| - int offset = SecondaryOffset(name, flags, primary_offset); |
| + int offset = SecondaryOffset(*name, flags, primary_offset); |
| if (entry(secondary_, offset) == &secondary_[i] && |
| !TypeFeedbackOracle::CanRetainOtherContext(map, *native_context)) { |
| - types->Add(Handle<Map>(map), zone); |
| + AddMapIfMissing(Handle<Map>(map), types, zone); |
| } |
| } |
| } |