Reduce ecma_{ref, deref}_object calls while using ecma_builtin_get (#2616)
The following stucture was highly frequented in the code base: - Get a builtin object // This operation increases the reference count of the object - Use it for create a new object - Deref the builtin object After a builtin has been instantiated there is always at least one reference to "keep it alive", so increase/decrease the reference count for getting the value only is unnecessary. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
committed by
Zoltan Herczeg
parent
8410570dd9
commit
e11c499b4b
@@ -49,7 +49,7 @@ ecma_arraybuffer_new_object (ecma_length_t length) /**< length of the arraybuffe
|
||||
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
|
||||
sizeof (ecma_extended_object_t) + length,
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.extra_info = ECMA_ARRAYBUFFER_INTERNAL_MEMORY;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_ARRAY_BUFFER_UL;
|
||||
@@ -80,7 +80,7 @@ ecma_arraybuffer_new_object_external (ecma_length_t length, /**< length of the b
|
||||
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
|
||||
sizeof (ecma_arraybuffer_external_info),
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
ecma_arraybuffer_external_info *array_object_p = (ecma_arraybuffer_external_info *) object_p;
|
||||
array_object_p->extended_object.u.class_prop.extra_info = ECMA_ARRAYBUFFER_EXTERNAL_MEMORY;
|
||||
array_object_p->extended_object.u.class_prop.class_id = LIT_MAGIC_STRING_ARRAY_BUFFER_UL;
|
||||
|
||||
Reference in New Issue
Block a user