Remove always-true --harmony-string-matchall runtime flag
It shipped in Chrome 73. Bug: v8:6890 Change-Id: Idd8c98cf05a0d6e8fa58c5b0a34d079631f68b1b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1582879 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Mathias Bynens <mathias@chromium.org> Commit-Queue: Peter Wong <peter.wm.wong@gmail.com> Cr-Commit-Position: refs/heads/master@{#61005}
This commit is contained in:
parent
3d846115d6
commit
3632d5aedf
@ -1990,6 +1990,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
|||||||
#endif // V8_INTL_SUPPORT
|
#endif // V8_INTL_SUPPORT
|
||||||
SimpleInstallFunction(isolate_, prototype, "match",
|
SimpleInstallFunction(isolate_, prototype, "match",
|
||||||
Builtins::kStringPrototypeMatch, 1, true);
|
Builtins::kStringPrototypeMatch, 1, true);
|
||||||
|
SimpleInstallFunction(isolate_, prototype, "matchAll",
|
||||||
|
Builtins::kStringPrototypeMatchAll, 1, true);
|
||||||
#ifdef V8_INTL_SUPPORT
|
#ifdef V8_INTL_SUPPORT
|
||||||
SimpleInstallFunction(isolate_, prototype, "normalize",
|
SimpleInstallFunction(isolate_, prototype, "normalize",
|
||||||
Builtins::kStringPrototypeNormalizeIntl, 0, false);
|
Builtins::kStringPrototypeNormalizeIntl, 0, false);
|
||||||
@ -2118,6 +2120,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
|||||||
InstallConstant(isolate_, symbol_fun, "iterator",
|
InstallConstant(isolate_, symbol_fun, "iterator",
|
||||||
factory->iterator_symbol());
|
factory->iterator_symbol());
|
||||||
InstallConstant(isolate_, symbol_fun, "match", factory->match_symbol());
|
InstallConstant(isolate_, symbol_fun, "match", factory->match_symbol());
|
||||||
|
InstallConstant(isolate_, symbol_fun, "matchAll",
|
||||||
|
factory->match_all_symbol());
|
||||||
InstallConstant(isolate_, symbol_fun, "replace", factory->replace_symbol());
|
InstallConstant(isolate_, symbol_fun, "replace", factory->replace_symbol());
|
||||||
InstallConstant(isolate_, symbol_fun, "search", factory->search_symbol());
|
InstallConstant(isolate_, symbol_fun, "search", factory->search_symbol());
|
||||||
InstallConstant(isolate_, symbol_fun, "species", factory->species_symbol());
|
InstallConstant(isolate_, symbol_fun, "species", factory->species_symbol());
|
||||||
@ -2486,6 +2490,12 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
|||||||
DCHECK_EQ(JSRegExp::kSymbolMatchFunctionDescriptorIndex,
|
DCHECK_EQ(JSRegExp::kSymbolMatchFunctionDescriptorIndex,
|
||||||
prototype->map()->LastAdded());
|
prototype->map()->LastAdded());
|
||||||
|
|
||||||
|
InstallFunctionAtSymbol(isolate_, prototype, factory->match_all_symbol(),
|
||||||
|
"[Symbol.matchAll]",
|
||||||
|
Builtins::kRegExpPrototypeMatchAll, 1, true);
|
||||||
|
DCHECK_EQ(JSRegExp::kSymbolMatchAllFunctionDescriptorIndex,
|
||||||
|
prototype->map()->LastAdded());
|
||||||
|
|
||||||
InstallFunctionAtSymbol(isolate_, prototype, factory->replace_symbol(),
|
InstallFunctionAtSymbol(isolate_, prototype, factory->replace_symbol(),
|
||||||
"[Symbol.replace]",
|
"[Symbol.replace]",
|
||||||
Builtins::kRegExpPrototypeReplace, 2, false);
|
Builtins::kRegExpPrototypeReplace, 2, false);
|
||||||
@ -2599,6 +2609,31 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
|||||||
JSObject::MigrateSlowToFast(regexp_fun, 0, "Bootstrapping");
|
JSObject::MigrateSlowToFast(regexp_fun, 0, "Bootstrapping");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ // --- R e g E x p S t r i n g I t e r a t o r ---
|
||||||
|
Handle<JSObject> iterator_prototype(
|
||||||
|
native_context()->initial_iterator_prototype(), isolate());
|
||||||
|
|
||||||
|
Handle<JSObject> regexp_string_iterator_prototype = factory->NewJSObject(
|
||||||
|
isolate()->object_function(), AllocationType::kOld);
|
||||||
|
JSObject::ForceSetPrototype(regexp_string_iterator_prototype,
|
||||||
|
iterator_prototype);
|
||||||
|
|
||||||
|
InstallToStringTag(isolate(), regexp_string_iterator_prototype,
|
||||||
|
"RegExp String Iterator");
|
||||||
|
|
||||||
|
SimpleInstallFunction(isolate(), regexp_string_iterator_prototype, "next",
|
||||||
|
Builtins::kRegExpStringIteratorPrototypeNext, 0,
|
||||||
|
true);
|
||||||
|
|
||||||
|
Handle<JSFunction> regexp_string_iterator_function = CreateFunction(
|
||||||
|
isolate(), "RegExpStringIterator", JS_REGEXP_STRING_ITERATOR_TYPE,
|
||||||
|
JSRegExpStringIterator::kSize, 0, regexp_string_iterator_prototype,
|
||||||
|
Builtins::kIllegal);
|
||||||
|
regexp_string_iterator_function->shared()->set_native(false);
|
||||||
|
native_context()->set_initial_regexp_string_iterator_prototype_map(
|
||||||
|
regexp_string_iterator_function->initial_map());
|
||||||
|
}
|
||||||
|
|
||||||
{ // -- E r r o r
|
{ // -- E r r o r
|
||||||
InstallError(isolate_, global, factory->Error_string(),
|
InstallError(isolate_, global, factory->Error_string(),
|
||||||
Context::ERROR_FUNCTION_INDEX);
|
Context::ERROR_FUNCTION_INDEX);
|
||||||
@ -4193,68 +4228,6 @@ void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
|
|||||||
InstallToStringTag(isolate_, isolate()->atomics_object(), "Atomics");
|
InstallToStringTag(isolate_, isolate()->atomics_object(), "Atomics");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Genesis::InitializeGlobal_harmony_string_matchall() {
|
|
||||||
if (!FLAG_harmony_string_matchall) return;
|
|
||||||
|
|
||||||
{ // String.prototype.matchAll
|
|
||||||
Handle<JSFunction> string_fun(native_context()->string_function(),
|
|
||||||
isolate());
|
|
||||||
Handle<JSObject> string_prototype(
|
|
||||||
JSObject::cast(string_fun->instance_prototype()), isolate());
|
|
||||||
|
|
||||||
SimpleInstallFunction(isolate(), string_prototype, "matchAll",
|
|
||||||
Builtins::kStringPrototypeMatchAll, 1, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
{ // RegExp.prototype[@@matchAll]
|
|
||||||
Handle<JSFunction> regexp_fun(native_context()->regexp_function(),
|
|
||||||
isolate());
|
|
||||||
Handle<JSObject> regexp_prototype(
|
|
||||||
JSObject::cast(regexp_fun->instance_prototype()), isolate());
|
|
||||||
InstallFunctionAtSymbol(isolate(), regexp_prototype,
|
|
||||||
factory()->match_all_symbol(), "[Symbol.matchAll]",
|
|
||||||
Builtins::kRegExpPrototypeMatchAll, 1, true);
|
|
||||||
DCHECK_EQ(JSRegExp::kSymbolMatchAllFunctionDescriptorIndex,
|
|
||||||
regexp_prototype->map()->LastAdded());
|
|
||||||
|
|
||||||
Handle<Map> regexp_prototype_map(regexp_prototype->map(), isolate());
|
|
||||||
Map::SetShouldBeFastPrototypeMap(regexp_prototype_map, true, isolate());
|
|
||||||
native_context()->set_regexp_prototype_map(*regexp_prototype_map);
|
|
||||||
}
|
|
||||||
|
|
||||||
{ // --- R e g E x p S t r i n g I t e r a t o r ---
|
|
||||||
Handle<JSObject> iterator_prototype(
|
|
||||||
native_context()->initial_iterator_prototype(), isolate());
|
|
||||||
|
|
||||||
Handle<JSObject> regexp_string_iterator_prototype = factory()->NewJSObject(
|
|
||||||
isolate()->object_function(), AllocationType::kOld);
|
|
||||||
JSObject::ForceSetPrototype(regexp_string_iterator_prototype,
|
|
||||||
iterator_prototype);
|
|
||||||
|
|
||||||
InstallToStringTag(isolate(), regexp_string_iterator_prototype,
|
|
||||||
"RegExp String Iterator");
|
|
||||||
|
|
||||||
SimpleInstallFunction(isolate(), regexp_string_iterator_prototype, "next",
|
|
||||||
Builtins::kRegExpStringIteratorPrototypeNext, 0,
|
|
||||||
true);
|
|
||||||
|
|
||||||
Handle<JSFunction> regexp_string_iterator_function = CreateFunction(
|
|
||||||
isolate(), "RegExpStringIterator", JS_REGEXP_STRING_ITERATOR_TYPE,
|
|
||||||
JSRegExpStringIterator::kSize, 0, regexp_string_iterator_prototype,
|
|
||||||
Builtins::kIllegal);
|
|
||||||
regexp_string_iterator_function->shared()->set_native(false);
|
|
||||||
native_context()->set_initial_regexp_string_iterator_prototype_map(
|
|
||||||
regexp_string_iterator_function->initial_map());
|
|
||||||
}
|
|
||||||
|
|
||||||
{ // @@matchAll Symbol
|
|
||||||
Handle<JSFunction> symbol_fun(native_context()->symbol_function(),
|
|
||||||
isolate());
|
|
||||||
InstallConstant(isolate(), symbol_fun, "matchAll",
|
|
||||||
factory()->match_all_symbol());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Genesis::InitializeGlobal_harmony_weak_refs() {
|
void Genesis::InitializeGlobal_harmony_weak_refs() {
|
||||||
if (!FLAG_harmony_weak_refs) return;
|
if (!FLAG_harmony_weak_refs) return;
|
||||||
|
|
||||||
|
@ -249,7 +249,6 @@ DEFINE_IMPLICATION(harmony_private_methods, harmony_private_fields)
|
|||||||
V(harmony_global, "harmony global") \
|
V(harmony_global, "harmony global") \
|
||||||
V(harmony_public_fields, "harmony public instance fields in class literals") \
|
V(harmony_public_fields, "harmony public instance fields in class literals") \
|
||||||
V(harmony_static_fields, "harmony static fields in class literals") \
|
V(harmony_static_fields, "harmony static fields in class literals") \
|
||||||
V(harmony_string_matchall, "harmony String.prototype.matchAll") \
|
|
||||||
V(harmony_object_from_entries, "harmony Object.fromEntries()") \
|
V(harmony_object_from_entries, "harmony Object.fromEntries()") \
|
||||||
V(harmony_await_optimization, "harmony await taking 1 tick") \
|
V(harmony_await_optimization, "harmony await taking 1 tick") \
|
||||||
V(harmony_private_fields, "harmony private fields in class literals") \
|
V(harmony_private_fields, "harmony private fields in class literals") \
|
||||||
|
@ -167,10 +167,10 @@ class JSRegExp : public JSObject {
|
|||||||
// Descriptor array index to important methods in the prototype.
|
// Descriptor array index to important methods in the prototype.
|
||||||
static const int kExecFunctionDescriptorIndex = 1;
|
static const int kExecFunctionDescriptorIndex = 1;
|
||||||
static const int kSymbolMatchFunctionDescriptorIndex = 13;
|
static const int kSymbolMatchFunctionDescriptorIndex = 13;
|
||||||
static const int kSymbolReplaceFunctionDescriptorIndex = 14;
|
static const int kSymbolMatchAllFunctionDescriptorIndex = 14;
|
||||||
static const int kSymbolSearchFunctionDescriptorIndex = 15;
|
static const int kSymbolReplaceFunctionDescriptorIndex = 15;
|
||||||
static const int kSymbolSplitFunctionDescriptorIndex = 16;
|
static const int kSymbolSearchFunctionDescriptorIndex = 16;
|
||||||
static const int kSymbolMatchAllFunctionDescriptorIndex = 17;
|
static const int kSymbolSplitFunctionDescriptorIndex = 17;
|
||||||
|
|
||||||
// The uninitialized value for a regexp code object.
|
// The uninitialized value for a regexp code object.
|
||||||
static const int kUninitializedValue = -1;
|
static const int kUninitializedValue = -1;
|
||||||
|
@ -160,9 +160,6 @@
|
|||||||
"name": "StringMatchAll",
|
"name": "StringMatchAll",
|
||||||
"main": "run.js",
|
"main": "run.js",
|
||||||
"resources": [ "string-matchall.js" ],
|
"resources": [ "string-matchall.js" ],
|
||||||
"flags": [
|
|
||||||
"--harmony-string-matchall"
|
|
||||||
],
|
|
||||||
"test_flags": [ "string-matchall" ],
|
"test_flags": [ "string-matchall" ],
|
||||||
"results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
|
"results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
|
||||||
"run_count": 1,
|
"run_count": 1,
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --harmony-string-matchall
|
|
||||||
|
|
||||||
delete RegExp.prototype[Symbol.matchAll];
|
delete RegExp.prototype[Symbol.matchAll];
|
||||||
const str = 'a';
|
const str = 'a';
|
||||||
assertThrows(() => str.matchAll(/\w/g), TypeError);
|
assertThrows(() => str.matchAll(/\w/g), TypeError);
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --harmony-string-matchall
|
|
||||||
|
|
||||||
(function TestReceiverNonString() {
|
(function TestReceiverNonString() {
|
||||||
const iter = 'a'.matchAll(/./);
|
const iter = 'a'.matchAll(/./);
|
||||||
assertThrows(
|
assertThrows(
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --harmony-string-matchall
|
|
||||||
|
|
||||||
var s = "baa";
|
var s = "baa";
|
||||||
|
|
||||||
assertEquals([["b"]], [...s.matchAll(/./)]);
|
assertEquals([["b"]], [...s.matchAll(/./)]);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --allow-natives-syntax --harmony-string-matchall
|
// Flags: --allow-natives-syntax
|
||||||
|
|
||||||
class MyRegExp {
|
class MyRegExp {
|
||||||
exec() { return null; }
|
exec() { return null; }
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --allow-natives-syntax --harmony-string-matchall
|
// Flags: --allow-natives-syntax
|
||||||
|
|
||||||
class MyRegExp {
|
class MyRegExp {
|
||||||
exec() { return null; }
|
exec() { return null; }
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --harmony-string-matchall
|
|
||||||
|
|
||||||
''.matchAll(/./u);
|
''.matchAll(/./u);
|
||||||
|
@ -48,8 +48,6 @@ FEATURE_FLAGS = {
|
|||||||
'class-static-fields-public': '--harmony-class-fields',
|
'class-static-fields-public': '--harmony-class-fields',
|
||||||
'class-fields-private': '--harmony-private-fields',
|
'class-fields-private': '--harmony-private-fields',
|
||||||
'class-static-fields-private': '--harmony-private-fields',
|
'class-static-fields-private': '--harmony-private-fields',
|
||||||
'String.prototype.matchAll': '--harmony-string-matchall',
|
|
||||||
'Symbol.matchAll': '--harmony-string-matchall',
|
|
||||||
'numeric-separator-literal': '--harmony-numeric-separator',
|
'numeric-separator-literal': '--harmony-numeric-separator',
|
||||||
'Intl.DateTimeFormat-datetimestyle': '--harmony-intl-datetime-style',
|
'Intl.DateTimeFormat-datetimestyle': '--harmony-intl-datetime-style',
|
||||||
'Intl.Locale': '--harmony-locale',
|
'Intl.Locale': '--harmony-locale',
|
||||||
|
Loading…
Reference in New Issue
Block a user