Commit 03936bcf authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[turbofan] Reserve larger initial size for JSHeapBroker refs map

This change introduces an initial size of 1000 for the refs map
(obtained by observing the typical size for compiling an empty function),
which reduces the time taken by "serialize standard objects" on TypeScript
benchmark from ~100ms to ~75ms (25% improvement).

Bug: v8:7790
Change-Id: I5e2d9036ad14ee0eafcd161ca913e770c468ef86
Reviewed-on: https://chromium-review.googlesource.com/1235918
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56074}
parent ed9551eb
......@@ -1198,7 +1198,7 @@ ObjectRef ContextRef::get(int index) const {
JSHeapBroker::JSHeapBroker(Isolate* isolate, Zone* zone)
: isolate_(isolate),
zone_(zone),
refs_(zone),
refs_(zone, kInitialRefsBucketCount),
mode_(FLAG_concurrent_compiler_frontend ? kSerializing : kDisabled) {
Trace("%s", "Constructing heap broker.\n");
}
......
......@@ -500,6 +500,7 @@ class V8_EXPORT_PRIVATE JSHeapBroker : public NON_EXPORTED_BASE(ZoneObject) {
base::Optional<NativeContextRef> native_context_;
ZoneUnorderedMap<Address, ObjectData*> refs_;
BrokerMode mode_;
static const size_t kInitialRefsBucketCount = 1000;
};
#define ASSIGN_RETURN_NO_CHANGE_IF_DATA_MISSING(something_var, \
......
......@@ -161,10 +161,10 @@ class ZoneUnorderedMap
ZoneAllocator<std::pair<const K, V>>> {
public:
// Constructs an empty map.
explicit ZoneUnorderedMap(Zone* zone)
explicit ZoneUnorderedMap(Zone* zone, size_t bucket_count = 100)
: std::unordered_map<K, V, Hash, KeyEqual,
ZoneAllocator<std::pair<const K, V>>>(
100, Hash(), KeyEqual(),
bucket_count, Hash(), KeyEqual(),
ZoneAllocator<std::pair<const K, V>>(zone)) {}
};
......
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