Commit 5ce6090d authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[CSA] Improve CSA debuggability

- Add BasicBlock::Print method for easier inspection in gdb
- Print detailed error message in InstructionSelector::VisitControl instead
  of just a check failure

Change-Id: Ice9d70567114f014b244c1b4e41e450900030994
Reviewed-on: https://chromium-review.googlesource.com/504388
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45295}
parent 130d7dc3
......@@ -926,9 +926,14 @@ void InstructionSelector::VisitControl(BasicBlock* block) {
if (block->SuccessorCount() > 1) {
for (BasicBlock* const successor : block->successors()) {
for (Node* const node : *successor) {
// If this CHECK fails, you might have specified merged variables
// for a label with only one predecessor.
CHECK(!IrOpcode::IsPhiOpcode(node->opcode()));
if (IrOpcode::IsPhiOpcode(node->opcode())) {
std::ostringstream str;
str << "You might have specified merged variables for a label with "
<< "only one predecessor." << std::endl
<< "# Current Block: " << *successor << std::endl
<< "# Node: " << *node;
FATAL(str.str().c_str());
}
}
}
}
......
......@@ -4,8 +4,8 @@
#include "src/compiler/schedule.h"
#include "src/compiler/node.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/node.h"
#include "src/ostreams.h"
namespace v8 {
......@@ -96,6 +96,8 @@ BasicBlock* BasicBlock::GetCommonDominator(BasicBlock* b1, BasicBlock* b2) {
return b1;
}
void BasicBlock::Print() { OFStream(stdout) << this; }
std::ostream& operator<<(std::ostream& os, const BasicBlock& block) {
os << "B" << block.id();
#if DEBUG
......
......@@ -65,6 +65,8 @@ class V8_EXPORT_PRIVATE BasicBlock final
AssemblerDebugInfo debug_info() const { return debug_info_; }
#endif // DEBUG
void Print();
// Predecessors.
BasicBlockVector& predecessors() { return predecessors_; }
const BasicBlockVector& predecessors() const { return predecessors_; }
......
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