Heap state is stored in JSContext

RESOLVED FIXED in Firefox 62

Status

()

enhancement
RESOLVED FIXED
Last year
Last year

People

(Reporter: jonco, Assigned: jonco)

Tracking

61 Branch
mozilla62
Points:
---

Firefox Tracking Flags

(firefox62 fixed)

Details

Attachments

(2 attachments)

The heap state field is part of the JSContext, but this should be a property of the JSRuntime.  I think this was moved there as part of the quantum DOM work when there was a 1:1 mapping between context and runtime, but got left there when this changed.
Patch to move heap state back to JSRuntime.  I made this atomic because it is checked by helper threads, e.g. when using GC zone iterators in GC parallel tasks.  I added assertions that it's only ever set from the main thread though.
Attachment #8985627 - Flags: review?(sphink)
This patch renames all the 'CurrentThreadIs...' functions now that it's not just related to the current thread.  I went with 'RuntimeHeapIs...' but I'm open to alternatives.
Attachment #8985628 - Flags: review?(sphink)
Comment on attachment 8985627 [details] [diff] [review]
bug1468867-move-heap-state-to-runtime

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

::: js/src/vm/Runtime.h
@@ +484,5 @@
>  
>      // Number of zones which may be operated on by helper threads.
>      mozilla::Atomic<size_t> numActiveHelperThreadZones;
>  
> +    // Any GC activity affecting the heap.

Technically, this is any activity, including non-GC activity.
Attachment #8985627 - Flags: review?(sphink) → review+
Comment on attachment 8985628 [details] [diff] [review]
bug1468867-rename-state-checks

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

I like the name.
Attachment #8985628 - Flags: review?(sphink) → review+
https://hg.mozilla.org/mozilla-central/rev/461ae2080686
https://hg.mozilla.org/mozilla-central/rev/bbdcb2e0eb3e
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.