28
28
29
29
#if ENABLED (JERRY_PROPRETY_HASHMAP )
30
30
31
- /**
32
- * Maximum number of properties that can be stored in a hashmap directly
33
- */
34
- #define ECMA_PROPERTY_HASHMAP_SHIFT_LIMIT (UINT16_MAX + 1)
35
-
36
31
/**
37
32
* Compute the total size of the property hashmap.
38
33
*/
@@ -134,7 +129,6 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
134
129
memset (hashmap_p , 0 , total_size );
135
130
136
131
hashmap_p -> header .types [0 ] = ECMA_PROPERTY_TYPE_HASHMAP ;
137
- hashmap_p -> header .types [1 ] = 0 ;
138
132
hashmap_p -> header .next_property_cp = object_p -> u1 .property_list_cp ;
139
133
hashmap_p -> max_property_count = max_property_count ;
140
134
hashmap_p -> null_count = max_property_count - named_property_count ;
@@ -144,16 +138,6 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
144
138
uint8_t * bits_p = (uint8_t * ) (pair_list_p + max_property_count );
145
139
uint32_t mask = max_property_count - 1 ;
146
140
147
- uint8_t shift_counter = 0 ;
148
-
149
- while (max_property_count > ECMA_PROPERTY_HASHMAP_SHIFT_LIMIT )
150
- {
151
- shift_counter ++ ;
152
- max_property_count >>= 1 ;
153
- }
154
-
155
- hashmap_p -> header .types [1 ] = shift_counter ;
156
-
157
141
prop_iter_cp = object_p -> u1 .property_list_cp ;
158
142
ECMA_SET_NON_NULL_POINTER (object_p -> u1 .property_list_cp , hashmap_p );
159
143
@@ -175,16 +159,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
175
159
property_pair_p -> names_cp [i ]);
176
160
uint32_t step = ecma_property_hashmap_steps [entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1 )];
177
161
178
- if (mask < ECMA_PROPERTY_HASHMAP_SHIFT_LIMIT )
179
- {
180
- entry_index &= mask ;
181
- }
182
- else
183
- {
184
- entry_index <<= shift_counter ;
185
- JERRY_ASSERT (entry_index <= mask );
186
- }
187
-
162
+ entry_index &= mask ;
188
163
#ifndef JERRY_NDEBUG
189
164
/* Because max_property_count (power of 2) and step (a prime
190
165
* number) are relative primes, all entries of the hasmap are
@@ -268,15 +243,8 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
268
243
uint32_t entry_index = ecma_string_hash (name_p );
269
244
uint32_t step = ecma_property_hashmap_steps [entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1 )];
270
245
uint32_t mask = hashmap_p -> max_property_count - 1 ;
246
+ entry_index &= mask ;
271
247
272
- if (mask < ECMA_PROPERTY_HASHMAP_SHIFT_LIMIT )
273
- {
274
- entry_index &= mask ;
275
- }
276
- else
277
- {
278
- entry_index <<= hashmap_p -> header .types [1 ];
279
- }
280
248
281
249
#ifndef JERRY_NDEBUG
282
250
/* See the comment for this variable in ecma_property_hashmap_create. */
@@ -351,15 +319,7 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
351
319
jmem_cpointer_t * pair_list_p = (jmem_cpointer_t * ) (hashmap_p + 1 );
352
320
uint8_t * bits_p = (uint8_t * ) (pair_list_p + hashmap_p -> max_property_count );
353
321
354
- if (mask < ECMA_PROPERTY_HASHMAP_SHIFT_LIMIT )
355
- {
356
- entry_index &= mask ;
357
- }
358
- else
359
- {
360
- entry_index <<= hashmap_p -> header .types [1 ];
361
- JERRY_ASSERT (entry_index <= mask );
362
- }
322
+ entry_index &= mask ;
363
323
364
324
#ifndef JERRY_NDEBUG
365
325
/* See the comment for this variable in ecma_property_hashmap_create. */
@@ -453,16 +413,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
453
413
uint32_t mask = hashmap_p -> max_property_count - 1 ;
454
414
jmem_cpointer_t * pair_list_p = (jmem_cpointer_t * ) (hashmap_p + 1 );
455
415
uint8_t * bits_p = (uint8_t * ) (pair_list_p + hashmap_p -> max_property_count );
456
-
457
- if (mask < ECMA_PROPERTY_HASHMAP_SHIFT_LIMIT )
458
- {
459
- entry_index &= mask ;
460
- }
461
- else
462
- {
463
- entry_index <<= hashmap_p -> header .types [1 ];
464
- JERRY_ASSERT (entry_index <= mask );
465
- }
416
+ entry_index &= mask ;
466
417
467
418
#ifndef JERRY_NDEBUG
468
419
/* See the comment for this variable in ecma_property_hashmap_create. */
0 commit comments