Return RegExpShared* instead of using bool + outparam

RESOLVED FIXED in Firefox 56

Status

()

Core
JavaScript Engine
RESOLVED FIXED
4 months ago
3 months ago

People

(Reporter: jandem, Assigned: jandem)

Tracking

unspecified
mozilla56
Points:
---

Firefox Tracking Flags

(firefox56 fixed)

Details

Attachments

(2 attachments)

(Assignee)

Description

4 months ago
Created attachment 8884624 [details] [diff] [review]
Patch

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)

Updated

4 months ago
Attachment #8884624 - Flags: review?(evilpies) → review+

Comment 1

4 months ago
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/3a0a2ffe803b
Refactor code to return RegExpShared* directly instead of using bool + outparam. r=evilpie
backed out for hazard failure like https://treeherder.mozilla.org/logviewer.html#?job_id=113286186&repo=mozilla-inbound
Flags: needinfo?(jdemooij)

Comment 3

4 months ago
Backout by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8dad48102b13
Backed out changeset 3a0a2ffe803b for hazard failure
(Assignee)

Comment 4

4 months ago
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

4 months ago
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/707b8c089de2
Refactor code to return RegExpShared* directly instead of using bool + outparam. r=evilpie,sfink

Updated

4 months ago
Depends on: 1380134

Updated

4 months ago
No longer depends on: 1380134

Comment 6

3 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/707b8c089de2
Status: ASSIGNED → RESOLVED
Last Resolved: 3 months 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.