Closed Bug 561218 Opened 15 years ago Closed 15 years ago

[meta] JM: Improve performance of global variables

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dvander, Unassigned)

References

Details

No description provided.
The plan currently is: 1. Non-intrusively improve front-end binding of global variables. 2. Investigate why and when functions cross globals, and find a way to pin scripts to a given global object. 3. Use this information in the method JIT to improve global access.
[4:03pm]brendan:dmandelin, dvander: functions are statically scoped in js -- no change of global object identity for a given cloned (unjoined) function object [4:03pm]brendan:the function's script of course is shared among all clones and the joined funobj [4:03pm]dvander:brendan, the script's global changing is what we're worried about [4:03pm]brendan:and not affine with any particular global in general -- but compile-n-go helps a lot [4:04pm]dvander:we'd like to be able to JIT the script for the global it's first run on [4:04pm]brendan:dvander: compile-n-go-created scripts (top-level and function) will all be scoped by a single global [4:04pm]dvander:and not have to worry about invalidating [4:04pm]brendan:dvander: the precompilation ("brutal sharing") cases are the opposite [4:04pm]dvander:brendan, when do those cases come up? [4:05pm]brendan:dvander: xul scripts [4:05pm]brendan:dvander: js components too, iirc [4:05pm]brendan:xbl [4:05pm]brendan:bz back yet? [4:05pm]brendan:dvander: look for COMPILE_N_GO in dxr [4:05pm]dmandelin:what about JS_ExecuteScript being called with different globals? [4:05pm]brendan:dmandelin: that is one of the APIs exposed for precompilation, yeah [4:06pm]brendan:dmandelin: <script> tags are compile-n-go tho -- JS_EvaluateUCScriptForPrincipals iirc [4:06pm]brendan:that's the case to focus on [4:06pm]brendan:this xul stuff is second order :-P
I had already summarized this discussion before the paste, so here goes: We went over question 2 above on IRC. For posterity: Running a script via Evaluate*Script*() compiles in COMPILE_N_GO mode, which means the caller promises to run the script with only one global. This currently enables some front-end optimizations. Browser content JS and shell JS is always run in this mode. Our plan is that for COMPILE_N_GO scripts, we optimize globals to the max. Otherwise, we will compile the safe thing, namely to walk the scope chain up to the global object.
This was done on JM a while ago.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.