Commit bc857f9d authored by epertoso's avatar epertoso Committed by Commit bot

[csa] Fix the bound & used condition check for RawMachineLabel and CodeAssemblerLabel.

CodeAssemblerLabel's destructor was not calling RawMachineLabel's destructor, because label_ is zone-allocated. RawMachineLabel's destructor contains a DCHECK that would make debugging easier. If the DCHECK is not triggered, things will go awry in the register allocation phase, making it harder to debug the issue.

BUG=

Review-Url: https://codereview.chromium.org/2641863002
Cr-Commit-Position: refs/heads/master@{#42461}
parent 485fdde2
......@@ -719,6 +719,8 @@ CodeAssemblerLabel::CodeAssemblerLabel(CodeAssembler* assembler,
}
}
CodeAssemblerLabel::~CodeAssemblerLabel() { label_->~RawMachineLabel(); }
void CodeAssemblerLabel::MergeVariables() {
++merge_count_;
for (auto var : state_->variables_) {
......
......@@ -444,7 +444,7 @@ class CodeAssemblerLabel {
CodeAssembler* assembler, CodeAssemblerVariable* merged_variable,
CodeAssemblerLabel::Type type = CodeAssemblerLabel::kNonDeferred)
: CodeAssemblerLabel(assembler, 1, &merged_variable, type) {}
~CodeAssemblerLabel() {}
~CodeAssemblerLabel();
private:
friend class CodeAssembler;
......
......@@ -332,7 +332,11 @@ Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
return graph()->NewNodeUnchecked(op, input_count, inputs);
}
RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); }
RawMachineLabel::~RawMachineLabel() {
// If this DCHECK fails, it means that the label has been bound but it's not
// used, or the opposite. This would cause the register allocator to crash.
DCHECK_EQ(bound_, used_);
}
} // namespace compiler
} // namespace internal
......
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