From 6918db2f59207b8b0f5ecc65fbe82548a4b658c4 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Wed, 16 Jul 2014 21:13:23 +0400 Subject: [PATCH] Replacing 'ecma_Free' prefix in ecma_Free{Object,Property,Number,ArrayFirstChunk,ArrayNonFirstChunk} to 'ecma_Dealloc'. --- src/libecmaobjects/ecma-alloc.c | 12 +++++++----- src/libecmaobjects/ecma-alloc.h | 22 +++++++++++----------- src/libecmaobjects/ecma-gc.c | 4 ++-- src/libecmaobjects/ecma-helpers-value.c | 2 +- src/libecmaobjects/ecma-helpers.c | 4 ++-- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/libecmaobjects/ecma-alloc.c b/src/libecmaobjects/ecma-alloc.c index 283b8acfb..bc188aa98 100644 --- a/src/libecmaobjects/ecma-alloc.c +++ b/src/libecmaobjects/ecma-alloc.c @@ -48,6 +48,8 @@ JERRY_STATIC_ASSERT( sizeof (ecma_CompletionValue_t) == sizeof(uint32_t) ); /** * Template of an allocation routine. + * + * FIXME: Run GC only if allocation failed. */ #define ALLOC( ecmaType) ecma_ ## ecmaType ## _t * \ ecma_Alloc ## ecmaType (void) \ @@ -62,13 +64,13 @@ ecma_Alloc ## ecmaType (void) \ } /** - * Free routine template + * Deallocation routine template */ -#define FREE( ecmaType) void \ -ecma_Free ## ecmaType( ecma_ ## ecmaType ## _t *p ## ecmaType) \ +#define DEALLOC( ecmaType) void \ +ecma_Dealloc ## ecmaType( ecma_ ## ecmaType ## _t *p ## ecmaType) \ { \ mem_PoolsFree( mem_SizeToPoolChunkType( sizeof(ecma_ ## ecmaType ## _t)), \ - (uint8_t*) p ## ecmaType); \ + (uint8_t*) p ## ecmaType); \ } /** @@ -76,7 +78,7 @@ ecma_Free ## ecmaType( ecma_ ## ecmaType ## _t *p ## ecmaType) \ */ #define DECLARE_ROUTINES_FOR( ecmaType) \ ALLOC( ecmaType) \ - FREE( ecmaType) + DEALLOC( ecmaType) DECLARE_ROUTINES_FOR (Object) DECLARE_ROUTINES_FOR (Property) diff --git a/src/libecmaobjects/ecma-alloc.h b/src/libecmaobjects/ecma-alloc.h index 78e660a98..f617be20b 100644 --- a/src/libecmaobjects/ecma-alloc.h +++ b/src/libecmaobjects/ecma-alloc.h @@ -33,9 +33,9 @@ extern ecma_Object_t *ecma_AllocObject(void); /** - * Free memory from an ecma-object + * Dealloc memory from an ecma-object */ -extern void ecma_FreeObject( ecma_Object_t *pObject); +extern void ecma_DeallocObject( ecma_Object_t *pObject); /** * Allocate memory for ecma-property @@ -45,9 +45,9 @@ extern void ecma_FreeObject( ecma_Object_t *pObject); extern ecma_Property_t *ecma_AllocProperty(void); /** - * Free memory from an ecma-property + * Dealloc memory from an ecma-property */ -extern void ecma_FreeProperty( ecma_Property_t *pProperty); +extern void ecma_DeallocProperty( ecma_Property_t *pProperty); /** * Allocate memory for ecma-number @@ -57,9 +57,9 @@ extern void ecma_FreeProperty( ecma_Property_t *pProperty); extern ecma_Number_t *ecma_AllocNumber(void); /** - * Free memory from an ecma-number + * Dealloc memory from an ecma-number */ -extern void ecma_FreeNumber( ecma_Number_t *pNumber); +extern void ecma_DeallocNumber( ecma_Number_t *pNumber); /** * Allocate memory for first chunk of an ecma-array @@ -69,9 +69,9 @@ extern void ecma_FreeNumber( ecma_Number_t *pNumber); extern ecma_ArrayFirstChunk_t *ecma_AllocArrayFirstChunk(void); /** - * Free memory from first chunk of an ecma-array + * Dealloc memory from first chunk of an ecma-array */ -extern void ecma_FreeArrayFirstChunk( ecma_ArrayFirstChunk_t *pFirstChunk); +extern void ecma_DeallocArrayFirstChunk( ecma_ArrayFirstChunk_t *pFirstChunk); /** * Allocate memory for non-first chunk of an ecma-array @@ -81,13 +81,13 @@ extern void ecma_FreeArrayFirstChunk( ecma_ArrayFirstChunk_t *pFirstChunk); extern ecma_ArrayNonFirstChunk_t *ecma_AllocArrayNonFirstChunk(void); /** - * Free memory from non-first chunk of an ecma-array + * Dealloc memory from non-first chunk of an ecma-array */ -extern void ecma_FreeArrayNonFirstChunk( ecma_ArrayNonFirstChunk_t *pNumber); +extern void ecma_DeallocArrayNonFirstChunk( ecma_ArrayNonFirstChunk_t *pNumber); #endif /* JERRY_ECMA_ALLOC_H */ /** * @} * @} - */ \ No newline at end of file + */ diff --git a/src/libecmaobjects/ecma-gc.c b/src/libecmaobjects/ecma-gc.c index b93d47431..8217d03c0 100644 --- a/src/libecmaobjects/ecma-gc.c +++ b/src/libecmaobjects/ecma-gc.c @@ -212,7 +212,7 @@ ecma_GCRun( void) } pNextProperty = ecma_GetPointer( property->m_pNextProperty); - ecma_FreeProperty( property); + ecma_DeallocProperty( property); } if ( pObject->m_IsLexicalEnvironment ) @@ -233,7 +233,7 @@ ecma_GCRun( void) } } - ecma_FreeObject( pObject); + ecma_DeallocObject( pObject); } } /* ecma_RunGC */ diff --git a/src/libecmaobjects/ecma-helpers-value.c b/src/libecmaobjects/ecma-helpers-value.c index 17a64a18b..b3bb41adc 100644 --- a/src/libecmaobjects/ecma-helpers-value.c +++ b/src/libecmaobjects/ecma-helpers-value.c @@ -190,7 +190,7 @@ ecma_FreeValue( ecma_Value_t value) /**< value description */ case ECMA_TYPE_NUMBER: { ecma_Number_t *pNumber = ecma_GetPointer( value.m_Value); - ecma_FreeNumber( pNumber); + ecma_DeallocNumber( pNumber); break; } diff --git a/src/libecmaobjects/ecma-helpers.c b/src/libecmaobjects/ecma-helpers.c index 4ae5be949..e639ba007 100644 --- a/src/libecmaobjects/ecma-helpers.c +++ b/src/libecmaobjects/ecma-helpers.c @@ -395,13 +395,13 @@ ecma_FreeArray( ecma_ArrayFirstChunk_t *pFirstChunk) /**< first chunk of the arr ecma_ArrayNonFirstChunk_t *pNonFirstChunk = ecma_GetPointer( pFirstChunk->m_Header.m_pNextChunk); - ecma_FreeArrayFirstChunk( pFirstChunk); + ecma_DeallocArrayFirstChunk( pFirstChunk); while ( pNonFirstChunk != NULL ) { ecma_ArrayNonFirstChunk_t *pNextChunk = ecma_GetPointer( pNonFirstChunk->m_pNextChunk); - ecma_FreeArrayNonFirstChunk( pNonFirstChunk); + ecma_DeallocArrayNonFirstChunk( pNonFirstChunk); pNonFirstChunk = pNextChunk; }