diff options
-rw-r--r-- | V8Binding/binding/v8_proxy.cpp | 42 | ||||
-rw-r--r-- | V8Binding/binding/v8_proxy.h | 10 | ||||
-rw-r--r-- | WebKit/android/TimeCounter.cpp | 2 | ||||
-rw-r--r-- | WebKit/android/TimeCounter.h | 2 |
4 files changed, 56 insertions, 0 deletions
diff --git a/V8Binding/binding/v8_proxy.cpp b/V8Binding/binding/v8_proxy.cpp index c68837d..2d5ee4c 100644 --- a/V8Binding/binding/v8_proxy.cpp +++ b/V8Binding/binding/v8_proxy.cpp @@ -57,6 +57,10 @@ #include "CString.h" +#ifdef ANDROID_INSTRUMENT +#include "TimeCounter.h" +#endif + namespace WebCore { // Static utility context. @@ -976,6 +980,18 @@ void V8Proxy::DisconnectEventListeners() v8::Handle<v8::Script> V8Proxy::CompileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine) +#ifdef ANDROID_INSTRUMENT +{ + android::TimeCounter::start(android::TimeCounter::JavaScriptParseTimeCounter); + v8::Handle<v8::Script> script = CompileScriptInternal(code, fileName, baseLine); + android::TimeCounter::record(android::TimeCounter::JavaScriptParseTimeCounter, __FUNCTION__); + return script; +} + +v8::Handle<v8::Script> V8Proxy::CompileScriptInternal(v8::Handle<v8::String> code, + const String& fileName, + int baseLine) +#endif { const uint16_t* fileNameString = FromWebCoreString(fileName); v8::Handle<v8::String> name = @@ -1095,6 +1111,17 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* n) v8::Local<v8::Value> V8Proxy::RunScript(v8::Handle<v8::Script> script, bool inline_code) +#ifdef ANDROID_INSTRUMENT +{ + android::TimeCounter::start(android::TimeCounter::JavaScriptExecuteTimeCounter); + v8::Local<v8::Value> result = RunScriptInternal(script, inline_code); + android::TimeCounter::record(android::TimeCounter::JavaScriptExecuteTimeCounter, __FUNCTION__); + return result; +} + +v8::Local<v8::Value> V8Proxy::RunScriptInternal(v8::Handle<v8::Script> script, + bool inline_code) +#endif { if (script.IsEmpty()) return v8::Local<v8::Value>(); @@ -1159,6 +1186,10 @@ v8::Local<v8::Value> V8Proxy::CallFunction(v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> args[]) { +#ifdef ANDROID_INSTRUMENT + android::TimeCounter::start(android::TimeCounter::JavaScriptExecuteTimeCounter); +#endif + // For now, we don't put any artificial limitations on the depth // of recursion that stems from calling functions. This is in // contrast to the script evaluations. @@ -1180,6 +1211,9 @@ v8::Local<v8::Value> V8Proxy::CallFunction(v8::Handle<v8::Function> function, if (v8::V8::IsDead()) HandleFatalErrorInV8(); +#ifdef ANDROID_INSTRUMENT + android::TimeCounter::record(android::TimeCounter::JavaScriptExecuteTimeCounter, __FUNCTION__); +#endif return result; } @@ -2168,6 +2202,10 @@ void V8Proxy::InitContextIfNeeded() if (!m_context.IsEmpty()) return; +#ifdef ANDROID_INSTRUMENT + android::TimeCounter::start(android::TimeCounter::JavaScriptInitTimeCounter); +#endif + // Create a handle scope for all local handles. v8::HandleScope handle_scope; @@ -2272,6 +2310,10 @@ void V8Proxy::InitContextIfNeeded() SetSecurityToken(); m_frame->loader()->dispatchWindowObjectAvailable(); + +#ifdef ANDROID_INSTRUMENT + android::TimeCounter::record(android::TimeCounter::JavaScriptInitTimeCounter, __FUNCTION__); +#endif } diff --git a/V8Binding/binding/v8_proxy.h b/V8Binding/binding/v8_proxy.h index 708f63d..08cf621 100644 --- a/V8Binding/binding/v8_proxy.h +++ b/V8Binding/binding/v8_proxy.h @@ -254,6 +254,11 @@ class V8Proxy { v8::Local<v8::Value> RunScript(v8::Handle<v8::Script> script, bool inline_code); +#ifdef ANDROID_INSTRUMENT + v8::Local<v8::Value> RunScriptInternal(v8::Handle<v8::Script> script, + bool inline_code); +#endif + // Call the function with the given receiver and arguments. v8::Local<v8::Value> CallFunction(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, @@ -359,6 +364,11 @@ class V8Proxy { static v8::Handle<v8::Script> CompileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine); +#ifdef ANDROID_INSTRUMENT + static v8::Handle<v8::Script> CompileScriptInternal(v8::Handle<v8::String> code, + const String& fileName, + int baseLine); +#endif #ifndef NDEBUG // Checks if a v8 value can be a DOM wrapper diff --git a/WebKit/android/TimeCounter.cpp b/WebKit/android/TimeCounter.cpp index a8de243..5f69cf6 100644 --- a/WebKit/android/TimeCounter.cpp +++ b/WebKit/android/TimeCounter.cpp @@ -68,7 +68,9 @@ uint32_t TimeCounter::sStartTime[TimeCounter::TotalTimeCounterCount]; static const char* timeCounterNames[] = { "css parsing", "javascript", + "javascript init", "javascript parsing", + "javascript execution", "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 054141b..c78d10f 100644 --- a/WebKit/android/TimeCounter.h +++ b/WebKit/android/TimeCounter.h @@ -44,7 +44,9 @@ public: // function base counters CSSParseTimeCounter, JavaScriptTimeCounter, + JavaScriptInitTimeCounter, JavaScriptParseTimeCounter, + JavaScriptExecuteTimeCounter, CalculateStyleTimeCounter, JavaCallbackTimeCounter, ParsingTimeCounter, |