Commit a62e9dd6 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[turbofan] print input types when failing monotonicity check.

Temporary additional verbosity to investigate crashes.
This change has a small runtime overhead to remember the input types
of NumberAdd. It should be reverted once chromiun:906567 is resolved.

Bug: chromiun:906567
Change-Id: If86124d4dd96bc3c3266cd019119906a18b8558d
Reviewed-on: https://chromium-review.googlesource.com/c/1369946Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58146}
parent 302f187b
......@@ -298,6 +298,10 @@ bool Node::OwnedBy(Node const* owner1, Node const* owner2) const {
void Node::Print() const {
StdoutStream os;
Print(os);
}
void Node::Print(std::ostream& os) const {
os << *this << std::endl;
for (Node* input : this->inputs()) {
os << " " << *input << std::endl;
......
......@@ -160,6 +160,7 @@ class V8_EXPORT_PRIVATE Node final {
bool OwnedBy(Node const* owner1, Node const* owner2) const;
void Print() const;
void Print(std::ostream&) const;
private:
struct Use;
......
......@@ -59,7 +59,8 @@ class Typer::Visitor : public Reducer {
explicit Visitor(Typer* typer, LoopVariableOptimizer* induction_vars)
: typer_(typer),
induction_vars_(induction_vars),
weakened_nodes_(typer->zone()) {}
weakened_nodes_(typer->zone()),
remembered_types_(typer->zone()) {}
const char* reducer_name() const override { return "Typer"; }
......@@ -205,6 +206,8 @@ class Typer::Visitor : public Reducer {
Typer* typer_;
LoopVariableOptimizer* induction_vars_;
ZoneSet<NodeId> weakened_nodes_;
// TODO(tebbi): remove once chromium:906567 is resolved.
ZoneUnorderedMap<std::pair<Node*, int>, Type> remembered_types_;
#define DECLARE_METHOD(x) inline Type Type##x(Node* node);
DECLARE_METHOD(Start)
......@@ -330,11 +333,37 @@ class Typer::Visitor : public Reducer {
if (V8_UNLIKELY(!previous.Is(current))) {
std::ostringstream ostream;
node->Print(ostream);
previous.PrintTo(ostream);
ostream << " -> ";
current.PrintTo(ostream);
FATAL("UpdateType error for operator %s:\n%s\n",
IrOpcode::Mnemonic(node->opcode()), ostream.str().c_str());
ostream << "\n"
<< "inputs:\n";
for (int i = 0; i < 2; ++i) {
Node* input = NodeProperties::GetValueInput(node, i);
if (remembered_types_[{node, i}].IsInvalid()) {
ostream << "untyped";
} else {
remembered_types_[{node, i}].PrintTo(ostream);
}
ostream << " -> ";
if (NodeProperties::IsTyped(input)) {
NodeProperties::GetType(input).PrintTo(ostream);
} else {
ostream << "untyped";
}
ostream << "\n";
}
FATAL("UpdateType error for node %s", ostream.str().c_str());
}
if (V8_UNLIKELY(node->opcode() == IrOpcode::kNumberAdd)) {
for (int i = 0; i < 2; ++i) {
Node* input = NodeProperties::GetValueInput(node, i);
if (NodeProperties::IsTyped(input)) {
remembered_types_[{node, i}] = NodeProperties::GetType(input);
}
}
}
NodeProperties::SetType(node, current);
......@@ -344,6 +373,15 @@ class Typer::Visitor : public Reducer {
}
return NoChange();
} else {
if (V8_UNLIKELY(node->opcode() == IrOpcode::kNumberAdd)) {
for (int i = 0; i < 2; ++i) {
Node* input = NodeProperties::GetValueInput(node, i);
if (NodeProperties::IsTyped(input)) {
remembered_types_[{node, i}] = NodeProperties::GetType(input);
}
}
}
// No previous type, simply update the type.
NodeProperties::SetType(node, current);
return Changed(node);
......
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