diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object.c b/jerry-core/ecma/builtin-objects/ecma-builtin-object.c
index a4989857f..7e2d60451 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-object.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object.c
@@ -30,6 +30,7 @@
#if ENABLED (JERRY_ESNEXT)
#include "ecma-iterator-object.h"
#include "ecma-function-object.h"
+#include "jcontext.h"
#endif /* ENABLED (JERRY_ESNEXT) */
#define ECMA_BUILTINS_INTERNAL
@@ -103,13 +104,11 @@ ecma_value_t
ecma_builtin_object_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
-
if (arguments_list_len == 0
|| ecma_is_value_undefined (arguments_list_p[0])
|| ecma_is_value_null (arguments_list_p[0]))
{
- return ecma_builtin_object_dispatch_construct (arguments_list_p, arguments_list_len);
+ return ecma_make_object_value (ecma_op_create_object_object_noarg ());
}
return ecma_op_to_object (arguments_list_p[0]);
@@ -124,16 +123,25 @@ ecma_value_t
ecma_builtin_object_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
-
- if (arguments_list_len == 0)
+#if ENABLED (JERRY_ESNEXT)
+ if (JERRY_CONTEXT (current_new_target) != ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT))
{
- ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
+ ecma_object_t *prototype_obj_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target),
+ ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
+ if (JERRY_UNLIKELY (prototype_obj_p == NULL))
+ {
+ return ECMA_VALUE_ERROR;
+ }
- return ecma_make_object_value (obj_p);
+ ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
+ 0,
+ ECMA_OBJECT_TYPE_GENERAL);
+ ecma_deref_object (prototype_obj_p);
+
+ return ecma_make_object_value (object_p);
}
-
- return ecma_op_create_object_object_arg (arguments_list_p[0]);
+#endif /* ENABLED (JERRY_ESNEXT) */
+ return ecma_builtin_object_dispatch_call (arguments_list_p, arguments_list_len);
} /* ecma_builtin_object_dispatch_construct */
/**
diff --git a/jerry-core/ecma/operations/ecma-objects-general.c b/jerry-core/ecma/operations/ecma-objects-general.c
index 06b6634be..3b87c0ff2 100644
--- a/jerry-core/ecma/operations/ecma-objects-general.c
+++ b/jerry-core/ecma/operations/ecma-objects-general.c
@@ -66,42 +66,6 @@ ecma_op_create_object_object_noarg (void)
return ecma_op_create_object_object_noarg_and_set_prototype (object_prototype_p);
} /* ecma_op_create_object_object_noarg */
-/**
- * 'Object' object creation operation with one argument.
- *
- * See also: ECMA-262 v5, 15.2.2.1
- *
- * @return pointer to newly created 'Object' object
- */
-ecma_value_t
-ecma_op_create_object_object_arg (ecma_value_t value) /**< argument of constructor */
-{
- ecma_check_value_type_is_spec_defined (value);
-
- if (!ecma_is_value_undefined (value)
- && !ecma_is_value_null (value))
- {
- /* 1.b, 1.c, 1.d */
- JERRY_ASSERT (ecma_is_value_object (value)
- || ecma_is_value_number (value)
- || ecma_is_value_prop_name (value)
- || ecma_is_value_boolean (value)
- || ecma_is_value_bigint (value));
-
- return ecma_op_to_object (value);
- }
- else
- {
- /* 2. */
- JERRY_ASSERT (ecma_is_value_undefined (value)
- || ecma_is_value_null (value));
-
- ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
-
- return ecma_make_object_value (obj_p);
- }
-} /* ecma_op_create_object_object_arg */
-
/**
* Object creation operation with no arguments.
* It sets the given prototype to the newly created object.
diff --git a/jerry-core/ecma/operations/ecma-objects-general.h b/jerry-core/ecma/operations/ecma-objects-general.h
index 111965f43..8936e642d 100644
--- a/jerry-core/ecma/operations/ecma-objects-general.h
+++ b/jerry-core/ecma/operations/ecma-objects-general.h
@@ -28,7 +28,6 @@
ecma_value_t ecma_reject (bool is_throw);
ecma_object_t *ecma_op_create_object_object_noarg (void);
-ecma_value_t ecma_op_create_object_object_arg (ecma_value_t value);
ecma_object_t *ecma_op_create_object_object_noarg_and_set_prototype (ecma_object_t *object_prototype_p);
ecma_value_t ecma_op_general_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw);
diff --git a/tests/test262-esnext-excludelist.xml b/tests/test262-esnext-excludelist.xml
index 458141395..890e68b5d 100644
--- a/tests/test262-esnext-excludelist.xml
+++ b/tests/test262-esnext-excludelist.xml
@@ -807,7 +807,6 @@
-
Test expects incorrect call order
Test expects incorrect call order