Commit 3ee4804f authored by Shu-yu Guo's avatar Shu-yu Guo Committed by V8 LUCI CQ

[top-level-await] Remove --harmony-top-level-await

TLA has been shipped since v8.9.

Bug: v8:9344, chromium:1271114
Change-Id: Ibebf21da8bacb1f0d212390133847495ad8553e5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3307103
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78169}
parent 7fd80194
......@@ -37,7 +37,6 @@ namespace internal {
T(AwaitNotInAsyncContext, \
"await is only valid in async functions and the top level bodies of " \
"modules") \
T(AwaitNotInAsyncFunction, "await is only valid in async function") \
T(AwaitNotInDebugEvaluate, \
"await can not be used when evaluating code " \
"while paused in the debugger") \
......
......@@ -1137,14 +1137,10 @@ MaybeLocal<Value> Shell::JSONModuleEvaluationSteps(Local<Context> context,
CHECK(!try_catch.HasCaught());
CHECK(!result.IsNothing() && result.FromJust());
if (i::FLAG_harmony_top_level_await) {
Local<Promise::Resolver> resolver =
Promise::Resolver::New(context).ToLocalChecked();
resolver->Resolve(context, Undefined(isolate)).ToChecked();
return resolver->GetPromise();
}
return Undefined(isolate);
Local<Promise::Resolver> resolver =
Promise::Resolver::New(context).ToLocalChecked();
resolver->Resolve(context, Undefined(isolate)).ToChecked();
return resolver->GetPromise();
}
struct DynamicImportData {
......@@ -1322,7 +1318,7 @@ void Shell::DoHostImportModuleDynamically(void* import_data) {
if (root_module->InstantiateModule(realm, ResolveModuleCallback)
.FromMaybe(false)) {
maybe_result = root_module->Evaluate(realm);
CHECK_IMPLIES(i::FLAG_harmony_top_level_await, !maybe_result.IsEmpty());
CHECK(!maybe_result.IsEmpty());
EmptyMessageQueues(isolate);
}
......@@ -1334,28 +1330,21 @@ void Shell::DoHostImportModuleDynamically(void* import_data) {
}
Local<Value> module_namespace = root_module->GetModuleNamespace();
if (i::FLAG_harmony_top_level_await) {
Local<Promise> result_promise(result.As<Promise>());
// Setup callbacks, and then chain them to the result promise.
// ModuleResolutionData will be deleted by the callbacks.
auto module_resolution_data =
new ModuleResolutionData(isolate, module_namespace, resolver);
Local<v8::External> edata = External::New(isolate, module_resolution_data);
Local<Function> callback_success;
CHECK(Function::New(realm, ModuleResolutionSuccessCallback, edata)
.ToLocal(&callback_success));
Local<Function> callback_failure;
CHECK(Function::New(realm, ModuleResolutionFailureCallback, edata)
.ToLocal(&callback_failure));
result_promise->Then(realm, callback_success, callback_failure)
.ToLocalChecked();
} else {
// TODO(cbruni): Clean up exception handling after introducing new
// API for evaluating async modules.
DCHECK(!try_catch.HasCaught());
resolver->Resolve(realm, module_namespace).ToChecked();
}
Local<Promise> result_promise(result.As<Promise>());
// Setup callbacks, and then chain them to the result promise.
// ModuleResolutionData will be deleted by the callbacks.
auto module_resolution_data =
new ModuleResolutionData(isolate, module_namespace, resolver);
Local<v8::External> edata = External::New(isolate, module_resolution_data);
Local<Function> callback_success;
CHECK(Function::New(realm, ModuleResolutionSuccessCallback, edata)
.ToLocal(&callback_success));
Local<Function> callback_failure;
CHECK(Function::New(realm, ModuleResolutionFailureCallback, edata)
.ToLocal(&callback_failure));
result_promise->Then(realm, callback_success, callback_failure)
.ToLocalChecked();
}
bool Shell::ExecuteModule(Isolate* isolate, const char* file_name) {
......@@ -1387,7 +1376,7 @@ bool Shell::ExecuteModule(Isolate* isolate, const char* file_name) {
if (root_module->InstantiateModule(realm, ResolveModuleCallback)
.FromMaybe(false)) {
maybe_result = root_module->Evaluate(realm);
CHECK_IMPLIES(i::FLAG_harmony_top_level_await, !maybe_result.IsEmpty());
CHECK(!maybe_result.IsEmpty());
EmptyMessageQueues(isolate);
}
Local<Value> result;
......@@ -1396,28 +1385,27 @@ bool Shell::ExecuteModule(Isolate* isolate, const char* file_name) {
ReportException(isolate, &try_catch);
return false;
}
if (i::FLAG_harmony_top_level_await) {
// Loop until module execution finishes
// TODO(cbruni): This is a bit wonky. "Real" engines would not be
// able to just busy loop waiting for execution to finish.
Local<Promise> result_promise(result.As<Promise>());
while (result_promise->State() == Promise::kPending) {
isolate->PerformMicrotaskCheckpoint();
}
if (result_promise->State() == Promise::kRejected) {
// If the exception has been caught by the promise pipeline, we rethrow
// here in order to ReportException.
// TODO(cbruni): Clean this up after we create a new API for the case
// where TLA is enabled.
if (!try_catch.HasCaught()) {
isolate->ThrowException(result_promise->Result());
} else {
DCHECK_EQ(try_catch.Exception(), result_promise->Result());
}
ReportException(isolate, &try_catch);
return false;
// Loop until module execution finishes
// TODO(cbruni): This is a bit wonky. "Real" engines would not be
// able to just busy loop waiting for execution to finish.
Local<Promise> result_promise(result.As<Promise>());
while (result_promise->State() == Promise::kPending) {
isolate->PerformMicrotaskCheckpoint();
}
if (result_promise->State() == Promise::kRejected) {
// If the exception has been caught by the promise pipeline, we rethrow
// here in order to ReportException.
// TODO(cbruni): Clean this up after we create a new API for the case
// where TLA is enabled.
if (!try_catch.HasCaught()) {
isolate->ThrowException(result_promise->Result());
} else {
DCHECK_EQ(try_catch.Exception(), result_promise->Result());
}
ReportException(isolate, &try_catch);
return false;
}
DCHECK(!try_catch.HasCaught());
......
......@@ -336,7 +336,6 @@ DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
V(harmony_sharedarraybuffer, "harmony sharedarraybuffer") \
V(harmony_atomics, "harmony atomics") \
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") \
V(harmony_error_cause, "harmony error cause property") \
V(harmony_object_has_own, "harmony Object.hasOwn") \
......
......@@ -4394,7 +4394,6 @@ void Genesis::InitializeCallSiteBuiltins() {
#define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \
void Genesis::InitializeGlobal_##id() {}
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_top_level_await)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_assertions)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_private_brand_checks)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_static_blocks)
......
......@@ -247,11 +247,7 @@ MaybeHandle<Object> Module::Evaluate(Isolate* isolate, Handle<Module> module) {
PrintStatusMessage(*module, "Evaluating module ");
#endif // DEBUG
STACK_CHECK(isolate, MaybeHandle<Object>());
if (FLAG_harmony_top_level_await) {
return Module::EvaluateMaybeAsync(isolate, module);
} else {
return Module::InnerEvaluate(isolate, module);
}
return Module::EvaluateMaybeAsync(isolate, module);
}
MaybeHandle<Object> Module::EvaluateMaybeAsync(Isolate* isolate,
......@@ -300,32 +296,6 @@ MaybeHandle<Object> Module::EvaluateMaybeAsync(Isolate* isolate,
}
}
MaybeHandle<Object> Module::InnerEvaluate(Isolate* isolate,
Handle<Module> module) {
if (module->status() == kErrored) {
isolate->Throw(module->GetException());
return MaybeHandle<Object>();
} else if (module->status() == kEvaluated) {
return isolate->factory()->undefined_value();
}
// InnerEvaluate can be called both to evaluate top level modules without
// the harmony_top_level_await flag and recursively to evaluate
// SyntheticModules in the dependency graphs of SourceTextModules.
//
// However, SyntheticModules transition directly to 'Evaluated,' so we should
// never see an 'Evaluating' module at this point.
CHECK_EQ(module->status(), kLinked);
if (module->IsSourceTextModule()) {
return SourceTextModule::Evaluate(isolate,
Handle<SourceTextModule>::cast(module));
} else {
return SyntheticModule::Evaluate(isolate,
Handle<SyntheticModule>::cast(module));
}
}
Handle<JSModuleNamespace> Module::GetModuleNamespace(Isolate* isolate,
Handle<Module> module) {
Handle<HeapObject> object(module->module_namespace(), isolate);
......
......@@ -119,9 +119,6 @@ class Module : public TorqueGeneratedModule<Module, HeapObject> {
static V8_WARN_UNUSED_RESULT MaybeHandle<Object> EvaluateMaybeAsync(
Isolate* isolate, Handle<Module> module);
static V8_WARN_UNUSED_RESULT MaybeHandle<Object> InnerEvaluate(
Isolate* isolate, Handle<Module> module);
// Set module's status back to kUnlinked and reset other internal state.
// This is used when instantiation fails.
static void Reset(Isolate* isolate, Handle<Module> module);
......
......@@ -1008,20 +1008,12 @@ MaybeHandle<Object> SourceTextModule::ExecuteModule(
isolate->native_context()->generator_next_internal(), isolate);
Handle<Object> result;
// With top_level_await, we need to catch any exceptions and reject
// the top level capability.
if (FLAG_harmony_top_level_await) {
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
Execution::TryCall(isolate, resume, generator, 0, nullptr,
Execution::MessageHandling::kKeepPending, nullptr,
false),
Object);
} else {
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
Execution::Call(isolate, resume, generator, 0, nullptr), Object);
}
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
Execution::TryCall(isolate, resume, generator, 0, nullptr,
Execution::MessageHandling::kKeepPending, nullptr,
false),
Object);
DCHECK(JSIteratorResult::cast(*result).done().BooleanValue(isolate));
return handle(JSIteratorResult::cast(*result).value(), isolate);
}
......
......@@ -119,23 +119,21 @@ MaybeHandle<Object> SyntheticModule::Evaluate(Isolate* isolate,
Handle<Object> result_from_callback = Utils::OpenHandle(*result);
if (FLAG_harmony_top_level_await) {
Handle<JSPromise> capability;
if (result_from_callback->IsJSPromise()) {
capability = Handle<JSPromise>::cast(result_from_callback);
} else {
// The host's evaluation steps should have returned a resolved Promise,
// but as an allowance to hosts that have not yet finished the migration
// to top-level await, create a Promise if the callback result didn't give
// us one.
capability = isolate->factory()->NewJSPromise();
JSPromise::Resolve(capability, isolate->factory()->undefined_value())
.ToHandleChecked();
}
module->set_top_level_capability(*capability);
Handle<JSPromise> capability;
if (result_from_callback->IsJSPromise()) {
capability = Handle<JSPromise>::cast(result_from_callback);
} else {
// The host's evaluation steps should have returned a resolved Promise,
// but as an allowance to hosts that have not yet finished the migration
// to top-level await, create a Promise if the callback result didn't give
// us one.
capability = isolate->factory()->NewJSPromise();
JSPromise::Resolve(capability, isolate->factory()->undefined_value())
.ToHandleChecked();
}
module->set_top_level_capability(*capability);
return result_from_callback;
}
......
......@@ -36,7 +36,6 @@ UnoptimizedCompileFlags::UnoptimizedCompileFlags(Isolate* isolate,
set_allow_lazy_compile(true);
set_collect_source_positions(!FLAG_enable_lazy_source_positions ||
isolate->NeedsDetailedOptimizedCodeLineInfo());
set_allow_harmony_top_level_await(FLAG_harmony_top_level_await);
}
// static
......
......@@ -60,7 +60,6 @@ class Zone;
V(allow_natives_syntax, bool, 1, _) \
V(allow_lazy_compile, bool, 1, _) \
V(collect_source_positions, bool, 1, _) \
V(allow_harmony_top_level_await, bool, 1, _) \
V(is_repl_mode, bool, 1, _)
class V8_EXPORT_PRIVATE UnoptimizedCompileFlags {
......
......@@ -923,12 +923,9 @@ class ParserBase {
if (flags().parsing_while_debugging() == ParsingWhileDebugging::kYes) {
ReportMessageAt(scanner()->location(),
MessageTemplate::kAwaitNotInDebugEvaluate);
} else if (flags().allow_harmony_top_level_await()) {
ReportMessageAt(scanner()->location(),
MessageTemplate::kAwaitNotInAsyncContext);
} else {
ReportMessageAt(scanner()->location(),
MessageTemplate::kAwaitNotInAsyncFunction);
MessageTemplate::kAwaitNotInAsyncContext);
}
return;
}
......@@ -1068,8 +1065,7 @@ class ParserBase {
return IsResumableFunction(function_state_->kind());
}
bool is_await_allowed() const {
return is_async_function() || (flags().allow_harmony_top_level_await() &&
IsModule(function_state_->kind()));
return is_async_function() || IsModule(function_state_->kind());
}
bool is_await_as_identifier_disallowed() {
return flags().is_module() ||
......
......@@ -587,31 +587,27 @@ FunctionLiteral* Parser::DoParseProgram(Isolate* isolate, ParseInfo* info) {
kNoSourcePosition, FunctionKind::kGeneratorFunction);
body.Add(
factory()->NewExpressionStatement(initial_yield, kNoSourcePosition));
if (flags().allow_harmony_top_level_await()) {
// First parse statements into a buffer. Then, if there was a
// top level await, create an inner block and rewrite the body of the
// module as an async function. Otherwise merge the statements back
// into the main body.
BlockT block = impl()->NullBlock();
{
StatementListT statements(pointer_buffer());
ParseModuleItemList(&statements);
// Modules will always have an initial yield. If there are any
// additional suspends, i.e. awaits, then we treat the module as an
// AsyncModule.
if (function_state.suspend_count() > 1) {
scope->set_is_async_module();
block = factory()->NewBlock(true, statements);
} else {
statements.MergeInto(&body);
}
}
if (IsAsyncModule(scope->function_kind())) {
impl()->RewriteAsyncFunctionBody(
&body, block, factory()->NewUndefinedLiteral(kNoSourcePosition));
// First parse statements into a buffer. Then, if there was a
// top level await, create an inner block and rewrite the body of the
// module as an async function. Otherwise merge the statements back
// into the main body.
BlockT block = impl()->NullBlock();
{
StatementListT statements(pointer_buffer());
ParseModuleItemList(&statements);
// Modules will always have an initial yield. If there are any
// additional suspends, i.e. awaits, then we treat the module as an
// AsyncModule.
if (function_state.suspend_count() > 1) {
scope->set_is_async_module();
block = factory()->NewBlock(true, statements);
} else {
statements.MergeInto(&body);
}
} else {
ParseModuleItemList(&body);
}
if (IsAsyncModule(scope->function_kind())) {
impl()->RewriteAsyncFunctionBody(
&body, block, factory()->NewUndefinedLiteral(kNoSourcePosition));
}
if (!has_error() &&
!module()->Validate(this->scope()->AsModuleScope(),
......
......@@ -6,7 +6,6 @@
wrap: no
module: yes
top level: yes
top level await: yes
---
snippet: "
......
......@@ -83,7 +83,7 @@ bytecodes: [
/* 48 E> */ B(StaKeyedPropertyAsDefine), R(this), R(0), U8(0),
/* 53 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
/* 58 E> */ B(LdaKeyedProperty), R(this), U8(2),
B(Wide), B(LdaSmi), I16(287),
B(Wide), B(LdaSmi), I16(286),
B(Star2),
B(LdaConstant), U8(0),
B(Star3),
......@@ -115,7 +115,7 @@ bytecodes: [
/* 41 E> */ B(StaKeyedPropertyAsDefine), R(this), R(0), U8(0),
/* 46 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
/* 51 E> */ B(LdaKeyedProperty), R(this), U8(2),
B(Wide), B(LdaSmi), I16(286),
B(Wide), B(LdaSmi), I16(285),
B(Star2),
B(LdaConstant), U8(0),
B(Star3),
......@@ -147,7 +147,7 @@ bytecodes: [
/* 48 E> */ B(StaKeyedPropertyAsDefine), R(this), R(0), U8(0),
/* 53 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
/* 58 E> */ B(LdaKeyedProperty), R(this), U8(2),
B(Wide), B(LdaSmi), I16(287),
B(Wide), B(LdaSmi), I16(286),
B(Star2),
B(LdaConstant), U8(0),
B(Star3),
......@@ -179,7 +179,7 @@ bytecodes: [
/* 41 E> */ B(StaKeyedPropertyAsDefine), R(this), R(0), U8(0),
/* 46 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
/* 51 E> */ B(LdaKeyedProperty), R(this), U8(2),
B(Wide), B(LdaSmi), I16(286),
B(Wide), B(LdaSmi), I16(285),
B(Star2),
B(LdaConstant), U8(0),
B(Star3),
......
......@@ -56,7 +56,7 @@ bytecodes: [
/* 44 E> */ B(StaKeyedPropertyAsDefine), R(this), R(0), U8(0),
/* 49 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
/* 54 E> */ B(LdaKeyedProperty), R(this), U8(2),
B(Wide), B(LdaSmi), I16(285),
B(Wide), B(LdaSmi), I16(284),
B(Star2),
B(LdaConstant), U8(0),
B(Star3),
......@@ -89,7 +89,7 @@ bytecodes: [
/* 44 E> */ B(StaKeyedPropertyAsDefine), R(this), R(0), U8(0),
/* 49 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
/* 54 E> */ B(LdaKeyedProperty), R(this), U8(2),
B(Wide), B(LdaSmi), I16(285),
B(Wide), B(LdaSmi), I16(284),
B(Star2),
B(LdaConstant), U8(0),
B(Star3),
......
......@@ -24,7 +24,7 @@ bytecodes: [
B(TestReferenceEqual), R(this),
B(Mov), R(this), R(1),
B(JumpIfTrue), U8(16),
B(Wide), B(LdaSmi), I16(279),
B(Wide), B(LdaSmi), I16(278),
B(Star2),
B(LdaConstant), U8(0),
B(Star3),
......@@ -59,13 +59,13 @@ bytecodes: [
B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0),
B(JumpIfTrue), U8(16),
B(Wide), B(LdaSmi), I16(279),
B(Wide), B(LdaSmi), I16(278),
B(Star1),
B(LdaConstant), U8(0),
B(Star2),
/* 61 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(1), U8(2),
B(Throw),
B(Wide), B(LdaSmi), I16(285),
B(Wide), B(LdaSmi), I16(284),
B(Star3),
B(LdaConstant), U8(1),
B(Star4),
......@@ -97,13 +97,13 @@ bytecodes: [
B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0),
B(JumpIfTrue), U8(16),
B(Wide), B(LdaSmi), I16(279),
B(Wide), B(LdaSmi), I16(278),
B(Star1),
B(LdaConstant), U8(0),
B(Star2),
/* 61 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(1), U8(2),
B(Throw),
B(Wide), B(LdaSmi), I16(285),
B(Wide), B(LdaSmi), I16(284),
B(Star3),
B(LdaConstant), U8(1),
B(Star4),
......@@ -143,7 +143,7 @@ bytecodes: [
B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0),
B(JumpIfTrue), U8(16),
B(Wide), B(LdaSmi), I16(279),
B(Wide), B(LdaSmi), I16(278),
B(Star2),
B(LdaConstant), U8(0),
B(Star3),
......@@ -165,7 +165,7 @@ bytecodes: [
B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0),
B(JumpIfTrue), U8(16),
B(Wide), B(LdaSmi), I16(279),
B(Wide), B(LdaSmi), I16(278),
B(Star3),
B(LdaConstant), U8(0),
B(Star4),
......@@ -180,7 +180,7 @@ bytecodes: [
B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0),
B(JumpIfTrue), U8(16),
B(Wide), B(LdaSmi), I16(279),
B(Wide), B(LdaSmi), I16(278),
B(Star2),
B(LdaConstant), U8(0),
B(Star3),
......@@ -214,13 +214,13 @@ bytecodes: [
B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0),
B(JumpIfTrue), U8(16),
B(Wide), B(LdaSmi), I16(279),
B(Wide), B(LdaSmi), I16(278),
B(Star1),
B(LdaConstant), U8(0),
B(Star2),
/* 65 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(1), U8(2),
B(Throw),
B(Wide), B(LdaSmi), I16(287),
B(Wide), B(LdaSmi), I16(286),
B(Star3),
B(LdaConstant), U8(1),
B(Star4),
......@@ -251,13 +251,13 @@ bytecodes: [
B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0),
B(JumpIfTrue), U8(16),
B(Wide), B(LdaSmi), I16(279),
B(Wide), B(LdaSmi), I16(278),
B(Star1),
B(LdaConstant), U8(0),
B(Star2),
/* 58 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(1), U8(2),
B(Throw),
B(Wide), B(LdaSmi), I16(286),
B(Wide), B(LdaSmi), I16(285),
B(Star3),
B(LdaConstant), U8(1),
B(Star4),
......@@ -288,13 +288,13 @@ bytecodes: [
B(TestReferenceEqual), R(this),
B(Mov), R(this), R(0),
B(JumpIfTrue), U8(16),
B(Wide), B(LdaSmi), I16(279),
B(Wide), B(LdaSmi), I16(278),
B(Star1),
B(LdaConstant), U8(0),
B(Star2),
/* 65 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(1), U8(2),
B(Throw),
B(Wide), B(LdaSmi), I16(287),
B(Wide), B(LdaSmi), I16(286),
B(Star3),
B(LdaConstant), U8(1),
B(Star4),
......@@ -323,7 +323,7 @@ bytecode array length: 19
bytecodes: [
/* 46 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
/* 51 E> */ B(LdaKeyedProperty), R(this), U8(0),
B(Wide), B(LdaSmi), I16(286),
B(Wide), B(LdaSmi), I16(285),
B(Star1),
B(LdaConstant), U8(0),
B(Star2),
......
......@@ -49,7 +49,6 @@ class ProgramOptions final {
top_level_(false),
print_callee_(false),
async_iteration_(false),
top_level_await_(false),
verbose_(false) {}
bool Validate() const;
......@@ -71,7 +70,6 @@ class ProgramOptions final {
bool top_level() const { return top_level_; }
bool print_callee() const { return print_callee_; }
bool async_iteration() const { return async_iteration_; }
bool top_level_await() const { return top_level_await_; }
bool verbose() const { return verbose_; }
bool suppress_runtime_errors() const { return baseline() && !verbose_; }
std::vector<std::string> input_filenames() const { return input_filenames_; }
......@@ -90,7 +88,6 @@ class ProgramOptions final {
bool top_level_;
bool print_callee_;
bool async_iteration_;
bool top_level_await_;
bool verbose_;
std::vector<std::string> input_filenames_;
std::string output_filename_;
......@@ -193,8 +190,6 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
options.print_callee_ = true;
} else if (strcmp(argv[i], "--async-iteration") == 0) {
options.async_iteration_ = true;
} else if (strcmp(argv[i], "--harmony-top-level-await") == 0) {
options.top_level_await_ = true;
} else if (strcmp(argv[i], "--verbose") == 0) {
options.verbose_ = true;
} else if (strncmp(argv[i], "--output=", 9) == 0) {
......@@ -312,8 +307,6 @@ void ProgramOptions::UpdateFromHeader(std::istream* stream) {
print_callee_ = ParseBoolean(line.c_str() + strlen(kPrintCallee));
} else if (line.compare(0, 17, "async iteration: ") == 0) {
async_iteration_ = ParseBoolean(line.c_str() + 17);
} else if (line.compare(0, 17, "top level await: ") == 0) {
top_level_await_ = ParseBoolean(line.c_str() + 17);
} else if (line == "---") {
break;
} else if (line.empty()) {
......@@ -336,7 +329,6 @@ void ProgramOptions::PrintHeader(std::ostream* stream) const {
if (top_level_) *stream << "\ntop level: yes";
if (print_callee_) *stream << "\nprint callee: yes";
if (async_iteration_) *stream << "\nasync iteration: yes";
if (top_level_await_) *stream << "\ntop level await: yes";
*stream << "\n\n";
}
......@@ -444,15 +436,11 @@ void GenerateExpectationsFile(std::ostream* stream,
printer.set_test_function_name(options.test_function_name());
}
if (options.top_level_await()) i::FLAG_harmony_top_level_await = true;
*stream << "#\n# Autogenerated by generate-bytecode-expectations.\n#\n\n";
options.PrintHeader(stream);
for (const std::string& snippet : snippet_list) {
printer.PrintExpectation(stream, snippet);
}
i::FLAG_harmony_top_level_await = false;
}
bool WriteExpectationsFile(const std::vector<std::string>& snippet_list,
......@@ -511,7 +499,6 @@ void PrintUsage(const char* exec_path) {
" --test-function-name=foo "
"Specify the name of the test function.\n"
" --top-level Process top level code, not the top-level function.\n"
" --top-level-await Enable await at the module level.\n"
" --output=file.name\n"
" Specify the output file. If not specified, output goes to "
"stdout.\n"
......
......@@ -2992,8 +2992,6 @@ TEST(Modules) {
}
TEST(AsyncModules) {
bool previous_top_level_await_flag = i::FLAG_harmony_top_level_await;
i::FLAG_harmony_top_level_await = true;
InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate());
printer.set_wrap(false);
......@@ -3017,7 +3015,6 @@ TEST(AsyncModules) {
CHECK(CompareTexts(BuildActual(printer, snippets),
LoadGolden("AsyncModules.golden")));
i::FLAG_harmony_top_level_await = previous_top_level_await_flag;
}
TEST(SuperCallAndSpread) {
......
This diff is collapsed.
This diff is collapsed.
// Copyright 2019 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.
//
// MODULE
//
// Flags: --harmony-top-level-await --ignore-unhandled-promises
import "modules-skip-1-top-level-await-fail.mjs"
*modules-skip-1-top-level-await-fail.mjs:7: ReferenceError: x is not defined
await x;
^
// Copyright 2019 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.
//
// MODULE
//
// Flags: --harmony-top-level-await --ignore-unhandled-promises
import "modules-skip-2-top-level-await-fail.mjs"
*modules-skip-2-top-level-await-fail.mjs:7: ReferenceError: ththsths is not defined
ththsths
^
......@@ -1306,12 +1306,6 @@
'regress/regress-crbug-1104608': [SKIP],
}],
##############################################################################
['variant == top_level_await', {
# specifically expects to fail on top level await.
'harmony/modules-import-15': [SKIP],
}], # variant == top_level_await
##############################################################################
['variant == stress_js_bg_compile_wasm_code_gc', {
# Runs significantly slower with --stress-wasm-code-gc, problematic
......
......@@ -44,7 +44,6 @@ ALL_VARIANT_FLAGS = {
"turboprop_as_toptier": [["--turboprop-as-toptier", "--turboprop"]],
"instruction_scheduling": [["--turbo-instruction-scheduling"]],
"stress_instruction_scheduling": [["--turbo-stress-instruction-scheduling"]],
"top_level_await": [["--harmony-top-level-await"]],
"wasm_write_protect_code": [["--wasm-write-protect-code-memory"]],
# Google3 variants.
"google3_icu": [[]],
......
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