Closed Bug 1163059 Opened 5 years ago Closed 5 years ago

Add a convenience wrapper to Zone for isAtomsZone

Categories

(Core :: JavaScript: GC, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox40 --- affected
firefox41 --- fixed

People

(Reporter: terrence, Assigned: terrence)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The zone contains a direct runtime pointer, so we can make this change without having to worry overly much about performance. It seems to shorten a few call sites and means we don't have to pass a runtime in a couple spots.
Attachment #8603431 - Flags: review?(sphink)
Comment on attachment 8603431 [details] [diff] [review]
24.0_add_convenience_isAtomsZone-v0.diff

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

::: js/src/gc/Zone.cpp
@@ +77,1 @@
>          MOZ_ASSERT(!runtimeFromMainThread()->exclusiveThreadsPresent());

Probably ought to be MOZ_ASSERT_IF, but I'd be shocked if the optimizer didn't make it go away anyway.

::: js/src/jit/VMFunctions.cpp
@@ +1221,5 @@
>  AssertValidSymbolPtr(JSContext* cx, JS::Symbol* sym)
>  {
>      // We can't closely inspect symbols from another runtime.
> +    if (sym->runtimeFromAnyThread() != cx->runtime()) {
> +        MOZ_ASSERT(sym->isWellKnownSymbol());

That seems like a rather good assertion to have.

::: js/src/vm/Runtime.h
@@ +923,5 @@
>      bool isSelfHostingGlobal(JSObject* global) {
>          return global == selfHostingGlobal_;
>      }
>      bool isSelfHostingCompartment(JSCompartment* comp);
> +    bool isSelfHostingZone(const JS::Zone* zone);

Make these const.

@@ +1268,5 @@
>          return comp == atomsCompartment_;
>      }
>  
>      // The atoms compartment is the only one in its zone.
> +    inline bool isAtomsZone(const JS::Zone* zone);

Make this const (though given that it's inline, I imagine the compiler can figure it out.)
Attachment #8603431 - Flags: review?(sphink) → review+
https://hg.mozilla.org/mozilla-central/rev/6bc3e88e0107
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.