Commit 89d71aa9 authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by V8 LUCI CQ

[mips][loong64][wasm] Interpret table.grow result as 32 bit

Port commit a0ace8a8

On mips64 and loong64, sign-extend the 32-bit value.

Change-Id: I058e3fcba94c25ad36ab1d751dea6bfc0558471a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3189854Reviewed-by: 's avatarLiu yu <liuyu@loongson.cn>
Commit-Queue: Liu yu <liuyu@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/main@{#77110}
parent 0cdcf46f
......@@ -3660,7 +3660,7 @@ void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label) {
Branch(not_smi_label, ne, scratch, Operand(zero_reg));
}
void MacroAssembler::AssertNotSmi(Register object) {
void TurboAssembler::AssertNotSmi(Register object) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
UseScratchRegisterScope temps(this);
......@@ -3670,7 +3670,7 @@ void MacroAssembler::AssertNotSmi(Register object) {
}
}
void MacroAssembler::AssertSmi(Register object) {
void TurboAssembler::AssertSmi(Register object) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
UseScratchRegisterScope temps(this);
......
......@@ -420,6 +420,19 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void SmiUntag(Register reg) { SmiUntag(reg, reg); }
// On LoongArch64, we should sign-extend 32-bit values.
void SmiToInt32(Register smi) {
if (FLAG_enable_slow_asserts) {
AssertSmi(smi);
}
DCHECK(SmiValuesAre32Bits() || SmiValuesAre31Bits());
SmiUntag(smi);
}
// Abort execution if argument is a smi, enabled via --debug-code.
void AssertNotSmi(Register object);
void AssertSmi(Register object);
int CalculateStackPassedWords(int num_reg_arguments,
int num_double_arguments);
......@@ -996,10 +1009,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
// Jump if the register contains a non-smi.
void JumpIfNotSmi(Register value, Label* not_smi_label);
// Abort execution if argument is a smi, enabled via --debug-code.
void AssertNotSmi(Register object);
void AssertSmi(Register object);
// Abort execution if argument is not a Constructor, enabled via --debug-code.
void AssertConstructor(Register object);
......
......@@ -460,6 +460,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void SmiUntag(Register dst, Register src) { sra(dst, src, kSmiTagSize); }
void SmiToInt32(Register smi) { SmiUntag(smi); }
int CalculateStackPassedWords(int num_reg_arguments,
int num_double_arguments);
......
......@@ -5546,7 +5546,7 @@ void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label,
Branch(bd, not_smi_label, ne, scratch, Operand(zero_reg));
}
void MacroAssembler::AssertNotSmi(Register object) {
void TurboAssembler::AssertNotSmi(Register object) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
UseScratchRegisterScope temps(this);
......@@ -5556,7 +5556,7 @@ void MacroAssembler::AssertNotSmi(Register object) {
}
}
void MacroAssembler::AssertSmi(Register object) {
void TurboAssembler::AssertSmi(Register object) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
UseScratchRegisterScope temps(this);
......
......@@ -485,6 +485,19 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void SmiUntag(Register reg) { SmiUntag(reg, reg); }
// On MIPS64, we should sign-extend 32-bit values.
void SmiToInt32(Register smi) {
if (FLAG_enable_slow_asserts) {
AssertSmi(smi);
}
DCHECK(SmiValuesAre32Bits() || SmiValuesAre31Bits());
SmiUntag(smi);
}
// Abort execution if argument is a smi, enabled via --debug-code.
void AssertNotSmi(Register object);
void AssertSmi(Register object);
int CalculateStackPassedWords(int num_reg_arguments,
int num_double_arguments);
......@@ -1183,10 +1196,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
void JumpIfNotSmi(Register value, Label* not_smi_label,
BranchDelaySlot bd = PROTECT);
// Abort execution if argument is a smi, enabled via --debug-code.
void AssertNotSmi(Register object);
void AssertSmi(Register object);
// Abort execution if argument is not a Constructor, enabled via --debug-code.
void AssertConstructor(Register object);
......
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