Fix invocation of GC for non-zero generations.

This commit is contained in:
Ruben Ayrapetyan
2014-08-07 21:10:36 +04:00
parent d7e28e3a28
commit 7ad6c25bb2
2 changed files with 12 additions and 18 deletions
+12 -8
View File
@@ -65,16 +65,20 @@ ecma_alloc_ ## ecma_type (void) \
return p ## ecma_type; \
} \
\
ecma_gc_run( ECMA_GC_GEN_0 ); \
\
p ## ecma_type = (ecma_ ## ecma_type ## _t *) \
mem_pools_alloc( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecma_type ## _t))); \
\
if ( likely( p ## ecma_type != NULL ) ) \
for ( ecma_gc_gen_t gen_id = ECMA_GC_GEN_0; \
gen_id < ECMA_GC_GEN_COUNT; \
gen_id++ ) \
{ \
return p ## ecma_type; \
ecma_gc_run( gen_id ); \
\
p ## ecma_type = (ecma_ ## ecma_type ## _t *) \
mem_pools_alloc( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecma_type ## _t))); \
\
if ( likely( p ## ecma_type != NULL ) ) \
{ \
return p ## ecma_type; \
} \
} \
\
JERRY_UNREACHABLE(); \
}
-10
View File
@@ -323,8 +323,6 @@ ecma_gc_run( ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
{
JERRY_ASSERT( max_gen_to_collect < ECMA_GC_GEN_COUNT );
bool was_something_sweeped = false;
/* clearing visited flags for all objects of generations to be processed */
for ( ecma_gc_gen_t gen_id = 0; gen_id <= max_gen_to_collect; gen_id++ )
{
@@ -386,8 +384,6 @@ ecma_gc_run( ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
if ( !obj_iter_p->gc_info.visited )
{
was_something_sweeped = true;
ecma_gc_sweep( obj_iter_p);
if ( likely( obj_prev_p != NULL ) )
@@ -450,12 +446,6 @@ ecma_gc_run( ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
}
}
#endif /* !JERRY_NDEBUG */
if ( !was_something_sweeped
&& max_gen_to_collect != ECMA_GC_GEN_COUNT - 1 )
{
ecma_gc_run( max_gen_to_collect + 1);
}
} /* ecma_gc_run */
/**