Expand description
The object model: property tables, arrays, functions, and the prototype chain.
QuickJS splits an object into a shape (the property names and their attributes, shared between objects with the same layout) and a property vector (the values). That split is a performance feature, not a semantic one, and it only pays off once objects are created in bulk; this model keeps the property table per object, in insertion order, and therefore reproduces the ordering rules directly.
Insertion order is load-bearing: for (k in o) and Object.keys iterate in the
order properties were defined, with integer-like keys first in ascending order.
Structs§
- Buffer
Storage - The bytes an
ArrayBufferowns, plus whether they have been detached. - Class
Def - What every instance of one host class shares: the engine’s half of
JSClassDef. - ClassId
- The id a host class is registered under: what
JS_NewClassIDhands out. - Closure
Env - The reference cells a closure captured from enclosing scopes.
- Compiled
Code - The bytecode of one function, plus the slot-to-cell mapping.
- Eval
Scope - The bindings a direct
evalmade visible, as name → cell. - Finalization
State - The mutable half of a
FinalizationRegistry. - Host
Data - One instance of a host class: the class id, the class, and the host’s payload.
- JsObject
- A JavaScript object.
- Local
Vars - Variables a direct
evaldeclared in one function call. - Object
Data - An object’s mutable state: its prototype, property table and internal slots.
- Opaque
- A pointer the engine never dereferences.
- Promise
Reaction - One
thenregistration. - Promise
State - A
Promise’s state, shared between the promise object and its resolve/reject functions. - Property
- A property of an object.
- Proxy
State - The two slots of a proxy, shared with its
revokefunction. - Registration
- One
FinalizationRegistry.registercall.
Enums§
- Callable
- The body of a callable object.
- Combinator
Kind - What a
Promisecombinator does when its elements settle. - Object
Kind - What kind of object this is.
- Promise
Status - Which of §27.2.1.2’s three states a promise is in.
- Property
Key - The mutable half of an object. What a property is keyed by.
- View
Length - How long a view is, which for a resizable buffer is not a constant.
- WeakKey
- A key that can be held weakly: an object, or a symbol.
Constants§
- ARRAY_
ELEMENT_ LIMIT - The largest array index that may be stored, i.e. the largest dense vector this engine will grow to an index for.
Traits§
- Exotic
- The property behaviour a host class may override: the exotic half of
JSClassDef.
Functions§
- array_
index - The array index a property key names, if it names one.
- has_own
- Whether
objecthaskeyas an own property, arrays included. - index_
value - An array index as a JavaScript number.
- length_
value - An array’s
lengthas a JavaScript number. - lookup
lookup_keyfor a string key.- lookup_
key keyonobjector anywhere up its prototype chain, with the owner.- lookup_
key_ above lookup_keystarting aboveobject: its prototype and upwards.- own_
property_ including_ array - Walk the prototype chain from
objectlooking forname. - weak_
key - Turn a script value into a weak key, if
CanBeHeldWeaklyallows it.
Type Aliases§
- Host
Finalizer - A host class’s finalizer:
JSClassDef::finalizer. - HostFn
- A host function: a native function plus the state it captured.
- Host
GcMark - A host class’s
gc_markcallback:JSClassDef::gc_mark. - Native
Fn - A native (Rust) function reachable from JavaScript.
- Promise
Ref - A promise’s shareable state.
- Proxy
Ref - A proxy’s mutable state, shared between the proxy object and its
revoke.