2013年12月22日 星期日

[Webkit] Function flow for javascript JIT execution.

Just a memo for myself to remark function flow of JIT execution.

HTMLTokenizer::scriptHandler                  // start from here to handle script

    HTMLTokenizer::scriptExecution

    ScriptController::executeScript

        Completion::evaluate

            Executable::complie               // Compile script

                 Parser::parse

            bytecodegenerator::generate       // generate byte code



            Interpreter::execute

                Executable::JITCode

                Executable::GenerateJITCode   // Compile and generateJITCode

                    JIT::Compile

                JITCode::execute              // execute JIT code

return to HTMLTokenizer::scriptHandler


Now, we generated some JIT code for basic execution demand and byte code objects for whole script.
Then, we have to compile byte code objects to JIT code for executing each function in script.

CallData::Call     // Get byte code object and compile to JIT code for each call

    Interpreter::executeCall

    JITCodeforCall::executable

        Executable::generateJITCodeforCall

    JIT::Compile

    JITCode::execute

return to CallData::Call

Call stack for reference:
JAVASCRIPTCORE!JSC::Interpreter::execute(JSC::ScopeChainNode * 0x077df768, JSC::JSObject * 0x00c60000, JSC::JSValue * 0x001cc8a0)  line 638
JAVASCRIPTCORE!JSC::evaluate(JSC::JSValue {...})  line 65
WEBKIT!WebCore::JSMainThreadExecState::evaluate(JSC::ExecState * 0x07791870, JSC::ScopeChain & {...}, const JSC::SourceCode & {...}, JSC::JSValue {...})  line 54 + 22 bytes
WEBKIT!WebCore::ScriptController::evaluateInWorld(const WebCore::ScriptSourceCode & {...}, WebCore::DOMWrapperWorld * 0x00000000, WebCore::ShouldAllowXSS 1887600)  line 147
WEBKIT!WebCore::ScriptController::evaluate(const WebCore::ScriptSourceCode & {...}, WebCore::ShouldAllowXSS DoNotAllowXSS)  line 172 + 26 bytes
WEBKIT!WebCore::ScriptController::executeScript(const WebCore::ScriptSourceCode & {...}, WebCore::ShouldAllowXSS AllowXSS)  line 62 + 22 bytes
WEBKIT!WebCore::HTMLTokenizer::scriptExecution(const WebCore::ScriptSourceCode & {...}, WebCore::HTMLTokenizer::State {...})  line 561 + 56 bytes
WEBKIT!WebCore::HTMLTokenizer::scriptHandler(WebCore::HTMLTokenizer::State {...})  line 508 + 230 bytes
WEBKIT!WebCore::HTMLTokenizer::parseNonHTMLText(WebCore::SegmentedString & {...}, WebCore::HTMLTokenizer::State {...})  line 351 + 18 bytes
WEBKIT!WebCore::HTMLTokenizer::advance(WebCore::HTMLTokenizer::State & {...})  line 1626 + 48 bytes
WEBKIT!WebCore::HTMLTokenizer::write(const WebCore::SegmentedString & {...}, bool true)  line 1784
WEBKIT!WebCore::DocumentWriter::addData(const char * 0x00000000, int 1124084960, bool true)  line 191 + 36 bytes
WEBKIT!WebCore::FrameLoader::addData(const char * 0x001cd4cc, int 8192)  line 1414
WEBKIT!WebFrameLoaderClient::receivedData(const char * 0x0752ebe0, int 123760368, const WebCore::String & {...})  line 601
WEBKIT!WebFrameLoaderClient::committedLoad(WebCore::DocumentLoader * 0x00762b80, const char * 0x001cd4cc, int 8192)  line 572
WEBKIT!WebCore::FrameLoader::committedLoad(WebCore::DocumentLoader * 0x00762b80, const char * 0x001cd4cc, int 8192)  line 3016
WEBKIT!WebCore::DocumentLoader::commitLoad(const char * 0x077df768, int 125376624)  line 281
WEBKIT!WebCore::DocumentLoader::receivedData(const char * 0x001cd4cc, int 8192)  line 293
WEBKIT!WebCore::FrameLoader::receivedData(const char * 0x001cd4cc, int 8192)  line 1839
WEBKIT!WebCore::MainResourceLoader::addData(const char * 0x001cd4cc, int 8192, bool false)  line 148
WEBKIT!WebCore::ResourceLoader::didReceiveData(const char * 0x0077e800, int 1125760212, __int64 8101893163188217, bool true)  line 264
WEBKIT!WebCore::MainResourceLoader::didReceiveData(const char * 0xfffffff9, int 1886368, __int64 8101923229845812, bool true)  line 410
WEBKIT!WebCore::ResourceLoader::didReceiveData(WebCore::ResourceHandle * 0x07777b20, const char * 0x001cd4cc, int 8192, int 0)  line 438
WEBKIT!WebCore::ResourceHandle::onRequestComplete(long 1869182051)  line 1550
WEBKIT!WebCore::ResourceJobManager::ResourceHandleWndProc(HWND__ * 0xfe070002, unsigned int 1026, unsigned int 4, long 0)  line 296
WEBKIT!WebCore::CustomEventVictoria::DoAction(NEventHandler * 0x000aa54c)  line 47
NEVENTBASELIB!41113ef6()
NEVENTBASELIB!41114082()
BROWSER!Browser::Run()  line 81
BROWSER!WinMain()  line 23
BROWSER!WinMainCRTStartupHelper()  line 71 + 14 bytes
BROWSER!WinMainCRTStartup()  line 105
COREDLL!MainThreadBaseFunc(HINSTANCE__ * 0x00000000, HINSTANCE__ * 0x00000000)  line 1209 + 54 bytes
fffffdff()
JavaScriptCore.dll!JSC::Interpreter::executeCall(JSC::ExecState * callFrame=0x0c0d1b90, JSC::JSObject * function=0x033ea340, JSC::CallType callType=CallTypeJS, const JSC::CallData & callData={...}, JSC::JSValue thisValue={...}, const JSC::ArgList & args={...}, JSC::JSValue * exception=0x058c4eb8)  Line 738 C++
JavaScriptCore.dll!JSC::call(JSC::ExecState * exec=0x0c0d1b90, JSC::JSValue functionObject={...}, JSC::CallType callType=CallTypeJS, const JSC::CallData & callData={...}, JSC::JSValue thisValue={...}, const JSC::ArgList & args={...})  Line 38 + 0x3b bytes C++
WebKit.dll!WebCore::JSMainThreadExecState::call(JSC::ExecState * exec=0x0c0d1b90, JSC::JSValue functionObject={...}, JSC::CallType callType=CallTypeJS, const JSC::CallData & callData={...}, JSC::JSValue thisValue={...}, const JSC::ArgList & args={...})  Line 48 + 0x20 bytes C++
WebKit.dll!WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext * scriptExecutionContext=0x0b118518, WebCore::Event * event=0x0c565500)  Line 124 + 0x5f bytes C++
WebKit.dll!WebCore::EventTarget::fireEventListeners(WebCore::Event * event=0x0c565500, WebCore::EventTargetData * d=0x0c55007c, WTF::Vector & entry={...})  Line 330 C++
WebKit.dll!WebCore::EventTarget::fireEventListeners(WebCore::Event * event=0x0c565500)  Line 295 C++
WebKit.dll!WebCore::EventTarget::dispatchEvent(WTF::PassRefPtr event={...})  Line 276 + 0x11 bytes C++
WebKit.dll!WebCore::XMLHttpRequestProgressEventThrottle::dispatchEvent(WTF::PassRefPtr event={...}, WebCore::ProgressEventAction progressEventAction=DoNotFlushProgressEvent)  Line 82 C++
WebKit.dll!WebCore::XMLHttpRequest::callReadyStateChangeListener()  Line 287 + 0x53 bytes C++
WebKit.dll!WebCore::XMLHttpRequest::didReceiveData(const char * data=0x0025d914, int len=8192)  Line 987 C++
WebKit.dll!WebCore::DocumentThreadableLoader::didReceiveData(WebCore::SubresourceLoader * loader=0x0c5589a0, const char * data=0x0025d914, int lengthReceived=8192)  Line 226 C++
WebKit.dll!WebCore::SubresourceLoader::didReceiveData(const char * data=0x0025d914, int length=8192, __int64 lengthReceived=0, bool allAtOnce=false)  Line 177 C++
WebKit.dll!WebCore::ResourceLoader::didReceiveData(WebCore::ResourceHandle * __formal=0x0c55f8b8, const char * data=0x0025d914, int length=8192, int lengthReceived=0)  Line 439 C++
WebKit.dll!WebCore::ResourceHandle::onRequestComplete(long lParam=0)  Line 1389 C++
WebKit.dll!WebCore::ResourceJobManager::ResourceHandleWndProc(HWND__ * hWnd=0x00151be8, unsigned int message=1026, unsigned int wParam=5, long lParam=0)  Line 273 C++
WebKit.dll!WebCore::CustomEventVictoria::DoAction(NEventHandler * pEventHandler=0x009b0e20)  Line 47 C++
NEventBaseLib.dll!0f347382()  
[Frames below may be incorrect and/or missing, no symbols loaded for NEventBaseLib.dll] 
NEventBaseLib.dll!0f346ffc()  
Browser.exe!Browser::Run()  Line 80 + 0xe bytes C++
Browser.exe!WinMain(HINSTANCE__ * hInstance=0x00880000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x003d3605, int nCmdShow=1)  Line 17 + 0xc bytes C++
Browser.exe!__tmainCRTStartup()  Line 578 + 0x35 bytes C
Browser.exe!WinMainCRTStartup()  Line 403 C
kernel32.dll!757f1154()  
ntdll.dll!773ab299()  
ntdll.dll!773ab26c()  

