Commit 0c2ef444 authored by Zeynep Cankara's avatar Zeynep Cankara Committed by Commit Bot

[system-analyzer] Map-processor bug-fix and add ic-panel click map

This CL unifies both map-processor and ic-processor's map processing
pipeline to the same format. Also, adds the functionality to search
for map transitions on map panel by clicking on map property of the
ic-panel.

Bug: v8:10644

Change-Id: I9f95feebb08620fd489486cf459ebe0babbd32d6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2367865Reviewed-by: 's avatarSathya Gunasekaran  <gsathya@chromium.org>
Commit-Queue: Zeynep Cankara <zcankara@google.com>
Cr-Commit-Position: refs/heads/master@{#69567}
parent beeef0d8
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
import { Group } from './ic-model.mjs'; import { Group } from './ic-model.mjs';
import CustomIcProcessor from "./ic-processor.mjs"; import CustomIcProcessor from "./ic-processor.mjs";
import { FocusEvent, SelectTimeEvent } from './events.mjs'; import { MapLogEvent } from "./map-processor.mjs";
import { FocusEvent, SelectTimeEvent, SelectionEvent } from './events.mjs';
import { defineCustomElement, V8CustomElement } from './helper.mjs'; import { defineCustomElement, V8CustomElement } from './helper.mjs';
defineCustomElement('ic-panel', (templateText) => defineCustomElement('ic-panel', (templateText) =>
...@@ -104,7 +105,22 @@ defineCustomElement('ic-panel', (templateText) => ...@@ -104,7 +105,22 @@ defineCustomElement('ic-panel', (templateText) =>
} }
handleMapClick(e) { handleMapClick(e) {
this.dispatchEvent(new FocusEvent(e.target.parentNode.entry)); let entry = e.target.parentNode.entry;
let id = entry.key;
let selectedMapLofEvents =
this.searchIcLogEventToMapLogEvent(id, entry.entries);
this.dispatchEvent(new SelectionEvent(selectedMapLofEvents));
}
searchIcLogEventToMapLogEvent(id, icLogEvents) {
// searches for mapLogEvents using the id, time
let selectedMapLogEventsSet = new Set();
for (const icLogEvent of icLogEvents) {
let time = icLogEvent.time;
let selectedMap = MapLogEvent.get(id, time);
selectedMapLogEventsSet.add(selectedMap);
}
return Array.from(selectedMapLogEventsSet);
} }
handleFilePositionClick(e) { handleFilePositionClick(e) {
......
...@@ -28,7 +28,7 @@ class IcProcessor extends LogReader { ...@@ -28,7 +28,7 @@ class IcProcessor extends LogReader {
super(); super();
let propertyICParser = [ let propertyICParser = [
parseInt, parseInt, parseInt, parseInt, parseString, parseString, parseInt, parseInt, parseInt, parseInt, parseString, parseString,
parseInt, parseString, parseString, parseString parseString, parseString, parseString, parseString
]; ];
LogReader.call(this, { LogReader.call(this, {
'code-creation': { 'code-creation': {
...@@ -246,7 +246,7 @@ class IcLogEvent extends Event { ...@@ -246,7 +246,7 @@ class IcLogEvent extends Event {
this.newState = newState; this.newState = newState;
this.state = this.oldState + ' → ' + this.newState; this.state = this.oldState + ' → ' + this.newState;
this.key = key; this.key = key;
this.map = map.toString(16); this.map = map;
this.reason = reason; this.reason = reason;
this.additional = additional; this.additional = additional;
} }
......
...@@ -74,7 +74,7 @@ defineCustomElement('map-panel', (templateText) => ...@@ -74,7 +74,7 @@ defineCustomElement('map-panel', (templateText) =>
let searchBar = this.$('#searchBarInput'); let searchBar = this.$('#searchBarInput');
let searchBarInput = searchBar.value; let searchBarInput = searchBar.value;
//access the map from model cache //access the map from model cache
let selectedMap = MapLogEvent.get(searchBarInput); let selectedMap = MapLogEvent.get(parseInt(searchBarInput));
if (selectedMap) { if (selectedMap) {
searchBar.className = "success"; searchBar.className = "success";
} else { } else {
......
...@@ -376,14 +376,13 @@ class MapLogEvent extends Event { ...@@ -376,14 +376,13 @@ class MapLogEvent extends Event {
static get(id, time = undefined) { static get(id, time = undefined) {
let maps = this.cache.get(id); let maps = this.cache.get(id);
if (maps) { if (maps) {
for (let i = 0; i < maps.length; i++) { for (let i = 1; i < maps.length; i++) {
// TODO: Implement time based map search if (maps[i].time > time) {
if (maps[i].time === time) { return maps[i - 1];
return maps[i];
} }
} }
// default return the latest // default return the latest
return maps[maps.length - 1]; return (maps.length > 0) ? maps[maps.length - 1] : undefined;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment