Commit c430bd1c authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[compiler] Avoid creating redundant register moves

They will later be detected as redundant again, but we can save memory
and performance by just not adding them in the first place.

R=mvstanton@chromium.org

Bug: v8:8423
Change-Id: I11d88642333681612e2f8f4eaee7ba700cbf64d5
Reviewed-on: https://chromium-review.googlesource.com/c/1390132Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58479}
parent 4e9682bd
......@@ -705,9 +705,7 @@ class V8_EXPORT_PRIVATE ParallelMove final
: public NON_EXPORTED_BASE(ZoneVector<MoveOperands*>),
public NON_EXPORTED_BASE(ZoneObject) {
public:
explicit ParallelMove(Zone* zone) : ZoneVector<MoveOperands*>(zone) {
reserve(4);
}
explicit ParallelMove(Zone* zone) : ZoneVector<MoveOperands*>(zone) {}
MoveOperands* AddMove(const InstructionOperand& from,
const InstructionOperand& to) {
......@@ -718,7 +716,9 @@ class V8_EXPORT_PRIVATE ParallelMove final
MoveOperands* AddMove(const InstructionOperand& from,
const InstructionOperand& to,
Zone* operand_allocation_zone) {
if (from.EqualsCanonicalized(to)) return nullptr;
MoveOperands* move = new (operand_allocation_zone) MoveOperands(from, to);
if (empty()) reserve(4);
push_back(move);
return move;
}
......
......@@ -1795,6 +1795,7 @@ void ConstraintBuilder::MeetConstraintsBefore(int instr_index) {
UnallocatedOperand(*cur_input, second_output->virtual_register());
MoveOperands* gap_move = data()->AddGapMove(instr_index, Instruction::END,
input_copy, *cur_input);
DCHECK_NOT_NULL(gap_move);
if (code()->IsReference(input_vreg) && !code()->IsReference(output_vreg)) {
if (second->HasReferenceMap()) {
RegisterAllocationData::DelayedReference delayed_reference = {
......
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