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:
committed by
Zoltan Herczeg
parent
7518b7bfe6
commit
8f39d90f7c
@@ -822,11 +822,18 @@ ecma_ref_ecma_string (ecma_string_t *string_p) /**< string descriptor */
|
|||||||
{
|
{
|
||||||
JERRY_ASSERT (string_p != NULL);
|
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;
|
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);
|
JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);
|
||||||
|
|
||||||
if (JERRY_LIKELY (string_p->refs_and_container < ECMA_STRING_MAX_REF))
|
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);
|
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;
|
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);
|
JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);
|
||||||
|
|
||||||
/* Decrease reference counter. */
|
/* Decrease reference counter. */
|
||||||
|
|||||||
Reference in New Issue
Block a user