Implementing case 3.b in PutValue operation.

This commit is contained in:
Ruben Ayrapetyan
2014-08-01 12:48:03 +04:00
parent a7b2aa1014
commit 8260cc0214
4 changed files with 46 additions and 7 deletions
@@ -14,6 +14,7 @@
*/
#include "globals.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-global-object.h"
#include "ecma-helpers.h"
@@ -26,6 +27,27 @@
* @{
*/
/**
* Global object
*/
static ecma_object_t* ecma_global_object_p = NULL;
/**
* Get Global object
*
* @return pointer to the Global object
* caller should free the reference by calling ecma_deref_object
*/
ecma_object_t*
ecma_get_global_object( void)
{
JERRY_ASSERT( ecma_global_object_p != NULL );
ecma_ref_object( ecma_global_object_p);
return ecma_global_object_p;
} /* ecma_get_global_object */
/**
* The Global Object construction routine.
*
@@ -36,6 +58,8 @@
ecma_object_t*
ecma_op_create_global_object( void)
{
JERRY_ASSERT( ecma_global_object_p == NULL );
ecma_object_t *glob_obj_p = ecma_create_object( NULL, true, ECMA_OBJECT_TYPE_GENERAL);
ecma_property_t *undefined_prop_p = ecma_create_named_data_property( glob_obj_p,
@@ -47,6 +71,9 @@ ecma_op_create_global_object( void)
TODO( /* Define NaN, Infinity, eval, parseInt, parseFloat, isNaN, isFinite properties */ );
ecma_ref_object( glob_obj_p);
ecma_global_object_p = glob_obj_p;
return glob_obj_p;
} /* ecma_op_create_global_object */