[tools] Avoid 'void 0' in modules

Bug: v8:10644
Change-Id: I24229cbbf6a3ffea0fd4c3b96ef6eaf1e780b6e9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2565136
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71505}
This commit is contained in:
Camillo Bruni 2020-11-30 19:38:13 +01:00 committed by Commit Bot
parent bec9f6c0ef
commit d35aaf74e2
7 changed files with 18 additions and 19 deletions

View File

@ -40,7 +40,7 @@ function BYTES(bytes, total) {
unitIndex++;
}
let result = formatNumber(value).padStart(10) + ' ' + units[unitIndex];
if (total !== void 0 && total != 0) {
if (total !== undefined && total != 0) {
result += PERCENT(bytes, total).padStart(5);
}
return result;
@ -161,7 +161,7 @@ class CompilationUnit {
class Script extends CompilationUnit {
constructor(id) {
super();
if (id === void 0 || id <= 0) {
if (id === undefined || id <= 0) {
throw new Error(`Invalid id=${id} for script`);
}
this.file = '';
@ -214,7 +214,7 @@ class Script extends CompilationUnit {
addMissingFunktions(list) {
if (this.finalized) throw 'script is finalized!';
list.forEach(fn => {
if (this.funktions[fn.start] === void 0) {
if (this.funktions[fn.start] === undefined) {
this.addFunktion(fn);
}
});
@ -222,8 +222,8 @@ class Script extends CompilationUnit {
addFunktion(fn) {
if (this.finalized) throw 'script is finalized!';
if (fn.start === void 0) throw "Funktion has no start position";
if (this.funktions[fn.start] !== void 0) {
if (fn.start === undefined) throw "Funktion has no start position";
if (this.funktions[fn.start] !== undefined) {
fn.print();
throw "adding same function twice to script";
}
@ -441,7 +441,7 @@ class Script extends CompilationUnit {
for (let i = 1; i < metricProperties.length; i += kMetricIncrement) {
let timestampPropertyName = metricProperties[i];
let timestamp = funktionOrScript[timestampPropertyName];
if (timestamp === void 0) continue;
if (timestamp === undefined) continue;
if (timestamp < start || end < timestamp) continue;
timestamp -= start;
let index = Math.floor(timestamp / delta);
@ -906,7 +906,7 @@ export class ParseProcessor extends LogReader {
}
let script = this.lookupScript(scriptId);
let funktion = script.getFunktionAtStartPosition(startPosition);
if (funktion === void 0) {
if (funktion === undefined) {
funktion = new Funktion(functionName, startPosition, endPosition, script);
}
return funktion;

View File

@ -24,4 +24,4 @@ export function formatSeconds(millis) {
export function delay(time) {
return new Promise(resolver => setTimeout(resolver, time));
}
}

View File

@ -20,4 +20,4 @@ export class LogEntry {
static get allTypes() {
throw new Error('Not implemented.');
}
}
}

View File

@ -34,7 +34,7 @@ define(Array.prototype, 'last', function() {
// Map Log Events
class MapLogEntry extends LogEntry {
edge = void 0;
edge = undefined;
children = [];
depth = 0;
_isDeprecated = false;
@ -80,8 +80,7 @@ class MapLogEntry extends LogEntry {
}
parent() {
if (this.edge === void 0) return void 0;
return this.edge.from;
return this.edge?.from;
}
isDeprecated() {
@ -93,7 +92,7 @@ class MapLogEntry extends LogEntry {
}
isRoot() {
return this.edge === void 0 || this.edge.from === void 0;
return this.edge === undefined || this.edge.from === undefined;
}
contains(map) {
@ -136,11 +135,11 @@ class MapLogEntry extends LogEntry {
}
get type() {
return this.edge === void 0 ? 'new' : this.edge.type;
return this.edge === undefined ? 'new' : this.edge.type;
}
isBootstrapped() {
return this.edge === void 0;
return this.edge === undefined;
}
getParents() {

View File

@ -69,4 +69,4 @@ export class ToolTipEvent extends CustomEvent {
get positionOrTargetNode() {
return this._positionOrTargetNode;
}
}
}

View File

@ -87,7 +87,7 @@ DOM.defineCustomElement(
}
_addMapAndParentTransitions(map) {
if (map === void 0) return;
if (map === undefined) return;
if (this._displayedMapsInTree.has(map)) return;
this._displayedMapsInTree.add(map);
this.currentNode = this.transitionView;
@ -191,7 +191,7 @@ DOM.defineCustomElement(
// Add subtransitions except the one that's already shown.
let visibleTransitionMap = subtransitionNodes.length == 1 ?
transitionsNode.querySelector('.map').map :
void 0;
undefined;
map.children.forEach((edge) => {
if (edge.to != visibleTransitionMap) {
this.currentNode = transitionsNode;

View File

@ -249,4 +249,4 @@ class LineBuilder {
marker.onmouseover = this._mouseoverHandler;
return marker;
}
}
}