aboutsummaryrefslogtreecommitdiff
path: root/jerry-core/ecma/base/ecma-helpers-string.c
diff options
context:
space:
mode:
authorRobert Fancsik <frobert@inf.u-szeged.hu>2019-10-16 14:00:47 +0200
committerZoltan Herczeg <zherczeg.u-szeged@partner.samsung.com>2019-10-16 14:00:47 +0200
commit8f39d90f7c8aa3ed78b2f552ec7bb064b9999437 (patch)
tree6b5cfbcd2bae894a36ff604a6383df135250b3d3 /jerry-core/ecma/base/ecma-helpers-string.c
parent7518b7bfe66c1df5e927d873ad543ba7cf52fdc1 (diff)
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
Diffstat (limited to 'jerry-core/ecma/base/ecma-helpers-string.c')
-rw-r--r--jerry-core/ecma/base/ecma-helpers-string.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/jerry-core/ecma/base/ecma-helpers-string.c b/jerry-core/ecma/base/ecma-helpers-string.c
index bbe419bc..9a3c7a1a 100644
--- a/jerry-core/ecma/base/ecma-helpers-string.c
+++ b/jerry-core/ecma/base/ecma-helpers-string.c
@@ -822,10 +822,17 @@ 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);
@@ -849,10 +856,17 @@ 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);