Commit 483e6297 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[turbofan] Add TurboAssembler::MovePair helper on x64

This helper can lower a parallel move a,b <- c,d for registers where
the sets {a,b} and {c,d} overlap.

Change-Id: I3c6ab20c075847d43628c5fd77851a3e614849c5
Bug: v8:8834
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1528533
Auto-Submit: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60304}
parent c8785d15
......@@ -419,21 +419,7 @@ void TurboAssembler::CallRecordWriteStub(
// Prepare argument registers for calling RecordWrite
// slot_parameter <= address
// object_parameter <= object
if (slot_parameter != object) {
// Normal case
Move(slot_parameter, address);
Move(object_parameter, object);
} else if (object_parameter != address) {
// Only slot_parameter and object are the same register
// object_parameter <= object
// slot_parameter <= address
Move(object_parameter, object);
Move(slot_parameter, address);
} else {
// slot_parameter \/ address
// object_parameter /\ object
xchgq(slot_parameter, object_parameter);
}
MovePair(slot_parameter, address, object_parameter, object);
Smi smi_rsa = Smi::FromEnum(remembered_set_action);
Smi smi_fm = Smi::FromEnum(fp_mode);
......@@ -1297,6 +1283,25 @@ void TurboAssembler::Move(Register dst, Register src) {
}
}
void TurboAssembler::MovePair(Register dst0, Register src0, Register dst1,
Register src1) {
if (dst0 != src1) {
// Normal case: Writing to dst0 does not destroy src1.
Move(dst0, src0);
Move(dst1, src1);
} else if (dst1 != src0) {
// Only dst0 and src1 are the same register,
// but writing to dst1 does not destroy src0.
Move(dst1, src1);
Move(dst0, src0);
} else {
// dst0 == src1, and dst1 == src0, a swap is required:
// dst0 \/ src0
// dst1 /\ src1
xchgq(dst0, dst1);
}
}
void TurboAssembler::MoveNumber(Register dst, double value) {
int32_t smi;
if (DoubleToSmiInteger(value, &smi)) {
......
......@@ -319,6 +319,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
movq(dst, Immediate64(ptr, rmode));
}
// Move src0 to dst0 and src1 to dst1, handling possible overlaps.
void MovePair(Register dst0, Register src0, Register dst1, Register src1);
void MoveStringConstant(Register result, const StringConstantBase* string,
RelocInfo::Mode rmode = RelocInfo::EMBEDDED_OBJECT);
......
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