V8 parts:

  1. Gradually replacing crankshafts with TurboFan, just-in-time builds, TurboFan optimizations were more complex, more thorough, and a layered architecture made it easier to write more efficient unit tests as optimizations and features were implemented later.
  2. V8’s use of just-in-time compilation to execute code means that it needs to be parsed and compiled before it can be executed, which can lead to considerable overhead. When Chrome sees the same script within two days, it produces the script cache data, attaches the cache data to the source object, and can be retrieved and persisted (stored to hard disk). When the script is subsequently compiled, it deserializes the code from the cache data, which is about twice as fast.
  3. Garbage collection. Many engines, including V8, dynamically allocate memory for running applications and then clean up after confirming that the data is not being used. The garbage collection mechanism is divided into old and new generations. Usually, most of the objects that are removed belong to the new generation, and the garbage collector can carry out regular collection for a short period of time within the new generation without having to track objects in the old generation. New generation is half space allocation policy, usually a new object most begin to be put in one and a half space, the subsequent have generated a new object is allocated in the half space, until the space is full, and then will the activity in the half space object is copied to the one and a half to the other space, if the object recovery still exist many times is up to the older generation, at the same time is considered to be a lasting, Any remaining dead objects that are not removed are removed. Old generation is to determine whether cited, if there are no other references will be recycled, and adopt the strategy of incremental tag must mark need recycling objects (because of JS single-threaded, mark recovery will affect the execution of tasks of the main thread), namely when the browser free tag object, until the full mark on pile executed after recovery. (V8 4.9 version concurrent reclamation)
  4. V84.9 supports WebAssembly, a low-level subset of javascript designed to be encoded in a compact binary format and run in a secure sandbox at near-native speed.

TurboFan: One of V8’s optimized compilers

New ES6 features:

Arrow functions: This is not newly generated and is not implicitly bound to facilitate callbacks, simplifying the code, but cannot be called by new at the same time because without this, instantiating an arrow function with the new operator will return the error “is not a constructor”.

Constructor: ** Internally uses this to construct properties and methods, usually with a capital letter distinguished from the normal function **

** Object.assign(target,source), which adds attribute methods from the source to the target, overwriting duplicate key/value pairs from the target

for… Of traversal value, for… In traversal key(VUE v-for recommends using in traversal object, of traversal number group, but because array is also an object, it can be returned by in traversal as a value, key)

Dot difference REST operator (…) Object or array flattening or merging can be used instead of arguments or as apply(null,… Use the args).

You can use the presence of new.target within a function to determine whether the current execution is a new call or a normal call.

When using Es6 inheritance, the new.target in the superclass is bound to the derived constructor of the new call, which gives the superclass access to the derived class’s prototype during construction.

Includes to determine whether an Array contains a value

The Proxy and Reflect proxy do data interception, validation, and include objects, and Reflect returns the appropriate default value to the proxy.

const debugMe = new Proxy({}, { get(target, name, receiver) { console.log(`Debug: get called for field: ${name}`); return Reflect.get(target, name, receiver); }, set(target, name, value, receiver) { console.log(`Debug: set called for field: ${name}, and value: ${value}`); return Reflect.set(target, name, value, receiver); }}); debugMe.name = 'John Doe'; // Debug: set called for field: name, and value: John Doe const title = `Mr. ${debugMe.name}`; // → 'Mr. John Doe'// Debug: get called for field: nameCopy the code

Let block-level scope, const pointer immutable.

Re: post-assertion (? <=) matches from right to left, preceded by assertions (? =) from left to right, “=” replaced by “!” If not, \u matches Unicode, which is the expression.