Closed Bug 1741403 Opened 3 years ago Closed 3 years ago

Add a Stencil caching mechanism

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

(Depends on 1 open bug)

Details

Attachments

(4 files)

When delazifying off-thread, the helper thread should provide a set of Stencil which are ready to be merged or instantiated by the main thread.

This implies that the cache is filled by both the main thread and the helper thread(s) and queried when the function is needed in the main thread or needed as this is the parent of a function to be delazified on the helper thread.

Depends on: 1742795
Depends on: 1743449

This patch add a strucutre which encapsulate a HashMap used to map a single
function to its CompilationStencil. This HashMap is wrapped using an
ExclusiveData Mutex, to ensure that uses are consistent.

To prevent costly uses of Mutexes, when the cache is not meant to be used, a
boolean flag is added as well as a few changes to the ExclusiveData::Guard. It
is extended to allow having a no-op Guard which evaluates to false if the lock
is not taken. In addition, this allow to have an outside scope which wrap all
StencilCache calls, to avoid having a call to clearAndDisable() in the middle.

Assignee: nobody → nicolas.b.pierron
Status: NEW → ASSIGNED

This patch adds a function which checks the cache and returns any cached result
from the StencilCache. This function is meant to short-cut the delazification by
looking up functions from the cache.

This patch modifies stencil test cases to add the ability to turn the cache on
and to fill-up this cache prior running the code. The intent being that the
cached code should be used and behave without any differences.

Depends on: 1751452
Pushed by npierron@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fbeb3779b64a Add StencilCache. r=arai https://hg.mozilla.org/integration/autoland/rev/4d00dc052dcc Add GetCachedLazyFunctionStencilMaybeInstantiate. r=arai https://hg.mozilla.org/integration/autoland/rev/b8e34643b725 Add main-thread Stencilcaching test cases. r=arai https://hg.mozilla.org/integration/autoland/rev/430636d4f051 Add isInStencilCache testing function. r=arai
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: