Changeset 88724 in webkit
- Timestamp:
- Jun 13, 2011 3:46:21 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r88719 r88724 1 2011-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 1 17 2011-06-13 Oliver Hunt <oliver@apple.com> 2 18 -
trunk/Source/JavaScriptCore/parser/Lexer.cpp
r88719 r88724 406 406 } 407 407 408 template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer::parseIdentifier(JSTokenData* lvalp, unsigned lexType)408 template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer::parseIdentifier(JSTokenData* tokenData, unsigned lexType) 409 409 { 410 410 const ptrdiff_t remaining = m_codeEnd - m_code; 411 411 if ((remaining >= maxTokenLength) && !(lexType & IgnoreReservedWords)) { 412 JSTokenType keyword = parseKeyword<shouldCreateIdentifier>( lvalp);412 JSTokenType keyword = parseKeyword<shouldCreateIdentifier>(tokenData); 413 413 if (keyword != IDENT) { 414 ASSERT((!shouldCreateIdentifier) || lvalp->ident);414 ASSERT((!shouldCreateIdentifier) || tokenData->ident); 415 415 return keyword; 416 416 } … … 458 458 459 459 ident = makeIdentifier(identifierStart, identifierLength); 460 lvalp->ident = ident;460 tokenData->ident = ident; 461 461 } else 462 lvalp->ident = 0;462 tokenData->ident = 0; 463 463 464 464 m_delimited = false; … … 479 479 } 480 480 481 template <bool shouldBuildStrings> ALWAYS_INLINE bool Lexer::parseString(JSTokenData* lvalp, bool strictMode)481 template <bool shouldBuildStrings> ALWAYS_INLINE bool Lexer::parseString(JSTokenData* tokenData, bool strictMode) 482 482 { 483 483 int stringQuoteCharacter = m_current; … … 575 575 m_buffer16.append(stringStart, currentCharacter() - stringStart); 576 576 if (shouldBuildStrings) 577 lvalp->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size());577 tokenData->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size()); 578 578 else 579 lvalp->ident = 0;579 tokenData->ident = 0; 580 580 581 581 m_buffer16.resize(0); … … 753 753 } 754 754 755 JSTokenType Lexer::lex(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned lexType, bool strictMode)755 JSTokenType Lexer::lex(JSTokenData* tokenData, JSTokenInfo* tokenInfo, unsigned lexType, bool strictMode) 756 756 { 757 757 ASSERT(!m_error); … … 1008 1008 break; 1009 1009 case CharacterOpenBrace: 1010 lvalp->intValue = currentOffset();1010 tokenData->intValue = currentOffset(); 1011 1011 shift(); 1012 1012 token = OPENBRACE; 1013 1013 break; 1014 1014 case CharacterCloseBrace: 1015 lvalp->intValue = currentOffset();1015 tokenData->intValue = currentOffset(); 1016 1016 m_delimited = true; 1017 1017 shift(); … … 1028 1028 shift(); 1029 1029 if ((m_current | 0x20) == 'x' && isASCIIHexDigit(peek(1))) { 1030 parseHex( lvalp->doubleValue);1030 parseHex(tokenData->doubleValue); 1031 1031 token = NUMBER; 1032 1032 } else { 1033 1033 record8('0'); 1034 1034 if (isASCIIOctalDigit(m_current)) { 1035 if (parseOctal( lvalp->doubleValue)) {1035 if (parseOctal(tokenData->doubleValue)) { 1036 1036 if (strictMode) 1037 1037 goto returnError; … … 1043 1043 case CharacterNumber: 1044 1044 if (LIKELY(token != NUMBER)) { 1045 if (!parseDecimal( lvalp->doubleValue)) {1045 if (!parseDecimal(tokenData->doubleValue)) { 1046 1046 if (m_current == '.') { 1047 1047 shift(); … … 1054 1054 // Null-terminate string for strtod. 1055 1055 m_buffer8.append('\0'); 1056 lvalp->doubleValue = WTF::strtod(m_buffer8.data(), 0);1056 tokenData->doubleValue = WTF::strtod(m_buffer8.data(), 0); 1057 1057 } 1058 1058 token = NUMBER; … … 1067 1067 case CharacterQuote: 1068 1068 if (lexType & DontBuildStrings) { 1069 if (UNLIKELY(!parseString<false>( lvalp, strictMode)))1069 if (UNLIKELY(!parseString<false>(tokenData, strictMode))) 1070 1070 goto returnError; 1071 1071 } else { 1072 if (UNLIKELY(!parseString<true>( lvalp, strictMode)))1072 if (UNLIKELY(!parseString<true>(tokenData, strictMode))) 1073 1073 goto returnError; 1074 1074 } … … 1082 1082 case CharacterBackSlash: 1083 1083 if (lexType & DontBuildKeywords) 1084 token = parseIdentifier<false>( lvalp, lexType);1084 token = parseIdentifier<false>(tokenData, lexType); 1085 1085 else 1086 token = parseIdentifier<true>( lvalp, lexType);1086 token = parseIdentifier<true>(tokenData, lexType); 1087 1087 break; 1088 1088 case CharacterLineTerminator: … … 1119 1119 1120 1120 returnToken: 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(); 1124 1124 m_lastToken = token; 1125 1125 return token; -
trunk/Source/JavaScriptCore/parser/Lexer.h
r88719 r88724 58 58 DontBuildKeywords = 4 59 59 }; 60 JSTokenType lex(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned, bool strictMode);60 JSTokenType lex(JSTokenData*, JSTokenInfo*, unsigned, bool strictMode); 61 61 bool nextTokenIsColon(); 62 62 int lineNumber() const { return m_lineNumber; } … … 90 90 SourceProvider* sourceProvider() const { return m_source->provider(); } 91 91 92 JSTokenType lexExpectIdentifier(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned, bool strictMode);92 JSTokenType lexExpectIdentifier(JSTokenData*, JSTokenInfo*, unsigned, bool strictMode); 93 93 94 94 private: … … 120 120 template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType parseKeyword(JSTokenData*); 121 121 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); 123 123 ALWAYS_INLINE void parseHex(double& returnValue); 124 124 ALWAYS_INLINE bool parseOctal(double& returnValue); … … 182 182 } 183 183 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) 185 185 { 186 186 ASSERT((lexType & IgnoreReservedWords)); … … 213 213 // Create the identifier if needed 214 214 if (lexType & DontBuildKeywords) 215 lvalp->ident = 0;215 tokenData->ident = 0; 216 216 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(); 221 221 m_lastToken = IDENT; 222 222 return IDENT; 223 223 224 224 slowCase: 225 return lex( lvalp, llocp, lexType, strictMode);225 return lex(tokenData, tokenInfo, lexType, strictMode); 226 226 } 227 227
Note: See TracChangeset
for help on using the changeset viewer.