Commit 85e287c9 authored by Lu Yahan's avatar Lu Yahan Committed by Yahan Lu

[riscv64] Port 3217193: [regexp] Various refactors

Change-Id: I2d9cb95d8b04a96f436b6f8eae1ce87d80df7f6f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3218710Reviewed-by: 's avatarji qiu <qiuji@iscas.ac.cn>
Commit-Queue: ji qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#77331}
parent 62d26420
...@@ -335,10 +335,9 @@ void RegExpMacroAssemblerRISCV::CheckNotBackReferenceIgnoreCase( ...@@ -335,10 +335,9 @@ void RegExpMacroAssemblerRISCV::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);
} }
...@@ -552,8 +551,7 @@ bool RegExpMacroAssemblerRISCV::CheckSpecialCharacterClass(base::uc16 type, ...@@ -552,8 +551,7 @@ bool RegExpMacroAssemblerRISCV::CheckSpecialCharacterClass(base::uc16 type,
BranchOrBacktrack(on_no_match, Ugreater, current_character(), BranchOrBacktrack(on_no_match, Ugreater, current_character(),
Operand('z')); Operand('z'));
} }
ExternalReference map = ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference::re_word_character_map(isolate());
__ li(a0, Operand(map)); __ li(a0, Operand(map));
__ Add64(a0, a0, current_character()); __ Add64(a0, a0, current_character());
__ Lbu(a0, MemOperand(a0, 0)); __ Lbu(a0, MemOperand(a0, 0));
...@@ -566,8 +564,7 @@ bool RegExpMacroAssemblerRISCV::CheckSpecialCharacterClass(base::uc16 type, ...@@ -566,8 +564,7 @@ bool RegExpMacroAssemblerRISCV::CheckSpecialCharacterClass(base::uc16 type,
// Table is 256 entries, so all Latin1 characters can be tested. // Table is 256 entries, so all Latin1 characters can be tested.
__ BranchShort(&done, Ugreater, current_character(), Operand('z')); __ BranchShort(&done, Ugreater, current_character(), Operand('z'));
} }
ExternalReference map = ExternalReference map = ExternalReference::re_word_character_map();
ExternalReference::re_word_character_map(isolate());
__ li(a0, Operand(map)); __ li(a0, Operand(map));
__ Add64(a0, a0, current_character()); __ Add64(a0, a0, current_character());
__ Lbu(a0, MemOperand(a0, 0)); __ Lbu(a0, MemOperand(a0, 0));
...@@ -929,8 +926,7 @@ Handle<HeapObject> RegExpMacroAssemblerRISCV::GetCode(Handle<String> source) { ...@@ -929,8 +926,7 @@ Handle<HeapObject> RegExpMacroAssemblerRISCV::GetCode(Handle<String> source) {
static constexpr int kNumArguments = 1; static constexpr int kNumArguments = 1;
__ PrepareCallCFunction(kNumArguments, 0, a0); __ PrepareCallCFunction(kNumArguments, 0, a0);
__ li(a0, ExternalReference::isolate_address(isolate())); __ li(a0, 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.
...@@ -1107,8 +1103,7 @@ void RegExpMacroAssemblerRISCV::ClearRegisters(int reg_from, int reg_to) { ...@@ -1107,8 +1103,7 @@ void RegExpMacroAssemblerRISCV::ClearRegisters(int reg_from, int reg_to) {
} }
} }
bool RegExpMacroAssemblerRISCV::CanReadUnaligned() const { return false; }
bool RegExpMacroAssemblerRISCV::CanReadUnaligned() { return false; }
// Private methods: // Private methods:
...@@ -1147,7 +1142,7 @@ void RegExpMacroAssemblerRISCV::CallCheckStackGuardState(Register scratch) { ...@@ -1147,7 +1142,7 @@ void RegExpMacroAssemblerRISCV::CallCheckStackGuardState(Register scratch) {
__ mv(a0, sp); __ mv(a0, sp);
ExternalReference stack_guard_check = ExternalReference stack_guard_check =
ExternalReference::re_check_stack_guard_state(masm_->isolate()); ExternalReference::re_check_stack_guard_state();
__ li(t6, Operand(stack_guard_check)); __ li(t6, Operand(stack_guard_check));
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
......
...@@ -78,7 +78,7 @@ class V8_EXPORT_PRIVATE RegExpMacroAssemblerRISCV ...@@ -78,7 +78,7 @@ class V8_EXPORT_PRIVATE RegExpMacroAssemblerRISCV
virtual void WriteCurrentPositionToRegister(int reg, int cp_offset); virtual void WriteCurrentPositionToRegister(int reg, int cp_offset);
virtual void ClearRegisters(int reg_from, int reg_to); virtual void ClearRegisters(int reg_from, int reg_to);
virtual void WriteStackPointerToRegister(int reg); virtual void WriteStackPointerToRegister(int reg);
virtual bool CanReadUnaligned(); virtual bool CanReadUnaligned() const;
// Called from RegExp if the stack-guard is triggered. // Called from RegExp if the stack-guard is triggered.
// If the code object is relocated, the return address is fixed before // If the code object is relocated, the return address is fixed before
......
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