forked from v8/v8
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.mjs
More file actions
136 lines (110 loc) · 2.64 KB
/
code.mjs
File metadata and controls
136 lines (110 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// 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 code() {
return this._entry?.logEntry;
}
get functionName() {
return this._entry.functionName;
}
static get propertyNames() {
return [
'type', 'reason', 'functionName', 'sourcePosition',
'functionSourcePosition', 'script', 'code'
];
}
}
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 isBuiltinKind() {
return this._kindName === 'Builtin';
}
get kindName() {
return this._kindName;
}
get entry() {
return this._entry;
}
get functionName() {
return this._entry.functionName ?? this._entry.getRawName();
}
get size() {
return this._entry.size;
}
get source() {
return this._entry?.getSourceCode() ?? '';
}
get code() {
return this._entry?.source?.disassemble;
}
get variants() {
const entries = Array.from(this.entry?.func?.codeEntries ?? []);
return entries.map(each => each.logEntry);
}
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', 'variants'
];
}
}
export class SharedLibLogEntry extends LogEntry {
constructor(entry) {
super('SHARED_LIB', 0);
this._entry = entry;
}
get name() {
return this._entry.name;
}
get entry() {
return this._entry;
}
toString() {
return `SharedLib`;
}
static get propertyNames() {
return ['name'];
}
}