Return RegExpShared* instead of using bool + outparam

RESOLVED FIXED in Firefox 56



2 years ago
2 years ago


(Reporter: jandem, Assigned: jandem)



Firefox Tracking Flags

(firefox56 fixed)



(2 attachments)

Created attachment 8884624 [details] [diff] [review]

There are a lot of places where we can return RegExpShared* instead of returning bool and using a RegExpShared outparam. This is cleaner and lets us eliminate a bunch of unnecessary roots.

This is a very mechanical patch. I did have to beef up the FORWARD macro in the js/ipc CPOW code to let us return nullptr on failure instead of false.
Attachment #8884624 - Flags: review?(evilpies)
Attachment #8884624 - Flags: review?(evilpies) → review+

Comment 1

2 years ago
Pushed by
Refactor code to return RegExpShared* directly instead of using bool + outparam. r=evilpie
backed out for hazard failure like
Flags: needinfo?(jdemooij)

Comment 3

2 years ago
Backout by
Backed out changeset 3a0a2ffe803b for hazard failure
Created attachment 8885247 [details] [diff] [review]
Suppress bogus GC function

We use the macro below in the CPOW code.

The analysis thinks that when the return value is a RegExpShared*, it's live across a GC call: AUTO_PROFILER_LABEL macro -> ~AutoProfilerLabel destructor.

This is bogus because ~AutoProfilerLabel has an indirect call but definitely can't GC.

I think the easiest fix is to teach the analysis that ~AutoProfilerLabel cannot GC. Unfortunately this code is in mozglue so I don't think we can use our SuppressGCAnalysis class for this.

This patch adds an annotation and I get a green analysis build with this on Try.

#define FORWARD(call, args, failRetVal)                                 \
    AUTO_PROFILER_LABEL(__func__, JS);                                  \
    WrapperOwner* owner = OwnerOf(proxy);                               \
    if (!owner->active()) {                                             \
        JS_ReportErrorASCII(cx, "cannot use a CPOW whose process is gone"); \
        return failRetVal;                                              \
    }                                                                   \
    if (!owner->allowMessage(cx)) {                                     \
        return failRetVal;                                              \
    }                                                                   \
    {                                                                   \
        CPOWTimer timer(cx);                                            \
        return owner->call args;                                        \
Flags: needinfo?(jdemooij)
Attachment #8885247 - Flags: review?(sphink)
Attachment #8885247 - Flags: review?(sphink) → review+

Comment 5

2 years ago
Pushed by
Refactor code to return RegExpShared* directly instead of using bool + outparam. r=evilpie,sfink


2 years ago
Depends on: 1380134


2 years ago
No longer depends on: 1380134

Comment 6

2 years ago
Last Resolved: 2 years ago
status-firefox56: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.