Changeset 88724 in webkit for trunk/Source/JavaScriptCore/parser/Lexer.cpp
- Timestamp:
- Jun 13, 2011, 3:46:21 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.