[collections] Avoid repeatedly loading same map and instance type.

The difference seems to matter at least in one benchmark.

R=jarin@chromium.org

Bug: chromium:764644
Change-Id: I6d74fbbd8026942637d2301da805b003a9e58af7
Reviewed-on: https://chromium-review.googlesource.com/666922
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48015}
This commit is contained in:
Georg Neis 2017-09-14 13:42:51 +02:00 committed by Commit Bot
parent b1cd08daf7
commit 9ba8c3374d
2 changed files with 15 additions and 8 deletions

View File

@ -1453,9 +1453,13 @@ TF_BUILTIN(SetHas, CollectionsBuiltinsAssembler) {
if_key_bigint(this), entry_found(this), not_found(this), done(this);
GotoIf(TaggedIsSmi(key), &if_key_smi);
GotoIf(IsString(key), &if_key_string);
GotoIf(IsHeapNumber(key), &if_key_heap_number);
GotoIf(IsBigInt(key), &if_key_bigint);
Node* key_map = LoadMap(key);
Node* key_instance_type = LoadMapInstanceType(key_map);
GotoIf(IsStringInstanceType(key_instance_type), &if_key_string);
GotoIf(IsHeapNumberMap(key_map), &if_key_heap_number);
GotoIf(IsBigIntInstanceType(key_instance_type), &if_key_bigint);
FindOrderedHashTableEntryForOtherKey<OrderedHashSet>(
context, table, key, &entry_start_position, &entry_found, &not_found);
@ -1648,9 +1652,13 @@ void CollectionsBuiltinsAssembler::TryLookupOrderedHashTableIndex(
if_key_bigint(this);
GotoIf(TaggedIsSmi(key), &if_key_smi);
GotoIf(IsString(key), &if_key_string);
GotoIf(IsHeapNumber(key), &if_key_heap_number);
GotoIf(IsBigInt(key), &if_key_bigint);
Node* key_map = LoadMap(key);
Node* key_instance_type = LoadMapInstanceType(key_map);
GotoIf(IsStringInstanceType(key_instance_type), &if_key_string);
GotoIf(IsHeapNumberMap(key_map), &if_key_heap_number);
GotoIf(IsBigIntInstanceType(key_instance_type), &if_key_bigint);
FindOrderedHashTableEntryForOtherKey<CollectionType>(
context, table, key, result, if_entry_found, if_not_found);

View File

@ -3809,8 +3809,7 @@ Node* CodeStubAssembler::IsName(Node* object) {
}
Node* CodeStubAssembler::IsString(Node* object) {
return Int32LessThan(LoadInstanceType(object),
Int32Constant(FIRST_NONSTRING_TYPE));
return IsStringInstanceType(LoadInstanceType(object));
}
Node* CodeStubAssembler::IsSymbolInstanceType(Node* instance_type) {