Commit dc384372 authored by bgeron's avatar bgeron Committed by Commit bot

[turbofan] Verify nodes without kNoThrow have only IfSuccess or IfException uses.

BUG=

Review-Url: https://codereview.chromium.org/2227763004
Cr-Commit-Position: refs/heads/master@{#38586}
parent cda8387c
......@@ -210,22 +210,22 @@ std::ostream& operator<<(std::ostream& os,
return os;
}
#define CACHED_OP_LIST(V) \
V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \
V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \
V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \
V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \
V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
V(LoopExit, Operator::kKontrol, 0, 0, 2, 0, 0, 1) \
V(LoopExitValue, Operator::kPure, 1, 0, 1, 1, 0, 0) \
V(LoopExitEffect, Operator::kNoThrow, 0, 1, 1, 0, 1, 0) \
V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0) \
V(FinishRegion, Operator::kKontrol, 1, 1, 0, 1, 1, 0) \
#define CACHED_OP_LIST(V) \
V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \
V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \
V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \
V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \
V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
V(OsrLoopEntry, Operator::kFoldable | Operator::kNoThrow, 0, 1, 1, 0, 1, 1) \
V(LoopExit, Operator::kKontrol, 0, 0, 2, 0, 0, 1) \
V(LoopExitValue, Operator::kPure, 1, 0, 1, 1, 0, 0) \
V(LoopExitEffect, Operator::kNoThrow, 0, 1, 1, 0, 1, 0) \
V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0) \
V(FinishRegion, Operator::kKontrol, 1, 1, 0, 1, 1, 0) \
V(Retain, Operator::kKontrol, 1, 1, 0, 0, 1, 0)
#define CACHED_RETURN_LIST(V) \
......@@ -619,10 +619,10 @@ const Operator* CommonOperatorBuilder::IfValue(int32_t index) {
const Operator* CommonOperatorBuilder::Start(int value_output_count) {
return new (zone()) Operator( // --
IrOpcode::kStart, Operator::kFoldable, // opcode
"Start", // name
0, 0, 0, value_output_count, 1, 1); // counts
return new (zone()) Operator( // --
IrOpcode::kStart, Operator::kFoldable | Operator::kNoThrow, // opcode
"Start", // name
0, 0, 0, value_output_count, 1, 1); // counts
}
......@@ -934,7 +934,8 @@ const Operator* CommonOperatorBuilder::TailCall(
public:
explicit TailCallOperator(const CallDescriptor* descriptor)
: Operator1<const CallDescriptor*>(
IrOpcode::kTailCall, descriptor->properties(), "TailCall",
IrOpcode::kTailCall,
descriptor->properties() | Operator::kNoThrow, "TailCall",
descriptor->InputCount() + descriptor->FrameStateCount(), 1, 1, 0,
0, 1, descriptor) {}
......
......@@ -149,6 +149,30 @@ void Verifier::Visitor::Check(Node* node) {
CheckOutput(control, node, control->op()->ControlOutputCount(),
"control");
}
// Verify that no-no-throw nodes only have IfSuccess/IfException control
// uses.
if (!node->op()->HasProperty(Operator::kNoThrow)) {
int count_success = 0, count_exception = 0;
for (Edge edge : node->use_edges()) {
if (!NodeProperties::IsControlEdge(edge)) {
continue;
}
Node* control_use = edge.from();
if (control_use->opcode() != IrOpcode::kIfSuccess &&
control_use->opcode() != IrOpcode::kIfException) {
V8_Fatal(__FILE__, __LINE__,
"#%d:%s should be followed by IfSuccess/IfException, but is "
"followed by #%d:%s",
node->id(), node->op()->mnemonic(), control_use->id(),
control_use->op()->mnemonic());
}
if (control_use->opcode() == IrOpcode::kIfSuccess) ++count_success;
if (control_use->opcode() == IrOpcode::kIfException) ++count_exception;
CHECK_LE(count_success, 1);
CHECK_LE(count_exception, 1);
}
}
}
switch (node->opcode()) {
......
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