diff options
author | Myles Borins <mylesborins@google.com> | 2018-04-10 21:39:51 -0400 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-04-11 13:22:42 -0400 |
commit | 12a1b9b8049462e47181a298120243dc83e81c55 (patch) | |
tree | 8605276308c8b4e3597516961266bae1af57557a /deps/v8/src/parsing/parser.cc | |
parent | 78cd8263354705b767ef8c6a651740efe4931ba0 (diff) | |
download | android-node-v8-12a1b9b8049462e47181a298120243dc83e81c55.tar.gz android-node-v8-12a1b9b8049462e47181a298120243dc83e81c55.tar.bz2 android-node-v8-12a1b9b8049462e47181a298120243dc83e81c55.zip |
deps: update V8 to 6.6.346.23
PR-URL: https://github.com/nodejs/node/pull/19201
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/src/parsing/parser.cc')
-rw-r--r-- | deps/v8/src/parsing/parser.cc | 290 |
1 files changed, 59 insertions, 231 deletions
diff --git a/deps/v8/src/parsing/parser.cc b/deps/v8/src/parsing/parser.cc index 0497958c82..8dc16a8b35 100644 --- a/deps/v8/src/parsing/parser.cc +++ b/deps/v8/src/parsing/parser.cc @@ -29,82 +29,8 @@ namespace v8 { namespace internal { -ScriptData::ScriptData(const byte* data, int length) - : owns_data_(false), rejected_(false), data_(data), length_(length) { - if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) { - byte* copy = NewArray<byte>(length); - DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment)); - CopyBytes(copy, data, length); - data_ = copy; - AcquireDataOwnership(); - } -} - -FunctionEntry ParseData::GetFunctionEntry(int start) { - // The current pre-data entry must be a FunctionEntry with the given - // start position. - if ((function_index_ + FunctionEntry::kSize <= Length()) && - (static_cast<int>(Data()[function_index_]) == start)) { - int index = function_index_; - function_index_ += FunctionEntry::kSize; - Vector<unsigned> subvector(&(Data()[index]), FunctionEntry::kSize); - return FunctionEntry(subvector); - } - return FunctionEntry(); -} - - -int ParseData::FunctionCount() { - int functions_size = FunctionsSize(); - if (functions_size < 0) return 0; - if (functions_size % FunctionEntry::kSize != 0) return 0; - return functions_size / FunctionEntry::kSize; -} - - -bool ParseData::IsSane() { - if (!IsAligned(script_data_->length(), sizeof(unsigned))) return false; - // Check that the header data is valid and doesn't specify - // point to positions outside the store. - int data_length = Length(); - if (data_length < PreparseDataConstants::kHeaderSize) return false; - if (Magic() != PreparseDataConstants::kMagicNumber) return false; - if (Version() != PreparseDataConstants::kCurrentVersion) return false; - // Check that the space allocated for function entries is sane. - int functions_size = FunctionsSize(); - if (functions_size < 0) return false; - if (functions_size % FunctionEntry::kSize != 0) return false; - // Check that the total size has room for header and function entries. - int minimum_size = - PreparseDataConstants::kHeaderSize + functions_size; - if (data_length < minimum_size) return false; - return true; -} - - -void ParseData::Initialize() { - // Prepares state for use. - int data_length = Length(); - if (data_length >= PreparseDataConstants::kHeaderSize) { - function_index_ = PreparseDataConstants::kHeaderSize; - } -} - - -unsigned ParseData::Magic() { - return Data()[PreparseDataConstants::kMagicOffset]; -} - - -unsigned ParseData::Version() { - return Data()[PreparseDataConstants::kVersionOffset]; -} -int ParseData::FunctionsSize() { - return static_cast<int>(Data()[PreparseDataConstants::kFunctionsSizeOffset]); -} - // Helper for putting parts of the parse results into a temporary zone when // parsing inner function bodies. class DiscardableZoneScope { @@ -153,17 +79,6 @@ class DiscardableZoneScope { DISALLOW_COPY_AND_ASSIGN(DiscardableZoneScope); }; -void Parser::SetCachedData(ParseInfo* info) { - DCHECK_NULL(cached_parse_data_); - if (consume_cached_parse_data()) { - if (allow_lazy_) { - cached_parse_data_ = ParseData::FromCachedData(*info->cached_data()); - if (cached_parse_data_ != nullptr) return; - } - compile_options_ = ScriptCompiler::kNoCompileOptions; - } -} - FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name, bool call_super, int pos, int end_pos) { @@ -403,16 +318,6 @@ Expression* Parser::NewTargetExpression(int pos) { return proxy; } -Expression* Parser::FunctionSentExpression(int pos) { - // We desugar function.sent into %_GeneratorGetInputOrDebugPos(generator). - ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone()); - VariableProxy* generator = factory()->NewVariableProxy( - function_state_->scope()->generator_object_var()); - args->Add(generator, zone()); - return factory()->NewCallRuntime(Runtime::kInlineGeneratorGetInputOrDebugPos, - args, pos); -} - Expression* Parser::ImportMetaExpression(int pos) { return factory()->NewCallRuntime( Runtime::kInlineGetImportMetaObject, @@ -511,11 +416,8 @@ Parser::Parser(ParseInfo* info) mode_(PARSE_EAGERLY), // Lazy mode must be set explicitly. source_range_map_(info->source_range_map()), target_stack_(nullptr), - compile_options_(info->compile_options()), - cached_parse_data_(nullptr), total_preparse_skipped_(0), temp_zoned_(false), - log_(nullptr), consumed_preparsed_scope_data_(info->consumed_preparsed_scope_data()), parameters_end_pos_(info->parameters_end_pos()) { // Even though we were passed ParseInfo, we should not store it in @@ -541,7 +443,6 @@ Parser::Parser(ParseInfo* info) info->extension() == nullptr && can_compile_lazily; set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); - set_allow_harmony_function_sent(FLAG_harmony_function_sent); set_allow_harmony_public_fields(FLAG_harmony_public_fields); set_allow_harmony_static_fields(FLAG_harmony_static_fields); set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import); @@ -603,18 +504,6 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); // Initialize parser state. - ParserLogger logger; - - if (produce_cached_parse_data()) { - if (allow_lazy_) { - log_ = &logger; - } else { - compile_options_ = ScriptCompiler::kNoCompileOptions; - } - } else if (consume_cached_parse_data()) { - cached_parse_data_->Initialize(); - } - DeserializeScopeChain(info, info->maybe_outer_scope_info()); scanner_.Initialize(info->character_stream(), info->is_module()); @@ -623,11 +512,6 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { HandleSourceURLComments(isolate, info->script()); - if (produce_cached_parse_data() && result != nullptr) { - *info->cached_data() = logger.GetScriptData(); - } - log_ = nullptr; - if (V8_UNLIKELY(FLAG_log_function_events) && result != nullptr) { double ms = timer.Elapsed().InMillisecondsF(); const char* event_name = "parse-eval"; @@ -742,6 +626,7 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) { result = factory()->NewScriptOrEvalFunctionLiteral( scope, body, function_state.expected_property_count(), parameter_count); + result->set_suspend_count(function_state.suspend_count()); } } @@ -904,8 +789,9 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info, scope->set_start_position(info->start_position()); ExpressionClassifier formals_classifier(this); ParserFormalParameters formals(scope); - int rewritable_length = - function_state.destructuring_assignments_to_rewrite().length(); + // The outer FunctionState should not contain destructuring assignments. + DCHECK_EQ(0, + function_state.destructuring_assignments_to_rewrite().length()); { // Parsing patterns as variable reference expression creates // NewUnresolved references in current scope. Enter arrow function @@ -943,8 +829,12 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info, // Pass `accept_IN=true` to ParseArrowFunctionLiteral --- This should // not be observable, or else the preparser would have failed. - Expression* expression = - ParseArrowFunctionLiteral(true, formals, rewritable_length, &ok); + const bool accept_IN = true; + // Any destructuring assignments in the current FunctionState + // actually belong to the arrow function itself. + const int rewritable_length = 0; + Expression* expression = ParseArrowFunctionLiteral( + accept_IN, formals, rewritable_length, &ok); if (ok) { // Scanning must end at the same position that was recorded // previously. If not, parsing has been interrupted due to a stack @@ -957,10 +847,6 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info, // must produce a FunctionLiteral. DCHECK(expression->IsFunctionLiteral()); result = expression->AsFunctionLiteral(); - // Rewrite destructuring assignments in the parameters. (The ones - // inside the function body are rewritten by - // ParseArrowFunctionLiteral.) - RewriteDestructuringAssignments(); } else { ok = false; } @@ -1293,7 +1179,7 @@ Statement* Parser::ParseExportDefault(bool* ok) { result = ParseAsyncFunctionDeclaration(&local_names, true, CHECK_OK); break; } - /* falls through */ + V8_FALLTHROUGH; default: { int pos = position(); @@ -1531,8 +1417,7 @@ Statement* Parser::DeclareFunction(const AstRawString* variable_name, ZoneList<const AstRawString*>* names, bool* ok) { VariableProxy* proxy = - factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE); - + factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE, pos); Declaration* declaration = factory()->NewFunctionDeclaration(proxy, function, pos); Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized, @@ -1831,6 +1716,8 @@ void Parser::ParseAndRewriteAsyncGeneratorFunctionBody( // Don't create iterator result for async generators, as the resume methods // will create it. + // TODO(leszeks): This will create another suspend point, which is unnecessary + // if there is already an unconditional return in the body. Statement* final_return = BuildReturnStatement( factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition); try_block->statements()->Add(final_return, zone()); @@ -1900,6 +1787,7 @@ Expression* Parser::BuildIteratorNextResult(VariableProxy* iterator, Expression* next_call = factory()->NewCall(next_property, next_arguments, kNoSourcePosition); if (type == IteratorType::kAsync) { + function_state_->AddSuspend(); next_call = factory()->NewAwait(next_call, pos); } Expression* result_proxy = factory()->NewVariableProxy(result); @@ -2681,6 +2569,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral( ZoneList<Statement*>* body = nullptr; int expected_property_count = -1; + int suspend_count = -1; int num_parameters = -1; int function_length = -1; bool has_duplicate_parameters = false; @@ -2747,10 +2636,10 @@ FunctionLiteral* Parser::ParseFunctionLiteral( if (should_preparse) { scope->AnalyzePartially(&previous_zone_ast_node_factory); } else { - body = ParseFunction(function_name, pos, kind, function_type, scope, - &num_parameters, &function_length, - &has_duplicate_parameters, &expected_property_count, - arguments_for_wrapped_function, CHECK_OK); + body = ParseFunction( + function_name, pos, kind, function_type, scope, &num_parameters, + &function_length, &has_duplicate_parameters, &expected_property_count, + &suspend_count, arguments_for_wrapped_function, CHECK_OK); } DCHECK_EQ(should_preparse, temp_zoned_); @@ -2808,6 +2697,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral( function_length, duplicate_parameters, function_type, eager_compile_hint, pos, true, function_literal_id, produced_preparsed_scope_data); function_literal->set_function_token_position(function_token_pos); + function_literal->set_suspend_count(suspend_count); if (should_infer_name) { DCHECK_NOT_NULL(fni_); @@ -2826,38 +2716,11 @@ Parser::LazyParsingResult Parser::SkipFunction( DCHECK_NE(kNoSourcePosition, function_scope->start_position()); DCHECK_EQ(kNoSourcePosition, parameters_end_pos_); - if (produce_cached_parse_data()) CHECK(log_); DCHECK_IMPLIES(IsArrowFunction(kind), scanner()->current_token() == Token::ARROW); - // Inner functions are not part of the cached data. - if (!is_inner_function && consume_cached_parse_data() && - !cached_parse_data_->rejected()) { - // If we have cached data, we use it to skip parsing the function. The data - // contains the information we need to construct the lazy function. - FunctionEntry entry = - cached_parse_data_->GetFunctionEntry(function_scope->start_position()); - // Check that cached data is valid. If not, mark it as invalid (the embedder - // handles it). Note that end position greater than end of stream is safe, - // and hard to check. - if (entry.is_valid() && - entry.end_pos() > function_scope->start_position()) { - total_preparse_skipped_ += entry.end_pos() - position(); - function_scope->set_end_position(entry.end_pos()); - scanner()->SeekForward(entry.end_pos() - 1); - Expect(Token::RBRACE, CHECK_OK_VALUE(kLazyParsingComplete)); - *num_parameters = entry.num_parameters(); - SetLanguageMode(function_scope, entry.language_mode()); - if (entry.uses_super_property()) - function_scope->RecordSuperPropertyUsage(); - SkipFunctionLiterals(entry.num_inner_functions()); - return kLazyParsingComplete; - } - cached_parse_data_->Reject(); - } - - // FIXME(marja): There are 3 ways to skip functions now. Unify them. + // FIXME(marja): There are 2 ways to skip functions now. Unify them. DCHECK_NOT_NULL(consumed_preparsed_scope_data_); if (consumed_preparsed_scope_data_->HasData()) { DCHECK(FLAG_preparser_scope_analysis); @@ -2908,6 +2771,9 @@ Parser::LazyParsingResult Parser::SkipFunction( *ok = false; return kLazyParsingComplete; } + + set_allow_eval_cache(reusable_preparser()->allow_eval_cache()); + PreParserLogger* logger = reusable_preparser()->logger(); function_scope->set_end_position(logger->end()); Expect(Token::RBRACE, CHECK_OK_VALUE(kLazyParsingComplete)); @@ -2915,13 +2781,6 @@ Parser::LazyParsingResult Parser::SkipFunction( function_scope->end_position() - function_scope->start_position(); *num_parameters = logger->num_parameters(); SkipFunctionLiterals(logger->num_inner_functions()); - if (!is_inner_function && produce_cached_parse_data()) { - DCHECK(log_); - log_->LogFunction(function_scope->start_position(), - function_scope->end_position(), *num_parameters, - language_mode(), function_scope->NeedsHomeObject(), - logger->num_inner_functions()); - } return kLazyParsingComplete; } @@ -3136,7 +2995,7 @@ Expression* Parser::BuildResolvePromise(Expression* value, int pos) { args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); args->Add(value, zone()); Expression* call_runtime = - factory()->NewCallRuntime(Context::PROMISE_RESOLVE_INDEX, args, pos); + factory()->NewCallRuntime(Runtime::kInlineResolvePromise, args, pos); return factory()->NewBinaryOperation( Token::COMMA, call_runtime, factory()->NewVariableProxy(PromiseVariable()), pos); @@ -3150,8 +3009,8 @@ Expression* Parser::BuildRejectPromise(Expression* value, int pos) { args->Add(factory()->NewVariableProxy(PromiseVariable()), zone()); args->Add(value, zone()); args->Add(factory()->NewBooleanLiteral(false, pos), zone()); - Expression* call_runtime = factory()->NewCallRuntime( - Context::PROMISE_INTERNAL_REJECT_INDEX, args, pos); + Expression* call_runtime = + factory()->NewCallRuntime(Runtime::kInlineRejectPromise, args, pos); return factory()->NewBinaryOperation( Token::COMMA, call_runtime, factory()->NewVariableProxy(PromiseVariable()), pos); @@ -3175,6 +3034,7 @@ Expression* Parser::BuildInitialYield(int pos, FunctionKind kind) { // The position of the yield is important for reporting the exception // caused by calling the .throw method on a generator suspended at the // initial yield (i.e. right after generator instantiation). + function_state_->AddSuspend(); return factory()->NewYield(yield_result, scope()->start_position(), Suspend::kOnExceptionThrow); } @@ -3184,6 +3044,7 @@ ZoneList<Statement*>* Parser::ParseFunction( FunctionLiteral::FunctionType function_type, DeclarationScope* function_scope, int* num_parameters, int* function_length, bool* has_duplicate_parameters, int* expected_property_count, + int* suspend_count, ZoneList<const AstRawString*>* arguments_for_wrapped_function, bool* ok) { ParsingModeScope mode(this, allow_lazy_ ? PARSE_LAZILY : PARSE_EAGERLY); @@ -3268,6 +3129,7 @@ ZoneList<Statement*>* Parser::ParseFunction( !classifier()->is_valid_formal_parameter_list_without_duplicates(); *expected_property_count = function_state.expected_property_count(); + *suspend_count = function_state.suspend_count(); return body; } @@ -3308,6 +3170,7 @@ Variable* Parser::CreateSyntheticContextVariable(const AstRawString* name, // - properties void Parser::DeclareClassProperty(const AstRawString* class_name, ClassLiteralProperty* property, + const AstRawString* property_name, ClassLiteralProperty::Kind kind, bool is_static, bool is_constructor, bool is_computed_name, ClassInfo* class_info, @@ -3322,7 +3185,8 @@ void Parser::DeclareClassProperty(const AstRawString* class_name, return; } - if (kind != ClassLiteralProperty::FIELD) { + if (kind != ClassLiteralProperty::PUBLIC_FIELD && + kind != ClassLiteralProperty::PRIVATE_FIELD) { class_info->properties->Add(property, zone()); return; } @@ -3331,12 +3195,14 @@ void Parser::DeclareClassProperty(const AstRawString* class_name, if (is_static) { DCHECK(allow_harmony_static_fields()); + DCHECK_EQ(kind, ClassLiteralProperty::PUBLIC_FIELD); class_info->static_fields->Add(property, zone()); } else { class_info->instance_fields->Add(property, zone()); } if (is_computed_name) { + DCHECK_EQ(kind, ClassLiteralProperty::PUBLIC_FIELD); // We create a synthetic variable name here so that scope // analysis doesn't dedupe the vars. Variable* computed_name_var = CreateSyntheticContextVariable( @@ -3346,6 +3212,13 @@ void Parser::DeclareClassProperty(const AstRawString* class_name, property->set_computed_name_var(computed_name_var); class_info->properties->Add(property, zone()); } + + if (kind == ClassLiteralProperty::PRIVATE_FIELD) { + Variable* private_field_name_var = + CreateSyntheticContextVariable(property_name, CHECK_OK_VOID); + property->set_private_field_name_var(private_field_name_var); + class_info->properties->Add(property, zone()); + } } FunctionLiteral* Parser::CreateInitializerFunction( @@ -3432,6 +3305,15 @@ void Parser::CheckConflictingVarDeclarations(Scope* scope, bool* ok) { } } +bool Parser::IsPropertyWithPrivateFieldKey(Expression* expression) { + if (!expression->IsProperty()) return false; + Property* property = expression->AsProperty(); + + if (!property->key()->IsVariableProxy()) return false; + VariableProxy* key = property->key()->AsVariableProxy(); + + return key->is_private_field(); +} void Parser::InsertShadowingVarBindingInitializers(Block* inner_block) { // For each var-binding that shadows a parameter, insert an assignment @@ -3550,15 +3432,6 @@ void Parser::ParseOnBackground(ParseInfo* info) { DCHECK_NULL(info->literal()); FunctionLiteral* result = nullptr; - ParserLogger logger; - if (produce_cached_parse_data()) { - if (allow_lazy_) { - log_ = &logger; - } else { - compile_options_ = ScriptCompiler::kNoCompileOptions; - } - } - scanner_.Initialize(info->character_stream(), info->is_module()); DCHECK(info->maybe_outer_scope_info().is_null()); @@ -3582,11 +3455,6 @@ void Parser::ParseOnBackground(ParseInfo* info) { // We cannot internalize on a background thread; a foreground task will take // care of calling AstValueFactory::Internalize just before compilation. - - if (produce_cached_parse_data()) { - if (result != nullptr) *info->cached_data() = logger.GetScriptData(); - log_ = nullptr; - } } Parser::TemplateLiteralState Parser::OpenTemplateLiteral(int pos) { @@ -3654,9 +3522,8 @@ Expression* Parser::CloseTemplateLiteral(TemplateLiteralState* state, int start, return expr; } else { // GetTemplateObject - const int32_t hash = ComputeTemplateLiteralHash(lit); Expression* template_object = - factory()->NewGetTemplateObject(cooked_strings, raw_strings, hash, pos); + factory()->NewGetTemplateObject(cooked_strings, raw_strings, pos); // Call TagFn ZoneList<Expression*>* call_args = @@ -3669,51 +3536,6 @@ Expression* Parser::CloseTemplateLiteral(TemplateLiteralState* state, int start, namespace { -// http://burtleburtle.net/bob/hash/integer.html -uint32_t HalfAvalance(uint32_t a) { - a = (a + 0x479AB41D) + (a << 8); - a = (a ^ 0xE4AA10CE) ^ (a >> 5); - a = (a + 0x9942F0A6) - (a << 14); - a = (a ^ 0x5AEDD67D) ^ (a >> 3); - a = (a + 0x17BEA992) + (a << 7); - return a; -} - -} // namespace - -int32_t Parser::ComputeTemplateLiteralHash(const TemplateLiteral* lit) { - const ZoneList<const AstRawString*>* raw_strings = lit->raw(); - int total = raw_strings->length(); - DCHECK_GT(total, 0); - - uint32_t running_hash = 0; - - for (int index = 0; index < total; ++index) { - if (index) { - running_hash = StringHasher::ComputeRunningHashOneByte( - running_hash, "${}", 3); - } - - const AstRawString* raw_string = raw_strings->at(index); - if (raw_string->is_one_byte()) { - const char* data = reinterpret_cast<const char*>(raw_string->raw_data()); - running_hash = StringHasher::ComputeRunningHashOneByte( - running_hash, data, raw_string->length()); - } else { - const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); - running_hash = StringHasher::ComputeRunningHash(running_hash, data, - raw_string->length()); - } - } - - // Pass {running_hash} throught a decent 'half avalance' hash function - // and take the most significant bits (in Smi range). - return static_cast<int32_t>(HalfAvalance(running_hash)) >> - (sizeof(int32_t) * CHAR_BIT - kSmiValueSize); -} - -namespace { - bool OnlyLastArgIsSpread(ZoneList<Expression*>* args) { for (int i = 0; i < args->length() - 1; i++) { if (args->at(i)->IsSpread()) { @@ -3911,6 +3733,9 @@ void Parser::RewriteDestructuringAssignments() { // pair.scope may already have been removed by FinalizeBlockScope in the // meantime. Scope* scope = to_rewrite->scope()->GetUnremovedScope(); + // Scope at the time of the rewriting and the original parsing + // should be in the same function. + DCHECK(scope->GetClosureScope() == scope_->GetClosureScope()); BlockState block_state(&scope_, scope); RewriteDestructuringAssignment(to_rewrite); } @@ -4070,6 +3895,7 @@ void Parser::BuildIteratorClose(ZoneList<Statement*>* statements, Expression* call = factory()->NewCallRuntime(Runtime::kInlineCall, args, nopos); if (type == IteratorType::kAsync) { + function_state_->AddSuspend(); call = factory()->NewAwait(call, nopos); } Expression* output_proxy = factory()->NewVariableProxy(var_output); @@ -4288,6 +4114,7 @@ void Parser::BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements, factory()->NewCallRuntime(Runtime::kInlineCall, args, nopos); if (type == IteratorType::kAsync) { + function_state_->AddSuspend(); call = factory()->NewAwait(call, nopos); } @@ -4315,6 +4142,7 @@ void Parser::BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements, Expression* call = factory()->NewCallRuntime(Runtime::kInlineCall, args, nopos); if (type == IteratorType::kAsync) { + function_state_->AddSuspend(); call = factory()->NewAwait(call, nopos); } |