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
+25 -3
View File
@@ -25,12 +25,28 @@
* @{
*/
/**
* Maximum number of array holes in a fast mode access array.
* If the number of holes exceeds this limit, the array is converted back
* Maximum number of new array holes in a fast mode access array.
* If the number of new holes exceeds this limit, the array is converted back
* to normal property list based array.
*/
#define ECMA_FAST_ARRAY_MAX_HOLE_COUNT 32
#define ECMA_FAST_ARRAY_MAX_NEW_HOLES_COUNT 32
/**
* Bitshift index for fast array hole count representation
*/
#define ECMA_FAST_ARRAY_HOLE_SHIFT 8
/**
* This number represents 1 array hole in underlying buffer of a fast acces mode array
*/
#define ECMA_FAST_ARRAY_HOLE_ONE (1 << ECMA_FAST_ARRAY_HOLE_SHIFT)
/**
* Maximum number of array holes in a fast access mode array
*/
#define ECMA_FAST_ARRAY_MAX_HOLE_COUNT (1 << 24)
/**
* Flags for ecma_op_array_object_set_length
@@ -52,6 +68,12 @@ ecma_op_new_array_object (ecma_length_t length);
ecma_object_t *
ecma_op_new_fast_array_object (ecma_length_t length);
bool
ecma_op_object_is_fast_array (ecma_object_t *object_p);
bool
ecma_op_array_is_fast_array (ecma_extended_object_t *array_p);
ecma_value_t *
ecma_fast_array_extend (ecma_object_t *object_p, uint32_t new_lengt);