[webkit-changes] [WebKit/WebKit] f6ec77: Simplify / optimize JSC's LiteralParser

Chris Dumez noreply at github.com
Wed Apr 26 08:56:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f6ec77d6554e5282dd6a264cdc59ab4076baa9e9
      https://github.com/WebKit/WebKit/commit/f6ec77d6554e5282dd6a264cdc59ab4076baa9e9
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-04-26 (Wed, 26 Apr 2023)

  Changed paths:
    M Source/JavaScriptCore/runtime/LiteralParser.cpp
    M Source/JavaScriptCore/runtime/LiteralParser.h

  Log Message:
  -----------
  Simplify / optimize JSC's LiteralParser
https://bugs.webkit.org/show_bug.cgi?id=255928

Reviewed by Justin Michaud.

Simplify / optimize JSC's LiteralParser:
- Avoid storing the start/end pointers inside LiteralParserToken, as they are
  not actually needed. We already have a `stringStart + length` for strings/identifiers,
  which is all that's needed.
- Stop using LiteralParserToken::stringIs8Bit for identifiers. Unlike strings,
  identifiers always use the same character type as the LiteralParser. This also avoids
  some unnecessary branching.

This may be a small progression on Speedometer on M1.

* Source/JavaScriptCore/runtime/LiteralParser.cpp:
(JSC::LiteralParser<CharType>::tryJSONPParse):
(JSC::LiteralParser<CharType>::makeIdentifier):
(JSC::LiteralParser<CharType>::makeJSString):
(JSC::LiteralParser<CharType>::Lexer::lex):
(JSC::LiteralParser<LChar>::Lexer::lexIdentifier):
(JSC::LiteralParser<UChar>::Lexer::lexIdentifier):
(JSC::setParserTokenString<LChar>):
(JSC::setParserTokenString<UChar>):
(JSC::LiteralParser<CharType>::Lexer::lexString):
(JSC::LiteralParser<CharType>::Lexer::lexStringSlow):
(JSC::LiteralParser<CharType>::Lexer::lexNumber):
(JSC::LiteralParser<CharType>::parsePrimitiveValue):
* Source/JavaScriptCore/runtime/LiteralParser.h:

Canonical link: https://commits.webkit.org/263416@main




More information about the webkit-changes mailing list