Closed Bug 1386555 Opened 7 years ago Closed 7 years ago

Inline AutoGeckoProfilerEntry constructor/destructor

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
The constructor and destructor show up in profiles sometimes.

The attached patch moves them to GeckoProfiler-inl.h, adds MOZ_ALWAYS_INLINE and MOZ_LIKELY, and adds an #ifdef DEBUG around the DebugOnly<> spBefore_ assignment because I'm not sure all of our compilers will no-op the profiler_->stackPointer() expression in opt builds.

This improves the micro-benchmark below from 204 ms to 191 ms.

function f() {
    var arr = [];
    var t = new Date;
    for (var i = 0; i < 10000000; i++)
        arr.reverse();
    print(new Date - t);
    return arr;
}
f();
Attachment #8892807 - Flags: review?(andrebargull)
>  private:
>    GeckoProfilerThread* profiler_;
>    mozilla::DebugOnly<uint32_t> spBefore_;
>    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER

While you're here you might also want to make the field itself #ifdef DEBUG, mozilla::DebugOnly<> still adds at least 1 byte to the class in opt builds (mozilla::DebugOnly<> isn't really meant to be used as a non-static class member).
Comment on attachment 8892807 [details] [diff] [review]
Patch

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

r=me with Emanuel's suggestion applied.
Attachment #8892807 - Flags: review?(andrebargull) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/24fad9deb6a9
Inline AutoGeckoProfilerEntry constructor and destructor. r=anba
https://hg.mozilla.org/mozilla-central/rev/24fad9deb6a9
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
https://hg.mozilla.org/projects/date/rev/24fad9deb6a98e39a73b62cc4dd609bc1cda59fa
Bug 1386555 - Inline AutoGeckoProfilerEntry constructor and destructor. r=anba
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: