Add allocate/free callbacks to ArrayBuffers (#4801)

Larger buffer allocations will throw error instead of calling jerry_fatal.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-10-28 13:51:34 +02:00
committed by GitHub
parent d2388e907f
commit a024eb2118
19 changed files with 1365 additions and 716 deletions
+9
View File
@@ -197,6 +197,15 @@ struct jerry_context_t
#endif /* JERRY_PROMISE_CALLBACK */
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_TYPEDARRAY
uint32_t arraybuffer_compact_allocation_limit; /**< maximum size of compact allocation */
jerry_arraybuffer_allocate_t arraybuffer_allocate_callback; /**< callback for allocating
* arraybuffer memory */
jerry_arraybuffer_free_t arraybuffer_free_callback; /**< callback for freeing arraybuffer memory */
void *arraybuffer_allocate_callback_user_p; /**< user pointer passed to arraybuffer_allocate_callback
* and arraybuffer_free_callback functions */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_VM_EXEC_STOP
uint32_t vm_exec_stop_frequency; /**< reset value for vm_exec_stop_counter */
uint32_t vm_exec_stop_counter; /**< down counter for reducing the calls of vm_exec_stop_cb */