Commit 19e05d6d authored by Junliang Yan's avatar Junliang Yan Committed by V8 LUCI CQ

ppc64: [baseline] port PrologueFillFrame and VerifyFrameSize

Change-Id: I23376b2ad0dc8616048f8c9c7122d5bf38fa70d8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3615013
Commit-Queue: Junliang Yan <junyan@redhat.com>
Reviewed-by: 's avatarMilad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#80269}
parent cf0d4647
......@@ -27,9 +27,71 @@ void BaselineCompiler::Prologue() {
PrologueFillFrame();
}
void BaselineCompiler::PrologueFillFrame() { UNIMPLEMENTED(); }
void BaselineCompiler::PrologueFillFrame() { PrologueFillFrame(); }
void BaselineCompiler::VerifyFrameSize() { UNIMPLEMENTED(); }
void BaselineCompiler::PrologueFillFrame() {
ASM_CODE_COMMENT(&masm_);
// Inlined register frame fill
interpreter::Register new_target_or_generator_register =
bytecode_->incoming_new_target_or_generator_register();
if (FLAG_debug_code) {
__ masm()->CompareRoot(kInterpreterAccumulatorRegister,
RootIndex::kUndefinedValue);
__ masm()->Assert(eq, AbortReason::kUnexpectedValue);
}
int register_count = bytecode_->register_count();
// Magic value
const int kLoopUnrollSize = 8;
const int new_target_index = new_target_or_generator_register.index();
const bool has_new_target = new_target_index != kMaxInt;
if (has_new_target) {
DCHECK_LE(new_target_index, register_count);
for (int i = 0; i < new_target_index; i++) {
__ Push(kInterpreterAccumulatorRegister);
}
// Push new_target_or_generator.
__ Push(kJavaScriptCallNewTargetRegister);
register_count -= new_target_index + 1;
}
if (register_count < 2 * kLoopUnrollSize) {
// If the frame is small enough, just unroll the frame fill completely.
for (int i = 0; i < register_count; ++i) {
__ Push(kInterpreterAccumulatorRegister);
}
} else {
// Extract the first few registers to round to the unroll size.
int first_registers = register_count % kLoopUnrollSize;
for (int i = 0; i < first_registers; ++i) {
__ Push(kInterpreterAccumulatorRegister);
}
BaselineAssembler::ScratchRegisterScope temps(&basm_);
Register scratch = temps.AcquireScratch();
__ Move(scratch, register_count / kLoopUnrollSize);
// We enter the loop unconditionally, so make sure we need to loop at least
// once.
DCHECK_GT(register_count / kLoopUnrollSize, 0);
Label loop;
__ Bind(&loop);
for (int i = 0; i < kLoopUnrollSize; ++i) {
__ Push(kInterpreterAccumulatorRegister);
}
__ masm()->SubS64(scratch, scratch, Operand(1));
__ masm()->b(gt, &loop);
}
}
void BaselineCompiler::VerifyFrameSize() {
BaselineAssembler::ScratchRegisterScope temps(&basm_);
Register scratch = temps.AcquireScratch();
__ masm()->AddS64(scratch, sp,
Operand(InterpreterFrameConstants::kFixedFrameSizeFromFp +
bytecode_->frame_size()));
__ masm()->CmpU64(scratch, fp);
__ masm()->Assert(eq, AbortReason::kUnexpectedStackPointer);
}
} // namespace baseline
} // namespace internal
......
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