V8 engine from WebCore to V8

Source: Internet
Author: User

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

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.