Closed Bug 1379461 Opened 8 years ago Closed 8 years ago

Return RegExpShared* instead of using bool + outparam

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: jandem, Assigned: jandem)

Details

Attachments

(2 files)

Attached patch PatchSplinter 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+
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
Flags: needinfo?(jdemooij)
Backout by cbook@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/8dad48102b13 Backed out changeset 3a0a2ffe803b for hazard failure
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+
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
Depends on: 1380134
No longer depends on: 1380134
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: