30 #include "../include/v8stdint.h"
59 Scope top_scope(&scope_, kTopLevelScope);
60 set_language_mode(mode);
61 Scope function_scope(&scope_, kFunctionScope);
65 ParseLazyFunctionLiteralBody(&ok);
71 if (!is_classic_mode()) {
73 CheckOctalLiteral(start_position, end_pos, &ok);
75 CheckDelayedStrictModeViolation(start_position, end_pos, &ok);
100 if (token == i::Token::ILLEGAL && stack_overflow_) {
103 i::Scanner::Location source_location = scanner_->
location();
108 return ReportMessageAt(source_location,
"unexpected_eos",
NULL);
109 case i::Token::NUMBER:
110 return ReportMessageAt(source_location,
"unexpected_token_number",
NULL);
111 case i::Token::STRING:
112 return ReportMessageAt(source_location,
"unexpected_token_string",
NULL);
113 case i::Token::IDENTIFIER:
114 return ReportMessageAt(source_location,
115 "unexpected_token_identifier",
NULL);
116 case i::Token::FUTURE_RESERVED_WORD:
117 return ReportMessageAt(source_location,
"unexpected_reserved",
NULL);
118 case i::Token::FUTURE_STRICT_RESERVED_WORD:
119 return ReportMessageAt(source_location,
120 "unexpected_strict_reserved",
NULL);
123 ReportMessageAt(source_location,
"unexpected_token", name);
130 void PreParser::CheckOctalLiteral(
int beg_pos,
int end_pos,
bool* ok) {
132 if (beg_pos <= octal.beg_pos && octal.end_pos <= end_pos) {
133 ReportMessageAt(octal,
"strict_octal_literal",
NULL);
140 #define CHECK_OK ok); \
141 if (!*ok) return kUnknownSourceElements; \
143 #define DUMMY ) // to make indentation work
147 PreParser::Statement PreParser::ParseSourceElement(
bool* ok) {
159 case i::Token::FUNCTION:
160 return ParseFunctionDeclaration(ok);
163 return ParseVariableStatement(kSourceElement, ok);
165 return ParseStatement(ok);
170 PreParser::SourceElements PreParser::ParseSourceElements(
int end_token,
175 bool allow_directive_prologue =
true;
176 while (peek() != end_token) {
177 Statement statement = ParseSourceElement(
CHECK_OK);
178 if (allow_directive_prologue) {
179 if (statement.IsUseStrictLiteral()) {
180 set_language_mode(harmony_scoping_ ?
182 }
else if (!statement.IsStringLiteral()) {
183 allow_directive_prologue =
false;
187 return kUnknownSourceElements;
192 #define CHECK_OK ok); \
193 if (!*ok) return Statement::Default(); \
195 #define DUMMY ) // to make indentation work
199 PreParser::Statement PreParser::ParseStatement(
bool* ok) {
226 case i::Token::LBRACE:
227 return ParseBlock(ok);
232 return ParseVariableStatement(kStatement, ok);
234 case i::Token::SEMICOLON:
236 return Statement::Default();
239 return ParseIfStatement(ok);
242 return ParseDoWhileStatement(ok);
244 case i::Token::WHILE:
245 return ParseWhileStatement(ok);
248 return ParseForStatement(ok);
250 case i::Token::CONTINUE:
251 return ParseContinueStatement(ok);
254 return ParseBreakStatement(ok);
256 case i::Token::RETURN:
257 return ParseReturnStatement(ok);
260 return ParseWithStatement(ok);
262 case i::Token::SWITCH:
263 return ParseSwitchStatement(ok);
265 case i::Token::THROW:
266 return ParseThrowStatement(ok);
269 return ParseTryStatement(ok);
271 case i::Token::FUNCTION: {
272 i::Scanner::Location start_location = scanner_->
peek_location();
273 Statement statement = ParseFunctionDeclaration(
CHECK_OK);
274 i::Scanner::Location end_location = scanner_->
location();
275 if (!is_classic_mode()) {
276 ReportMessageAt(start_location.beg_pos, end_location.end_pos,
277 "strict_function",
NULL);
279 return Statement::Default();
285 case i::Token::DEBUGGER:
286 return ParseDebuggerStatement(ok);
289 return ParseExpressionOrLabelledStatement(ok);
294 PreParser::Statement PreParser::ParseFunctionDeclaration(
bool* ok) {
297 Expect(i::Token::FUNCTION,
CHECK_OK);
299 Identifier identifier = ParseIdentifier(
CHECK_OK);
300 i::Scanner::Location location = scanner_->
location();
302 Expression function_value = ParseFunctionLiteral(
CHECK_OK);
304 if (function_value.IsStrictFunction() &&
305 !identifier.IsValidStrictVariable()) {
308 const char*
type =
"strict_function_name";
309 if (identifier.IsFutureStrictReserved()) {
310 type =
"strict_reserved_word";
312 ReportMessageAt(location, type,
NULL);
315 return Statement::FunctionDeclaration();
319 PreParser::Statement PreParser::ParseBlock(
bool* ok) {
327 while (peek() != i::Token::RBRACE) {
328 if (is_extended_mode()) {
334 Expect(i::Token::RBRACE, ok);
335 return Statement::Default();
339 PreParser::Statement PreParser::ParseVariableStatement(
340 VariableDeclarationContext var_context,
345 Statement result = ParseVariableDeclarations(var_context,
359 PreParser::Statement PreParser::ParseVariableDeclarations(
360 VariableDeclarationContext var_context,
361 VariableDeclarationProperties* decl_props,
377 bool require_initializer =
false;
392 switch (language_mode()) {
397 ReportMessageAt(location,
"strict_const",
NULL);
399 return Statement::Default();
402 if (var_context != kSourceElement &&
403 var_context != kForStatement) {
405 ReportMessageAt(location.beg_pos, location.end_pos,
406 "unprotected_const",
NULL);
408 return Statement::Default();
410 require_initializer =
true;
420 if (!is_extended_mode()) {
422 ReportMessageAt(location.beg_pos, location.end_pos,
423 "illegal_let",
NULL);
425 return Statement::Default();
428 if (var_context != kSourceElement &&
429 var_context != kForStatement) {
431 ReportMessageAt(location.beg_pos, location.end_pos,
432 "unprotected_let",
NULL);
434 return Statement::Default();
438 return Statement::Default();
448 if (nvars > 0) Consume(i::Token::COMMA);
449 Identifier identifier = ParseIdentifier(
CHECK_OK);
450 if (!is_classic_mode() && !identifier.IsValidStrictVariable()) {
451 StrictModeIdentifierViolation(scanner_->
location(),
455 return Statement::Default();
458 if (peek() == i::Token::ASSIGN || require_initializer) {
460 ParseAssignmentExpression(var_context != kForStatement,
CHECK_OK);
461 if (decl_props !=
NULL) *decl_props = kHasInitializers;
463 }
while (peek() == i::Token::COMMA);
465 if (num_decl !=
NULL) *num_decl = nvars;
466 return Statement::Default();
470 PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(
bool* ok) {
475 Expression expr = ParseExpression(
true,
CHECK_OK);
476 if (expr.IsRawIdentifier()) {
477 ASSERT(!expr.AsIdentifier().IsFutureReserved());
478 ASSERT(is_classic_mode() || !expr.AsIdentifier().IsFutureStrictReserved());
479 if (peek() == i::Token::COLON) {
480 Consume(i::Token::COLON);
481 return ParseStatement(ok);
489 return Statement::ExpressionStatement(expr);
493 PreParser::Statement PreParser::ParseIfStatement(
bool* ok) {
502 if (peek() == i::Token::ELSE) {
506 return Statement::Default();
510 PreParser::Statement PreParser::ParseContinueStatement(
bool* ok) {
514 Expect(i::Token::CONTINUE,
CHECK_OK);
517 tok != i::Token::SEMICOLON &&
518 tok != i::Token::RBRACE &&
519 tok != i::Token::EOS) {
523 return Statement::Default();
527 PreParser::Statement PreParser::ParseBreakStatement(
bool* ok) {
534 tok != i::Token::SEMICOLON &&
535 tok != i::Token::RBRACE &&
536 tok != i::Token::EOS) {
540 return Statement::Default();
544 PreParser::Statement PreParser::ParseReturnStatement(
bool* ok) {
560 tok != i::Token::SEMICOLON &&
561 tok != i::Token::RBRACE &&
562 tok != i::Token::EOS) {
566 return Statement::Default();
570 PreParser::Statement PreParser::ParseWithStatement(
bool* ok) {
574 if (!is_classic_mode()) {
575 i::Scanner::Location location = scanner_->
location();
576 ReportMessageAt(location,
"strict_mode_with",
NULL);
578 return Statement::Default();
584 Scope::InsideWith iw(scope_);
586 return Statement::Default();
590 PreParser::Statement PreParser::ParseSwitchStatement(
bool* ok) {
601 while (token != i::Token::RBRACE) {
602 if (token == i::Token::CASE) {
614 Expect(i::Token::RBRACE, ok);
615 return Statement::Default();
619 PreParser::Statement PreParser::ParseDoWhileStatement(
bool* ok) {
628 Expect(i::Token::RPAREN, ok);
629 if (peek() == i::Token::SEMICOLON) Consume(i::Token::SEMICOLON);
630 return Statement::Default();
634 PreParser::Statement PreParser::ParseWhileStatement(
bool* ok) {
643 return Statement::Default();
647 PreParser::Statement PreParser::ParseForStatement(
bool* ok) {
653 if (peek() != i::Token::SEMICOLON) {
658 VariableDeclarationProperties decl_props = kHasNoInitializers;
659 ParseVariableDeclarations(
660 kForStatement, &decl_props, &decl_count,
CHECK_OK);
661 bool accept_IN = decl_count == 1 &&
662 !(is_let && decl_props == kHasInitializers);
669 return Statement::Default();
679 return Statement::Default();
685 Expect(i::Token::SEMICOLON,
CHECK_OK);
687 if (peek() != i::Token::SEMICOLON) {
690 Expect(i::Token::SEMICOLON,
CHECK_OK);
692 if (peek() != i::Token::RPAREN) {
698 return Statement::Default();
702 PreParser::Statement PreParser::ParseThrowStatement(
bool* ok) {
708 i::Scanner::Location pos = scanner_->
location();
709 ReportMessageAt(pos,
"newline_after_throw",
NULL);
711 return Statement::Default();
715 return Statement::Default();
719 PreParser::Statement PreParser::ParseTryStatement(
bool* ok) {
738 bool catch_or_finally_seen =
false;
739 if (peek() == i::Token::CATCH) {
740 Consume(i::Token::CATCH);
742 Identifier
id = ParseIdentifier(
CHECK_OK);
743 if (!is_classic_mode() && !
id.IsValidStrictVariable()) {
744 StrictModeIdentifierViolation(scanner_->
location(),
745 "strict_catch_variable",
748 return Statement::Default();
751 { Scope::InsideWith iw(scope_);
754 catch_or_finally_seen =
true;
756 if (peek() == i::Token::FINALLY) {
757 Consume(i::Token::FINALLY);
759 catch_or_finally_seen =
true;
761 if (!catch_or_finally_seen) {
764 return Statement::Default();
768 PreParser::Statement PreParser::ParseDebuggerStatement(
bool* ok) {
775 Expect(i::Token::DEBUGGER,
CHECK_OK);
777 return Statement::Default();
782 #define CHECK_OK ok); \
783 if (!*ok) return Expression::Default(); \
785 #define DUMMY ) // to make indentation work
790 PreParser::Expression PreParser::ParseExpression(
bool accept_IN,
bool* ok) {
795 Expression result = ParseAssignmentExpression(accept_IN,
CHECK_OK);
796 while (peek() == i::Token::COMMA) {
798 ParseAssignmentExpression(accept_IN,
CHECK_OK);
799 result = Expression::Default();
806 PreParser::Expression PreParser::ParseAssignmentExpression(
bool accept_IN,
813 Expression expression = ParseConditionalExpression(accept_IN,
CHECK_OK);
820 if (!is_classic_mode() &&
821 expression.IsIdentifier() &&
822 expression.AsIdentifier().IsEvalOrArguments()) {
823 i::Scanner::Location after = scanner_->
location();
824 ReportMessageAt(before.beg_pos, after.end_pos,
825 "strict_lhs_assignment",
NULL);
827 return Expression::Default();
831 ParseAssignmentExpression(accept_IN,
CHECK_OK);
833 if ((op == i::Token::ASSIGN) && expression.IsThisProperty()) {
834 scope_->AddProperty();
837 return Expression::Default();
842 PreParser::Expression PreParser::ParseConditionalExpression(
bool accept_IN,
849 Expression expression = ParseBinaryExpression(4, accept_IN,
CHECK_OK);
850 if (peek() != i::Token::CONDITIONAL)
return expression;
851 Consume(i::Token::CONDITIONAL);
855 ParseAssignmentExpression(
true,
CHECK_OK);
857 ParseAssignmentExpression(accept_IN,
CHECK_OK);
858 return Expression::Default();
871 PreParser::Expression PreParser::ParseBinaryExpression(
int prec,
874 Expression result = ParseUnaryExpression(
CHECK_OK);
875 for (
int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) {
877 while (Precedence(peek(), accept_IN) == prec1) {
879 ParseBinaryExpression(prec1 + 1, accept_IN,
CHECK_OK);
880 result = Expression::Default();
887 PreParser::Expression PreParser::ParseUnaryExpression(
bool* ok) {
903 ParseUnaryExpression(ok);
904 return Expression::Default();
908 Expression expression = ParseUnaryExpression(
CHECK_OK);
909 if (!is_classic_mode() &&
910 expression.IsIdentifier() &&
911 expression.AsIdentifier().IsEvalOrArguments()) {
912 i::Scanner::Location after = scanner_->
location();
913 ReportMessageAt(before.beg_pos, after.end_pos,
914 "strict_lhs_prefix",
NULL);
917 return Expression::Default();
919 return ParsePostfixExpression(ok);
924 PreParser::Expression PreParser::ParsePostfixExpression(
bool* ok) {
929 Expression expression = ParseLeftHandSideExpression(
CHECK_OK);
932 if (!is_classic_mode() &&
933 expression.IsIdentifier() &&
934 expression.AsIdentifier().IsEvalOrArguments()) {
935 i::Scanner::Location after = scanner_->
location();
936 ReportMessageAt(before.beg_pos, after.end_pos,
937 "strict_lhs_postfix",
NULL);
939 return Expression::Default();
942 return Expression::Default();
948 PreParser::Expression PreParser::ParseLeftHandSideExpression(
bool* ok) {
952 Expression result = Expression::Default();
953 if (peek() == i::Token::NEW) {
954 result = ParseNewExpression(
CHECK_OK);
956 result = ParseMemberExpression(
CHECK_OK);
961 case i::Token::LBRACK: {
962 Consume(i::Token::LBRACK);
965 if (result.IsThis()) {
966 result = Expression::ThisProperty();
968 result = Expression::Default();
973 case i::Token::LPAREN: {
975 result = Expression::Default();
979 case i::Token::PERIOD: {
980 Consume(i::Token::PERIOD);
982 if (result.IsThis()) {
983 result = Expression::ThisProperty();
985 result = Expression::Default();
997 PreParser::Expression PreParser::ParseNewExpression(
bool* ok) {
1009 unsigned new_count = 0;
1011 Consume(i::Token::NEW);
1013 }
while (peek() == i::Token::NEW);
1015 return ParseMemberWithNewPrefixesExpression(new_count, ok);
1019 PreParser::Expression PreParser::ParseMemberExpression(
bool* ok) {
1020 return ParseMemberWithNewPrefixesExpression(0, ok);
1024 PreParser::Expression PreParser::ParseMemberWithNewPrefixesExpression(
1025 unsigned new_count,
bool* ok) {
1031 Expression result = Expression::Default();
1032 if (peek() == i::Token::FUNCTION) {
1033 Consume(i::Token::FUNCTION);
1034 Identifier identifier = Identifier::Default();
1035 if (peek_any_identifier()) {
1036 identifier = ParseIdentifier(
CHECK_OK);
1038 result = ParseFunctionLiteral(
CHECK_OK);
1039 if (result.IsStrictFunction() && !identifier.IsValidStrictVariable()) {
1040 StrictModeIdentifierViolation(scanner_->
location(),
1041 "strict_function_name",
1044 return Expression::Default();
1047 result = ParsePrimaryExpression(
CHECK_OK);
1052 case i::Token::LBRACK: {
1053 Consume(i::Token::LBRACK);
1055 Expect(i::Token::RBRACK,
CHECK_OK);
1056 if (result.IsThis()) {
1057 result = Expression::ThisProperty();
1059 result = Expression::Default();
1063 case i::Token::PERIOD: {
1064 Consume(i::Token::PERIOD);
1066 if (result.IsThis()) {
1067 result = Expression::ThisProperty();
1069 result = Expression::Default();
1073 case i::Token::LPAREN: {
1074 if (new_count == 0)
return result;
1078 result = Expression::Default();
1088 PreParser::Expression PreParser::ParsePrimaryExpression(
bool* ok) {
1102 Expression result = Expression::Default();
1104 case i::Token::THIS: {
1106 result = Expression::This();
1110 case i::Token::FUTURE_RESERVED_WORD: {
1112 i::Scanner::Location location = scanner_->
location();
1113 ReportMessageAt(location.beg_pos, location.end_pos,
1114 "reserved_word",
NULL);
1116 return Expression::Default();
1119 case i::Token::FUTURE_STRICT_RESERVED_WORD:
1120 if (!is_classic_mode()) {
1122 i::Scanner::Location location = scanner_->
location();
1123 ReportMessageAt(location,
"strict_reserved_word",
NULL);
1125 return Expression::Default();
1128 case i::Token::IDENTIFIER: {
1129 Identifier
id = ParseIdentifier(
CHECK_OK);
1130 result = Expression::FromIdentifier(
id);
1134 case i::Token::NULL_LITERAL:
1135 case i::Token::TRUE_LITERAL:
1136 case i::Token::FALSE_LITERAL:
1137 case i::Token::NUMBER: {
1141 case i::Token::STRING: {
1143 result = GetStringSymbol();
1147 case i::Token::ASSIGN_DIV:
1148 result = ParseRegExpLiteral(
true,
CHECK_OK);
1152 result = ParseRegExpLiteral(
false,
CHECK_OK);
1155 case i::Token::LBRACK:
1156 result = ParseArrayLiteral(
CHECK_OK);
1159 case i::Token::LBRACE:
1160 result = ParseObjectLiteral(
CHECK_OK);
1163 case i::Token::LPAREN:
1164 Consume(i::Token::LPAREN);
1165 parenthesized_function_ = (peek() == i::Token::FUNCTION);
1166 result = ParseExpression(
true,
CHECK_OK);
1167 Expect(i::Token::RPAREN,
CHECK_OK);
1168 result = result.Parenthesize();
1172 result = ParseV8Intrinsic(
CHECK_OK);
1178 return Expression::Default();
1186 PreParser::Expression PreParser::ParseArrayLiteral(
bool* ok) {
1189 Expect(i::Token::LBRACK,
CHECK_OK);
1190 while (peek() != i::Token::RBRACK) {
1191 if (peek() != i::Token::COMMA) {
1192 ParseAssignmentExpression(
true,
CHECK_OK);
1194 if (peek() != i::Token::RBRACK) {
1198 Expect(i::Token::RBRACK,
CHECK_OK);
1200 scope_->NextMaterializedLiteralIndex();
1201 return Expression::Default();
1204 void PreParser::CheckDuplicate(DuplicateFinder* finder,
1209 if (property == i::Token::NUMBER) {
1217 if (HasConflict(old_type, type)) {
1218 if (IsDataDataConflict(old_type, type)) {
1220 if (is_classic_mode())
return;
1221 ReportMessageAt(scanner_->
location(),
1222 "strict_duplicate_property",
NULL);
1223 }
else if (IsDataAccessorConflict(old_type, type)) {
1225 ReportMessageAt(scanner_->
location(),
1226 "accessor_data_property",
NULL);
1228 ASSERT(IsAccessorAccessorConflict(old_type, type));
1230 ReportMessageAt(scanner_->
location(),
1231 "accessor_get_set",
NULL);
1238 PreParser::Expression PreParser::ParseObjectLiteral(
bool* ok) {
1245 Expect(i::Token::LBRACE,
CHECK_OK);
1246 DuplicateFinder duplicate_finder(scanner_->
unicode_cache());
1247 while (peek() != i::Token::RBRACE) {
1250 case i::Token::IDENTIFIER:
1251 case i::Token::FUTURE_RESERVED_WORD:
1252 case i::Token::FUTURE_STRICT_RESERVED_WORD: {
1253 bool is_getter =
false;
1254 bool is_setter =
false;
1255 ParseIdentifierNameOrGetOrSet(&is_getter, &is_setter,
CHECK_OK);
1256 if ((is_getter || is_setter) && peek() != i::Token::COLON) {
1259 if (name != i::Token::IDENTIFIER &&
1260 name != i::Token::FUTURE_RESERVED_WORD &&
1261 name != i::Token::FUTURE_STRICT_RESERVED_WORD &&
1262 name != i::Token::NUMBER &&
1263 name != i::Token::STRING &&
1266 return Expression::Default();
1271 PropertyType type = is_getter ? kGetterProperty : kSetterProperty;
1272 CheckDuplicate(&duplicate_finder, name, type,
CHECK_OK);
1274 if (peek() != i::Token::RBRACE) {
1279 CheckDuplicate(&duplicate_finder, next, kValueProperty,
CHECK_OK);
1282 case i::Token::STRING:
1284 CheckDuplicate(&duplicate_finder, next, kValueProperty,
CHECK_OK);
1287 case i::Token::NUMBER:
1289 CheckDuplicate(&duplicate_finder, next, kValueProperty,
CHECK_OK);
1294 CheckDuplicate(&duplicate_finder, next, kValueProperty,
CHECK_OK);
1298 return Expression::Default();
1303 ParseAssignmentExpression(
true,
CHECK_OK);
1306 if (peek() != i::Token::RBRACE) Expect(i::Token::COMMA,
CHECK_OK);
1308 Expect(i::Token::RBRACE,
CHECK_OK);
1310 scope_->NextMaterializedLiteralIndex();
1311 return Expression::Default();
1315 PreParser::Expression PreParser::ParseRegExpLiteral(
bool seen_equal,
1319 ReportMessageAt(scanner_->
location(),
"unterminated_regexp",
NULL);
1321 return Expression::Default();
1324 scope_->NextMaterializedLiteralIndex();
1328 ReportMessageAt(scanner_->
location(),
"invalid_regexp_flags",
NULL);
1330 return Expression::Default();
1333 return Expression::Default();
1337 PreParser::Arguments PreParser::ParseArguments(
bool* ok) {
1341 Expect(i::Token::LPAREN, ok);
1342 if (!*ok)
return -1;
1343 bool done = (peek() == i::Token::RPAREN);
1346 ParseAssignmentExpression(
true, ok);
1347 if (!*ok)
return -1;
1349 done = (peek() == i::Token::RPAREN);
1351 Expect(i::Token::COMMA, ok);
1352 if (!*ok)
return -1;
1355 Expect(i::Token::RPAREN, ok);
1360 PreParser::Expression PreParser::ParseFunctionLiteral(
bool* ok) {
1365 ScopeType outer_scope_type = scope_->type();
1366 bool inside_with = scope_->IsInsideWith();
1367 Scope function_scope(&scope_, kFunctionScope);
1370 Expect(i::Token::LPAREN,
CHECK_OK);
1372 bool done = (peek() == i::Token::RPAREN);
1373 DuplicateFinder duplicate_finder(scanner_->
unicode_cache());
1375 Identifier
id = ParseIdentifier(
CHECK_OK);
1376 if (!
id.IsValidStrictVariable()) {
1377 StrictModeIdentifierViolation(scanner_->
location(),
1378 "strict_param_name",
1391 if (prev_value != 0) {
1392 SetStrictModeViolation(scanner_->
location(),
1393 "strict_param_dupe",
1396 done = (peek() == i::Token::RPAREN);
1401 Expect(i::Token::RPAREN,
CHECK_OK);
1406 bool is_lazily_compiled = (outer_scope_type == kTopLevelScope &&
1407 !inside_with && allow_lazy_ &&
1408 !parenthesized_function_);
1409 parenthesized_function_ =
false;
1411 Expect(i::Token::LBRACE,
CHECK_OK);
1412 if (is_lazily_compiled) {
1413 ParseLazyFunctionLiteralBody(
CHECK_OK);
1415 ParseSourceElements(i::Token::RBRACE, ok);
1417 Expect(i::Token::RBRACE,
CHECK_OK);
1419 if (!is_classic_mode()) {
1421 CheckOctalLiteral(start_position, end_position,
CHECK_OK);
1422 CheckDelayedStrictModeViolation(start_position, end_position,
CHECK_OK);
1423 return Expression::StrictFunction();
1426 return Expression::Default();
1430 void PreParser::ParseLazyFunctionLiteralBody(
bool* ok) {
1433 ParseSourceElements(i::Token::RBRACE, ok);
1441 scope_->materialized_literal_count(),
1442 scope_->expected_properties(),
1447 PreParser::Expression PreParser::ParseV8Intrinsic(
bool* ok) {
1451 if (!allow_natives_syntax_) {
1453 return Expression::Default();
1458 return Expression::Default();
1464 void PreParser::ExpectSemicolon(
bool* ok) {
1468 if (tok == i::Token::SEMICOLON) {
1473 tok == i::Token::RBRACE ||
1474 tok == i::Token::EOS) {
1477 Expect(i::Token::SEMICOLON, ok);
1481 void PreParser::LogSymbol() {
1491 PreParser::Expression PreParser::GetStringSymbol() {
1492 const int kUseStrictLength = 10;
1493 const char* kUseStrictChars =
"use strict";
1499 kUseStrictLength)) {
1500 return Expression::UseStrictStringLiteral();
1502 return Expression::StringLiteral();
1506 PreParser::Identifier PreParser::GetIdentifierSymbol() {
1508 if (scanner_->
current_token() == i::Token::FUTURE_RESERVED_WORD) {
1509 return Identifier::FutureReserved();
1511 i::Token::FUTURE_STRICT_RESERVED_WORD) {
1512 return Identifier::FutureStrictReserved();
1518 return Identifier::Eval();
1522 return Identifier::Arguments();
1525 return Identifier::Default();
1529 PreParser::Identifier PreParser::ParseIdentifier(
bool* ok) {
1532 case i::Token::FUTURE_RESERVED_WORD: {
1533 i::Scanner::Location location = scanner_->
location();
1534 ReportMessageAt(location.beg_pos, location.end_pos,
1535 "reserved_word",
NULL);
1537 return GetIdentifierSymbol();
1539 case i::Token::FUTURE_STRICT_RESERVED_WORD:
1540 if (!is_classic_mode()) {
1541 i::Scanner::Location location = scanner_->
location();
1542 ReportMessageAt(location.beg_pos, location.end_pos,
1543 "strict_reserved_word",
NULL);
1547 case i::Token::IDENTIFIER:
1548 return GetIdentifierSymbol();
1551 return Identifier::Default();
1556 void PreParser::SetStrictModeViolation(i::Scanner::Location location,
1559 if (!is_classic_mode()) {
1560 ReportMessageAt(location, type,
NULL);
1572 strict_mode_violation_location_ = location;
1573 strict_mode_violation_type_ =
type;
1577 void PreParser::CheckDelayedStrictModeViolation(
int beg_pos,
1580 i::Scanner::Location location = strict_mode_violation_location_;
1581 if (location.IsValid() &&
1582 location.beg_pos > beg_pos && location.end_pos < end_pos) {
1583 ReportMessageAt(location, strict_mode_violation_type_,
NULL);
1589 void PreParser::StrictModeIdentifierViolation(i::Scanner::Location location,
1590 const char* eval_args_type,
1591 Identifier identifier,
1593 const char* type = eval_args_type;
1594 if (identifier.IsFutureReserved()) {
1595 type =
"reserved_word";
1596 }
else if (identifier.IsFutureStrictReserved()) {
1597 type =
"strict_reserved_word";
1599 if (!is_classic_mode()) {
1600 ReportMessageAt(location, type,
NULL);
1604 strict_mode_violation_location_ = location;
1605 strict_mode_violation_type_ =
type;
1609 PreParser::Identifier PreParser::ParseIdentifierName(
bool* ok) {
1616 return Identifier::Default();
1618 if (next == i::Token::IDENTIFIER ||
1619 next == i::Token::FUTURE_RESERVED_WORD ||
1620 next == i::Token::FUTURE_STRICT_RESERVED_WORD) {
1621 return GetIdentifierSymbol();
1624 return Identifier::Default();
1632 PreParser::Identifier PreParser::ParseIdentifierNameOrGetOrSet(
bool* is_get,
1635 Identifier result = ParseIdentifierName(ok);
1636 if (!*ok)
return Identifier::Default();
1640 *is_get = strncmp(token,
"get", 3) == 0;
1641 *is_set = !*is_get && strncmp(token,
"set", 3) == 0;
1646 bool PreParser::peek_any_identifier() {
1648 return next == i::Token::IDENTIFIER ||
1649 next == i::Token::FUTURE_RESERVED_WORD ||
1650 next == i::Token::FUTURE_STRICT_RESERVED_WORD;
1665 uint32_t hash = Hash(key, is_ascii);
1666 byte* encoding = BackupKey(key, is_ascii);
1667 i::HashMap::Entry* entry = map_.
Lookup(encoding, hash,
true);
1668 int old_value =
static_cast<int>(
reinterpret_cast<intptr_t
>(entry->value));
1670 reinterpret_cast<void*
>(
static_cast<intptr_t
>(value | old_value));
1678 if (IsNumberCanonical(key)) {
1683 double double_value =
StringToDouble(unicode_constants_, key, flags, 0.0);
1687 string =
"Infinity";
1695 length),
true, value);
1705 int length = number.
length();
1706 if (number.
length() > 15)
return false;
1707 if (number[pos] ==
'0') {
1710 while (pos < length &&
1711 static_cast<unsigned>(number[pos] -
'0') <= (
'9' -
'0')) pos++;
1713 if (length == pos)
return true;
1714 if (number[pos] !=
'.')
return false;
1716 bool invalid_last_digit =
true;
1717 while (pos < length) {
1718 byte digit = number[pos] -
'0';
1719 if (digit >
'9' -
'0')
return false;
1720 invalid_last_digit = (digit == 0);
1723 return !invalid_last_digit;
1730 int length = key.
length();
1731 uint32_t hash = (length << 1) | (is_ascii ? 1 : 0) ;
1732 for (
int i = 0; i < length; i++) {
1733 uint32_t c = key[i];
1734 hash = (hash + c) * 1025;
1735 hash ^= (hash >> 6);
1741 bool DuplicateFinder::Match(
void* first,
void* second) {
1749 uint32_t length_ascii_field = 0;
1753 if (c1 != *s2)
return false;
1754 length_ascii_field = (length_ascii_field << 7) | (c1 & 0x7f);
1757 }
while ((c1 & 0x80) != 0);
1758 int length =
static_cast<int>(length_ascii_field >> 1);
1759 return memcmp(s1, s2, length) == 0;
1765 uint32_t ascii_length = (bytes.
length() << 1) | (is_ascii ? 1 : 0);
1769 if (ascii_length >= (1 << 7)) {
1770 if (ascii_length >= (1 << 14)) {
1771 if (ascii_length >= (1 << 21)) {
1772 if (ascii_length >= (1 << 28)) {
1773 backing_store_.
Add(static_cast<byte>((ascii_length >> 28) | 0x80));
1775 backing_store_.
Add(static_cast<byte>((ascii_length >> 21) | 0x80u));
1777 backing_store_.
Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
1779 backing_store_.
Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
1781 backing_store_.
Add(static_cast<byte>(ascii_length & 0x7f));
static int Precedence(Value tok)
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
static bool IsUnaryOp(Value op)
int literal_length() const
#define ASSERT(condition)
bool HasAnyLineTerminatorBeforeNext() const
int AddNumber(i::Vector< const char > key, int value)
virtual void LogFunction(int start, int end, int literals, int properties, LanguageMode language_mode)=0
double StringToDouble(UnicodeCache *unicode_cache, const char *str, int flags, double empty_string_val)
Vector< T > AddBlock(int size, T initial_value)
bool literal_contains_escapes() const
virtual void LogAsciiSymbol(int start, Vector< const char > literal)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
static const char * String(Value tok)
const char * DoubleToCString(double v, Vector< char > buffer)
static bool IsAssignmentOp(Value tok)
virtual void ResumeRecording()=0
Entry * Lookup(void *key, uint32_t hash, bool insert, AllocationPolicy allocator=AllocationPolicy())
int AddUtf16Symbol(i::Vector< const uint16_t > key, int value)
static bool IsKeyword(Value tok)
int AddAsciiSymbol(i::Vector< const char > key, int value)
int StrLength(const char *string)
PreParseResult PreParseLazyFunction(i::LanguageMode mode, i::ParserRecorder *log)
Location location() const
Vector< T > EndSequence()
virtual void PauseRecording()=0
virtual void LogUtf16Symbol(int start, Vector< const uc16 > literal)
void clear_octal_position()
#define ASSERT_EQ(v1, v2)
Vector< const char > literal_ascii_string()
Token::Value peek() const
Location octal_position() const
Token::Value current_token()
Vector< const uc16 > literal_utf16_string()
bool ScanRegExpPattern(bool seen_equal)
static bool IsCountOp(Value op)
UnicodeCache * unicode_cache()
Location peek_location() const