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()  

沒有留言:

張貼留言