Commit 35990c95 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

[regexp] Add a (currently failing) cctest for irregexp reentrancy

The test should be enabled once reentrancy is supported.

Bug: v8:11382
Change-Id: Ifb90d8a6fd8bf9f05e9ca2405d4e04e013ce7ee3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3138201
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarPatrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76667}
parent 5a254440
......@@ -136,6 +136,9 @@
'test-strings/Traverse': [PASS, HEAVY],
'test-swiss-name-dictionary-csa/DeleteAtBoundaries': [PASS, HEAVY],
'test-swiss-name-dictionary-csa/SameH2': [PASS, HEAVY],
# TODO(v8:11382): Reenable once irregexp is reentrant.
'test-regexp/RegExpInterruptReentrantExecution': [FAIL],
}], # ALWAYS
##############################################################################
......@@ -670,6 +673,9 @@
# Instruction cache flushing is disabled in jitless mode.
'test-icache/*': [SKIP],
# Tests generated irregexp code.
'test-regexp/RegExpInterruptReentrantExecution': [SKIP],
}], # lite_mode or variant == jitless
##############################################################################
......
......@@ -21734,10 +21734,6 @@ TEST(RegExpInterruptAndMakeSubjectTwoByteExternal) {
// experimental engine.
i::FLAG_enable_experimental_regexp_engine_on_excessive_backtracks = false;
RegExpInterruptTest test;
// We want to be stuck regexp execution, so no fallback to linear-time
// engine.
// TODO(mbid,v8:10765): Find a way to test interrupt support of the
// experimental engine.
test.RunTest(RegExpInterruptTest::MakeSubjectTwoByteExternal);
}
......@@ -2346,6 +2346,50 @@ TEST(UnicodePropertyEscapeCodeSize) {
}
}
namespace {
struct RegExpExecData {
i::Isolate* isolate;
i::Handle<i::JSRegExp> regexp;
i::Handle<i::String> subject;
};
i::Handle<i::Object> RegExpExec(const RegExpExecData* d) {
return i::RegExp::Exec(d->isolate, d->regexp, d->subject, 0,
d->isolate->regexp_last_match_info())
.ToHandleChecked();
}
void ReenterRegExp(v8::Isolate* isolate, void* data) {
RegExpExecData* d = static_cast<RegExpExecData*>(data);
i::Handle<i::Object> result = RegExpExec(d);
CHECK(result->IsNull());
}
} // namespace
// Tests reentrant irregexp calls.
TEST(RegExpInterruptReentrantExecution) {
CHECK(!i::FLAG_jitless);
i::FLAG_regexp_tier_up = false; // Enter irregexp, not the interpreter.
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
RegExpExecData d;
d.isolate = reinterpret_cast<i::Isolate*>(isolate);
d.regexp = v8::Utils::OpenHandle(
*v8::RegExp::New(context.local(), v8_str("(a*)*x"), v8::RegExp::kNone)
.ToLocalChecked());
d.subject = v8::Utils::OpenHandle(*v8_str("aaaa"));
isolate->RequestInterrupt(&ReenterRegExp, &d);
i::Handle<i::Object> result = RegExpExec(&d);
CHECK(result->IsNull());
}
#undef CHECK_PARSE_ERROR
#undef CHECK_SIMPLE
#undef CHECK_MIN_MAX
......
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