Rework promise internal structures (#3985)
- Capabilities - Promise all resolver JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
@@ -633,6 +633,24 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
ecma_gc_mark_executable_object (object_p);
|
||||
break;
|
||||
}
|
||||
case LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY:
|
||||
{
|
||||
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) object_p;
|
||||
|
||||
if (ecma_is_value_object (capability_p->header.u.class_prop.u.promise))
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (capability_p->header.u.class_prop.u.promise));
|
||||
}
|
||||
if (ecma_is_value_object (capability_p->resolve))
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (capability_p->resolve));
|
||||
}
|
||||
if (ecma_is_value_object (capability_p->reject))
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (capability_p->reject));
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
default:
|
||||
{
|
||||
@@ -765,6 +783,18 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (rev_proxy_p->proxy));
|
||||
}
|
||||
}
|
||||
else if (ext_func_p->u.external_handler_cb == ecma_op_get_capabilities_executor_cb)
|
||||
{
|
||||
ecma_promise_capability_executor_t *executor_p = (ecma_promise_capability_executor_t *) object_p;
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (executor_p->capability));
|
||||
}
|
||||
else if (ext_func_p->u.external_handler_cb == ecma_promise_all_handler_cb)
|
||||
{
|
||||
ecma_promise_all_executor_t *executor_p = (ecma_promise_all_executor_t *) object_p;
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (executor_p->capability));
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (executor_p->values));
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (executor_p->remaining_elements));
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
@@ -1124,6 +1154,14 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
{
|
||||
ext_object_size = sizeof (ecma_revocable_proxy_object_t);
|
||||
}
|
||||
else if (ext_func_p->u.external_handler_cb == ecma_op_get_capabilities_executor_cb)
|
||||
{
|
||||
ext_object_size = sizeof (ecma_promise_capability_executor_t);
|
||||
}
|
||||
else if (ext_func_p->u.external_handler_cb == ecma_promise_all_handler_cb)
|
||||
{
|
||||
ext_object_size = sizeof (ecma_promise_all_executor_t);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
break;
|
||||
}
|
||||
@@ -1234,6 +1272,11 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
ext_object_size = ecma_gc_free_executable_object (object_p);
|
||||
break;
|
||||
}
|
||||
case LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY:
|
||||
{
|
||||
ext_object_size = sizeof (ecma_promise_capabality_t);
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
default:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user