ref count ScriptSource

RESOLVED FIXED in mozilla17

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Benjamin, Assigned: Benjamin)

Tracking

unspecified
mozilla17
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
Right now, ScriptSource is hacked onto the GC. This creates icky things like attachToRuntime and the IGC hacks in JSScript::setScriptSource. Since ScriptSource doesn't contain any structs, it would be easier to reference count script sources. Reference counting would also free the source as soon as the last script owning it disappeared instead of waiting for full GC.
(Assignee)

Comment 1

5 years ago
Created attachment 648471 [details] [diff] [review]
implementing ref counting

The only slightly tricky part is that MemoryMetrics has to use a HashSet to avoid counting the same source multiple times.
Assignee: general → bpeterson
Attachment #648471 - Flags: review?(jorendorff)
Comment on attachment 648471 [details] [diff] [review]
implementing ref counting

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

Wonderful. This is so much better than the GC hack.

My experience is, anything like this eventually gets turned into a real GC-thing; but if that happens in time, fine, and there's no rush.

::: js/src/jsscript.cpp
@@ +1293,2 @@
>      JS_ASSERT(ready());
>      // data is a union, but both members are pointers to allocated memory, so

Pre-existing style nit: while you're in here, please put a blank line before this comment (since it is not at the top of a block)
Attachment #648471 - Flags: review?(jorendorff) → review+
(Assignee)

Comment 3

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/fa77c8c2a346
https://hg.mozilla.org/mozilla-central/rev/fa77c8c2a346
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.