Inline AutoGeckoProfilerEntry constructor/destructor

RESOLVED FIXED in Firefox 57

Status

()

Core
JavaScript Engine
RESOLVED FIXED
17 days ago
10 days ago

People

(Reporter: jandem, Assigned: jandem)

Tracking

(Blocks: 1 bug)

unspecified
mozilla57
Points:
---

Firefox Tracking Flags

(firefox57 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

17 days ago
Created attachment 8892807 [details] [diff] [review]
Patch

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 2

17 days ago
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+

Comment 3

15 days ago
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
Last Resolved: 14 days ago
status-firefox57: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57

Comment 5

10 days ago
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.