[regexp] Remove --harmony-regexp-match-indices
RegExp match indices have shipped since M90 Bug: v8:9548 Change-Id: I8bf54ce1a50b5079aad71140f75c979a09aae5bb Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3042842 Auto-Submit: Shu-yu Guo <syg@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#75848}
This commit is contained in:
parent
ee445477fb
commit
ddd6996715
@ -1085,6 +1085,7 @@ TNode<String> RegExpBuiltinsAssembler::FlagsGetter(TNode<Context> context,
|
||||
CASE_FOR_FLAG("dotAll", JSRegExp::kDotAll);
|
||||
CASE_FOR_FLAG("unicode", JSRegExp::kUnicode);
|
||||
CASE_FOR_FLAG("sticky", JSRegExp::kSticky);
|
||||
CASE_FOR_FLAG("hasIndices", JSRegExp::kHasIndices);
|
||||
#undef CASE_FOR_FLAG
|
||||
|
||||
#define CASE_FOR_FLAG(NAME, V8_FLAG_EXTERN_REF, FLAG) \
|
||||
@ -1106,10 +1107,6 @@ TNode<String> RegExpBuiltinsAssembler::FlagsGetter(TNode<Context> context,
|
||||
BIND(&next); \
|
||||
} while (false)
|
||||
|
||||
CASE_FOR_FLAG(
|
||||
"hasIndices",
|
||||
ExternalReference::address_of_harmony_regexp_match_indices_flag(),
|
||||
JSRegExp::kHasIndices);
|
||||
CASE_FOR_FLAG(
|
||||
"linear",
|
||||
ExternalReference::address_of_enable_experimental_regexp_engine(),
|
||||
|
@ -512,11 +512,6 @@ ExternalReference ExternalReference::address_of_builtin_subclassing_flag() {
|
||||
return ExternalReference(&FLAG_builtin_subclassing);
|
||||
}
|
||||
|
||||
ExternalReference
|
||||
ExternalReference::address_of_harmony_regexp_match_indices_flag() {
|
||||
return ExternalReference(&FLAG_harmony_regexp_match_indices);
|
||||
}
|
||||
|
||||
ExternalReference ExternalReference::address_of_runtime_stats_flag() {
|
||||
return ExternalReference(&TracingFlags::runtime_stats);
|
||||
}
|
||||
|
@ -104,8 +104,6 @@ class StatsCounter;
|
||||
"address_of_enable_experimental_regexp_engine") \
|
||||
V(address_of_float_abs_constant, "float_absolute_constant") \
|
||||
V(address_of_float_neg_constant, "float_negate_constant") \
|
||||
V(address_of_harmony_regexp_match_indices_flag, \
|
||||
"FLAG_harmony_regexp_match_indices") \
|
||||
V(address_of_min_int, "LDoubleConstant::min_int") \
|
||||
V(address_of_mock_arraybuffer_allocator_flag, \
|
||||
"FLAG_mock_arraybuffer_allocator") \
|
||||
|
@ -303,7 +303,6 @@ DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
|
||||
#define HARMONY_SHIPPING_BASE(V) \
|
||||
V(harmony_sharedarraybuffer, "harmony sharedarraybuffer") \
|
||||
V(harmony_atomics, "harmony atomics") \
|
||||
V(harmony_regexp_match_indices, "harmony regexp match indices") \
|
||||
V(harmony_private_brand_checks, "harmony private brand checks") \
|
||||
V(harmony_top_level_await, "harmony top level await") \
|
||||
V(harmony_relative_indexing_methods, "harmony relative indexing methods") \
|
||||
|
@ -2466,6 +2466,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
Builtin::kRegExpPrototypeFlagsGetter, true);
|
||||
SimpleInstallGetter(isolate_, prototype, factory->global_string(),
|
||||
Builtin::kRegExpPrototypeGlobalGetter, true);
|
||||
SimpleInstallGetter(isolate(), prototype, factory->has_indices_string(),
|
||||
Builtin::kRegExpPrototypeHasIndicesGetter, true);
|
||||
SimpleInstallGetter(isolate_, prototype, factory->ignoreCase_string(),
|
||||
Builtin::kRegExpPrototypeIgnoreCaseGetter, true);
|
||||
SimpleInstallGetter(isolate_, prototype, factory->multiline_string(),
|
||||
@ -4449,36 +4451,6 @@ void Genesis::InitializeGlobal_harmony_weak_refs_with_cleanup_some() {
|
||||
DONT_ENUM);
|
||||
}
|
||||
|
||||
void Genesis::InitializeGlobal_harmony_regexp_match_indices() {
|
||||
if (!FLAG_harmony_regexp_match_indices) return;
|
||||
|
||||
Handle<Map> source_map(native_context()->regexp_result_map(), isolate());
|
||||
Handle<Map> initial_map =
|
||||
Map::Copy(isolate(), source_map, "JSRegExpResult with indices");
|
||||
initial_map->set_instance_size(JSRegExpResultWithIndices::kSize);
|
||||
DCHECK_EQ(initial_map->GetInObjectProperties(),
|
||||
JSRegExpResultWithIndices::kInObjectPropertyCount);
|
||||
|
||||
// indices descriptor
|
||||
{
|
||||
Descriptor d =
|
||||
Descriptor::DataField(isolate(), factory()->indices_string(),
|
||||
JSRegExpResultWithIndices::kIndicesIndex, NONE,
|
||||
Representation::Tagged());
|
||||
Map::EnsureDescriptorSlack(isolate(), initial_map, 1);
|
||||
initial_map->AppendDescriptor(isolate(), &d);
|
||||
}
|
||||
|
||||
native_context()->set_regexp_result_with_indices_map(*initial_map);
|
||||
|
||||
Handle<JSObject> prototype(native_context()->regexp_prototype(), isolate());
|
||||
SimpleInstallGetter(isolate(), prototype, factory()->has_indices_string(),
|
||||
Builtin::kRegExpPrototypeHasIndicesGetter, true);
|
||||
|
||||
// Store regexp prototype map again after change.
|
||||
native_context()->set_regexp_prototype_map(prototype->map());
|
||||
}
|
||||
|
||||
void Genesis::InitializeGlobal_regexp_linear_flag() {
|
||||
if (!FLAG_enable_experimental_regexp_engine) return;
|
||||
|
||||
@ -4890,7 +4862,27 @@ bool Genesis::InstallABunchOfRandomThings() {
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the map for RegExp results objects for regexps with the /d flag.
|
||||
Handle<Map> initial_with_indices_map =
|
||||
Map::Copy(isolate(), initial_map, "JSRegExpResult with indices");
|
||||
initial_with_indices_map->set_instance_size(
|
||||
JSRegExpResultWithIndices::kSize);
|
||||
DCHECK_EQ(initial_with_indices_map->GetInObjectProperties(),
|
||||
JSRegExpResultWithIndices::kInObjectPropertyCount);
|
||||
|
||||
// indices descriptor
|
||||
{
|
||||
Descriptor d =
|
||||
Descriptor::DataField(isolate(), factory()->indices_string(),
|
||||
JSRegExpResultWithIndices::kIndicesIndex, NONE,
|
||||
Representation::Tagged());
|
||||
Map::EnsureDescriptorSlack(isolate(), initial_with_indices_map, 1);
|
||||
initial_with_indices_map->AppendDescriptor(isolate(), &d);
|
||||
}
|
||||
|
||||
native_context()->set_regexp_result_map(*initial_map);
|
||||
native_context()->set_regexp_result_with_indices_map(
|
||||
*initial_with_indices_map);
|
||||
}
|
||||
|
||||
// Create a constructor for JSRegExpResultIndices (a variant of Array that
|
||||
|
@ -52,10 +52,9 @@ class JSRegExp : public TorqueGeneratedJSRegExp<JSRegExp, JSObject> {
|
||||
: c == 'y' ? base::Optional<Flag>(kSticky)
|
||||
: c == 'u' ? base::Optional<Flag>(kUnicode)
|
||||
: c == 's' ? base::Optional<Flag>(kDotAll)
|
||||
: c == 'd' ? base::Optional<Flag>(kHasIndices)
|
||||
: (FLAG_enable_experimental_regexp_engine && c == 'l')
|
||||
? base::Optional<Flag>(kLinear)
|
||||
: (FLAG_harmony_regexp_match_indices && c == 'd')
|
||||
? base::Optional<Flag>(kHasIndices)
|
||||
: base::Optional<Flag>();
|
||||
// clang-format on
|
||||
}
|
||||
@ -226,11 +225,11 @@ class JSRegExp : public TorqueGeneratedJSRegExp<JSRegExp, JSObject> {
|
||||
|
||||
// Descriptor array index to important methods in the prototype.
|
||||
static const int kExecFunctionDescriptorIndex = 1;
|
||||
static const int kSymbolMatchFunctionDescriptorIndex = 13;
|
||||
static const int kSymbolMatchAllFunctionDescriptorIndex = 14;
|
||||
static const int kSymbolReplaceFunctionDescriptorIndex = 15;
|
||||
static const int kSymbolSearchFunctionDescriptorIndex = 16;
|
||||
static const int kSymbolSplitFunctionDescriptorIndex = 17;
|
||||
static const int kSymbolMatchFunctionDescriptorIndex = 14;
|
||||
static const int kSymbolMatchAllFunctionDescriptorIndex = 15;
|
||||
static const int kSymbolReplaceFunctionDescriptorIndex = 16;
|
||||
static const int kSymbolSearchFunctionDescriptorIndex = 17;
|
||||
static const int kSymbolSplitFunctionDescriptorIndex = 18;
|
||||
|
||||
// The uninitialized value for a regexp code object.
|
||||
static const int kUninitializedValue = -1;
|
||||
|
@ -1704,9 +1704,6 @@ MaybeHandle<JSRegExp> ValueDeserializer::ReadJSRegExp() {
|
||||
if (!FLAG_enable_experimental_regexp_engine) {
|
||||
bad_flags_mask |= JSRegExp::kLinear;
|
||||
}
|
||||
if (!FLAG_harmony_regexp_match_indices) {
|
||||
bad_flags_mask |= JSRegExp::kHasIndices;
|
||||
}
|
||||
if ((raw_flags & bad_flags_mask) ||
|
||||
!JSRegExp::New(isolate_, pattern, static_cast<JSRegExp::Flags>(raw_flags))
|
||||
.ToHandle(®exp)) {
|
||||
|
@ -961,8 +961,6 @@ RUNTIME_FUNCTION(
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_RegExpBuildIndices) {
|
||||
DCHECK(FLAG_harmony_regexp_match_indices);
|
||||
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(RegExpMatchInfo, match_info, 1);
|
||||
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2021 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --no-harmony-regexp-match-indices
|
||||
|
||||
// Redefined hasIndices should not reflect in flags without
|
||||
// --harmony-regexp-match-indices
|
||||
{
|
||||
let re = /./;
|
||||
Object.defineProperty(re, "hasIndices", { get: function() { return true; } });
|
||||
assertEquals("", re.flags);
|
||||
}
|
@ -1516,22 +1516,14 @@ TEST_F(ValueSerializerTest, DecodeLinearRegExp) {
|
||||
}
|
||||
|
||||
TEST_F(ValueSerializerTest, DecodeHasIndicesRegExp) {
|
||||
bool flag_was_enabled = i::FLAG_harmony_regexp_match_indices;
|
||||
|
||||
// The last byte encodes the regexp flags.
|
||||
std::vector<uint8_t> regexp_encoding = {0xFF, 0x09, 0x3F, 0x00, 0x52, 0x03,
|
||||
0x66, 0x6F, 0x6F, 0xAD, 0x01};
|
||||
|
||||
i::FLAG_harmony_regexp_match_indices = true;
|
||||
Local<Value> value = DecodeTest(regexp_encoding);
|
||||
ASSERT_TRUE(value->IsRegExp());
|
||||
ExpectScriptTrue("Object.getPrototypeOf(result) === RegExp.prototype");
|
||||
ExpectScriptTrue("result.toString() === '/foo/dgmsy'");
|
||||
|
||||
i::FLAG_harmony_regexp_match_indices = false;
|
||||
InvalidDecodeTest(regexp_encoding);
|
||||
|
||||
i::FLAG_harmony_regexp_match_indices = flag_was_enabled;
|
||||
}
|
||||
|
||||
TEST_F(ValueSerializerTest, RoundTripMap) {
|
||||
|
Loading…
Reference in New Issue
Block a user