mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 06:20:13 +00:00
[vm, compiler] Restore the performance of LoadUniqueObject.
The purpose of LoadUniqueObject (77c206f231
) is to avoid the cost searching for matching object pool entries. Pass kPatchable to AddObject to skip the work of inserting / rehashing. This also fixes incorrect use of DirectChainedHashMap::Insert with an already-present key.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/23249
Bug: https://github.com/dart-lang/sdk/issues/38018
Change-Id: I30cc3212720d3ddfc9bc515b092a4cd6f6879b8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213027
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
8132940357
commit
802dfdfd62
3 changed files with 15 additions and 6 deletions
|
@ -1671,8 +1671,11 @@ void Assembler::LoadObjectHelper(Register rd,
|
|||
RELEASE_ASSERT(CanLoadFromObjectPool(object));
|
||||
// Make sure that class CallPattern is able to decode this load from the
|
||||
// object pool.
|
||||
const auto index = is_unique ? object_pool_builder().AddObject(object)
|
||||
: object_pool_builder().FindObject(object);
|
||||
const auto index = is_unique
|
||||
? object_pool_builder().AddObject(
|
||||
object, ObjectPoolBuilderEntry::kPatchable)
|
||||
: object_pool_builder().FindObject(
|
||||
object, ObjectPoolBuilderEntry::kNotPatchable);
|
||||
LoadWordFromPoolIndex(rd, index, pp, cond);
|
||||
}
|
||||
|
||||
|
|
|
@ -555,8 +555,11 @@ void Assembler::LoadObjectHelper(Register dst,
|
|||
}
|
||||
}
|
||||
if (CanLoadFromObjectPool(object)) {
|
||||
const intptr_t index = is_unique ? object_pool_builder().AddObject(object)
|
||||
: object_pool_builder().FindObject(object);
|
||||
const intptr_t index =
|
||||
is_unique ? object_pool_builder().AddObject(
|
||||
object, ObjectPoolBuilderEntry::kPatchable)
|
||||
: object_pool_builder().FindObject(
|
||||
object, ObjectPoolBuilderEntry::kNotPatchable);
|
||||
LoadWordFromPoolIndex(dst, index);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1287,8 +1287,11 @@ void Assembler::LoadObjectHelper(Register dst,
|
|||
}
|
||||
}
|
||||
if (CanLoadFromObjectPool(object)) {
|
||||
const intptr_t index = is_unique ? object_pool_builder().AddObject(object)
|
||||
: object_pool_builder().FindObject(object);
|
||||
const intptr_t index =
|
||||
is_unique ? object_pool_builder().AddObject(
|
||||
object, ObjectPoolBuilderEntry::kPatchable)
|
||||
: object_pool_builder().FindObject(
|
||||
object, ObjectPoolBuilderEntry::kNotPatchable);
|
||||
LoadWordFromPoolIndex(dst, index);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue