[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: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45295}
This commit is contained in:
Camillo Bruni 2017-05-15 11:42:50 +02:00 committed by Commit Bot
parent 130d7dc34c
commit 5ce6090d1b
3 changed files with 13 additions and 4 deletions

View File

@ -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());
}
}
}
}

View File

@ -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

View File

@ -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_; }