2020-09-02 13:17:35 +00:00
|
|
|
// 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.
|
2020-11-03 08:01:33 +00:00
|
|
|
import {LogEntry} from './log.mjs';
|
2020-09-02 13:17:35 +00:00
|
|
|
|
2020-10-19 10:13:33 +00:00
|
|
|
export class IcLogEntry extends LogEntry {
|
2020-09-02 13:17:35 +00:00
|
|
|
constructor(
|
2020-11-03 08:01:33 +00:00
|
|
|
type, fn_file, time, line, column, key, oldState, newState, map, reason,
|
2021-06-15 11:19:00 +00:00
|
|
|
modifier, codeEntry) {
|
2020-09-02 13:17:35 +00:00
|
|
|
super(type, time);
|
|
|
|
this.category = 'other';
|
|
|
|
if (this.type.indexOf('Store') !== -1) {
|
|
|
|
this.category = 'Store';
|
|
|
|
} else if (this.type.indexOf('Load') !== -1) {
|
|
|
|
this.category = 'Load';
|
|
|
|
}
|
2020-12-03 17:48:45 +00:00
|
|
|
const parts = fn_file.split(' ');
|
2020-09-02 13:17:35 +00:00
|
|
|
this.functionName = parts[0];
|
|
|
|
this.file = parts[1];
|
|
|
|
this.oldState = oldState;
|
|
|
|
this.newState = newState;
|
|
|
|
this.key = key;
|
|
|
|
this.map = map;
|
|
|
|
this.reason = reason;
|
2020-10-26 18:02:54 +00:00
|
|
|
this.modifier = modifier;
|
2021-06-15 11:19:00 +00:00
|
|
|
this.codeEntry = codeEntry;
|
|
|
|
}
|
|
|
|
|
|
|
|
get state() {
|
|
|
|
return this.oldState + ' → ' + this.newState;
|
|
|
|
}
|
|
|
|
|
2021-06-15 21:27:47 +00:00
|
|
|
get code() {
|
2021-06-15 11:19:00 +00:00
|
|
|
return this.codeEntry?.logEntry;
|
2020-09-02 13:17:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
parseMapProperties(parts, offset) {
|
|
|
|
let next = parts[++offset];
|
|
|
|
if (!next.startsWith('dict')) return offset;
|
|
|
|
this.propertiesMode = next.substr(5) == '0' ? 'fast' : 'slow';
|
|
|
|
this.numberOfOwnProperties = parts[++offset].substr(4);
|
|
|
|
next = parts[++offset];
|
|
|
|
this.instanceType = next.substr(5, next.length - 6);
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
parsePositionAndFile(parts, start) {
|
|
|
|
// find the position of 'at' in the parts array.
|
|
|
|
let offset = start;
|
|
|
|
for (let i = start + 1; i < parts.length; i++) {
|
|
|
|
offset++;
|
|
|
|
if (parts[i] == 'at') break;
|
|
|
|
}
|
|
|
|
if (parts[offset] !== 'at') return -1;
|
|
|
|
this.position = parts.slice(start, offset).join(' ');
|
|
|
|
offset += 1;
|
|
|
|
this.isNative = parts[offset] == 'native'
|
|
|
|
offset += this.isNative ? 1 : 0;
|
|
|
|
this.file = parts[offset];
|
|
|
|
return offset;
|
|
|
|
}
|
2020-11-03 08:01:33 +00:00
|
|
|
|
2020-10-19 10:45:42 +00:00
|
|
|
static get propertyNames() {
|
|
|
|
return [
|
2021-06-15 21:27:47 +00:00
|
|
|
'type', 'category', 'functionName', 'script', 'sourcePosition', 'code',
|
|
|
|
'state', 'key', 'map', 'reason'
|
2020-10-19 10:45:42 +00:00
|
|
|
];
|
|
|
|
}
|
2020-10-19 10:13:33 +00:00
|
|
|
}
|