Static strings should be reference counted in debug mode (#3219)

This patch helps to find out invalid reference count usage for ecma-strings.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik 2019-10-16 14:00:47 +02:00 committed by Zoltan Herczeg
parent 7518b7bfe6
commit 8f39d90f7c

View File

@ -822,11 +822,18 @@ ecma_ref_ecma_string (ecma_string_t *string_p) /**< string descriptor */
{
JERRY_ASSERT (string_p != NULL);
if (ECMA_IS_DIRECT_STRING (string_p) || ECMA_STRING_IS_STATIC (string_p))
if (ECMA_IS_DIRECT_STRING (string_p))
{
return;
}
#ifdef JERRY_NDEBUG
if (ECMA_STRING_IS_STATIC (string_p))
{
return;
}
#endif /* JERRY_NDEBUG */
JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);
if (JERRY_LIKELY (string_p->refs_and_container < ECMA_STRING_MAX_REF))
@ -849,11 +856,18 @@ ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */
{
JERRY_ASSERT (string_p != NULL);
if (ECMA_IS_DIRECT_STRING (string_p) || ECMA_STRING_IS_STATIC (string_p))
if (ECMA_IS_DIRECT_STRING (string_p))
{
return;
}
#ifdef JERRY_NDEBUG
if (ECMA_STRING_IS_STATIC (string_p))
{
return;
}
#endif /* JERRY_NDEBUG */
JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);
/* Decrease reference counter. */