Rework array hole calculation for fast access mode arrays (#3248)

This patch gives possibility to Array.prototype builtin routine optimizations.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-10-29 10:10:25 +01:00
committed by GitHub
parent 42ab062441
commit 1c34539997
20 changed files with 293 additions and 287 deletions
+8 -15
View File
@@ -18,6 +18,7 @@
*/
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-container-object.h"
#include "ecma-globals.h"
#include "ecma-gc.h"
@@ -482,7 +483,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
if (ext_object_p->u.array.is_fast_mode)
if (ecma_op_array_is_fast_array (ext_object_p))
{
if (object_p->u1.property_list_cp != JMEM_CP_NULL)
{
@@ -611,11 +612,9 @@ ecma_gc_free_native_pointer (ecma_property_t *property_p) /**< property */
static void
ecma_free_fast_access_array (ecma_object_t *object_p) /**< fast access mode array object to free */
{
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_ARRAY);
JERRY_ASSERT (ecma_op_object_is_fast_array (object_p));
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
JERRY_ASSERT (ext_object_p->u.array.is_fast_mode);
const uint32_t aligned_length = ECMA_FAST_ARRAY_ALIGN_LENGTH (ext_object_p->u.array.length);
if (object_p->u1.property_list_cp != JMEM_CP_NULL)
@@ -651,15 +650,10 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
if (obj_is_not_lex_env
|| ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
{
if (obj_is_not_lex_env && ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_ARRAY)
if (obj_is_not_lex_env && ecma_op_object_is_fast_array (object_p))
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
if (ext_object_p->u.array.is_fast_mode)
{
ecma_free_fast_access_array (object_p);
return;
}
ecma_free_fast_access_array (object_p);
return;
}
jmem_cpointer_t prop_iter_cp = object_p->u1.property_list_cp;
@@ -1203,8 +1197,7 @@ ecma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */
|| ecma_get_lex_env_type (obj_iter_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
{
if (!ecma_is_lexical_environment (obj_iter_p)
&& ecma_get_object_type (obj_iter_p) == ECMA_OBJECT_TYPE_ARRAY
&& ((ecma_extended_object_t *) obj_iter_p)->u.array.is_fast_mode)
&& ecma_op_object_is_fast_array (obj_iter_p))
{
obj_iter_cp = obj_iter_p->gc_next_cp;
continue;