91ace57f43
This is a reland of 1ec8f1da4f
Original change's description:
> [presubmit] Add JS formatting for tools/system-analyzer
>
> Bug: v8:10670
> Change-Id: Ifb653ada003719faff261b6e5b2169db37cffdaf
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2282522
> Reviewed-by: Tamer Tas <tmrts@chromium.org>
> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#68909}
Bug: v8:10670
Change-Id: I4903b3eb8ff39a76594324076f0840b06290044e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2307229
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70938}
66 lines
2.0 KiB
JavaScript
66 lines
2.0 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 {LogEntry} from './log.mjs';
|
|
|
|
export class IcLogEntry extends LogEntry {
|
|
constructor(
|
|
type, fn_file, time, line, column, key, oldState, newState, map, reason,
|
|
script, modifier, additional) {
|
|
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';
|
|
}
|
|
let parts = fn_file.split(' ');
|
|
this.functionName = parts[0];
|
|
this.file = parts[1];
|
|
let position = line + ':' + column;
|
|
this.filePosition = this.file + ':' + position;
|
|
this.oldState = oldState;
|
|
this.newState = newState;
|
|
this.state = this.oldState + ' → ' + this.newState;
|
|
this.key = key;
|
|
this.map = map;
|
|
this.reason = reason;
|
|
this.additional = additional;
|
|
this.script = script;
|
|
this.modifier = modifier;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
static get propertyNames() {
|
|
return [
|
|
'type', 'category', 'functionName', 'filePosition', 'state', 'key', 'map',
|
|
'reason', 'file'
|
|
];
|
|
}
|
|
}
|