Changeset 88724 in webkit


Ignore:
Timestamp:
Jun 13, 2011 3:46:21 PM (13 years ago)
Author:
oliver@apple.com
Message:

2011-06-13 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

Fix llocp and lvalp names in the lexer to something more meaningful
https://bugs.webkit.org/show_bug.cgi?id=62605

A simple rename

  • parser/Lexer.cpp: (JSC::Lexer::parseIdentifier): (JSC::Lexer::parseString): (JSC::Lexer::lex):
  • parser/Lexer.h: (JSC::Lexer::lexExpectIdentifier):
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r88719 r88724  
     12011-06-13  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Fix llocp and lvalp names in the lexer to something more meaningful
     6        https://bugs.webkit.org/show_bug.cgi?id=62605
     7
     8        A simple rename
     9
     10        * parser/Lexer.cpp:
     11        (JSC::Lexer::parseIdentifier):
     12        (JSC::Lexer::parseString):
     13        (JSC::Lexer::lex):
     14        * parser/Lexer.h:
     15        (JSC::Lexer::lexExpectIdentifier):
     16
    1172011-06-13  Oliver Hunt  <oliver@apple.com>
    218
  • trunk/Source/JavaScriptCore/parser/Lexer.cpp

    r88719 r88724  
    406406}
    407407
    408 template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer::parseIdentifier(JSTokenData* lvalp, unsigned lexType)
     408template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer::parseIdentifier(JSTokenData* tokenData, unsigned lexType)
    409409{
    410410    const ptrdiff_t remaining = m_codeEnd - m_code;
    411411    if ((remaining >= maxTokenLength) && !(lexType & IgnoreReservedWords)) {
    412         JSTokenType keyword = parseKeyword<shouldCreateIdentifier>(lvalp);
     412        JSTokenType keyword = parseKeyword<shouldCreateIdentifier>(tokenData);
    413413        if (keyword != IDENT) {
    414             ASSERT((!shouldCreateIdentifier) || lvalp->ident);
     414            ASSERT((!shouldCreateIdentifier) || tokenData->ident);
    415415            return keyword;
    416416        }
     
    458458
    459459        ident = makeIdentifier(identifierStart, identifierLength);
    460         lvalp->ident = ident;
     460        tokenData->ident = ident;
    461461    } else
    462         lvalp->ident = 0;
     462        tokenData->ident = 0;
    463463
    464464    m_delimited = false;
     
    479479}
    480480
    481 template <bool shouldBuildStrings> ALWAYS_INLINE bool Lexer::parseString(JSTokenData* lvalp, bool strictMode)
     481template <bool shouldBuildStrings> ALWAYS_INLINE bool Lexer::parseString(JSTokenData* tokenData, bool strictMode)
    482482{
    483483    int stringQuoteCharacter = m_current;
     
    575575        m_buffer16.append(stringStart, currentCharacter() - stringStart);
    576576    if (shouldBuildStrings)
    577         lvalp->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size());
     577        tokenData->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size());
    578578    else
    579         lvalp->ident = 0;
     579        tokenData->ident = 0;
    580580
    581581    m_buffer16.resize(0);
     
    753753}
    754754
    755 JSTokenType Lexer::lex(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned lexType, bool strictMode)
     755JSTokenType Lexer::lex(JSTokenData* tokenData, JSTokenInfo* tokenInfo, unsigned lexType, bool strictMode)
    756756{
    757757    ASSERT(!m_error);
     
    10081008        break;
    10091009    case CharacterOpenBrace:
    1010         lvalp->intValue = currentOffset();
     1010        tokenData->intValue = currentOffset();
    10111011        shift();
    10121012        token = OPENBRACE;
    10131013        break;
    10141014    case CharacterCloseBrace:
    1015         lvalp->intValue = currentOffset();
     1015        tokenData->intValue = currentOffset();
    10161016        m_delimited = true;
    10171017        shift();
     
    10281028        shift();
    10291029        if ((m_current | 0x20) == 'x' && isASCIIHexDigit(peek(1))) {
    1030             parseHex(lvalp->doubleValue);
     1030            parseHex(tokenData->doubleValue);
    10311031            token = NUMBER;
    10321032        } else {
    10331033            record8('0');
    10341034            if (isASCIIOctalDigit(m_current)) {
    1035                 if (parseOctal(lvalp->doubleValue)) {
     1035                if (parseOctal(tokenData->doubleValue)) {
    10361036                    if (strictMode)
    10371037                        goto returnError;
     
    10431043    case CharacterNumber:
    10441044        if (LIKELY(token != NUMBER)) {
    1045             if (!parseDecimal(lvalp->doubleValue)) {
     1045            if (!parseDecimal(tokenData->doubleValue)) {
    10461046                if (m_current == '.') {
    10471047                    shift();
     
    10541054                // Null-terminate string for strtod.
    10551055                m_buffer8.append('\0');
    1056                 lvalp->doubleValue = WTF::strtod(m_buffer8.data(), 0);
     1056                tokenData->doubleValue = WTF::strtod(m_buffer8.data(), 0);
    10571057            }
    10581058            token = NUMBER;
     
    10671067    case CharacterQuote:
    10681068        if (lexType & DontBuildStrings) {
    1069             if (UNLIKELY(!parseString<false>(lvalp, strictMode)))
     1069            if (UNLIKELY(!parseString<false>(tokenData, strictMode)))
    10701070                goto returnError;
    10711071        } else {
    1072             if (UNLIKELY(!parseString<true>(lvalp, strictMode)))
     1072            if (UNLIKELY(!parseString<true>(tokenData, strictMode)))
    10731073                goto returnError;
    10741074        }
     
    10821082    case CharacterBackSlash:
    10831083        if (lexType & DontBuildKeywords)
    1084             token = parseIdentifier<false>(lvalp, lexType);
     1084            token = parseIdentifier<false>(tokenData, lexType);
    10851085        else
    1086             token = parseIdentifier<true>(lvalp, lexType);
     1086            token = parseIdentifier<true>(tokenData, lexType);
    10871087        break;
    10881088    case CharacterLineTerminator:
     
    11191119
    11201120returnToken:
    1121     llocp->line = m_lineNumber;
    1122     llocp->startOffset = startOffset;
    1123     llocp->endOffset = currentOffset();
     1121    tokenInfo->line = m_lineNumber;
     1122    tokenInfo->startOffset = startOffset;
     1123    tokenInfo->endOffset = currentOffset();
    11241124    m_lastToken = token;
    11251125    return token;
  • trunk/Source/JavaScriptCore/parser/Lexer.h

    r88719 r88724  
    5858            DontBuildKeywords = 4
    5959        };
    60         JSTokenType lex(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned, bool strictMode);
     60        JSTokenType lex(JSTokenData*, JSTokenInfo*, unsigned, bool strictMode);
    6161        bool nextTokenIsColon();
    6262        int lineNumber() const { return m_lineNumber; }
     
    9090        SourceProvider* sourceProvider() const { return m_source->provider(); }
    9191       
    92         JSTokenType lexExpectIdentifier(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned, bool strictMode);
     92        JSTokenType lexExpectIdentifier(JSTokenData*, JSTokenInfo*, unsigned, bool strictMode);
    9393       
    9494    private:
     
    120120        template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType parseKeyword(JSTokenData*);
    121121        template <bool shouldBuildIdentifiers> ALWAYS_INLINE JSTokenType parseIdentifier(JSTokenData*, unsigned);
    122         template <bool shouldBuildStrings> ALWAYS_INLINE bool parseString(JSTokenData* lvalp, bool strictMode);
     122        template <bool shouldBuildStrings> ALWAYS_INLINE bool parseString(JSTokenData*, bool strictMode);
    123123        ALWAYS_INLINE void parseHex(double& returnValue);
    124124        ALWAYS_INLINE bool parseOctal(double& returnValue);
     
    182182    }
    183183
    184     ALWAYS_INLINE JSTokenType Lexer::lexExpectIdentifier(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned lexType, bool strictMode)
     184    ALWAYS_INLINE JSTokenType Lexer::lexExpectIdentifier(JSTokenData* tokenData, JSTokenInfo* tokenInfo, unsigned lexType, bool strictMode)
    185185    {
    186186        ASSERT((lexType & IgnoreReservedWords));
     
    213213        // Create the identifier if needed
    214214        if (lexType & DontBuildKeywords)
    215             lvalp->ident = 0;
     215            tokenData->ident = 0;
    216216        else
    217             lvalp->ident = makeIdentifier(start, ptr - start);
    218         llocp->line = m_lineNumber;
    219         llocp->startOffset = start - m_codeStart;
    220         llocp->endOffset = currentOffset();
     217            tokenData->ident = makeIdentifier(start, ptr - start);
     218        tokenInfo->line = m_lineNumber;
     219        tokenInfo->startOffset = start - m_codeStart;
     220        tokenInfo->endOffset = currentOffset();
    221221        m_lastToken = IDENT;
    222222        return IDENT;
    223223       
    224224    slowCase:
    225         return lex(lvalp, llocp, lexType, strictMode);
     225        return lex(tokenData, tokenInfo, lexType, strictMode);
    226226    }
    227227
Note: See TracChangeset for help on using the changeset viewer.