Commit 7ad02b49 authored by Vicky Kontoura's avatar Vicky Kontoura Committed by Commit Bot

[wasm] Adjust budget for tiering of js-to-wasm wrappers

This CL increases the budget for the tiering strategy of the js-to-wasm
wrappers from 6 (which was initially picked at random, as the feature
was experimental) to 1000 calls (which is picked based on benchmarking).

The high-level rationale behind such a choice can be summarized in the
following:
- The generic wrapper is not that much slower than the specific
wrappers, so it can handle up to some thousands of calls quite well.
- After that, the generic wrapper starts lacking compared to the
specific wrappers, even if compiling a specific wrapper means blocking
the main thread.
- Real-life applications do call exported functions thousands of times,
so this is not an unrealistic choice.

Bug: v8:10982
Change-Id: I143dd11e535101fd24810f63ed8b987cd03c4326
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2539913
Commit-Queue: Vicky Kontoura <vkont@google.com>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71232}
parent 076687ab
......@@ -126,7 +126,17 @@ constexpr int kAnonymousFuncIndex = -1;
// The number of calls to an exported Wasm function that will be handled
// by the generic wrapper. Once the budget is exhausted, a specific wrapper
// is to be compiled for the function's signature.
constexpr uint32_t kGenericWrapperBudget = 6;
// The abstract goal of the tiering strategy for the js-to-wasm wrappers is to
// use the generic wrapper as much as possible (less space, no need to compile),
// but fall back to compiling a specific wrapper for any function (signature)
// that is used often enough for the generic wrapper's small execution penalty
// to start adding up.
// So, when choosing a value for the initial budget, we are interested in a
// value that skips on tiering up functions that are called only a few times and
// the tier-up only wastes resources, but triggers compilation of specific
// wrappers early on for those functions that have the potential to be called
// often enough.
constexpr uint32_t kGenericWrapperBudget = 1000;
} // namespace wasm
} // namespace internal
......
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