[liftoff] Fix CacheState::Steal to move, not copy

CacheState::Steal didn't actually call the move assignment operator,
even though it should (and unlike what the comment says in its body).

The reason is the incompatible const-qualifier, such that the move
assignment operater wasn't selected during overload resolution.
Due to C++'s operator overloading, the compiler silently used the copy
assignment operator instead. That works, but is naturally slower.

This actually gave `Steal` the exact same behavior as `Split` until now,
which masked yet another bug, where we called `Steal` but should have
called `Split`.

This CL fixes both issues.

Bug: v8:13673
Change-Id: I940eb0fed383d78244f497bc6f7b67730038de42
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4215292
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Daniel Lehmann <dlehmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85611}
This commit is contained in:
Daniel Lehmann 2023-02-01 19:51:16 +00:00 committed by V8 LUCI CQ
parent ff1dba398d
commit e0790d35d1
3 changed files with 3 additions and 3 deletions

View File

@ -521,7 +521,7 @@ void LiftoffAssembler::CacheState::InitMerge(const CacheState& source,
kRegistersAllowed, kReuseRegisters, used_regs);
}
void LiftoffAssembler::CacheState::Steal(const CacheState& source) {
void LiftoffAssembler::CacheState::Steal(CacheState& source) {
// Just use the move assignment operator.
*this = std::move(source);
}

View File

@ -457,7 +457,7 @@ class LiftoffAssembler : public MacroAssembler {
void InitMerge(const CacheState& source, uint32_t num_locals,
uint32_t arity, uint32_t stack_depth);
void Steal(const CacheState& source);
void Steal(CacheState& source);
void Split(const CacheState& source);

View File

@ -1405,7 +1405,7 @@ class LiftoffCompiler {
}
__ bind(&block->try_info->catch_label);
__ cache_state()->Steal(block->try_info->catch_state);
__ cache_state()->Split(block->try_info->catch_state);
if (!block->try_info->in_handler) {
block->try_info->in_handler = true;
num_exceptions_++;