Commit bbc68d41 authored by gsathya's avatar gsathya Committed by Commit bot

[parser] remove %catch parsing

Promise catch prediction no longer has to be threaded through the
parser since the code using %catch has been moved to TF codestubs.

This is currently dead code.

BUG=v8:5343,v8:5741

Review-Url: https://codereview.chromium.org/2575133002
Cr-Commit-Position: refs/heads/master@{#41701}
parent 51245896
......@@ -3237,15 +3237,6 @@ class AstNodeFactory final BASE_EMBEDDED {
try_block, scope, variable, catch_block, HandlerTable::UNCAUGHT, pos);
}
TryCatchStatement* NewTryCatchStatementForPromiseReject(Block* try_block,
Scope* scope,
Variable* variable,
Block* catch_block,
int pos) {
return new (zone_) TryCatchStatement(
try_block, scope, variable, catch_block, HandlerTable::PROMISE, pos);
}
TryCatchStatement* NewTryCatchStatementForDesugaring(Block* try_block,
Scope* scope,
Variable* variable,
......
......@@ -879,15 +879,16 @@ void AstPrinter::PrintTryStatement(TryStatement* node) {
case HandlerTable::CAUGHT:
prediction = "CAUGHT";
break;
case HandlerTable::PROMISE:
prediction = "PROMISE";
break;
case HandlerTable::DESUGARING:
prediction = "DESUGARING";
break;
case HandlerTable::ASYNC_AWAIT:
prediction = "ASYNC_AWAIT";
break;
case HandlerTable::PROMISE:
// Catch prediction resulting in promise rejections aren't
// parsed by the parser.
UNREACHABLE();
}
Print(" %s\n", prediction);
}
......
......@@ -642,7 +642,6 @@ class ParserBase {
scope(nullptr),
init_block(parser->impl()->NullBlock()),
inner_block(parser->impl()->NullBlock()),
for_promise_reject(false),
bound_names(1, parser->zone()),
tail_call_expressions(parser->zone()) {}
IdentifierT name;
......@@ -651,7 +650,6 @@ class ParserBase {
Scope* scope;
BlockT init_block;
BlockT inner_block;
bool for_promise_reject;
ZoneList<const AstRawString*> bound_names;
TailCallExpressionList tail_call_expressions;
};
......@@ -5121,7 +5119,6 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseTryStatement(
}
CatchInfo catch_info(this);
catch_info.for_promise_reject = allow_natives() && Check(Token::MOD);
if (peek() != Token::CATCH && peek() != Token::FINALLY) {
ReportMessage(MessageTemplate::kNoCatchOrFinally);
......
......@@ -1814,15 +1814,9 @@ Statement* Parser::RewriteTryStatement(Block* try_block, Block* catch_block,
DCHECK_NOT_NULL(catch_info.scope);
DCHECK_NOT_NULL(catch_info.variable);
TryCatchStatement* statement;
if (catch_info.for_promise_reject) {
statement = factory()->NewTryCatchStatementForPromiseReject(
try_block, catch_info.scope, catch_info.variable, catch_block,
kNoSourcePosition);
} else {
statement = factory()->NewTryCatchStatement(
try_block, catch_info.scope, catch_info.variable, catch_block,
kNoSourcePosition);
}
statement = factory()->NewTryCatchStatement(try_block, catch_info.scope,
catch_info.variable,
catch_block, kNoSourcePosition);
try_block = factory()->NewBlock(nullptr, 1, false, kNoSourcePosition);
try_block->statements()->Add(statement, zone());
......
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