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

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

This is a reland of 3ee4804f.

The CL was originally reverted for blink test failures. Since the
revert, the blink top-level await flag has been removed.

Original change's description:
> [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: Camillo Bruni <cbruni@chromium.org>
> Reviewed-by: Marja Hölttä <marja@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#78169}

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