Remove --harmony-optional-chaining and --harmony-nullish

Both features shipped in M80.

Bug: v8:9547, v8:9553
Change-Id: I7a34db05796f22bcc112c36a42826e7c926a7364
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2154768
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Auto-Submit: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67219}
This commit is contained in:
Shu-yu Guo 2020-04-17 16:32:27 -07:00 committed by Commit Bot
parent 1d8f1376b4
commit df4df03103
11 changed files with 5 additions and 72 deletions

View File

@ -253,8 +253,6 @@ DEFINE_IMPLICATION(harmony_weak_refs_with_cleanup_some, harmony_weak_refs)
V(harmony_import_meta, "harmony import.meta property") \
V(harmony_dynamic_import, "harmony dynamic import") \
V(harmony_promise_all_settled, "harmony Promise.allSettled") \
V(harmony_nullish, "harmony nullish operator") \
V(harmony_optional_chaining, "harmony optional chaining syntax") \
V(harmony_private_methods, "harmony private methods in class literals")
#ifdef V8_INTL_SUPPORT

View File

@ -4237,8 +4237,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_private_methods)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_dynamic_import)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_meta)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_sequence)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_optional_chaining)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_nullish)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_top_level_await)
#ifdef V8_INTL_SUPPORT

View File

@ -64,8 +64,6 @@ ParseInfo::ParseInfo(Isolate* isolate, AccountingAllocator* zone_allocator,
set_allow_natives_syntax(FLAG_allow_natives_syntax);
set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import);
set_allow_harmony_import_meta(FLAG_harmony_import_meta);
set_allow_harmony_optional_chaining(FLAG_harmony_optional_chaining);
set_allow_harmony_nullish(FLAG_harmony_nullish);
set_allow_harmony_private_methods(FLAG_harmony_private_methods);
set_allow_harmony_top_level_await(FLAG_harmony_top_level_await);
}

View File

@ -105,15 +105,11 @@ class V8_EXPORT_PRIVATE ParseInfo {
set_allow_harmony_dynamic_import)
FLAG_ACCESSOR(kAllowHarmonyImportMeta, allow_harmony_import_meta,
set_allow_harmony_import_meta)
FLAG_ACCESSOR(kAllowHarmonyOptionalChaining, allow_harmony_optional_chaining,
set_allow_harmony_optional_chaining)
FLAG_ACCESSOR(kAllowHarmonyPrivateMethods, allow_harmony_private_methods,
set_allow_harmony_private_methods)
FLAG_ACCESSOR(kIsOneshotIIFE, is_oneshot_iife, set_is_oneshot_iife)
FLAG_ACCESSOR(kCollectSourcePositions, collect_source_positions,
set_collect_source_positions)
FLAG_ACCESSOR(kAllowHarmonyNullish, allow_harmony_nullish,
set_allow_harmony_nullish)
FLAG_ACCESSOR(kAllowHarmonyTopLevelAwait, allow_harmony_top_level_await,
set_allow_harmony_top_level_await)
FLAG_ACCESSOR(kREPLMode, is_repl_mode, set_repl_mode)

View File

