Commit 433cd531 authored by cbruni's avatar cbruni Committed by Commit bot

[tools] Support more map information in --trace-ic and ic-explorer.html

BUG=

Review-Url: https://codereview.chromium.org/2451173002
Cr-Commit-Position: refs/heads/master@{#40611}
parent c4d770b1
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "src/ic/ic.h" #include "src/ic/ic.h"
#include <iostream>
#include "src/accessors.h" #include "src/accessors.h"
#include "src/api-arguments-inl.h" #include "src/api-arguments-inl.h"
#include "src/api.h" #include "src/api.h"
...@@ -99,45 +101,51 @@ void IC::TraceIC(const char* type, Handle<Object> name) { ...@@ -99,45 +101,51 @@ void IC::TraceIC(const char* type, Handle<Object> name) {
void IC::TraceIC(const char* type, Handle<Object> name, State old_state, void IC::TraceIC(const char* type, Handle<Object> name, State old_state,
State new_state) { State new_state) {
if (FLAG_trace_ic) { if (!FLAG_trace_ic) return;
PrintF("[%s%s in ", is_keyed() ? "Keyed" : "", type); PrintF("[%s%s in ", is_keyed() ? "Keyed" : "", type);
// TODO(jkummerow): Add support for "apply". The logic is roughly: // TODO(jkummerow): Add support for "apply". The logic is roughly:
// marker = [fp_ + kMarkerOffset]; // marker = [fp_ + kMarkerOffset];
// if marker is smi and marker.value == INTERNAL and // if marker is smi and marker.value == INTERNAL and
// the frame's code == builtin(Builtins::kFunctionApply): // the frame's code == builtin(Builtins::kFunctionApply):
// then print "apply from" and advance one frame // then print "apply from" and advance one frame
Object* maybe_function = Object* maybe_function =
Memory::Object_at(fp_ + JavaScriptFrameConstants::kFunctionOffset); Memory::Object_at(fp_ + JavaScriptFrameConstants::kFunctionOffset);
if (maybe_function->IsJSFunction()) { if (maybe_function->IsJSFunction()) {
JSFunction* function = JSFunction::cast(maybe_function); JSFunction* function = JSFunction::cast(maybe_function);
int code_offset = 0; int code_offset = 0;
if (function->code()->is_interpreter_trampoline_builtin()) { if (function->code()->is_interpreter_trampoline_builtin()) {
code_offset = InterpretedFrame::GetBytecodeOffset(fp()); code_offset = InterpretedFrame::GetBytecodeOffset(fp());
} else { } else {
code_offset = code_offset =
static_cast<int>(pc() - function->code()->instruction_start()); static_cast<int>(pc() - function->code()->instruction_start());
}
JavaScriptFrame::PrintFunctionAndOffset(
function, function->abstract_code(), code_offset, stdout, true);
}
const char* modifier = "";
if (kind() == Code::KEYED_STORE_IC) {
KeyedAccessStoreMode mode =
casted_nexus<KeyedStoreICNexus>()->GetKeyedAccessStoreMode();
modifier = GetTransitionMarkModifier(mode);
}
void* map = nullptr;
if (!receiver_map().is_null()) {
map = reinterpret_cast<void*>(*receiver_map());
} }
PrintF(" (%c->%c%s) map=%p ", TransitionMarkFromState(old_state), JavaScriptFrame::PrintFunctionAndOffset(function, function->abstract_code(),
TransitionMarkFromState(new_state), modifier, map); code_offset, stdout, true);
name->ShortPrint(stdout); }
PrintF("]\n");
} const char* modifier = "";
if (kind() == Code::KEYED_STORE_IC) {
KeyedAccessStoreMode mode =
casted_nexus<KeyedStoreICNexus>()->GetKeyedAccessStoreMode();
modifier = GetTransitionMarkModifier(mode);
}
Map* map = nullptr;
if (!receiver_map().is_null()) {
map = *receiver_map();
}
PrintF(" (%c->%c%s) map=(%p", TransitionMarkFromState(old_state),
TransitionMarkFromState(new_state), modifier,
reinterpret_cast<void*>(map));
if (map != nullptr) {
PrintF(" dict=%u own=%u type=", map->is_dictionary_map(),
map->NumberOfOwnDescriptors());
std::cout << map->instance_type();
}
PrintF(") ");
name->ShortPrint(stdout);
PrintF("]\n");
} }
......
...@@ -40,6 +40,11 @@ code is governed by a BSD-style license that can be found in the LICENSE file. ...@@ -40,6 +40,11 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
"use strict" "use strict"
var entries = []; var entries = [];
var properties = ['type', 'category', 'file', 'filePosition', 'state',
'key', 'isNative', 'map', 'propertiesMode', 'numberOfOwnProperties',
'instanceType'
]
class Entry { class Entry {
constructor(id, line) { constructor(id, line) {
this.id = id; this.id = id;
...@@ -50,8 +55,11 @@ code is governed by a BSD-style license that can be found in the LICENSE file. ...@@ -50,8 +55,11 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
if (parts[0][0] !== "[") return; if (parts[0][0] !== "[") return;
if (parts[1] === "patching") return; if (parts[1] === "patching") return;
this.type = parts[0].substr(1); this.type = parts[0].substr(1);
this.category = "Other"; this.category = "unknown";
this.map = undefined; this.map = "unknown";
this.propertiesMode = "unknown";
this.numberOfOwnProperties = 0;
this.instanceType = "unknown";
if (this.type.indexOf("Store") !== -1) { if (this.type.indexOf("Store") !== -1) {
this.category = "Store"; this.category = "Store";
} else if (this.type.indexOf("Load") !== -1) { } else if (this.type.indexOf("Load") !== -1) {
...@@ -70,13 +78,22 @@ code is governed by a BSD-style license that can be found in the LICENSE file. ...@@ -70,13 +78,22 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
var offset = this.parsePositionAndFile(parts, 2); var offset = this.parsePositionAndFile(parts, 2);
if (offset == -1) return if (offset == -1) return
this.state = parts[++offset]; this.state = parts[++offset];
this.map = parts[offset + 1]; var mapPart = parts[offset + 1];
if (this.map !== undefined && this.map.startsWith("map=")) { if (mapPart !== undefined && mapPart.startsWith("map=")) {
this.map = this.map.substring(4); if (mapPart[4] == "(") {
offset++; if (mapPart.endsWith(")")) {
} else { this.map = mapPart.substr(5, mapPart.length-6);
this.map = undefined; } else {
} this.map = mapPart.substr(5);
}
offset++;
offset = this.parseMapProperties(parts, offset);
} else {
this.map = mapPart.substr(4);
offset++;
}
if (this.map == "(nil)") this.map = "unknown";
}
if (this.type !== "CompareIC") { if (this.type !== "CompareIC") {
// if there is no address we have a smi key // if there is no address we have a smi key
var address = parts[++offset]; var address = parts[++offset];
...@@ -108,6 +125,17 @@ code is governed by a BSD-style license that can be found in the LICENSE file. ...@@ -108,6 +125,17 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
this.isValid = true; this.isValid = true;
} }
parseMapProperties(parts, offset) {
var 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) { parsePositionAndFile(parts, start) {
// find the position of 'at' in the parts array. // find the position of 'at' in the parts array.
var offset = start; var offset = start;
...@@ -157,11 +185,6 @@ code is governed by a BSD-style license that can be found in the LICENSE file. ...@@ -157,11 +185,6 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
} }
var properties = ['type', 'category', 'file', 'filePosition', 'state',
'key', 'isNative', 'map'
]
class Group { class Group {
constructor(property, key, entry) { constructor(property, key, entry) {
this.property = property; this.property = property;
...@@ -332,10 +355,14 @@ code is governed by a BSD-style license that can be found in the LICENSE file. ...@@ -332,10 +355,14 @@ code is governed by a BSD-style license that can be found in the LICENSE file.
select.add(option); select.add(option);
} }
} }
function handleOnLoad() {
document.querySelector("#uploadInput").focus();
}
</script> </script>
</head> </head>
<body> <body onload="handleOnLoad()">
<h1> <h1>
<span style="color: #00FF00">I</span> <span style="color: #00FF00">I</span>
<span style="color: #FF00FF">C</span> <span style="color: #FF00FF">C</span>
......
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