Closed Bug 774706 Opened 12 years ago Closed 12 years ago

weird dead xpc_UnmarkGrayScript floating around in nsJSContext::Serialize

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: luke, Assigned: Benjamin)

Details

Attachments

(1 file, 1 obsolete file)

Go figure:
http://mxr.mozilla.org/mozilla-central/source/dom/base/nsJSEnvironment.cpp#1984

Related question: do we ever call this function?  It ends up being 1 of 2 uses of JS engine XDR, so it would be awesome if we could kill it...
I see.  bz: do you know how that stream serialization relates to the startup cache?
Pretty directly, last I checked: the result is what's stored in the startup cache.
Interesting, so is this for a set of scripts disjoint from those XDR'd via (Read|Write)CachedScript (by mozJSComponentLoader::GlobalForLocation and mozJSSubScriptLoader::LoadSubScript) ?
Yes, this is for <script> tags in XUL documents.  Specifically for inline <script>s, for the callsite linked in comment 1, I believe.
Ah, thanks for explaining.  Would you say that <script> tags are the majority (size-wise) of XDR'd scripts?
I would think not, because the inline scripts should generally be small (and perhaps even rare) and <script src> uses a different codepath here, right?

We could measure, if desired.
(In reply to Boris Zbarsky (:bz) from comment #7)
Ah, good to hear; we'll measure.  (This is all in the context of removing the decompiler and bug 761723.)
Attached patch kill dead xpc thing (obsolete) — Splinter Review
Going back to the original bug.
Assignee: nobody → bpeterson
Attachment #649684 - Flags: review?(luke)
Comment on attachment 649684 [details] [diff] [review]
kill dead xpc thing

Removing them is one option, but I assume it was put here for a reason:
  http://hg.mozilla.org/mozilla-central/rev/defb50779980
Steve?
Attachment #649684 - Flags: review?(luke) → review?(sphink)
Perhaps smaug can comment.
The question is, what does WriteScript do with aScriptObject?  If it can create any new references to aScriptObject anywhere in the heap, then we need to do an xpc_UnmarkGrayScript() before we do WriteScript.
I don't know what WriteScript does... but looks like it ends up calling
JS_EncodeInterpretedFunction or JS_EncodeScript.
I don't believe JS_EncodeScript currently can keep extra references around. Maybe it would be safer to retain the xpc_UnmarkGrayScript just in case.
That would be the easiest thing to do.  I can't imagine the overhead of a function call will impact performance much here.
Attached patch fix dead codeSplinter Review
Attachment #649684 - Attachment is obsolete: true
Attachment #649684 - Flags: review?(sphink)
Attachment #649741 - Flags: review?(continuation)
Comment on attachment 649741 [details] [diff] [review]
fix dead code

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

Thanks.
Attachment #649741 - Flags: review?(continuation) → review+
https://hg.mozilla.org/mozilla-central/rev/b25596aab946
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: