v8/tools/system-analyzer/log/code.mjs
Leszek Swirski 423f38ab01 [system-analyzer] Process shared-library events
Add a new LogEntry for sharedlib PCs

Change-Id: I4f7fdca93a9905e41b73347df475dffcb84bcb89
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2959620
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75125}
2021-06-14 10:43:27 +00:00

120 lines
2.3 KiB
JavaScript

// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {formatBytes} from '../helper.mjs';
import {LogEntry} from './log.mjs';
export class DeoptLogEntry extends LogEntry {
constructor(
type, time, entry, deoptReason, deoptLocation, scriptOffset,
instructionStart, codeSize, inliningId) {
super(type, time);
this._entry = entry;
this._reason = deoptReason;
this._location = deoptLocation;
this._scriptOffset = scriptOffset;
this._instructionStart = instructionStart;
this._codeSize = codeSize;
this._inliningId = inliningId;
this.fileSourcePosition = undefined;
}
get reason() {
return this._reason;
}
get location() {
return this._location;
}
get entry() {
return this._entry;
}
get functionName() {
return this._entry.functionName;
}
static get propertyNames() {
return [
'type', 'reason', 'functionName', 'sourcePosition',
'functionSourcePosition', 'script'
];
}
}
export class CodeLogEntry extends LogEntry {
constructor(type, time, kindName, kind, entry) {
super(type, time);
this._kind = kind;
this._kindName = kindName;
this._entry = entry;
entry.logEntry = this;
}
get kind() {
return this._kind;
}
get kindName() {
return this._kindName;
}
get entry() {
return this._entry;
}
get functionName() {
return this._entry.functionName;
}
get size() {
return this._entry.size;
}
get source() {
return this._entry?.getSourceCode() ?? '';
}
get code() {
return this._entry?.source?.disassemble;
}
toString() {
return `Code(${this.type})`;
}
get toolTipDict() {
const dict = super.toolTipDict;
dict.size = formatBytes(dict.size);
return dict;
}
static get propertyNames() {
return [
'functionName', 'sourcePosition', 'kindName', 'size', 'type', 'kind',
'script', 'source', 'code'
];
}
}
export class SharedLibLogEntry extends LogEntry {
constructor(name) {
super('SHARED_LIB', 0);
this._name = name;
}
get name() {
return this._name;
}
toString() {
return `SharedLib`;
}
static get propertyNames() {
return ['name'];
}
}