зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1843534 - Avoid measuring protect time when write-protection is disabled. r=jandem
On certain devices we have seen that taking frequent timestamps can be expensive. Currently we measure the time taken to write protect JIT code, and as this is a hot path we see these timestamps show up in profiles. However, since bug 1835876 we no longer write protect code in content processes. This patch therefore avoids measuring the time when write protection is disabled. Differential Revision: https://phabricator.services.mozilla.com/D185005
This commit is contained in:
Родитель
5b33bdd436
Коммит
7a78be9a55
|
@ -53,10 +53,16 @@ class MOZ_RAII AutoWritableJitCodeFallible {
|
|||
}
|
||||
|
||||
~AutoWritableJitCodeFallible() {
|
||||
mozilla::TimeStamp startTime = mozilla::TimeStamp::Now();
|
||||
// Taking TimeStamps frequently can be expensive, and there's no point
|
||||
// measuring this if write protection is disabled.
|
||||
const bool measuringTime = JitOptions.writeProtectCode;
|
||||
const mozilla::TimeStamp startTime =
|
||||
measuringTime ? mozilla::TimeStamp::Now() : mozilla::TimeStamp();
|
||||
auto timer = mozilla::MakeScopeExit([&] {
|
||||
if (Realm* realm = rt_->mainContextFromOwnThread()->realm()) {
|
||||
realm->timers.protectTime += mozilla::TimeStamp::Now() - startTime;
|
||||
if (measuringTime) {
|
||||
if (Realm* realm = rt_->mainContextFromOwnThread()->realm()) {
|
||||
realm->timers.protectTime += mozilla::TimeStamp::Now() - startTime;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче