Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (88723 => 88724)
--- trunk/Source/_javascript_Core/ChangeLog 2011-06-13 22:45:23 UTC (rev 88723)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-06-13 22:46:21 UTC (rev 88724)
@@ -2,6 +2,22 @@
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):
+
+2011-06-13 Oliver Hunt <[email protected]>
+
+ Reviewed by Gavin Barraclough.
+
Make it possible to inline the common case of identifier lexing
https://bugs.webkit.org/show_bug.cgi?id=62600
Modified: trunk/Source/_javascript_Core/parser/Lexer.cpp (88723 => 88724)
--- trunk/Source/_javascript_Core/parser/Lexer.cpp 2011-06-13 22:45:23 UTC (rev 88723)
+++ trunk/Source/_javascript_Core/parser/Lexer.cpp 2011-06-13 22:46:21 UTC (rev 88724)
@@ -405,13 +405,13 @@
record16(UChar(static_cast<unsigned short>(c)));
}
-template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer::parseIdentifier(JSTokenData* lvalp, unsigned lexType)
+template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer::parseIdentifier(JSTokenData* tokenData, unsigned lexType)
{
const ptrdiff_t remaining = m_codeEnd - m_code;
if ((remaining >= maxTokenLength) && !(lexType & IgnoreReservedWords)) {
- JSTokenType keyword = parseKeyword<shouldCreateIdentifier>(lvalp);
+ JSTokenType keyword = parseKeyword<shouldCreateIdentifier>(tokenData);
if (keyword != IDENT) {
- ASSERT((!shouldCreateIdentifier) || lvalp->ident);
+ ASSERT((!shouldCreateIdentifier) || tokenData->ident);
return keyword;
}
}
@@ -457,9 +457,9 @@
}
ident = makeIdentifier(identifierStart, identifierLength);
- lvalp->ident = ident;
+ tokenData->ident = ident;
} else
- lvalp->ident = 0;
+ tokenData->ident = 0;
m_delimited = false;
@@ -478,7 +478,7 @@
return IDENT;
}
-template <bool shouldBuildStrings> ALWAYS_INLINE bool Lexer::parseString(JSTokenData* lvalp, bool strictMode)
+template <bool shouldBuildStrings> ALWAYS_INLINE bool Lexer::parseString(JSTokenData* tokenData, bool strictMode)
{
int stringQuoteCharacter = m_current;
shift();
@@ -574,9 +574,9 @@
if (currentCharacter() != stringStart && shouldBuildStrings)
m_buffer16.append(stringStart, currentCharacter() - stringStart);
if (shouldBuildStrings)
- lvalp->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size());
+ tokenData->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size());
else
- lvalp->ident = 0;
+ tokenData->ident = 0;
m_buffer16.resize(0);
return true;
@@ -752,7 +752,7 @@
return code < m_codeEnd && *code == ':';
}
-JSTokenType Lexer::lex(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned lexType, bool strictMode)
+JSTokenType Lexer::lex(JSTokenData* tokenData, JSTokenInfo* tokenInfo, unsigned lexType, bool strictMode)
{
ASSERT(!m_error);
ASSERT(m_buffer8.isEmpty());
@@ -1007,12 +1007,12 @@
token = SEMICOLON;
break;
case CharacterOpenBrace:
- lvalp->intValue = currentOffset();
+ tokenData->intValue = currentOffset();
shift();
token = OPENBRACE;
break;
case CharacterCloseBrace:
- lvalp->intValue = currentOffset();
+ tokenData->intValue = currentOffset();
m_delimited = true;
shift();
token = CLOSEBRACE;
@@ -1027,12 +1027,12 @@
case CharacterZero:
shift();
if ((m_current | 0x20) == 'x' && isASCIIHexDigit(peek(1))) {
- parseHex(lvalp->doubleValue);
+ parseHex(tokenData->doubleValue);
token = NUMBER;
} else {
record8('0');
if (isASCIIOctalDigit(m_current)) {
- if (parseOctal(lvalp->doubleValue)) {
+ if (parseOctal(tokenData->doubleValue)) {
if (strictMode)
goto returnError;
token = NUMBER;
@@ -1042,7 +1042,7 @@
// Fall through into CharacterNumber
case CharacterNumber:
if (LIKELY(token != NUMBER)) {
- if (!parseDecimal(lvalp->doubleValue)) {
+ if (!parseDecimal(tokenData->doubleValue)) {
if (m_current == '.') {
shift();
inNumberAfterDecimalPoint:
@@ -1053,7 +1053,7 @@
goto returnError;
// Null-terminate string for strtod.
m_buffer8.append('\0');
- lvalp->doubleValue = WTF::strtod(m_buffer8.data(), 0);
+ tokenData->doubleValue = WTF::strtod(m_buffer8.data(), 0);
}
token = NUMBER;
}
@@ -1066,10 +1066,10 @@
break;
case CharacterQuote:
if (lexType & DontBuildStrings) {
- if (UNLIKELY(!parseString<false>(lvalp, strictMode)))
+ if (UNLIKELY(!parseString<false>(tokenData, strictMode)))
goto returnError;
} else {
- if (UNLIKELY(!parseString<true>(lvalp, strictMode)))
+ if (UNLIKELY(!parseString<true>(tokenData, strictMode)))
goto returnError;
}
shift();
@@ -1081,9 +1081,9 @@
// Fall through into CharacterBackSlash.
case CharacterBackSlash:
if (lexType & DontBuildKeywords)
- token = parseIdentifier<false>(lvalp, lexType);
+ token = parseIdentifier<false>(tokenData, lexType);
else
- token = parseIdentifier<true>(lvalp, lexType);
+ token = parseIdentifier<true>(tokenData, lexType);
break;
case CharacterLineTerminator:
ASSERT(isLineTerminator(m_current));
@@ -1118,9 +1118,9 @@
// Fall through into returnToken.
returnToken:
- llocp->line = m_lineNumber;
- llocp->startOffset = startOffset;
- llocp->endOffset = currentOffset();
+ tokenInfo->line = m_lineNumber;
+ tokenInfo->startOffset = startOffset;
+ tokenInfo->endOffset = currentOffset();
m_lastToken = token;
return token;
Modified: trunk/Source/_javascript_Core/parser/Lexer.h (88723 => 88724)
--- trunk/Source/_javascript_Core/parser/Lexer.h 2011-06-13 22:45:23 UTC (rev 88723)
+++ trunk/Source/_javascript_Core/parser/Lexer.h 2011-06-13 22:46:21 UTC (rev 88724)
@@ -57,7 +57,7 @@
DontBuildStrings = 2,
DontBuildKeywords = 4
};
- JSTokenType lex(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned, bool strictMode);
+ JSTokenType lex(JSTokenData*, JSTokenInfo*, unsigned, bool strictMode);
bool nextTokenIsColon();
int lineNumber() const { return m_lineNumber; }
void setLastLineNumber(int lastLineNumber) { m_lastLineNumber = lastLineNumber; }
@@ -89,7 +89,7 @@
SourceProvider* sourceProvider() const { return m_source->provider(); }
- JSTokenType lexExpectIdentifier(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned, bool strictMode);
+ JSTokenType lexExpectIdentifier(JSTokenData*, JSTokenInfo*, unsigned, bool strictMode);
private:
friend class JSGlobalData;
@@ -119,7 +119,7 @@
template <int shiftAmount, ShiftType shouldBoundsCheck> void internalShift();
template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType parseKeyword(JSTokenData*);
template <bool shouldBuildIdentifiers> ALWAYS_INLINE JSTokenType parseIdentifier(JSTokenData*, unsigned);
- template <bool shouldBuildStrings> ALWAYS_INLINE bool parseString(JSTokenData* lvalp, bool strictMode);
+ template <bool shouldBuildStrings> ALWAYS_INLINE bool parseString(JSTokenData*, bool strictMode);
ALWAYS_INLINE void parseHex(double& returnValue);
ALWAYS_INLINE bool parseOctal(double& returnValue);
ALWAYS_INLINE bool parseDecimal(double& returnValue);
@@ -181,7 +181,7 @@
return &m_arena->makeIdentifier(m_globalData, characters, length);
}
- ALWAYS_INLINE JSTokenType Lexer::lexExpectIdentifier(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned lexType, bool strictMode)
+ ALWAYS_INLINE JSTokenType Lexer::lexExpectIdentifier(JSTokenData* tokenData, JSTokenInfo* tokenInfo, unsigned lexType, bool strictMode)
{
ASSERT((lexType & IgnoreReservedWords));
const UChar* start = m_code;
@@ -212,17 +212,17 @@
// Create the identifier if needed
if (lexType & DontBuildKeywords)
- lvalp->ident = 0;
+ tokenData->ident = 0;
else
- lvalp->ident = makeIdentifier(start, ptr - start);
- llocp->line = m_lineNumber;
- llocp->startOffset = start - m_codeStart;
- llocp->endOffset = currentOffset();
+ tokenData->ident = makeIdentifier(start, ptr - start);
+ tokenInfo->line = m_lineNumber;
+ tokenInfo->startOffset = start - m_codeStart;
+ tokenInfo->endOffset = currentOffset();
m_lastToken = IDENT;
return IDENT;
slowCase:
- return lex(lvalp, llocp, lexType, strictMode);
+ return lex(tokenData, tokenInfo, lexType, strictMode);
}
} // namespace JSC