Closed Bug 1471091 Opened 6 years ago Closed 6 years ago

Try to drop single-use scripts from the script loader cache after they're executed

Categories

(Core :: XPConnect, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: kmag, Assigned: kmag)

References

(Blocks 1 open bug)

Details

(Whiteboard: [overhead:45K])

Attachments

(1 file)

When we load scripts from the preloader cache, they are always compiled for the shared JSM scope. If they need to be loaded into another scope, we need to clone them first. After we do that, we keep around the original script, in case it needs to be loaded again.

There are some scripts which will only ever be loaded once, though. Or which are not likely to be loaded more than once, at least. Process scripts are a good example. They get loaded into a single frameloader per process.

In those cases, we can just drop the saved JSScript after the first time it's loaded, and decode it again from cached the XDR bytecode if it's needed again.
Priority: -- → P2
Whiteboard: [overhead:~100K] → [overhead:60K]
Note: I only handled process scripts here since we don't currently seem to wind up caching any subscript loader scripts for content processes.
Comment on attachment 8988957 [details]
Bug 1471091: Avoid cloning and caching process scripts.

https://reviewboard.mozilla.org/r/254068/#review262314

Sorry for the delay.

::: js/xpconnect/loader/ScriptPreloader.h:229
(Diff revision 1)
> +        // again and, if not, drops it and returns true. This is the case for
> +        // run-once scripts that do not still need to be encoded into the
> +        // cache.
> +        //
> +        // If this method returns false, callers may set mScript to a cached
> +        // JSScript instance for this entry. If it returns false, they should

Both sentences say "false". Should the second one have "true"?
Attachment #8988957 - Flags: review?(continuation) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/612859656fae2968cd7f6d978b8a4783d69fb236
Bug 1471091: Follow-up: Fix crash in devtools tests when they execute process scripts multiple times. r=bustage
https://hg.mozilla.org/mozilla-central/rev/9bb8b9e81886
https://hg.mozilla.org/mozilla-central/rev/612859656fae
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Whiteboard: [overhead:60K] → [overhead:45K]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: