ppc64: Fix StaContextSlot when depth == 0

Change-Id: Iacc2af0825b8e38e78c70a34878b82b537011f51
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4013562
Commit-Queue: Junliang Yan <junyan@redhat.com>
Reviewed-by: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#84135}
This commit is contained in:
Junliang Yan 2022-11-08 11:26:33 -05:00 committed by V8 LUCI CQ
parent 58f7f33a8e
commit fb3475ede8

View File

@ -596,6 +596,7 @@ void BaselineAssembler::AddToInterruptBudgetAndJumpIfNotExceeded(
void BaselineAssembler::LdaContextSlot(Register context, uint32_t index,
uint32_t depth) {
ASM_CODE_COMMENT(masm_);
for (; depth > 0; --depth) {
LoadTaggedPointerField(context, context, Context::kPreviousOffset);
}
@ -605,8 +606,15 @@ void BaselineAssembler::LdaContextSlot(Register context, uint32_t index,
void BaselineAssembler::StaContextSlot(Register context, Register value,
uint32_t index, uint32_t depth) {
for (; depth > 0; --depth) {
LoadTaggedPointerField(context, context, Context::kPreviousOffset);
ASM_CODE_COMMENT(masm_);
if (depth > 0) {
for (; depth > 0; --depth) {
LoadTaggedPointerField(context, context, Context::kPreviousOffset);
}
if (COMPRESS_POINTERS_BOOL) {
// Decompress tagged pointer.
__ AddS64(context, context, kPtrComprCageBaseRegister);
}
}
StoreTaggedFieldWithWriteBarrier(context, Context::OffsetOfElementAt(index),
value);
@ -614,6 +622,7 @@ void BaselineAssembler::StaContextSlot(Register context, Register value,
void BaselineAssembler::LdaModuleVariable(Register context, int cell_index,
uint32_t depth) {
ASM_CODE_COMMENT(masm_);
for (; depth > 0; --depth) {
LoadTaggedPointerField(context, context, Context::kPreviousOffset);
}
@ -636,6 +645,7 @@ void BaselineAssembler::LdaModuleVariable(Register context, int cell_index,
void BaselineAssembler::StaModuleVariable(Register context, Register value,
int cell_index, uint32_t depth) {
ASM_CODE_COMMENT(masm_);
for (; depth > 0; --depth) {
LoadTaggedPointerField(context, context, Context::kPreviousOffset);
}
@ -650,6 +660,7 @@ void BaselineAssembler::StaModuleVariable(Register context, Register value,
}
void BaselineAssembler::AddSmi(Register lhs, Smi rhs) {
ASM_CODE_COMMENT(masm_);
if (rhs.value() == 0) return;
__ LoadSmiLiteral(r0, rhs);
if (SmiValuesAre31Bits()) {