Replacing 'ecma_Free' prefix in ecma_Free{Object,Property,Number,ArrayFirstChunk,ArrayNonFirstChunk} to 'ecma_Dealloc'.

This commit is contained in:
Ruben Ayrapetyan
2014-07-16 21:13:23 +04:00
parent b72185696a
commit 6918db2f59
5 changed files with 23 additions and 21 deletions
+7 -5
View File
@@ -48,6 +48,8 @@ JERRY_STATIC_ASSERT( sizeof (ecma_CompletionValue_t) == sizeof(uint32_t) );
/** /**
* Template of an allocation routine. * Template of an allocation routine.
*
* FIXME: Run GC only if allocation failed.
*/ */
#define ALLOC( ecmaType) ecma_ ## ecmaType ## _t * \ #define ALLOC( ecmaType) ecma_ ## ecmaType ## _t * \
ecma_Alloc ## ecmaType (void) \ ecma_Alloc ## ecmaType (void) \
@@ -62,13 +64,13 @@ ecma_Alloc ## ecmaType (void) \
} }
/** /**
* Free routine template * Deallocation routine template
*/ */
#define FREE( ecmaType) void \ #define DEALLOC( ecmaType) void \
ecma_Free ## ecmaType( ecma_ ## ecmaType ## _t *p ## ecmaType) \ ecma_Dealloc ## ecmaType( ecma_ ## ecmaType ## _t *p ## ecmaType) \
{ \ { \
mem_PoolsFree( mem_SizeToPoolChunkType( sizeof(ecma_ ## ecmaType ## _t)), \ 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) \ #define DECLARE_ROUTINES_FOR( ecmaType) \
ALLOC( ecmaType) \ ALLOC( ecmaType) \
FREE( ecmaType) DEALLOC( ecmaType)
DECLARE_ROUTINES_FOR (Object) DECLARE_ROUTINES_FOR (Object)
DECLARE_ROUTINES_FOR (Property) DECLARE_ROUTINES_FOR (Property)
+10 -10
View File
@@ -33,9 +33,9 @@
extern ecma_Object_t *ecma_AllocObject(void); 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 * Allocate memory for ecma-property
@@ -45,9 +45,9 @@ extern void ecma_FreeObject( ecma_Object_t *pObject);
extern ecma_Property_t *ecma_AllocProperty(void); 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 * Allocate memory for ecma-number
@@ -57,9 +57,9 @@ extern void ecma_FreeProperty( ecma_Property_t *pProperty);
extern ecma_Number_t *ecma_AllocNumber(void); 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 * 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); 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 * Allocate memory for non-first chunk of an ecma-array
@@ -81,9 +81,9 @@ extern void ecma_FreeArrayFirstChunk( ecma_ArrayFirstChunk_t *pFirstChunk);
extern ecma_ArrayNonFirstChunk_t *ecma_AllocArrayNonFirstChunk(void); 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 */ #endif /* JERRY_ECMA_ALLOC_H */
+2 -2
View File
@@ -212,7 +212,7 @@ ecma_GCRun( void)
} }
pNextProperty = ecma_GetPointer( property->m_pNextProperty); pNextProperty = ecma_GetPointer( property->m_pNextProperty);
ecma_FreeProperty( property); ecma_DeallocProperty( property);
} }
if ( pObject->m_IsLexicalEnvironment ) if ( pObject->m_IsLexicalEnvironment )
@@ -233,7 +233,7 @@ ecma_GCRun( void)
} }
} }
ecma_FreeObject( pObject); ecma_DeallocObject( pObject);
} }
} /* ecma_RunGC */ } /* ecma_RunGC */
+1 -1
View File
@@ -190,7 +190,7 @@ ecma_FreeValue( ecma_Value_t value) /**< value description */
case ECMA_TYPE_NUMBER: case ECMA_TYPE_NUMBER:
{ {
ecma_Number_t *pNumber = ecma_GetPointer( value.m_Value); ecma_Number_t *pNumber = ecma_GetPointer( value.m_Value);
ecma_FreeNumber( pNumber); ecma_DeallocNumber( pNumber);
break; break;
} }
+2 -2
View File
@@ -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_ArrayNonFirstChunk_t *pNonFirstChunk = ecma_GetPointer( pFirstChunk->m_Header.m_pNextChunk);
ecma_FreeArrayFirstChunk( pFirstChunk); ecma_DeallocArrayFirstChunk( pFirstChunk);
while ( pNonFirstChunk != NULL ) while ( pNonFirstChunk != NULL )
{ {
ecma_ArrayNonFirstChunk_t *pNextChunk = ecma_GetPointer( pNonFirstChunk->m_pNextChunk); ecma_ArrayNonFirstChunk_t *pNextChunk = ecma_GetPointer( pNonFirstChunk->m_pNextChunk);
ecma_FreeArrayNonFirstChunk( pNonFirstChunk); ecma_DeallocArrayNonFirstChunk( pNonFirstChunk);
pNonFirstChunk = pNextChunk; pNonFirstChunk = pNextChunk;
} }