Revert "[maglev] Remove kScratchRegister in maglev-ir"

This reverts commit 3cc300558e.

Reason for revert: Reverting because of TSAN failures https://logs.chromium.org/logs/v8/buildbucket/cr-buildbucket/8792427956695159937/+/u/Check/regress-1394663

Original change's description:
> [maglev] Remove kScratchRegister in maglev-ir
>
> The use of kScratchRegister in arm64 code is unsafe. Since a scratch
> scope could re-use the same register. Ideally, we should remove it
> altogether, but we still currently require it for the ParallelMover.
>
> Bug: v8:7700
> Change-Id: I46c93874632a3d505ef71a7bf790c31fb5fd46d6
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4147617
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
> Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
> Auto-Submit: Victor Gomes <victorgomes@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#85156}

Bug: v8:7700
Change-Id: Ib5a47c20932c28163fc2627c5b433ca64ab55730
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4148267
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Owners-Override: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85159}
This commit is contained in:
Deepti Gandluri 2023-01-09 17:45:17 +00:00 committed by V8 LUCI CQ
parent 0b327a7c61
commit 4baa96c84c
3 changed files with 4 additions and 19 deletions

View File

@ -551,14 +551,6 @@ inline void MaglevAssembler::MoveRepr(MachineRepresentation repr,
UNREACHABLE();
}
}
template <>
inline void MaglevAssembler::MoveRepr(MachineRepresentation repr,
MemOperand dst, MemOperand src) {
UseScratchRegisterScope temps(this);
Register scratch = temps.AcquireX();
MoveRepr(repr, scratch, src);
MoveRepr(repr, dst, scratch);
}
inline Condition ToCondition(AssertCondition cond) {
switch (cond) {

View File

@ -753,7 +753,8 @@ void GapMove::GenerateCode(MaglevAssembler* masm,
__ Move(ToDoubleRegister(target()), source_op);
} else {
DCHECK(target().IsAnyStackSlot());
__ MoveRepr(repr, masm->ToMemOperand(target()), source_op);
__ MoveRepr(repr, kScratchRegister, source_op);
__ MoveRepr(repr, masm->ToMemOperand(target()), kScratchRegister);
}
}
}
@ -1923,20 +1924,18 @@ void CallKnownJSFunction::SetValueLocationConstraints() {
UseAny(arg(i));
}
DefineAsFixed(this, kReturnRegister0);
set_temporaries_needed(1);
}
void CallKnownJSFunction::GenerateCode(MaglevAssembler* masm,
const ProcessingState& state) {
Register scratch = general_temporaries().PopFirst();
int actual_parameter_count = num_args() + 1;
if (actual_parameter_count < expected_parameter_count_) {
int number_of_undefineds =
expected_parameter_count_ - actual_parameter_count;
__ LoadRoot(scratch, RootIndex::kUndefinedValue);
__ LoadRoot(kScratchRegister, RootIndex::kUndefinedValue);
__ PushReverse(receiver(),
base::make_iterator_range(args_begin(), args_end()),
RepeatValue(scratch, number_of_undefineds));
RepeatValue(kScratchRegister, number_of_undefineds));
} else {
__ PushReverse(receiver(),
base::make_iterator_range(args_begin(), args_end()));

View File

@ -480,12 +480,6 @@ inline void MaglevAssembler::MoveRepr(MachineRepresentation repr, Dest dst,
UNREACHABLE();
}
}
template <>
inline void MaglevAssembler::MoveRepr(MachineRepresentation repr,
MemOperand dst, MemOperand src) {
MoveRepr(repr, kScratchRegister, src);
MoveRepr(repr, dst, kScratchRegister);
}
inline Condition ToCondition(AssertCondition cond) {
switch (cond) {