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:
Robert Fancsik
2018-11-28 20:23:21 +01:00
committed by Zoltan Herczeg
parent 8410570dd9
commit e11c499b4b
24 changed files with 28 additions and 97 deletions
@@ -169,15 +169,13 @@ ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
else
{
/* 3.b. */
ecma_object_t *global_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL);
ecma_object_t *global_object_p = ecma_builtin_get_global ();
ecma_value_t completion = ecma_op_object_put (global_object_p,
var_name_string_p,
value,
false);
ecma_deref_object (global_object_p);
JERRY_ASSERT (ecma_is_value_boolean (completion));
return ECMA_VALUE_EMPTY;