61 template <
typename Traits>
68 typedef typename Traits::Type::Literal
LiteralT;
74 typename Traits::Type::Parser this_object)
138 class CheckpointBase;
139 class ObjectLiteralChecker;
149 typename Traits::Type::Scope* scope)
150 : scope_stack_(scope_stack),
151 outer_scope_(*scope_stack),
166 typename Traits::Type::Scope** scope_stack,
167 typename Traits::Type::Scope* scope,
168 typename Traits::Type::Zone*
zone =
NULL,
172 typename Traits::Type::Scope** scope_stack,
173 typename Traits::Type::Scope** scope,
174 typename Traits::Type::Zone*
zone =
NULL,
180 return next_materialized_literal_index_++;
196 typename Traits::Type::GeneratorVariable* variable) {
199 generator_object_variable_ = variable;
200 is_generator_ =
true;
204 return generator_object_variable_;
207 typename Traits::Type::Factory*
factory() {
return &factory_; }
230 typename Traits::Type::Scope** scope_stack_;
231 typename Traits::Type::Scope* outer_scope_;
238 friend class CheckpointBase;
249 next_materialized_literal_index_ =
257 next_materialized_literal_index_;
264 int next_materialized_literal_index_;
265 int next_handler_index_;
266 int expected_property_count_;
273 old_mode_(parser->
mode()) {
274 parser_->mode_ =
mode;
277 parser_->mode_ = old_mode_;
291 typename Traits::Type::Zone*
zone()
const {
return zone_; }
340 if (tok == Token::SEMICOLON) {
344 if (
scanner()->HasAnyLineTerminatorBeforeNext() ||
345 tok == Token::RBRACE ||
349 Expect(Token::SEMICOLON, ok);
354 return next == Token::IDENTIFIER ||
355 next == Token::FUTURE_RESERVED_WORD ||
356 next == Token::FUTURE_STRICT_RESERVED_WORD ||
362 if (peek() == Token::IDENTIFIER &&
363 scanner()->is_next_contextual_keyword(keyword)) {
371 Expect(Token::IDENTIFIER, ok);
373 if (!
scanner()->is_literal_contextual_keyword(keyword)) {
396 bool function_name_is_strict_reserved,
402 if (this->IsEvalOrArguments(function_name)) {
403 Traits::ReportMessageAt(function_name_loc,
"strict_eval_arguments");
407 if (function_name_is_strict_reserved) {
408 Traits::ReportMessageAt(function_name_loc,
"unexpected_strict_reserved");
412 if (eval_args_error_loc.
IsValid()) {
413 Traits::ReportMessageAt(eval_args_error_loc,
"strict_eval_arguments");
417 if (dupe_error_loc.
IsValid()) {
418 Traits::ReportMessageAt(dupe_error_loc,
"strict_param_dupe");
423 Traits::ReportMessageAt(reserved_loc,
"unexpected_strict_reserved");
445 bool is_reference_error =
false) {
447 Traits::ReportMessageAt(source_location, message, arg, is_reference_error);
451 bool is_reference_error =
false) {
452 Traits::ReportMessageAt(location, message,
453 reinterpret_cast<const char*
>(
NULL),
472 bool* is_strict_reserved,
489 bool in_class,
bool is_static,
507 bool name_is_strict_reserved,
int pos,
554 return (type1 & type2) != 0;
995 int pos,
bool is_static) {
1005 int boilerplate_properties,
1044 Yield::Kind yield_kind,
1077 int materialized_literal_count,
int expected_property_count,
1078 int handler_count,
int parameter_count,
1080 FunctionLiteral::FunctionType function_type,
1081 FunctionLiteral::IsFunctionFlag is_function,
1082 FunctionLiteral::IsParenthesizedFlag is_parenthesized,
FunctionKind kind,
1099 static int dummy = 42;
1148 template <
typename FunctionState>
1150 template <
typename FunctionState>
1258 const char* message,
1259 const char* arg =
NULL,
1260 bool is_reference_error =
false);
1263 const char* message,
1264 const char* arg =
NULL,
1265 bool is_reference_error =
false);
1360 int* materialized_literal_count,
1361 int* expected_property_count,
bool* ok) {
1368 bool is_generator,
bool* ok);
1390 FunctionLiteral::ArityRestriction arity_restriction,
bool* ok);
1514 int* materialized_literal_count,
1515 int* expected_property_count,
bool* ok);
1523 bool name_is_strict_reserved,
FunctionKind kind,
int function_token_pos,
1524 FunctionLiteral::FunctionType function_type,
1525 FunctionLiteral::ArityRestriction arity_restriction,
bool* ok);
1534 Token::Value fvar_init_op,
bool is_generator,
bool* ok) {
1540 Expect(Token::RBRACE, ok);
1547 Token::Value fvar_init_op,
bool is_generator,
bool* ok) {
1549 fvar_init_op, is_generator, ok);
1553 template <
class Traits>
1555 FunctionState** function_state_stack,
1556 typename Traits::Type::Scope** scope_stack,
1557 typename Traits::Type::Scope* scope,
typename Traits::Type::Zone* zone,
1559 : next_materialized_literal_index_(
JSFunction::kLiteralsPrefixSize),
1560 next_handler_index_(0),
1561 expected_property_count_(0),
1562 is_generator_(
false),
1563 generator_object_variable_(
NULL),
1564 function_state_stack_(function_state_stack),
1565 outer_function_state_(*function_state_stack),
1566 scope_stack_(scope_stack),
1567 outer_scope_(*scope_stack),
1568 ast_node_id_gen_(ast_node_id_gen),
1569 factory_(zone, ast_value_factory, ast_node_id_gen) {
1570 *scope_stack_ = scope;
1571 *function_state_stack =
this;
1572 Traits::SetUpFunctionState(
this);
1576 template <
class Traits>
1577 ParserBase<Traits>::FunctionState::FunctionState(
1578 FunctionState** function_state_stack,
1579 typename Traits::Type::Scope** scope_stack,
1580 typename Traits::Type::Scope** scope,
typename Traits::Type::Zone* zone,
1581 AstValueFactory* ast_value_factory, AstNode::IdGen* ast_node_id_gen)
1582 : next_materialized_literal_index_(JSFunction::kLiteralsPrefixSize),
1583 next_handler_index_(0),
1584 expected_property_count_(0),
1585 is_generator_(
false),
1586 generator_object_variable_(
NULL),
1587 function_state_stack_(function_state_stack),
1588 outer_function_state_(*function_state_stack),
1589 scope_stack_(scope_stack),
1590 outer_scope_(*scope_stack),
1591 ast_node_id_gen_(ast_node_id_gen),
1592 factory_(zone, ast_value_factory, ast_node_id_gen) {
1593 *scope_stack_ = *scope;
1594 *function_state_stack =
this;
1595 Traits::SetUpFunctionState(
this);
1599 template <
class Traits>
1600 ParserBase<Traits>::FunctionState::~FunctionState() {
1601 *scope_stack_ = outer_scope_;
1602 *function_state_stack_ = outer_function_state_;
1603 Traits::TearDownFunctionState(
this);
1607 template<
class Traits>
1614 return ReportMessageAt(source_location,
"unexpected_eos");
1616 return ReportMessageAt(source_location,
"unexpected_token_number");
1618 return ReportMessageAt(source_location,
"unexpected_token_string");
1619 case Token::IDENTIFIER:
1620 return ReportMessageAt(source_location,
"unexpected_token_identifier");
1621 case Token::FUTURE_RESERVED_WORD:
1622 return ReportMessageAt(source_location,
"unexpected_reserved");
1625 case Token::FUTURE_STRICT_RESERVED_WORD:
1626 return ReportMessageAt(source_location, strict_mode() ==
SLOPPY
1627 ?
"unexpected_token_identifier" :
"unexpected_strict_reserved");
1631 Traits::ReportMessageAt(source_location,
"unexpected_token",
name);
1636 template<
class Traits>
1641 if (next == Token::IDENTIFIER) {
1643 if (allow_eval_or_arguments == kDontAllowEvalOrArguments &&
1644 strict_mode() ==
STRICT && this->IsEvalOrArguments(
name)) {
1645 ReportMessage(
"strict_eval_arguments");
1649 }
else if (strict_mode() ==
SLOPPY &&
1650 (next == Token::FUTURE_STRICT_RESERVED_WORD ||
1653 return this->GetSymbol(scanner());
1655 this->ReportUnexpectedToken(next);
1657 return Traits::EmptyIdentifier();
1662 template <
class Traits>
1664 Traits>::ParseIdentifierOrStrictReservedWord(
bool* is_strict_reserved,
1667 if (next == Token::IDENTIFIER) {
1668 *is_strict_reserved =
false;
1669 }
else if (next == Token::FUTURE_STRICT_RESERVED_WORD ||
1672 *is_strict_reserved =
true;
1674 ReportUnexpectedToken(next);
1676 return Traits::EmptyIdentifier();
1678 return this->GetSymbol(scanner());
1682 template <
class Traits>
1686 if (next != Token::IDENTIFIER && next != Token::FUTURE_RESERVED_WORD &&
1689 this->ReportUnexpectedToken(next);
1691 return Traits::EmptyIdentifier();
1693 return this->GetSymbol(scanner());
1697 template <
class Traits>
1703 if (!*ok)
return Traits::EmptyIdentifier();
1704 scanner()->IsGetOrSet(is_get, is_set);
1709 template <
class Traits>
1711 bool seen_equal,
bool* ok) {
1712 int pos = peek_position();
1713 if (!scanner()->ScanRegExpPattern(seen_equal)) {
1715 ReportMessage(
"unterminated_regexp");
1717 return Traits::EmptyExpression();
1720 int literal_index = function_state_->NextMaterializedLiteralIndex();
1722 IdentifierT js_pattern = this->GetNextSymbol(scanner());
1723 if (!scanner()->ScanRegExpFlags()) {
1725 ReportMessage(
"invalid_regexp_flags");
1727 return Traits::EmptyExpression();
1729 IdentifierT js_flags = this->GetNextSymbol(scanner());
1731 return factory()->NewRegExpLiteral(js_pattern, js_flags, literal_index, pos);
1735 #define CHECK_OK ok); \
1736 if (!*ok) return this->EmptyExpression(); \
1742 #define CHECK_OK_CUSTOM(x) ok); \
1743 if (!*ok) return this->x(); \
1748 template <
class Traits>
1765 int pos = peek_position();
1770 Consume(Token::THIS);
1771 result = this->ThisExpression(scope_, factory());
1775 case Token::NULL_LITERAL:
1776 case Token::TRUE_LITERAL:
1777 case Token::FALSE_LITERAL:
1780 result = this->ExpressionFromLiteral(token, pos, scanner(), factory());
1783 case Token::IDENTIFIER:
1786 case Token::FUTURE_STRICT_RESERVED_WORD: {
1789 result = this->ExpressionFromIdentifier(
name, pos, scope_, factory());
1795 result = this->ExpressionFromString(pos, scanner(), factory());
1799 case Token::ASSIGN_DIV:
1800 result = this->ParseRegExpLiteral(
true,
CHECK_OK);
1804 result = this->ParseRegExpLiteral(
false,
CHECK_OK);
1808 result = this->ParseArrayLiteral(
CHECK_OK);
1812 result = this->ParseObjectLiteral(
CHECK_OK);
1816 Consume(Token::LPAREN);
1817 if (allow_arrow_functions() && peek() == Token::RPAREN) {
1820 Consume(Token::RPAREN);
1821 result = this->ParseArrowFunctionLiteral(
1822 pos, this->EmptyArrowParamList(),
CHECK_OK);
1826 parenthesized_function_ = (peek() == Token::FUNCTION);
1827 result = this->ParseExpression(
true,
CHECK_OK);
1828 result->increase_parenthesization_level();
1833 case Token::CLASS: {
1834 Consume(Token::CLASS);
1835 int class_token_position = position();
1837 bool is_strict_reserved_name =
false;
1839 if (peek_any_identifier()) {
1840 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name,
1842 class_name_location = scanner()->location();
1844 result = this->ParseClassLiteral(
name, class_name_location,
1845 is_strict_reserved_name,
1851 if (allow_natives_syntax() || extension_ !=
NULL) {
1852 result = this->ParseV8Intrinsic(
CHECK_OK);
1860 ReportUnexpectedToken(token);
1869 template <
class Traits>
1871 bool accept_IN,
bool* ok) {
1879 int pos = position();
1881 result = factory()->NewBinaryOperation(
Token::COMMA, result, right, pos);
1887 template <
class Traits>
1893 int pos = peek_position();
1894 typename Traits::Type::ExpressionList values =
1895 this->NewExpressionList(4, zone_);
1897 while (peek() != Token::RBRACK) {
1900 elem = this->GetLiteralTheHole(peek_position(), factory());
1902 elem = this->ParseAssignmentExpression(
true,
CHECK_OK);
1904 values->Add(elem, zone_);
1905 if (peek() != Token::RBRACK) {
1912 int literal_index = function_state_->NextMaterializedLiteralIndex();
1914 return factory()->NewArrayLiteral(values, literal_index, pos);
1918 template <
class Traits>
1920 bool* is_get,
bool* is_set,
bool* is_static,
bool* ok) {
1925 return this->GetSymbol(scanner_);
1927 Consume(Token::NUMBER);
1928 return this->GetNumberAsSymbol(scanner_);
1933 return ParseIdentifierNameOrGetOrSet(is_get, is_set, ok);
1936 return this->EmptyIdentifier();
1940 template <
class Traits>
1943 bool in_class,
bool is_static,
bool* ok) {
1945 bool is_get =
false;
1946 bool is_set =
false;
1947 bool name_is_static =
false;
1948 bool is_generator = allow_harmony_object_literals_ && Check(
Token::MUL);
1951 int next_pos = peek_position();
1953 ParsePropertyName(&is_get, &is_set, &name_is_static,
1956 if (fni_ !=
NULL) this->PushLiteralName(fni_,
name);
1958 if (!in_class && !is_generator && peek() == Token::COLON) {
1962 Consume(Token::COLON);
1963 value = this->ParseAssignmentExpression(
1966 }
else if (is_generator ||
1967 (allow_harmony_object_literals_ && peek() == Token::LPAREN)) {
1970 if (is_static && this->IsPrototype(
name)) {
1971 ReportMessageAt(scanner()->location(),
"static_prototype");
1973 return this->EmptyObjectLiteralProperty();
1975 if (is_generator && in_class && !is_static && this->IsConstructor(
name)) {
1976 ReportMessageAt(scanner()->location(),
"constructor_special_method");
1978 return this->EmptyObjectLiteralProperty();
1986 value = this->ParseFunctionLiteral(
1987 name, scanner()->location(),
1990 FunctionLiteral::NORMAL_ARITY,
1993 }
else if (in_class && name_is_static && !is_static) {
1995 return ParsePropertyDefinition(checker,
true,
true, ok);
1997 }
else if (is_get || is_set) {
1999 bool dont_care =
false;
2000 name_token = peek();
2001 name = ParsePropertyName(&dont_care, &dont_care, &dont_care,
2005 if (is_static && this->IsPrototype(
name)) {
2006 ReportMessageAt(scanner()->location(),
"static_prototype");
2008 return this->EmptyObjectLiteralProperty();
2009 }
else if (in_class && !is_static && this->IsConstructor(
name)) {
2013 ReportMessageAt(scanner()->location(),
"constructor_special_method");
2015 return this->EmptyObjectLiteralProperty();
2018 is_get ? kGetterProperty : kSetterProperty,
2021 typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral(
2022 name, scanner()->location(),
2025 FunctionLiteral::ANONYMOUS_EXPRESSION,
2026 is_get ? FunctionLiteral::GETTER_ARITY : FunctionLiteral::SETTER_ARITY,
2028 return factory()->NewObjectLiteralProperty(is_get, value, next_pos,
2032 ReportUnexpectedToken(next);
2034 return this->EmptyObjectLiteralProperty();
2039 ? factory()->NewNumberLiteral(index, next_pos)
2040 : factory()->NewStringLiteral(
name, next_pos);
2042 return factory()->NewObjectLiteralProperty(key, value, is_static);
2046 template <
class Traits>
2052 int pos = peek_position();
2053 typename Traits::Type::PropertyList properties =
2054 this->NewPropertyList(4, zone_);
2055 int number_of_boilerplate_properties = 0;
2056 bool has_function =
false;
2062 while (peek() != Token::RBRACE) {
2063 if (fni_ !=
NULL) fni_->Enter();
2065 const bool in_class =
false;
2066 const bool is_static =
false;
2068 this->ParsePropertyDefinition(&checker, in_class, is_static,
CHECK_OK);
2073 this->CheckFunctionLiteralInsideTopLevelObjectLiteral(scope_, property,
2077 if (this->IsBoilerplateProperty(property)) {
2078 number_of_boilerplate_properties++;
2080 properties->Add(property, zone());
2082 if (peek() != Token::RBRACE) {
2095 int literal_index = function_state_->NextMaterializedLiteralIndex();
2097 return factory()->NewObjectLiteral(properties,
2099 number_of_boilerplate_properties,
2105 template <
class Traits>
2111 typename Traits::Type::ExpressionList result =
2112 this->NewExpressionList(4, zone_);
2114 bool done = (peek() == Token::RPAREN);
2116 ExpressionT argument = this->ParseAssignmentExpression(
2118 result->Add(argument, zone_);
2120 ReportMessage(
"too_many_arguments");
2122 return this->NullExpressionList();
2124 done = (peek() == Token::RPAREN);
2135 template <
class Traits>
2147 return this->ParseYieldExpression(ok);
2150 if (fni_ !=
NULL) fni_->Enter();
2151 typename Traits::Checkpoint checkpoint(
this);
2153 this->ParseConditionalExpression(accept_IN,
CHECK_OK);
2155 if (allow_arrow_functions() && peek() == Token::ARROW) {
2156 checkpoint.Restore();
2157 expression = this->ParseArrowFunctionLiteral(lhs_location.
beg_pos,
2163 if (fni_ !=
NULL) fni_->Leave();
2168 expression = this->CheckAndRewriteReferenceExpression(
2169 expression, lhs_location,
"invalid_lhs_in_assignment",
CHECK_OK);
2170 expression = this->MarkExpressionAsAssigned(expression);
2173 int pos = position();
2181 if (op == Token::ASSIGN && this->IsThisProperty(expression)) {
2182 function_state_->AddProperty();
2185 this->CheckAssigningFunctionLiteralToProperty(expression, right);
2191 if ((op == Token::INIT_VAR
2192 || op == Token::INIT_CONST_LEGACY
2193 || op == Token::ASSIGN)
2194 && (!right->IsCall() && !right->IsCallNew())) {
2197 fni_->RemoveLastFunction();
2202 return factory()->NewAssignment(op, expression, right, pos);
2205 template <
class Traits>
2210 int pos = peek_position();
2213 factory()->NewVariableProxy(function_state_->generator_object_variable());
2214 ExpressionT expression = Traits::EmptyExpression();
2215 Yield::Kind kind = Yield::kSuspend;
2216 if (!scanner()->HasAnyLineTerminatorBeforeNext()) {
2217 if (Check(
Token::MUL)) kind = Yield::kDelegating;
2220 case Token::SEMICOLON:
2230 if (kind == Yield::kSuspend)
2235 expression = ParseAssignmentExpression(
false,
CHECK_OK);
2239 if (kind == Yield::kDelegating) {
2241 expression = this->GetIterator(expression, factory());
2243 typename Traits::Type::YieldExpression yield =
2244 factory()->NewYield(generator_object, expression, kind, pos);
2245 if (kind == Yield::kDelegating) {
2246 yield->set_index(function_state_->NextHandlerIndex());
2253 template <
class Traits>
2260 int pos = peek_position();
2263 if (peek() != Token::CONDITIONAL)
return expression;
2264 Consume(Token::CONDITIONAL);
2271 return factory()->NewConditional(expression, left, right, pos);
2276 template <
class Traits>
2281 for (
int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) {
2283 while (Precedence(peek(), accept_IN) == prec1) {
2285 int pos = position();
2288 if (this->ShortcutNumericLiteralBinaryExpression(&x,
y, op, pos,
2301 case Token::NE_STRICT: cmp = Token::EQ_STRICT;
break;
2304 x = factory()->NewCompareOperation(cmp, x,
y, pos);
2307 x = factory()->NewUnaryOperation(
Token::NOT, x, pos);
2312 x = factory()->NewBinaryOperation(op, x,
y, pos);
2320 template <
class Traits>
2338 int pos = position();
2342 if (op == Token::DELETE && strict_mode() ==
STRICT &&
2343 this->IsIdentifier(expression)) {
2344 ReportMessage(
"strict_delete");
2346 return this->EmptyExpression();
2350 return this->BuildUnaryExpression(expression, op, pos, factory());
2355 expression = this->CheckAndRewriteReferenceExpression(
2356 expression, lhs_location,
"invalid_lhs_in_prefix_op",
CHECK_OK);
2357 this->MarkExpressionAsAssigned(expression);
2359 return factory()->NewCountOperation(op,
2365 return this->ParsePostfixExpression(ok);
2370 template <
class Traits>
2378 if (!scanner()->HasAnyLineTerminatorBeforeNext() &&
2380 expression = this->CheckAndRewriteReferenceExpression(
2381 expression, lhs_location,
"invalid_lhs_in_postfix_op",
CHECK_OK);
2382 expression = this->MarkExpressionAsAssigned(expression);
2386 factory()->NewCountOperation(next,
2395 template <
class Traits>
2405 case Token::LBRACK: {
2406 Consume(Token::LBRACK);
2407 int pos = position();
2409 result = factory()->NewProperty(result, index, pos);
2414 case Token::LPAREN: {
2416 if (scanner()->current_token() == Token::IDENTIFIER) {
2426 pos = peek_position();
2430 if (result->IsFunctionLiteral() &&
mode() == PARSE_EAGERLY) {
2431 result->AsFunctionLiteral()->set_parenthesized();
2434 typename Traits::Type::ExpressionList args = ParseArguments(
CHECK_OK);
2443 this->CheckPossibleEvalCall(result, scope_);
2444 result = factory()->NewCall(result, args, pos);
2445 if (fni_ !=
NULL) fni_->RemoveLastFunction();
2449 case Token::PERIOD: {
2450 Consume(Token::PERIOD);
2451 int pos = position();
2453 result = factory()->NewProperty(
2454 result, factory()->NewStringLiteral(
name, pos), pos);
2455 if (fni_ !=
NULL) this->PushLiteralName(fni_,
name);
2466 template <
class Traits>
2486 if (peek() == Token::NEW) {
2487 Consume(Token::NEW);
2488 int new_pos = position();
2490 if (Check(Token::SUPER)) {
2491 result = this->SuperReference(scope_, factory());
2493 result = this->ParseMemberWithNewPrefixesExpression(
CHECK_OK);
2495 if (peek() == Token::LPAREN) {
2497 typename Traits::Type::ExpressionList args =
2499 result = factory()->NewCallNew(result, args, new_pos);
2501 result = this->ParseMemberExpressionContinuation(result,
CHECK_OK);
2505 return factory()->NewCallNew(result, this->NewExpressionList(0, zone_),
2509 return this->ParseMemberExpression(ok);
2513 template <
class Traits>
2526 if (peek() == Token::FUNCTION) {
2527 Consume(Token::FUNCTION);
2531 bool is_strict_reserved_name =
false;
2533 FunctionLiteral::FunctionType function_type =
2534 FunctionLiteral::ANONYMOUS_EXPRESSION;
2535 if (peek_any_identifier()) {
2536 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name,
2538 function_name_location = scanner()->location();
2539 function_type = FunctionLiteral::NAMED_EXPRESSION;
2541 result = this->ParseFunctionLiteral(
2542 name, function_name_location, is_strict_reserved_name,
2547 }
else if (peek() == Token::SUPER) {
2548 int beg_pos = position();
2549 Consume(Token::SUPER);
2551 if (next == Token::PERIOD || next == Token::LBRACK ||
2552 next == Token::LPAREN) {
2553 result = this->SuperReference(scope_, factory());
2556 "unexpected_super");
2558 return this->EmptyExpression();
2561 result = ParsePrimaryExpression(
CHECK_OK);
2564 result = ParseMemberExpressionContinuation(result,
CHECK_OK);
2569 template <
class Traits>
2577 case Token::LBRACK: {
2578 Consume(Token::LBRACK);
2579 int pos = position();
2581 expression = factory()->NewProperty(expression, index, pos);
2583 this->PushPropertyName(fni_, index);
2588 case Token::PERIOD: {
2589 Consume(Token::PERIOD);
2590 int pos = position();
2592 expression = factory()->NewProperty(
2593 expression, factory()->NewStringLiteral(
name, pos), pos);
2595 this->PushLiteralName(fni_,
name);
2604 return this->EmptyExpression();
2608 template <
class Traits>
2613 typename Traits::Type::ScopePtr scope =
2615 typename Traits::Type::StatementList body;
2616 typename Traits::Type::AstProperties ast_properties;
2618 int num_parameters = -1;
2619 int materialized_literal_count = -1;
2620 int expected_property_count = -1;
2621 int handler_count = 0;
2624 FunctionState function_state(&function_state_, &scope_, &scope, zone(),
2625 this->ast_value_factory(), ast_node_id_gen_);
2627 num_parameters = Traits::DeclareArrowParametersFromExpression(
2628 params_ast, scope_, &dupe_error_loc, ok);
2632 "malformed_arrow_function_parameter_list");
2633 return this->EmptyExpression();
2638 "too_many_parameters");
2640 return this->EmptyExpression();
2645 if (peek() == Token::LBRACE) {
2647 Consume(Token::LBRACE);
2648 bool is_lazily_parsed =
2649 (
mode() == PARSE_LAZILY && scope_->AllowsLazyCompilation());
2650 if (is_lazily_parsed) {
2651 body = this->NewStatementList(0, zone());
2652 this->SkipLazyFunctionBody(this->EmptyIdentifier(),
2653 &materialized_literal_count,
2654 &expected_property_count,
CHECK_OK);
2656 body = this->ParseEagerFunctionBody(
2658 Token::INIT_VAR,
false,
2660 materialized_literal_count =
2661 function_state.materialized_literal_count();
2662 expected_property_count = function_state.expected_property_count();
2663 handler_count = function_state.handler_count();
2667 int pos = position();
2668 parenthesized_function_ =
false;
2670 body = this->NewStatementList(1, zone());
2671 body->Add(factory()->NewReturnStatement(expression, pos), zone());
2672 materialized_literal_count = function_state.materialized_literal_count();
2673 expected_property_count = function_state.expected_property_count();
2674 handler_count = function_state.handler_count();
2677 scope->set_start_position(start_pos);
2678 scope->set_end_position(scanner()->location().end_pos);
2681 bool function_name_is_strict_reserved =
false;
2685 this->CheckStrictFunctionNameAndParameters(
2686 this->EmptyIdentifier(), function_name_is_strict_reserved,
2687 function_name_loc, eval_args_error_loc, dupe_error_loc, reserved_loc,
2691 if (strict_mode() ==
STRICT) {
2692 CheckOctalLiteral(start_pos, scanner()->location().end_pos,
CHECK_OK);
2695 if (allow_harmony_scoping() && strict_mode() ==
STRICT)
2696 this->CheckConflictingVarDeclarations(scope,
CHECK_OK);
2698 ast_properties = *factory()->visitor()->ast_properties();
2699 dont_optimize_reason = factory()->visitor()->dont_optimize_reason();
2703 this->EmptyIdentifierString(), this->ast_value_factory(), scope, body,
2704 materialized_literal_count, expected_property_count, handler_count,
2705 num_parameters, FunctionLiteral::kNoDuplicateParameters,
2706 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction,
2710 function_literal->set_function_token_position(start_pos);
2711 function_literal->set_ast_properties(&ast_properties);
2712 function_literal->set_dont_optimize_reason(dont_optimize_reason);
2714 if (fni_ !=
NULL) this->InferFunctionName(fni_, function_literal);
2716 return function_literal;
2720 template <
class Traits>
2723 bool name_is_strict_reserved,
int pos,
bool* ok) {
2725 if (name_is_strict_reserved) {
2726 ReportMessageAt(class_name_location,
"unexpected_strict_reserved");
2728 return this->EmptyExpression();
2730 if (this->IsEvalOrArguments(
name)) {
2731 ReportMessageAt(class_name_location,
"strict_eval_arguments");
2733 return this->EmptyExpression();
2738 typename Traits::Type::ScopePtr extends_scope =
2740 FunctionState extends_function_state(
2741 &function_state_, &scope_, &extends_scope, zone(),
2742 this->ast_value_factory(), ast_node_id_gen_);
2743 scope_->SetStrictMode(
STRICT);
2744 scope_->SetScopeName(
name);
2747 if (Check(Token::EXTENDS)) {
2748 extends = this->ParseLeftHandSideExpression(
CHECK_OK);
2752 typename Traits::Type::PropertyList properties =
2753 this->NewPropertyList(4, zone_);
2757 while (peek() != Token::RBRACE) {
2758 if (Check(Token::SEMICOLON))
continue;
2759 if (fni_ !=
NULL) fni_->Enter();
2761 const bool in_class =
true;
2762 const bool is_static =
false;
2764 this->ParsePropertyDefinition(&checker, in_class, is_static,
CHECK_OK);
2766 properties->Add(property, zone());
2775 return this->ClassLiteral(
name, extends, constructor, properties, pos,
2780 template <
typename Traits>
2785 if (strict_mode() ==
STRICT && this->IsIdentifier(expression) &&
2786 this->IsEvalOrArguments(this->AsIdentifier(expression))) {
2787 this->ReportMessageAt(location,
"strict_eval_arguments",
false);
2789 return this->EmptyExpression();
2790 }
else if (expression->IsValidReferenceExpression()) {
2792 }
else if (expression->IsCall()) {
2796 ExpressionT error = this->NewThrowReferenceError(message, pos);
2797 return factory()->NewProperty(expression, error, pos);
2799 this->ReportMessageAt(location, message,
true);
2801 return this->EmptyExpression();
2807 #undef CHECK_OK_CUSTOM
2810 template <
typename Traits>
2814 if (property == Token::NUMBER) {
static const int kMaxArguments
static const int kLiteralsPrefixSize
void set_generator_object_variable(typename Traits::Type::GeneratorVariable *variable)
FunctionState(FunctionState **function_state_stack, typename Traits::Type::Scope **scope_stack, typename Traits::Type::Scope *scope, typename Traits::Type::Zone *zone=NULL, AstValueFactory *ast_value_factory=NULL, AstNode::IdGen *ast_node_id_gen=NULL)
int expected_property_count_
FunctionState ** function_state_stack_
BlockState(typename Traits::Type::Scope **scope_stack, typename Traits::Type::Scope *scope)
int materialized_literal_count()
ParsingModeScope(ParserBase *parser, Mode mode)
Traits::Type::Factory factory_
CheckpointBase(ParserBase *parser)
FunctionState * outer_function_state_
Traits::Type::Zone * extra_param_
Traits::Type::Scope ** scope_stack_
Traits::Type::Factory * factory()
FunctionState(FunctionState **function_state_stack, typename Traits::Type::Scope **scope_stack, typename Traits::Type::Scope **scope, typename Traits::Type::Zone *zone=NULL, AstValueFactory *ast_value_factory=NULL, AstNode::IdGen *ast_node_id_gen=NULL)
bool is_generator() const
Traits::Type::Scope * scope_
Variable * generator_object_variable_
AstNode::IdGen * ast_node_id_gen_
int expected_property_count()
Traits::Type::Scope * outer_scope_
void set_is_generator(bool is_generator)
AstNode::IdGen saved_id_gen_
FunctionState * function_state_
int NextMaterializedLiteralIndex()
int next_materialized_literal_index_
Traits::Type::GeneratorVariable * generator_object_variable() const
ObjectLiteralChecker(ParserBase *parser, StrictMode strict_mode)
ParserBase * parser() const
bool HasConflict(PropertyKind type1, PropertyKind type2)
void CheckProperty(Token::Value property, PropertyKind type, bool *ok)
bool IsAccessorAccessorConflict(PropertyKind type1, PropertyKind type2)
bool IsDataDataConflict(PropertyKind type1, PropertyKind type2)
Scanner * scanner() const
bool IsDataAccessorConflict(PropertyKind type1, PropertyKind type2)
v8::Extension * extension_
IdentifierT ParseIdentifierName(bool *ok)
bool allow_harmony_scoping() const
ExpressionT ParseBinaryExpression(int prec, bool accept_IN, bool *ok)
INLINE(Token::Value peek())
ExpressionT ParseClassLiteral(IdentifierT name, Scanner::Location function_name_location, bool name_is_strict_reserved, int pos, bool *ok)
bool Check(Token::Value token)
static int Precedence(Token::Value token, bool accept_IN)
ExpressionT ParsePostfixExpression(bool *ok)
IdentifierT ParseIdentifierOrStrictReservedWord(bool *is_strict_reserved, bool *ok)
bool allow_harmony_object_literals() const
ExpressionT ParseObjectLiteral(bool *ok)
ExpressionT ParseConditionalExpression(bool accept_IN, bool *ok)
Traits::Type::ObjectLiteralProperty ObjectLiteralPropertyT
bool peek_any_identifier()
ExpressionT ParseArrowFunctionLiteral(int start_pos, ExpressionT params_ast, bool *ok)
Traits::Type::Scope * scope_
void set_allow_harmony_scoping(bool allow)
IdentifierT ParsePropertyName(bool *is_get, bool *is_set, bool *is_static, bool *ok)
Traits::Type::Zone * zone() const
void set_allow_lazy(bool allow)
void Expect(Token::Value token, bool *ok)
AstNode::IdGen * ast_node_id_gen() const
Traits::Type::Literal LiteralT
ExpressionT ParseYieldExpression(bool *ok)
void set_stack_overflow()
void set_allow_arrow_functions(bool allow)
AstNode::IdGen * ast_node_id_gen_
Traits::Type::FunctionLiteral FunctionLiteralT
IdentifierT ParseIdentifierNameOrGetOrSet(bool *is_get, bool *is_set, bool *ok)
void ReportMessageAt(Scanner::Location location, const char *message, bool is_reference_error=false)
bool allow_natives_syntax() const
IdentifierT ParseIdentifier(AllowEvalOrArgumentsAsIdentifier, bool *ok)
Traits::Type::ExpressionList ParseArguments(bool *ok)
void CheckOctalLiteral(int beg_pos, int end_pos, bool *ok)
bool allow_natives_syntax_
Traits::Type::Expression ExpressionT
bool is_generator() const
void set_allow_modules(bool allow)
bool CheckContextualKeyword(Vector< const char > keyword)
ParserBase(Scanner *scanner, uintptr_t stack_limit, v8::Extension *extension, ParserRecorder *log, typename Traits::Type::Zone *zone, AstNode::IdGen *ast_node_id_gen, typename Traits::Type::Parser this_object)
ObjectLiteralPropertyT ParsePropertyDefinition(ObjectLiteralChecker *checker, bool in_class, bool is_static, bool *ok)
void set_allow_harmony_numeric_literals(bool allow)
ExpressionT ParseArrayLiteral(bool *ok)
void set_allow_harmony_object_literals(bool allow)
void set_allow_classes(bool allow)
ExpressionT ParseAssignmentExpression(bool accept_IN, bool *ok)
bool stack_overflow() const
void ExpectSemicolon(bool *ok)
ExpressionT CheckAndRewriteReferenceExpression(ExpressionT expression, Scanner::Location location, const char *message, bool *ok)
void ReportMessage(const char *message, const char *arg=NULL, bool is_reference_error=false)
bool allow_harmony_object_literals_
Traits::Type::Identifier IdentifierT
bool allow_arrow_functions_
ExpressionT ParseExpression(bool accept_IN, bool *ok)
INLINE(Token::Value Next())
ExpressionT ParseUnaryExpression(bool *ok)
ExpressionT ParseMemberWithNewPrefixesExpression(bool *ok)
bool allow_modules() const
Scanner * scanner() const
FunctionState * function_state_
bool allow_arrow_functions() const
void CheckStrictFunctionNameAndParameters(IdentifierT function_name, bool function_name_is_strict_reserved, const Scanner::Location &function_name_loc, const Scanner::Location &eval_args_error_loc, const Scanner::Location &dupe_error_loc, const Scanner::Location &reserved_loc, bool *ok)
void set_allow_natives_syntax(bool allow)
bool allow_harmony_numeric_literals() const
bool parenthesized_function_
void ExpectContextualKeyword(Vector< const char > keyword, bool *ok)
ExpressionT ParsePrimaryExpression(bool *ok)
void Consume(Token::Value token)
friend class Traits::Checkpoint
Traits::Type::Factory * factory()
void ReportUnexpectedToken(Token::Value token)
ExpressionT ParseMemberExpressionContinuation(ExpressionT expression, bool *ok)
ExpressionT ParseRegExpLiteral(bool seen_equal, bool *ok)
ExpressionT ParseMemberExpression(bool *ok)
Traits::Type::Zone * zone_
bool allow_classes() const
ExpressionT ParseLeftHandSideExpression(bool *ok)
AllowEvalOrArgumentsAsIdentifier
@ kDontAllowEvalOrArguments
void Add(PreParserExpression, void *)
PreParserExpressionList * operator->()
PreParserExpressionList()
bool is_parenthesized() const
static PreParserExpression ThisProperty()
static PreParserExpression FromIdentifier(PreParserIdentifier id)
static PreParserExpression UseStrictStringLiteral()
bool IsIdentifier() const
bool IsValidReferenceExpression() const
bool IsStringLiteral() const
void set_function_token_position(int position)
void set_dont_optimize_reason(BailoutReason dont_optimize_reason)
void set_index(int index)
bool IsUseStrictLiteral() const
bool IsThisProperty() const
static PreParserExpression BinaryOperation(PreParserExpression left, Token::Value op, PreParserExpression right)
static PreParserExpression Call()
@ kThisPropertyExpression
@ kMultiParenthesizedExpression
@ kParenthesizedExpression
@ kBinaryOperationArrowParamList
static PreParserExpression Super()
static PreParserExpression This()
static PreParserExpression Property()
void increase_parenthesization_level()
bool operator==(const PreParserExpression &other) const
bool IsBinaryOperation() const
PreParserExpression * operator->()
PreParserExpression(int expression_code)
static PreParserExpression Default()
static PreParserExpression EmptyArrowParamList()
static PreParserExpression StringLiteral()
int ArrowParamListBit() const
bool operator!=(const PreParserExpression &other) const
bool IsValidArrowParamList() const
PreParserIdentifier AsIdentifier() const
void set_ast_properties(int *ast_properties)
PreParserExpression AsFunctionLiteral()
bool IsFunctionLiteral() const
PreParserFactory(void *, void *, void *)
PreParserExpression NewProperty(PreParserExpression obj, PreParserExpression key, int pos)
PreParserExpression NewYield(PreParserExpression generator_object, PreParserExpression expression, Yield::Kind yield_kind, int pos)
PreParserExpression NewCompareOperation(Token::Value op, PreParserExpression left, PreParserExpression right, int pos)
PreParserExpression NewAssignment(Token::Value op, PreParserExpression left, PreParserExpression right, int pos)
PreParserStatement NewReturnStatement(PreParserExpression expression, int pos)
PreParserExpression NewCallNew(PreParserExpression expression, PreParserExpressionList arguments, int pos)
PreParserExpression NewBinaryOperation(Token::Value op, PreParserExpression left, PreParserExpression right, int pos)
PreParserExpression NewNumberLiteral(double number, int pos)
PreParserExpression NewVariableProxy(void *variable)
BailoutReason dont_optimize_reason()
PreParserExpression NewFunctionLiteral(PreParserIdentifier name, AstValueFactory *ast_value_factory, const PreParserScope &scope, PreParserStatementList body, int materialized_literal_count, int expected_property_count, int handler_count, int parameter_count, FunctionLiteral::ParameterFlag has_duplicate_parameters, FunctionLiteral::FunctionType function_type, FunctionLiteral::IsFunctionFlag is_function, FunctionLiteral::IsParenthesizedFlag is_parenthesized, FunctionKind kind, int position)
PreParserExpression NewObjectLiteralProperty(bool is_getter, PreParserExpression value, int pos, bool is_static)
PreParserExpression NewObjectLiteralProperty(PreParserExpression key, PreParserExpression value, bool is_static)
PreParserExpression NewStringLiteral(PreParserIdentifier identifier, int pos)
PreParserExpression NewCall(PreParserExpression expression, PreParserExpressionList arguments, int pos)
PreParserExpression NewObjectLiteral(PreParserExpressionList properties, int literal_index, int boilerplate_properties, bool has_function, int pos)
PreParserFactory * visitor()
PreParserExpression NewConditional(PreParserExpression condition, PreParserExpression then_expression, PreParserExpression else_expression, int pos)
PreParserExpression NewUnaryOperation(Token::Value op, PreParserExpression expression, int pos)
PreParserExpression NewArrayLiteral(PreParserExpressionList values, int literal_index, int pos)
PreParserExpression NewClassLiteral(PreParserIdentifier name, PreParserExpression extends, PreParserExpression constructor, PreParserExpressionList properties, int position)
PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, PreParserIdentifier js_flags, int literal_index, int pos)
PreParserExpression NewCountOperation(Token::Value op, bool is_prefix, PreParserExpression expression, int pos)
static PreParserIdentifier Eval()
static PreParserIdentifier Arguments()
static PreParserIdentifier Prototype()
static PreParserIdentifier FutureStrictReserved()
static PreParserIdentifier FutureReserved()
bool IsFutureReserved() const
const PreParserIdentifier * operator->() const
bool IsValidStrictVariable() const
bool IsEvalOrArguments() const
const PreParserIdentifier raw_name() const
static PreParserIdentifier Let()
PreParserIdentifier(Type type)
bool IsConstructor() const
static PreParserIdentifier Default()
static PreParserIdentifier Constructor()
bool IsFutureStrictReserved() const
@ kFutureReservedIdentifier
@ kFutureStrictReservedIdentifier
static PreParserIdentifier Yield()
StrictMode strict_mode() const
void set_end_position(int position)
void set_start_position(int position)
void SetScopeName(PreParserIdentifier name)
PreParserScope * operator->()
void SetStrictMode(StrictMode strict_mode)
void DeclareParameter(const PreParserIdentifier &identifier, VariableMode)
bool IsDeclared(const PreParserIdentifier &identifier) const
PreParserScope(PreParserScope *outer_scope, ScopeType scope_type, void *=NULL)
bool AllowsLazyCompilation() const
void Add(PreParserStatement, void *)
PreParserStatementList * operator->()
@ kUseStrictExpressionStatement
@ kStringLiteralExpressionStatement
bool IsUseStrictLiteral()
static PreParserStatement FunctionDeclaration()
PreParserStatement(Type code)
static PreParserStatement Default()
static PreParserStatement ExpressionStatement(PreParserExpression expression)
bool IsFunctionDeclaration()
static PreParserExpression EmptyLiteral()
static PreParserStatementList NewStatementList(int size, void *zone)
PreParserIdentifier GetNumberAsSymbol(Scanner *scanner)
PreParserExpression GetIterator(PreParserExpression iterable, PreParserFactory *factory)
static PreParserExpression MarkExpressionAsAssigned(PreParserExpression expression)
static PreParserIdentifier GetNextSymbol(Scanner *scanner)
void CheckConflictingVarDeclarations(PreParserScope scope, bool *ok)
PreParserExpression ExpressionFromString(int pos, Scanner *scanner, PreParserFactory *factory=NULL)
static void PushLiteralName(FuncNameInferrer *fni, PreParserIdentifier id)
void SkipLazyFunctionBody(PreParserIdentifier function_name, int *materialized_literal_count, int *expected_property_count, bool *ok)
static bool IsBoilerplateProperty(PreParserExpression property)
static void InferFunctionName(FuncNameInferrer *fni, PreParserExpression expression)
static PreParserExpression ExpressionFromIdentifier(PreParserIdentifier name, int pos, PreParserScope *scope, PreParserFactory *factory)
PreParserStatementList ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, Variable *fvar, Token::Value fvar_init_op, bool is_generator, bool *ok)
PreParserScope NewScope(PreParserScope *outer_scope, ScopeType scope_type)
PreParserExpression ParseV8Intrinsic(bool *ok)
static PreParserExpression EmptyArrowParamList()
static PreParserIdentifier EmptyIdentifier()
static PreParserExpression ExpressionFromLiteral(Token::Value token, int pos, Scanner *scanner, PreParserFactory *factory)
bool ShortcutNumericLiteralBinaryExpression(PreParserExpression *x, PreParserExpression y, Token::Value op, int pos, PreParserFactory *factory)
static PreParserExpression ThisExpression(PreParserScope *scope, PreParserFactory *factory)
static AstValueFactory * ast_value_factory()
static void CheckPossibleEvalCall(PreParserExpression expression, PreParserScope *scope)
PreParserExpression ParseFunctionLiteral(PreParserIdentifier name, Scanner::Location function_name_location, bool name_is_strict_reserved, FunctionKind kind, int function_token_position, FunctionLiteral::FunctionType type, FunctionLiteral::ArityRestriction arity_restriction, bool *ok)
PreParserExpression NewThrowSyntaxError(const char *type, Handle< Object > arg, int pos)
PreParserExpression NewThrowTypeError(const char *type, Handle< Object > arg, int pos)
static bool IsThisProperty(PreParserExpression expression)
static PreParserIdentifier EmptyIdentifierString()
static PreParserExpression EmptyObjectLiteralProperty()
static PreParserExpressionList NewPropertyList(int size, void *zone)
static PreParserExpressionList NewExpressionList(int size, void *zone)
PreParserIdentifier GetSymbol(Scanner *scanner)
static PreParserExpression GetLiteralTheHole(int position, PreParserFactory *factory)
static void CheckFunctionLiteralInsideTopLevelObjectLiteral(PreParserScope *scope, PreParserExpression property, bool *has_function)
static bool IsIdentifier(PreParserExpression expression)
PreParserTraits(PreParser *pre_parser)
static void PushPropertyName(FuncNameInferrer *fni, PreParserExpression expression)
static PreParserExpression EmptyFunctionLiteral()
static bool IsConstructor(PreParserIdentifier identifier)
static void SetUpFunctionState(FunctionState *function_state)
static PreParserExpression EmptyExpression()
static bool IsPrototype(PreParserIdentifier identifier)
static PreParserExpressionList NullExpressionList()
PreParserExpression BuildUnaryExpression(PreParserExpression expression, Token::Value op, int pos, PreParserFactory *factory)
void ReportMessageAt(Scanner::Location location, const char *message, const char *arg=NULL, bool is_reference_error=false)
static void CheckAssigningFunctionLiteralToProperty(PreParserExpression left, PreParserExpression right)
static bool IsArrayIndex(PreParserIdentifier string, uint32_t *index)
static PreParserIdentifier AsIdentifier(PreParserExpression expression)
static PreParserExpression ClassLiteral(PreParserIdentifier name, PreParserExpression extends, PreParserExpression constructor, PreParserExpressionList properties, int position, PreParserFactory *factory)
static PreParserExpression SuperReference(PreParserScope *scope, PreParserFactory *factory)
static void TearDownFunctionState(FunctionState *function_state)
int DeclareArrowParametersFromExpression(PreParserExpression expression, PreParserScope *scope, Scanner::Location *dupe_loc, bool *ok)
static bool IsEvalOrArguments(PreParserIdentifier identifier)
static bool IsFutureStrictReserved(PreParserIdentifier identifier)
PreParserExpression NewThrowReferenceError(const char *type, int pos)
Expression ParseObjectLiteral(bool *ok)
Statement ParseReturnStatement(bool *ok)
Statement ParseTryStatement(bool *ok)
Statement ParseContinueStatement(bool *ok)
void ParseLazyFunctionLiteralBody(bool *ok)
Statement ParseVariableStatement(VariableDeclarationContext var_context, bool *ok)
PreParseResult PreParseLazyFunction(StrictMode strict_mode, bool is_generator, ParserRecorder *log)
Statement ParseFunctionDeclaration(bool *ok)
Statement ParseWithStatement(bool *ok)
PreParserStatementList ParseEagerFunctionBody(PreParserIdentifier function_name, int pos, Variable *fvar, Token::Value fvar_init_op, bool is_generator, bool *ok)
Statement ParseStatement(bool *ok)
VariableDeclarationProperties
Statement ParseWhileStatement(bool *ok)
PreParserStatement Statement
Expression ParseV8Intrinsic(bool *ok)
Statement ParseSourceElement(bool *ok)
bool CheckInOrOf(bool accept_OF)
Statement ParseSwitchStatement(bool *ok)
Statement ParseForStatement(bool *ok)
PreParserIdentifier Identifier
VariableDeclarationContext
Statement ParseClassDeclaration(bool *ok)
Statement ParseExpressionOrLabelledStatement(bool *ok)
Statement ParseVariableDeclarations(VariableDeclarationContext var_context, VariableDeclarationProperties *decl_props, int *num_decl, bool *ok)
SourceElements ParseSourceElements(int end_token, bool *ok)
Statement ParseDoWhileStatement(bool *ok)
Expression ParseFunctionLiteral(Identifier name, Scanner::Location function_name_location, bool name_is_strict_reserved, FunctionKind kind, int function_token_pos, FunctionLiteral::FunctionType function_type, FunctionLiteral::ArityRestriction arity_restriction, bool *ok)
Statement ParseThrowStatement(bool *ok)
PreParser(Scanner *scanner, ParserRecorder *log, uintptr_t stack_limit)
void SkipLazyFunctionBody(PreParserIdentifier function_name, int *materialized_literal_count, int *expected_property_count, bool *ok)
Statement ParseBlock(bool *ok)
PreParserExpression Expression
Expression ParseConditionalExpression(bool accept_IN, bool *ok)
Statement ParseDebuggerStatement(bool *ok)
Statement ParseIfStatement(bool *ok)
PreParseResult PreParseProgram()
Statement ParseBreakStatement(bool *ok)
static const int kNoPosition
Token::Value peek() const
int FindNumber(DuplicateFinder *finder, int value)
void SetHarmonyClasses(bool classes)
void SetHarmonyModules(bool modules)
bool HarmonyClasses() const
void SetHarmonyNumericLiterals(bool numeric_literals)
bool HarmonyModules() const
int FindSymbol(DuplicateFinder *finder, int value)
void SetHarmonyScoping(bool scoping)
Location peek_location() const
bool HarmonyNumericLiterals() const
bool HarmonyScoping() const
void clear_octal_position()
Location octal_position() const
Location location() const
static bool IsKeyword(Value tok)
static bool IsCompareOp(Value op)
static const char * String(Value tok)
static int Precedence(Value tok)
static bool IsUnaryOp(Value op)
static bool IsCountOp(Value op)
static bool IsAssignmentOp(Value tok)
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
kFeedbackVectorOffset kHiddenPrototypeBit kReadOnlyPrototypeBit kDoNotCacheBit kIsTopLevelBit kAllowLazyCompilationWithoutContext has_duplicate_parameters
kExpectedNofPropertiesOffset function_token_position
DISABLE_ASAN uintptr_t GetCurrentStackPosition()
@ kConciseGeneratorMethod
Debugger support for the V8 JavaScript engine.
#define CHECK_OK_CUSTOM(x)
PreParserExpression ObjectLiteralProperty
PreParserExpression Expression
Vector< PreParserIdentifier > ParameterIdentifierVector
PreParserStatementList StatementList
PreParserExpression ClassLiteral
PreParserExpression YieldExpression
PreParserExpressionList PropertyList
PreParserExpression Literal
PreParserExpression FunctionLiteral
PreParserIdentifier Identifier
PreParserExpressionList ExpressionList
static Location invalid()