Commit d02005f4 authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

PPC/s390: [regexp] Various refactors

Port 12ecb4f5

Original Commit Message:

    No functional changes.

    - Removed unused Isolate* argument from regexp extrefs.
    - Added const where possible.
    - Removed unused functions.
    - Shuffled declarations for better readability.
    - ...

R=jgruber@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com
BUG=
LOG=N

Change-Id: I58f21f9f75a7c7bb592b7b07dedd9c32ae8a270c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3216034Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#77359}
parent 51727469
...@@ -362,10 +362,9 @@ void RegExpMacroAssemblerPPC::CheckNotBackReferenceIgnoreCase( ...@@ -362,10 +362,9 @@ void RegExpMacroAssemblerPPC::CheckNotBackReferenceIgnoreCase(
{ {
AllowExternalCallThatCantCauseGC scope(masm_.get()); AllowExternalCallThatCantCauseGC scope(masm_.get());
ExternalReference function = ExternalReference function =
unicode ? ExternalReference::re_case_insensitive_compare_unicode( unicode
isolate()) ? ExternalReference::re_case_insensitive_compare_unicode()
: ExternalReference::re_case_insensitive_compare_non_unicode( : ExternalReference::re_case_insensitive_compare_non_unicode();
isolate());
__ CallCFunction(function, argument_count); __ CallCFunction(function, argument_count);
} }
...@@ -610,8 +609,7 @@ bool RegExpMacroAssemblerPPC::CheckSpecialCharacterClass(base::uc16 type, ...@@ -610,8 +609,7 @@ bool RegExpMacroAssemblerPPC::CheckSpecialCharacterClass(base::uc16 type,
__ cmpi(current_character(), Operand('z')); __ cmpi(current_character(), Operand('z'));
BranchOrBacktrack(gt, on_no_match); BranchOrBacktrack(gt, on_no_match);
} }
ExternalReference map = ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference::re_word_character_map(isolate());
__ mov(r3, Operand(map)); __ mov(r3, Operand(map));
__ lbzx(r3, MemOperand(r3, current_character())); __ lbzx(r3, MemOperand(r3, current_character()));
__ cmpli(r3, Operand::Zero()); __ cmpli(r3, Operand::Zero());
...@@ -625,8 +623,7 @@ bool RegExpMacroAssemblerPPC::CheckSpecialCharacterClass(base::uc16 type, ...@@ -625,8 +623,7 @@ bool RegExpMacroAssemblerPPC::CheckSpecialCharacterClass(base::uc16 type,
__ cmpli(current_character(), Operand('z')); __ cmpli(current_character(), Operand('z'));
__ bgt(&done); __ bgt(&done);
} }
ExternalReference map = ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference::re_word_character_map(isolate());
__ mov(r3, Operand(map)); __ mov(r3, Operand(map));
__ lbzx(r3, MemOperand(r3, current_character())); __ lbzx(r3, MemOperand(r3, current_character()));
__ cmpli(r3, Operand::Zero()); __ cmpli(r3, Operand::Zero());
...@@ -998,8 +995,7 @@ Handle<HeapObject> RegExpMacroAssemblerPPC::GetCode(Handle<String> source) { ...@@ -998,8 +995,7 @@ Handle<HeapObject> RegExpMacroAssemblerPPC::GetCode(Handle<String> source) {
static constexpr int kNumArguments = 1; static constexpr int kNumArguments = 1;
__ PrepareCallCFunction(kNumArguments, r3); __ PrepareCallCFunction(kNumArguments, r3);
__ mov(r3, Operand(ExternalReference::isolate_address(isolate()))); __ mov(r3, Operand(ExternalReference::isolate_address(isolate())));
ExternalReference grow_stack = ExternalReference grow_stack = ExternalReference::re_grow_stack();
ExternalReference::re_grow_stack(isolate());
__ CallCFunction(grow_stack, kNumArguments); __ CallCFunction(grow_stack, kNumArguments);
// If nullptr is returned, we have failed to grow the stack, and must exit // If nullptr is returned, we have failed to grow the stack, and must exit
// with a stack-overflow exception. // with a stack-overflow exception.
...@@ -1210,7 +1206,7 @@ void RegExpMacroAssemblerPPC::CallCheckStackGuardState(Register scratch) { ...@@ -1210,7 +1206,7 @@ void RegExpMacroAssemblerPPC::CallCheckStackGuardState(Register scratch) {
__ addi(r3, sp, Operand(kStackFrameExtraParamSlot * kSystemPointerSize)); __ addi(r3, sp, Operand(kStackFrameExtraParamSlot * kSystemPointerSize));
ExternalReference stack_guard_check = ExternalReference stack_guard_check =
ExternalReference::re_check_stack_guard_state(isolate()); ExternalReference::re_check_stack_guard_state();
__ mov(ip, Operand(stack_guard_check)); __ mov(ip, Operand(stack_guard_check));
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
......
...@@ -353,10 +353,9 @@ void RegExpMacroAssemblerS390::CheckNotBackReferenceIgnoreCase( ...@@ -353,10 +353,9 @@ void RegExpMacroAssemblerS390::CheckNotBackReferenceIgnoreCase(
{ {
AllowExternalCallThatCantCauseGC scope(masm_.get()); AllowExternalCallThatCantCauseGC scope(masm_.get());
ExternalReference function = ExternalReference function =
unicode ? ExternalReference::re_case_insensitive_compare_unicode( unicode
isolate()) ? ExternalReference::re_case_insensitive_compare_unicode()
: ExternalReference::re_case_insensitive_compare_non_unicode( : ExternalReference::re_case_insensitive_compare_non_unicode();
isolate());
__ CallCFunction(function, argument_count); __ CallCFunction(function, argument_count);
} }
...@@ -587,8 +586,7 @@ bool RegExpMacroAssemblerS390::CheckSpecialCharacterClass(base::uc16 type, ...@@ -587,8 +586,7 @@ bool RegExpMacroAssemblerS390::CheckSpecialCharacterClass(base::uc16 type,
__ CmpS64(current_character(), Operand('z')); __ CmpS64(current_character(), Operand('z'));
BranchOrBacktrack(gt, on_no_match); BranchOrBacktrack(gt, on_no_match);
} }
ExternalReference map = ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference::re_word_character_map(isolate());
__ mov(r2, Operand(map)); __ mov(r2, Operand(map));
__ LoadU8(r2, MemOperand(r2, current_character())); __ LoadU8(r2, MemOperand(r2, current_character()));
__ CmpU64(r2, Operand::Zero()); __ CmpU64(r2, Operand::Zero());
...@@ -602,8 +600,7 @@ bool RegExpMacroAssemblerS390::CheckSpecialCharacterClass(base::uc16 type, ...@@ -602,8 +600,7 @@ bool RegExpMacroAssemblerS390::CheckSpecialCharacterClass(base::uc16 type,
__ CmpU64(current_character(), Operand('z')); __ CmpU64(current_character(), Operand('z'));
__ bgt(&done); __ bgt(&done);
} }
ExternalReference map = ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference::re_word_character_map(isolate());
__ mov(r2, Operand(map)); __ mov(r2, Operand(map));
__ LoadU8(r2, MemOperand(r2, current_character())); __ LoadU8(r2, MemOperand(r2, current_character()));
__ CmpU64(r2, Operand::Zero()); __ CmpU64(r2, Operand::Zero());
...@@ -1003,7 +1000,7 @@ Handle<HeapObject> RegExpMacroAssemblerS390::GetCode(Handle<String> source) { ...@@ -1003,7 +1000,7 @@ Handle<HeapObject> RegExpMacroAssemblerS390::GetCode(Handle<String> source) {
static constexpr int kNumArguments = 1; static constexpr int kNumArguments = 1;
__ PrepareCallCFunction(kNumArguments, r2); __ PrepareCallCFunction(kNumArguments, r2);
__ mov(r2, Operand(ExternalReference::isolate_address(isolate()))); __ mov(r2, Operand(ExternalReference::isolate_address(isolate())));
ExternalReference grow_stack = ExternalReference::re_grow_stack(isolate()); ExternalReference grow_stack = ExternalReference::re_grow_stack();
__ CallCFunction(grow_stack, kNumArguments); __ CallCFunction(grow_stack, kNumArguments);
// If nullptr is returned, we have failed to grow the stack, and must exit // If nullptr is returned, we have failed to grow the stack, and must exit
// with a stack-overflow exception. // with a stack-overflow exception.
...@@ -1176,7 +1173,7 @@ void RegExpMacroAssemblerS390::CallCheckStackGuardState(Register scratch) { ...@@ -1176,7 +1173,7 @@ void RegExpMacroAssemblerS390::CallCheckStackGuardState(Register scratch) {
// r2 becomes return address pointer. // r2 becomes return address pointer.
__ lay(r2, MemOperand(sp, kStackFrameRASlot * kSystemPointerSize)); __ lay(r2, MemOperand(sp, kStackFrameRASlot * kSystemPointerSize));
ExternalReference stack_guard_check = ExternalReference stack_guard_check =
ExternalReference::re_check_stack_guard_state(isolate()); ExternalReference::re_check_stack_guard_state();
__ mov(ip, Operand(stack_guard_check)); __ mov(ip, Operand(stack_guard_check));
__ StoreReturnAddressAndCall(ip); __ StoreReturnAddressAndCall(ip);
......
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