Commit 4706fa71 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

aix: fix function_descriptor issue on regexp

the problem is that we call irregexp code in two ways:

1. CallCFunction9 from CSA builtins
2. Through GeneratedCode::Call from the runtime.

1 is a standard C call and expects the target to be a FD,
2 is our own implementation where we dynamically generate a FD.
So there's a mismatch between the two.

Change-Id: I8391db30fa7586d296b5d1880a7f44dafad21a2a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1487341
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Auto-Submit: Junliang Yan <jyan@ca.ibm.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60129}
parent 041a996d
...@@ -109,6 +109,9 @@ RegExpMacroAssemblerPPC::RegExpMacroAssemblerPPC(Isolate* isolate, Zone* zone, ...@@ -109,6 +109,9 @@ RegExpMacroAssemblerPPC::RegExpMacroAssemblerPPC(Isolate* isolate, Zone* zone,
internal_failure_label_() { internal_failure_label_() {
DCHECK_EQ(0, registers_to_save % 2); DCHECK_EQ(0, registers_to_save % 2);
// Because RegExp code respects C ABI, so needs a FD
__ function_descriptor();
__ b(&entry_label_); // We'll write the entry code later. __ b(&entry_label_); // We'll write the entry code later.
// If the code gets too big or corrupted, an internal exception will be // If the code gets too big or corrupted, an internal exception will be
// raised, and we will exit right away. // raised, and we will exit right away.
......
...@@ -273,8 +273,9 @@ int NativeRegExpMacroAssembler::Execute( ...@@ -273,8 +273,9 @@ int NativeRegExpMacroAssembler::Execute(
int output_size, Address stack_base, int direct_call, Isolate* isolate); int output_size, Address stack_base, int direct_call, Isolate* isolate);
auto fn = GeneratedCode<RegexpMatcherSig>::FromCode(code); auto fn = GeneratedCode<RegexpMatcherSig>::FromCode(code);
int result = fn.Call(input.ptr(), start_offset, input_start, input_end, int result =
output, output_size, stack_base, direct_call, isolate); fn.CallIrregexp(input.ptr(), start_offset, input_start, input_end, output,
output_size, stack_base, direct_call, isolate);
DCHECK(result >= RETRY); DCHECK(result >= RETRY);
if (result == EXCEPTION && !isolate->has_pending_exception()) { if (result == EXCEPTION && !isolate->has_pending_exception()) {
......
...@@ -118,7 +118,10 @@ class GeneratedCode { ...@@ -118,7 +118,10 @@ class GeneratedCode {
return Simulator::current(isolate_)->template Call<Return>( return Simulator::current(isolate_)->template Call<Return>(
reinterpret_cast<Address>(fn_ptr_), args...); reinterpret_cast<Address>(fn_ptr_), args...);
} }
DISABLE_CFI_ICALL Return CallIrregexp(Args... args) { return Call(args...); }
#else #else
DISABLE_CFI_ICALL Return Call(Args... args) { DISABLE_CFI_ICALL Return Call(Args... args) {
// When running without a simulator we call the entry directly. // When running without a simulator we call the entry directly.
#if V8_OS_AIX #if V8_OS_AIX
...@@ -135,7 +138,12 @@ class GeneratedCode { ...@@ -135,7 +138,12 @@ class GeneratedCode {
return fn_ptr_(args...); return fn_ptr_(args...);
#endif // V8_OS_AIX #endif // V8_OS_AIX
} }
#endif
DISABLE_CFI_ICALL Return CallIrregexp(Args... args) {
// When running without a simulator we call the entry directly.
return fn_ptr_(args...);
}
#endif // USE_SIMULATOR
private: private:
friend class GeneratedCode<Return(Args...)>; friend class GeneratedCode<Return(Args...)>;
......
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