Closed Bug 1392225 Opened 2 years ago Closed 2 years ago

JSBC: Unability to serialize bytecode causes failures to continue the execution.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

Details

Attachments

(1 file)

When running the eager mode of JSBC, the serialization fails on asm.js code.
We should do 2 thing:
 - Prevent encoding failures from stopping the rest of the execution.
 - Discard the incremental encoder when asm.js code is detected in the source.

I can reproduce this with:

 $ mach mochitest \
   --setpref dom.script_loader.bytecode_cache.strategy=-1 \
   --setpref dom.script_loader.bytecode_cache.enabled=true \
   dom/asmjscache/test/test_slow.html

Which ends with a timeout without running any of the asm.js test cases.
The problem was simpler than expected, the xdtEncodeTopLevel function used
by the StartIncrementalEncoder jsapi function was reporting the equivalent
of an execution failure to the ScriptLoader.

This error prevented the execution of all scripts containing asm.js code
from ever running after the 5th visit, unless the user used Ctrl-Shift-R for
reloading without the cache.

This patch does 2 things:
 - Add a short-cut to avoid allocating and iterating over tons of JSScript
   if there is any asm.js code in the source.
 - Fix the xdrEncodeTopLevel function, to only report allocation failures,
   and no longer encoding failures.
Attachment #8899504 - Flags: review?(luke)
Comment on attachment 8899504 [details] [diff] [review]
StartIncrementalEncoder should not report encoding failures.

Review of attachment 8899504 [details] [diff] [review]:
-----------------------------------------------------------------

Simple enough!
Attachment #8899504 - Flags: review?(luke) → review+
Status: NEW → ASSIGNED
Component: DOM → JavaScript Engine
Pushed by npierron@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ce67aec308e0
StartIncrementalEncoder should not report encoding failures. r=luke
https://hg.mozilla.org/mozilla-central/rev/ce67aec308e0
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.