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

[cleanup][x64] Fix times_pointer_size in x64 builtins

Bug: v8:8477, v8:8834
Change-Id: I5ff2df3988cde5f806cecc9e40259ba02f6265d2
Reviewed-on: https://chromium-review.googlesource.com/c/1473291Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59619}
parent c4366c8c
......@@ -115,7 +115,7 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
// -----------------------------------
__ jmp(&entry);
__ bind(&loop);
__ Push(Operand(rbx, rcx, times_pointer_size, 0));
__ Push(Operand(rbx, rcx, times_system_pointer_size, 0));
__ bind(&entry);
__ decq(rcx);
__ j(greater_equal, &loop, Label::kNear);
......@@ -286,7 +286,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
// -----------------------------------
__ jmp(&entry, Label::kNear);
__ bind(&loop);
__ Push(Operand(rbx, rcx, times_pointer_size, 0));
__ Push(Operand(rbx, rcx, times_system_pointer_size, 0));
__ bind(&entry);
__ decq(rcx);
__ j(greater_equal, &loop, Label::kNear);
......@@ -648,7 +648,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
__ Set(rcx, 0); // Set loop variable to 0.
__ jmp(&entry, Label::kNear);
__ bind(&loop);
__ movq(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0));
__ movq(kScratchRegister, Operand(rbx, rcx, times_system_pointer_size, 0));
__ Push(Operand(kScratchRegister, 0)); // dereference handle
__ addq(rcx, Immediate(1));
__ bind(&entry);
......@@ -1061,7 +1061,8 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
#undef JUMP_IF_EQUAL
// Otherwise, load the size of the current bytecode and advance the offset.
__ addl(bytecode_offset, Operand(bytecode_size_table, bytecode, times_4, 0));
__ addl(bytecode_offset,
Operand(bytecode_size_table, bytecode, times_int_size, 0));
}
// Generate code for entering a JS function with the interpreter.
......@@ -1185,7 +1186,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
BytecodeArray::kIncomingNewTargetOrGeneratorRegisterOffset));
__ testl(rax, rax);
__ j(zero, &no_incoming_new_target_or_generator_register, Label::kNear);
__ movq(Operand(rbp, rax, times_pointer_size, 0), rdx);
__ movq(Operand(rbp, rax, times_system_pointer_size, 0), rdx);
__ bind(&no_incoming_new_target_or_generator_register);
// Load accumulator with undefined.
......@@ -1200,9 +1201,9 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
ExternalReference::interpreter_dispatch_table_address(masm->isolate()));
__ movzxbq(r11, Operand(kInterpreterBytecodeArrayRegister,
kInterpreterBytecodeOffsetRegister, times_1, 0));
__ movq(
kJavaScriptCallCodeStartRegister,
Operand(kInterpreterDispatchTableRegister, r11, times_pointer_size, 0));
__ movq(kJavaScriptCallCodeStartRegister,
Operand(kInterpreterDispatchTableRegister, r11,
times_system_pointer_size, 0));
__ call(kJavaScriptCallCodeStartRegister);
masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset());
......@@ -1449,9 +1450,9 @@ static void Generate_InterpreterEnterBytecode(MacroAssembler* masm) {
// Dispatch to the target bytecode.
__ movzxbq(r11, Operand(kInterpreterBytecodeArrayRegister,
kInterpreterBytecodeOffsetRegister, times_1, 0));
__ movq(
kJavaScriptCallCodeStartRegister,
Operand(kInterpreterDispatchTableRegister, r11, times_pointer_size, 0));
__ movq(kJavaScriptCallCodeStartRegister,
Operand(kInterpreterDispatchTableRegister, r11,
times_system_pointer_size, 0));
__ jmp(kJavaScriptCallCodeStartRegister);
}
......@@ -1543,7 +1544,7 @@ void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
__ PopReturnAddressTo(rbx);
__ incq(rcx);
__ leaq(rsp, Operand(rsp, rcx, times_pointer_size, 0));
__ leaq(rsp, Operand(rsp, rcx, times_system_pointer_size, 0));
__ PushReturnAddressFrom(rbx);
__ ret(0);
......@@ -1659,7 +1660,8 @@ void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
}
__ bind(&no_this_arg);
__ PopReturnAddressTo(rcx);
__ leaq(rsp, Operand(rsp, rax, times_pointer_size, kSystemPointerSize));
__ leaq(rsp,
Operand(rsp, rax, times_system_pointer_size, kSystemPointerSize));
__ Push(rdx);
__ PushReturnAddressFrom(rcx);
}
......@@ -1775,7 +1777,8 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
__ movq(rbx, args.GetArgumentOperand(3)); // argumentsList
__ bind(&done);
__ PopReturnAddressTo(rcx);
__ leaq(rsp, Operand(rsp, rax, times_pointer_size, kSystemPointerSize));
__ leaq(rsp,
Operand(rsp, rax, times_system_pointer_size, kSystemPointerSize));
__ Push(rdx);
__ PushReturnAddressFrom(rcx);
}
......@@ -1827,7 +1830,8 @@ void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
__ movq(rdx, args.GetArgumentOperand(3)); // new.target
__ bind(&done);
__ PopReturnAddressTo(rcx);
__ leaq(rsp, Operand(rsp, rax, times_pointer_size, kSystemPointerSize));
__ leaq(rsp,
Operand(rsp, rax, times_system_pointer_size, kSystemPointerSize));
__ PushRoot(RootIndex::kUndefinedValue);
__ PushReturnAddressFrom(rcx);
}
......@@ -1941,7 +1945,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// Copy receiver and all expected arguments.
const int offset = StandardFrameConstants::kCallerSPOffset;
__ leaq(rax, Operand(rbp, rax, times_pointer_size, offset));
__ leaq(rax, Operand(rbp, rax, times_system_pointer_size, offset));
__ Set(r8, -1); // account for receiver
Label copy;
......@@ -1963,7 +1967,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// Copy receiver and all actual arguments.
const int offset = StandardFrameConstants::kCallerSPOffset;
__ leaq(rdi, Operand(rbp, rax, times_pointer_size, offset));
__ leaq(rdi, Operand(rbp, rax, times_system_pointer_size, offset));
__ Set(r8, -1); // account for receiver
Label copy;
......@@ -2336,7 +2340,7 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
// Reserve stack space for the [[BoundArguments]].
{
Label done;
__ leaq(kScratchRegister, Operand(rbx, times_pointer_size, 0));
__ leaq(kScratchRegister, Operand(rbx, times_system_pointer_size, 0));
__ subq(rsp, kScratchRegister);
// Check the stack for overflow. We are not trying to catch interruptions
// (i.e. debug break and preemption) here, so check the "real stack
......@@ -2344,7 +2348,7 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
__ CompareRoot(rsp, RootIndex::kRealStackLimit);
__ j(above_equal, &done, Label::kNear);
// Restore the stack pointer.
__ leaq(rsp, Operand(rsp, rbx, times_pointer_size, 0));
__ leaq(rsp, Operand(rsp, rbx, times_system_pointer_size, 0));
{
FrameScope scope(masm, StackFrame::MANUAL);
__ EnterFrame(StackFrame::INTERNAL);
......@@ -2360,10 +2364,12 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
{
Label loop;
__ Set(rcx, 0);
__ leaq(rbx, Operand(rsp, rbx, times_pointer_size, 0));
__ leaq(rbx, Operand(rsp, rbx, times_system_pointer_size, 0));
__ bind(&loop);
__ movq(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0));
__ movq(Operand(rsp, rcx, times_pointer_size, 0), kScratchRegister);
__ movq(kScratchRegister,
Operand(rbx, rcx, times_system_pointer_size, 0));
__ movq(Operand(rsp, rcx, times_system_pointer_size, 0),
kScratchRegister);
__ incl(rcx);
__ cmpl(rcx, rax);
__ j(less, &loop);
......@@ -2385,7 +2391,7 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
FieldOperand(rcx, rbx, times_tagged_size,
FixedArray::kHeaderSize - kTaggedSize),
decompr_scratch, decompr_scratch_for_debug);
__ movq(Operand(rsp, rax, times_pointer_size, 0), r12);
__ movq(Operand(rsp, rax, times_system_pointer_size, 0), r12);
__ leal(rax, Operand(rax, 1));
__ decl(rbx);
__ j(greater, &loop);
......@@ -3255,7 +3261,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) {
// FunctionCallbackInfo::values_ (points at the first varargs argument passed
// on the stack).
__ leaq(scratch, Operand(scratch, argc, times_pointer_size,
__ leaq(scratch, Operand(scratch, argc, times_system_pointer_size,
(FCA::kArgsLength - 1) * kSystemPointerSize));
__ movq(StackSpaceOperand(1), scratch);
......@@ -3265,7 +3271,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) {
// We also store the number of bytes to drop from the stack after returning
// from the API function here.
__ leaq(kScratchRegister,
Operand(argc, times_pointer_size,
Operand(argc, times_system_pointer_size,
(FCA::kArgsLength + 1 /* receiver */) * kSystemPointerSize));
__ movq(StackSpaceOperand(3), kScratchRegister);
......
......@@ -155,7 +155,7 @@ enum ScaleFactor : int8_t {
times_4 = 2,
times_8 = 3,
times_int_size = times_4,
times_pointer_size = (kSystemPointerSize == 8) ? times_8 : times_4,
times_system_pointer_size = (kSystemPointerSize == 8) ? times_8 : times_4,
times_tagged_size = (kTaggedSize == 8) ? times_8 : times_4,
};
......
......@@ -171,7 +171,7 @@ void Deoptimizer::GenerateDeoptimizationEntries(MacroAssembler* masm,
// last FrameDescription**.
__ movl(rdx, Operand(rax, Deoptimizer::output_count_offset()));
__ movq(rax, Operand(rax, Deoptimizer::output_offset()));
__ leaq(rdx, Operand(rax, rdx, times_pointer_size, 0));
__ leaq(rdx, Operand(rax, rdx, times_system_pointer_size, 0));
__ jmp(&outer_loop_header);
__ bind(&outer_push_loop);
// Inner loop state: rbx = current FrameDescription*, rcx = loop index.
......
......@@ -50,9 +50,9 @@ Operand StackArgumentsAccessor::GetArgumentOperand(int index) {
kSystemPointerSize);
} else {
// argument[0] is at base_reg_ + displacement_to_last_argument +
// argument_count_reg_ * times_pointer_size + (receiver - 1) *
// argument_count_reg_ * times_system_pointer_size + (receiver - 1) *
// kSystemPointerSize.
return Operand(base_reg_, argument_count_reg_, times_pointer_size,
return Operand(base_reg_, argument_count_reg_, times_system_pointer_size,
displacement_to_last_argument +
(receiver - 1 - index) * kSystemPointerSize);
}
......@@ -1664,8 +1664,9 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
// table.
bind(&if_code_is_builtin);
movl(destination, FieldOperand(code_object, Code::kBuiltinIndexOffset));
movq(destination, Operand(kRootRegister, destination, times_pointer_size,
IsolateData::builtin_entry_table_offset()));
movq(destination,
Operand(kRootRegister, destination, times_system_pointer_size,
IsolateData::builtin_entry_table_offset()));
bind(&out);
} else {
......@@ -2216,11 +2217,12 @@ void TurboAssembler::PrepareForTailCall(const ParameterCount& callee_args_count,
Register new_sp_reg = scratch0;
if (callee_args_count.is_reg()) {
subq(caller_args_count_reg, callee_args_count.reg());
leaq(new_sp_reg, Operand(rbp, caller_args_count_reg, times_pointer_size,
StandardFrameConstants::kCallerPCOffset));
leaq(new_sp_reg,
Operand(rbp, caller_args_count_reg, times_system_pointer_size,
StandardFrameConstants::kCallerPCOffset));
} else {
leaq(new_sp_reg,
Operand(rbp, caller_args_count_reg, times_pointer_size,
Operand(rbp, caller_args_count_reg, times_system_pointer_size,
StandardFrameConstants::kCallerPCOffset -
callee_args_count.immediate() * kSystemPointerSize));
}
......@@ -2256,8 +2258,8 @@ void TurboAssembler::PrepareForTailCall(const ParameterCount& callee_args_count,
jmp(&entry, Label::kNear);
bind(&loop);
decq(count_reg);
movq(tmp_reg, Operand(rsp, count_reg, times_pointer_size, 0));
movq(Operand(new_sp_reg, count_reg, times_pointer_size, 0), tmp_reg);
movq(tmp_reg, Operand(rsp, count_reg, times_system_pointer_size, 0));
movq(Operand(new_sp_reg, count_reg, times_system_pointer_size, 0), tmp_reg);
bind(&entry);
cmpq(count_reg, Immediate(0));
j(not_equal, &loop, Label::kNear);
......@@ -2541,7 +2543,7 @@ void MacroAssembler::EnterExitFrame(int arg_stack_space, bool save_doubles,
// Set up argv in callee-saved register r15. It is reused in LeaveExitFrame,
// so it must be retained across the C-call.
int offset = StandardFrameConstants::kCallerSPOffset - kSystemPointerSize;
leaq(r15, Operand(rbp, r14, times_pointer_size, offset));
leaq(r15, Operand(rbp, r14, times_system_pointer_size, offset));
EnterExitFrameEpilogue(arg_stack_space, save_doubles);
}
......
......@@ -921,7 +921,8 @@ inline Operand ContextOperand(Register context, int index) {
inline Operand ContextOperand(Register context, Register index) {
return Operand(context, index, times_pointer_size, Context::SlotOffset(0));
return Operand(context, index, times_system_pointer_size,
Context::SlotOffset(0));
}
......
......@@ -528,7 +528,8 @@ TEST(OperandOffset) {
__ j(not_equal, &exit);
__ incq(rax);
Operand sp2c2 = Operand(rsp, rcx, times_pointer_size, 2 * kSystemPointerSize);
Operand sp2c2 =
Operand(rsp, rcx, times_system_pointer_size, 2 * kSystemPointerSize);
// Test 6.
__ movl(rdx, sp2c2); // Sanity check.
......@@ -582,7 +583,7 @@ TEST(OperandOffset) {
__ incq(rax);
Operand bp2c4 =
Operand(rbp, rcx, times_pointer_size, -4 * kSystemPointerSize);
Operand(rbp, rcx, times_system_pointer_size, -4 * kSystemPointerSize);
// Test 14:
__ movl(rdx, bp2c4); // Sanity check.
......@@ -638,7 +639,7 @@ TEST(OperandOffset) {
__ incq(rax);
Operand bx2c2 =
Operand(rbx, rcx, times_pointer_size, -2 * kSystemPointerSize);
Operand(rbx, rcx, times_system_pointer_size, -2 * kSystemPointerSize);
// Test 23.
__ movl(rdx, bx2c2); // Sanity check.
......
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