Commit aa984947 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[ptr-compr] Fix 32-bit smis on non-ptr-compr builds

Bug: v8:10047, v8:10257
Change-Id: Ifcc65235726420fe753e26707d84061400d5d2b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2050384
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66415}
parent e00fdf2d
...@@ -1213,9 +1213,11 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { ...@@ -1213,9 +1213,11 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bind(&stack_check_interrupt); __ bind(&stack_check_interrupt);
// Modify the bytecode offset in the stack to be kFunctionEntryBytecodeOffset // Modify the bytecode offset in the stack to be kFunctionEntryBytecodeOffset
// for the call to the StackGuard. // for the call to the StackGuard.
__ Move(kScratchRegister,
Smi::FromInt(BytecodeArray::kHeaderSize - kHeapObjectTag +
kFunctionEntryBytecodeOffset));
__ movq(Operand(rbp, InterpreterFrameConstants::kBytecodeOffsetFromFp), __ movq(Operand(rbp, InterpreterFrameConstants::kBytecodeOffsetFromFp),
Immediate(Smi::FromInt(BytecodeArray::kHeaderSize - kHeapObjectTag + kScratchRegister);
kFunctionEntryBytecodeOffset)));
__ CallRuntime(Runtime::kStackGuard); __ CallRuntime(Runtime::kStackGuard);
// After the call, restore the bytecode array, bytecode offset and accumulator // After the call, restore the bytecode array, bytecode offset and accumulator
......
...@@ -1028,17 +1028,7 @@ void TurboAssembler::Set(Operand dst, intptr_t x) { ...@@ -1028,17 +1028,7 @@ void TurboAssembler::Set(Operand dst, intptr_t x) {
// Smi tagging, untagging and tag detection. // Smi tagging, untagging and tag detection.
Register TurboAssembler::GetSmiConstant(Smi source) { Register TurboAssembler::GetSmiConstant(Smi source) {
STATIC_ASSERT(kSmiTag == 0); Move(kScratchRegister, source);
int value = source.value();
if (value == 0) {
xorl(kScratchRegister, kScratchRegister);
return kScratchRegister;
}
if (SmiValuesAre32Bits()) {
Move(kScratchRegister, source);
} else {
movl(kScratchRegister, Immediate(source));
}
return kScratchRegister; return kScratchRegister;
} }
...@@ -1048,7 +1038,11 @@ void TurboAssembler::Move(Register dst, Smi source) { ...@@ -1048,7 +1038,11 @@ void TurboAssembler::Move(Register dst, Smi source) {
if (value == 0) { if (value == 0) {
xorl(dst, dst); xorl(dst, dst);
} else { } else {
Move(dst, source.ptr(), RelocInfo::NONE); if (COMPRESS_POINTERS_BOOL) {
movl(dst, Immediate(source));
} else {
Move(dst, source.ptr(), RelocInfo::NONE);
}
} }
} }
......
...@@ -375,11 +375,6 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -375,11 +375,6 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void Move(Register dst, Smi source); void Move(Register dst, Smi source);
void Move(Operand dst, Smi source) {
Register constant = GetSmiConstant(source);
movq(dst, constant);
}
void Move(Register dst, ExternalReference ext); void Move(Register dst, ExternalReference ext);
void Move(XMMRegister dst, uint32_t src); void Move(XMMRegister dst, uint32_t src);
......
...@@ -94,7 +94,7 @@ static void TestMoveSmi(MacroAssembler* masm, Label* exit, int id, Smi value) { ...@@ -94,7 +94,7 @@ static void TestMoveSmi(MacroAssembler* masm, Label* exit, int id, Smi value) {
__ movl(rax, Immediate(id)); __ movl(rax, Immediate(id));
__ Move(rcx, value); __ Move(rcx, value);
__ Set(rdx, static_cast<intptr_t>(value.ptr())); __ Set(rdx, static_cast<intptr_t>(value.ptr()));
__ cmpq(rcx, rdx); __ cmp_tagged(rcx, rdx);
__ j(not_equal, exit); __ j(not_equal, exit);
} }
......
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