Commit f306ee1b authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC: use DirectCEntry for regexp code

Change-Id: I9bd7c97dd0b36935bd1fb76cd2cbc83a1b28cdfb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1521223
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Auto-Submit: Junliang Yan <jyan@ca.ibm.com>
Reviewed-by: 's avatarMilad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#60223}
parent 1140f202
......@@ -3272,8 +3272,21 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) {
}
void Builtins::Generate_DirectCEntry(MacroAssembler* masm) {
// Unused.
__ stop(0);
// Place the return address on the stack, making the call
// GC safe. The RegExp backend also relies on this.
__ mflr(r0);
__ StoreP(r0, MemOperand(sp, kStackFrameExtraParamSlot * kPointerSize));
if (ABI_USES_FUNCTION_DESCRIPTORS && FLAG_embedded_builtins) {
// AIX/PPC64BE Linux use a function descriptor;
__ LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(ip, kPointerSize));
__ LoadP(ip, MemOperand(ip, 0)); // Instruction address
}
__ Call(ip); // Call the C++ function.
__ LoadP(r0, MemOperand(sp, kStackFrameExtraParamSlot * kPointerSize));
__ mtlr(r0);
__ blr();
}
#undef __
......
......@@ -1131,7 +1131,19 @@ void RegExpMacroAssemblerPPC::CallCheckStackGuardState(Register scratch) {
ExternalReference stack_guard_check =
ExternalReference::re_check_stack_guard_state(isolate());
__ mov(ip, Operand(stack_guard_check));
__ StoreReturnAddressAndCall(ip);
if (FLAG_embedded_builtins) {
EmbeddedData d = EmbeddedData::FromBlob();
CHECK(Builtins::IsIsolateIndependent(Builtins::kDirectCEntry));
Address entry = d.InstructionStartOfBuiltin(Builtins::kDirectCEntry);
__ mov(r0, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
} else {
// TODO(v8:8519): Remove this once embedded builtins are on unconditionally.
Handle<Code> code = BUILTIN_CODE(isolate(), DirectCEntry);
__ mov(r0, Operand(reinterpret_cast<intptr_t>(code.location()),
RelocInfo::CODE_TARGET));
}
__ Call(r0);
// Restore the stack pointer
stack_space = kNumRequiredStackFrameSlots + stack_passed_arguments;
......
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