mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fixing insertion to lookup cache: removing possibility of invalidation of entry during it's initialization, skipping empty entries during search for entry containing specified property.
This commit is contained in:
parent
2b9b729c37
commit
ee7ac6602b
@ -16,7 +16,6 @@
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-lcache.h"
|
||||
#include "globals.h"
|
||||
#include "mem-poolman.h"
|
||||
|
||||
@ -65,8 +64,6 @@ JERRY_STATIC_ASSERT (sizeof (ecma_label_descriptor_t) == sizeof (uint64_t));
|
||||
return p ## ecma_type; \
|
||||
} \
|
||||
\
|
||||
ecma_lcache_invalidate_all (); \
|
||||
\
|
||||
for (ecma_gc_gen_t gen_id = ECMA_GC_GEN_0; \
|
||||
gen_id < ECMA_GC_GEN_COUNT; \
|
||||
gen_id++) \
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-lcache.h"
|
||||
#include "globals.h"
|
||||
#include "jerry-libc.h"
|
||||
#include "jrt-bit-fields.h"
|
||||
@ -525,6 +526,8 @@ ecma_gc_sweep (ecma_object_t *object_p) /**< object to free */
|
||||
void
|
||||
ecma_gc_run (ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run collection on */
|
||||
{
|
||||
ecma_lcache_invalidate_all ();
|
||||
|
||||
JERRY_ASSERT(max_gen_to_collect < ECMA_GC_GEN_COUNT);
|
||||
|
||||
/* clearing visited flags for all objects of generations to be processed */
|
||||
|
||||
@ -147,6 +147,8 @@ ecma_lcache_insert (ecma_object_t *object_p, /**< object */
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (prop_name_p != NULL);
|
||||
|
||||
prop_name_p = ecma_copy_or_ref_ecma_string (prop_name_p);
|
||||
|
||||
ecma_string_hash_t hash_key = ecma_string_hash (prop_name_p);
|
||||
|
||||
if (prop_p != NULL)
|
||||
@ -159,8 +161,14 @@ ecma_lcache_insert (ecma_object_t *object_p, /**< object */
|
||||
int32_t entry_index;
|
||||
for (entry_index = 0; entry_index < ECMA_LCACHE_HASH_ROW_LENGTH; entry_index++)
|
||||
{
|
||||
if (ecma_lcache_hash_table[hash_key][entry_index].prop_cp == prop_cp)
|
||||
if (ecma_lcache_hash_table[hash_key][entry_index].object_cp != ECMA_NULL_POINTER
|
||||
&& ecma_lcache_hash_table[hash_key][entry_index].prop_cp == prop_cp)
|
||||
{
|
||||
#ifndef JERRY_NDEBUG
|
||||
ecma_object_t* obj_in_entry_p;
|
||||
obj_in_entry_p = ECMA_GET_NON_NULL_POINTER (ecma_lcache_hash_table[hash_key][entry_index].object_cp);
|
||||
JERRY_ASSERT (obj_in_entry_p == object_p);
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -195,8 +203,7 @@ ecma_lcache_insert (ecma_object_t *object_p, /**< object */
|
||||
|
||||
ecma_ref_object (object_p);
|
||||
ECMA_SET_NON_NULL_POINTER (ecma_lcache_hash_table[ hash_key ][ entry_index ].object_cp, object_p);
|
||||
ECMA_SET_NON_NULL_POINTER (ecma_lcache_hash_table[ hash_key ][ entry_index ].prop_name_cp,
|
||||
ecma_copy_or_ref_ecma_string (prop_name_p));
|
||||
ECMA_SET_NON_NULL_POINTER (ecma_lcache_hash_table[ hash_key ][ entry_index ].prop_name_cp, prop_name_p);
|
||||
ECMA_SET_POINTER (ecma_lcache_hash_table[ hash_key ][ entry_index ].prop_cp, prop_p);
|
||||
} /* ecma_lcache_insert */
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user