Commit c0f871a1 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Tweak ParseMemberWithNewPrefix for better inlining

Change-Id: I38e7ea204c84dfef22e1f87ac5923d93322b2620
Reviewed-on: https://chromium-review.googlesource.com/1238722Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56157}
parent 5cfa94bd
......@@ -1131,7 +1131,10 @@ class ParserBase {
ExpressionT ParseUnaryExpression(bool* ok);
V8_INLINE ExpressionT ParsePostfixExpression(bool* ok);
V8_INLINE ExpressionT ParseLeftHandSideExpression(bool* ok);
ExpressionT ParseMemberWithNewPrefixesExpression(bool* is_async, bool* ok);
ExpressionT ParseMemberWithPresentNewPrefixesExpression(bool* is_async,
bool* ok);
V8_INLINE ExpressionT ParseMemberWithNewPrefixesExpression(bool* is_async,
bool* ok);
V8_INLINE ExpressionT ParseMemberExpression(bool* is_async, bool* ok);
V8_INLINE ExpressionT ParseMemberExpressionContinuation(
ExpressionT expression, bool* is_async, bool* ok);
......@@ -3427,7 +3430,7 @@ ParserBase<Impl>::ParseLeftHandSideExpression(bool* ok) {
template <typename Impl>
typename ParserBase<Impl>::ExpressionT
ParserBase<Impl>::ParseMemberWithNewPrefixesExpression(bool* is_async,
ParserBase<Impl>::ParseMemberWithPresentNewPrefixesExpression(bool* is_async,
bool* ok) {
// NewExpression ::
// ('new')+ MemberExpression
......@@ -3448,8 +3451,6 @@ ParserBase<Impl>::ParseMemberWithNewPrefixesExpression(bool* is_async,
// new new foo means new (new foo)
// new new foo() means new (new foo())
// new new foo().bar().baz means (new (new foo()).bar()).baz
if (peek() == Token::NEW) {
BindingPatternUnexpectedToken();
ArrowFormalParametersUnexpectedToken();
Consume(Token::NEW);
......@@ -3488,9 +3489,15 @@ ParserBase<Impl>::ParseMemberWithNewPrefixesExpression(bool* is_async,
}
// NewExpression without arguments.
return factory()->NewCallNew(result, impl()->NewExpressionList(0), new_pos);
}
// No 'new' or 'super' keyword.
return ParseMemberExpression(is_async, ok);
}
template <typename Impl>
typename ParserBase<Impl>::ExpressionT
ParserBase<Impl>::ParseMemberWithNewPrefixesExpression(bool* is_async,
bool* ok) {
return peek() == Token::NEW
? ParseMemberWithPresentNewPrefixesExpression(is_async, ok)
: ParseMemberExpression(is_async, ok);
}
template <typename Impl>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment