Revert "[x64] Reuse scratch register for ExternalReference"

This reverts commit 6031412e0a.

Reason for revert: Tanks quite a few benchmarks (crbug.com/827854).

Original change's description:
> [x64] Reuse scratch register for ExternalReference
> 
> This reduces CEntryStub code size by 64 bytes, and reduces CallApiCallbackStub
> by 27 bytes.
> 
> Change-Id: I46479077f61fdae6b260ca28c67df3509dee5c1a
> Reviewed-on: https://chromium-review.googlesource.com/963652
> Commit-Queue: Kanghua Yu <kanghua.yu@intel.com>
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#52005}

TBR=bmeurer@chromium.org,kanghua.yu@intel.com
Bug: chromium:827854

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ief0905a7bdba86f7b9fd20888eecdfd58bc6ea7d
Reviewed-on: https://chromium-review.googlesource.com/991712
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52314}
This commit is contained in:
Benedikt Meurer 2018-04-03 05:13:16 +00:00 committed by Commit Bot
parent 0258a06180
commit fe65d6c832
3 changed files with 9 additions and 35 deletions

View File

@ -405,20 +405,16 @@ void CEntryStub::Generate(MacroAssembler* masm) {
isolate());
{
FrameScope scope(masm, StackFrame::MANUAL);
__ xorp(arg_reg_1, arg_reg_1); // argc.
__ xorp(arg_reg_2, arg_reg_2); // argv.
__ movp(arg_reg_1, Immediate(0)); // argc.
__ movp(arg_reg_2, Immediate(0)); // argv.
__ Move(arg_reg_3, ExternalReference::isolate_address(isolate()));
__ PrepareCallCFunction(3);
__ CallCFunction(find_handler, 3);
}
// Retrieve the handler context, SP and FP.
__ movp(rsi, masm->ExternalOperand(pending_handler_context_address));
__ movp(rsp,
masm->ExternalOperandReuseScratchRegister(
pending_handler_sp_address, pending_handler_context_address));
__ movp(rbp,
masm->ExternalOperandReuseScratchRegister(
pending_handler_fp_address, pending_handler_context_address));
__ movp(rsp, masm->ExternalOperand(pending_handler_sp_address));
__ movp(rbp, masm->ExternalOperand(pending_handler_fp_address));
// If the handler is a JS frame, restore the context to the frame. Note that
// the context will be set to (rsi == 0) for non-JS frames.
@ -435,9 +431,7 @@ void CEntryStub::Generate(MacroAssembler* masm) {
__ ResetSpeculationPoisonRegister();
// Compute the handler entry address and jump to it.
__ movp(rdi, masm->ExternalOperandReuseScratchRegister(
pending_handler_entrypoint_address,
pending_handler_context_address));
__ movp(rdi, masm->ExternalOperand(pending_handler_entrypoint_address));
__ jmp(rdi);
}

View File

@ -160,19 +160,6 @@ Operand TurboAssembler::ExternalOperand(ExternalReference target,
return Operand(scratch, 0);
}
Operand TurboAssembler::ExternalOperandReuseScratchRegister(
ExternalReference target, ExternalReference previous, Register scratch) {
if (root_array_available_ && !serializer_enabled()) {
int64_t delta = RootRegisterDelta(target);
if (delta != kInvalidRootRegisterDelta && is_int32(delta)) {
return Operand(kRootRegister, static_cast<int32_t>(delta));
}
}
int64_t delta = target.address() - previous.address();
DCHECK(is_int32(delta));
return Operand(scratch, static_cast<int32_t>(delta));
}
int TurboAssembler::LoadAddressSize(ExternalReference source) {
if (root_array_available_ && !serializer_enabled()) {
// This calculation depends on the internals of LoadAddress.
@ -2261,12 +2248,9 @@ void MacroAssembler::EnterExitFramePrologue(bool save_rax,
movp(r14, rax); // Backup rax in callee-save register.
}
ExternalReference fp_address(IsolateAddressId::kCEntryFPAddress, isolate()),
context_address(IsolateAddressId::kContextAddress, isolate()),
function_address(IsolateAddressId::kCFunctionAddress, isolate());
movp(ExternalOperand(fp_address), rbp);
movp(ExternalOperandReuseScratchRegister(context_address, fp_address), rsi);
movp(ExternalOperandReuseScratchRegister(function_address, fp_address), rbx);
Store(ExternalReference(IsolateAddressId::kCEntryFPAddress, isolate()), rbp);
Store(ExternalReference(IsolateAddressId::kContextAddress, isolate()), rsi);
Store(ExternalReference(IsolateAddressId::kCFunctionAddress, isolate()), rbx);
}
@ -2374,8 +2358,7 @@ void MacroAssembler::LeaveExitFrameEpilogue() {
// Clear the top frame.
ExternalReference c_entry_fp_address(IsolateAddressId::kCEntryFPAddress,
isolate());
Operand c_entry_fp_operand =
ExternalOperandReuseScratchRegister(c_entry_fp_address, context_address);
Operand c_entry_fp_operand = ExternalOperand(c_entry_fp_address);
movp(c_entry_fp_operand, Immediate(0));
}

View File

@ -366,9 +366,6 @@ class TurboAssembler : public Assembler {
// that is guaranteed not to be clobbered.
Operand ExternalOperand(ExternalReference reference,
Register scratch = kScratchRegister);
Operand ExternalOperandReuseScratchRegister(
ExternalReference target, ExternalReference previous,
Register scratch = kScratchRegister);
void Call(Operand op);
void Call(Handle<Code> code_object, RelocInfo::Mode rmode);