Commit 49dc0e31 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by Commit Bot

[flags] Remove --harmony-dynamic-import

It's shipped since M63.

Bug: v8:5785
Change-Id: Iaa591890edc560bc58b7a6b18ad5787d747f1ba4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2509942Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70953}
parent 4b6455aa
......@@ -242,8 +242,6 @@ DEFINE_BOOL(es_staging, false,
DEFINE_BOOL(harmony, false, "enable all completed harmony features")
DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
DEFINE_IMPLICATION(es_staging, harmony)
// Enabling import.meta requires to also enable import()
DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import)
// Enabling FinalizationRegistry#cleanupSome also enables weak refs
DEFINE_IMPLICATION(harmony_weak_refs_with_cleanup_some, harmony_weak_refs)
......@@ -285,7 +283,6 @@ DEFINE_IMPLICATION(harmony_weak_refs_with_cleanup_some, harmony_weak_refs)
V(harmony_sharedarraybuffer, "harmony sharedarraybuffer") \
V(harmony_atomics, "harmony atomics") \
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_promise_any, "harmony Promise.any") \
V(harmony_private_methods, "harmony private methods in class literals") \
......
......@@ -4128,7 +4128,6 @@ void Genesis::InitializeCallSiteBuiltins() {
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_namespace_exports)
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_top_level_await)
......
......@@ -32,7 +32,6 @@ UnoptimizedCompileFlags::UnoptimizedCompileFlags(Isolate* isolate,
set_might_always_opt(FLAG_always_opt || FLAG_prepare_always_opt);
set_allow_natives_syntax(FLAG_allow_natives_syntax);
set_allow_lazy_compile(FLAG_lazy);
set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import);
set_allow_harmony_import_meta(FLAG_harmony_import_meta);
set_allow_harmony_private_methods(FLAG_harmony_private_methods);
set_collect_source_positions(!FLAG_enable_lazy_source_positions ||
......
......@@ -60,7 +60,6 @@ class Zone;
V(might_always_opt, bool, 1, _) \
V(allow_natives_syntax, bool, 1, _) \
V(allow_lazy_compile, bool, 1, _) \
V(allow_harmony_dynamic_import, bool, 1, _) \
V(allow_harmony_import_meta, bool, 1, _) \
V(allow_harmony_private_methods, bool, 1, _) \
V(is_oneshot_iife, bool, 1, _) \
......
......@@ -1853,7 +1853,6 @@ ParserBase<Impl>::ParsePrimaryExpression() {
return ParseSuperExpression(is_new);
}
case Token::IMPORT:
if (!flags().allow_harmony_dynamic_import()) break;
return ParseImportExpressions();
case Token::LBRACK:
......@@ -3439,9 +3438,7 @@ ParserBase<Impl>::ParseMemberWithPresentNewPrefixesExpression() {
if (peek() == Token::SUPER) {
const bool is_new = true;
result = ParseSuperExpression(is_new);
} else if (flags().allow_harmony_dynamic_import() &&
peek() == Token::IMPORT &&
(!flags().allow_harmony_import_meta() ||
} else if (peek() == Token::IMPORT && (!flags().allow_harmony_import_meta() ||
PeekAhead() == Token::LPAREN)) {
impl()->ReportMessageAt(scanner()->peek_location(),
MessageTemplate::kImportCallNotNewExpression);
......@@ -3540,8 +3537,6 @@ ParserBase<Impl>::ParseMemberExpression() {
template <typename Impl>
typename ParserBase<Impl>::ExpressionT
ParserBase<Impl>::ParseImportExpressions() {
DCHECK(flags().allow_harmony_dynamic_import());
Consume(Token::IMPORT);
int pos = position();
if (flags().allow_harmony_import_meta() && Check(Token::PERIOD)) {
......
......@@ -1034,8 +1034,7 @@ Statement* Parser::ParseModuleItem() {
// We must be careful not to parse a dynamic import expression as an import
// declaration. Same for import.meta expressions.
Token::Value peek_ahead = PeekAhead();
if ((!flags().allow_harmony_dynamic_import() ||
peek_ahead != Token::LPAREN) &&
if (peek_ahead != Token::LPAREN &&
(!flags().allow_harmony_import_meta() || peek_ahead != Token::PERIOD)) {
ParseImportDeclaration();
return factory()->EmptyStatement();
......
......@@ -26037,7 +26037,6 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallbackResolve(
}
TEST(DynamicImport) {
i::FLAG_harmony_dynamic_import = true;
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
......@@ -26071,7 +26070,6 @@ void HostInitializeImportMetaObjectCallbackStatic(Local<Context> context,
}
TEST(ImportMeta) {
i::FLAG_harmony_dynamic_import = true;
i::FLAG_harmony_import_meta = true;
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
......@@ -26123,7 +26121,6 @@ void HostInitializeImportMetaObjectCallbackThrow(Local<Context> context,
}
TEST(ImportMetaThrowUnhandled) {
i::FLAG_harmony_dynamic_import = true;
i::FLAG_harmony_import_meta = true;
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
......@@ -26164,7 +26161,6 @@ TEST(ImportMetaThrowUnhandled) {
}
TEST(ImportMetaThrowHandled) {
i::FLAG_harmony_dynamic_import = true;
i::FLAG_harmony_import_meta = true;
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
......@@ -808,9 +808,7 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallbackReject(
TEST(ModuleEvaluationTopLevelAwaitDynamicImport) {
bool previous_top_level_await_flag_value = i::FLAG_harmony_top_level_await;
bool previous_dynamic_import_flag_value = i::FLAG_harmony_dynamic_import;
i::FLAG_harmony_top_level_await = true;
i::FLAG_harmony_dynamic_import = true;
Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
......@@ -847,14 +845,11 @@ TEST(ModuleEvaluationTopLevelAwaitDynamicImport) {
CHECK_EQ(promise->State(), v8::Promise::kFulfilled);
}
i::FLAG_harmony_top_level_await = previous_top_level_await_flag_value;
i::FLAG_harmony_dynamic_import = previous_dynamic_import_flag_value;
}
TEST(ModuleEvaluationTopLevelAwaitDynamicImportError) {
bool previous_top_level_await_flag_value = i::FLAG_harmony_top_level_await;
bool previous_dynamic_import_flag_value = i::FLAG_harmony_dynamic_import;
i::FLAG_harmony_top_level_await = true;
i::FLAG_harmony_dynamic_import = true;
Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
......@@ -895,7 +890,6 @@ TEST(ModuleEvaluationTopLevelAwaitDynamicImportError) {
CHECK(!try_catch.HasCaught());
}
i::FLAG_harmony_top_level_await = previous_top_level_await_flag_value;
i::FLAG_harmony_dynamic_import = previous_dynamic_import_flag_value;
}
TEST(TerminateExecutionTopLevelAwaitSync) {
......
......@@ -1620,7 +1620,6 @@ enum ParserFlag {
kAllowLazy,
kAllowNatives,
kAllowHarmonyPrivateMethods,
kAllowHarmonyDynamicImport,
kAllowHarmonyImportMeta,
kAllowHarmonyLogicalAssignment,
};
......@@ -1634,7 +1633,6 @@ enum ParserSyncTestResult {
void SetGlobalFlags(base::EnumSet<ParserFlag> flags) {
i::FLAG_allow_natives_syntax = flags.contains(kAllowNatives);
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_logical_assignment =
flags.contains(kAllowHarmonyLogicalAssignment);
......@@ -1645,8 +1643,6 @@ void SetParserFlags(i::UnoptimizedCompileFlags* compile_flags,
compile_flags->set_allow_natives_syntax(flags.contains(kAllowNatives));
compile_flags->set_allow_harmony_private_methods(
flags.contains(kAllowHarmonyPrivateMethods));
compile_flags->set_allow_harmony_dynamic_import(
flags.contains(kAllowHarmonyDynamicImport));
compile_flags->set_allow_harmony_import_meta(
flags.contains(kAllowHarmonyImportMeta));
compile_flags->set_allow_harmony_logical_assignment(
......@@ -4862,23 +4858,8 @@ TEST(ImportExpressionSuccess) {
// clang-format on
// We ignore test error messages because the error message from the
// parser/preparser is different for the same data depending on the
// context.
// For example, a top level "import(" is parsed as an
// import declaration. The parser parses the import token correctly
// and then shows an "Unexpected token '('" error message. The
// preparser does not understand the import keyword (this test is
// run without kAllowHarmonyDynamicImport flag), so this results in
// an "Unexpected token 'import'" error.
RunParserSyncTest(context_data, data, kError);
RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0,
nullptr, 0, true, true);
static const ParserFlag flags[] = {kAllowHarmonyDynamicImport};
RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, flags,
arraysize(flags));
RunModuleParserSyncTest(context_data, data, kSuccess, nullptr, 0, flags,
arraysize(flags));
RunParserSyncTest(context_data, data, kSuccess);
RunModuleParserSyncTest(context_data, data, kSuccess);
}
TEST(ImportExpressionErrors) {
......@@ -4924,13 +4905,6 @@ TEST(ImportExpressionErrors) {
// clang-format on
RunParserSyncTest(context_data, data, kError);
// We ignore the error messages for the reason explained in the
// ImportExpressionSuccess test.
RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0,
nullptr, 0, true, true);
static const ParserFlag flags[] = {kAllowHarmonyDynamicImport};
RunParserSyncTest(context_data, data, kError, nullptr, 0, flags,
arraysize(flags));
// We ignore test error messages because the error message from
// the parser/preparser is different for the same data depending
......@@ -4939,8 +4913,8 @@ TEST(ImportExpressionErrors) {
// correctly and then shows an "Unexpected end of input" error
// message because of the '{'. The preparser shows an "Unexpected
// token '{'" because it's not a valid token in a CallExpression.
RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, flags,
arraysize(flags), nullptr, 0, true, true);
RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0,
nullptr, 0, true, true);
}
{
......@@ -4960,11 +4934,8 @@ TEST(ImportExpressionErrors) {
RunParserSyncTest(context_data, data, kError);
RunModuleParserSyncTest(context_data, data, kError);
static const ParserFlag flags[] = {kAllowHarmonyDynamicImport};
RunParserSyncTest(context_data, data, kError, nullptr, 0, flags,
arraysize(flags));
RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, flags,
arraysize(flags));
RunParserSyncTest(context_data, data, kError);
RunModuleParserSyncTest(context_data, data, kError);
}
// Import statements as arrow function params and destructuring targets.
......@@ -4993,11 +4964,8 @@ TEST(ImportExpressionErrors) {
RunParserSyncTest(context_data, data, kError);
RunModuleParserSyncTest(context_data, data, kError);
static const ParserFlag flags[] = {kAllowHarmonyDynamicImport};
RunParserSyncTest(context_data, data, kError, nullptr, 0, flags,
arraysize(flags));
RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, flags,
arraysize(flags));
RunParserSyncTest(context_data, data, kError);
RunModuleParserSyncTest(context_data, data, kError);
}
}
......@@ -9575,9 +9543,7 @@ TEST(ImportMetaSuccess) {
RunModuleParserSyncTest(context_data, data, kError, nullptr, 0, nullptr, 0,
nullptr, 0, true, true);
static const ParserFlag flags[] = {
kAllowHarmonyImportMeta, kAllowHarmonyDynamicImport,
};
static const ParserFlag flags[] = {kAllowHarmonyImportMeta};
// 2.1.1 Static Semantics: Early Errors
// ImportMeta
// * It is an early Syntax Error if Module is not the syntactic goal symbol.
......@@ -9613,9 +9579,7 @@ TEST(ImportMetaFailure) {
// clang-format on
static const ParserFlag flags[] = {
kAllowHarmonyImportMeta, kAllowHarmonyDynamicImport,
};
static const ParserFlag flags[] = {kAllowHarmonyImportMeta};
RunParserSyncTest(context_data, data, kError, nullptr, 0, flags,
arraysize(flags));
......
// Copyright 2016 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: --harmony-dynamic-import
import();
*%(basename)s:7: SyntaxError: import() requires a specifier
*%(basename)s:5: SyntaxError: import() requires a specifier
import();
^
SyntaxError: import() requires a specifier
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