Optimize Promise data structures. (#3768)

This patch reworks several structures:

- Fulfill and reject reactions are combined into one collection. The values in this collection
are compressed: a capability followed by an optional fulfill and reject functions.
- Fulfill and reject reactions are directly stored, no need to allocate an object for them.
- The job queue directly stores its items, this saves a pointer to the value, and the
callback is replaced by an uint8 type.
- Promise status and already resolved is stored in extra_info.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-05-25 18:00:43 +02:00
committed by GitHub
parent 1774cca47c
commit 1105b43c22
8 changed files with 298 additions and 300 deletions
+2 -2
View File
@@ -177,8 +177,8 @@ struct jerry_context_t
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE)
ecma_job_queueitem_t *job_queue_head_p; /**< points to the head item of the jobqueue */
ecma_job_queueitem_t *job_queue_tail_p; /**< points to the tail item of the jobqueue*/
ecma_job_queue_item_t *job_queue_head_p; /**< points to the head item of the job queue */
ecma_job_queue_item_t *job_queue_tail_p; /**< points to the tail item of the job queue */
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
#if ENABLED (JERRY_VM_EXEC_STOP)