summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--JavaScriptCore/parser/Parser.cpp11
-rw-r--r--WebCore/css/CSSParser.cpp58
-rw-r--r--WebCore/css/CSSStyleSheet.cpp10
-rw-r--r--WebKit/android/TimeCounter.cpp1
-rw-r--r--WebKit/android/TimeCounter.h3
5 files changed, 72 insertions, 11 deletions
diff --git a/JavaScriptCore/parser/Parser.cpp b/JavaScriptCore/parser/Parser.cpp
index 886a513..6c22687 100644
--- a/JavaScriptCore/parser/Parser.cpp
+++ b/JavaScriptCore/parser/Parser.cpp
@@ -35,10 +35,18 @@ using std::auto_ptr;
extern int jscyyparse(void*);
#endif
+#ifdef ANDROID_INSTRUMENT
+#include "TimeCounter.h"
+#endif
+
namespace JSC {
void Parser::parse(JSGlobalData* globalData, int* errLine, UString* errMsg)
{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::JavaScriptParseTimeCounter);
+#endif
+
ASSERT(!m_sourceElements);
int defaultErrLine;
@@ -66,6 +74,9 @@ void Parser::parse(JSGlobalData* globalData, int* errLine, UString* errMsg)
*errMsg = "Parse error";
m_sourceElements.clear();
}
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::JavaScriptParseTimeCounter, __FUNCTION__);
+#endif
}
void Parser::reparseInPlace(JSGlobalData* globalData, FunctionBodyNode* functionBodyNode)
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index e420a5f..fc431b7 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -88,6 +88,10 @@ using namespace WTF;
#include "CSSPropertyNames.cpp"
#include "CSSValueKeywords.c"
+#ifdef ANDROID_INSTRUMENT
+#include "TimeCounter.h"
+#endif
+
namespace WebCore {
static bool equal(const CSSParserString& a, const char* b)
@@ -217,32 +221,53 @@ void CSSParser::setupParser(const char* prefix, const String& string, const char
void CSSParser::parseSheet(CSSStyleSheet* sheet, const String& string)
{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
+#endif
m_styleSheet = sheet;
m_defaultNamespace = starAtom; // Reset the default namespace.
setupParser("", string, "");
cssyyparse(this);
m_rule = 0;
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
+#endif
}
PassRefPtr<CSSRule> CSSParser::parseRule(CSSStyleSheet* sheet, const String& string)
{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
+#endif
m_styleSheet = sheet;
setupParser("@-webkit-rule{", string, "} ");
cssyyparse(this);
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
+#endif
return m_rule.release();
}
PassRefPtr<CSSRule> CSSParser::parseKeyframeRule(CSSStyleSheet *sheet, const String &string)
{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
+#endif
m_styleSheet = sheet;
setupParser("@-webkit-keyframe-rule{ ", string, "} ");
cssyyparse(this);
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
+#endif
return m_keyframe.release();
}
bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int id, const String& string, bool important)
{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
+#endif
ASSERT(!declaration->stylesheet() || declaration->stylesheet()->isCSSStyleSheet());
m_styleSheet = static_cast<CSSStyleSheet*>(declaration->stylesheet());
@@ -264,6 +289,9 @@ bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int id, cons
clearProperties();
}
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
+#endif
return ok;
}
@@ -294,6 +322,9 @@ bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict)
bool CSSParser::parseColor(CSSMutableStyleDeclaration* declaration, const String& string)
{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
+#endif
ASSERT(!declaration->stylesheet() || declaration->stylesheet()->isCSSStyleSheet());
m_styleSheet = static_cast<CSSStyleSheet*>(declaration->stylesheet());
@@ -301,11 +332,17 @@ bool CSSParser::parseColor(CSSMutableStyleDeclaration* declaration, const String
cssyyparse(this);
m_rule = 0;
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
+#endif
return (m_numParsedProperties && m_parsedProperties[0]->m_id == CSSPropertyColor);
}
void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorList& selectorList)
{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
+#endif
RefPtr<CSSStyleSheet> dummyStyleSheet = CSSStyleSheet::create(doc);
m_styleSheet = dummyStyleSheet.get();
@@ -316,10 +353,16 @@ void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorLi
cssyyparse(this);
m_selectorListForParseSelector = 0;
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
+#endif
}
bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string)
{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
+#endif
ASSERT(!declaration->stylesheet() || declaration->stylesheet()->isCSSStyleSheet());
m_styleSheet = static_cast<CSSStyleSheet*>(declaration->stylesheet());
@@ -336,6 +379,9 @@ bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const
clearProperties();
}
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
+#endif
return ok;
}
@@ -344,6 +390,9 @@ bool CSSParser::parseMediaQuery(MediaList* queries, const String& string)
if (string.isEmpty())
return true;
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
+#endif
m_mediaQuery = 0;
// can't use { because tokenizer state switches from mediaquery to initial state when it sees { token.
// instead insert one " " (which is WHITESPACE in CSSGrammar.y)
@@ -357,6 +406,9 @@ bool CSSParser::parseMediaQuery(MediaList* queries, const String& string)
m_mediaQuery = 0;
}
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
+#endif
return ok;
}
@@ -4643,6 +4695,9 @@ void CSSParser::clearVariables()
bool CSSParser::parseVariable(CSSVariablesDeclaration* declaration, const String& variableName, const String& variableValue)
{
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
+#endif
m_styleSheet = static_cast<CSSStyleSheet*>(declaration->stylesheet());
String nameValuePair = variableName + ": ";
@@ -4660,6 +4715,9 @@ bool CSSParser::parseVariable(CSSVariablesDeclaration* declaration, const String
clearVariables();
+#ifdef ANDROID_INSTRUMENT
+ android::TimeCounter::record(android::TimeCounter::CSSParseTimeCounter, __FUNCTION__);
+#endif
return ok;
}
diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp
index 2e9255b..47b2c81 100644
--- a/WebCore/css/CSSStyleSheet.cpp
+++ b/WebCore/css/CSSStyleSheet.cpp
@@ -31,10 +31,6 @@
#include "TextEncoding.h"
#include <wtf/Deque.h>
-#ifdef ANDROID_INSTRUMENT
-#include "TimeCounter.h"
-#endif
-
namespace WebCore {
CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const String& charset)
@@ -163,15 +159,9 @@ const AtomicString& CSSStyleSheet::determineNamespace(const AtomicString& prefix
bool CSSStyleSheet::parseString(const String &string, bool strict)
{
-#ifdef ANDROID_INSTRUMENT
- android::TimeCounter::start(android::TimeCounter::CSSTimeCounter);
-#endif
setStrictParsing(strict);
CSSParser p(strict);
p.parseSheet(this, string);
-#ifdef ANDROID_INSTRUMENT
- android::TimeCounter::record(android::TimeCounter::CSSTimeCounter, __FUNCTION__);
-#endif
return true;
}
diff --git a/WebKit/android/TimeCounter.cpp b/WebKit/android/TimeCounter.cpp
index 96fb180..b423441 100644
--- a/WebKit/android/TimeCounter.cpp
+++ b/WebKit/android/TimeCounter.cpp
@@ -66,6 +66,7 @@ uint32_t TimeCounter::sStartTime[TimeCounter::TotalTimeCounterCount];
static const char* timeCounterNames[] = {
"css parsing",
"javascript",
+ "javascript parsing",
"calculate style",
"Java callback (frame bridge)",
"parsing (may include calcStyle or Java callback)",
diff --git a/WebKit/android/TimeCounter.h b/WebKit/android/TimeCounter.h
index f15deef..054141b 100644
--- a/WebKit/android/TimeCounter.h
+++ b/WebKit/android/TimeCounter.h
@@ -42,8 +42,9 @@ class TimeCounter {
public:
enum Type {
// function base counters
- CSSTimeCounter,
+ CSSParseTimeCounter,
JavaScriptTimeCounter,
+ JavaScriptParseTimeCounter,
CalculateStyleTimeCounter,
JavaCallbackTimeCounter,
ParsingTimeCounter,