[tools] Map search bar feature added, map id changed from int to string
Change-Id: Icc37fc091086a3239a1b080ca2829efcda97f328 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2245601 Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#68406}
This commit is contained in:
parent
79ed10cfb1
commit
af5f156d40
1
AUTHORS
1
AUTHORS
@ -216,3 +216,4 @@ Zhongping Wang <kewpie.w.zp@gmail.com>
|
||||
柳荣一 <admin@web-tinker.com>
|
||||
Yanbo Li <lybvinci@gmail.com>
|
||||
Gilang Mentari Hamidy <gilang@hamidy.net>
|
||||
Zeynep Cankara <zeynepcankara402@gmail.com>
|
@ -337,8 +337,15 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
details.style.display = display;
|
||||
}
|
||||
|
||||
function removeOptions(selectElement) {
|
||||
while(selectElement.options.length > 0) {
|
||||
selectElement.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
function initGroupKeySelect() {
|
||||
let select = document.getElementById("group-key");
|
||||
removeOptions(select);
|
||||
for (let i in properties) {
|
||||
let option = document.createElement("option");
|
||||
option.text = properties[i];
|
||||
|
@ -369,6 +369,10 @@ dd {
|
||||
z-index: 100;
|
||||
display: none;
|
||||
}
|
||||
#searchBarInput {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script src="./splaytree.js"></script>
|
||||
<script src="./codemap.js"></script>
|
||||
@ -503,8 +507,23 @@ define(Array.prototype, "histogram", function(mapFn) {
|
||||
return histogram;
|
||||
});
|
||||
|
||||
|
||||
// =========================================================================
|
||||
// EventHandlers
|
||||
function handleSearchBar(){
|
||||
let searchBar = $('searchBarInput');
|
||||
let searchBarInput = searchBar.value;
|
||||
let selectedMap = V8Map.get(searchBarInput);
|
||||
//removeAllChildren($('mapIdList'));
|
||||
if(selectedMap){
|
||||
let map = selectedMap;
|
||||
document.state.map = map;
|
||||
searchBar.className = "green";
|
||||
} else {
|
||||
searchBar.className = "red";
|
||||
}
|
||||
}
|
||||
|
||||
function handleBodyLoad() {
|
||||
let upload = $('fileReader');
|
||||
upload.onclick = (e) => $("file").click();
|
||||
@ -1253,6 +1272,15 @@ function transitionTypeToColor(type) {
|
||||
<section id="transitionView"></section>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2>Search Map by Address</h2>
|
||||
<section id="searchBar"></section>
|
||||
<input type="search" id="searchBarInput" placeholder="Search maps by address..">
|
||||
<button onclick="handleSearchBar()">Search</button>
|
||||
<ul id="mapIdList" title="Map Id List">
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Selected Map</h2>
|
||||
<section id="mapDetails"></section>
|
||||
</div>
|
||||
|
@ -43,17 +43,17 @@ class MapProcessor extends LogReader {
|
||||
processor: this.processFunctionMove
|
||||
},
|
||||
'map-create': {
|
||||
parsers: [parseInt, parseInt, parseString],
|
||||
parsers: [parseInt, parseString],
|
||||
processor: this.processMapCreate
|
||||
},
|
||||
'map': {
|
||||
parsers: [parseString, parseInt, parseInt, parseInt, parseInt, parseInt,
|
||||
parsers: [parseString, parseInt, parseString, parseString, parseInt, parseInt,
|
||||
parseString, parseString, parseString
|
||||
],
|
||||
processor: this.processMap
|
||||
},
|
||||
'map-details': {
|
||||
parsers: [parseInt, parseInt, parseString],
|
||||
parsers: [parseInt, parseString, parseString],
|
||||
processor: this.processMapDetails
|
||||
}
|
||||
};
|
||||
@ -183,17 +183,16 @@ class MapProcessor extends LogReader {
|
||||
this.getExistingMap(id, time).deprecate();
|
||||
}
|
||||
|
||||
processMapCreate(time, id, string) {
|
||||
processMapCreate(time, id) {
|
||||
// map-create events might override existing maps if the addresses get
|
||||
// rcycled. Hence we do not check for existing maps.
|
||||
// recycled. Hence we do not check for existing maps.
|
||||
let map = this.createMap(id, time);
|
||||
map.description = string;
|
||||
}
|
||||
|
||||
processMapDetails(time, id, string) {
|
||||
//TODO(cbruni): fix initial map logging.
|
||||
let map = this.getExistingMap(id, time);
|
||||
if (!map.description) map.description = string;
|
||||
map.description = string;
|
||||
}
|
||||
|
||||
createMap(id, time) {
|
||||
@ -203,8 +202,8 @@ class MapProcessor extends LogReader {
|
||||
}
|
||||
|
||||
getExistingMap(id, time) {
|
||||
if (id === 0) return undefined;
|
||||
let map = V8Map.get(id);
|
||||
if (id === "0x000000000000") return undefined;
|
||||
let map = V8Map.get(id, time);
|
||||
if (map === undefined) {
|
||||
console.error("No map details provided: id=" + id);
|
||||
// Manually patch in a map to continue running.
|
||||
@ -332,18 +331,34 @@ class V8Map {
|
||||
return parents;
|
||||
}
|
||||
|
||||
static get(id) {
|
||||
return this.cache.get(id);
|
||||
|
||||
static get(id, time = undefined) {
|
||||
let maps = this.cache.get(id);
|
||||
if(maps){
|
||||
for (let i = 0; i < maps.length; i++) {
|
||||
//TODO: Implement time based map search
|
||||
if(maps[i].time === time){
|
||||
return maps[i];
|
||||
}
|
||||
}
|
||||
// default return the latest
|
||||
return maps[maps.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
static set(id, map) {
|
||||
this.cache.set(id, map);
|
||||
if(this.cache.has(id)){
|
||||
this.cache.get(id).push(map);
|
||||
} else {
|
||||
this.cache.set(id, [map]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
V8Map.cache = new Map();
|
||||
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
class Edge {
|
||||
constructor(type, name, reason, time, from, to) {
|
||||
|
Loading…
Reference in New Issue
Block a user