summaryrefslogtreecommitdiff
path: root/deps/v8/tools/system-analyzer/log/code.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/tools/system-analyzer/log/code.mjs')
-rw-r--r--deps/v8/tools/system-analyzer/log/code.mjs62
1 files changed, 45 insertions, 17 deletions
diff --git a/deps/v8/tools/system-analyzer/log/code.mjs b/deps/v8/tools/system-analyzer/log/code.mjs
index 4e8ca40f5e..06051a2e52 100644
--- a/deps/v8/tools/system-analyzer/log/code.mjs
+++ b/deps/v8/tools/system-analyzer/log/code.mjs
@@ -2,9 +2,25 @@
// 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';
+class CodeString {
+ constructor(string) {
+ if (typeof string !== 'string') {
+ throw new Error('Expected string');
+ }
+ this.string = string;
+ }
+
+ get isCode() {
+ return true;
+ }
+
+ toString() {
+ return this.string;
+ }
+}
+
export class DeoptLogEntry extends LogEntry {
constructor(
type, time, entry, deoptReason, deoptLocation, scriptOffset,
@@ -48,14 +64,33 @@ export class DeoptLogEntry extends LogEntry {
}
}
-export class CodeLogEntry extends LogEntry {
- constructor(type, time, kindName, kind, entry) {
+class CodeLikeLogEntry extends LogEntry {
+ constructor(type, time, profilerEntry) {
super(type, time);
+ this._entry = profilerEntry;
+ profilerEntry.logEntry = this;
+ this._relatedEntries = [];
+ }
+
+ get entry() {
+ return this._entry;
+ }
+
+ add(entry) {
+ this._relatedEntries.push(entry);
+ }
+
+ relatedEntries() {
+ return this._relatedEntries;
+ }
+}
+
+export class CodeLogEntry extends CodeLikeLogEntry {
+ constructor(type, time, kindName, kind, profilerEntry) {
+ super(type, time, profilerEntry);
this._kind = kind;
this._kindName = kindName;
- this._entry = entry;
this._feedbackVector = undefined;
- entry.logEntry = this;
}
get kind() {
@@ -74,10 +109,6 @@ export class CodeLogEntry extends LogEntry {
return this._kindName;
}
- get entry() {
- return this._entry;
- }
-
get functionName() {
return this._entry.functionName ?? this._entry.getRawName();
}
@@ -117,6 +148,8 @@ export class CodeLogEntry extends LogEntry {
get toolTipDict() {
const dict = super.toolTipDict;
dict.size = formatBytes(dict.size);
+ dict.source = new CodeString(dict.source);
+ dict.code = new CodeString(dict.code);
return dict;
}
@@ -182,20 +215,15 @@ export class FeedbackVectorEntry extends LogEntry {
}
}
-export class SharedLibLogEntry extends LogEntry {
- constructor(entry) {
- super('SHARED_LIB', 0);
- this._entry = entry;
+export class SharedLibLogEntry extends CodeLikeLogEntry {
+ constructor(profilerEntry) {
+ super('SHARED_LIB', 0, profilerEntry);
}
get name() {
return this._entry.name;
}
- get entry() {
- return this._entry;
- }
-
toString() {
return `SharedLib`;
}