Commit 5807fdfa authored by Junliang Yan's avatar Junliang Yan Committed by V8 LUCI CQ

ppc64: [baseline] setup ScratchRegisterScope

Change-Id: I4a1e9ebc1a8c2efd1cdc46079519bd62fd90dc8e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3507200Reviewed-by: 's avatarMilad Farazmand <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/main@{#79390}
parent 426233a1
......@@ -30,24 +30,21 @@ class BaselineAssembler::ScratchRegisterScope {
explicit ScratchRegisterScope(BaselineAssembler* assembler)
: assembler_(assembler),
prev_scope_(assembler->scratch_register_scope_),
wrapped_scope_(assembler->masm()) {
if (!assembler_->scratch_register_scope_) {
// If we haven't opened a scratch scope yet, for the first one add a
// couple of extra registers.
DCHECK(wrapped_scope_.CanAcquire());
wrapped_scope_.Include(r8, r9);
wrapped_scope_.Include(kInterpreterBytecodeOffsetRegister);
}
registers_used_(prev_scope_ == nullptr ? 0
: prev_scope_->registers_used_) {
assembler_->scratch_register_scope_ = this;
}
~ScratchRegisterScope() { assembler_->scratch_register_scope_ = prev_scope_; }
Register AcquireScratch() { return wrapped_scope_.Acquire(); }
Register AcquireScratch() {
DCHECK_LT(registers_used_, detail::kNumScratchRegisters);
return detail::kScratchRegisters[registers_used_++];
}
private:
BaselineAssembler* assembler_;
ScratchRegisterScope* prev_scope_;
UseScratchRegisterScope wrapped_scope_;
int registers_used_;
};
// TODO(v8:11429,leszeks): Unify condition names in the MacroAssembler.
......
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