From webcore to V8, V8 engine webcore

Source: Internet
Author: User

From webcore to V8, V8 engine webcore

I don't want to talk about V8 here. Please use Baidu. Since we have developed webkit by ourselves, subsequent V8 learning and research will be based on the combination of webkit and V8 (currently we have not studied blink, but simply changed the official JavaScriptCore engine of webkit to V8 ), not purely V8.

Here we will only introduce the webcore entry


Starting with the webcore js entry, there is a function in html lexical parsing:

Bool HTMLDocumentParser: canTakeNextToken (SynchronousMode mode, PumpSession & session)

This will determine whether to continue parsing, where:

// If we're paused waiting for a script, we try to execute scripts before continuing.
Bool shouldContinueParsing = runScriptsForPausedTreeBuilder ();

Here is the resolution entry. continue until a void ScriptElement: executeScript (const ScriptSourceCode & sourceCode) function of the dom module.

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

Now, the comments have been clearly written. From here, we will leave webcore to prepare for entering the js engine.

Frame-> script ()-> evaluate (sourceCode); call the scriptcontroler of the binding module to enter the binding module, the binding module JSC has a lot of similarities with V8. Next, I will analyze the binding module of v8.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.