Merge mozilla-central to autoland. a=merge CLOSED TREE

This commit is contained in:
Bogdan Tara 2018-11-23 23:40:33 +02:00
Родитель 7f4954743b 243e2192a2
Коммит 2c11899649
6 изменённых файлов: 61 добавлений и 146 удалений

Просмотреть файл

@ -1,127 +0,0 @@
/* 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/. */
use std::{iter::Extend, ops, marker::PhantomData, u32};
use util::recycle_vec;
#[derive(Debug, Hash)]
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct Index<T>(u32, PhantomData<T>);
// We explicitly implement Copy + Clone instead of using #[derive(Copy, Clone)]
// because we don't want to require that T implements Clone + Copy.
impl<T> Clone for Index<T> {
fn clone(&self) -> Self { *self }
}
impl<T> Copy for Index<T> {}
impl<T> PartialEq for Index<T> {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
impl<T> Index<T> {
fn new(idx: usize) -> Self {
debug_assert!(idx < u32::max_value() as usize);
Index(idx as u32, PhantomData)
}
pub const INVALID: Index<T> = Index(u32::MAX, PhantomData);
}
#[derive(Debug)]
pub struct Range<T> {
pub start: Index<T>,
pub end: Index<T>,
}
// We explicitly implement Copy + Clone instead of using #[derive(Copy, Clone)]
// because we don't want to require that T implements Clone + Copy.
impl<T> Clone for Range<T> {
fn clone(&self) -> Self {
Range { start: self.start, end: self.end }
}
}
impl<T> Copy for Range<T> {}
impl<T> Range<T> {
/// Create an empty `Range`
pub fn empty() -> Self {
Range {
start: Index::new(0),
end: Index::new(0),
}
}
/// Check for an empty `Range`
pub fn is_empty(&self) -> bool {
!(self.start.0 < self.end.0)
}
}
pub struct Storage<T> {
data: Vec<T>,
}
impl<T> Storage<T> {
pub fn new(initial_capacity: usize) -> Self {
Storage {
data: Vec::with_capacity(initial_capacity),
}
}
pub fn len(&self) -> usize {
self.data.len()
}
pub fn push(&mut self, t: T) -> Index<T> {
let index = self.data.len();
self.data.push(t);
Index(index as u32, PhantomData)
}
pub fn recycle(&mut self) {
recycle_vec(&mut self.data);
}
pub fn extend<II: IntoIterator<Item=T>>(&mut self, iter: II) -> Range<T> {
let start = Index::new(self.data.len());
self.data.extend(iter);
let end = Index::new(self.data.len());
Range { start, end }
}
}
impl<T> ops::Index<Index<T>> for Storage<T> {
type Output = T;
fn index(&self, index: Index<T>) -> &Self::Output {
&self.data[index.0 as usize]
}
}
impl<T> ops::IndexMut<Index<T>> for Storage<T> {
fn index_mut(&mut self, index: Index<T>) -> &mut Self::Output {
&mut self.data[index.0 as usize]
}
}
impl<T> ops::Index<Range<T>> for Storage<T> {
type Output = [T];
fn index(&self, index: Range<T>) -> &Self::Output {
let start = index.start.0 as _;
let end = index.end.0 as _;
&self.data[start..end]
}
}
impl<T> ops::IndexMut<Range<T>> for Storage<T> {
fn index_mut(&mut self, index: Range<T>) -> &mut Self::Output {
let start = index.start.0 as _;
let end = index.end.0 as _;
&mut self.data[start..end]
}
}

Просмотреть файл

@ -742,8 +742,6 @@ ChunkPool::push(Chunk* chunk)
}
head_ = chunk;
++count_;
MOZ_ASSERT(verify());
}
Chunk*
@ -764,7 +762,6 @@ ChunkPool::remove(Chunk* chunk)
chunk->info.next = chunk->info.prev = nullptr;
--count_;
MOZ_ASSERT(verify());
return chunk;
}
@ -952,9 +949,7 @@ Chunk::updateChunkListAfterFree(JSRuntime* rt, const AutoLockGC& lock)
rt->gc.fullChunks(lock).remove(this);
rt->gc.availableChunks(lock).push(this);
} else if (!unused()) {
MOZ_ASSERT(!rt->gc.fullChunks(lock).contains(this));
MOZ_ASSERT(rt->gc.availableChunks(lock).contains(this));
MOZ_ASSERT(!rt->gc.emptyChunks(lock).contains(this));
} else {
MOZ_ASSERT(unused());
rt->gc.availableChunks(lock).remove(this);

Просмотреть файл

@ -2826,9 +2826,7 @@ js::gc::StoreBuffer::SlotsEdge::trace(TenuringTracer& mover) const
return;
}
if (IsInsideNursery(obj)) {
return;
}
MOZ_ASSERT(!IsInsideNursery(obj), "obj shouldn't live in nursery.");
if (kind() == ElementKind) {
uint32_t initLen = obj->getDenseInitializedLength();

Просмотреть файл

@ -426,7 +426,7 @@ var State = {
let tabs = {};
for (let counter of counters) {
let {items, host, pid, counterId, windowId, duration, isWorker,
isTopLevel} = counter;
memoryInfo, isTopLevel} = counter;
// If a worker has a windowId of 0 or max uint64, attach it to the
// browser UI (doc group with id 1).
if (isWorker && (windowId == 18446744073709552000 || !windowId))
@ -436,6 +436,17 @@ var State = {
dispatchCount += count;
}
let memory = 0;
for (let field in memoryInfo) {
if (field == "media") {
for (let mediaField of ["audioSize", "videoSize", "resourcesSize"]) {
memory += memoryInfo.media[mediaField];
}
continue;
}
memory += memoryInfo[field];
}
let tab;
let id = windowId;
if (addonHosts.has(host)) {
@ -444,13 +455,14 @@ var State = {
if (id in tabs) {
tab = tabs[id];
} else {
tab = {windowId, host, dispatchCount: 0, duration: 0, children: []};
tab = {windowId, host, dispatchCount: 0, duration: 0, memory: 0, children: []};
tabs[id] = tab;
}
tab.dispatchCount += dispatchCount;
tab.duration += duration;
tab.memory += memory;
if (!isTopLevel || isWorker) {
tab.children.push({host, isWorker, dispatchCount, duration,
tab.children.push({host, isWorker, dispatchCount, duration, memory,
counterId: pid + ":" + counterId});
}
}
@ -468,7 +480,7 @@ var State = {
if (id in tabs) {
tab = tabs[id];
} else {
tab = {windowId: 0, host: id, dispatchCount: 0, duration: 0, children: []};
tab = {windowId: 0, host: id, dispatchCount: 0, duration: 0, memory: 0, children: []};
tabs[id] = tab;
}
tab.dispatchCount += dispatchCount;
@ -669,8 +681,7 @@ var State = {
}
// For each subitem, create a new object including the deltas since the previous time.
let children = tab.children.map(child => {
let {host, dispatchCount, duration, isWorker, counterId} = child;
let {host, dispatchCount, duration, memory, isWorker, counterId} = child;
let dispatchesSincePrevious = dispatchCount;
let durationSincePrevious = duration;
if (prevChildren.has(counterId)) {
@ -680,7 +691,7 @@ var State = {
prevChildren.delete(counterId);
}
return {host, dispatchCount, duration, isWorker,
return {host, dispatchCount, duration, isWorker, memory,
dispatchesSincePrevious, durationSincePrevious};
});
@ -714,7 +725,7 @@ var State = {
durationSinceStartOfBuffer =
duration - oldest.duration - (oldest.durationFromFormerChildren || 0);
}
counters.push({id, name, image, type,
counters.push({id, name, image, type, memory: tab.memory,
totalDispatches: dispatches, totalDuration: duration,
durationSincePrevious, dispatchesSincePrevious,
durationSinceStartOfBuffer, dispatchesSinceStartOfBuffer,
@ -1037,7 +1048,7 @@ var View = {
{value: energyImpact});
}
},
appendRow(name, energyImpact, tooltip, type, image = "") {
appendRow(name, energyImpact, memory, tooltip, type, image = "") {
let row = document.createElement("tr");
let elt = document.createElement("td");
@ -1069,6 +1080,24 @@ var View = {
this.displayEnergyImpact(elt, energyImpact);
row.appendChild(elt);
elt = document.createElement("td");
if (!memory) {
elt.textContent = "–";
} else {
let unit = "KB";
memory = Math.ceil(memory / 1024);
if (memory > 1024) {
memory = Math.ceil(memory / 1024 * 10) / 10;
unit = "MB";
if (memory > 1024) {
memory = Math.ceil(memory / 1024 * 100) / 100;
unit = "GB";
}
}
document.l10n.setAttributes(elt, "size-" + unit, {value: memory});
}
row.appendChild(elt);
if (tooltip)
document.l10n.setAttributes(row, "item", tooltip);
@ -1204,6 +1233,8 @@ var Control = {
// If the mouse has been moved recently, update the data displayed
// without moving any item to avoid the risk of users clicking an action
// button for the wrong item.
// Memory use is unlikely to change dramatically within a few seconds, so
// it's probably fine to not update the Memory column in this case.
if (Date.now() - this._lastMouseEvent < TIME_BEFORE_SORTING_AGAIN) {
let energyImpactPerId = new Map();
for (let {id, dispatchesSincePrevious,
@ -1240,11 +1271,12 @@ var Control = {
let counters = this._sortCounters(State.getCounters());
for (let {id, name, image, type, totalDispatches, dispatchesSincePrevious,
totalDuration, durationSincePrevious, children} of counters) {
memory, totalDuration, durationSincePrevious, children} of counters) {
let row =
View.appendRow(name,
this._computeEnergyImpact(dispatchesSincePrevious,
durationSincePrevious),
memory,
{totalDispatches, totalDuration: Math.ceil(totalDuration / 1000),
dispatchesSincePrevious,
durationSincePrevious: Math.ceil(durationSincePrevious / 1000)},
@ -1307,6 +1339,7 @@ var Control = {
View.appendRow(row.host,
this._computeEnergyImpact(row.dispatchesSincePrevious,
row.durationSincePrevious),
row.memory,
{totalDispatches: row.dispatchCount,
totalDuration: Math.ceil(row.duration / 1000),
dispatchesSincePrevious: row.dispatchesSincePrevious,

Просмотреть файл

@ -144,9 +144,15 @@
width: 8em;
}
#dispatch-table td:nth-child(3) {
width: 12em;
width: 9em;
}
#dispatch-table td:nth-child(4) {
width: 5em;
}
#dispatch-tbody td:nth-child(4) {
text-align: end;
}
#dispatch-table td:nth-child(5) {
width: 20px;
}
@ -333,6 +339,7 @@
<td data-l10n-id="column-name"/>
<td data-l10n-id="column-type"/>
<td data-l10n-id="column-energy-impact"/>
<td data-l10n-id="column-memory"/>
<td></td><!-- actions -->
</tr>
</thead>

Просмотреть файл

@ -9,6 +9,7 @@ about-performance-title = Task Manager
column-name = Name
column-type = Type
column-energy-impact = Energy Impact
column-memory = Memory
## Special values for the Name column
ghost-windows = Recently closed tabs
@ -34,6 +35,14 @@ energy-impact-high = High ({ $value })
energy-impact-medium = Medium ({ $value })
energy-impact-low = Low ({ $value })
## Values for the Memory column
##
## Variables:
## $value (Number) - How much memory is used
size-KB = { $value } KB
size-MB = { $value } MB
size-GB = { $value } GB
## Tooltips for the action buttons
close-tab =
.title = Close tab