Fixing various FIXMEs that depend on built-in Object constructor and Object.prototype.

This commit is contained in:
Ruben Ayrapetyan 2014-09-26 18:33:50 +04:00
parent a0a2ec2cea
commit f82ae90040
4 changed files with 13 additions and 14 deletions

View File

@ -67,17 +67,17 @@ ecma_builtin_bin_search_for_magic_string_id_in_array (const ecma_magic_string_id
macro (STRING_PROTOTYPE, \
TYPE_GENERAL, \
STRING_UL, \
ECMA_BUILTIN_ID__COUNT /* FIXME: ECMA_BUILTIN_ID_OBJECT_PROTOTYPE */, \
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, \
string_prototype) \
macro (OBJECT, \
TYPE_FUNCTION, \
OBJECT_UL, \
ECMA_BUILTIN_ID__COUNT /* FIXME: ECMA_BUILTIN_ID_OBJECT_PROTOTYPE */, \
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, \
object) \
macro (MATH, \
TYPE_GENERAL, \
MATH_UL, \
ECMA_BUILTIN_ID__COUNT /* FIXME: ECMA_BUILTIN_ID_OBJECT_PROTOTYPE */, \
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, \
math) \
macro (ARRAY, \
TYPE_FUNCTION, \

View File

@ -210,8 +210,7 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
len_p = NULL;
// 16.
FIXME(Use 'new Object ()' instead);
ecma_object_t *proto_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL);
ecma_object_t *proto_p = ecma_op_create_object_object_noarg ();
// 17.
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
@ -605,9 +604,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
else
{
// 7.
FIXME (/* Set to built-in Object prototype (15.2.4) */);
prototype_p = ecma_create_object (NULL, false, ECMA_OBJECT_TYPE_GENERAL);
prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
}
// 1., 2., 4.

View File

@ -21,6 +21,7 @@
*/
#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
@ -54,8 +55,7 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
*len_p = ecma_uint32_to_number (arguments_list_length);
// 2., 3., 6.
FIXME (/* Set prototype to built-in Object prototype object (15.2.4) */);
ecma_object_t *obj_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL);
ecma_object_t *obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
// 4.
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
@ -123,8 +123,7 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
&& formal_params_number > 0)
{
// 8.
FIXME (Use built-in Object constructor);
ecma_object_t *map_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL);
ecma_object_t *map_p = ecma_op_create_object_object_noarg ();
// 11.c
ecma_string_t *formal_params[formal_params_number];

View File

@ -13,6 +13,7 @@
* limitations under the License.
*/
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
@ -58,10 +59,12 @@ ecma_reject (bool is_throw) /**< Throw flag */
ecma_object_t*
ecma_op_create_object_object_noarg (void)
{
FIXME (/* Set to built-in Object prototype (15.2.4) */);
ecma_object_t *object_prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
// 3., 4., 6., 7.
ecma_object_t *obj_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL);
ecma_object_t *obj_p = ecma_create_object (object_prototype_p, true, ECMA_OBJECT_TYPE_GENERAL);
ecma_deref_object (object_prototype_p);
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
class_prop_p->u.internal_property.value = ECMA_MAGIC_STRING_OBJECT_UL;