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
+3 -3
View File
@@ -67,17 +67,17 @@ ecma_builtin_bin_search_for_magic_string_id_in_array (const ecma_magic_string_id
macro (STRING_PROTOTYPE, \ macro (STRING_PROTOTYPE, \
TYPE_GENERAL, \ TYPE_GENERAL, \
STRING_UL, \ STRING_UL, \
ECMA_BUILTIN_ID__COUNT /* FIXME: ECMA_BUILTIN_ID_OBJECT_PROTOTYPE */, \ ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, \
string_prototype) \ string_prototype) \
macro (OBJECT, \ macro (OBJECT, \
TYPE_FUNCTION, \ TYPE_FUNCTION, \
OBJECT_UL, \ OBJECT_UL, \
ECMA_BUILTIN_ID__COUNT /* FIXME: ECMA_BUILTIN_ID_OBJECT_PROTOTYPE */, \ ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, \
object) \ object) \
macro (MATH, \ macro (MATH, \
TYPE_GENERAL, \ TYPE_GENERAL, \
MATH_UL, \ MATH_UL, \
ECMA_BUILTIN_ID__COUNT /* FIXME: ECMA_BUILTIN_ID_OBJECT_PROTOTYPE */, \ ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, \
math) \ math) \
macro (ARRAY, \ macro (ARRAY, \
TYPE_FUNCTION, \ TYPE_FUNCTION, \
+2 -5
View File
@@ -210,8 +210,7 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
len_p = NULL; len_p = NULL;
// 16. // 16.
FIXME(Use 'new Object ()' instead); ecma_object_t *proto_p = ecma_op_create_object_object_noarg ();
ecma_object_t *proto_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL);
// 17. // 17.
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor (); 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 else
{ {
// 7. // 7.
FIXME (/* Set to built-in Object prototype (15.2.4) */); prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
prototype_p = ecma_create_object (NULL, false, ECMA_OBJECT_TYPE_GENERAL);
} }
// 1., 2., 4. // 1., 2., 4.
@@ -21,6 +21,7 @@
*/ */
#include "ecma-alloc.h" #include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-function-object.h" #include "ecma-function-object.h"
#include "ecma-gc.h" #include "ecma-gc.h"
#include "ecma-globals.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); *len_p = ecma_uint32_to_number (arguments_list_length);
// 2., 3., 6. // 2., 3., 6.
FIXME (/* Set prototype to built-in Object prototype object (15.2.4) */); ecma_object_t *obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
ecma_object_t *obj_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL);
// 4. // 4.
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS); 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) && formal_params_number > 0)
{ {
// 8. // 8.
FIXME (Use built-in Object constructor); ecma_object_t *map_p = ecma_op_create_object_object_noarg ();
ecma_object_t *map_p = ecma_create_object (NULL, true, ECMA_OBJECT_TYPE_GENERAL);
// 11.c // 11.c
ecma_string_t *formal_params[formal_params_number]; ecma_string_t *formal_params[formal_params_number];
+5 -2
View File
@@ -13,6 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "ecma-builtins.h"
#include "ecma-exceptions.h" #include "ecma-exceptions.h"
#include "ecma-function-object.h" #include "ecma-function-object.h"
#include "ecma-gc.h" #include "ecma-gc.h"
@@ -58,10 +59,12 @@ ecma_reject (bool is_throw) /**< Throw flag */
ecma_object_t* ecma_object_t*
ecma_op_create_object_object_noarg (void) 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. // 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); 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; class_prop_p->u.internal_property.value = ECMA_MAGIC_STRING_OBJECT_UL;