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

Revert "[parser] Restructure Binary expression parsing"

This reverts commit f2f48bd8.

Reason for revert: Negative performance impact

Original change's description:
> [parser] Restructure Binary expression parsing
> 
> Change-Id: I1ff35a3e647b32edb229f47fde80de1b8b50737b
> Reviewed-on: https://chromium-review.googlesource.com/1240333
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#56179}

TBR=ishell@chromium.org,verwaest@chromium.org

Change-Id: If08f8c5f538dc25f5f3ea62cd8dd80e024156e81
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/1241957Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56186}
parent 534820c2
......@@ -1131,10 +1131,7 @@ class ParserBase {
V8_INLINE ExpressionT ParseConditionalExpression(bool accept_IN, bool* ok);
ExpressionT ParseConditionalContinuation(ExpressionT expression,
bool accept_IN, int pos, bool* ok);
ExpressionT ParseBinaryContinuation(ExpressionT x, int prec, int prec1,
bool accept_IN, bool* ok);
V8_INLINE ExpressionT ParseBinaryExpression(int prec, bool accept_IN,
bool* ok);
ExpressionT ParseBinaryExpression(int prec, bool accept_IN, bool* ok);
ExpressionT ParseUnaryOpExpression(bool* ok);
ExpressionT ParseAwaitExpression(bool* ok);
ExpressionT ParsePrefixExpression(bool* ok);
......@@ -3139,11 +3136,12 @@ ParserBase<Impl>::ParseConditionalContinuation(ExpressionT expression,
// Precedence >= 4
template <typename Impl>
typename ParserBase<Impl>::ExpressionT
ParserBase<Impl>::ParseBinaryContinuation(ExpressionT x, int prec, int prec1,
bool accept_IN, bool* ok) {
typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseBinaryExpression(
int prec, bool accept_IN, bool* ok) {
DCHECK_GE(prec, 4);
SourceRange right_range;
do {
ExpressionT x = ParseUnaryExpression(CHECK_OK);
for (int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) {
// prec1 >= 4
while (Precedence(peek(), accept_IN) == prec1) {
ValidateExpression(CHECK_OK);
......@@ -3186,21 +3184,6 @@ ParserBase<Impl>::ParseBinaryContinuation(ExpressionT x, int prec, int prec1,
}
}
}
--prec1;
} while (prec1 >= prec);
return x;
}
// Precedence >= 4
template <typename Impl>
typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseBinaryExpression(
int prec, bool accept_IN, bool* ok) {
DCHECK_GE(prec, 4);
ExpressionT x = ParseUnaryExpression(CHECK_OK);
int prec1 = Precedence(peek(), accept_IN);
if (prec1 >= prec) {
return ParseBinaryContinuation(x, prec, prec1, accept_IN, CHECK_OK);
}
return x;
}
......
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