Closed Bug 1148534 Opened 9 years ago Closed 9 years ago

Templatize IsMarked and IsAboutToBeFinalized

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: terrence, Assigned: terrence)

References

Details

Attachments

(1 file)

Nothing too complicated here. Adds a few lines since this needs explicit expansions for jsid that were not present before.
Attachment #8584725 - Flags: review?(jcoppeard)
Comment on attachment 8584725 [details] [diff] [review]
4.6.2_templatize_ismarked-v0.diff

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

Looks good!

::: js/src/gc/Marking.cpp
@@ +840,5 @@
> +IsMarkedInternal<Value>(Value *valuep)
> +{
> +    bool rv = true;  // Non-markable types are always live.
> +    if (valuep->isString()) {
> +        JSString *str = (JSString *)valuep->toGCThing();

Let's replace these C-style casts while we're here.

@@ +948,5 @@
> +template <typename T>
> +bool
> +IsMarkedUnbarriered(T *thingp)
> +{
> +    auto layout = reinterpret_cast<typename PtrBaseGCType<T>::type *>(thingp);

I think it should be possible to factor out this conversion.  Something like:

    template <typename T>
    PtrBaseGCType<T> *ConvertToBase(T *thing)
    {
        return reinterpret_cast ... etc
    }
Attachment #8584725 - Flags: review?(jcoppeard) → review+
(In reply to Jon Coppeard (:jonco) from comment #1)
> @@ +948,5 @@
> > +template <typename T>
> > +bool
> > +IsMarkedUnbarriered(T *thingp)
> > +{
> > +    auto layout = reinterpret_cast<typename PtrBaseGCType<T>::type *>(thingp);
> 
> I think it should be possible to factor out this conversion.  Something like:
> 
>     template <typename T>
>     PtrBaseGCType<T> *ConvertToBase(T *thing)
>     {
>         return reinterpret_cast ... etc
>     }

asBase, maybe? Or asBaseGCType or something.
Whoops, checked this in with the wrong bug: bug 1149352.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: