Revise internal array creation operations (#4291)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-10-16 15:24:50 +02:00
committed by GitHub
parent 841d536fce
commit d8955552d7
18 changed files with 350 additions and 314 deletions
+3 -5
View File
@@ -62,15 +62,13 @@ ecma_value_t
vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimited */
{
#if ENABLED (JERRY_LINE_INFO)
ecma_value_t result_array = ecma_op_create_array_object (NULL, 0, false);
if (max_depth == 0)
{
max_depth = UINT32_MAX;
}
vm_frame_ctx_t *context_p = JERRY_CONTEXT (vm_top_context_p);
ecma_object_t *array_p = ecma_get_object_from_value (result_array);
ecma_object_t *array_p = ecma_op_new_array_object (0);
JERRY_ASSERT (ecma_op_object_is_fast_array (array_p));
uint32_t index = 0;
@@ -107,10 +105,10 @@ vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimite
}
}
return result_array;
return ecma_make_object_value (array_p);
#else /* !ENABLED (JERRY_LINE_INFO) */
JERRY_UNUSED (max_depth);
return ecma_op_create_array_object (NULL, 0, false);
return ecma_make_object_value (ecma_op_new_array_object (0));
#endif /* ENABLED (JERRY_LINE_INFO) */
} /* vm_get_backtrace */
+6 -6
View File
@@ -2024,8 +2024,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_PUSH_ARRAY:
{
// Note: this operation cannot throw an exception
*stack_top_p++ = ecma_make_object_value (ecma_op_new_fast_array_object (0));
/* Note: this operation cannot throw an exception */
*stack_top_p++ = ecma_make_object_value (ecma_op_new_array_object (0));
continue;
}
#if ENABLED (JERRY_ESNEXT)
@@ -2329,9 +2329,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
arg_list_len = argument_end;
}
result = ecma_op_create_array_object (arg_list_p + argument_end,
arg_list_len - argument_end,
false);
result = ecma_op_new_array_object_from_buffer (arg_list_p + argument_end,
arg_list_len - argument_end);
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (result));
*stack_top_p++ = result;
@@ -2401,7 +2400,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_REST_INITIALIZER:
{
ecma_object_t *array_p = ecma_op_new_fast_array_object (0);
ecma_object_t *array_p = ecma_op_new_array_object (0);
JERRY_ASSERT (ecma_op_object_is_fast_array (array_p));
ecma_value_t iterator = stack_top_p[-1];
uint32_t index = 0;