2013年12月12日 星期四

[Webkit] Callstack for RenderObject::setStyle

Webkit development offen happen to layout issue, I just remark where to set object style here.

WEBKIT!WebCore::RenderObject::setStyle(WTF::PassRefPtr<WebCore::RenderStyle> * 0x0010d430 {m_ptr=0x004eb898 {m_affectedByAttributeSelectors=false m_unique=false m_affectedByEmpty=false ...} })  line 1523
WEBKIT!WebCore::Document::recalcStyle(WebCore::Node::StyleChange 0x00512c80)  line 1377
WEBKIT!WebCore::Document::attach()  line 1527
WEBKIT!WebCore::Frame::setDocument(WTF::PassRefPtr<WebCore::Document> * ...)  line 273
WEBKIT!WebCore::DocumentWriter::begin(const WebCore::KURL & {m_string={m_impl={m_ptr=0x00000000 {s_copyCharsInlineCutOff=??? m_data=??? m_buffer=??? ...} } } m_isValid=true m_protocolInHTTPFamily=false ...}, bool true, WebCore::SecurityOrigin * ...)  line 115
WEBKIT!WebCore::FrameLoader::receivedFirstData()  line 784
WEBKIT!WebCore::FrameLoader::willSetEncoding()  line 1406
WEBKIT!WebCore::DocumentWriter::setEncoding(const WebCore::String & {m_impl={m_ptr=0x00000000 {s_copyCharsInlineCutOff=??? m_data=??? m_buffer=??? ...} } }, bool false)  line 243
WEBKIT!WebFrameLoaderClient::receivedData()  line 595
WEBKIT!WebFrameLoaderClient::committedLoad()  line 567
WEBKIT!WebCore::FrameLoader::committedLoad(WebCore::DocumentLoader * 0x00523600 {m_dataSource=0x06cb4400 {m_refCount=0x00000001 m_loader={m_ptr=0x00523600 {m_dataSource=0x06cb4400 m_detachedDataSource=0x00000000 } } m_representation={m_ptr=0x00000000 } } m_detachedDataSource=0x00000000 {m_refCount=??? m_loader={m_ptr=??? } m_representation={m_ptr=??? } } }, const char * ...)  line
WEBKIT!WebCore::DocumentLoader::commitLoad(const char * 0x00000000 <Bad Ptr>, int 0x004ef200)  line 281
WEBKIT!WebCore::DocumentLoader::receivedData(const char * ...)  line 293
WEBKIT!WebCore::FrameLoader::receivedData(const char * ...)  line 1839
WEBKIT!WebCore::MainResourceLoader::addData(const char * ...)  line 148
WEBKIT!WebCore::ResourceLoader::didReceiveData(const char * 0x00000000 <Bad Ptr>, int 0x005897e0, __int64 0x4180000000000000, bool true)  line 264
WEBKIT!WebCore::MainResourceLoader::didReceiveData(const char * 0x00000000 <Bad Ptr>, int 0x41800000, __int64 0x00512c980058d7d0, bool true)  line 410
WEBKIT!WebCore::ResourceLoader::didReceiveData(WebCore::ResourceHandle * 0x004e15c0 {m_dumpedFileHandle=0x00000000 d={m_ptr=0x00581800 {m_client=0x004f4000 {m_initialRequest={...} m_substituteData={...} m_dataLoadTimer={...} ...} m_request={m_type=RequestMain } m_lastHTTPMethod={m_impl={...} } ...} } }, const char * ...)  line 438
WEBKIT!WebCore::ResourceHandle::loadFile()  line 1938
WEBKIT!WebCore::ResourceHandle::fileLoadTimer(WebCore::Timer<WebCore::ResourceHandle> * 0x0010d003 {m_object=0xec2d7000 {m_dumpedFileHandle=??? d={m_ptr=??? } } m_function=0xec2d7e00 })  line 2086
WEBKIT!WebCore::Timer<WebCore::Document>::fired()  line 113 + 26 bytes
WEBKIT!WebCore::ThreadTimers::sharedTimerFiredInternal()  line 115
WEBKIT!WebCore::ThreadTimers::sharedTimerFired()  line 91
WEBKIT!WebCore::Victoria_Shared_Timer::OnTimer()  line 87
NSTANDARDLIB!40de3538()
NEVENTBASELIB!41033f98()
NEVENTBASELIB!41034078()
BROWSER!Browser::Run()  line 81
BROWSER!WinMain()  line 23
BROWSER!WinMainCRTStartupHelper()  line 71 + 14 bytes
BROWSER!WinMainCRTStartup()  line 105
COREDLL!MainThreadBaseFunc(HINSTANCE__ * 0x00000000 {unused=??? }, HINSTANCE__ * 0x00000000 {unused=??? })  line 1209 + 54 bytes
fffffdff()

