Check reference count of objects
Throw an error if the object reference count reached the limit. Related issue: #118 JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -211,7 +211,16 @@ ecma_init_gc_info (ecma_object_t *object_p) /**< object */
|
||||
void
|
||||
ecma_ref_object (ecma_object_t *object_p) /**< object */
|
||||
{
|
||||
ecma_gc_set_object_refs (object_p, ecma_gc_get_object_refs (object_p) + 1);
|
||||
uint32_t ref_cnt = ecma_gc_get_object_refs (object_p);
|
||||
|
||||
if (ref_cnt < (uint32_t) CONFIG_ECMA_REFERENCE_COUNTER_LIMIT)
|
||||
{
|
||||
ecma_gc_set_object_refs (object_p, ref_cnt + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
jerry_fatal (ERR_REF_COUNT_LIMIT);
|
||||
}
|
||||
} /* ecma_ref_object */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1334,11 +1334,10 @@ ecma_get_property_descriptor_from_property (ecma_property_t *prop_p) /**< proper
|
||||
void
|
||||
ecma_bytecode_ref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
|
||||
{
|
||||
/* Abort program if maximum reference number is reached.
|
||||
* Note: This is not tested for objects. */
|
||||
/* Abort program if maximum reference number is reached. */
|
||||
if ((bytecode_p->status_flags >> ECMA_BYTECODE_REF_SHIFT) >= 0x3ff)
|
||||
{
|
||||
jerry_fatal (ERR_UNIMPLEMENTED_CASE);
|
||||
jerry_fatal (ERR_REF_COUNT_LIMIT);
|
||||
}
|
||||
|
||||
bytecode_p->status_flags = (uint16_t) (bytecode_p->status_flags + (1 << ECMA_BYTECODE_REF_SHIFT));
|
||||
|
||||
Reference in New Issue
Block a user