Skip to content

Commit cb09ed2

Browse files
committed
2011-06-03 Oliver Hunt <oliver@apple.com>
Reviewed by Gavin Barraclough. GCC not inlining some functions that it really should be https://bugs.webkit.org/show_bug.cgi?id=62075 Add ALWAYS_INLINE to a number of parsing and lexing functions that should always be inlined. This gets us ~1.4% on my ad hoc parser test. * KeywordLookupGenerator.py: * parser/JSParser.cpp: (JSC::JSParser::next): (JSC::JSParser::nextTokenIsColon): (JSC::JSParser::consume): (JSC::JSParser::match): (JSC::JSParser::tokenStart): (JSC::JSParser::tokenLine): (JSC::JSParser::tokenEnd): * parser/Lexer.cpp: (JSC::isIdentPart): Canonical link: https://commits.webkit.org/77537@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88083 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 8db9c2a commit cb09ed2

4 files changed

Lines changed: 32 additions & 9 deletions

File tree

Source/JavaScriptCore/ChangeLog

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
2011-06-03 Oliver Hunt <oliver@apple.com>
2+
3+
Reviewed by Gavin Barraclough.
4+
5+
GCC not inlining some functions that it really should be
6+
https://bugs.webkit.org/show_bug.cgi?id=62075
7+
8+
Add ALWAYS_INLINE to a number of parsing and lexing functions
9+
that should always be inlined. This gets us ~1.4% on my ad hoc
10+
parser test.
11+
12+
* KeywordLookupGenerator.py:
13+
* parser/JSParser.cpp:
14+
(JSC::JSParser::next):
15+
(JSC::JSParser::nextTokenIsColon):
16+
(JSC::JSParser::consume):
17+
(JSC::JSParser::match):
18+
(JSC::JSParser::tokenStart):
19+
(JSC::JSParser::tokenLine):
20+
(JSC::JSParser::tokenEnd):
21+
* parser/Lexer.cpp:
22+
(JSC::isIdentPart):
23+
124
2011-06-03 Oliver Hunt <oliver@apple.com>
225

326
Whoops, fix last minute bug.

Source/JavaScriptCore/KeywordLookupGenerator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def maxLength(self):
163163

164164
def printAsC(self):
165165
print("namespace JSC {")
166-
print("static inline bool isIdentPart(int c);")
166+
print("static ALWAYS_INLINE bool isIdentPart(int c);")
167167
# max length + 1 so we don't need to do any bounds checking at all
168168
print("static const int maxTokenLength = %d;" % (self.maxLength() + 1))
169169
print("ALWAYS_INLINE JSTokenType Lexer::parseKeyword() {")

Source/JavaScriptCore/parser/JSParser.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,43 +99,43 @@ class JSParser {
9999
bool m_isLoop;
100100
};
101101

102-
void next(unsigned lexType = 0)
102+
ALWAYS_INLINE void next(unsigned lexType = 0)
103103
{
104104
m_lastLine = m_token.m_info.line;
105105
m_lastTokenEnd = m_token.m_info.endOffset;
106106
m_lexer->setLastLineNumber(m_lastLine);
107107
m_token.m_type = m_lexer->lex(&m_token.m_data, &m_token.m_info, lexType, strictMode());
108108
}
109109

110-
bool nextTokenIsColon()
110+
ALWAYS_INLINE bool nextTokenIsColon()
111111
{
112112
return m_lexer->nextTokenIsColon();
113113
}
114114

115-
bool consume(JSTokenType expected, unsigned flags = 0)
115+
ALWAYS_INLINE bool consume(JSTokenType expected, unsigned flags = 0)
116116
{
117117
bool result = m_token.m_type == expected;
118118
failIfFalse(result);
119119
next(flags);
120120
return result;
121121
}
122122

123-
bool match(JSTokenType expected)
123+
ALWAYS_INLINE bool match(JSTokenType expected)
124124
{
125125
return m_token.m_type == expected;
126126
}
127127

128-
int tokenStart()
128+
ALWAYS_INLINE int tokenStart()
129129
{
130130
return m_token.m_info.startOffset;
131131
}
132132

133-
int tokenLine()
133+
ALWAYS_INLINE int tokenLine()
134134
{
135135
return m_token.m_info.line;
136136
}
137137

138-
int tokenEnd()
138+
ALWAYS_INLINE int tokenEnd()
139139
{
140140
return m_token.m_info.endOffset;
141141
}

Source/JavaScriptCore/parser/Lexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static NEVER_INLINE bool isNonASCIIIdentPart(int c)
357357
| Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector);
358358
}
359359

360-
static inline bool isIdentPart(int c)
360+
static ALWAYS_INLINE bool isIdentPart(int c)
361361
{
362362
// Character types are divided into two groups depending on whether they can be part of an
363363
// identifier or not. Those whose type value is less or equal than CharacterNumber can be

0 commit comments

Comments
 (0)