2013年12月2日 星期一

[Webkit] Callstack for handle string event to append text to HtmlInputElement.

Memo for handle string event.

It would be useful if you like to know the function flow to append text to HtmlInputElement.

WEBKIT!WebCore::TypingCommand::insertTextRunWithoutNewlines(const WTF::String & {...}, bool false)  line 369
WEBKIT!WebCore::TypingCommandLineOperation::operator()(unsigned int 0, unsigned int 1, bool true)  line 63 + 68 bytes
WEBKIT!WebCore::forEachLineInString<WebCore::TypingCommandLineOperation>(const WTF::String & {...}, const WebCore::TypingCommandLineOperation & {...})  line 62
WEBKIT!WebCore::TypingCommand::insertText(const WTF::String & {...}, bool false)  line 360
WEBKIT!WebCore::TypingCommand::insertText(WebCore::Document * 0x0c71f800, const WTF::String & {...}, const WebCore::VisibleSelection & {...}, unsigned int 0, WebCore::TypingCommand::TextCompositionType TextCompositionNone)  line 194
WEBKIT!WebCore::Editor::insertTextWithoutSendingTextEvent(const WTF::String & {...}, bool false, WebCore::TextEvent * 0x0062b420)  line 944
WEBKIT!WebCore::Editor::handleTextEvent(WebCore::TextEvent * 0x0062b420)  line 181 + 20 bytes
WEBKIT!WebCore::EventHandler::defaultTextInputEventHandler(WebCore::TextEvent * 0x0062b420)  line 3501 + 20 bytes
WEBKIT!WebCore::Node::defaultEventHandler(WebCore::Event * 0x0062b420)  line 2760
WEBKIT!WebCore::HTMLTextFormControlElement::defaultEventHandler(WebCore::Event * 0x0062b420)  line 106
WEBKIT!WebCore::HTMLInputElement::defaultEventHandler(WebCore::Event * 0x0062b420)  line 1249
WEBKIT!WebCore::EventDispatcher::dispatchEventPostProcess(WTF::PassRefPtr<WebCore::Event> * 0x0015e4bc, void * 0x00000000)  line 350
WEBKIT!WebCore::EventDispatcher::dispatchEvent(WTF::PassRefPtr<WebCore::Event> * 0x0015e784)  line 267
WEBKIT!WebCore::EventDispatchMediator::dispatchEvent(WebCore::EventDispatcher * 0x0015e7b4)  line 52 + 108 bytes
WEBKIT!WebCore::EventDispatcher::dispatchEvent(WebCore::Node * 0x0063e140, WTF::PassRefPtr<WebCore::EventDispatchMediator> * 0x0015e828)  line 129 + 52 bytes
WEBKIT!WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event> * 0x0015e874)  line 2577 + 96 bytes
WEBKIT!WebCore::EventTarget::dispatchEvent(WTF::PassRefPtr<WebCore::Event> * 0x0015e934, int & 6831584)  line 143 + 84 bytes
WEBKIT!WebCore::EventHandler::handleTextInputEvent(const WTF::String & {...}, WebCore::Event * 0x0c70a0b0, WebCore::TextEventInputType TextEventInputKeyboard)  line 3467
WEBKIT!WebCore::Editor::insertText(const WTF::String & {...}, WebCore::Event * 0x0c70a0b0)  line 885 + 36 bytes
WEBKIT!WebView::handleEditingKeyboardEvent(WebCore::KeyboardEvent * 0x0c70a0b0)  line 3246 + 116 bytes
WEBKIT!WebEditorClient::handleKeyboardEvent(WebCore::KeyboardEvent * 0x0c70a0b0)  line 636 + 20 bytes
WEBKIT!WebCore::Editor::handleKeyboardEvent(WebCore::KeyboardEvent * 0x0c70a0b0)  line 151
WEBKIT!WebCore::EventHandler::defaultKeyboardEventHandler(WebCore::KeyboardEvent * 0x0c70a0b0)  line 3200
WEBKIT!WebCore::Node::defaultEventHandler(WebCore::Event * 0x0c70a0b0)  line 2745
WEBKIT!WebCore::HTMLTextFormControlElement::defaultEventHandler(WebCore::Event * 0x0c70a0b0)  line 106
WEBKIT!WebCore::HTMLInputElement::defaultEventHandler(WebCore::Event * 0x0c70a0b0)  line 1189
WEBKIT!WebCore::EventDispatcher::dispatchEventPostProcess(WTF::PassRefPtr<WebCore::Event> * 0x0015f36c, void * 0x00000000)  line 350
WEBKIT!WebCore::EventDispatcher::dispatchEvent(WTF::PassRefPtr<WebCore::Event> * 0x0015f634)  line 267
WEBKIT!WebCore::EventDispatchMediator::dispatchEvent(WebCore::EventDispatcher * 0x0015f690)  line 52 + 108 bytes
WEBKIT!WebCore::KeyboardEventDispatchMediator::dispatchEvent(WebCore::EventDispatcher * 0x0015f690)  line 222 + 12 bytes
WEBKIT!WebCore::EventDispatcher::dispatchEvent(WebCore::Node * 0x0063e140, WTF::PassRefPtr<WebCore::EventDispatchMediator> * 0x0015f704)  line 129 + 52 bytes
WEBKIT!WebCore::Node::dispatchKeyEvent(const WebCore::PlatformKeyboardEvent & {...})  line 2618 + 188 bytes
WEBKIT!WebCore::EventHandler::keyEvent(const WebCore::PlatformKeyboardEvent & {...})  line 3049 + 12 bytes
WEBKIT!WebView::keyPress(unsigned int 71, long 0, bool false)  line 3525 + 20 bytes
WEBKIT!WebView::handleStrEvent(wchar_t * 0x005005d8)  line 3402 + 44 bytes
BROWSER!CoreService::OnPressTenKey2()  line 904
BROWSER!EBSS_fBrowser__onPressTenKey2()  line 106
UICOMMONLIB!40f683f0()
NEVENTBASELIB!40d63f10()
NEVENTBASELIB!40d64530()
BROWSER!Browser::Run()  line 81
BROWSER!WinMain()  line 17 + 8 bytes
BROWSER!WinMainCRTStartupHelper(HINSTANCE__ * 0xfffffffd, HINSTANCE__ * 0x00000005, unsigned short * 0xf101f798, int 1)  line 71 + 20 bytes
COREDLL!MainThreadBaseFunc(void * 0x00000000, const wchar_t * 0x00000000, const wchar_t * 0x00000000, HINSTANCE__ * 0x00000000, HINSTANCE__ * 0x00000000, HINSTANCE__ * 0x00000000)  line 1209 + 88 bytes
f101fffc()