Commit ea4a6c7f authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

Remove always-true --harmony-regexp-named-captures runtime flag

It was shipped in Chrome 64.

Bug: v8:5437
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I6d9ac762b2eafdf4e64fd1dd10dbce553a8455f9
Reviewed-on: https://chromium-review.googlesource.com/1086790Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53510}
parent 1d5c823b
......@@ -4267,7 +4267,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
void Genesis::InitializeGlobal_##id() {}
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_tostring)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_public_fields)
......
......@@ -232,7 +232,6 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_private_fields)
#define HARMONY_SHIPPING(V) \
V(harmony_string_trimming, "harmony String.prototype.trim{Start,End}") \
V(harmony_sharedarraybuffer, "harmony sharedarraybuffer") \
V(harmony_regexp_named_captures, "harmony regexp named captures") \
V(harmony_regexp_property, "harmony Unicode regexp property classes") \
V(harmony_function_tostring, "harmony Function.prototype.toString") \
V(harmony_optional_catch_binding, "allow omitting binding in catch blocks") \
......
......@@ -11692,7 +11692,6 @@ int String::IndexOf(Isolate* isolate, Handle<String> receiver,
MaybeHandle<String> String::GetSubstitution(Isolate* isolate, Match* match,
Handle<String> replacement,
int start_index) {
DCHECK_IMPLIES(match->HasNamedCaptures(), FLAG_harmony_regexp_named_captures);
DCHECK_GE(start_index, 0);
Factory* factory = isolate->factory();
......
......@@ -477,18 +477,17 @@ RegExpTree* RegExpParser::ParseDisjunction() {
builder->AddCharacter('u');
} else {
// With /u, invalid escapes are not treated as identity escapes.
return ReportError(CStrVector("Invalid unicode escape"));
return ReportError(CStrVector("Invalid Unicode escape"));
}
break;
}
case 'k':
// Either an identity escape or a named back-reference. The two
// interpretations are mutually exclusive: '\k' is interpreted as
// an identity escape for non-unicode patterns without named
// an identity escape for non-Unicode patterns without named
// capture groups, and as the beginning of a named back-reference
// in all other cases.
if (FLAG_harmony_regexp_named_captures &&
(unicode() || HasNamedCaptures())) {
if (unicode() || HasNamedCaptures()) {
Advance(2);
ParseNamedBackReference(builder, state CHECK_FAILED);
break;
......@@ -678,13 +677,10 @@ RegExpParser::RegExpParserState* RegExpParser::ParseOpenParenthesis(
subexpr_type = NEGATIVE_LOOKAROUND;
break;
}
if (FLAG_harmony_regexp_named_captures) {
is_named_capture = true;
has_named_captures_ = true;
Advance();
break;
}
V8_FALLTHROUGH;
is_named_capture = true;
has_named_captures_ = true;
Advance();
break;
default:
ReportError(CStrVector("Invalid group"));
return nullptr;
......@@ -765,7 +761,6 @@ void RegExpParser::ScanForCaptures() {
// * or a named capture '(?<'.
//
// Of these, only named captures are capturing groups.
if (!FLAG_harmony_regexp_named_captures) break;
Advance();
if (current() != '<') break;
......@@ -830,8 +825,6 @@ static void push_code_unit(ZoneVector<uc16>* v, uint32_t code_unit) {
}
const ZoneVector<uc16>* RegExpParser::ParseCaptureGroupName() {
DCHECK(FLAG_harmony_regexp_named_captures);
ZoneVector<uc16>* name =
new (zone()->New(sizeof(ZoneVector<uc16>))) ZoneVector<uc16>(zone());
......@@ -879,7 +872,6 @@ const ZoneVector<uc16>* RegExpParser::ParseCaptureGroupName() {
bool RegExpParser::CreateNamedCaptureAtIndex(const ZoneVector<uc16>* name,
int index) {
DCHECK(FLAG_harmony_regexp_named_captures);
DCHECK(0 < index && index <= captures_started_);
DCHECK_NOT_NULL(name);
......
......@@ -149,9 +149,6 @@ class CompiledReplacement {
// Equivalent to String::GetSubstitution, except that this method converts
// the replacement string into an internal representation that avoids
// repeated parsing when used repeatedly.
DCHECK_IMPLIES(capture_name_map != nullptr,
FLAG_harmony_regexp_named_captures);
int length = characters.length();
int last = 0;
for (int i = 0; i < length; i++) {
......@@ -329,7 +326,6 @@ bool CompiledReplacement::Compile(Isolate* isolate, Handle<JSRegExp> regexp,
DCHECK_EQ(regexp->TypeTag(), JSRegExp::IRREGEXP);
Object* maybe_capture_name_map = regexp->CaptureNameMap();
if (maybe_capture_name_map->IsFixedArray()) {
DCHECK(FLAG_harmony_regexp_named_captures);
capture_name_map = FixedArray::cast(maybe_capture_name_map);
}
}
......@@ -948,7 +944,6 @@ class MatchInfoBackedMatch : public String::Match {
Object* o = regexp->CaptureNameMap();
has_named_captures_ = o->IsFixedArray();
if (has_named_captures_) {
DCHECK(FLAG_harmony_regexp_named_captures);
capture_name_map_ = handle(FixedArray::cast(o), isolate);
}
} else {
......@@ -1106,7 +1101,6 @@ class VectorBackedMatch : public String::Match {
Handle<JSObject> ConstructNamedCaptureGroupsObject(
Isolate* isolate, Handle<FixedArray> capture_map,
std::function<Object*(int)> f_get_capture) {
DCHECK(FLAG_harmony_regexp_named_captures);
Handle<JSObject> groups = isolate->factory()->NewJSObjectWithNullProto();
const int capture_count = capture_map->length() >> 1;
......@@ -1219,7 +1213,6 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject,
Handle<Object> maybe_capture_map(regexp->CaptureNameMap(), isolate);
const bool has_named_captures = maybe_capture_map->IsFixedArray();
DCHECK_IMPLIES(has_named_captures, FLAG_harmony_regexp_named_captures);
const int argc =
has_named_captures ? 4 + capture_count : 3 + capture_count;
......@@ -1498,7 +1491,6 @@ RUNTIME_FUNCTION(Runtime_StringReplaceNonGlobalRegExpWithFunction) {
}
}
DCHECK_IMPLIES(has_named_captures, FLAG_harmony_regexp_named_captures);
const uint32_t argc = GetArgcForReplaceCallable(m, has_named_captures);
if (argc == static_cast<uint32_t>(-1)) {
THROW_NEW_ERROR_RETURN_FAILURE(
......@@ -1854,14 +1846,11 @@ RUNTIME_FUNCTION(Runtime_RegExpReplace) {
}
Handle<Object> groups_obj = isolate->factory()->undefined_value();
if (FLAG_harmony_regexp_named_captures) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, groups_obj,
Object::GetProperty(result, factory->groups_string()));
}
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, groups_obj,
Object::GetProperty(result, factory->groups_string()));
const bool has_named_captures = !groups_obj->IsUndefined(isolate);
DCHECK_IMPLIES(has_named_captures, FLAG_harmony_regexp_named_captures);
Handle<String> replacement;
if (functional_replace) {
......
......@@ -432,7 +432,6 @@ TEST(RegExpParser) {
CHECK_MIN_MAX("a(?=bbb|bb)c", 2, 2);
CHECK_MIN_MAX("a(?!bbb|bb)c", 2, 2);
FLAG_harmony_regexp_named_captures = true;
CheckParseEq("(?<a>x)(?<b>x)(?<c>x)\\k<a>",
"(: (^ 'x') (^ 'x') (^ 'x') (<- 1))", true);
CheckParseEq("(?<a>x)(?<b>x)(?<c>x)\\k<b>",
......@@ -447,7 +446,6 @@ TEST(RegExpParser) {
CheckParseEq("(?<\\u{03C0}>a)", "(^ 'a')", true);
CheckParseEq("(?<\\u03C0>a)", "(^ 'a')", true);
FLAG_harmony_regexp_named_captures = false;
}
TEST(ParserRegression) {
......@@ -501,7 +499,6 @@ TEST(Errors) {
}
ExpectError(os.str().c_str(), kTooManyCaptures);
FLAG_harmony_regexp_named_captures = true;
const char* kInvalidCaptureName = "Invalid capture group name";
ExpectError("(?<>.)", kInvalidCaptureName, true);
ExpectError("(?<1>.)", kInvalidCaptureName, true);
......@@ -516,7 +513,6 @@ TEST(Errors) {
ExpectError("(?<b>)\\k<a>", kInvalidCaptureReferenced, true);
const char* kInvalidNamedReference = "Invalid named reference";
ExpectError("\\ka", kInvalidNamedReference, true);
FLAG_harmony_regexp_named_captures = false;
}
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-regexp-named-captures --allow-natives-syntax
// Flags: --allow-natives-syntax
// Malformed named captures.
assertThrows("/(?<>a)/u", SyntaxError); // Empty name.
......
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-regexp-named-captures --stack-size=100
// Flags: --stack-size=100
function call_replace_close_to_stack_overflow() {
try {
call_replace_close_to_stack_overflow();
} catch(e) {
} catch {
"b".replace(/(b)/g);
}
}
......
......@@ -43,7 +43,6 @@ from testrunner.outproc import test262
# TODO(littledan): move the flag mapping into the status file
FEATURE_FLAGS = {
'BigInt': '--harmony-bigint',
'regexp-named-groups': '--harmony-regexp-named-captures',
'regexp-unicode-property-escapes': '--harmony-regexp-property',
'class-fields-public': '--harmony-public-fields',
'optional-catch-binding': '--harmony-optional-catch-binding',
......
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