summaryrefslogtreecommitdiff
path: root/deps/v8/src/regexp/regexp.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2021-03-12 08:24:20 +0100
committerMichaël Zasso <targos@protonmail.com>2021-03-15 15:54:50 +0100
commit732ad99e47bae5deffa3a22d2ebe5500284106f0 (patch)
tree759a6b072accf188f03c74a84e8256fe92f1925c /deps/v8/src/regexp/regexp.cc
parent802b3e7cf9a5074a72bec75cf1c46758b81e04b1 (diff)
downloadnode-new-732ad99e47bae5deffa3a22d2ebe5500284106f0.tar.gz
deps: update V8 to 9.0.257.11
PR-URL: https://github.com/nodejs/node/pull/37587 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/src/regexp/regexp.cc')
-rw-r--r--deps/v8/src/regexp/regexp.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/deps/v8/src/regexp/regexp.cc b/deps/v8/src/regexp/regexp.cc
index f4497842e2..5f83269a8f 100644
--- a/deps/v8/src/regexp/regexp.cc
+++ b/deps/v8/src/regexp/regexp.cc
@@ -76,7 +76,8 @@ class RegExpImpl final : public AllStatic {
// Returns an empty handle in case of an exception.
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> IrregexpExec(
Isolate* isolate, Handle<JSRegExp> regexp, Handle<String> subject,
- int index, Handle<RegExpMatchInfo> last_match_info);
+ int index, Handle<RegExpMatchInfo> last_match_info,
+ RegExp::ExecQuirks exec_quirks = RegExp::ExecQuirks::kNone);
static bool CompileIrregexp(Isolate* isolate, Handle<JSRegExp> re,
Handle<String> sample_subject, bool is_one_byte);
@@ -268,15 +269,17 @@ bool RegExp::EnsureFullyCompiled(Isolate* isolate, Handle<JSRegExp> re,
// static
MaybeHandle<Object> RegExp::ExperimentalOneshotExec(
Isolate* isolate, Handle<JSRegExp> regexp, Handle<String> subject,
- int index, Handle<RegExpMatchInfo> last_match_info) {
+ int index, Handle<RegExpMatchInfo> last_match_info,
+ RegExp::ExecQuirks exec_quirks) {
return ExperimentalRegExp::OneshotExec(isolate, regexp, subject, index,
- last_match_info);
+ last_match_info, exec_quirks);
}
// static
MaybeHandle<Object> RegExp::Exec(Isolate* isolate, Handle<JSRegExp> regexp,
Handle<String> subject, int index,
- Handle<RegExpMatchInfo> last_match_info) {
+ Handle<RegExpMatchInfo> last_match_info,
+ ExecQuirks exec_quirks) {
switch (regexp->TypeTag()) {
case JSRegExp::NOT_COMPILED:
UNREACHABLE();
@@ -285,10 +288,10 @@ MaybeHandle<Object> RegExp::Exec(Isolate* isolate, Handle<JSRegExp> regexp,
last_match_info);
case JSRegExp::IRREGEXP:
return RegExpImpl::IrregexpExec(isolate, regexp, subject, index,
- last_match_info);
+ last_match_info, exec_quirks);
case JSRegExp::EXPERIMENTAL:
return ExperimentalRegExp::Exec(isolate, regexp, subject, index,
- last_match_info);
+ last_match_info, exec_quirks);
}
}
@@ -641,7 +644,8 @@ int RegExpImpl::IrregexpExecRaw(Isolate* isolate, Handle<JSRegExp> regexp,
MaybeHandle<Object> RegExpImpl::IrregexpExec(
Isolate* isolate, Handle<JSRegExp> regexp, Handle<String> subject,
- int previous_index, Handle<RegExpMatchInfo> last_match_info) {
+ int previous_index, Handle<RegExpMatchInfo> last_match_info,
+ RegExp::ExecQuirks exec_quirks) {
DCHECK_EQ(regexp->TypeTag(), JSRegExp::IRREGEXP);
subject = String::Flatten(isolate, subject);
@@ -691,6 +695,11 @@ MaybeHandle<Object> RegExpImpl::IrregexpExec(
output_registers, required_registers);
if (res == RegExp::RE_SUCCESS) {
+ if (exec_quirks == RegExp::ExecQuirks::kTreatMatchAtEndAsFailure) {
+ if (output_registers[0] >= subject->length()) {
+ return isolate->factory()->null_value();
+ }
+ }
int capture_count = regexp->CaptureCount();
return RegExp::SetLastMatchInfo(isolate, last_match_info, subject,
capture_count, output_registers);
@@ -847,6 +856,9 @@ bool RegExpImpl::Compile(Isolate* isolate, Zone* zone, RegExpCompileData* data,
#elif V8_TARGET_ARCH_MIPS64
macro_assembler.reset(new RegExpMacroAssemblerMIPS(isolate, zone, mode,
output_register_count));
+#elif V8_TARGET_ARCH_RISCV64
+ macro_assembler.reset(new RegExpMacroAssemblerRISCV(isolate, zone, mode,
+ output_register_count));
#else
#error "Unsupported architecture"
#endif