@ -286,22 +286,6 @@ class ParserBase {
V8_INLINE bool has_error() const { return scanner()->has_parser_error(); }
bool allow_harmony_optional_chaining() const {
return scanner()->allow_harmony_optional_chaining();
}
void set_allow_harmony_optional_chaining(bool allow) {
scanner()->set_allow_harmony_optional_chaining(allow);
}
bool allow_harmony_nullish() const {
return scanner()->allow_harmony_nullish();
}
void set_allow_harmony_nullish(bool allow) {
scanner()->set_allow_harmony_nullish(allow);
}
uintptr_t stack_limit() const { return stack_limit_; }
void set_stack_limit(uintptr_t stack_limit) { stack_limit_ = stack_limit; }

View File

@ -455,8 +455,6 @@ Parser::Parser(ParseInfo* info)
set_allow_natives(info->allow_natives_syntax());
set_allow_harmony_dynamic_import(info->allow_harmony_dynamic_import());
set_allow_harmony_import_meta(info->allow_harmony_import_meta());
set_allow_harmony_nullish(info->allow_harmony_nullish());
set_allow_harmony_optional_chaining(info->allow_harmony_optional_chaining());
set_allow_harmony_private_methods(info->allow_harmony_private_methods());
set_allow_harmony_top_level_await(info->allow_harmony_top_level_await());
for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;

View File

@ -366,11 +366,11 @@ V8_INLINE Token::Value Scanner::ScanSingleToken() {
case Token::CONDITIONAL:
// ? ?. ??
Advance();
if (V8_UNLIKELY(allow_harmony_optional_chaining() && c0_ == '.')) {
if (c0_ == '.') {
Advance();
if (!IsDecimalDigit(c0_)) return Token::QUESTION_PERIOD;
PushBack('.');
} else if (V8_UNLIKELY(allow_harmony_nullish() && c0_ == '?')) {
} else if (c0_ == '?') {
return Select(Token::NULLISH);
}
return Token::CONDITIONAL;

View File

@ -92,8 +92,6 @@ bool Scanner::BookmarkScope::HasBeenApplied() const {
Scanner::Scanner(Utf16CharacterStream* source, bool is_module)
: source_(source),
found_html_comment_(false),
allow_harmony_optional_chaining_(false),
allow_harmony_nullish_(false),
is_module_(is_module),
octal_pos_(Location::invalid()),
octal_message_(MessageTemplate::kNone) {

View File

@ -410,18 +410,6 @@ class V8_EXPORT_PRIVATE Scanner {
bool FoundHtmlComment() const { return found_html_comment_; }
bool allow_harmony_optional_chaining() const {
return allow_harmony_optional_chaining_;
}
void set_allow_harmony_optional_chaining(bool allow) {
allow_harmony_optional_chaining_ = allow;
}
bool allow_harmony_nullish() const { return allow_harmony_nullish_; }
void set_allow_harmony_nullish(bool allow) { allow_harmony_nullish_ = allow; }
const Utf16CharacterStream* stream() const { return source_; }
private:
@ -730,10 +718,6 @@ class V8_EXPORT_PRIVATE Scanner {
// Whether this scanner encountered an HTML comment.
bool found_html_comment_;
// Harmony flags to allow ESNext features.
bool allow_harmony_optional_chaining_;
bool allow_harmony_nullish_;
const bool is_module_;
// Values parsed from magic comments.

View File

@ -1534,8 +1534,6 @@ enum ParserFlag {
kAllowHarmonyPrivateMethods,
kAllowHarmonyDynamicImport,
kAllowHarmonyImportMeta,
kAllowHarmonyNullish,
kAllowHarmonyOptionalChaining,
};
enum ParserSyncTestResult {
@ -1549,9 +1547,6 @@ void SetGlobalFlags(base::EnumSet<ParserFlag> flags) {
i::FLAG_harmony_private_methods = flags.contains(kAllowHarmonyPrivateMethods);
i::FLAG_harmony_dynamic_import = flags.contains(kAllowHarmonyDynamicImport);
i::FLAG_harmony_import_meta = flags.contains(kAllowHarmonyImportMeta);
i::FLAG_harmony_optional_chaining =
flags.contains(kAllowHarmonyOptionalChaining);
i::FLAG_harmony_nullish = flags.contains(kAllowHarmonyNullish);
}
void SetParserFlags(i::PreParser* parser, base::EnumSet<ParserFlag> flags) {
@ -1562,9 +1557,6 @@ void SetParserFlags(i::PreParser* parser, base::EnumSet<ParserFlag> flags) {
flags.contains(kAllowHarmonyDynamicImport));
parser->set_allow_harmony_import_meta(
flags.contains(kAllowHarmonyImportMeta));
parser->set_allow_harmony_optional_chaining(
flags.contains(kAllowHarmonyOptionalChaining));
parser->set_allow_harmony_nullish(flags.contains(kAllowHarmonyNullish));
}
void TestParserSyncWithFlags(i::Handle<i::String> source,
@ -1995,10 +1987,7 @@ TEST(OptionalChaining) {
{"", ""}, {"'use strict';", ""}, {nullptr, nullptr}};
const char* statement_data[] = {"a?.b", "a?.['b']", "a?.()", nullptr};
static const ParserFlag flags[] = {kAllowHarmonyOptionalChaining};
RunParserSyncTest(context_data, statement_data, kSuccess, nullptr, 0, flags,
1, nullptr, 0, false, true, true);
RunParserSyncTest(context_data, statement_data, kError);
RunParserSyncTest(context_data, statement_data, kSuccess);
}
TEST(OptionalChainingTaggedError) {
@ -2010,9 +1999,6 @@ TEST(OptionalChainingTaggedError) {
{"", ""}, {"'use strict';", ""}, {nullptr, nullptr}};
const char* statement_data[] = {"a?.b``", "a?.['b']``", "a?.()``", nullptr};
static const ParserFlag flags[] = {kAllowHarmonyOptionalChaining};
RunParserSyncTest(context_data, statement_data, kError, nullptr, 9, flags, 1,
nullptr, 0, false, true, true);
RunParserSyncTest(context_data, statement_data, kError);
}
@ -2028,10 +2014,7 @@ TEST(Nullish) {
"a ?? b ?? c ? d : e",
nullptr};
static const ParserFlag flags[] = {kAllowHarmonyNullish};
RunParserSyncTest(context_data, statement_data, kSuccess, nullptr, 0, flags,
1, nullptr, 0, false, true, true);
RunParserSyncTest(context_data, statement_data, kError);
RunParserSyncTest(context_data, statement_data, kSuccess);
}
TEST(NullishNotContained) {
@ -2046,9 +2029,7 @@ TEST(NullishNotContained) {
"a ?? b && c",
nullptr};
static const ParserFlag flags[] = {kAllowHarmonyNullish};
RunParserSyncTest(context_data, statement_data, kError, nullptr, 0, flags, 1,
nullptr, 0, false, true, true);
RunParserSyncTest(context_data, statement_data, kError);
}
TEST(ErrorsEvalAndArguments) {

View File

@ -56,14 +56,12 @@ FEATURE_FLAGS = {
'FinalizationRegistry': '--harmony-weak-refs-with-cleanup-some',
'WeakRef': '--harmony-weak-refs-with-cleanup-some',
'host-gc-required': '--expose-gc-as=v8GC',
'optional-chaining': '--harmony-optional-chaining',
'top-level-await': '--harmony-top-level-await',
'regexp-match-indices': '--harmony-regexp-match-indices',
# https://github.com/tc39/test262/pull/2395
'regexp-named-groups': '--harmony-regexp-match-indices',
'class-methods-private': '--harmony-private-methods',
'class-static-methods-private': '--harmony-private-methods',
'coalesce-expression': '--harmony-nullish',
}
SKIPPED_FEATURES = set([])