mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fixing comment about an object's maximum reference counter. Adding runtime check for the counter's overflow.
This commit is contained in:
parent
27f6d2b552
commit
7984c7e65f
@ -68,6 +68,11 @@ ecma_ref_object(ecma_object_t *object_p) /**< object */
|
||||
* Check that value was not overflowed
|
||||
*/
|
||||
JERRY_ASSERT(object_p->GCInfo.u.refs > 0);
|
||||
|
||||
if ( unlikely( object_p->GCInfo.u.refs == 0 ) )
|
||||
{
|
||||
JERRY_UNREACHABLE();
|
||||
}
|
||||
} /* ecma_ref_object */
|
||||
|
||||
/**
|
||||
|
||||
@ -246,6 +246,8 @@ typedef struct ecma_property_t {
|
||||
* Description of GC's information layout
|
||||
*/
|
||||
typedef struct {
|
||||
FIXME( /* Handle cyclic dependencies */ );
|
||||
|
||||
/**
|
||||
* Flag that indicates if the object is valid for normal usage.
|
||||
* If the flag is zero, then the object is not valid and is queued for GC.
|
||||
@ -258,9 +260,9 @@ typedef struct {
|
||||
* Number of refs to the object (if is_object_valid).
|
||||
*
|
||||
* Note: It is not a pointer. Maximum value of reference counter
|
||||
* willn't be bigger than overall count of variables/objects/properties,
|
||||
* which is limited by size of address space allocated for JerryScript
|
||||
* (and, consequently, by ECMA_POINTER_FIELD_WIDTH).
|
||||
* willn't be bigger than overall count of variables/objects/properties.
|
||||
* The width of the field will be sufficient in most cases. However, it is not theoretically
|
||||
* guaranteed. Overflow is handled in ecma_ref_object by stopping the engine.
|
||||
*/
|
||||
unsigned int refs : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user