@@ -741,23 +741,24 @@ ecma_op_function_construct_simple_or_external (ecma_object_t *func_obj_p, /**< F
741
741
prototype_magic_string_p),
742
742
ret_value);
743
743
744
- // 6 .
745
- ecma_object_t *prototype_p ;
744
+ // 1., 2., 4 .
745
+ ecma_object_t *obj_p ;
746
746
if (ecma_is_value_object (func_obj_prototype_prop_value))
747
747
{
748
- prototype_p = ecma_get_object_from_value (func_obj_prototype_prop_value);
749
- ecma_ref_object (prototype_p);
748
+ // 6.
749
+ obj_p = ecma_create_object (ecma_get_object_from_value (func_obj_prototype_prop_value),
750
+ true ,
751
+ ECMA_OBJECT_TYPE_GENERAL);
750
752
}
751
753
else
752
754
{
753
755
// 7.
754
- prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
755
- }
756
+ ecma_object_t *prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
756
757
757
- // 1., 2., 4.
758
- ecma_object_t *obj_p = ecma_create_object (prototype_p, true , ECMA_OBJECT_TYPE_GENERAL);
758
+ obj_p = ecma_create_object (prototype_p, true , ECMA_OBJECT_TYPE_GENERAL);
759
759
760
- ecma_deref_object (prototype_p);
760
+ ecma_deref_object (prototype_p);
761
+ }
761
762
762
763
// 3.
763
764
/*
@@ -781,19 +782,21 @@ ecma_op_function_construct_simple_or_external (ecma_object_t *func_obj_p, /**< F
781
782
// 9.
782
783
if (ecma_is_value_object (call_completion))
783
784
{
784
- ecma_deref_object (obj_p);
785
-
786
785
obj_value = ecma_copy_value (call_completion, true );
787
786
}
788
787
else
789
788
{
790
789
// 10.
790
+ ecma_ref_object (obj_p);
791
791
obj_value = ecma_make_object_value (obj_p);
792
792
}
793
793
794
794
ret_value = ecma_make_normal_completion_value (obj_value);
795
795
796
796
ECMA_FINALIZE (call_completion);
797
+
798
+ ecma_deref_object (obj_p);
799
+
797
800
ECMA_FINALIZE (func_obj_prototype_prop_value);
798
801
799
802
ecma_deref_ecma_string (prototype_magic_string_p);
0 commit comments