106 lines
3.7 KiB
JavaScript
106 lines
3.7 KiB
JavaScript
var js = this
|
||
js[prosperon.DOC] = `
|
||
Provides functions for introspecting and configuring the QuickJS runtime engine.
|
||
Includes debug info, memory usage, GC controls, code evaluation, etc.
|
||
`
|
||
|
||
js.rt_info[prosperon.DOC] = "Return internal QuickJS runtime info, such as object counts."
|
||
|
||
js.dump_shapes[prosperon.DOC] = `
|
||
:return: A debug string describing the internal shape hierarchy used by QuickJS.
|
||
Use this for internal debugging of object shapes.
|
||
`
|
||
|
||
js.dump_atoms[prosperon.DOC] = `
|
||
:return: A debug string listing all currently registered atoms (internal property keys/symbols)
|
||
known by QuickJS. Helpful for diagnosing memory usage or potential key collisions.
|
||
`
|
||
|
||
js.dump_class[prosperon.DOC] = `
|
||
:return: A debug string describing the distribution of JS object classes in the QuickJS runtime.
|
||
Shows how many objects of each class exist, useful for advanced memory or performance profiling.
|
||
`
|
||
|
||
js.dump_type_overheads[prosperon.DOC] = `
|
||
:return: A debug string describing the overheads for various JS object types in QuickJS.
|
||
Displays memory usage breakdown for different internal object types.
|
||
`
|
||
|
||
js.dump_objects[prosperon.DOC] = `
|
||
:return: A debug string listing certain internal QuickJS objects and their references,
|
||
useful for debugging memory leaks or object lifetimes.
|
||
`
|
||
|
||
js.stack_info[prosperon.DOC] = `
|
||
:return: An object or string describing the runtime's current stack usage and capacity.
|
||
Internal debugging utility to examine call stack details.
|
||
`
|
||
|
||
js.cycle_hook[prosperon.DOC] = `
|
||
:param callback: A function to call each time QuickJS completes a "cycle" (internal VM loop),
|
||
or undefined to remove the callback.
|
||
:return: None
|
||
|
||
Register or remove a hook function that QuickJS calls once per execution cycle. If the callback
|
||
is set, it receives a single argument (an optional object/value describing the cycle). If callback
|
||
is undefined, the hook is removed.
|
||
`
|
||
|
||
js.calc_mem[prosperon.DOC] = `
|
||
:param value: A JavaScript value to analyze.
|
||
:return: Approximate memory usage (in bytes) of that single value.
|
||
|
||
Compute the approximate size of a single JS value in memory. This is a best-effort estimate.
|
||
`
|
||
|
||
js.mem[prosperon.DOC] = `
|
||
:return: An object containing a comprehensive snapshot of memory usage for the current QuickJS runtime,
|
||
including total allocated bytes, object counts, and more.
|
||
|
||
Retrieve an overview of the runtime’s memory usage.
|
||
`
|
||
|
||
js.mem_limit[prosperon.DOC] = `
|
||
:param bytes: The maximum memory (in bytes) QuickJS is allowed to use.
|
||
:return: None
|
||
|
||
Set the upper memory limit for the QuickJS runtime. Exceeding this limit may cause operations to
|
||
fail or throw errors.
|
||
`
|
||
|
||
js.gc_threshold[prosperon.DOC] = `
|
||
:param bytes: The threshold (in bytes) at which the engine triggers automatic garbage collection.
|
||
:return: None
|
||
|
||
Set the threshold (in bytes) for QuickJS to perform an automatic GC pass when memory usage surpasses it.
|
||
`
|
||
|
||
js.max_stacksize[prosperon.DOC] = `
|
||
:param bytes: The maximum allowed stack size (in bytes) for QuickJS.
|
||
:return: None
|
||
|
||
Set the maximum stack size for QuickJS. If exceeded, the runtime may throw a stack overflow error.
|
||
`
|
||
|
||
js.memstate[prosperon.DOC] = `
|
||
:return: A simpler memory usage object (malloc sizes, etc.) for the QuickJS runtime.
|
||
|
||
Gives a quick overview of the memory usage, including malloc size and other allocations.
|
||
`
|
||
|
||
js.gc[prosperon.DOC] = `
|
||
:return: None
|
||
|
||
Force an immediate, full garbage collection pass, reclaiming unreachable memory.
|
||
`
|
||
|
||
js.eval[prosperon.DOC] = `
|
||
:param src: A string of JavaScript source code to evaluate.
|
||
:param filename: (Optional) A string for the filename or label, used in debugging or stack traces.
|
||
:return: The result of evaluating the given source code.
|
||
|
||
Execute a string of JavaScript code in the current QuickJS context.
|
||
`
|
||
|
||
return js
|