Here do not want to say what is V8, please own Baidu. Their own webkit, so after the V8 study is based on the combination of WebKit and V8 (currently no research blink, just webkit the official JavaScriptCore engine for V8), not pure V8.
Only the entrance from WebCore is introduced here.
First from the WebCore JS Portal, in the HTML lexical parsing, there is a function:
BOOL Htmldocumentparser::cantakenexttoken (SynchronousMode mode, pumpsession& session)
This will determine whether the current parsing continues, and where:
If we ' re paused waiting for a script, we try to execute scripts before continuing.
BOOL shouldcontinueparsing = Runscriptsforpausedtreebuilder ();
Here is the parse entry, which goes on until a void Scriptelement::executescript (const scriptsourcecode& sourcecode) of the DOM module is
void Scriptelement::executescript (const scriptsourcecode& sourcecode)
{
ASSERT (m_alreadystarted);
if (Sourcecode.isempty ())
Return
if (!m_isexternalscript &&!m_element->document ()->contentsecuritypolicy ()->allowinlinescript ())
Return
refptr<document> Document = M_element->document ();
ASSERT (document);
if (frame* Frame = Document->frame ()) {
{
Ignoredestructivewritecountincrementer Ignoredesctructivewritecountincrementer (M_isExternalScript document.get ( ): 0);
Create a script from the script element node, using the script
Block ' s source and the script block ' s type.
Note:this is where the script is compiled and actually executed.
Frame->script ()->evaluate (sourcecode);
}
Document::updatestyleforalldocuments ();
}
}
See, the note has been written very clearly, from here to leave WebCore ready to enter the JS engine
Frame->script ()->evaluate (sourcecode), which calls the script controller Scriptcontroler of the binding module and begins to enter the binding module, This binding module JSC and V8 in fact have a lot of similarities. The next chapter is devoted to analyzing the binding module of V8.
V8 engine from WebCore to V8