Implementing object model, memory allocators finalization routines. Adding assertion that all memory was freed before exit.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-operations.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-global-object.h"
|
||||
#include "globals.h"
|
||||
|
||||
/**
|
||||
* ECMA object model finalization routine
|
||||
*/
|
||||
void
|
||||
ecma_finalize(void)
|
||||
{
|
||||
ecma_finalize_global_object();
|
||||
} /* ecma_finalize */
|
||||
@@ -77,6 +77,19 @@ ecma_op_create_global_object( void)
|
||||
return glob_obj_p;
|
||||
} /* ecma_op_create_global_object */
|
||||
|
||||
/**
|
||||
* Remove global reference to the global object.
|
||||
*
|
||||
* Warning:
|
||||
* the routine should be called only from ecma_finalize
|
||||
*/
|
||||
void
|
||||
ecma_finalize_global_object(void)
|
||||
{
|
||||
ecma_deref_object( ecma_global_object_p);
|
||||
ecma_global_object_p = NULL;
|
||||
} /* ecma_free_global_object */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
extern ecma_object_t* ecma_get_global_object(void);
|
||||
extern ecma_object_t* ecma_op_create_global_object( void);
|
||||
extern void ecma_finalize_global_object( void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -492,6 +492,8 @@ ecma_op_create_global_environment( void)
|
||||
|
||||
ecma_object_t *glob_env_p = ecma_create_object_lex_env( NULL, glob_obj_p, false);
|
||||
|
||||
ecma_deref_object( glob_obj_p);
|
||||
|
||||
return glob_env_p;
|
||||
} /* ecma_op_create_global_environment */
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ extern ecma_reference_t ecma_op_get_identifier_reference( ecma_object_t *lex_env
|
||||
extern ecma_completion_value_t ecma_op_get_value( ecma_reference_t ref);
|
||||
extern ecma_completion_value_t ecma_op_put_value( ecma_reference_t ref, ecma_value_t value);
|
||||
|
||||
extern void ecma_finalize( void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user