Backed out 2 changesets (bug 1864828) for causing build bustages on TestJemalloc.cpp. CLOSED TREE
Backed out changeset c1b4a8307702 (bug 1864828) Backed out changeset ba88f119b1fc (bug 1864828)
This commit is contained in:
@@ -47,6 +47,27 @@ Order CompareAddr(T* aAddr1, T* aAddr2) {
|
|||||||
return CompareInt(uintptr_t(aAddr1), uintptr_t(aAddr2));
|
return CompareInt(uintptr_t(aAddr1), uintptr_t(aAddr2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// User-defined literals to make constants more legible
|
||||||
|
constexpr size_t operator"" _KiB(unsigned long long int aNum) {
|
||||||
|
return size_t(aNum) * 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr size_t operator"" _KiB(long double aNum) {
|
||||||
|
return size_t(aNum * 1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr size_t operator"" _MiB(unsigned long long int aNum) {
|
||||||
|
return size_t(aNum) * 1024_KiB;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr size_t operator"" _MiB(long double aNum) {
|
||||||
|
return size_t(aNum * 1024_KiB);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr double operator""_percent(long double aPercent) {
|
||||||
|
return double(aPercent) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
// Helper for (fast) comparison of fractions without involving divisions or
|
// Helper for (fast) comparison of fractions without involving divisions or
|
||||||
// floats.
|
// floats.
|
||||||
class Fraction {
|
class Fraction {
|
||||||
|
|||||||
@@ -150,7 +150,6 @@
|
|||||||
#include "mozilla/DoublyLinkedList.h"
|
#include "mozilla/DoublyLinkedList.h"
|
||||||
#include "mozilla/HelperMacros.h"
|
#include "mozilla/HelperMacros.h"
|
||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
#include "mozilla/Literals.h"
|
|
||||||
#include "mozilla/MathAlgorithms.h"
|
#include "mozilla/MathAlgorithms.h"
|
||||||
#include "mozilla/RandomNum.h"
|
#include "mozilla/RandomNum.h"
|
||||||
// Note: MozTaggedAnonymousMmap() could call an LD_PRELOADed mmap
|
// Note: MozTaggedAnonymousMmap() could call an LD_PRELOADed mmap
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
/* Helpers for units on integer literals. */
|
|
||||||
|
|
||||||
#ifndef mozilla_Literals_h
|
|
||||||
#define mozilla_Literals_h
|
|
||||||
|
|
||||||
// User-defined literals to make constants more legible. Use them by
|
|
||||||
// appending them to literals such as:
|
|
||||||
//
|
|
||||||
// size_t page_size = 4_KiB;
|
|
||||||
//
|
|
||||||
constexpr size_t operator"" _KiB(unsigned long long int aNum) {
|
|
||||||
return size_t(aNum) * 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr size_t operator"" _KiB(long double aNum) {
|
|
||||||
return size_t(aNum * 1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr size_t operator"" _MiB(unsigned long long int aNum) {
|
|
||||||
return size_t(aNum) * 1024_KiB;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr size_t operator"" _MiB(long double aNum) {
|
|
||||||
return size_t(aNum * 1024_KiB);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr double operator""_percent(long double aPercent) {
|
|
||||||
return double(aPercent) / 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ! mozilla_Literals_h */
|
|
||||||
@@ -63,7 +63,6 @@ EXPORTS.mozilla = [
|
|||||||
"Latin1.h",
|
"Latin1.h",
|
||||||
"Likely.h",
|
"Likely.h",
|
||||||
"LinkedList.h",
|
"LinkedList.h",
|
||||||
"Literals.h",
|
|
||||||
"MacroArgs.h",
|
"MacroArgs.h",
|
||||||
"MacroForEach.h",
|
"MacroForEach.h",
|
||||||
"MathAlgorithms.h",
|
"MathAlgorithms.h",
|
||||||
|
|||||||
@@ -11054,11 +11054,6 @@
|
|||||||
value: @IS_EARLY_BETA_OR_EARLIER@
|
value: @IS_EARLY_BETA_OR_EARLIER@
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
- name: memory.phc.min_ram_mb
|
|
||||||
type: uint32_t
|
|
||||||
value: 8000
|
|
||||||
mirror: always
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Prefs starting with "midi."
|
# Prefs starting with "midi."
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -2011,10 +2011,6 @@ phc:
|
|||||||
description: Whether to enable PHC
|
description: Whether to enable PHC
|
||||||
type: boolean
|
type: boolean
|
||||||
setPref: memory.phc.enabled
|
setPref: memory.phc.enabled
|
||||||
phcMinRamMB:
|
|
||||||
description: The minimum amount of RAM required to enable PHC
|
|
||||||
type: int
|
|
||||||
setPref: memory.phc.min_ram_mb
|
|
||||||
|
|
||||||
mailto:
|
mailto:
|
||||||
description: Prefs to control aspects of the mailto handler
|
description: Prefs to control aspects of the mailto handler
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "PHCManager.h"
|
#include "PHCManager.h"
|
||||||
|
|
||||||
#include "PHC.h"
|
#include "PHC.h"
|
||||||
#include "mozilla/Literals.h"
|
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/StaticPrefs_memory.h"
|
#include "mozilla/StaticPrefs_memory.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
@@ -17,37 +16,31 @@ namespace mozilla {
|
|||||||
|
|
||||||
using namespace phc;
|
using namespace phc;
|
||||||
|
|
||||||
static const char kPHCEnabledPref[] = "memory.phc.enabled";
|
static const char kPHCPref[] = "memory.phc.enabled";
|
||||||
static const char kPHCMinRamMBPref[] = "memory.phc.min_ram_mb";
|
|
||||||
|
|
||||||
static void UpdatePHCState() {
|
static PHCState GetPHCStateFromPref() {
|
||||||
size_t mem_size = PR_GetPhysicalMemorySize() / (1_MiB);
|
return StaticPrefs::memory_phc_enabled() ? Enabled : OnlyFree;
|
||||||
size_t min_mem_size = StaticPrefs::memory_phc_min_ram_mb();
|
}
|
||||||
|
|
||||||
|
static void PrefChangeCallback(const char* aPrefName, void* aNull) {
|
||||||
|
MOZ_ASSERT(0 == strcmp(aPrefName, kPHCPref));
|
||||||
|
|
||||||
|
SetPHCState(GetPHCStateFromPref());
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitPHCState() {
|
||||||
|
size_t memSize = PR_GetPhysicalMemorySize();
|
||||||
// Only enable PHC if there are at least 8GB of ram. Note that we use
|
// Only enable PHC if there are at least 8GB of ram. Note that we use
|
||||||
// 1000 bytes per kilobyte rather than 1024. Some 8GB machines will have
|
// 1000 bytes per kilobyte rather than 1024. Some 8GB machines will have
|
||||||
// slightly lower actual RAM available after some hardware devices
|
// slightly lower actual RAM available after some hardware devices
|
||||||
// reserve some.
|
// reserve some.
|
||||||
if (StaticPrefs::memory_phc_enabled() && mem_size >= min_mem_size) {
|
if (memSize >= size_t(8'000'000'000llu)) {
|
||||||
SetPHCState(Enabled);
|
SetPHCState(GetPHCStateFromPref());
|
||||||
} else {
|
|
||||||
SetPHCState(OnlyFree);
|
Preferences::RegisterCallback(PrefChangeCallback, kPHCPref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrefChangeCallback(const char* aPrefName, void* aNull) {
|
|
||||||
MOZ_ASSERT((0 == strcmp(aPrefName, kPHCEnabledPref)) ||
|
|
||||||
(0 == strcmp(aPrefName, kPHCMinRamMBPref)));
|
|
||||||
|
|
||||||
UpdatePHCState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitPHCState() {
|
|
||||||
Preferences::RegisterCallback(PrefChangeCallback, kPHCEnabledPref);
|
|
||||||
Preferences::RegisterCallback(PrefChangeCallback, kPHCMinRamMBPref);
|
|
||||||
UpdatePHCState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReportPHCTelemetry() {
|
void ReportPHCTelemetry() {
|
||||||
MemoryUsage usage;
|
MemoryUsage usage;
|
||||||
PHCMemoryUsage(usage);
|
PHCMemoryUsage(usage);
|
||||||
|
|||||||
Reference in New Issue
Block a user