[JSC] speed up parsing of async functions
authorcaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Nov 2016 08:58:05 +0000 (08:58 +0000)
committercaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Nov 2016 08:58:05 +0000 (08:58 +0000)
commitc4eeeddbd7ce06a82bc18c89113dee07f3a1fcbe
tree20c64e9a13ded2376a7160d9dc750144042a70ec
parent37c7a55631687414daf8625ded75016455c43b66
[JSC] speed up parsing of async functions
https://bugs.webkit.org/show_bug.cgi?id=164808

Reviewed by Yusuke Suzuki.

JSTests:

Add tests for line terminator following "async" keyword in async
function syntax.

* stress/async-await-syntax.js:
(shouldBe):

Source/JavaScriptCore:

Minor adjustments to Parser in order to mitigate slowdown with async
function parsing enabled:

  - Tokenize "async" as a keyword
  - Perform less branching in various areas of the Parser

* parser/Keywords.table:
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::parseStatement):
(JSC::Parser<LexerType>::maybeParseAsyncFunctionDeclarationStatement):
(JSC::Parser<LexerType>::parseClass):
(JSC::Parser<LexerType>::parseExportDeclaration):
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::createResolveAndUseVariable):
(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseMemberExpression):
(JSC::Parser<LexerType>::printUnexpectedTokenText):
* parser/Parser.h:
(JSC::isAnyContextualKeyword):
(JSC::isIdentifierOrAnyContextualKeyword):
(JSC::isSafeContextualKeyword):
(JSC::Parser::matchSpecIdentifier):
* parser/ParserTokens.h:
* runtime/CommonIdentifiers.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208933 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/async-await-syntax.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/parser/Keywords.table
Source/JavaScriptCore/parser/Parser.cpp
Source/JavaScriptCore/parser/Parser.h
Source/JavaScriptCore/parser/ParserTokens.h
Source/JavaScriptCore/runtime/CommonIdentifiers.h