41 bool call_super,
int pos) {
42 int expected_property_count = 0;
55 FunctionState function_state(&function_state_, &
scope_, function_scope);
73 factory()->NewSuperCallForwardArgs(super_call_ref,
pos);
74 body.
Add(factory()->NewReturnStatement(call,
pos));
77 expected_property_count = function_state.expected_property_count();
84 pos,
true, GetNextInfoId());
85 return function_literal;
90 bool is_static,
int pos) {
99 FunctionState function_state(&function_state_, &
scope_, function_scope);
100 body.
Add(factory()->NewAutoAccessorGetterBody(name_proxy,
pos));
105 nullptr, function_scope, body, 0, 0, 0,
110 name ? ast_value_factory()->get_space_string() :
nullptr;
117 bool is_static,
int pos) {
129 FunctionState function_state(&function_state_, &
scope_, function_scope);
130 body.
Add(factory()->NewAutoAccessorSetterBody(name_proxy,
pos));
135 nullptr, function_scope, body, 0, 1, 0,
140 name ? ast_value_factory()->set_space_string() :
nullptr;
146 ClassInfo* class_info,
148 bool is_static,
int pos) {
152 AutoAccessorVariableName(ast_value_factory(),
153 class_info->autoaccessor_count++),
159 name, is_static,
pos + 1);
161 name, is_static,
pos + 2);
163 accessor_storage_name_proxy);
169 bool is_private,
int pos) {
172 return factory()->NewClassLiteralProperty(
173 key, value, accessor_info, is_static, is_computed_name, is_private);
179 const char* arg =
nullptr;
182 message = MessageTemplate::kUnexpectedEOS;
187 message = MessageTemplate::kUnexpectedTokenNumber;
190 message = MessageTemplate::kUnexpectedTokenString;
192 case Token::kPrivateName:
193 case Token::kIdentifier:
194 message = MessageTemplate::kUnexpectedTokenIdentifier;
201 message = MessageTemplate::kUnexpectedReserved;
206 case Token::kFutureStrictReservedWord:
208 ? MessageTemplate::kUnexpectedStrictReserved
209 : MessageTemplate::kUnexpectedTokenIdentifier;
212 case Token::kTemplateSpan:
213 case Token::kTemplateTail:
214 message = MessageTemplate::kUnexpectedTemplateString;
216 case Token::kEscapedStrictReservedWord:
217 case Token::kEscapedKeyword:
218 message = MessageTemplate::kInvalidEscapedReservedWord;
220 case Token::kIllegal:
221 if (scanner()->has_error()) {
222 message = scanner()->error();
223 location = scanner()->error_location();
225 message = MessageTemplate::kInvalidOrUnexpectedToken;
228 case Token::kRegExpLiteral:
229 message = MessageTemplate::kUnexpectedTokenRegExp;
237 ReportMessageAt(location, message, arg);
246 if ((*x)->IsNumberLiteral() &&
y->IsNumberLiteral()) {
247 double x_val = (*x)->AsLiteral()->AsNumber();
248 double y_val =
y->AsLiteral()->AsNumber();
251 *
x = factory()->NewNumberLiteral(x_val + y_val,
pos);
254 *
x = factory()->NewNumberLiteral(x_val - y_val,
pos);
257 *
x = factory()->NewNumberLiteral(x_val * y_val,
pos);
263 *
x = factory()->NewNumberLiteral(
Modulo(x_val, y_val),
pos);
265 case Token::kBitOr: {
267 *
x = factory()->NewNumberLiteral(value,
pos);
270 case Token::kBitAnd: {
272 *
x = factory()->NewNumberLiteral(value,
pos);
275 case Token::kBitXor: {
277 *
x = factory()->NewNumberLiteral(value,
pos);
283 *
x = factory()->NewNumberLiteral(value,
pos);
289 *
x = factory()->NewNumberLiteral(value,
pos);
295 *
x = factory()->NewNumberLiteral(value,
pos);
299 *
x = factory()->NewNumberLiteral(
math::pow(x_val, y_val),
pos);
307 if (op == Token::kAdd) {
311 if (
y->IsStringLiteral()) {
312 if ((*x)->IsStringLiteral()) {
313 const AstRawString* x_val = (*x)->AsLiteral()->AsRawString();
315 AstConsString* cons = ast_value_factory()->NewConsString(x_val, y_val);
316 *
x = factory()->NewConsStringLiteral(cons, (*x)->position());
319 if ((*x)->IsConsStringLiteral()) {
321 (*x)->AsLiteral()->AsConsString()->AddString(zone(), y_val);
333 if (*
x && (*x)->IsConditionalChain()) {
335 if (then_expression !=
nullptr) {
339 if (else_expression !=
nullptr) {
350 if (*
x && (*x)->IsConditionalChain()) {
365 if ((*x)->IsBinaryOperation()) {
367 if (binop->
op() != op)
return false;
369 nary = factory()->NewNaryOperation(op, binop->
left(), 2);
373 }
else if ((*x)->IsNaryOperation()) {
374 nary = (*x)->AsNaryOperation();
375 if (nary->
op() != op)
return false;
393 return ast_value_factory()->GetOneByteString(
literal);
395 std::unique_ptr<char[]> decimal =
397 return ast_value_factory()->GetOneByteString(decimal.get());
405 if (op == Token::kNot) {
407 return factory()->NewBooleanLiteral(
literal->ToBooleanIsFalse(),
pos);
408 }
else if (
literal->IsNumberLiteral()) {
410 double value =
literal->AsNumber();
415 return factory()->NewNumberLiteral(-value,
pos);
423 return factory()->NewUnaryOperation(op, expression,
pos);
430 args.Add(factory()->NewSmiLiteral(
static_cast<int>(message),
pos));
431 args.Add(factory()->NewStringLiteral(arg,
pos));
433 return factory()->NewThrow(call_constructor,
pos);
438 if (
IsStatic(scope()->GetReceiverScope()->function_kind())) {
439 home_object_name = ast_value_factory_->dot_static_home_object_string();
441 home_object_name = ast_value_factory_->dot_home_object_string();
446 return factory()->NewSuperPropertyReference(proxy,
pos);
451 NewUnresolved(ast_value_factory()->new_target_string(),
pos);
453 NewUnresolved(ast_value_factory()->this_function_string(),
pos);
454 return factory()->NewSuperCallReference(new_target_proxy, this_function_proxy,
459 auto proxy = NewUnresolved(ast_value_factory()->new_target_string(),
pos);
460 proxy->set_is_new_target();
466 if (!has_module_in_scope_chain()) {
467 DCHECK(IsParsingWhileDebugging());
470 return factory()->NewUndefinedLiteral(
pos);
472 return factory()->NewCallRuntime(Runtime::kInlineGetImportMetaObject,
args,
478 case Token::kNullLiteral:
479 return factory()->NewNullLiteral(
pos);
480 case Token::kTrueLiteral:
481 return factory()->NewBooleanLiteral(
true,
pos);
482 case Token::kFalseLiteral:
483 return factory()->NewBooleanLiteral(
false,
pos);
485 uint32_t value = scanner()->smi_value();
486 return factory()->NewSmiLiteral(value,
pos);
488 case Token::kNumber: {
489 double value = scanner()->DoubleValue();
490 return factory()->NewNumberLiteral(value,
pos);
493 return factory()->NewBigIntLiteral(
494 AstBigInt(scanner()->CurrentLiteralAsCString(zone())),
pos);
495 case Token::kString: {
510 GetClosureScope()->ForceEagerCompilation();
513 if (!name->is_one_byte()) {
515 ReportMessage(MessageTemplate::kNotDefined, name);
527 if (function ==
nullptr) {
528 ReportMessage(MessageTemplate::kNotDefined, name);
533 if (function->nargs != -1 && function->nargs !=
args.length()) {
534 ReportMessage(MessageTemplate::kRuntimeWrongNumArgs);
538 return factory()->NewCallRuntime(function,
args,
pos);
550 if (function ==
nullptr ||
552 function->nargs >
args.length()) {
557 if (function->nargs == -1) {
558 return factory()->NewCallRuntime(function,
args,
pos);
563 for (
int i = 0;
i < function->nargs;
i++) {
566 return factory()->NewCallRuntime(function, permissive_args,
pos);
571 info->zone(), &scanner_, info->stack_limit(),
572 info->ast_value_factory(), info->pending_error_handler(),
573 info->runtime_call_stats(), info->v8_file_logger(), info->flags(),
574 true, info->flags().compile_hints_magic_enabled(),
575 info->flags().compile_hints_per_function_magic_enabled()),
578 scanner_(info->character_stream(), flags()),
579 preparser_zone_(info->zone()->allocator(),
"pre-parser-zone"),
580 reusable_preparser_(nullptr),
581 mode_(PARSE_EAGERLY),
582 source_range_map_(info->source_range_map()),
583 total_preparse_skipped_(0),
584 consumed_preparse_data_(info->consumed_preparse_data()),
585 preparse_data_buffer_(),
586 parameters_end_pos_(info->parameters_end_pos()) {
601 bool can_compile_lazily =
flags().allow_lazy_compile() && !
flags().is_eager();
603 set_default_eager_compile_hint(can_compile_lazily
607 info->extension() ==
nullptr && can_compile_lazily;
619 info->set_script_scope(script_scope);
620 original_scope_ = script_scope;
623template <
typename IsolateT>
630 if (maybe_outer_scope_info.
ToHandle(&outer_scope_info)) {
633 isolate, zone(), *outer_scope_info, info->script_scope(),
634 ast_value_factory(), mode, info);
640 if (info->has_module_in_scope_chain()) {
641 set_has_module_in_scope_chain();
671 DCHECK_EQ(script->id(), flags().script_id());
675 DCHECK(parsing_on_main_thread_);
677 ? RuntimeCallCounterId::kParseEval
678 : RuntimeCallCounterId::kParseProgram);
687 DCHECK_EQ(script->is_wrapped(), info->is_wrapped_as_function());
688 if (script->is_wrapped()) {
695 if (
result ==
nullptr)
return;
700 double ms = timer.Elapsed().InMillisecondsF();
701 const char* event_name =
"parse-eval";
704 if (!
flags().is_eval()) {
705 event_name =
"parse-script";
710 FunctionEvent(event_name,
flags().script_id(), ms,
start,
end,
"", 0));
719 DCHECK_EQ(parsing_on_main_thread_, isolate !=
nullptr);
727 Scope* outer = original_scope_;
729 if (
flags().is_eval()) {
730 outer = NewEvalScope(outer);
731 }
else if (
flags().is_module()) {
733 outer = NewModuleScope(info->script_scope());
739 FunctionState function_state(&function_state_, &
scope_, scope);
741 int beg_pos = scanner()->location().beg_pos;
742 if (
flags().is_module()) {
754 if (function_state.suspend_count() > 1) {
758 !module()->Validate(this->scope()->AsModuleScope(),
759 pending_error_handler(), zone())) {
760 scanner()->set_parser_error();
762 }
else if (info->is_wrapped_as_function()) {
763 DCHECK(parsing_on_main_thread_);
765 }
else if (
flags().is_repl_mode()) {
771 ParseStatementList(&body, Token::kEos);
779 CheckStrictOctalLiteral(beg_pos, end_position());
790 if (
flags().is_eval()) {
791 DCHECK(parsing_on_main_thread_);
792 DCHECK(!isolate->main_thread_local_heap()->IsParked());
793 info->ast_value_factory()->Internalize(isolate);
795 CheckConflictingVarDeclarations(scope);
798 if (body.
length() != 1 || !body.
at(0)->IsExpressionStatement() ||
800 ->AsExpressionStatement()
802 ->IsFunctionLiteral()) {
803 ReportMessage(MessageTemplate::kSingleFunctionLiteral);
808 result = factory()->NewScriptOrEvalFunctionLiteral(
809 scope, body, function_state.expected_property_count(),
parameter_count);
810 result->set_suspend_count(function_state.suspend_count());
813 info->set_max_info_id(GetLastInfoId());
815 if (has_error())
return nullptr;
822template <
typename IsolateT>
828 info->set_language_mode(
literal->language_mode());
829 if (info->flags().is_eval()) {
830 info->set_allow_eval_cache(allow_eval_cache());
833 info->ast_value_factory()->Internalize(isolate);
836 RCS_SCOPE(info->runtime_call_stats(), RuntimeCallCounterId::kCompileAnalyse,
837 RuntimeCallStats::kThreadSpecific);
838 bool has_stack_overflow =
false;
842 info->set_literal(
nullptr);
843 if (has_stack_overflow) {
845 set_stack_overflow();
860 DCHECK(parsing_on_main_thread_);
864 int arguments_length = arguments->length();
867 for (
int i = 0;
i < arguments_length;
i++) {
868 const AstRawString* argument_string = ast_value_factory()->GetString(
871 arguments_for_wrapped_function->
Add(argument_string, zone);
873 return arguments_for_wrapped_function;
879 DCHECK(parsing_on_main_thread_);
880 DCHECK(info->is_wrapped_as_function());
885 FunctionState function_state(&function_state_, &
scope_, outer_scope);
897 arguments_for_wrapped_function);
901 body->
Add(return_statement);
918 BlockT block = impl()->NullBlock();
920 StatementListT statements(pointer_buffer());
921 ParseStatementList(&statements, Token::kEos);
922 block = factory()->NewBlock(
true, statements);
925 if (has_error())
return;
927 bool has_stack_overflow =
false;
929 info, scope, block->statements(), &has_stack_overflow);
931 if (has_stack_overflow) {
933 set_stack_overflow();
938 *maybe_result ?
static_cast<Expression*
>(*maybe_result)
941 block->statements()->Add(factory()->NewAsyncReturnStatement(
944 DCHECK(!info->pending_error_handler()->stack_overflow());
959 Literal* property_name = factory()->NewStringLiteral(
962 factory()->NewObjectLiteralProperty(property_name, value,
true);
964 Literal* proto_name = factory()->NewStringLiteral(
970 properties.Add(property);
971 properties.Add(prototype);
980 DCHECK(parsing_on_main_thread_);
981 RCS_SCOPE(runtime_call_stats_, RuntimeCallCounterId::kParseFunction);
987 if (shared_info->HasOuterScopeInfo()) {
988 maybe_outer_scope_info =
991 int start_position = shared_info->StartPosition();
992 int end_position = shared_info->EndPosition();
996 DCHECK_EQ(factory()->zone(), info->zone());
999 if (shared_info->is_wrapped()) {
1003 int function_literal_id = shared_info->function_literal_id();
1006 info->set_function_name(ast_value_factory()->GetString(
1018 function_kind, start_position, function_literal_id, end_position,
1019 info->function_name());
1020 info->set_max_info_id(GetLastInfoId());
1021 }
else if (
V8_UNLIKELY(shared_info->private_name_lookup_skips_outer_class() &&
1022 original_scope_->is_class_scope())) {
1028 function_literal_id, info->function_name());
1031 function_literal_id, info->function_name());
1033 if (
result ==
nullptr)
return;
1037 double ms = timer.Elapsed().InMillisecondsF();
1041 std::unique_ptr<char[]> function_name = shared_info->DebugNameCStr();
1043 FunctionEvent(
"parse-function",
flags().script_id(), ms,
1046 strlen(function_name.get())));
1051 int start_position,
int end_position,
1052 int function_literal_id,
1054 DCHECK_EQ(parsing_on_main_thread_, isolate !=
nullptr);
1058 DCHECK(ast_value_factory());
1059 fni_.PushEnclosingName(raw_name);
1063 SkipInfos(function_literal_id - 1);
1072 Scope* outer = original_scope_;
1075 FunctionState function_state(&function_state_, &
scope_, outer_function);
1076 BlockState block_state(&
scope_, outer);
1081 flags().function_syntax_kind() ==
1086 DCHECK(!scanner()->HasLineTerminatorAfterNext());
1087 if (!Check(Token::kAsync)) {
1088 CHECK(stack_overflow());
1091 if (!(peek_any_identifier() || peek() == Token::kLeftParen)) {
1092 CHECK(stack_overflow());
1097 CHECK_EQ(function_literal_id, GetNextInfoId());
1114 BlockState inner_block_state(&
scope_, scope);
1115 if (Check(Token::kLeftParen)) {
1117 ParseFormalParameterList(&formals);
1118 Expect(Token::kRightParen);
1121 ParameterParsingScope parameter_parsing_scope(impl(), &formals);
1122 ParseFormalParameter(&formals);
1131 bool could_be_immediately_invoked =
false;
1132 Expression* expression = ParseArrowFunctionLiteral(
1133 formals, function_literal_id, could_be_immediately_invoked);
1140 if (scanner()->location().end_pos == end_position) {
1143 DCHECK(expression->IsFunctionLiteral());
1144 result = expression->AsFunctionLiteral();
1152 info->is_wrapped_as_function()
1158 info->language_mode(), arguments_for_wrapped_function);
1161 if (has_error())
return nullptr;
1162 result->set_requires_instance_members_initializer(
1164 result->set_class_scope_has_private_brand(
1165 flags().class_scope_has_private_brand());
1166 result->set_has_static_private_methods_or_accessors(
1170 info->set_max_info_id(GetLastInfoId());
1177 FunctionKind initializer_kind,
int initializer_pos,
int initializer_id,
1178 int initializer_end_pos,
const AstRawString* class_name) {
1183 DCHECK_EQ(peek_position(), initializer_pos);
1187 FunctionState function_state(&function_state_, &
scope_, nearest_decl_scope);
1191 SkipInfos(initializer_id - 1);
1203 BlockState block_state(&
scope_, original_scope_);
1206 BlockState object_literal_scope_state(&object_literal_scope_,
nullptr);
1208 ClassInfo class_info(
this);
1209 class_info.is_anonymous = is_anonymous;
1234 scope()->MarkReparsingForClassInitializer();
1237 ParseClassLiteralBody(class_info, class_name, class_token_pos, Token::kEos);
1240 DCHECK_EQ(class_info.instance_members_function_id, initializer_id);
1243 DCHECK_EQ(class_info.static_elements_function_id, initializer_id);
1249 if (has_error())
return nullptr;
1271 if (next == Token::kExport) {
1275 if (next == Token::kImport) {
1279 if (peek_ahead != Token::kLeftParen && peek_ahead != Token::kPeriod) {
1281 return factory()->EmptyStatement();
1285 return ParseStatementListItem();
1297 DCHECK(scope()->is_module_scope());
1298 while (peek() != Token::kEos) {
1300 if (stat ==
nullptr)
return;
1301 if (stat->IsEmptyStatement())
continue;
1310 Expect(Token::kString);
1338 Expect(Token::kLeftBrace);
1341 while ((name_tok = peek()) != Token::kRightBrace) {
1343 if (!string_literal_local_name_loc->
IsValid() &&
1344 name_tok == Token::kString) {
1347 *string_literal_local_name_loc = scanner()->location();
1348 }
else if (!reserved_loc->
IsValid() &&
1350 flags().is_module())) {
1353 *reserved_loc = scanner()->location();
1357 if (CheckContextualKeyword(ast_value_factory()->as_string())) {
1361 location.
end_pos = scanner()->location().end_pos;
1363 export_name = local_name;
1365 export_data->
push_back({export_name, local_name, location});
1366 if (peek() == Token::kRightBrace)
break;
1368 ReportUnexpectedToken(Next());
1373 Expect(Token::kRightBrace);
1386 if (next == Token::kString) {
1390 reinterpret_cast<const uint16_t*
>(export_name->
raw_data()),
1391 export_name->
length())) {
1394 ReportMessage(MessageTemplate::kInvalidModuleExportName);
1398 ReportUnexpectedToken(next);
1417 Expect(Token::kLeftBrace);
1420 while (peek() != Token::kRightBrace) {
1427 if (CheckContextualKeyword(ast_value_factory()->as_string())) {
1428 local_name = ParsePropertyName();
1432 flags().is_module())) {
1433 ReportMessage(MessageTemplate::kUnexpectedReserved);
1436 ReportMessage(MessageTemplate::kStrictEvalArguments);
1444 zone()->New<NamedImport>(import_name, local_name, location);
1445 result->Add(
import, zone());
1447 if (peek() == Token::kRightBrace)
break;
1448 Expect(Token::kComma);
1451 Expect(Token::kRightBrace);
1466 if (
v8_flags.harmony_import_attributes && Check(Token::kWith)) {
1469 return import_attributes;
1472 Expect(Token::kLeftBrace);
1474 while (peek() != Token::kRightBrace) {
1476 Check(Token::kString) ?
GetSymbol() : ParsePropertyName();
1480 Expect(Token::kColon);
1481 Expect(Token::kString);
1487 location.
end_pos = scanner()->location().end_pos;
1489 auto result = import_attributes->insert(std::make_pair(
1490 attribute_key, std::make_pair(attribute_value, location)));
1493 ReportMessageAt(location, MessageTemplate::kImportAttributesDuplicateKey,
1498 if (peek() == Token::kRightBrace)
break;
1500 ReportUnexpectedToken(Next());
1505 Expect(Token::kRightBrace);
1507 return import_attributes;
1529 int pos = peek_position();
1530 Expect(Token::kImport);
1535 if (tok == Token::kString) {
1540 module()->AddEmptyImport(module_specifier, import_attributes, specifier_loc,
1549 if (tok != Token::kMul && tok != Token::kLeftBrace) {
1550 if (
v8_flags.js_source_phase_imports &&
1551 PeekContextualKeyword(ast_value_factory()->source_string()) &&
1552 PeekAhead() == Token::kIdentifier &&
1553 PeekAheadAhead() == Token::kIdentifier) {
1554 Consume(Token::kIdentifier);
1557 import_default_binding = ParseNonRestrictedIdentifier();
1558 import_default_binding_loc = scanner()->location();
1564 const AstRawString* module_namespace_binding =
nullptr;
1568 (import_default_binding ==
nullptr || Check(Token::kComma))) {
1571 Consume(Token::kMul);
1572 ExpectContextualKeyword(ast_value_factory()->as_string());
1573 module_namespace_binding = ParseNonRestrictedIdentifier();
1574 module_namespace_binding_loc = scanner()->location();
1580 case Token::kLeftBrace:
1585 ReportUnexpectedToken(scanner()->current_token());
1590 ExpectContextualKeyword(ast_value_factory()->from_string());
1609 if (module_namespace_binding !=
nullptr) {
1611 module()->AddStarImport(module_namespace_binding, module_specifier,
1612 import_attributes, module_namespace_binding_loc,
1613 specifier_loc, zone());
1616 if (import_default_binding !=
nullptr) {
1619 module()->AddImport(ast_value_factory()->default_string(),
1620 import_default_binding, module_specifier, import_phase,
1621 import_attributes, import_default_binding_loc,
1622 specifier_loc, zone());
1625 if (named_imports !=
nullptr) {
1627 if (named_imports->
length() == 0) {
1628 module()->AddEmptyImport(module_specifier, import_attributes,
1629 specifier_loc, zone());
1631 for (
const NamedImport*
import : *named_imports) {
1632 module()->AddImport(import->import_name, import->local_name,
1633 module_specifier, import_phase, import_attributes,
1634 import->location, specifier_loc, zone());
1646 Expect(Token::kDefault);
1652 case Token::kFunction:
1653 result = ParseHoistableDeclaration(&local_names,
true);
1657 Consume(Token::kClass);
1658 result = ParseClassDeclaration(&local_names,
true);
1662 if (PeekAhead() == Token::kFunction &&
1663 !scanner()->HasLineTerminatorAfterNext()) {
1664 Consume(Token::kAsync);
1665 result = ParseAsyncFunctionDeclaration(&local_names,
true);
1672 AcceptINScope scope(
this,
true);
1673 Expression* value = ParseAssignmentExpression();
1677 ast_value_factory()->dot_default_string();
1678 local_names.
Add(local_name, zone());
1686 Assignment* assignment = factory()->NewAssignment(
1698 module()->AddExport(local_names.
first(),
1699 ast_value_factory()->default_string(), default_loc,
1707 const char* prefix =
".ns-export";
1708 std::string
s(prefix);
1710 return ast_value_factory()->GetOneByteString(s.c_str());
1715 Consume(Token::kMul);
1717 if (!PeekContextualKeyword(ast_value_factory()->as_string())) {
1720 ExpectContextualKeyword(ast_value_factory()->from_string());
1725 module()->AddStarExport(module_specifier, import_attributes, loc,
1726 specifier_loc, zone());
1742 ExpectContextualKeyword(ast_value_factory()->as_string());
1750 ExpectContextualKeyword(ast_value_factory()->from_string());
1756 module()->AddStarImport(local_name, module_specifier, import_attributes,
1757 local_name_loc, specifier_loc, zone());
1758 module()->AddExport(local_name, export_name, export_name_loc, zone());
1782 Expect(Token::kExport);
1787 case Token::kDefault:
1792 return factory()->EmptyStatement();
1794 case Token::kLeftBrace: {
1811 if (CheckContextualKeyword(ast_value_factory()->from_string())) {
1818 if (export_data->
empty()) {
1819 module()->AddEmptyImport(module_specifier, import_attributes,
1820 specifier_loc, zone());
1823 module()->AddExport(data.local_name, data.export_name,
1824 module_specifier, import_attributes,
1825 data.location, specifier_loc, zone());
1831 ReportMessageAt(reserved_loc, MessageTemplate::kUnexpectedReserved);
1833 }
else if (string_literal_local_name_loc.
IsValid()) {
1834 ReportMessageAt(string_literal_local_name_loc,
1835 MessageTemplate::kModuleExportNameWithoutFromClause);
1842 module()->AddExport(data.local_name, data.export_name, data.location,
1846 return factory()->EmptyStatement();
1849 case Token::kFunction:
1850 result = ParseHoistableDeclaration(&names,
false);
1854 Consume(Token::kClass);
1855 result = ParseClassDeclaration(&names,
false);
1861 result = ParseVariableStatement(kStatementListItem, &names);
1865 Consume(Token::kAsync);
1866 if (peek() == Token::kFunction &&
1867 !scanner()->HasLineTerminatorBeforeNext()) {
1868 result = ParseAsyncFunctionDeclaration(&names,
false);
1874 ReportUnexpectedToken(scanner()->current_token());
1877 loc.
end_pos = scanner()->location().end_pos;
1881 descriptor->
AddExport(name, name, loc, zone());
1891 &was_added,
pos, end_position());
1904 Variable::DefaultInitializationFlag(mode),
1905 scope(), &was_added,
pos, end_position());
1912 bool* was_added,
int initializer_position) {
1914 proxy->
raw_name(),
kind, mode, Variable::DefaultInitializationFlag(mode),
1922 Scope* scope,
bool* was_added,
int begin,
1927 declaration = factory()->NewNestedVariableDeclaration(scope, begin);
1929 declaration = factory()->NewVariableDeclaration(begin);
1938 int var_begin_pos,
int var_end_pos) {
1939 bool local_ok =
true;
1940 bool sloppy_mode_block_scope_function_redefinition =
false;
1942 declaration, name, var_begin_pos, mode, variable_kind, init, was_added,
1943 &sloppy_mode_block_scope_function_redefinition, &local_ok);
1950 : var_begin_pos + 1);
1952 ReportMessageAt(loc, MessageTemplate::kParamDupe);
1954 ReportMessageAt(loc, MessageTemplate::kVarRedeclaration,
1957 }
else if (sloppy_mode_block_scope_function_redefinition) {
1963 DeclarationParsingResult* parsing_result) {
1965 for (
const auto&
declaration : parsing_result->declarations) {
1970 return factory()->NewBlock(
true, statements);
1978 factory()->NewFunctionDeclaration(function, beg_pos);
1981 &was_added, beg_pos);
1982 if (
info()->
flags().coverage_enabled()) {
1987 if (names) names->Add(variable_name, zone());
1990 loop_nesting_depth() > 0 ? Token::kAssign : Token::kInit;
1992 factory()->NewSloppyBlockFunctionStatement(end_pos,
declaration->var(),
1994 GetDeclarationScope()->DeclareSloppyBlockFunction(
statement);
1997 return factory()->EmptyStatement();
2003 int class_token_pos,
int end_pos) {
2007 if (names) names->Add(variable_name, zone());
2010 factory()->NewAssignment(Token::kInit, proxy, value, class_token_pos);
2020 GetClosureScope()->ForceEagerCompilation();
2028 return factory()->NewExpressionStatement(
2034 Block* block = factory()->NewBlock(1,
true);
2055 Block* switch_block = factory()->NewBlock(2,
false);
2059 NewTemporary(ast_value_factory()->dot_switch_tag_string());
2060 Assignment* tag_assign = factory()->NewAssignment(
2061 Token::kAssign, factory()->NewVariableProxy(tag_variable), tag,
2067 switch_block->
statements()->Add(tag_statement, zone());
2069 switch_statement->
set_tag(factory()->NewVariableProxy(tag_variable));
2070 Block* cases_block = factory()->NewBlock(1,
false);
2071 cases_block->
statements()->Add(switch_statement, zone());
2073 switch_block->
statements()->Add(cases_block, zone());
2074 return switch_block;
2079 const DeclarationParsingResult::Declaration*
declaration) {
2080 if (has_error())
return;
2088 Assignment* assignment = factory()->NewAssignment(
2090 statements->
Add(factory()->NewExpressionStatement(assignment,
pos));
2096 DeclarationParsingResult::Declaration decl(
2097 catch_info->pattern, factory()->NewVariableProxy(catch_info->variable));
2101 return factory()->NewBlock(
true, init_statements);
2106 if (decl->var()->raw_name() == name) {
2112 ReportMessageAt(location, MessageTemplate::kVarRedeclaration, name);
2121 Block* finally_block,
2123 const CatchInfo& catch_info,
int pos) {
2129 if (catch_block !=
nullptr && finally_block !=
nullptr) {
2132 statement = factory()->NewTryCatchStatement(try_block, catch_info.
scope,
2136 try_block = factory()->NewBlock(1,
false);
2138 catch_block =
nullptr;
2141 if (catch_block !=
nullptr) {
2144 try_block, catch_info.
scope, catch_block,
pos);
2150 factory()->NewTryFinallyStatement(try_block, finally_block,
pos);
2162 ParseStatementList(body, Token::kRightBrace);
2172 ParseStatementList(body, Token::kRightBrace);
2179 function_scope->
LookupLocal(function_name) ==
nullptr) {
2202 const DeclarationParsingResult::Declaration& decl =
2203 for_info.parsing_result.declarations[0];
2205 decl.initializer !=
nullptr && decl.pattern->IsVariableProxy()) {
2207 const AstRawString* name = decl.pattern->AsVariableProxy()->raw_name();
2209 Block* init_block = factory()->NewBlock(2,
true);
2211 factory()->NewExpressionStatement(
2212 factory()->NewAssignment(Token::kAssign, single_var,
2213 decl.initializer, decl.value_beg_pos),
2238 DCHECK_EQ(1, for_info->parsing_result.declarations.size());
2239 DeclarationParsingResult::Declaration& decl =
2240 for_info->parsing_result.declarations[0];
2244 decl.initializer = factory()->NewVariableProxy(temp, for_info->position);
2247 *body_block = factory()->NewBlock(3,
false);
2250 ->Add(factory()->NewBlock(
true, each_initialization_statements), zone());
2251 *each_variable = factory()->NewVariableProxy(temp, for_info->position);
2256 const ForInfo& for_info) {
2260 init_block = factory()->NewBlock(1,
false);
2262 for (
const AstRawString* bound_name : for_info.bound_names) {
2314 DCHECK_GT(for_info.bound_names.length(), 0);
2317 Block* outer_block =
2318 factory()->NewBlock(for_info.bound_names.length() + 4,
false);
2321 outer_block->
statements()->Add(init, zone());
2323 const AstRawString* temp_name = ast_value_factory()->dot_for_string();
2327 for (
const AstRawString* bound_name : for_info.bound_names) {
2330 VariableProxy* temp_proxy = factory()->NewVariableProxy(temp);
2331 Assignment* assignment = factory()->NewAssignment(
2335 outer_block->
statements()->Add(assignment_statement, zone());
2343 VariableProxy* first_proxy = factory()->NewVariableProxy(first);
2345 Assignment* assignment = factory()->NewAssignment(
2349 outer_block->
statements()->Add(assignment_statement, zone());
2354 factory()->NewExpressionStatement(
2364 outer_block->
statements()->Add(outer_loop, zone());
2367 Block* inner_block = factory()->NewBlock(3,
false);
2369 BlockState block_state(&
scope_, inner_scope);
2371 Block* ignore_completion_block =
2372 factory()->NewBlock(for_info.bound_names.length() + 3,
true);
2376 for (
int i = 0;
i < for_info.bound_names.
length();
i++) {
2378 for_info.bound_names[
i], for_info.parsing_result.descriptor.mode,
2380 inner_vars.
Add(proxy->
var());
2382 Assignment* assignment = factory()->NewAssignment(
2386 int declaration_pos = for_info.parsing_result.descriptor.declaration_pos;
2389 ignore_completion_block->
statements()->Add(assignment_statement, zone());
2399 VariableProxy* first_proxy = factory()->NewVariableProxy(first);
2400 compare = factory()->NewCompareOperation(Token::kEq, first_proxy,
2406 VariableProxy* first_proxy = factory()->NewVariableProxy(first);
2408 Assignment* assignment = factory()->NewAssignment(
2413 Statement* clear_first_or_next = factory()->NewIfStatement(
2415 ignore_completion_block->
statements()->Add(clear_first_or_next, zone());
2421 VariableProxy* flag_proxy = factory()->NewVariableProxy(flag);
2423 Assignment* assignment = factory()->NewAssignment(
2427 ignore_completion_block->
statements()->Add(assignment_statement, zone());
2434 Statement* noop = factory()->EmptyStatement();
2436 factory()->NewIfStatement(cond, noop, stop, cond->
position()),
2440 inner_block->
statements()->Add(ignore_completion_block, zone());
2445 VariableProxy* flag_proxy = factory()->NewVariableProxy(flag);
2446 flag_cond = factory()->NewCompareOperation(Token::kEq, flag_proxy, const1,
2451 Statement* compound_next_statement =
nullptr;
2456 VariableProxy* flag_proxy = factory()->NewVariableProxy(flag);
2458 compound_next = factory()->NewAssignment(Token::kAssign, flag_proxy,
2463 int inner_var_proxy_pos = scanner()->location().beg_pos;
2464 for (
int i = 0;
i < for_info.bound_names.
length();
i++) {
2467 factory()->NewVariableProxy(inner_vars.
at(
i), inner_var_proxy_pos);
2468 Assignment* assignment = factory()->NewAssignment(
2470 compound_next = factory()->NewBinaryOperation(
2474 compound_next_statement =
2482 loop->
Initialize(
nullptr, flag_cond, compound_next_statement, body);
2483 inner_block->
statements()->Add(loop, zone());
2491 VariableProxy* flag_proxy = factory()->NewVariableProxy(flag);
2492 compare = factory()->NewCompareOperation(Token::kEq, flag_proxy, const1,
2497 Statement* empty = factory()->EmptyStatement();
2506 outer_loop->
Initialize(
nullptr,
nullptr,
nullptr, inner_block);
2513 parser->ReportMessageAt(
duplicate_loc, MessageTemplate::kParamDupe);
2539 if (expr->IsNaryOperation()) {
2559 if (expr->IsBinaryOperation()) {
2575 bool is_rest = expr->IsSpread();
2577 expr = expr->AsSpread()->expression();
2584 if (expr->IsAssignment()) {
2585 Assignment* assignment = expr->AsAssignment();
2586 DCHECK(!assignment->IsCompoundAssignment());
2587 initializer = assignment->
value();
2588 expr = assignment->
target();
2597 if (expr->IsEmptyParentheses() || has_error())
return;
2602 ReportMessageAt(params_loc, MessageTemplate::kMalformedArrowFunParamList);
2615 for (
auto p : parameters->
params) {
2616 if (p->pattern !=
nullptr) reindexer.
Reindex(p->pattern);
2617 if (p->initializer() !=
nullptr) {
2618 reindexer.
Reindex(p->initializer());
2620 if (reindexer.HasStackOverflow()) {
2621 set_stack_overflow();
2631 reindexer.
Reindex(computed_name);
2638 function_state_->scope()->DeclareGeneratorObjectVar(
2639 ast_value_factory()->dot_generator_object_string());
2658 DCHECK_EQ(is_wrapped, arguments_for_wrapped_function !=
nullptr);
2661 : function_token_pos;
2667 bool should_infer_name = function_name ==
nullptr;
2671 if (should_infer_name) {
2672 function_name = ast_value_factory()->empty_string();
2677 int compile_hint_position = peek_position();
2680 function_state_->next_function_is_likely_called() || is_wrapped ||
2681 params_need_validation ||
2682 (
info()->
flags().compile_hints_magic_enabled() &&
2683 scanner()->SawMagicCommentCompileHintsAll()) ||
2684 (
info()->
flags().compile_hints_per_function_magic_enabled() &&
2685 scanner()->HasPerFunctionCompileHint(compile_hint_position))
2687 : default_eager_compile_hint();
2725 eager_compile_hint =
2728 const bool is_lazy =
2731 const bool is_eager_top_level_function = !is_lazy && is_top_level;
2733 RCS_SCOPE(runtime_call_stats_, RuntimeCallCounterId::kParseFunctionLiteral,
2734 RuntimeCallStats::kThreadSpecific);
2746 const bool can_post_parallel_task =
2748 scanner()->stream()->can_be_cloned_for_parallel_access();
2752 bool should_post_parallel_task =
2753 can_post_parallel_task && !
flags().is_reparse() &&
2754 ((is_eager_top_level_function &&
2755 flags().post_parallel_compile_tasks_for_eager_toplevel()) ||
2756 (is_lazy &&
flags().post_parallel_compile_tasks_for_lazy()));
2762 const bool should_preparse =
2763 can_preparse && (is_lazy || should_post_parallel_task);
2766 int expected_property_count = 0;
2767 int suspend_count = -1;
2768 int num_parameters = -1;
2769 int function_length = -1;
2771 int function_literal_id = GetNextInfoId();
2784 scope->SetScopeName(function_name);
2787 if (!is_wrapped &&
V8_UNLIKELY(!Check(Token::kLeftParen))) {
2788 ReportUnexpectedToken(Next());
2798 bool did_preparse_successfully =
2801 &num_parameters, &function_length, &produced_preparse_data);
2803 if (!did_preparse_successfully) {
2806 if (should_preparse) Consume(Token::kLeftParen);
2807 should_post_parallel_task =
false;
2810 &expected_property_count, &suspend_count,
2811 arguments_for_wrapped_function);
2815 double ms = timer.Elapsed().InMillisecondsF();
2816 const char* event_name =
2818 ? (is_top_level ?
"preparse-no-resolution" :
"preparse-resolution")
2820 v8_file_logger_->FunctionEvent(
2823 reinterpret_cast<const char*
>(function_name->
raw_data()),
2826#ifdef V8_RUNTIME_CALL_STATS
2827 if (did_preparse_successfully && runtime_call_stats_ &&
2828 V8_UNLIKELY(TracingFlags::is_runtime_stats_enabled())) {
2829 runtime_call_stats_->CorrectCurrentCounterId(
2830 RuntimeCallCounterId::kPreParseWithVariableResolution,
2831 RuntimeCallStats::kThreadSpecific);
2838 CheckFunctionName(language_mode, function_name, function_name_validity,
2839 function_name_location);
2851 function_name, scope, body, expected_property_count, num_parameters,
2852 function_length, duplicate_parameters, function_syntax_kind,
2853 eager_compile_hint,
pos,
true, function_literal_id,
2854 produced_preparse_data);
2860 if (should_post_parallel_task && !has_error()) {
2864 if (should_infer_name) {
2865 fni_.AddFunction(function_literal);
2867 return function_literal;
2873 int* function_length,
2875 FunctionState function_state(&function_state_, &
scope_, function_scope);
2882 scanner()->current_token() == Token::kArrow);
2888 int num_inner_infos;
2889 bool uses_super_property;
2890 if (stack_overflow())
return true;
2893 *produced_preparse_data =
2896 num_parameters, function_length, &num_inner_infos,
2897 &uses_super_property, &language_mode);
2903 scanner()->SeekForward(end_position - 1);
2904 Expect(Token::kRightBrace);
2906 if (uses_super_property) {
2909 SkipInfos(num_inner_infos);
2919 if (!private_name_scope_iter.
Done()) {
2920 unresolved_private_tail =
2929 function_name,
kind, function_syntax_kind, function_scope,
use_counts_,
2930 produced_preparse_data);
2934 set_stack_overflow();
2935 }
else if (pending_error_handler()->has_error_unidentifiable_by_preparser()) {
2940 DCHECK(!pending_error_handler()->stack_overflow());
2945 if (!private_name_scope_iter.
Done()) {
2947 unresolved_private_tail);
2950 pending_error_handler()->clear_unidentifiable_error();
2952 }
else if (pending_error_handler()->has_pending_error()) {
2953 DCHECK(!pending_error_handler()->stack_overflow());
2956 DCHECK(!pending_error_handler()->stack_overflow());
2961 Expect(Token::kRightBrace);
2967 if (!private_name_scope_iter.
Done()) {
2969 factory(), unresolved_private_tail);
2971 function_scope->
AnalyzePartially(
this, factory(), MaybeParsingArrowhead());
2980 DCHECK(scope()->is_function_scope());
2984 for (
auto parameter : parameters.
params) {
2987 if (parameter->initializer() !=
nullptr) {
2990 auto condition = factory()->NewCompareOperation(
2995 factory()->NewConditional(
condition, parameter->initializer(),
2999 BlockState block_state(&
scope_, scope()->AsDeclarationScope());
3000 DeclarationParsingResult::Declaration decl(parameter->pattern,
3006 return factory()->NewParameterInitializationBlock(init_statements);
3010 Expression* yield_result = factory()->NewVariableProxy(
3011 function_state_->scope()->generator_object_var());
3015 function_state_->AddSuspend();
3016 return factory()->NewYield(yield_result, scope()->start_position(),
3023 DeclarationScope* function_scope,
int* num_parameters,
int* function_length,
3027 FunctionParsingScope function_parsing_scope(
this);
3030 FunctionState function_state(&function_state_, &
scope_, function_scope);
3040 DCHECK_EQ(function_name, ast_value_factory()->empty_string());
3051 for (
const AstRawString* arg : *arguments_for_wrapped_function) {
3052 const bool is_rest =
false;
3057 DCHECK_EQ(arguments_for_wrapped_function->length(),
3063 ParseFormalParameterList(&formals);
3068 if (
position < expected_parameters_end_pos) {
3070 MessageTemplate::kArgStringTerminatesParametersEarly);
3072 }
else if (
position > expected_parameters_end_pos) {
3074 expected_parameters_end_pos),
3075 MessageTemplate::kUnexpectedEndOfArgString);
3079 Expect(Token::kRightParen);
3080 int formals_end_position = end_position();
3084 formals_end_position);
3085 Expect(Token::kLeftBrace);
3093 AcceptINScope scope(
this,
true);
3094 ParseFunctionBody(body, function_name,
pos, formals,
kind,
3095 function_syntax_kind, FunctionBodyType::kBlock);
3099 *expected_property_count = function_state.expected_property_count();
3100 *suspend_count = function_state.suspend_count();
3104 ClassInfo* class_info,
int class_token_pos) {
3106 scope->SetScopeName(name);
3124 is_static ? class_info->static_elements_scope
3125 : class_info->instance_members_scope;
3126 return declaration_scope->
NewUnresolved(factory()->ast_node_factory(), name,
3141 int end = end_position();
3142 bool was_added =
false;
3148 ReportMessageAt(loc, MessageTemplate::kVarRedeclaration, var->
raw_name());
3150 return factory()->NewVariableProxy(var, begin);
3154 ClassInfo* class_info,
3157 class_info->static_elements->Add(
3158 factory()->NewClassLiteralStaticElement(property), zone());
3161 class_info->instance_fields->Add(property, zone());
3166 bool is_static,
bool is_computed_name,
3167 ClassInfo* class_info) {
3170 if (is_computed_name) {
3174 ast_value_factory(), class_info->computed_field_count);
3177 property->set_computed_name_proxy(proxy);
3178 class_info->public_members->Add(property, zone());
3186 bool is_static, ClassInfo* class_info) {
3191 class_info->private_members->Add(property, zone());
3200 scope, GetVariableMode(
kind),
3203 int pos =
property->value()->position();
3205 pos =
property->key()->position();
3209 property->SetPrivateNameProxy(proxy);
3219 ClassInfo* class_info) {
3221 DCHECK(!class_info->constructor);
3222 class_info->constructor =
property->value()->AsFunctionLiteral();
3224 class_info->constructor->set_raw_name(
3225 class_name !=
nullptr ? ast_value_factory()->NewConsString(class_name)
3230 class_info->public_members->Add(property, zone());
3234 DCHECK(class_info->has_static_elements());
3235 class_info->static_elements->Add(
3236 factory()->NewClassLiteralStaticElement(block), zone());
3241 int function_literal_id,
Statement* initializer_stmt) {
3245 statements.
Add(initializer_stmt);
3247 class_name, scope, statements, 0, 0, 0,
3251 function_literal_id);
3253 scope->SetScopeName(class_name);
3263 name, class_info->static_elements_scope,
3264 class_info->static_elements_function_id,
3265 factory()->NewInitializeClassStaticElementsStatement(
3272 name, class_info->instance_members_scope,
3273 class_info->instance_members_function_id,
3274 factory()->NewInitializeClassMembersStatement(class_info->instance_fields,
3287 ClassInfo* class_info,
int pos) {
3292 bool has_extends = class_info->extends !=
nullptr;
3293 bool has_default_constructor = class_info->constructor ==
nullptr;
3295 if (has_default_constructor) {
3305 if (class_info->has_static_elements()) {
3310 if (class_info->has_instance_members()) {
3311 instance_members_initializer_function =
3313 class_info->constructor->set_requires_instance_members_initializer(
true);
3314 class_info->constructor->add_expected_properties(
3315 class_info->instance_fields->length());
3318 if (class_info->requires_brand) {
3319 class_info->constructor->set_class_scope_has_private_brand(
true);
3321 if (class_info->has_static_private_methods_or_accessors) {
3322 class_info->constructor->set_has_static_private_methods_or_accessors(
true);
3324 ClassLiteral* class_literal = factory()->NewClassLiteral(
3325 block_scope, class_info->extends, class_info->constructor,
3326 class_info->public_members, class_info->private_members,
3327 static_initializer, instance_members_initializer_function,
pos, end_pos,
3328 class_info->has_static_computed_names, class_info->is_anonymous,
3329 class_info->home_object_variable,
3330 class_info->static_home_object_variable);
3333 return class_literal;
3343 BlockState block_state(&
scope_, inner_scope);
3348 std::set<Variable*> hoisted_func_vars;
3349 std::vector<std::pair<Variable*, Variable*>> var_param_bindings;
3351 if (!decl->IsVariableDeclaration()) {
3352 hoisted_func_vars.insert(decl->var());
3359 if (parameter ==
nullptr)
continue;
3360 var_param_bindings.push_back(std::pair(decl->var(), parameter));
3363 for (
auto decl : var_param_bindings) {
3364 if (hoisted_func_vars.find(decl.first) != hoisted_func_vars.end()) {
3369 VariableProxy* from = factory()->NewVariableProxy(decl.second);
3392template <
typename IsolateT>
3397 script->set_source_url(*source_url);
3402 if (!source_mapping_url.
is_null() &&
3403 IsUndefined(script->source_mapping_url(isolate), isolate)) {
3404 script->set_source_mapping_url(*source_mapping_url);
3425 if (script->line_offset() == 0 && script->column_offset() == 0) {
3440 int* preparse_skipped) {
3450 if (script->line_offset() == 0 && script->column_offset() == 0) {
3466 int end_position,
int function_literal_id) {
3467 RCS_SCOPE(isolate, RuntimeCallCounterId::kParseProgram,
3468 RuntimeCallStats::CounterMode::kThreadSpecific);
3469 parsing_on_main_thread_ =
false;
3476 isolate->ParkIfOnBackgroundAndExecute([
this, start_position, end_position,
3477 function_literal_id, info, &
result]() {
3489 if (
flags().is_toplevel()) {
3495 std::optional<ClassScope::HeritageParsingScope> heritage;
3497 original_scope_->is_class_scope())) {
3501 heritage.emplace(original_scope_->AsClassScope());
3504 end_position, function_literal_id,
3505 info->function_name());
3507 if (
result ==
nullptr)
return;
3511 if (
flags().is_toplevel()) {
3514 if (
result ==
nullptr)
return;
3524 int end = scanner()->location().end_pos - (tail ? 1 : 2);
3525 const AstRawString* raw = scanner()->CurrentRawSymbol(ast_value_factory());
3527 const AstRawString* cooked = scanner()->CurrentSymbol(ast_value_factory());
3528 (*state)->AddTemplateSpan(cooked, raw,
end, zone());
3530 (*state)->AddTemplateSpan(
nullptr, raw,
end, zone());
3536 (*state)->AddExpression(expression, zone());
3550 if (cooked_strings->
length() == 1) {
3551 return factory()->NewStringLiteral(cooked_strings->
first(),
pos);
3553 return factory()->NewTemplateLiteral(cooked_strings, expressions,
pos);
3557 factory()->NewGetTemplateObject(cooked_strings, raw_strings,
pos);
3561 call_args.
Add(template_object);
3563 return factory()->NewTaggedTemplate(tag, call_args,
pos);
3579#if V8_ENABLE_WEBASSEMBLY
3580void Parser::SetAsmModule() {
3584 DCHECK(scope()->is_declaration_scope());
3585 scope()->AsDeclarationScope()->set_is_asm_module();
3586 info_->set_contains_asm_module(
true);
3593 if (
args.length() == 1)
return expr;
3594 if (
args.length() == 2) {
3595 return factory()->NewBinaryOperation(Token::kComma, expr,
args.at(1),
3599 factory()->NewNaryOperation(Token::kComma, expr,
args.length() - 1);
3609 if (has_error())
return;
3612 if (property->NeedsSetFunctionName()) {
3619 DCHECK_IMPLIES(property->value()->IsAnonymousFunctionDefinition() ||
3620 property->value()->IsConciseMethodDefinition() ||
3621 property->value()->IsAccessorFunctionDefinition(),
3635 if (property->IsPrototype() || has_error())
return;
3637 DCHECK(!property->value()->IsAnonymousFunctionDefinition() ||
3654 if (!value->IsAnonymousFunctionDefinition() &&
3655 !value->IsConciseMethodDefinition() &&
3656 !value->IsAccessorFunctionDefinition()) {
3659 auto function = value->AsFunctionLiteral();
3660 if (value->IsClassLiteral()) {
3661 function = value->AsClassLiteral()->constructor();
3663 if (function !=
nullptr) {
3665 if (name !=
nullptr) {
3666 if (prefix !=
nullptr) {
3667 cons_name = ast_value_factory()->NewConsString(prefix, name);
3669 cons_name = ast_value_factory()->NewConsString(name);
3674 function->set_raw_name(cons_name);
static bool HasUnpairedSurrogate(const uint16_t *code_units, size_t length)
@ kHtmlCommentInExternalScript
@ kSourceMappingUrlMagicCommentAtSign
@ kUseCounterFeatureCount
@ kSloppyModeBlockScopedFunctionRedefinition
void emplace_back(Args &&... args)
Expression * target() const
Expression * value() const
void Reindex(Expression *pattern)
const unsigned char * raw_data() const
Expression * right() const
Expression * left() const
void set_scope(Scope *scope)
ZonePtrList< Statement > * statements()
void ResetUnresolvedPrivateNameTail(UnresolvedList::Iterator tail)
Variable * DeclareClassVariable(AstValueFactory *ast_value_factory, const AstRawString *name, int class_token_pos)
void MigrateUnresolvedPrivateNameTail(AstNodeFactory *ast_node_factory, UnresolvedList::Iterator tail)
Variable * class_variable()
Variable * DeclarePrivateName(const AstRawString *name, VariableMode mode, IsStaticFlag is_static_flag, bool *was_added)
UnresolvedList::Iterator GetUnresolvedPrivateNameTail()
static const int kMaxArguments
size_t conditional_chain_length() const
void set_else_expression(Expression *s)
void AddChainEntry(Expression *cond, Expression *then, int pos)
virtual ProducedPreparseData * GetDataForSkippableFunction(Zone *zone, int start_position, int *end_position, int *num_parameters, int *function_length, int *num_inner_functions, bool *uses_super_property, LanguageMode *language_mode)=0
void ResetAfterPreparsing(AstValueFactory *ast_value_factory, bool aborted)
static V8_WARN_UNUSED_RESULT bool Analyze(ParseInfo *info)
void set_is_skipped_function(bool is_skipped_function)
FunctionKind function_kind() const
void DeserializeReceiver(AstValueFactory *ast_value_factory)
void HoistSloppyBlockFunctions(AstNodeFactory *factory)
void RecordSuperPropertyUsage()
void set_zone(Zone *zone)
void AnalyzePartially(Parser *parser, AstNodeFactory *ast_node_factory, bool maybe_in_arrowhead)
Variable * parameter(int index) const
void set_has_checked_syntax(bool has_checked_syntax)
Variable * DeclareParameter(const AstRawString *name, VariableMode mode, bool is_optional, bool is_rest, AstValueFactory *ast_value_factory, int position)
Variable * DeclareFunctionVar(const AstRawString *name, Scope *cache=nullptr)
void set_module_has_toplevel_await()
bool has_simple_parameters() const
void TakeUnresolvedReferencesFromParent()
V8_INLINE bool is_null() const
void ValidateExpression()
void clear_parenthesized()
void Initialize(Statement *init, Expression *cond, Statement *next, Statement *body)
FunctionKind kind() const
int function_literal_id() const
@ kHasDuplicateParameters
void set_should_parallel_compile()
void set_suspend_count(int suspend_count)
DeclarationScope * scope() const
void set_function_token_position(int pos)
V8_WARN_UNUSED_RESULT V8_INLINE bool ToHandle(DirectHandle< S > *out) const
Expression * subsequent(size_t index) const
int subsequent_op_position(size_t index) const
void AddSubsequent(Expression *expr, int pos)
size_t subsequent_length() const
Expression * first() const
const Scanner::Location & duplicate_location() const
LazyCompileDispatcher * dispatcher() const
const UnoptimizedCompileFlags & flags() const
SourceRangeMap * source_range_map() const
const ZonePtrList< Expression > * expressions() const
const ZonePtrList< const AstRawString > * raw() const
const ZonePtrList< const AstRawString > * cooked() const
void SetLanguageMode(Scope *scope, LanguageMode mode)
void Declare(Declaration *declaration, const AstRawString *name, VariableKind kind, VariableMode mode, InitializationFlag init, Scope *declaration_scope, bool *was_added, int var_begin_pos, int var_end_pos=kNoSourcePosition)
bool CollapseNaryExpression(Expression **x, Expression *y, Token::Value op, int pos, const SourceRange &range)
Parser(LocalIsolate *local_isolate, ParseInfo *info)
bool AllowsLazyParsingWithoutUnresolvedVariables() const
V8_INLINE void AddFunctionForNameInference(FunctionLiteral *func_to_infer)
void DeclarePublicClassField(ClassScope *scope, ClassLiteralProperty *property, bool is_static, bool is_computed_name, ClassInfo *class_info)
void ParseGeneratorFunctionBody(int pos, FunctionKind kind, ScopedPtrList< Statement > *body)
Statement * RewriteSwitchStatement(SwitchStatement *switch_statement, Scope *scope)
Statement * DeclareNative(const AstRawString *name, int pos)
void UpdateStatistics(Isolate *isolate, DirectHandle< Script > script)
void InsertSloppyBlockFunctionVarBindings(DeclarationScope *scope)
Expression * NewV8Intrinsic(const AstRawString *name, const ScopedPtrList< Expression > &args, int pos)
int use_counts_[v8::Isolate::kUseCounterFeatureCount]
Block * RewriteForVarInLegacy(const ForInfo &for_info)
void ParseModuleItemList(ScopedPtrList< Statement > *body)
const AstRawString * GetBigIntAsSymbol()
void DeclareFunctionNameVar(const AstRawString *function_name, FunctionSyntaxKind function_syntax_kind, DeclarationScope *function_scope)
Statement * ParseExportDeclaration()
ZonePtrList< const NamedImport > * ParseNamedImports(int pos)
void DeserializeScopeChain(IsolateT *isolate, ParseInfo *info, MaybeDirectHandle< ScopeInfo > maybe_outer_scope_info, Scope::DeserializationMode mode=Scope::DeserializationMode::kScopesOnly)
bool SkipFunction(const AstRawString *function_name, FunctionKind kind, FunctionSyntaxKind function_syntax_kind, DeclarationScope *function_scope, int *num_parameters, int *function_length, ProducedPreparseData **produced_preparsed_scope_data)
FunctionLiteral * DefaultConstructor(const AstRawString *name, bool call_super, int pos)
void InitializeEmptyScopeChain(ParseInfo *info)
void ParseImportDeclaration()
void AppendConditionalChainElse(Expression **x, const SourceRange &else_range)
void AddTemplateSpan(TemplateLiteralState *state, bool should_cook, bool tail)
Expression * NewTargetExpression(int pos)
void ParseAsyncGeneratorFunctionBody(int pos, FunctionKind kind, ScopedPtrList< Statement > *body)
V8_INLINE void RecordTryFinallyStatementSourceRange(TryFinallyStatement *node, const SourceRange &body_range)
AutoAccessorInfo * NewAutoAccessorInfo(ClassScope *scope, ClassInfo *class_info, const AstRawString *name, bool is_static, int pos)
V8_WARN_UNUSED_RESULT Variable * DeclareVariable(const AstRawString *name, VariableKind kind, VariableMode mode, InitializationFlag init, Scope *declaration_scope, bool *was_added, int begin, int end=kNoSourcePosition)
Statement * ParseExportDefault()
Expression * RewriteClassLiteral(ClassScope *block_scope, const AstRawString *name, ClassInfo *class_info, int pos)
Expression * WrapREPLResult(Expression *value)
V8_INLINE VariableProxy * ExpressionFromPrivateName(PrivateNameScopeIterator *private_name_scope, const AstRawString *name, int start_position)
void InsertShadowingVarBindingInitializers(Block *block)
V8_INLINE bool IsEmptyIdentifier(const AstRawString *subject) const
void AddClassStaticBlock(Block *block, ClassInfo *class_info)
Expression * NewThrowError(Runtime::FunctionId function_id, MessageTemplate message, const AstRawString *arg, int pos)
V8_INLINE const AstRawString * GetSymbol() const
Statement * RewriteTryStatement(Block *try_block, Block *catch_block, const SourceRange &catch_range, Block *finally_block, const SourceRange &finally_range, const CatchInfo &catch_info, int pos)
TemplateLiteralState OpenTemplateLiteral(int pos)
void DeclarePublicClassMethod(const AstRawString *class_name, ClassLiteralProperty *property, bool is_constructor, ClassInfo *class_info)
void InitializeVariables(ScopedPtrList< Statement > *statements, VariableKind kind, const DeclarationParsingResult::Declaration *declaration)
ImportAttributes * ParseImportWithOrAssertClause()
V8_WARN_UNUSED_RESULT VariableProxy * DeclareBoundVariable(const AstRawString *name, VariableMode mode, int pos)
void DesugarBindingInForEachStatement(ForInfo *for_info, Block **body_block, Expression **each_variable)
FunctionLiteral * DoParseFunction(Isolate *isolate, ParseInfo *info, int start_position, int end_position, int function_literal_id, const AstRawString *raw_name)
Expression * CloseTemplateLiteral(TemplateLiteralState *state, int start, Expression *tag)
FunctionLiteral * MakeAutoAccessorGetter(VariableProxy *name_proxy, const AstRawString *name, bool is_static, int pos)
LocalIsolate * local_isolate_
V8_INLINE v8::Extension * extension() const
Variable * NewTemporary(const AstRawString *name)
Statement * DeclareClass(const AstRawString *variable_name, Expression *value, ZonePtrList< const AstRawString > *names, int class_token_pos, int end_pos)
void HandleSourceURLComments(IsolateT *isolate, DirectHandle< Script > script)
MaybeHandle< FixedArray > maybe_wrapped_arguments_
Statement * BuildInitializationBlock(DeclarationParsingResult *parsing_result)
VariableProxy * CreatePrivateNameVariable(ClassScope *scope, VariableMode mode, IsStaticFlag is_static_flag, const AstRawString *name)
friend bool v8::internal::parsing::ParseFunction(ParseInfo *, DirectHandle< SharedFunctionInfo > shared_info, Isolate *, parsing::ReportStatisticsMode stats_mode)
void ReindexComputedMemberName(Expression *computed_name)
ConsumedPreparseData * consumed_preparse_data_
void DeclareClassVariable(ClassScope *scope, const AstRawString *name, ClassInfo *class_info, int class_token_pos)
Block * RewriteCatchPattern(CatchInfo *catch_info)
FunctionLiteral * CreateInitializerFunction(const AstRawString *class_name, DeclarationScope *scope, int function_literal_id, Statement *initializer_stmt)
const AstRawString * NextInternalNamespaceExportName()
ZonePtrList< const AstRawString > * PrepareWrappedArguments(Isolate *isolate, ParseInfo *info, Zone *zone)
VariableProxy * CreateSyntheticContextVariableProxy(ClassScope *scope, ClassInfo *class_info, const AstRawString *name, bool is_static)
V8_INLINE void AppendConditionalChainElseSourceRange(ConditionalChain *node, const SourceRange &range)
V8_INLINE void AppendNaryOperationSourceRange(NaryOperation *node, const SourceRange &range)
void DeclareUnboundVariable(const AstRawString *name, VariableMode mode, InitializationFlag init, int pos)
void AddInstanceFieldOrStaticElement(ClassLiteralProperty *property, ClassInfo *class_info, bool is_static)
friend bool v8::internal::parsing::ParseProgram(ParseInfo *, DirectHandle< Script >, MaybeDirectHandle< ScopeInfo > maybe_outer_scope_info, Isolate *, parsing::ReportStatisticsMode stats_mode)
ClassLiteralProperty * NewClassLiteralPropertyWithAccessorInfo(ClassScope *scope, ClassInfo *class_info, const AstRawString *name, Expression *key, Expression *value, bool is_static, bool is_computed_name, bool is_private, int pos)
const AstRawString * ParseExportSpecifierName()
Statement * DesugarLexicalBindingsInForStatement(ForStatement *loop, Statement *init, Expression *cond, Statement *next, Statement *body, Scope *inner_scope, const ForInfo &for_info)
const AstRawString * ParseModuleSpecifier()
V8_INLINE void DeclareFormalParameters(ParserFormalParameters *parameters)
Expression * FailureExpression()
V8_INLINE bool ParsingExtension() const
Block * BuildParameterInitializationBlock(const ParserFormalParameters ¶meters)
V8_INLINE VariableProxy * ExpressionFromIdentifier(const AstRawString *name, int start_position, InferName infer=InferName::kYes)
V8_INLINE const AstRawString * GetIdentifier() const
Expression * NewV8RuntimeFunctionForFuzzing(const Runtime::Function *function, const ScopedPtrList< Expression > &args, int pos)
FunctionLiteral * MakeAutoAccessorSetter(VariableProxy *name_proxy, const AstRawString *name, bool is_static, int pos)
void ParseWrapped(Isolate *isolate, ParseInfo *info, ScopedPtrList< Statement > *body, DeclarationScope *scope, Zone *zone)
Expression * ExpressionListToExpression(const ScopedPtrList< Expression > &args)
V8_INLINE void AppendConditionalChainSourceRange(ConditionalChain *node, const SourceRange &range)
V8_INLINE void AddFormalParameter(ParserFormalParameters *parameters, Expression *pattern, Expression *initializer, int initializer_end_position, bool is_rest)
FunctionLiteral * ParseClassForMemberInitialization(FunctionKind initializer_kind, int initializer_pos, int initializer_id, int initializer_end_pos, const AstRawString *class_name)
void ReportUnexpectedTokenAt(Scanner::Location location, Token::Value token, MessageTemplate message=MessageTemplate::kUnexpectedToken)
void ReindexArrowFunctionFormalParameters(ParserFormalParameters *parameters)
void PrepareGeneratorVariables()
Expression * ImportMetaExpression(int pos)
static V8_INLINE std::nullptr_t NullExpression()
void SetFunctionNameFromPropertyName(LiteralProperty *property, const AstRawString *name, const AstRawString *prefix=nullptr)
ZoneChunkList< ExportClauseData > * ParseExportClause(Scanner::Location *reserved_loc, Scanner::Location *string_literal_local_name_loc)
Expression * BuildInitialYield(int pos, FunctionKind kind)
FunctionLiteral * DoParseProgram(Isolate *isolate, ParseInfo *info)
V8_INLINE const AstRawString * EmptyIdentifierString() const
bool ShortcutLiteralBinaryExpression(Expression **x, Expression *y, Token::Value op, int pos)
void DeclarePrivateClassMember(ClassScope *scope, const AstRawString *property_name, ClassLiteralProperty *property, ClassLiteralProperty::Kind kind, bool is_static, ClassInfo *class_info)
void SetFunctionNameFromIdentifierRef(Expression *value, Expression *identifier)
void ParseOnBackground(LocalIsolate *isolate, ParseInfo *info, DirectHandle< Script > script, int start_position, int end_position, int function_literal_id)
Statement * DeclareFunction(const AstRawString *variable_name, FunctionLiteral *function, VariableMode mode, VariableKind kind, int beg_pos, int end_pos, ZonePtrList< const AstRawString > *names)
void ParseREPLProgram(ParseInfo *info, ScopedPtrList< Statement > *body, DeclarationScope *scope)
FunctionLiteral * ParseFunctionLiteral(const AstRawString *name, Scanner::Location function_name_location, FunctionNameValidity function_name_validity, FunctionKind kind, int function_token_position, FunctionSyntaxKind type, LanguageMode language_mode, ZonePtrList< const AstRawString > *arguments_for_wrapped_function)
V8_INLINE void RecordFunctionLiteralSourceRange(FunctionLiteral *node)
SuperCallReference * NewSuperCallReference(int pos)
V8_INLINE bool IsEvalOrArguments(const AstRawString *identifier) const
bool CollapseConditionalChain(Expression **x, Expression *cond, Expression *then_expression, Expression *else_expression, int pos, const SourceRange &then_range)
Block * CreateForEachStatementTDZ(Block *init_block, const ForInfo &for_info)
void AddArrowFunctionFormalParameters(ParserFormalParameters *parameters, Expression *params, int end_pos)
Expression * BuildUnaryExpression(Expression *expression, Token::Value op, int pos)
void AddTemplateExpression(TemplateLiteralState *state, Expression *expression)
bool parse_lazily() const
FunctionLiteral * CreateStaticElementsInitializer(const AstRawString *name, ClassInfo *class_info)
V8_INLINE void RecordTryCatchStatementSourceRange(TryCatchStatement *node, const SourceRange &body_range)
Statement * ParseModuleItem()
void DeclareArrowFunctionFormalParameters(ParserFormalParameters *parameters, Expression *params, const Scanner::Location ¶ms_loc)
V8_INLINE FunctionLiteral::EagerCompileHint GetEmbedderCompileHint(FunctionLiteral::EagerCompileHint current_compile_hint, int position)
Block * IgnoreCompletion(Statement *statement)
Expression * ExpressionFromLiteral(Token::Value token, int pos)
int total_preparse_skipped_
int number_of_named_namespace_exports_
PreParser * reusable_preparser()
void DeclareAndBindVariable(VariableProxy *proxy, VariableKind kind, VariableMode mode, Scope *declaration_scope, bool *was_added, int initializer_position)
FunctionLiteral * CreateInstanceMembersInitializer(const AstRawString *name, ClassInfo *class_info)
Expression * NewSuperPropertyReference(int pos)
void PostProcessParseResult(IsolateT *isolate, ParseInfo *info, FunctionLiteral *literal)
void SetFunctionName(Expression *value, const AstRawString *name, const AstRawString *prefix=nullptr)
void ReportVarRedeclarationIn(const AstRawString *name, Scope *scope)
V8_INLINE void ConvertBinaryToNaryOperationSourceRange(BinaryOperation *binary_op, NaryOperation *nary_op)
int function_length() const
int num_parameters() const
int num_inner_infos() const
PreParserLogger * logger()
PreParseResult PreParseFunction(const AstRawString *function_name, FunctionKind kind, FunctionSyntaxKind function_syntax_kind, DeclarationScope *function_scope, int *use_counts, ProducedPreparseData **produced_preparser_scope_data)
ClassScope * GetScope() const
static V8_EXPORT_PRIVATE bool Rewrite(ParseInfo *info, bool *out_has_stack_overflow)
static std::optional< VariableProxy * > RewriteBody(ParseInfo *info, Scope *scope, ZonePtrList< Statement > *body, bool *out_has_stack_overflow)
static bool IsEnabledForFuzzing(FunctionId id)
static const Function * FunctionForName(const unsigned char *name, int length)
void Set(size_t bookmark)
bool FoundHtmlComment() const
bool SawMagicCommentCompileHintsAll() const
bool SawSourceMappingUrlMagicCommentAtSign() const
DirectHandle< String > SourceMappingUrl(IsolateT *isolate) const
DirectHandle< String > SourceUrl(IsolateT *isolate) const
void SetLanguageMode(LanguageMode language_mode)
void set_end_position(int statement_pos)
base::ThreadedList< Declaration > * declarations()
Scope * outer_scope() const
DeclarationScope * AsDeclarationScope()
static Scope * DeserializeScopeChain(IsolateT *isolate, Zone *zone, Tagged< ScopeInfo > scope_info, DeclarationScope *script_scope, AstValueFactory *ast_value_factory, DeserializationMode deserialization_mode, ParseInfo *info=nullptr)
VariableProxy * NewUnresolved(AstNodeFactory *factory, const AstRawString *name, int start_pos, VariableKind kind=NORMAL_VARIABLE)
DeclarationScope * GetReceiverScope()
bool is_eval_scope() const
bool is_function_scope() const
void SetMustUsePreparseData()
ScopeType scope_type() const
DeclarationScope * GetClosureScope()
void set_is_wrapped_function()
bool is_with_scope() const
void set_start_position(int statement_pos)
Variable * DeclareVariable(Declaration *declaration, const AstRawString *name, int pos, VariableMode mode, VariableKind kind, InitializationFlag init, bool *was_added, bool *sloppy_mode_block_scope_function_redefinition, bool *ok)
bool is_block_scope() const
DeclarationScope * GetDeclarationScope()
LanguageMode language_mode() const
bool HasReceiverToDeserialize() const
int start_position() const
bool is_declaration_scope() const
Variable * LookupLocal(const AstRawString *name)
void AddAll(base::Vector< const T > list)
const T & at(int i) const
void AddExport(const AstRawString *local_name, const AstRawString *export_name, const Scanner::Location loc, Zone *zone)
void set_tag(Expression *t)
static ThreadId Current()
static V8_INLINE bool IsValidIdentifier(Value token, LanguageMode language_mode, bool is_generator, bool disallow_await)
static bool IsBinaryOp(Value op)
static const char * String(Value token)
static bool IsPropertyName(Value token)
void BindTo(Variable *var)
const AstRawString * raw_name() const
void set_is_home_object()
void set_initializer_position(int pos)
const AstRawString * raw_name() const
void ForceContextAllocation()
void push_back(const T &item)
V8_INLINE int length() const
base::Vector< const T > ToConstVector() const
void Add(const T &element, Zone *zone)
RecordWriteMode const mode_
DeclarationScope * scope_
base::Vector< const DirectHandle< Object > > args
ZoneVector< RpoNumber > & result
LiftoffAssembler::CacheState state
FunctionLiteral * literal
#define LOG(isolate, Call)
LocalIsolate * local_isolate_
signed_type ShlWithWraparound(signed_type a, signed_type b)
double pow(double x, double y)
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
uint32_t DoubleToUint32(double x)
bool IsArrowFunction(FunctionKind kind)
bool is_sloppy(LanguageMode language_mode)
constexpr int kNoSourcePosition
bool IsLexicalVariableMode(VariableMode mode)
double Modulo(double x, double y)
bool IsDerivedConstructor(FunctionKind kind)
bool IsConciseMethod(FunctionKind kind)
bool IsAsyncFunction(FunctionKind kind)
bool IsAccessorFunction(FunctionKind kind)
bool IsStatic(FunctionKind kind)
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in name
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats TracingFlags::gc_stats track native contexts that are expected to be garbage collected verify heap pointers before and after GC memory reducer runs GC with ReduceMemoryFootprint flag Maximum number of memory reducer GCs scheduled Old gen GC speed is computed directly from gc tracer counters Perform compaction on full GCs based on V8 s default heuristics Perform compaction on every full GC Perform code space compaction when finalizing a full GC with stack Stress GC compaction to flush out bugs with moving objects flush of baseline code when it has not been executed recently Use time base code flushing instead of age Use a progress bar to scan large objects in increments when incremental marking is active force incremental marking for small heaps and run it more often force marking at random points between and force scavenge at random points between and reclaim otherwise unreachable unmodified wrapper objects when possible less compaction in non memory reducing mode use high priority threads for concurrent Marking Test mode only flag It allows an unit test to select evacuation candidates use incremental marking for CppHeap cppheap_concurrent_marking c value for membalancer A special constant to balance between memory and space tradeoff The smaller the more memory it uses enable use of SSE4 instructions if available enable use of AVX VNNI instructions if available enable use of POPCNT instruction if available force all emitted branches to be in long mode(MIPS/PPC only)") DEFINE_BOOL(partial_constant_pool
@ SLOPPY_BLOCK_FUNCTION_VARIABLE
@ ONLY_SINGLE_FUNCTION_LITERAL
bool IsAsyncGeneratorFunction(FunctionKind kind)
SharedFunctionInfo::HasStaticPrivateMethodsOrAccessorsBit SharedFunctionInfo::MaglevCompilationFailedBit SharedFunctionInfo::FunctionSyntaxKindBits has_duplicate_parameters
constexpr int kFunctionLiteralIdTopLevel
static T ArithmeticShiftRight(T x, int shift)
int32_t DoubleToInt32(double x)
bool is_strict(LanguageMode language_mode)
V8_EXPORT_PRIVATE FlagValues v8_flags
bool IsClassMembersInitializerFunction(FunctionKind kind)
has_static_private_methods_or_accessors
SharedFunctionInfo::HasStaticPrivateMethodsOrAccessorsBit SharedFunctionInfo::MaglevCompilationFailedBit SharedFunctionInfo::FunctionSyntaxKindBits SharedFunctionInfo::HasDuplicateParametersBit requires_instance_members_initializer
bool IsImmutableLexicalOrPrivateVariableMode(VariableMode mode)
bool IsDefaultConstructor(FunctionKind kind)
@ kDefaultDerivedConstructor
@ kClassMembersInitializerFunction
@ kDefaultBaseConstructor
std::unique_ptr< char[]> BigIntLiteralToDecimal(LocalIsolate *isolate, base::Vector< const uint8_t > literal)
kInterpreterTrampolineOffset script
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
OptimizedCompilationInfo * info_
const uintptr_t stack_limit_
#define DCHECK_NOT_NULL(val)
#define CHECK_NOT_NULL(val)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_NE(v1, v2)
#define DCHECK_GE(v1, v2)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define DCHECK_GT(v1, v2)
static Location invalid()
#define TRACE_EVENT0(category_group, name)
#define TRACE_DISABLED_BY_DEFAULT(name)
#define V8_LIKELY(condition)
#define V8_UNLIKELY(condition)