Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: src/compiler/instruction.cc

Issue 1760323002: [turbofan] SSA Validation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: just ssa validation, after other fixed made it in Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction.cc
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc
index 05c6215c74c569d40aef8867c0f9010dc25ca85c..5eb0d88bb2bf5064e70c0eba7a236f60ee7a4e5d 100644
--- a/src/compiler/instruction.cc
+++ b/src/compiler/instruction.cc
@@ -620,7 +620,7 @@ InstructionBlocks* InstructionSequence::InstructionBlocksFor(
return blocks;
}
-void InstructionSequence::Validate() {
+void InstructionSequence::ValidateEdgeSplitForm() {
// Validate blocks are in edge-split form: no block with multiple successors
// has an edge to a block (== a successor) with more than one predecessors.
for (const InstructionBlock* block : instruction_blocks()) {
@@ -635,6 +635,21 @@ void InstructionSequence::Validate() {
}
}
+void InstructionSequence::ValidateSSA() {
+ // TODO(mtrofin): We could use a local zone here instead.
+ BitVector definitions(VirtualRegisterCount(), zone());
+ for (const Instruction* instruction : *this) {
+ for (size_t i = 0; i < instruction->OutputCount(); ++i) {
+ const InstructionOperand* output = instruction->OutputAt(i);
+ int vreg = (output->IsConstant())
+ ? ConstantOperand::cast(output)->virtual_register()
+ : UnallocatedOperand::cast(output)->virtual_register();
+ CHECK(!definitions.Contains(vreg));
+ definitions.Add(vreg);
+ }
+ }
+}
+
void InstructionSequence::ComputeAssemblyOrder(InstructionBlocks* blocks) {
int ao = 0;
for (InstructionBlock* const block : *blocks) {
@@ -669,7 +684,7 @@ InstructionSequence::InstructionSequence(Isolate* isolate,
block_starts_.reserve(instruction_blocks_->size());
#if DEBUG
- Validate();
+ ValidateEdgeSplitForm();
#endif
}
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698