Commit c17053c2 authored by jgruber's avatar jgruber Committed by Commit Bot

[ia32] Change CEntry calling convention to free kRootRegister

And other related cleanups (additional asserts, use named register
constants instead of the raw register name where appropriate).

Drive-by: Unset kOffHeapTrampolineRegister (it's unused on ia32).

Bug: v8:6666
Change-Id: Id2b94e0b9dbfa5d3bbacc80ec7424d38c4145658
Reviewed-on: https://chromium-review.googlesource.com/1185011
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55328}
parent d16bce9d
......@@ -2440,7 +2440,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
SaveFPRegsMode save_doubles, ArgvMode argv_mode,
bool builtin_exit_frame) {
// eax: number of arguments including receiver
// ebx: pointer to C function (C callee-saved)
// edx: pointer to C function
// ebp: frame pointer (restored after C call)
// esp: stack pointer (restored after C call)
// esi: current context (C callee-saved)
......@@ -2449,6 +2449,16 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
// If argv_mode == kArgvInRegister:
// ecx: pointer to the first argument
STATIC_ASSERT(eax == kRuntimeCallArgCountRegister);
STATIC_ASSERT(ecx == kRuntimeCallArgvRegister);
STATIC_ASSERT(edx == kRuntimeCallFunctionRegister);
STATIC_ASSERT(esi == kContextRegister);
STATIC_ASSERT(edi == kJSFunctionRegister);
DCHECK(!AreAliased(kRuntimeCallArgCountRegister, kRuntimeCallArgvRegister,
kRuntimeCallFunctionRegister, kContextRegister,
kJSFunctionRegister, kRootRegister));
ProfileEntryHookStub::MaybeCallEntryHook(masm);
// Reserve space on the stack for the three arguments passed to the call. If
......@@ -2472,7 +2482,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
builtin_exit_frame ? StackFrame::BUILTIN_EXIT : StackFrame::EXIT);
}
// ebx: pointer to C function (C callee-saved)
// edx: pointer to C function
// ebp: frame pointer (restored after C call)
// esp: stack pointer (restored after C call)
// edi: number of arguments including receiver (C callee-saved)
......@@ -2489,7 +2499,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
__ mov(Operand(esp, 1 * kPointerSize), esi); // argv.
__ mov(Operand(esp, 2 * kPointerSize),
Immediate(ExternalReference::isolate_address(masm->isolate())));
__ call(ebx);
__ call(kRuntimeCallFunctionRegister);
// Result is in eax or edx:eax - do not destroy these registers!
......
......@@ -839,8 +839,8 @@ void MacroAssembler::CallRuntime(const Runtime::Function* f,
// arguments passed in because it is constant. At some point we
// should remove this need and make the runtime routine entry code
// smarter.
Move(eax, Immediate(num_arguments));
mov(ebx, Immediate(ExternalReference::Create(f)));
Move(kRuntimeCallArgCountRegister, Immediate(num_arguments));
Move(kRuntimeCallFunctionRegister, Immediate(ExternalReference::Create(f)));
Handle<Code> code =
CodeFactory::CEntry(isolate(), f->result_size, save_doubles);
Call(code, RelocInfo::CODE_TARGET);
......@@ -853,9 +853,10 @@ void TurboAssembler::CallRuntimeWithCEntry(Runtime::FunctionId fid,
// arguments passed in because it is constant. At some point we
// should remove this need and make the runtime routine entry code
// smarter.
Move(eax, Immediate(f->nargs));
mov(ebx, Immediate(ExternalReference::Create(f)));
DCHECK(!AreAliased(centry, eax, ebx));
Move(kRuntimeCallArgCountRegister, Immediate(f->nargs));
Move(kRuntimeCallFunctionRegister, Immediate(ExternalReference::Create(f)));
DCHECK(!AreAliased(centry, kRuntimeCallArgCountRegister,
kRuntimeCallFunctionRegister));
add(centry, Immediate(Code::kHeaderSize - kHeapObjectTag));
Call(centry);
}
......@@ -878,7 +879,7 @@ void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) {
// arguments passed in because it is constant. At some point we
// should remove this need and make the runtime routine entry code
// smarter.
mov(eax, Immediate(function->nargs));
Move(kRuntimeCallArgCountRegister, Immediate(function->nargs));
}
JumpToExternalReference(ExternalReference::Create(fid));
}
......@@ -886,7 +887,7 @@ void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) {
void MacroAssembler::JumpToExternalReference(const ExternalReference& ext,
bool builtin_exit_frame) {
// Set the entry point and jump to the C entry runtime stub.
mov(ebx, Immediate(ext));
Move(kRuntimeCallFunctionRegister, Immediate(ext));
Handle<Code> code = CodeFactory::CEntry(isolate(), 1, kDontSaveFPRegs,
kArgvOnStack, builtin_exit_frame);
Jump(code, RelocInfo::CODE_TARGET);
......
......@@ -33,8 +33,11 @@ constexpr Register kJavaScriptCallTargetRegister = kJSFunctionRegister;
constexpr Register kJavaScriptCallNewTargetRegister = edx;
constexpr Register kJavaScriptCallExtraArg1Register = ebx;
constexpr Register kOffHeapTrampolineRegister = ecx;
constexpr Register kRuntimeCallFunctionRegister = ebx;
// The off-heap trampoline does not need a register on ia32 (it uses a
// pc-relative call instead).
constexpr Register kOffHeapTrampolineRegister = no_reg;
constexpr Register kRuntimeCallFunctionRegister = edx;
constexpr Register kRuntimeCallArgCountRegister = eax;
constexpr Register kRuntimeCallArgvRegister = ecx;
constexpr Register kWasmInstanceRegister = esi;
......
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