Skip to content

Commit 386ec44

Browse files
authored
Double the maximum number of object references (#4768)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
1 parent d08b5be commit 386ec44

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

jerry-core/ecma/base/ecma-globals.h

+12-18
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,12 @@ typedef enum
815815
*/
816816
typedef enum
817817
{
818-
/* Types between 0 - 12 are ecma_object_type_t which can have a built-in flag. */
819-
820-
ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE = 29, /**< declarative lexical environment */
818+
/* Types between 0 - 12 are ecma_object_type_t. */
819+
ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE = 13, /**< declarative lexical environment */
821820
#if JERRY_ESNEXT
822-
ECMA_LEXICAL_ENVIRONMENT_CLASS = 30, /**< lexical environment with class */
821+
ECMA_LEXICAL_ENVIRONMENT_CLASS = 14, /**< lexical environment with class */
823822
#endif /* JERRY_ESNEXT */
824-
ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND = 31, /**< object-bound lexical environment */
823+
ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND = 15, /**< object-bound lexical environment */
825824

826825
ECMA_LEXICAL_ENVIRONMENT_TYPE_START = ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE, /**< first lexical
827826
* environment type */
@@ -875,12 +874,12 @@ typedef enum
875874
/**
876875
* Ecma object type mask for getting the object type.
877876
*/
878-
#define ECMA_OBJECT_TYPE_MASK 0x01fu
877+
#define ECMA_OBJECT_TYPE_MASK 0x00fu
879878

880879
/**
881880
* Extensible object.
882881
*/
883-
#define ECMA_OBJECT_FLAG_EXTENSIBLE 0x20
882+
#define ECMA_OBJECT_FLAG_EXTENSIBLE 0x10
884883

885884
/**
886885
* Declarative lexical environments created for non-closure code blocks
@@ -895,7 +894,7 @@ typedef enum
895894
/**
896895
* Bitshift index for an ecma-object reference count field
897896
*/
898-
#define ECMA_OBJECT_REF_SHIFT 6
897+
#define ECMA_OBJECT_REF_SHIFT 5
899898

900899
/**
901900
* Value for increasing or decreasing the object reference counter.
@@ -904,30 +903,25 @@ typedef enum
904903

905904
#if JERRY_CPOINTER_32_BIT
906905

907-
/**
908-
* Bitmask for an ecma-object reference count field
909-
*/
910-
#define ECMA_OBJECT_REF_MASK (((1u << 26) - 1) << ECMA_OBJECT_REF_SHIFT)
911-
912906
/**
913907
* Type of the descriptor field of an object
914908
*/
915909
typedef uint32_t ecma_object_descriptor_t;
916910

917911
#else /* !JERRY_CPOINTER_32_BIT */
918912

919-
/**
920-
* Bitmask for an ecma-object reference count field
921-
*/
922-
#define ECMA_OBJECT_REF_MASK (((1u << 10) - 1) << ECMA_OBJECT_REF_SHIFT)
923-
924913
/**
925914
* Type of the descriptor field of an object
926915
*/
927916
typedef uint16_t ecma_object_descriptor_t;
928917

929918
#endif /* JERRY_CPOINTER_32_BIT */
930919

920+
/**
921+
* Bitmask for an ecma-object reference count field
922+
*/
923+
#define ECMA_OBJECT_REF_MASK ((ecma_object_descriptor_t) (~0u << ECMA_OBJECT_REF_SHIFT))
924+
931925
/**
932926
* Represents non-visited white object
933927
*/

jerry-core/ecma/base/ecma-helpers.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ JERRY_STATIC_ASSERT (ECMA_OBJECT_REF_ONE == (ECMA_OBJECT_FLAG_EXTENSIBLE << 1),
5252
ecma_object_ref_one_must_follow_the_extensible_flag);
5353

5454
JERRY_STATIC_ASSERT ((ECMA_OBJECT_MAX_REF + ECMA_OBJECT_REF_ONE) == ECMA_OBJECT_REF_MASK,
55-
ecma_object_max_ref_does_not_fill_the_remaining_bits);
55+
ecma_object_max_ref_does_not_fill_the_remaining_bits);
56+
57+
JERRY_STATIC_ASSERT ((ECMA_OBJECT_REF_MASK & (ECMA_OBJECT_TYPE_MASK | ECMA_OBJECT_FLAG_EXTENSIBLE)) == 0,
58+
ecma_object_ref_mask_overlaps_with_object_type_or_extensible);
5659

5760
JERRY_STATIC_ASSERT (ECMA_PROPERTY_FLAGS_MASK == ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,
5861
ecma_property_flags_mask_must_use_the_configurable_enumerable_writable_flags);

0 commit comments

Comments
 (0)