JS engine simple to understand __JS

Source: Internet
Author: User

The JavaScript engine consists of the following parts:

First, the compiler. The main task is to compile the source code into an abstract syntax tree, and then, in some engines, to convert the abstract syntax tree into bytecode.

Second, the interpreter. In some engines, the interpreter mainly accepts bytecode, interprets execution of the bytecode, and then relies on the recovery mechanism.

Third, JIT tools. A tool that can JIT to convert bytecode or abstract syntax tree to cost code, of course it also needs to rely on remembering

Four, garbage collector and Analysis tool (Profiler). They are responsible for garbage collection and collection of information in the engine to help improve engine performance and effectiveness.

CEF3 is based on the chromium kernel, the JS engine used is V8. Google, for performance, directly eliminates the step of converting bytecode, and even uses JavaScript to compile cost-coded code directly. The V8 API not only provides the ability to compile and run JavaScript code, but also provides other functions that interact with C + +, including registration of functions and data structures, error handling, security checks, and so on. C + + applications can use V8 as a common class library, simply by referencing V8.h.

The context of V8 is a standalone JavaScript execution environment that allows JavaScript applications to run on different V8 instances by using contexts. Executing a section of JavaScript code must display the specified context. This is because JavaScript provides a series of built-in auxiliary functions and global objects that can be invoked and modified by JavaScript code. If two unrelated JavaScript code modifies the global object at the same time, it may result in the user not wanting to see the results. According to the V8 specification, the execution JavaScript function must be within the context, so before invoking the executefunction we must enter the context, which must be exited after execution. This feature is provided by Cefv8context, and the most important members are enter, Exist, eval, and so on.

Resources:

Understanding WebKit and Chromium:javascript engine introduction

http://blog.csdn.net/milado_nju/article/details/22101681

Chromium/content v8::extension

Https://github.com/fanfeilong/cefutil/blob/master/doc/content_register_v8_extension.md


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.