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
@@ -137,8 +137,6 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
|
||||
function_object_size,
|
||||
ECMA_OBJECT_TYPE_FUNCTION);
|
||||
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
/* 2., 6., 7., 8. */
|
||||
/*
|
||||
* We don't setup [[Get]], [[Call]], [[Construct]], [[HasInstance]] for each function object.
|
||||
@@ -215,9 +213,6 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
|
||||
arrow_function_object_size,
|
||||
ECMA_OBJECT_TYPE_ARROW_FUNCTION);
|
||||
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
|
||||
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) func_p;
|
||||
|
||||
ECMA_SET_NON_NULL_POINTER (arrow_func_p->scope_cp, scope_p);
|
||||
@@ -263,8 +258,6 @@ ecma_op_create_external_function_object (ecma_external_handler_t handler_cb) /**
|
||||
sizeof (ecma_extended_object_t),
|
||||
ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION);
|
||||
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
/*
|
||||
* [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION type.
|
||||
*
|
||||
@@ -1019,8 +1012,6 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
|
||||
ecma_object_t *prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
|
||||
new_this_obj_p = ecma_create_object (prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);
|
||||
|
||||
ecma_deref_object (prototype_p);
|
||||
}
|
||||
|
||||
ecma_free_value (prototype_prop_value);
|
||||
@@ -1179,8 +1170,6 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
|
||||
thrower_p,
|
||||
ECMA_PROPERTY_FIXED,
|
||||
&caller_prop_p);
|
||||
|
||||
ecma_deref_object (thrower_p);
|
||||
return caller_prop_p;
|
||||
}
|
||||
}
|
||||
@@ -1290,8 +1279,6 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
|
||||
thrower_p,
|
||||
ECMA_PROPERTY_FIXED,
|
||||
&caller_prop_p);
|
||||
|
||||
ecma_deref_object (thrower_p);
|
||||
return caller_prop_p;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user