Closed Bug 941786 Opened 11 years ago Closed 7 months ago

Disable saving source for chrome code

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mccr8, Unassigned)

References

Details

(Whiteboard: [MemShrink:P3])

(Do workers actually have any chrome code?)
Given the reality of lazy script parsing, which is its own memory improvement (...at least relative to a world where we already save source for toString/toSource...I think?), I'm not sure this is actually possible any more.  Or at least that's the tentative conclusion I reached when discussing disabling saved-source on b2g awhile back with nbp.
Right now I don't think we ever use lazy script parsing for chrome code.
The main problem is that addons like to use toString() on functions to dynamically patch them. Even in our tests, toString() and eval() are used for cheap metaprogramming. See toolkit/components/osfile/tests/mochi/test_osfile_comms.xul for an example usage in chrome workers. Perhaps turning off toString() for functions in chrome workers is a tractable task, though.
Our main interest here is reducing memory usage on B2G, so addon compatibility isn't a problem.  But yeah this could break Gaia or tests or something.
Whiteboard: [MemShrink]
But gaia code doesn't run in a chrome context, does it? I guess I'm not exactly sure what the scope of this bug is.
Note also that bug 886193 might get bigger gains than this, if enabled for chrome code, too - and would only work if the source has been saved.
Whiteboard: [MemShrink] → [MemShrink:P3]
(In reply to Till Schneidereit [:till] from comment #6)
> Note also that bug 886193 might get bigger gains than this, if enabled for
> chrome code, too - and would only work if the source has been saved.

Now that bug 886193 has landed, is this bug relevant any more?
(In reply to Nicholas Nethercote [:njn] from comment #7)
> Now that bug 886193 has landed, is this bug relevant any more?

Likely! Bug 944659 would make it even more so, however. That has its own share of potential problems with jank, though: see bug 944659, comment 59 and following.
(and by "likely!", I mean "probably not!" My reading comprehension seems to have been lacking when I replied ...)
Blocks: 916021
No longer blocks: 941783
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.