@@ -113,24 +113,40 @@ ecma_builtin_array_prototype_object_concat (ecma_value_t this_arg, /**< this arg
113113 ecma_completion_value_t new_array = ecma_op_create_array_object (0 , 0 , false );
114114 ecma_object_t *new_array_p = ecma_get_object_from_completion_value (new_array);
115115
116+ if (ecma_object_get_class_name (obj_p) == LIT_MAGIC_STRING_ARRAY_UL)
117+ {
118+ for (uint32_t index = 0 ;
119+ index < len && ecma_is_completion_value_empty (ret_value);
120+ index++, new_array_index++)
121+ {
122+ ecma_string_t *index_string_p = ecma_new_ecma_string_from_uint32 (index);
123+ ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_string_p), ret_value);
116124
117- for (uint32_t index = 0 ;
118- index < len && ecma_is_completion_value_empty (ret_value);
119- index++, new_array_index++)
125+ /* Using [[Put]] is equvalent to [[DefineOwnProperty]] in this case, so we use it for simplicity. */
126+ ecma_completion_value_t put_comp = ecma_op_object_put (new_array_p,
127+ index_string_p,
128+ get_value,
129+ false );
130+ JERRY_ASSERT (ecma_is_completion_value_normal (put_comp));
131+ ecma_free_completion_value (put_comp);
132+
133+ ECMA_FINALIZE (get_value);
134+ ecma_deref_ecma_string (index_string_p);
135+ }
136+ }
137+ else
120138 {
121- ecma_string_t *index_string_p = ecma_new_ecma_string_from_uint32 (index);
122- ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_string_p), ret_value);
139+ ecma_string_t *new_array_index_string_p = ecma_new_ecma_string_from_uint32 (new_array_index);
123140
124- /* Using [[Put]] is equvalent to [[DefineOwnProperty]] in this case, so we use it for simplicity. */
125141 ecma_completion_value_t put_comp = ecma_op_object_put (new_array_p,
126- index_string_p ,
127- get_value ,
142+ new_array_index_string_p ,
143+ this_arg ,
128144 false );
129- JERRY_ASSERT (ecma_is_completion_value_normal (put_comp));
145+ JERRY_ASSERT (ecma_is_completion_value_normal_true (put_comp));
130146 ecma_free_completion_value (put_comp);
131147
132- ECMA_FINALIZE (get_value );
133- ecma_deref_ecma_string (index_string_p) ;
148+ ecma_deref_ecma_string (new_array_index_string_p );
149+ new_array_index++ ;
134150 }
135151
136152 for (uint32_t arg_index = 0 ;
0 commit comments